PageSourceSearch

https://www.rumbleinthegarden.com/_next/static/chunks/25_ky1bkmkmjj.js

js rumbleinthegarden.com collected 2026-09-25 02:36:09 UTC 593,457 bytes, 82 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="214e3156-40cb-1826-41c8-2295538d06e3")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,601459,e=>{"use strict";var t=e.i(478902);e.s(["default",0,({className:e,width:n=14,height:r=14})=>(0,t.jsxs)("svg",{className:e,width:n,height:r,strokeWidth:"2px",viewBox:"-0.25 -0.25 24.5 24.5",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M3.000 12.750 A9.000 9.000 0 1 0 21.000 12.750 A9.000 9.000 0 1 0 3.000 12.750 Z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M6 23.25L7.386 20.479",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M12 12.75L8.609 12.75",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M12 7.5L12 12.75",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M1.5 3.75L5.25 0.75",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M18 23.25L16.614 20.478",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M22.5 3.75L18.75 0.75",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]})])},174604,769861,e=>{"use strict";var t=e.i(478902);e.s(["default",0,({className:e,width:n,height:r})=>(0,t.jsxs)("svg",{className:e,width:n,height:r,fill:"transparent",strokeWidth:"2px",xmlns:"http://www.w3.org/2000/svg",viewBox:"-0.25 -0.25 24.5 24.5",children:[(0,t.jsx)("path",{stroke:"currentColor",d:"M12 17.25C11.7929 17.25 11.625 17.0821 11.625 16.875C11.625 16.6679 11.7929 16.5 12 16.5"}),(0,t.jsx)("path",{stroke:"currentColor",d:"M12 17.25C12.2071 17.25 12.375 17.0821 12.375 16.875C12.375 16.6679 12.2071 16.5 12 16.5"}),(0,t.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",d:"M12 13.5V5.25"}),(0,t.jsx)("path",{stroke:"currentColor",strokeMiterlimit:"10",d:"M12 23.25C18.2132 23.25 23.25 18.2132 23.25 12C23.25 5.7868 18.2132 0.75 12 0.75C5.7868 0.75 0.75 5.7868 0.75 12C0.75 18.2132 5.7868 23.25 12 23.25Z"})]})],174604);var n=e.i(197649),r={default:"_12ml3x22",error:"_12ml3x23"},i={default:"_12ml3x25",error:"_12ml3x26"};e.s(["default",0,({className:e,classNameText:o,classNameIcon:s,children:l,icon:a,color:c="default",...u})=>{let d=(0,n.default)("_12ml3x20",i[c],e);return(0,t.jsxs)("div",{className:d,...u,children:[a&&(0,t.jsx)("div",{className:(0,n.default)("_12ml3x21",r[c],s),children:a}),(0,t.jsx)("span",{className:(0,n.default)("_12ml3x24",o),children:l})]})}],769861)},447394,e=>{"use strict";var t=e.i(478902),n=e.i(197649),r=e.i(962973),i={regular:"_1rcalkz1 _1rcalkz0",primary:"_1rcalkz2 _1rcalkz0",outlined:"_1rcalkz3 _1rcalkz0",flat:"_1rcalkz4 _1rcalkz0"},o={regular:"_1rcalkz6",primary:"_1rcalkz7",outlined:"_1rcalkz8",flat:"_1rcalkz9"},s={small:"_1rcalkzb",regular:"_1rcalkzc",large:"_1rcalkzd"},l={primary:"_1rcalkze"};e.s(["default",0,({text:e,displayType:a="primary",className:c,textClassName:u,iconLeft:d,iconRight:h,fullWidth:p,size:f="regular",active:m=!1,uppercase:g=!1,color:y,...v})=>(0,t.jsxs)("href"in v?"a":"button",{className:(0,n.default)(r.SELECTORS.Button,i[a],m&&o[a],c&&c,p&&"_1rcalkza",g&&"_1rcalkz5",s[f],y&&l[y]),...v,children:[d&&(0,t.jsx)("span",{children:d}),(0,t.jsx)("span",{className:u,children:e}),h&&(0,t.jsx)("span",{children:h})]})],447394)},44305,510508,55092,751307,e=>{"use strict";var t=e.i(478902),n=e.i(389959),r=e.i(34321),i=e.i(948335),o=e.i(722010);e.i(555831);var s=e.i(249922),l=e.i(808660);let a=[o.AttachmentType.Twitter,o.AttachmentType.Youtube,o.AttachmentType.Link,o.AttachmentType.Instagram,o.AttachmentType.TikTok,o.AttachmentType.Bluesky];e.s(["default",0,({initialPreviewData:e,attachmentUrl:c,onRemoveAttachment:u,onUpdateAttachmentData:d,validAttachmentUrl:h})=>
2{let[p,f]=(0,n.useState)(null),[m,g]=(0,n.useState)(void 0),[y,v]=(0,n.useState)(void 0),[b,w]=(0,n.useState)(null),[x,C]=(0,n.useState)(null),[k,S]=(0,n.useState)(!!e),E=(0,n.useRef)(c);E.current=c,(0,n.useEffect)(()=>{if(e&&e[0]){let t=e[0];a.includes(t.type)&&f({url:t.url,type:t.type}),t.type===o.AttachmentType.Twitter&&v({html:t.html??void 0,authorName:t.authorName??void 0}),t.type===o.AttachmentType.Youtube&&v({html:t.html??void 0,thumbnailUrl:t.thumbnailUrl??void 0,thumbnailHeight:t.thumbnailHeight??void 0,thumbnailWidth:t.thumbnailWidth??void 0}),t.type===o.AttachmentType.Instagram&&v({html:t.html??void 0,thumbnailUrl:t.thumbnailUrl??void 0,thumbnailHeight:t.thumbnailHeight??void 0,thumbnailWidth:t.thumbnailWidth??void 0}),t.type===o.AttachmentType.TikTok&&v({html:t.html??void 0,thumbnailUrl:t.thumbnailUrl??void 0,thumbnailHeight:t.thumbnailHeight??void 0,thumbnailWidth:t.thumbnailWidth??void 0}),t.type===o.AttachmentType.Bluesky&&v({html:t.html??void 0,thumbnailUrl:t.thumbnailUrl??void 0,thumbnailHeight:t.thumbnailHeight??void 0,thumbnailWidth:t.thumbnailWidth??void 0}),t.type===o.AttachmentType.Link&&g({ogTitle:t.ogTitle??void 0,ogDescription:t.ogDescription??void 0,ogSiteName:t.ogSiteName??void 0,publishedAt:t.publishedAt??void 0,ogImage:t.ogImage??void 0})}},[e]),(0,n.useEffect)(()=>{d(p?{...p,...m,...y,heightToWidthRatio:b??null}:null)},[p,d,m,y,b]),(0,n.useEffect)(()=>{let e=!1;async function t(){if(!p){v(void 0),g(void 0);return}let t=p.url,n=()=>!e&&E.current===t,r=!1;C("loading");try{if(p.type===o.AttachmentType.Link){let e=await (0,i.fetchOpengraphData)(p.url);if(!n())return;g(e);return}if(p.type===o.AttachmentType.Twitter||p.type===o.AttachmentType.Youtube||p.type===o.AttachmentType.Instagram||p.type===o.AttachmentType.TikTok||p.type===o.AttachmentType.Bluesky){let e=await (0,i.fetchOembedData)(p);if(!n())return;if((0,i.shouldFallbackYoutubeAttachmentToLink)(p.type,e)){r=!0,v(void 0),f({type:o.AttachmentType.Link,url:t});return}if(!e)return;v({html:e.html??void 0,thumbnailUrl:(e.thumbnail_url||e.links?.thumbnail?.[0]?.href)??void 0,thumbnailHeight:(e.thumbnail_height||e.links?.thumbnail?.[0]?.media?.height)??void 0,thumbnailWidth:(e.thumbnail_width||e.links?.thumbnail?.[0]?.media?.width)??void 0,authorName:(e.author_name||e.meta?.author)??void 0})}}finally{n()&&!r&&C("done")}}return k||t(),()=>{e=!0}},[p,k]),(0,n.useEffect)(()=>{k||function(){if(c&&""!==c&&h)return f({type:(0,i.getAttachmentType)(c),url:c});f(null)}()},[c,h,k]);let T=(0,n.useCallback)(e=>{u(e),v(void 0),g(void 0),S(!1)},[u]),M=(0,n.useCallback)(e=>{e.height&&e.width&&w(e.height/e.width)},[]);return p?(0,t.jsx)("div",{className:"_1wwrzz20",children:"loading"===x?(0,t.jsx)("div",{className:"_1wwrzz21",children:(0,t.jsx)(r.default,{background:"gray",height:"full"})}):(0,t.jsx)(s.default,{onRemove:e=>{T(e)},onDimensionsChange:e=>M(e),type:l.AttachmentDisplayType.preview,attachment:{id:"preview",...p,...y,...m}})}):null},"supportedPreviewTypes",0,a],44305),e.s(["advancedComposerContainer",0,"_1hcu36qj","advancedCreateLink",0,"_1hcu36qs","animatedContainer",0,"_1hcu36q1","avatarContainer",0,"_1hcu36q5","belowEditor",0,"_1hcu36qk","belowEditorCoral",0,"_1hcu36qv","border",0,"_1hcu36q4","bottomBar",0,"_1hcu36qi","buttonContainer",0,"_1hcu36qn","cancelButton",0,"_1hcu36qt","composerBottom",0,"_1hcu36q8","composerContainer",0,"_1hcu36q6","composerContent",0,"_1hcu36q9","composerTop",0,"_1hcu36q7","container",0,"_1hcu36q2","coralBottomButtonsContainer",0,"_1hcu36qy","coralComposerContainer",0,"_1hcu36qw","coralComposerContent",0,"_1hcu36qx","coralEditExpiredCallout",0,"_1hcu36qz","coralEditRemainingTime",0,"_1hcu36q10","editCountdownText",0,"_1hcu36qp","editCountdownWrapper",0,"_1hcu36qo","editUrgentText",0,"_1hcu36qq","editorContainer",0,"_1hcu36qb","gifSearchContainer",0,"_1hcu36qu","hiddenImagesInput",0,"_1hcu36qg","iconButton",0,"_1hcu36ql","input",0,"_1hcu36qd","inputWrapper",0,"_1hcu36qf","linkIcon",0,"_1hcu36qm","loadingWrapper",0,"_1hcu36qh","parentComposerContainer",0,"_1hcu36q3","title",0,"_1hcu36qe","usernameContainer",0,"_1hcu36qa","warningText",0,"_1hcu36qr"],510508),e.s(["editorContainer",0,{default:"_14jmyir1 _14jmyir0 _12grc8k1",reply:"_14jmyir2 _14jmyir0 _12grc8k1",advanced:"_14jmyir3 _14jmyir0 _12grc8k1",coral:"_14jmyir4 _14jmyir0 _12grc8k2 _12grc8k1"}],55092),e.i(807738);var c=e.i(738886),u="_12ls96h1",d="_12ls96h2",h="_12ls96h3";e.s(["default",0,({linkBeingFormatted:e,onSaveLink:n,onCancelLink:r,onUpdateLinkHref:i,onUpdateLinkText:o})=>(0,t.jsxs)("div",{className:"_12ls96h0",children:[(0,t.jsxs)("div",{className:u,children:[(0,t.jsx)("label",{className:h,htmlFor:"linkText",children:"text"}),(0,t.jsx)("input",{className:d,name:"linkText",type:"text",value:e?.text??"",onChange:o})]}),(0,t.jsxs)("div",{className:u,children:[(0,t.jsx)("label",{className:h,htmlFor:"linkHref",children:"link"}),(0,t.jsx)("input",{className:d,name:"linkHref",type:"text",value:e?.href??"",onChange:i})]}),(0,t.jsxs)("div",{className:"_12ls96h4",children:[(0,t.jsx)(c.default,{className:"_12ls96h6",displayType:"cyclone",text:"Cancel",onClick:r}),(0,t.jsx)(c.default,{className:"_12ls96h5",displayType:"cyclone",text:"Save",onClick:n})]})]})],751307)},245915,431491,106058,137081,66878,44824,47696,647876,e=>{"use strict";var t=e.i(478902);let n=e=>!!(e&&e.trim().length>0);e.s(["isValidUsername",0,n],431491);var r=e.i(970060);let i=e=>!!e&&n(e.commentingName),o=e=>!!e&&!!e.emailVerified;e.s(["AuthErrorMessage",0,({user:e})=>{let n;if(!e)return null;let s=i(e),l=o(e);return s&&l?null:(l||s?l?s||(n="add a commenting name"):n="verify your email address":n="verify your email address and add a commenting name",(0,t.jsx)("div",{className:"wipgme0",children:(0,t.jsxs)("div",{className:"wipgme1",children:["Looks like you're signed in, but still need to"," ",(0,t.jsx)("a",{href:"/account/profile",className:r.sharedStyles.text.singleLink,children:n}),". If you believe you've already done that, try"," ",(0,t.jsx)("a",{role:"button",href:"#",className:r.sharedStyles.text.singleLink,onClick:()=>location.reload(),children:"reloading the page"}),". Please note that your first few comments may be reviewed by our site moderators."]})}))},"userHasCommentingName",0,i,"userHasVerifiedEmail",0,o],245915);var s=e.i(197649);e.s(["CharacterCount",0,({characters:e,maxCharacterCount:n,showCountAtCharacters:r})=>{let i=Math.round(100/n*e),o=e>n;return(0,t.jsx)(t.Fragment,{children:e>
2r&&(0,t.jsxs)("div",{className:(0,s.default)("z4twd0",o&&"z4twd2"),children:[(0,t.jsxs)("svg",{height:"20",width:"20",viewBox:"0 0 20 20",className:"z4twd1",children:[(0,t.jsx)("circle",{r:"10",cx:"10",cy:"10",fill:"#e9ecef"}),(0,t.jsx)("circle",{r:"5",cx:"10",cy:"10",fill:"transparent",stroke:"currentColor",strokeWidth:"10",strokeDasharray:`calc(${i} * 31.4 / 100) 31.4`,transform:"rotate(-90) translate(-20)"}),(0,t.jsx)("circle",{r:"6",cx:"10",cy:"10",fill:"white"})]}),o?`${n-e} characters`:`${e} / ${n} characters`]})})}],106058);let l=({className:e,width:n,height:r})=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"-0.25 -0.25 24.5 24.5",className:e,width:n,height:r,fill:"none",children:[(0,t.jsx)("path",{stroke:"currentColor",d:"M12 19.5C11.7929 19.5 11.625 19.3321 11.625 19.125C11.625 18.9179 11.7929 18.75 12 18.75"}),(0,t.jsx)("path",{stroke:"currentColor",d:"M12 19.5C12.2071 19.5 12.375 19.3321 12.375 19.125C12.375 18.9179 12.2071 18.75 12 18.75"}),(0,t.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",d:"M12 15.75V8.25"}),(0,t.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M13.621 1.76001C13.4722 1.45702 13.2414 1.20181 12.9549 1.02333C12.6684 0.844851 12.3376 0.750244 12 0.750244C11.6624 0.750244 11.3316 0.844851 11.0451 1.02333C10.7586 1.20181 10.5278 1.45702 10.379 1.76001L0.90601 21.058C0.79198 21.29 0.738946 21.5472 0.751916 21.8053C0.764886 22.0635 0.843432 22.3141 0.980137 22.5334C1.11684 22.7528 1.3072 22.9337 1.53324 23.0591C1.75927 23.1845 2.01353 23.2502 2.27201 23.25H21.728C21.9865 23.2502 22.2407 23.1845 22.4668 23.0591C22.6928 22.9337 22.8832 22.7528 23.0199 22.5334C23.1566 22.3141 23.2351 22.0635 23.2481 21.8053C23.2611 21.5472 23.208 21.29 23.094 21.058L13.621 1.76001Z"})]});e.s(["CharacterCountCoral",0,({characters:e,maxCharacterCount:n})=>{let r=e>n;return(0,t.jsx)(t.Fragment,{children:n>0&&(0,t.jsxs)("div",{className:(0,s.default)("_17jyp680",r&&"_17jyp682"),children:[r&&(0,t.jsx)(l,{className:"_17jyp681"}),`${(n-e).toLocaleString()} characters remaining`]})})}],137081);var a=e.i(389959),c=e.i(655744),u=function(e){var t=e.as,n=e.errors,r=e.name,i=e.message,o=e.render,s=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,["as","errors","name","message","render"]),l=(0,c.useFormContext)(),u=(0,c.get)(n||l.formState.errors,r);if(!u)return null;var d=u.message,h=u.types,p=Object.assign({},s,{children:d||i});return a.isValidElement(t)?a.cloneElement(t,p):o?o({message:d||i,messages:h}):a.createElement(t||a.Fragment,p)};let d=({className:e="",width:n=40,height:r=40,fill:i="none"})=>(0,t.jsxs)("svg",{className:e,width:n,height:r,fill:i,viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("title",{children:"Info"}),(0,t.jsx)("path",{d:"M6.4165 4.08329H7.58317V5.24996H6.4165V4.08329ZM6.4165 6.41663H7.58317V9.91663H6.4165V6.41663ZM6.99984 1.16663C3.77984 1.16663 1.1665 3.77996 1.1665 6.99996C1.1665 10.22 3.77984 12.8333 6.99984 12.8333C10.2198 12.8333 12.8332 10.22 12.8332 6.99996C12.8332 3.77996 10.2198 1.16663 6.99984 1.16663ZM6.99984 11.6666C4.42734 11.6666 2.33317 9.57246 2.33317 6.99996C2.33317 4.42746 4.42734 2.33329 6.99984 2.33329C9.57234 2.33329 11.6665 4.42746 11.6665 6.99996C11.6665 9.57246 9.57234 11.6666 6.99984 11.6666Z"})]});var h=e.i(95411);e.s(["default",0,({errors:e,name:n})=>(0,t.jsx)(u,{errors:e,name:n,render:({message:e})=>(0,t.jsxs)("div",{className:"_1rxiadt0",children:[(0,t.jsx)(d,{fill:h.default.sys.color.alert,width:12,height:12}),e]})})],66878),e.i(807738);var p=e.i(738886),f={default:"_1u9c6k11 _1u9c6k10",coral:"_1u9c6k12 _1u9c6k10",reply:"_1u9c6k13 _1u9c6k10",advanced:"_1u9c6k14 _1u9c6k10"},m={default:"_1u9c6k16 _1u9c6k15",coral:"_1u9c6k17 _1u9c6k15",reply:"_1u9c6k18 _1u9c6k15",advanced:"_1u9c6k19 _1u9c6k15"},g={default:"_1u9c6k1b _1u9c6k1a",coral:"_1u9c6k1c _1u9c6k1a",reply:"_1u9c6k1d _1u9c6k1a",advanced:"_1u9c6k1e _1u9c6k1a"},y={default:"_1u9c6k1g _1u9c6k1f",coral:"_1u9c6k1h _1u9c6k1f",reply:"_1u9c6k1i _1u9c6k1f",advanced:"_1u9c6k1j _1u9c6k1f"};
2e.s(["ButtonFormat",0,({displayType:e="default",onClick:n,active:r,text:i,icon:o,"aria-label":l,disabled:c})=>(0,t.jsx)(p.default,{className:(0,s.default)(f[e],!i&&m[e]),displayType:"cycloneSecondary",onClick:n,text:i||"",active:r,"aria-label":l,iconLeft:o&&(0,a.cloneElement)(o,{className:(0,s.default)(o.props.className,g[e],r&&y[e])}),disabled:c})],44824);var v=e.i(597406),b=e.i(396902),w=e.i(533066);let x=({gif:e,onSelect:n})=>{let r=(0,a.useCallback)(()=>{n(e)},[e,n]);return(0,t.jsx)("button",{className:"_18ighlw0",onClick:r,children:(0,t.jsx)("img",{src:e.preview,className:"_18ighlw1",alt:e.title})})},C=({gifs:e,onSelectGif:n,numColumns:r})=>{let i=(0,a.useMemo)(()=>{let t=[];for(let e=0;e<r;e++)t.push([]);let n=0;for(let i=0;i<e.length;i++){let o=t[n],s=e[i];s&&o?.push(s),++n>=r&&(n=0)}return t},[e,r]);return(0,t.jsx)("div",{className:"_18ighlw2",children:i.map((e,r)=>(0,t.jsx)("div",{className:"_18ighlw3",children:e.map((e,r)=>(0,t.jsx)(x,{gif:e,onSelect:n},`${e.id}-${r}`))},`gif-result-column-${r}`))})},k=({gifs:e,showLoadMore:n,onSelectGif:r,onLoadMore:i})=>{let o=(0,a.useRef)(null),[s,l]=(0,a.useState)(0),c=(0,a.useCallback)(()=>{o.current?l(o.current.getBoundingClientRect().width/125):l(0)},[o,l]);return(0,a.useEffect)(()=>(window.requestAnimationFrame(c),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}),[e,c]),(0,t.jsxs)("div",{className:"_18ighlw4",ref:o,children:[s>0&&(0,t.jsx)(C,{gifs:e,onSelectGif:r,numColumns:s}),n&&(0,t.jsx)("div",{className:"_18ighlw5",children:(0,t.jsx)(p.default,{text:"Load more",onClick:e=>{e.preventDefault(),i()}})})]})};e.s(["default",0,({onSelect:e})=>{var n;let r,{user:i}=(0,v.useAuth)(),{cycloneConfig:{serverURL:o}}=(0,b.useConfigContext)(),[s,l]=(0,a.useState)(null),[d,h]=(0,a.useState)([]),[p,f]=(0,a.useState)(null),{control:m,formState:{errors:g},setError:y,watch:x}=(0,c.useForm)({defaultValues:{Query:""}}),C=x("Query",""),S=(0,a.useCallback)(async(e,t)=>{let n=new URL("/klipy/search",o);n.searchParams.set("query",e),t&&n.searchParams.set("pos",t);let r=await fetch(n.toString(),{headers:{Authorization:`Bearer ${i?.cycloneToken}`}});if(!r.ok)return y("root",{type:"manual",message:"Something went wrong, please try again."}),{results:[]};let s=await r.json();return s||void y("root",{type:"manual",message:"Something went wrong, please try again."})},[y,o,i]),E=(0,a.useCallback)(async({Query:e})=>{let t=await S(e);t&&(h(t.results),f(t.next))},[h,f,S]),T=(0,a.useCallback)(async()=>{if(!p)return;let e=await S(C.trim(),p);e&&(h([...d,...e.results]),e.next!==p?f(e.next):f(null))},[d,h,f,p,C,S]),M=(n=(0,a.useCallback)(()=>{let e=C.trim();e&&0!==e.length?e!==s&&(l(e),E({Query:e})):h([])},[C,s,l,h,E]),r=(0,a.useRef)(n),(0,a.useLayoutEffect)(()=>{r.current=n}),(0,a.useMemo)(()=>(0,w.default)((...e)=>{r.current(...e)},500),[500]));(0,a.useEffect)(()=>{M()},[C,M]);let O=(0,a.useCallback)(t=>{e(t)},[e]);return(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Controller,{control:m,rules:{required:!0},render:({field:{onChange:e,onBlur:n,value:r}})=>(0,t.jsx)("input",{className:"_15kpxkh0",placeholder:"Search KLIPY",type:"text",onChange:e,value:r,onBlur:n,onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()}}),name:"Query"}),g.Query&&(0,t.jsx)(u,{errors:g,name:"Query"}),d.length>0&&(0,t.jsx)(k,{gifs:d,showLoadMore:!!p,onSelectGif:O,onLoadMore:()=>{T()}})]})}],47696),e.s([],647876)},533599,e=>{"use strict";var t,n=e.i(478902),r=e.i(578746),i=e.i(437944),o=e.i(200381),s=e.i(932451),l=e.i(458938),a=e.i(197649),c=e.i(701447),u=e.i(533066),d=e.i(389959),h=e.i(655744),p=e.i(576164),f=e.i(427232),m=e.i(601459),g=e.i(174604),y=e.i(769861),v=e.i(447394),b=e.i(245915),w=e.i(106058),x=e.i(137081),C=e.i(66878),k=e.i(44824);e.i(647876);var S=e.i(47696),E=e.i(34321),T=e.i(597406),M=e.i(798240),O=e.i(396902),A=e.i(623690),N=e.i(948335),R=e.i(649784),j=e.i(465149),D=e.i(657569),I=e.i(722010),P=e.i(761201),L=e.i(431491),_=e.i(738886);e.i(555831);var V=e.i(249922),B=e.i(808660);e.i(977082);var H=e.i(239981);e.i(819366);var F=e.i(384076);e.i(431686);var z=e.i(371536),$=e.i(557380),W=e.i(407570),q=e.i(220255),U=e.i(195826),K=e.i(322226),J=e.i(553662),Z=e.i(44305),G=e.i(510508),Y=e.i(55092),X=e.i(751307),Q=e.i(678506),ee=e.i(970060);let et=({editor:e,editorState:t,showInBubbleMenu:r=!0,displayType:i})=>{let[o,s]=(0,d.useState)(null),[l,a]=(0,d.useState)(null),c=(0,d.useRef)(null),u=(0,d.useRef)(null),h=(0,d.useCallback)(t=>{if(t.preventDefault(),e.state.selection.empty)s({href:"",text:""});else{let{from:t,to:n}=e.state.selection;a({from:t,to:n}),s({href:e.getAttributes("link").href,text:e.state.doc.textBetween(t,n)})}r||c.current?.click()},[e,r,c]),p=(0,d.useCallback)(()=>{u.current?.click(),s(null),a(null)},[u]),f=(0,d.useCallback)(()=>
2{if(o?.href&&o.text){let t=o.href.trim();/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(t)||(t="http://"+t),e.commands.setLink({href:t,target:"_blank"}),l?o.text!==e.state.doc.textBetween(l.from,l.to)&&e.chain().focus().insertContentAt({from:l.from,to:l.to},o.text).setTextSelection({from:l.from,to:l.to}).setLink({href:t,target:"_blank"}).run():e.chain().focus().insertContent(o.text).run()}else e.chain().focus().unsetLink().run();p()},[e,o,l,p]),m=(0,d.useCallback)(()=>{p()},[p]),g=(0,d.useCallback)(e=>{s(t=>({text:t?.text??"",href:e.target.value}))},[]),y=(0,d.useCallback)(e=>{s(t=>({text:e.target.value,href:t?.href??""}))},[]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q.default,{Trigger:(0,n.jsx)("div",{ref:c,className:ee.sharedStyles.layout.hide}),CloseButton:(0,n.jsx)("div",{ref:u,className:ee.sharedStyles.layout.hide}),side:"top",children:(0,n.jsx)(X.default,{onSaveLink:f,onCancelLink:m,linkBeingFormatted:o,onUpdateLinkText:y,onUpdateLinkHref:g})}),(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:h,active:!!t.isLink,icon:(0,n.jsx)(W.default,{})})]})},en=({className:e="",width:t=24,height:r=24,fill:i="currentColor"})=>(0,n.jsxs)("svg",{className:e,width:t,height:r,viewBox:"0 -960 960 960",fill:i,xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("title",{children:"Format Bold"}),(0,n.jsx)("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})]}),er=({className:e="",width:t=24,height:r=24,fill:i="currentColor"})=>(0,n.jsxs)("svg",{className:e,width:t,height:r,viewBox:"0 -960 960 960",fill:i,xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("title",{children:"Format Italic"}),(0,n.jsx)("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})]}),ei=({className:e="",width:t=24,height:r=24,fill:i="currentColor"})=>(0,n.jsxs)("svg",{className:e,width:t,height:r,viewBox:"0 -960 960 960",fill:i,xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("title",{children:"Format List"}),(0,n.jsx)("path",{d:"M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"})]}),eo=({className:e="",width:t=24,height:r=24,fill:i="currentColor"})=>(0,n.jsxs)("svg",{className:e,width:t,height:r,viewBox:"0 -960 960 960",fill:i,xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("title",{children:"Format Numbered"}),(0,n.jsx)("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})]}),es=({className:e="",width:t=24,height:r=24,fill:i="currentColor"})=>(0,n.jsxs)("svg",{className:e,width:t,height:r,viewBox:"0 0 24 24",fill:i,xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("title",{children:"Format Quote"}),(0,n.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.jsx)("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})]}),el=({className:e="",width:t=24,height:r=24,fill:i="currentColor"})=>(0,n.jsxs)("svg",{className:e,width:t,height:r,viewBox:"0 0 40 40",fill:"transparent",xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("title",{children:"Format Spoiler"}),(0,n.jsx)("g",{clipPath:"url(#clip0_59_10789)",children:(0,n.jsx)("path",{d:"M29.9 29.8998C27.051 32.0715 23.5818 33.2746 20 33.3332C8.33332 33.3332 1.66666 19.9998 1.66666 19.9998C3.73981 16.1363 6.61521 12.7608 10.1 10.0998M16.5 7.0665C17.6472 6.79797 18.8218 6.66374 20 6.6665C31.6667 6.6665 38.3333 19.9998 38.3333 19.9998C37.3216 21.8925 3
26.1151 23.6744 34.7333 25.3165M23.5333 23.5332C23.0756 24.0244 22.5236 24.4184 21.9102 24.6917C21.2969 24.965 20.6348 25.1119 19.9635 25.1238C19.2921 25.1356 18.6253 25.0121 18.0027 24.7607C17.3801 24.5092 16.8145 24.1349 16.3397 23.6601C15.8649 23.1853 15.4906 22.6197 15.2392 21.9972C14.9877 21.3746 14.8642 20.7077 14.876 20.0364C14.8879 19.365 15.0348 18.7029 15.3081 18.0896C15.5814 17.4763 15.9754 16.9243 16.4667 16.4665M1.66666 1.6665L38.3333 38.3332",stroke:i,strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),ea=({className:e="",width:t=24,height:r=24,fill:i="currentColor"})=>(0,n.jsxs)("svg",{className:e,width:t,height:r,viewBox:"0 0 20 21",fill:i,xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("title",{children:"Format Strike"}),(0,n.jsx)("path",{d:"M17.3496 10.2292V11.6121H14.0098L14.1465 11.8396C14.5154 12.4519 14.5254 13.1331 14.5254 13.3796C14.5252 14.6371 13.9271 15.4348 13.0996 15.9255C12.2635 16.4214 11.1891 16.6042 10.2588 16.6042C8.30464 16.6042 6.31907 15.7753 5.6748 13.9539C5.56281 13.6389 5.50119 13.2364 5.48828 12.8376H7.66504C7.69889 13.6152 7.99412 14.1417 8.46094 14.4714C8.94782 14.8152 9.59542 14.9294 10.25 14.9294C10.883 14.9294 11.3938 14.7851 11.75 14.5154C12.1108 14.2421 12.2998 13.8491 12.2998 13.3875C12.2998 12.8378 12.114 12.4768 11.7881 12.2097C11.477 11.9548 11.0419 11.7904 10.5713 11.6062L10.5449 11.5955H2.65039V10.2292H17.3496ZM10.2002 4.39624C11.5383 4.39628 12.6334 4.7961 13.3506 5.42554L13.3535 5.42749C13.9402 5.92289 14.4692 6.73272 14.5127 7.86206H12.3018C12.2884 7.64711 12.2472 7.4466 12.1748 7.25659H12.1758C11.9043 6.45157 11.063 6.08765 10.1582 6.08765C9.35589 6.08767 8.82702 6.30842 8.49805 6.62573C8.17027 6.94195 8.05862 7.33733 8.05859 7.65405C8.05859 8.11722 8.30388 8.49233 8.74121 8.78687L8.74219 8.78784C8.90339 8.8939 9.0684 8.99597 9.26074 9.09546H6.24512C6.07938 8.8207 5.85847 8.39779 5.8584 7.64624C5.8584 6.5727 6.37042 5.76576 7.16699 5.22241C7.96833 4.67595 9.05981 4.39624 10.2002 4.39624Z",strokeWidth:"0.3"})]});var ec={default:"_1b9962y1 _1b9962y0",coral:"_1b9962y2 _1b9962y0",reply:"_1b9962y3 _1b9962y0",advanced:"_1b9962y4 _1b9962y0"},eu={default:"_1b9962y6 _1b9962y5",coral:"_1b9962y7 _1b9962y5",reply:"_1b9962y8 _1b9962y5",advanced:"_1b9962y9 _1b9962y5"};let ed=({children:e,editor:t})=>
2(0,n.jsx)(s.BubbleMenu,{editor:t,tippyOptions:{duration:100},children:e});var eh=((t={})[t.BOLD=0]="BOLD",t[t.ITALIC=1]="ITALIC",t[t.BULLET_LIST=2]="BULLET_LIST",t[t.BLOCKQUOTE=3]="BLOCKQUOTE",t[t.ORDERED_LIST=4]="ORDERED_LIST",t[t.LINK=5]="LINK",t[t.STRIKE=6]="STRIKE",t[t.SARCASM=7]="SARCASM",t[t.SPOILER=8]="SPOILER",t);let ep=({editor:e,showInBubbleMenu:t=!0,options:r=[0,1,2,3,4,6,7,8],displayType:i="default",extraButtons:o})=>{let l=(0,s.useEditorState)({editor:e,selector:({editor:e})=>({isBold:e.isActive("bold"),isItalic:e.isActive("italic"),isBulletList:e.isActive("bulletList"),isBlockquote:e.isActive("blockquote"),isOrderedList:e.isActive("orderedList"),isLink:e.isActive("link"),isStrike:e.isActive("strike"),isSarcasm:e.isActive("sarcasm"),isSpoiler:e.isActive("spoiler")})}),c=(0,n.jsxs)("div",{className:(0,a.default)(ec[i]),children:[r.includes(0)&&(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:t=>{t.preventDefault(),e.chain().focus().toggleBold().run()},icon:(0,n.jsx)(en,{}),active:!!l.isBold,"aria-label":"Bold"}),r.includes(1)&&(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:t=>{t.preventDefault(),e.chain().focus().toggleItalic().run()},icon:(0,n.jsx)(er,{}),active:!!l.isItalic,"aria-label":"Italic"}),r.includes(5)&&(0,n.jsx)(et,{displayType:i,editor:e,editorState:l,showInBubbleMenu:t}),r.includes(2)&&(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:t=>{t.preventDefault(),e.chain().focus().toggleBulletList().run()},icon:(0,n.jsx)(ei,{}),active:!!l.isBulletList,"aria-label":"Format List"}),r.includes(4)&&(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:t=>{t.preventDefault(),e.chain().focus().toggleOrderedList().run()},icon:(0,n.jsx)(eo,{}),active:!!l.isOrderedList,"aria-label":"Format Numbered"}),r.includes(3)&&(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:t=>{t.preventDefault(),e.chain().focus().toggleBlockquote().run()},icon:(0,n.jsx)(es,{}),active:!!l.isBlockquote,"aria-label":"Format Quote"}),r.includes(6)&&(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:t=>{t.preventDefault(),e.chain().focus().toggleStrike().run()},icon:(0,n.jsx)(ea,{}),active:!!l.isStrike,"aria-label":"Format Strike"}),r.includes(7)&&(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:t=>{t.preventDefault(),e.chain().focus().toggleSarcasm().run()},text:"Sarcasm",active:!!l.isSarcasm,"aria-label":"Sarcasm"}),r.includes(8)&&(0,n.jsx)(k.ButtonFormat,{displayType:i,onClick:t=>{t.preventDefault(),e.chain().focus().toggleSpoiler().run()},active:!!l.isSpoiler,"aria-label":"Spoiler",icon:(0,n.jsx)(el,{className:(0,a.default)("_1b9962ya",!!l.isSpoiler&&eu[i])})}),o]});return t?(0,n.jsx)(ed,{editor:e,children:c}):(0,n.jsx)(n.Fragment,{children:c})},ef=({editor:e,displayType:t="default",toolbarPosition:r,extraButtons:i})=>{let o;"advanced"===t&&(o=[eh.BOLD,eh.ITALIC,eh.LINK,eh.BULLET_LIST,eh.BLOCKQUOTE,eh.ORDERED_LIST,eh.STRIKE,eh.SARCASM,eh.SPOILER]);let l=(0,n.jsx)(ep,{editor:e,options:o,showInBubbleMenu:"bubbleMenu"===r,displayType:t,extraButtons:i});return(0,n.jsxs)(n.Fragment,{children:[("top"===r||"bubbleMenu"===r)&&l,(0,n.jsx)("div",{className:(0,a.default)(Y.editorContainer[t]),children:(0,n.jsx)(s.EditorContent,{editor:e})}),"bottom"===r&&l]})};var em=e.i(366392);let eg=em.Mark.create({name:"sarcasm",addOptions:()=>({HTMLAttributes:{class:"sarcasm"}}),parseHTML:()=>[{tag:"span.sarcasm"}],renderHTML:({HTMLAttributes:e})=>["span",{...e,class:["sarcasm",e.class].filter(Boolean).join(" ")},0],addCommands(){return{unsetSarcasm:()=>({commands:e})=>e.unsetMark(this.name),setSarcasm:()=>({commands:e})=>e.setMark(this.name),toggleSarcasm:()=>({commands:e})=>e.toggleMark(this.name)}}}),ey=em.Mark.create({name:"spoiler",addOptions:()=>({HTMLAttributes:{class:"spoiler"}}),parseHTML:()=>[{tag:"span.spoiler"}],renderHTML:({HTMLAttributes:e})=>["span",{...e,class:["spoiler",e.class].filter(Boolean).join(" ")},0],addCommands(){return{unsetSpoiler:()=>({commands:e})=>e.unsetMark(this.name),setSpoiler:()=>({commands:e})=>e.setMark(this.name),toggleSpoiler:()=>({commands:e})=>e.toggleMark(this.name)}}}),ev=({className:e="",fill:t="currentColor",width:r=24,height:i=24})=>(0,n.jsx)("svg",{className:e,width:r,height:i,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)("path",{d:"M19 13H13V19H11V13H5V11H11V5H13V11H19V13Z",fill:t})}),eb=({className:e="",fill:t="currentColor",width:r=24,height:i=24})=>(0,n.jsx)("svg",{className:e,width:r,height:i,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)("path",{d:"M12 8C13.1 8 14 7.1 14 6C14 4.9 13.1 4 12 4C10.9 4 10 4.9 10 6C10 7.1 10.9 8 12 8ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10ZM12 16C10.9 16 10 16.9 10 18C10 19.1 10.9 20 12 20C13.1 20 14 19.1 14 18C14 16.9 13.1 16 12 16Z",fill:t})}),ew=["PollOptionNameRequiredError","PollTooFewOptionsError","PollTooManyOptionsError","PollOptionNameExceedsMaxLength","PollDuplicateOptionNameError","PollInvalidDurationError","PollRequiresStaffRoleError","PollInputConflictError","AdOnlyPollDurationNotAllowedError"],ex=[1,2,3,4,5,6,7];var eC="ui82722";
2let ek=({value:e,onChange:t,onClose:r,openEnded:i=!1,required:o=!1})=>{let s=(0,d.useRef)(null),[l,c]=(0,d.useState)(null),u=e?.options??[{name:""},{name:""}],h=e?.durationDays??3,p=u.length<6,f=u.length>2,m=e=>{i?t({options:e}):t({options:e,durationDays:h})},g=e=>{s.current=e},y=()=>{let e=s.current;if(s.current=null,c(null),null===e||null===l||e===l)return;let t=[...u],n=t.splice(e,1)[0];n&&(t.splice(l,0,n),m(t))};return(0,n.jsxs)("div",{className:"ui82720",children:[(0,n.jsxs)("div",{className:"ui82721",children:[i?(0,n.jsx)("div",{className:eC,children:(0,n.jsx)("span",{children:"Open-ended — GAM creative flighting controls visibility"})}):(0,n.jsxs)("div",{className:eC,children:[(0,n.jsx)("span",{children:"Poll ends in"}),(0,n.jsx)("select",{className:"ui82723",value:h,onChange:e=>{t({options:u,durationDays:Number(e.target.value)})},children:ex.map(e=>(0,n.jsxs)("option",{value:e,children:[e," day",1===e?"":"s"]},e))})]}),!o&&(0,n.jsx)("button",{type:"button",className:"ui82724",onClick:r,"aria-label":"Remove poll",children:"✕"})]}),u.map((e,t)=>{let r=l===t&&null!==s.current;return(0,n.jsxs)("div",{className:(0,a.default)("ui82726",r&&"ui82727"),onDragOver:e=>{e.preventDefault(),c(t)},children:[(0,n.jsx)("span",{className:"ui82725",draggable:!0,onDragStart:()=>g(t),onDragEnd:y,onTouchStart:()=>g(t),onTouchEnd:y,"aria-label":`Drag to reorder option ${t+1}`,children:(0,n.jsx)(eb,{width:24,height:24})}),(0,n.jsx)("input",{type:"text",className:"ui82728",placeholder:`Option ${t+1}`,value:e.name,onChange:e=>{var n;return n=e.target.value,void m(u.map((e,r)=>r===t?{name:n}:e))},maxLength:30}),f&&(0,n.jsx)("button",{type:"button",className:"ui82729",onClick:()=>{u.length<=2||m(u.filter((e,n)=>n!==t))},"aria-label":`Remove option ${t+1}`,children:"×"})]},t)}),(0,n.jsxs)("button",{type:"button",className:"ui8272a",onClick:()=>{u.length>=6||m([...u,{name:""}])},disabled:!p,children:[(0,n.jsx)(ev,{width:24,height:24}),"Add option"]})]})},eS=({control:e,onClose:t,openEnded:r=!1,required:i=!1})=>(0,n.jsx)(h.Controller,{control:e,name:"poll",render:({field:e,formState:{errors:o}})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ek,{value:e.value,onChange:e.onChange,onClose:t,openEnded:r,required:i}),(0,n.jsx)(C.default,{errors:o,name:"poll"})]})});function eE(e,t){return e?t?{options:[{name:""},{name:""}]}:{options:[{name:""},{name:""}],durationDays:3}:null}let eT=/(?:https?:)\/\/(?:localhost|(?:\d{1,3}\.){3}\d{1,3}|(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63})(?::\d{2,5})?(?:\/[^\s"'<>?#]*)*\/[^\s"'<>?#]+\.(?:jpe?g|png|gif|webp)(?:\?[^\s"'<>#]*)?(?:#[^\s"'<>]*)?/gi,eM=(e,t,n)=>{let r="from now"===n?"":n;return`${e} ${t}${1===e?"":"s"}${r?` ${r}`:""}`};e.s(["default",0,({onFormSubmit:e,includesTitle:t,titleRequired:Y=!1,bodyRequired:X=!1,includeAttachmentInput:Q=!1,maxBodyCharacterCount:ee=15e3,showBorder:et=!1,parent:en,onCancel:er,placeholderText:ei,editPost:eo,showPollButton:es=!1,requirePoll:el=!1,openEndedPoll:ea=!1,showViewerBar:ec=!1,autoFocus:eu=!1,editorRef:ed,displayType:eh="default",supportImageLinkAttachments:ep=!1,authPending:em=!1,draftScopeId:ev})=>{let[eb,ex]=(0,d.useState)(el),[eC,ek]=(0,d.useState)(!1),[eO,eA]=(0,d.useState)(null),[eN,eR]=(0,d.useState)(null),[ej,eD]=(0,d.useState)(null),[eI,eP]=(0,d.useState)(null),[eL,e_]=(0,d.useState)(!1),[eV,eB]=(0,d.useState)(null),[eH,eF]=(0,d.useState)(null),[ez,e$]=(0,d.useState)(null),[eW,eq]=(0,d.useState)(null),[eU,eK]=(0,d.useState)(!1),eJ=(0,d.useRef)(!1),eZ=(0,d.useRef)(null),eG="coral"===eh,eY="reply"===eh,eX="advanced"===eh,eQ=(0,d.useMemo)(()=>eG?{allowFeedFallback:!1}:void 0,[eG]),e0=ev??en?.id,e1=!!er,e2=!eY&&!eo&&!eX,{cycloneConfig:{serverURL:e9}}=(0,O.useConfigContext)(),{cycloneCommunityPrefix:e3}=(0,M.useCurrentCycloneCommunity)(),{viewer:e4}=(0,A.useCyclone)(),{user:e6}=(0,T.useAuth)(),{getComposition:e8}=(0,j.useContentLocationContext)(),e5=e8(eY?I.ContentObjectType.QuickPost:I.ContentObjectType.FanPost),{includeStaffBadge:e7,showStaffBadgeText:te}=(0,P.getStaffBadgeProps)({composition:e5,role:e4?.role}),tt=(0,J.getCommunityAdvancedEditorPath)(e3),{reset:tn,control:tr,handleSubmit:ti,register:to,unregister:ts,watch:tl,setError:ta,clearErrors:tc,setValue:tu,trigger:td,formState:{errors:th,isSubmitSuccessful:tp,isValid:tf,isSubmitting:tm}}=(0,h.useForm)({defaultValues:{title:"",attachment:"",images:[],poll:eE(el,ea)}}),{fields:tg,remove:ty,replace:tv}=(0,h.useFieldArray)({control:tr,name:"images",keyName:"imageId"}),tb=to("poll"),tw=tl("attachment"),tx=tl("title"),tC=tl("poll");(0,d.useEffect)(()=>
2{if(!eo)return void e$(null);let e=()=>{let e=Date.parse(eo.createdAt),t=Date.now(),n=e+R.QUICKPOST_EDIT_WINDOW-t;n>0?e$(Math.ceil(n/1e3)):(e$(null),(0,D.removeDraft)(eY,e0,eo.id,eQ))};e();let t=setInterval(e,1e3);return()=>{clearInterval(t)}},[eo,eY,en,eQ,e0]);let tk=(0,d.useMemo)(()=>ez?ez<60?`${ez}s`:`${Math.floor(ez/60)+1}m`:null,[ez]),tS=(0,d.useMemo)(()=>{if(!em&&(!(0,b.userHasCommentingName)(e6)||!(0,b.userHasVerifiedEmail)(e6))||tm)return!1;let e=(tC?.options.filter(e=>e.name.trim())??[]).length>=2;return(!eb||!!e)&&(X?(!eo||!!ez)&&!!(tf&&(eN||eV&&"<p></p>"!==eV)):tf)},[tf,X,eV,e6,em,eN,tm,eo,ez,eb,tC]);(0,d.useEffect)(()=>{eA(tw)},[tw]),(0,d.useEffect)(()=>{eN&&e_(!1)},[eN]);let tE=(0,d.useCallback)(()=>{el||(ts("poll"),tu("poll",null),ex(!1),tc("poll"))},[tc,el,tu,ts]),tT=(0,d.useCallback)(()=>{eP(null),eD(null),e_(!1),eA(null),eR(null),ek(!1),tu("attachment",""),tv([]),tc("attachment"),tc("images"),eW||eo||!(tg.length>0)||Promise.allSettled(tg.map(e=>(0,N.removeUploadedImage)(e.id,e9,e6?.cycloneToken)))},[tg,tc,eW,eo,tv,e9,tu,e6]),tM=(0,d.useCallback)(e=>{e&&tE(),eR(e?[e]:null)},[tE]);(0,d.useEffect)(()=>{eI&&tE(),eR(eI?[eI]:null)},[tE,eI]),(0,d.useEffect)(()=>{ej&&tE(),eR(ej?[ej]:null)},[tE,ej]),(0,d.useEffect)(()=>{0===tg.length?eR(null):(tE(),eR(tg.map(e=>({id:e.id,url:e.url,type:I.AttachmentType.Upload,altText:e.altText,height:e.height,width:e.width}))))},[tg,tE]),(0,d.useEffect)(()=>{eO&&""!==eO&&!c.test(eO)?ta("attachment",{message:"Invalid url added to post. Please remove or update with a valid url."}):tc("attachment")},[eO,tc,ta]);let tO=(0,d.useCallback)(()=>{eD(null),eP(null),eA(null),eR(null),tu("attachment",""),tc("attachment")},[tc,tu]),tA=(0,d.useRef)(null),tN=(0,d.useCallback)(()=>{if(tA.current){let e=tA.current,t=e.getBoundingClientRect(),n=window.visualViewport?.height||document.documentElement.clientHeight,r=window.visualViewport?.width||document.documentElement.clientWidth;t.top>=0&&t.left>=0&&t.bottom<=n&&t.right<=r||e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},[tA]),tR=(0,d.useMemo)(()=>ei||(eY&&!eo?`Your reply to ${en.author?.username}`:"Add details, a link, or an image (optional)"),[eo,eY,en,ei]),tj=[l.default,o.default.configure({placeholder:tR}),i.default.configure({defaultProtocol:"https"}).extend({inclusive:!1}),r.default.configure({limit:ee}),eg,ey],tD=(0,s.useEditor)({extensions:tj,content:"",immediatelyRender:!1,onUpdate({editor:e}){t_(e)},onPaste(e,t){tV(e,t)},onFocus(){eu&&setTimeout(()=>{tN()},800)}});ed&&(ed.current=tD);let tI=(0,d.useCallback)(()=>{if(!eo&&!eW)return;let e=eW??eo;!e||(e.title&&tu("title",e.title,{shouldValidate:!0}),e.body&&(tD?.commands.setContent(e.body),eB(e.body)),e.attachments&&e.attachments[0]&&(Z.supportedPreviewTypes.includes(e.attachments[0].type)&&tu("attachment",e.attachments[0].url),e.attachments[0].type===I.AttachmentType.Upload&&tu("images",e.attachments),e.attachments[0].type===I.AttachmentType.GIF&&eD(e.attachments[0]),e.attachments[0].type===I.AttachmentType.ImageLink&&eP(e.attachments[0])))},[eo,tu,eW,eB,eD,eP,tD]);(0,d.useEffect)(()=>{eU&&tI()},[eU,tI]);let tP=(0,d.useCallback)((e=!1)=>{if(!tD||tm&&!e)return;let t={body:tD.getHTML(),title:tx,attachments:eN,poll:tC};(0,D.saveDraft)(t,eY,e0,eo?.id,eQ)},[tx,eY,e0,eo,tD,eN,tm,tC,eQ]),tL=(0,d.useMemo)(()=>(0,u.default)(tP,R.DRAFT_SAVE_DELAY),[tP]);(0,d.useEffect)(()=>()=>{tL.flush()},[tL]),(0,d.useEffect)(()=>{tL()},[tx,tL]);let t_=(0,d.useCallback)(e=>{eB(e.getHTML()),tL(),(th.root||th.attachment||th.title)&&td()},[eB,tL,td,th]),tV=(0,d.useCallback)((e,t)=>{if(eN||eb)return;let n=t.content.content[0]?.textContent;if(!n)return;if(ep){let e=n.match(eT);if(e&&e.length>0){let t=e[0];tE(),eP({id:(0,f.v4)(),url:t,type:I.AttachmentType.ImageLink}),tL();return}}let r=c.find(n);if(!(r.length>0))return;let i=r[0];i&&(tE(),eA(i.href),tL())},[eN,tE,tL,eb,ep]);(0,d.useEffect)(()=>{let e=eG?(0,D.takeDraft)(eY,[e0,en?.id],eo?.id,eQ):(0,D.getDraft)(eY,e0,eo?.id,eQ);if(eJ.current)return void eK(!0);if(tD&&!tD.isEmpty){eJ.current=!0,eK(!0);return}if(!e)return void eK(!0);let t=null;try{t=JSON.parse(e)??null}catch{t=null,eK(!0);return}t?(eJ.current=!0,eq(t),eK(!0),t.poll&&(tu("poll",t.poll),ex(!0))):eK(!0)},[tD,eY,eG,eo,tu,en,eX,eQ,e0]),(0,d.useEffect)(()=>{tD&&eu&&tD.commands.focus()},[tD,eu]);let tB=(0,d.useCallback)(async t=>{if(tL.cancel(),!tD)return;if(el&&!tC)return void ta("poll",{message:"A poll is required for this post."});let n=function(e){if(!e)return null;if(e.some(e=>
2e.name.trim().length>30))return"Option must be 30 characters or fewer.";let t=e.filter(e=>e.name.trim().length>0);if(t.length<2)return null;let n=new Set;for(let e of t){let t=e.name.trim().toLowerCase();if(n.has(t))return"Poll options must have unique names.";n.add(t)}return null}(tC?.options);if(n)return void ta("poll",{message:n});tP(!0);let r=tC?ea?{options:tC.options}:tC:void 0,{errors:i}=await e(t,eV,eN??void 0,r);if(i){for(let e of i){let t=e.extensions?.code,n="string"==typeof e?e:"string"==typeof e.message?e.message:null;if("FanPostBodyExceedsMaxLength"===t)return void ta("root",{message:"The body of your post exceeds the max length of 15000 characters. Please update and try again."});if("CycloneAuthenticationInvalid"===t)return void ta("root",{message:n??"Your commenting session has expired. Please refresh the page and try again."});if("CommentAuthRequired"===t)return void ta("root",{message:e.message??"Sign in to post your comment."});if("CommentAccountIncomplete"===t)return void ta("root",{message:e.message??"Finish setting up your account to post."});if(t&&ew.includes(t))return void ta("poll",{message:n??"There was an error with your poll."});if("AdOnlyRequiresAdCommunityError"===t||"CommunityIdMismatchError"===t||"AdOnlyRequiresStaffRoleError"===t)return void ta("root",{message:n??"There was an error creating your ad FanPost."});if(n)return void ta("root",{message:n})}ta("root",{message:"There was an error creating your post."});return}(0,D.removeDrafts)(eY,[e0,en?.id],eo?.id,eQ)},[tD,e,eV,eN,ta,eY,en,e0,eo,tL,tC,el,ea,tP,eQ]),tH=(0,d.useCallback)(e=>{e.preventDefault(),ek(e=>!e)},[]),tF=(0,d.useCallback)(async e=>{if(!e.target.files)return;th.images&&tc("images");let t=Array.from(e.target.files),n=[];for(let e of t){if(e.size>N.UPLOAD_MAX_SIZE){ta("images",{message:"Image files cannot exceed 5MB."});continue}if(n.length+tg.length>=N.UPLOAD_MAX_FILES){ta("images",{message:"A maximum of 4 images can be uploaded."});break}n.push({file:e})}let r=n.map(async e=>
2{let t=await (0,N.getUploadedImage)(e.file);return{...e,height:t.height,width:t.width}}),i=await Promise.all(r);i.length>0&&tE(),eF(n.length);let o=await (0,N.uploadImages)(n,e9,e6?.cycloneToken);if(!o)return;let s=o.map(e=>{let t=i.find(t=>t.file.name===e.filename);return{id:e.id,type:I.AttachmentType.Upload,url:`${e9}/upload/${e.id}`,filename:e.filename,altText:null,height:t?.height??null,width:t?.width??null}});n.length<o.length&&ta("images",{message:"Not all of your images were successfully uploaded."}),setTimeout(()=>{tv([...tg,...s]),eF(null)},1e3),eZ.current&&(eZ.current.value="")},[tv,eZ,tg,e9,tc,th.images,ta,e6,tE]),tz=(0,d.useCallback)(e=>{e.preventDefault(),eZ.current?.click()},[eZ]),t$=(0,d.useCallback)(async(e,t,n)=>{e?.preventDefault(),ty(t),eW||eo||await (0,N.removeUploadedImage)(n,e9,e6?.cycloneToken)},[ty,e9,e6,eW,eo]),tW=(0,d.useCallback)(e=>{tE();let t=e.mediaFormats.mp4.dims[0],n=e.mediaFormats.mp4.dims[1];eD({id:e.id,url:e.url,type:I.AttachmentType.GIF,altText:e.content_description,thumbnailUrl:e.mediaFormats.preview.url,heightToWidthRatio:t&&t>0&&n?n/t:null,mediaFormats:e.mediaFormats}),e_(!1)},[tE]),tq=(0,d.useCallback)(()=>{tn({title:"",attachment:"",images:[],poll:eE(el,ea)}),tD?.commands.setContent(""),eA(null),eB(null),eP(null),eD(null),ek(!1),ex(el)},[tn,tD,el,ea]),tU=(0,d.useCallback)(e=>{e.preventDefault(),e_(e=>!e)},[]),tK=(0,d.useCallback)(e=>{e.preventDefault(),er&&er()},[er]);if((0,d.useEffect)(()=>{th.attachment||th.title||th.root||tp&&tq()},[tp,tn,th.attachment,th.title,th.root,tq]),!tD)return null;let tJ=e6&&(0,L.isValidUsername)(e6.commentingName),tZ=!!eN,tG=tg.length>0&&tg.length<4,tY=!!eH||tZ,tX=eb||tZ,tQ=eb||tZ&&!tG;return(0,n.jsxs)("form",{onSubmit:()=>{ti(tB)},children:[(0,n.jsx)(b.AuthErrorMessage,{user:e6}),(0,n.jsx)("div",{className:(0,a.default)(G.container,eY&&G.parentComposerContainer,et&&G.border,G.animatedContainer,eG&&G.coralComposerContainer,eX&&G.advancedComposerContainer),ref:tA,children:(0,n.jsxs)("div",{className:G.composerContainer,children:[ec&&(0,n.jsxs)("div",{className:G.composerTop,children:[tJ&&(0,n.jsx)("div",{className:G.avatarContainer,children:(0,n.jsx)(H.default,{username:e4?.username,avatarUrl:e4?.avatar})}),tJ&&(0,n.jsx)("div",{className:G.usernameContainer,children:(0,n.jsx)(z.default,{username:e4?.username??"",includeStaffBadge:e7,showStaffBadgeText:te})})]}),(0,n.jsxs)("div",{className:(0,a.default)(!eG&&G.composerBottom),children:[(0,n.jsxs)("div",{className:(0,a.default)(eG?G.coralComposerContent:G.composerContent),children:[t&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:G.inputWrapper,children:(0,n.jsx)("textarea",{...to("title",{required:Y,maxLength:300}),autoFocus:eu,id:"title",placeholder:"Title of your post*",className:(0,a.default)(G.title,G.input),rows:1,onInput:e=>{let t=e.target;t.style.height="auto",t.style.height=`${t.scrollHeight}px`}})}),(0,n.jsx)(C.default,{errors:th,name:"title"}),(0,n.jsx)(w.CharacterCount,{characters:tx?tx.length:0,maxCharacterCount:400,showCountAtCharacters:350})]}),(0,n.jsx)("div",{className:G.editorContainer,children:(0,n.jsx)(ef,{editor:tD,displayType:eh,toolbarPosition:eG?"bottom":eX?"top":"bubbleMenu",extraButtons:eG?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k.ButtonFormat,{displayType:"coral",icon:tG?(0,n.jsx)(q.default,{}):(0,n.jsx)(U.default,{}),onClick:tz,disabled:tQ}),(0,n.jsx)(k.ButtonFormat,{displayType:"coral",icon:(0,n.jsx)($.default,{}),onClick:tU,disabled:tX,active:!!eL})]}):void 0})})]}),(0,n.jsxs)("div",{className:(0,a.default)(G.belowEditor,eG&&G.belowEditorCoral),children:[!eG&&(0,n.jsx)(w.CharacterCount,{characters:tD.storage.characterCount.characters(),maxCharacterCount:ee,showCountAtCharacters:13e3}),eU&&(0,n.jsx)(Z.default,{initialPreviewData:eo?.attachments??eW?.attachments??null,attachmentUrl:eO,onRemoveAttachment:e=>{e?.preventDefault(),tO()},onUpdateAttachmentData:tM,validAttachmentUrl:!th.attachment}),ej&&(0,n.jsx)(V.default,{attachment:ej,type:B.AttachmentDisplayType.preview,onRemove:e=>{e?.preventDefault(),tO(),e_(!1)}}),eI&&(0,n.jsx)(V.default,{attachment:eI,type:B.AttachmentDisplayType.preview,onRemove:e=>{e?.preventDefault(),tO()}}),(tg.length>0||eH)&&(0,n.jsxs)(F.default,{children:[tg.length>0&&(0,n.jsx)(n.Fragment,{children:tg.map((e,t)=>
2(0,n.jsx)("div",{children:(0,n.jsx)(h.Controller,{control:tr,name:`images.${t}`,render:()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(V.default,{attachment:{id:"preview",url:e.url,type:I.AttachmentType.Upload},type:B.AttachmentDisplayType.preview,displayAtOriginalRatio:1===tg.length,onRemove:n=>{t$(n,t,e.id)}})})})},e.imageId))}),!!eH&&(0,n.jsx)(n.Fragment,{children:Array.from({length:eH},(e,t)=>(0,n.jsx)(d.default.Fragment,{children:(0,n.jsx)("div",{className:G.loadingWrapper,children:(0,n.jsx)(E.default,{background:"gray",height:"full"})})},t))})]})]}),(0,n.jsx)(n.Fragment,{children:eC&&(0,n.jsxs)("div",{className:G.inputWrapper,children:[(0,n.jsx)("input",{...to("attachment"),id:"attachment",type:"text",placeholder:"attachment URL (optional)",className:G.input}),(0,n.jsx)("div",{children:(0,n.jsx)(C.default,{errors:th,name:"attachment"})})]})}),!eG&&!!(eo&&!ez)&&(0,n.jsx)("span",{className:G.warningText,children:"Time has expired, so you can no longer edit this reply. Why not post another one?"}),eb&&(0,n.jsx)(eS,{control:tr,onClose:tE,openEnded:ea,required:el}),!eG&&(0,n.jsxs)("div",{className:G.bottomBar,children:[Q&&(0,n.jsx)(_.default,{displayType:"cycloneSecondary",iconLeft:(0,n.jsx)(W.default,{className:G.linkIcon,height:24,width:24}),text:"",onClick:tH,disabled:eb}),(0,n.jsx)(_.default,{displayType:"cycloneSecondary",iconLeft:tG?(0,n.jsx)(q.default,{}):(0,n.jsx)(U.default,{}),className:G.iconButton,onClick:tz,disabled:tQ,text:""}),(0,n.jsx)(_.default,{displayType:"cycloneSecondary",iconLeft:(0,n.jsx)($.default,{}),text:"",onClick:tU,className:G.iconButton,disabled:tX,active:!!eL}),es&&(0,n.jsx)(_.default,{displayType:"cycloneSecondary",iconLeft:(0,n.jsx)(K.default,{}),text:"",onClick:e=>{e.preventDefault(),tT(),ex(!0)},className:G.iconButton,active:eb,disabled:tY}),(0,n.jsxs)("div",{className:G.buttonContainer,children:[!!(eo&&ez)&&(0,n.jsx)("div",{className:G.editCountdownWrapper,children:(0,n.jsx)("span",{className:(0,a.default)(G.editCountdownText,ez<=30&&G.editUrgentText),children:tk})}),e2&&(0,n.jsx)("a",{className:G.advancedCreateLink,href:tt,children:"Advanced editor"}),e1&&(0,n.jsx)(_.default,{text:"Cancel",displayType:"cyclone",className:G.cancelButton,onClick:e=>{tK(e)}}),(0,n.jsx)(_.default,{text:eo?"Save Edit":eY?"Post":"Publish",displayType:"cyclone",onClick:e=>{e.preventDefault(),ti(tB)()},disabled:!tS})]})]}),(0,n.jsx)(C.default,{errors:th,name:"root"}),eL&&(0,n.jsx)("div",{className:G.gifSearchContainer,children:(0,n.jsx)(S.default,{onSelect:tW})}),(0,n.jsx)("input",{className:G.hiddenImagesInput,id:"image",type:"file",accept:"image/jpeg, image/png",multiple:!0,ref:eZ,onChange:e=>{tF(e)}}),(0,n.jsx)("div",{children:(0,n.jsx)(C.default,{errors:th,name:"images"})}),(0,n.jsx)("input",{type:"hidden",...tb})]})]})}),eG&&(e6||em)&&(0,n.jsxs)(n.Fragment,{children:[!!(eo&&null!==ez&&ez>0)&&(0,n.jsxs)("div",{className:G.coralEditRemainingTime,children:[(0,n.jsx)(m.default,{}),(0,n.jsxs)("div",{children:["Edit:"," ",(0,n.jsx)(p.default,{date:new Date(Date.now()+1e3*ez),formatter:eM,live:!0})," ","remaining"]})]}),!!(eo&&!ez)&&(0,n.jsx)(y.default,{color:"error",icon:(0,n.jsx)(g.default,{width:14,height:14}),className:G.coralEditExpiredCallout,children:"Edit time has expired. You can no longer edit this comment. Why not post another one?"}),(0,n.jsx)(x.CharacterCountCoral,{characters:tD.storage.characterCount.characters(),maxCharacterCount:ee}),(0,n.jsxs)("div",{className:G.coralBottomButtonsContainer,children:[e1&&(0,n.jsx)(v.default,{fullWidth:!0,text:"Cancel",size:"large",uppercase:!0,displayType:"outlined",onClick:e=>{tK(e)}}),(0,n.jsx)(v.default,{text:eo?"Save Changes":tm&&!e6?"Logging in...":"Submit",displayType:"primary",color:"primary",fullWidth:!0,size:"large",uppercase:!0,onClick:e=>{e.preventDefault(),ti(tB)()},disabled:!tS})]})]})]})}],533599)},34321,e=>{"use strict";var t=e.i(478902),n=e.i(197649);e.s(["default",0,({background:e="white",align:r="center",height:i="medium"})=>(0,t.jsx)("div",{className:(0,n.default)("x42rjf0","gray"===e?"x42rjf5":"x42rjf4","small"===i&&"x42rjf1","medium"===i&&"x42rjf2","full"===i&&"x42rjf3"),children:(0,t.jsx)("div",{className:(0,n.default)("x42rjf6","center"===r&&"x42rjf7")})})],34321)},678506,262653,e=>{"use strict";let t;var n,r,i,o,s=e.i(478902);e.s([],845237),e.i(845237);var l=e.i(389959),a=e.i(185173);function c(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function u(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}let d={};function h(e,t){let n=l.useRef(d);return n.current===d&&(n.current=e(t)),n}let p=[];function f(e){l.useEffect(e,p)}class m{static create(){return new m}currentId=0;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=0,t()},e)}isStarted(){return 0!==this.currentId}clear=()=>{0!==this.currentId&&(clearTimeout(this.currentId),this.currentId=0)};disposeEffect=()=>this.clear}function g(){let e=h(m.create).current;return f(e.disposeEffect),e}let y=l[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],v=y&&y!==l.useLayoutEffect?y:e=>e();function b(e){let t=h(w).current;return t.next=e,v(t.effect),t.trampoline}function w(){let e={next:void 0,callback:x,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function x(){}function C(e){return e?.ownerDocument||document}function k(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function S(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;
2if(n&&(0,a.isShadowRoot)(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function E(e){return"composedPath"in e?e.composedPath()[0]:e.target}let T="data-base-ui-focusable",M="active",O="selected",A="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function N(e,t){if(!(0,a.isElement)(e))return!1;if(t.hasElement(e))return!e.hasAttribute("data-trigger-disabled");for(let[,n]of t.entries())if(S(n,e))return!n.hasAttribute("data-trigger-disabled");return!1}function R(e,t){return null!=t&&("composedPath"in e?e.composedPath().includes(t):null!=e.target&&t.contains(e.target))}function j(e){return(0,a.isHTMLElement)(e)&&e.matches(A)}function D(e){return!!e&&"combobox"===e.getAttribute("role")&&j(e)}function I(e){return e?e.hasAttribute(T)?e:e.querySelector(`[${T}]`)||e:null}let P="u">typeof navigator,L=function(){if(!P)return{platform:"",maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}(),_=function(){if(!P)return"";let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}(),V=function(){if(!P)return"";let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(" "):navigator.userAgent}(),B="u">typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter:none"),H="MacIntel"===L.platform&&L.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(L.platform);P&&/firefox/i.test(V);let F=P&&/apple/i.test(navigator.vendor);P&&/Edg/i.test(V);let z=P&&/android/i.test(_)||/android/i.test(V);P&&_.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;let $=V.includes("jsdom/");function W(e,t){let n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function q(e){let t=e.type;return"click"===t||"mousedown"===t||"keydown"===t||"keyup"===t}function U(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...U(e,t.id,n)])}function K(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}let J={...l},Z=0,G=J.useId;function Y(e,t){if(void 0!==G){let n=G();return e??(t?`${t}-${n}`:n)}return function(e,t="mui"){let[n,r]=l.useState(e),i=e||n;return l.useEffect(()=>{null==n&&(Z+=1,r(`${t}-${Z}`))},[n,t]),i}(e,t)}let X="u">typeof document?l.useLayoutEffect:()=>{};function Q(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class ee{nodesRef={current:[]};events=Q();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);-1!==t&&this.nodesRef.current.splice(t,1)}}let et=l.createContext(null),en=l.createContext(null),er=()=>l.useContext(et)?.id||null,ei=e=>{let t=l.useContext(en);return e??t};function eo(e){let{children:t,id:n}=e,r=er();return(0,s.jsx)(et.Provider,{value:l.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function es(e){let{children:t,externalTree:n}=e,r=h(()=>n??new ee).current;return(0,s.jsx)(en.Provider,{value:r,children:t})}function el(){}Object.freeze([]);let ea=Object.freeze({});function ec(e,t,n,r){let i=!1,o=!1,s=r??ea;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){o=!0},get isCanceled(){return i},get isPropagationAllowed(){return o},trigger:n,...s}}e.s(["cancelOpen",0,"cancel-open","chipRemovePress",0,"chip-remove-press","clearPress",0,"clear-press","closePress",0,"close-press","closeWatcher",0,"close-watcher","decrementPress",0,"decrement-press","disabled",0,"disabled","drag",0,"drag","escapeKey",0,"escape-key","focusOut",0,"focus-out","imperativeAction",0,"imperative-action","incrementPress",0,"increment-press","inputBlur",0,"input-blur","inputChange",0,"input-change","inputClear",0,"input-clear","inputPaste",0,"input-paste","inputPress",0,"input-press","itemPress",0,"item-press","keyboard",0,"keyboard","linkPress",0,"link-press","listNavigation",0,"list-navigation","none",0,"none","outsidePress",0,"outside-press","pointer",0,"pointer","scrub",0,"scrub","siblingOpen",0,"sibling-open","swipe",0,"swipe","trackPress",0,"track-press","triggerFocus",0,"trigger-focus","triggerHover",0,"trigger-hover","triggerPress",0,"trigger-press","wheel",0,"wheel","windowResize",0,"window-resize"],476172);var eu=e.i(476172),eu=eu;function ed(e){return`data-base-ui-${e}`}let eh={intentional:"onClick",sloppy:"onPointerDown"};function ep(){return!1}function ef(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),o=l.useCallback(t=>em(t,e,"reference"),t),s=l.useCallback(t=>em(t,e,"floating"),n),a=l.useCallback(t=>em(t,e,"item"),r),c=l.useCallback(t=>em(t,e,"trigger"),i);return l.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:a,getTriggerProps:c}),[o,s,a,c])}function em(e,t,n){let r=new Map,i="item"===n,o={};for(let t in"floating"===n&&(o.tabIndex=-1,o[T]=""),e)i&&e&&(t===M||t===O)||(o[t]=e[t]);for(let s=0;s<t.length;s+=1){let l,a=t[s]?.[n];(l="function"==typeof a?e?a(e):null:a)&&eg(o,l,i,r)}return eg(o,e,i,r),o}function eg(e,t,n,r){for(let i in t){let o=t[i];n&&(i===M||i===O)||(i.startsWith("on")?(r.has(i)||r.set(i,[]),"function"==typeof o&&(r.get(i)?.pu
2sh(o),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>void 0!==e))):e[i]=o)}}let ey=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]),ev=function(e,...t){let n=new URL("https://base-ui.com/production-error");return n.searchParams.set("code",e.toString()),t.forEach(e=>n.searchParams.append("args[]",e)),`Base UI error #${e}; visit ${n} for the full message.`},eb=(e,t,n,r,i,o,...s)=>{let l;if(s.length>0)throw Error(ev(1));if(e&&t&&n&&r&&i&&o)l=(s,l,a,c)=>o(e(s,l,a,c),t(s,l,a,c),n(s,l,a,c),r(s,l,a,c),i(s,l,a,c),l,a,c);else if(e&&t&&n&&r&&i)l=(o,s,l,a)=>i(e(o,s,l,a),t(o,s,l,a),n(o,s,l,a),r(o,s,l,a),s,l,a);else if(e&&t&&n&&r)l=(i,o,s,l)=>r(e(i,o,s,l),t(i,o,s,l),n(i,o,s,l),o,s,l);else if(e&&t&&n)l=(r,i,o,s)=>n(e(r,i,o,s),t(r,i,o,s),i,o,s);else if(e&&t)l=(n,r,i,o)=>t(e(n,r,i,o),r,i,o);else if(e)l=e;else throw Error("Missing arguments");return l};var ew=e.i(623921),ex=e.i(114095);let eC=parseInt(l.version,10),ek=eC>=19?function(e,n,r,i,o){let s;if(!t){let t;return t=l.useCallback(()=>n(e.getSnapshot(),r,i,o),[e,n,r,i,o]),(0,ew.useSyncExternalStore)(e.subscribe,t,t)}let a=t.syncIndex;return t.syncIndex+=1,t.didInitialize?(s=t.syncHooks[a]).store===e&&s.selector===n&&Object.is(s.a1,r)&&Object.is(s.a2,i)&&Object.is(s.a3,o)||(s.store!==e&&(t.didChangeStore=!0),s.store=e,s.selector=n,s.a1=r,s.a2=i,s.a3=o,s.didChange=!0):(s={store:e,selector:n,a1:r,a2:i,a3:o,value:n(e.getSnapshot(),r,i,o),didChange:!1},t.syncHooks.push(s)),s.value}:function(e,t,n,r,i){return(0,ex.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))};[].push({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,ew.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});class eS{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t]))return void this.setState({...this.state,...e})}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return ek(this,e,t,n,r)}}class eE extends eS{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){l.useDebugValue(e),X(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;X(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;X(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){l.useDebugValue(e);let n=void 0!==t;X(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){return(0,this.selectors[e])(this.state,t,n,r)}useState(e,t,n,r){return l.useDebugValue(e),ek(this,this.selectors[e],t,n,r)}useContextCallback(e,t){l.useDebugValue(e);let n=b(t??el);this.context[e]=n}useStateSetter(e){let t=l.useRef(void 0);return void 0===t.current&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n,r=(n="function"==typeof e?e:this.selectors[e])(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}}let eT={open:eb(e=>e.open),transitionStatus:eb(e=>e.transitionStatus),domReferenceElement:eb(e=>e.domReferenceElement),referenceElement:eb(e=>e.positionReference??e.referenceElement),floatingElement:eb(e=>e.floatingElement),floatingId:eb(e=>e.floatingId)};class eM extends eE{constructor(e){const{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...o}=e;super({...o,positionReference:o.referenceElement,domReferenceElement:o.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Q(),nested:n,triggerElements:i},eT),this.syncOnly=t}syncOpenEvent=(e,t)=>
2{(!e||!this.state.open||null!=t&&q(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit("openchange",n)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}}let eO=l.createContext(void 0);function eA(e){let t=l.useContext(eO);if(void 0===t&&!e)throw Error(ev(47));return t}var eN=e.i(971131),eu=eu;class eR{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(void 0!==n&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}let ej=eb(e=>e.triggerIdProp??e.activeTriggerId),eD={open:eb(e=>e.openProp??e.open),mounted:eb(e=>e.mounted),transitionStatus:eb(e=>e.transitionStatus),floatingRootContext:eb(e=>e.floatingRootContext),preventUnmountingOnClose:eb(e=>e.preventUnmountingOnClose),payload:eb(e=>e.payload),activeTriggerId:ej,activeTriggerElement:eb(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:eb((e,t)=>void 0!==t&&ej(e)===t),isOpenedByTrigger:eb((e,t)=>void 0!==t&&ej(e)===t&&e.open),isMountedByTrigger:eb((e,t)=>void 0!==t&&ej(e)===t&&e.mounted),triggerProps:eb((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:eb(e=>e.popupProps),popupElement:eb(e=>e.popupElement),positionerElement:eb(e=>e.positionerElement)},eI={style:{transition:"none"}},eP="data-base-ui-click-trigger",eL={fallbackAxisSide:"end"},e_={clipPath:"inset(50%)",position:"fixed",top:0,left:0},eV={...eD,disabled:eb(e=>e.disabled),instantType:eb(e=>e.instantType),openMethod:eb(e=>e.openMethod),openChangeReason:eb(e=>e.openChangeReason),modal:eb(e=>e.modal),focusManagerModal:eb(e=>e.focusManagerModal),stickIfOpen:eb(e=>e.stickIfOpen),titleElementId:eb(e=>e.titleElementId),descriptionElementId:eb(e=>e.descriptionElementId),openOnHover:eb(e=>e.openOnHover),closeDelay:eb(e=>e.closeDelay),hasViewport:eb(e=>e.hasViewport)};class eB extends eE{constructor(e){const t={...{...{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new eM({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new eR,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0}),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:ea,inactiveTriggerProps:ea,popupProps:ea},disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1},...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:l.createRef(),backdropRef:l.createRef(),internalBackdropRef:l.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:l.createRef(),beforeContentFocusGuardRef:l.createRef(),stickIfOpenTimeout:new m,triggerElements:new eR},eV)}setOpen=(e,t)=>{let n=t.reason===eu.triggerHover,r=t.reason===eu.triggerPress&&0===t.event.detail,i=!e&&(t.reason===eu.escapeKey||null==t.reason);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set("stickIfOpen",!1)}),eN.flushSync(o)):o(),r||i?this.set("instantType",r?"click":"dismiss"):t.reason===eu.focusOut?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,t){let n=h(()=>new eB(t)).current,r=e??n;return f(n.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}var eu=eu;let eH=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}};class eF{static create(){return new eF}static request(e){return eH.request(e)}static cancel(e){return eH.cancel(e)}currentId=null;request(e){this.cancel(),this.currentId=eH.request(()=>{this.currentId=null,e()})}cancel=()=>{null!==this.currentId&&(eH.cancel(this.currentId),this.currentId=null)};
2disposeEffect=()=>this.cancel}function ez(){let e=h(eF.create).current;return f(e.disposeEffect),e}function e$(e){return null==e?e:"current"in e?e.current:e}let eW=((n={}).startingStyle="data-starting-style",n.endingStyle="data-ending-style",n),eq={[eW.startingStyle]:""},eU={[eW.endingStyle]:""},eK={transitionStatus:e=>"starting"===e?eq:"ending"===e?eU:null};function eJ(e,t=!1,n=!0){let r=ez();return b((i,o=null)=>{r.cancel();let s=e$(e);if(null==s)return;let l=()=>{eN.flushSync(i)};if("function"!=typeof s.getAnimations||globalThis.BASE_UI_ANIMATIONS_DISABLED)return void i();function a(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{o?.aborted||l()}).catch(()=>{if(n){o?.aborted||l();return}let e=s.getAnimations();!o?.aborted&&e.length>0&&e.some(e=>e.pending||"finished"!==e.playState)&&a()})}if(t){let e=eW.startingStyle;if(!s.hasAttribute(e))return void r.request(a);let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),a())});return t.observe(s,{attributes:!0,attributeFilter:[e]}),void o?.addEventListener("abort",()=>t.disconnect(),{once:!0})}r.request(a)})}function eZ(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,o=b(i),s=eJ(r,n,!1);l.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function eG({props:e}){let t,n,{children:r,open:i,defaultOpen:o=!1,onOpenChange:d,onOpenChangeComplete:p,modal:f=!1,handle:y,triggerId:v,defaultTriggerId:w=null}=e,x=eB.useStore(y?.store,{modal:f,open:o,openProp:i,activeTriggerId:w,triggerIdProp:v});(t=l.useRef(!0)).current&&(t.current=!1,(()=>{void 0===i&&!1===x.state.open&&!0===o&&x.update({open:!0,activeTriggerId:w})})()),x.useControlledProp("openProp",i),x.useControlledProp("triggerIdProp",v);let k=x.useState("open"),T=x.useState("payload");x.useContextCallback("onOpenChange",d),x.useContextCallback("onOpenChangeComplete",p);let{openMethod:M,triggerProps:O}=function(e){let t,n,r,i,[o,s]=l.useState(null),a=b((t,n)=>{e||s(n||(H?"touch":""))});t=l.useRef(e),X(()=>{t.current!==e&&n(t.current)},[e,n=b(t=>{t&&!e&&s(null)})]),X(()=>{t.current=e},[e]);let{onClick:c,onPointerDown:u}=(r=l.useRef(""),i=l.useCallback(e=>{e.defaultPrevented||(r.current=e.pointerType,a(e,e.pointerType))},[a]),{onClick:l.useCallback(e=>{0===e.detail?a(e,"keyboard"):(a(e,"pointerType"in e?e.pointerType:r.current),r.current="")},[a]),onPointerDown:i});return l.useMemo(()=>({openMethod:o,triggerProps:{onClick:c,onPointerDown:u}}),[o,c,u])}(k);X(()=>{if(n&&!x.select("activeTriggerId")&&1===x.context.triggerElements.size){let e=x.context.triggerElements.entries().next();if(!e.done){let[t,n]=e.value;x.update({activeTriggerId:t,activeTriggerElement:n})}}},[n=x.useState("open"),x]);let{forceUnmount:A}=function(e,t,n){let{mounted:r,setMounted:i,transitionStatus:o}=function(e,t=!1,n=!1){let[r,i]=l.useState(e&&t?"idle":void 0),[o,s]=l.useState(e);return e&&!o&&(s(!0),i("starting")),e||!o||"ending"===r||n||i("ending"),e||o||"ending"!==r||i(void 0),X(()=>{if(!e&&o&&"ending"!==r&&n){let e=eF.request(()=>{i("ending")});return()=>{eF.cancel(e)}}},[e,o,r,n]),X(()=>{if(!e||t)return;let n=eF.request(()=>{i(void 0)});return()=>{eF.cancel(n)}},[t,e]),X(()=>{if(!e||!t)return;e&&o&&"idle"!==r&&i("starting");let n=eF.request(()=>{i("idle")});return()=>{eF.cancel(n)}},[t,e,o,r]),{mounted:o,setMounted:s,transitionStatus:r}}(e);t.useSyncedValues({mounted:r,transitionStatus:o});let s=b(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return eZ({enabled:!t.useState("preventUnmountingOnClose"),open:e,ref:t.context.popupRef,onComplete(){e||s()}}),{forceUnmount:s,transitionStatus:o}}(k,x,()=>{x.update({stickIfOpen:!0,openChangeReason:null})});l.useEffect(()=>{k||x.context.stickIfOpenTimeout.clear()},[x,k]);let N=l.useCallback(()=>{x.setOpen(!1,ec(eu.imperativeAction))},[x]);l.useImperativeHandle(e.actionsRef,()=>({unmount:A,close:N}),[A,N]);let j=function(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=Y(),o=null!=er(),s=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(n?"popupElement":"positionerElement"),u=t.context.triggerElements,d=h(()=>new eM({open:s,transitionStatus:void 0,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:r,floatingId:i,syncOnly:!0,nested:o})).current;return X(()=>{let e={open:s,floatingId:i,referenceElement:l,floatingElement:c};(0,a.isElement)(l)&&(e.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(e.positionReference=l),d.update(e)},[s,i,l,c,d]),d.context.onOpenChange=r,d.context.nested=o,d}({popupStore:x,onOpenChange:x.setOpen}),{getReferenceProps:D,getFloatingProps:P,getTriggerProps:L}=ef([function(e,t={}){let n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingElement"),{dataRef:o}=n.context,{enabled:s=!0,escapeKey:d=!0,outsidePress:h=!0,outsidePressEvent:p="sloppy",referencePress:f=ep,referencePressEvent:y="sloppy",bubbles:v,externalTree:w}=t,x=ei(w),k=b("function"==typeof h?h:()=>!1),T="function"==typeof h?k:h,M=!1!==T,O=b(()=>p),A=l.useRef(!1),N=l.useRef(!1),j=l.useRef(!1),{escapeKey:D,outsidePress:I}={escapeKey:"boolean"==typeof v?v:v?.escapeKey??!1,outsidePress:"boolean"==typeof v?v:v?.outsidePress??!0},P=l.useRef(null),L=g(),_=g(),V=b(()=>{_.clear(),o.current.insideReactTree=!1}),B=l.useRef(!1),H=l.useRef(""),F=b(f),z=b(e=>{if(!r||!s||!d||"Escape"!==e.key||B.current)return;let t=o.current.floatingContext?.nodeId,i=x?U(x.nodesRef.current,t):[];if(!D&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let l="nativeEvent"in e?e.nativeEvent:e,a=ec(eu.escapeKey,l);n.setOpen(!1,a),D||a.isPropagationAllowed||e.stopPropagation()}),$=b(()=>{o.current.insideReactTree=!0,_.start(0,V)});l.useEffect(()=>{if(!r||!s)return;o.current.__escapeKeyBubbles=D,o.current.__outsidePressBubbles=I;let e=new m,t=new m;function l(){j.current=!0,t.start(0,()=>{j.current=!1})}function h(){A.current=!1,N.current=!1}function p(){let e=H.current,t=O(),n="function"==typeof t?t():t;return"string"==typeof n?n:n["pen"!==e&&e?e:"mouse"]}
2function f(e){let t=o.current.floatingContext?.nodeId,r=x&&U(x.nodesRef.current,t).some(t=>R(e,t.context?.elements.floating));return R(e,n.select("floatingElement"))||R(e,n.select("domReferenceElement"))||r}function g(e){let r;if("intentional"===(r=p())&&"click"!==e.type||"sloppy"===r&&"click"===e.type||o.current.insideReactTree)return void V();let i=E(e),s=`[${ed("inert")}]`,l=(0,a.isElement)(i)?i.getRootNode():null,c=Array.from(((0,a.isShadowRoot)(l)?l:C(n.select("floatingElement"))).querySelectorAll(s)),u=n.context.triggerElements;if(i&&(u.hasElement(i)||u.hasMatchingElement(e=>S(e,i))))return;let d=(0,a.isElement)(i)?i:null;for(;d&&!(0,a.isLastTraversableNode)(d);){let e=(0,a.getParentNode)(d);if((0,a.isLastTraversableNode)(e)||!(0,a.isElement)(e))break;d=e}if(c.length&&(0,a.isElement)(i)&&!i.matches("html,body")&&!S(i,n.select("floatingElement"))&&c.every(e=>!S(d,e)))return;if((0,a.isHTMLElement)(i)&&!("touches"in e)){let t=(0,a.isLastTraversableNode)(i),n=(0,a.getComputedStyle)(i),r=/auto|scroll/,o=t||r.test(n.overflowX),s=t||r.test(n.overflowY),l=o&&i.clientWidth>0&&i.scrollWidth>i.clientWidth,c=s&&i.clientHeight>0&&i.scrollHeight>i.clientHeight,u="rtl"===n.direction,d=c&&(u?e.offsetX<=i.offsetWidth-i.clientWidth:e.offsetX>i.clientWidth),h=l&&e.offsetY>i.clientHeight;if(d||h)return}if(f(e))return;if("intentional"===p()&&j.current){t.clear(),j.current=!1;return}if("function"==typeof T&&!T(e))return;let h=o.current.floatingContext?.nodeId,m=x?U(x.nodesRef.current,h):[];if(m.length>0){let e=!0;if(m.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,ec(eu.outsidePress,e)),V()}function y(e){if("sloppy"!==p()||!n.select("open")||!s||R(e,n.select("floatingElement"))||R(e,n.select("domReferenceElement")))return;let t=e.touches[0];t&&(P.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},L.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function v(e,t){let n=E(e);if(!n)return;let r=c(n,e.type,()=>{t(e),r()})}function b(e){L.clear(),"pointerdown"===e.type&&(H.current=e.pointerType),("mousedown"!==e.type||!P.current||P.current.dismissOnMouseDown)&&v(e,e=>{if("pointerdown"===e.type)"sloppy"!==p()||"touch"===e.pointerType||!n.select("open")||!s||R(e,n.select("floatingElement"))||R(e,n.select("domReferenceElement"))||g(e);else g(e)})}function w(e){if(!A.current)return;let n=N.current;if(h(),"intentional"===p()){if("pointercancel"===e.type){n&&l();return}f(e)||(n?l():("function"!=typeof T||T(e))&&(t.clear(),j.current=!0,V()))}}function k(e){if("sloppy"!==p()||!P.current||R(e,n.select("floatingElement"))||R(e,n.select("domReferenceElement")))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-P.current.startX),i=Math.abs(t.clientY-P.current.startY),o=Math.sqrt(r*r+i*i);o>5&&(P.current.dismissOnTouchEnd=!0),o>10&&(g(e),L.clear(),P.current=null)}function _(e){"sloppy"!==p()||!P.current||R(e,n.select("floatingElement"))||R(e,n.select("domReferenceElement"))||(P.current.dismissOnTouchEnd&&g(e),L.clear(),P.current=null)}let F=C(i),$=u(d&&u(c(F,"keydown",z),c(F,"compositionstart",function(){e.clear(),B.current=!0}),c(F,"compositionend",function(){e.start(5*!!(0,a.isWebKit)(),()=>{B.current=!1})})),M&&u(c(F,"click",b,!0),c(F,"pointerdown",b,!0),c(F,"pointerup",w,!0),c(F,"pointercancel",w,!0),c(F,"mousedown",b,!0),c(F,"mouseup",w,!0),c(F,"touchstart",function(e){H.current="touch",v(e,y)},!0),c(F,"touchmove",function(e){v(e,k)},!0),c(F,"touchend",function(e){v(e,_)}
2,!0)));return()=>{$(),e.clear(),t.clear(),h(),j.current=!1}},[o,i,d,M,T,r,s,D,I,z,V,O,x,n,L]),l.useEffect(V,[T,V]);let W=l.useMemo(()=>({onKeyDown:z,[eh[y]]:e=>{F()&&n.setOpen(!1,ec(eu.triggerPress,e.nativeEvent))},..."intentional"!==y&&{onClick(e){F()&&n.setOpen(!1,ec(eu.triggerPress,e.nativeEvent))}}}),[z,n,y,F]),q=b(e=>{if(!r||!s||0!==e.button)return;let t=E(e.nativeEvent);S(n.select("floatingElement"),t)&&(A.current||(A.current=!0,N.current=!1))}),K=b(e=>{!r||!s||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&A.current&&(N.current=!0)}),J=l.useMemo(()=>({onKeyDown:z,onPointerDown:K,onMouseDown:K,onClickCapture:$,onMouseDownCapture(e){$(),q(e)},onPointerDownCapture(e){$(),q(e)},onMouseUpCapture:$,onTouchEndCapture:$,onTouchMoveCapture:$}),[z,$,q,K]);return l.useMemo(()=>s?{reference:W,floating:J,trigger:W}:{},[s,W,J])}(j,{outsidePressEvent:{mouse:"trap-focus"===f?"sloppy":"intentional",touch:"sloppy"}}),function(e,t={}){let n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingId"),o=n.useState("domReferenceElement"),s=n.useState("floatingElement"),{role:a="dialog"}=t,c=Y(),u=o?.id||c,d=l.useMemo(()=>I(s)?.id||i,[s,i]),h=ey.get(a)??a,p=null!=er(),f=l.useMemo(()=>"tooltip"===h||"label"===a?ea:{"aria-haspopup":"alertdialog"===h?"dialog":h,"aria-expanded":"false",..."listbox"===h&&{role:"combobox"},..."menu"===h&&p&&{role:"menuitem"},..."select"===a&&{"aria-autocomplete":"none"},..."combobox"===a&&{"aria-autocomplete":"list"}},[h,p,a]),m=l.useMemo(()=>"tooltip"===h||"label"===a?{[`aria-${"label"===a?"labelledby":"describedby"}`]:r?d:void 0}:{...f,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,..."menu"===h&&{id:u}},[h,d,r,u,a,f]),g=l.useMemo(()=>{let e={id:d,...h&&{role:h}};return"tooltip"===h||"label"===a?e:{...e,..."menu"===h&&{"aria-labelledby":u}}},[h,d,u,a]),y=l.useCallback(({active:e,selected:t})=>{let n={role:"option",...e&&{id:`${d}-fui-option`}};switch(a){case"select":case"combobox":return{...n,"aria-selected":t}}return{}},[d,a]);return l.useMemo(()=>({reference:m,floating:g,item:y,trigger:f}),[m,g,f,y])}(j)]),_=l.useMemo(()=>D(O),[D,O]),V=l.useMemo(()=>L(O),[L,O]),B=l.useMemo(()=>P(),[P]);x.useSyncedValues({modal:f,openMethod:M,activeTriggerProps:_,inactiveTriggerProps:V,popupProps:B,floatingRootContext:j,nested:null!=er()});let F=l.useMemo(()=>({store:x}),[x]);return(0,s.jsx)(eO.Provider,{value:F,children:"function"==typeof r?r({payload:T}):r})}function eY(e,t){return e&&!t?e:!e&&t?t:e||t?{...e,...t}:void 0}let eX={};function eQ(e,t,n,r,i){if(!n&&!r&&!i&&!e)return e0(t);let o=e0(e);return t&&(o=e1(o,t)),n&&(o=e1(o,n)),r&&(o=e1(o,r)),i&&(o=e1(o,i)),o}function e0(e){return e9(e)?{...e3(e,eX)}:function(e){let t={...e};for(let e in t){let n=t[e];e2(e,n)&&(t[e]=e4(n))}return t}(e)}function e1(e,t){return e9(t)?e3(t,e):function(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case"style":e[n]=eY(e.style,r);break;case"className":e[n]=e8(e.className,r);break;default:e2(n,r)?e[n]=function(e,t){return t?e?(...n)=>{let r=n[0];if(e5(r)){e6(r);let i=t(...n);return r.baseUIHandlerPrevented||e?.(...n),i}let i=t(...n);return e?.(...n),i}:e4(t):e}(e[n],r):e[n]=r}}return e}(e,t)}function e2(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return 111===n&&110===r&&i>=65&&i<=90&&("function"==typeof t||void 0===t)}function e9(e){return"function"==typeof e}function e3(e,t){return e9(e)?e(t):e??eX}function e4(e){return e?(...t)=>{let n=t[0];return e5(n)&&e6(n),e(...t)}:e}function e6(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function e8(e,t){return t?e?t+" "+e:t:e}function e5(e){return null!=e&&"object"==typeof e&&"nativeEvent"in e}let e7=l.createContext(void 0);function te(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:o}=e,s=l.useRef(null),a=function(e=!1){let t=l.useContext(e7);if(void 0===t&&!e)throw Error(ev(16));return t}(!0),c=o??void 0!==a,{props:u}=function(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:o}=e,s=r&&!1!==t,a=r&&!1===t;return{props:l.useMemo(()=>{let e={onKeyDown(e){n&&t&&"Tab"!==e.key&&e.preventDefault()}};return r||(e.tabIndex=i,!o&&n&&(e.tabIndex=t?i:-1)),(o&&(t||s)||!o&&n)&&(e["aria-disabled"]=n),o&&(!t||a)&&(e.disabled=n),e},[r,n,t,s,a,o,i])}}({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),d=l.useCallback(()=>{let e=s.current;tt(e)&&c&&t&&void 0===u.disabled&&e.disabled&&(e.disabled=!1)},[t,u.disabled,c]);return X(d,[d]),{getButtonProps:l.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:o,onKeyDown:s,onPointerDown:l,...a}=e;return eQ({type:i?"button":void 0,onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){var r;if(t||(e6(e),s?.(e),e.baseUIHandlerPrevented))return;let o=e.target===e.currentTarget,l=e.currentTarget,a=tt(l),u=!i&&(r=l,!!(r?.tagName==="A"&&r?.href)),d=o&&(i?a:!u),h="Enter"===e.key,p=" "===e.key,f=l.getAttribute("role"),m=f?.startsWith("menuitem")||"option"===f||"gridcell"===f;if(o&&c&&p){if(e.defaultPrevented&&m)return;e.preventDefault(),u||i&&a?(l.click(),e.preventBaseUIHandler()):d&&(n?.(e),e.preventBaseUIHandler());return}d&&(!i&&(p||h)&&e.preventDefault(),!i&&h&&n?.(e))},onKeyUp(e){t||((e6(e),o?.(e),e.target===e.currentTarget&&i&&c&&tt(e.currentTarget)&&" "===e.key)?e.preventDefault():!e.baseUIHandlerPrevented&&(e.target!==e.currentTarget||i||c||" "!==e.key||n?.(e)))},onPointerDown(e){t?e.preventDefault():l?.(e)}},i?void 0:{role:"button"},u,a)},[t,u,c,i]),buttonRef:b(e=>{s.current=e,d()})}}function tt(e){return(0,a.isHTMLElement)(e)&&"BUTTON"===e.tagName}let tn=((r={}).open="data-open",r.closed="data-closed",r[r.startingStyle=eW.startingStyle]="startingStyle",r[r.endingStyle=eW.endingStyle]="endingStyle",r.anchorHidden="data-anchor-hidden",r.side="data-side",r.align="data-align",r),tr=((i={}).popupOpen="data-popup-open",i.pressed="data-pressed",i),ti={[tr.popupOpen]:""},to={[tr.popupOpen]:"",[tr.pressed]:""},ts={[tn.open]:""},tl={[tn.closed]:""},ta={[tn.anchorHidden]:""},tc=e=>e?ti:null,tu=e=>e?to:null,td={open:e=>e?ts:tl,anchorHidden:e=>e?ta:null};function th(e,t,n,r){var i,o,s,l,a;let c=h(tp).current;return i=c,o=e,s=t,l=n,a=r,(i.refs[0]!==o||i.refs[1]!==s||i.refs[2]!==l||i.refs[3]!==a)&&tf(c,[e,t,n,r]),c.callback}function tp(){return{callback:null,cleanup:null,refs:[]}}function tf(e,t){if(e.refs=t,t.every(e=>null==e)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),null!=n){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(null!=i)switch(typeof i){case"function":{let t=i(n);"function"==typeof t&&(r[e]=t);break}case"object":i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(null!=n)switch(typeof n){case"function":{let t=r[e];"function"==typeof t?t():n(null);break}case"object":n.current=null}}}}}}function tm(e){if(!l.isValidElement(e))return null;let t=e.props;return(eC>=19?t?.ref:e.ref)??null}function tg(e,t,n={}){let r=t.render,i=function(e,t={}){var n,r,i;let{className:o,style:s,render:l}=e,{state:a=ea,ref:c,props:u,stateAttributesMapping:d,enabled:p=!0}
2=t,f=p?"function"==typeof o?o(a):o:void 0,m=p?"function"==typeof s?s(a):s:void 0,g=p?function(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);null!=e&&Object.assign(n,e);continue}!0===i?n[`data-${r.toLowerCase()}`]="":i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}(a,d):ea,y=p&&u?function(e){if(Array.isArray(e)){if(0===e.length)return eX;if(1===e.length)return e0(e[0]);let t=e0(e[0]);for(let n=1;n<e.length;n+=1)t=e1(t,e[n]);return t}return eQ(void 0,e)}(u):void 0,v=p?eY(g,y)??{}:ea;if("u">typeof document)if(p)if(Array.isArray(c)){let e;n=[v.ref,tm(l),...c],r=e=h(tp).current,i=n,(r.refs.length!==i.length||r.refs.some((e,t)=>e!==i[t]))&&tf(e,n),v.ref=e.callback}else v.ref=th(v.ref,tm(l),c);else th(null,null);return p?(void 0!==f&&(v.className=e8(v.className,f)),void 0!==m&&(v.style=eY(v.style,m)),v):ea}(t,n);return!1===n.enabled?null:function(e,t,n,r){if(t){if("function"==typeof t)return t(n,r);let e=eQ(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===ty&&(i=l.Children.toArray(t)[0]),l.cloneElement(i,e)}if(e&&"string"==typeof e){var i,o;return i=e,o=n,"button"===i?(0,l.createElement)("button",{type:"button",...o,key:o.key}):"img"===i?(0,l.createElement)("img",{alt:"",...o,key:o.key}):l.createElement(i,o)}throw Error(ev(8))}(e,r,i,n.state??ea)}let ty=Symbol.for("react.lazy"),tv=.1*.1;function tb(e,t,n,r,i,o){return r>=t!=o>=t&&e<=(i-n)*(t-r)/(o-r)+n}function tw(e,t,n,r,i,o,s,l,a,c){let u=!1;return tb(e,t,n,r,i,o)&&(u=!u),tb(e,t,i,o,s,l)&&(u=!u),tb(e,t,s,l,a,c)&&(u=!u),tb(e,t,a,c,n,r)&&(u=!u),u}function tx(e,t,n,r,i,o){let s=Math.min(n,i),l=Math.max(n,i),a=Math.min(r,o),c=Math.max(r,o);return e>=s&&e<=l&&t>=a&&t<=c}var eu=eu;function tC(e){let t=h(tk,e).current;return t.next=e,X(t.effect),t}function tk(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var eu=eu;class tS{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new m,this.restTimeout=new m,this.handleCloseOptions=void 0}static create(){return new tS}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}let tE=new WeakMap;function tT(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&tE.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),tE.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function tM(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,o=tE.get(n);o&&o!==e&&tT(o),tT(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,tE.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function tO(e){let t=h(tS.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),f(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function tA(e,t,n){let r=null==n||W(n)?"function"==typeof e?e():e:0;return"number"==typeof r?r:r?.[t]}function tN(e){return"function"==typeof e?e():e}function tR(e,t){return t||"click"===e||"mousedown"===e}let tj={current:null};function tD(e){return Y(e,"base-ui")}let tI={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},tP={...tI,position:"fixed",top:0,left:0};({...tI,position:"absolute"});let tL=l.forwardRef(function(e,t){let[n,r]=l.useState();return X(()=>{F&&r("button")},[]),(0,s.jsx)("span",{...e,ref:t,style:tP,"aria-hidden":!n||void 0,tabIndex:0,role:n,"data-base-ui-focus-guard":""})});var eu=eu;function t_(e,t=e?(0,a.getComputedStyle)(e):null){var n;
2return!!e&&!!e.isConnected&&!!t&&"hidden"!==(n=t).visibility&&"collapse"!==n.visibility&&("function"==typeof e.checkVisibility?e.checkVisibility():"none"!==t.display&&"contents"!==t.display)}function tV(e){for(let t of Array.from(e.children))if("summary"===(0,a.getNodeName)(t))return t;return null}function tB(e){let t=e?(0,a.getNodeName)(e):"";return null!=e&&e.matches('a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]')&&("summary"!==t||null!=e.parentElement&&"details"===(0,a.getNodeName)(e.parentElement)&&tV(e.parentElement)===e)&&("details"!==t||null==tV(e))&&("input"!==t||"hidden"!==e.type)}function tH(e){if(!tB(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=function(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return(0,a.isShadowRoot)(n)?n.host:null}(t)){let n=t!==e,r="slot"===(0,a.getNodeName)(t);if(t.hasAttribute("inert")||n&&"details"===(0,a.getNodeName)(t)&&!t.open&&!function(e,t){let n=tV(t);return!!n&&(e===n||S(n,e))}(e,t)||t.hasAttribute("hidden")||!r&&!function(e,t){let n=(0,a.getComputedStyle)(e);return t?"none"!==n.display:t_(e,n)}(t,n))return!1}return!0}function tF(e){let t=e.tabIndex;if(t<0){let t=(0,a.getNodeName)(e);if("details"===t||"audio"===t||"video"===t||(0,a.isHTMLElement)(e)&&e.isContentEditable)return 0}return t}function tz(e){return"input"!==(0,a.getNodeName)(e)?null:"radio"===e.type&&""!==e.name?e:null}function t$(e){if((0,a.isHTMLElement)(e)&&"slot"===(0,a.getNodeName)(e)){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return(0,a.isHTMLElement)(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function tW(e){return tH(e)&&tF(e)>=0}function tq(e){let t=[];return!function e(t,n){t$(t).forEach(t=>{tB(t)&&n.push(t),e(t,n)})}(e,t),t.filter(tH)}function tU(e){let t=tq(e);return t.filter(e=>tF(e)>=0&&function(e,t){let n=tz(e);if(!n)return!0;let r=t.find(e=>{let t=tz(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=tz(e);return t?.name===n.name&&t.form===n.form})===n}(e,t))}function tK(e,t){let n=tU(e),r=n.length;if(0===r)return;let i=k(C(e)),o=n.indexOf(i);return n[-1===o?1===t?0:r-1:o+t]}function tJ(e){return tK(C(e).body,1)||e}function tZ(e){return tK(C(e).body,-1)||e}function tG(e,t){if(!e)return null;let n=tU(C(e).body),r=n.length;if(0===r)return null;let i=n.indexOf(e);return -1===i?null:n[(i+t+r)%r]}function tY(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!S(n,r)}function tX(e){let t=[];!function e(t,n,r){t$(t).forEach(t=>{(0,a.isHTMLElement)(t)&&t.matches(n)&&r.push(t),e(t,n,r)})}(e,"[data-tabindex]",t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}var eu=eu;let tQ=l.forwardRef(function(e,t){var n;let r,i,o,d,h,p,f,{render:y,className:v,disabled:w=!1,nativeButton:x=!0,handle:k,payload:T,openOnHover:M=!1,delay:O=300,closeDelay:A=0,id:R,style:D,...I}=e,P=eA(!0),L=k?.store??P?.store;if(!L)throw Error(ev(74));let _=tD(R),V=L.useState("isTriggerActive",_),B=L.useState("floatingRootContext"),H=L.useState("isOpenedByTrigger",_),F=l.useRef(null),{registerTrigger:z,isMountedByThisTrigger:$}=(n={payload:T,disabled:w,openOnHover:M,closeDelay:A},r=L.useState("isMountedByTrigger",_),i=l.useRef(null),o=l.useRef(null),d=l.useCallback(e=>{if(void 0!==_){if(null!==i.current){let e=i.current,t=o.current,n=L.context.triggerElements.getById(e);t&&n===t&&L.context.triggerElements.delete(e),i.current=null,o.current=null}null!==e&&(i.current=_,o.current=e,L.context.triggerElements.add(_,e))}},[L,_]),h=b(e=>{if(d(e),!e||!L.select("open"))return;let t=L.select("activeTriggerId");t===_?L.update({activeTriggerElement:e,...n}):null==t&&L.update({activeTriggerId:_,activeTriggerElement:e,...n})}),X(()=>{r&&L.update({activeTriggerElement:F.current,...n})},[r,L,F,...Object.values(n)]),{registerTrigger:h,isMountedByThisTrigger:r}),K=L.useState("openChangeReason"),J=L.useState("stickIfOpen"),Z=L.useState("openMethod"),G=L.useState("focusManagerModal"),Y=function(e,t={}){let n="rootStore"in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:o=!0,delay:s=0,handleClose:d=null,mouseOnly:h=!1,restMs:p=0,move:f=!0,triggerElementRef:m=tj,externalTree:g,isActiveTrigger:y=!0,getHandleCloseContext:v,isClosing:w}
2=t,x=ei(g),k=tO(n),T=l.useRef(!1),M=tC(d),O=tC(s),A=tC(p),R=tC(o),j=tC(w);y&&(k.handleCloseOptions=M.current?.__options);let D=b(()=>tR(r.current.openEvent?.type,k.interactedInside)),I=b(e=>N(e,n.context.triggerElements)),P=b((e,t,r)=>{let i=n.context.triggerElements;return i.hasElement(t)?!e||!S(e,t):!!(0,a.isElement)(r)&&i.hasMatchingElement(e=>S(e,r))&&(!e||!S(e,r))}),L=b((e,t=!0)=>{let r=tA(O.current,"close",k.pointerType);r?k.openChangeTimeout.start(r,()=>{n.setOpen(!1,ec(eu.triggerHover,e)),x?.events.emit("floating.closed",e)}):t&&(k.openChangeTimeout.clear(),n.setOpen(!1,ec(eu.triggerHover,e)),x?.events.emit("floating.closed",e))}),_=b(()=>{k.handler&&(C(n.select("domReferenceElement")).removeEventListener("mousemove",k.handler),k.handler=void 0)}),V=b(()=>{tT(k)});return l.useEffect(()=>_,[_]),l.useEffect(()=>{if(o)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){e.open?T.current=!1:(T.current=e.reason===eu.triggerHover,_(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}},[o,i,k,_]),l.useEffect(()=>{if(!o)return;let e=m.current??(y?n.select("domReferenceElement"):null);if((0,a.isElement)(e))return f?u(c(e,"mousemove",t,{once:!0}),c(e,"mouseenter",t),c(e,"mouseleave",i)):u(c(e,"mouseenter",t),c(e,"mouseleave",i));function t(e){if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,h&&!W(k.pointerType))return;let t=tN(A.current),r=tA(O.current,"open",k.pointerType),i=E(e),o=e.currentTarget??null,s=n.select("domReferenceElement"),l=o;if((0,a.isElement)(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(S(e,i)){l=e;break}}(0,a.isElement)(o)&&(0,a.isElement)(s)&&!n.context.triggerElements.hasElement(o)&&S(o,s)&&(l=s);let c=null!=l&&P(s,l,i),u=n.select("open"),d=j.current?.()??"ending"===n.select("transitionStatus"),p=!u&&d&&T.current,f=!c&&(0,a.isElement)(l)&&(0,a.isElement)(s)&&S(s,l)&&p,m=t>0&&!r,g=!u||c;c&&(u||p)||f?n.setOpen(!0,ec(eu.triggerHover,e,l)):!m&&(r?k.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,ec(eu.triggerHover,e,l))}):g&&n.setOpen(!0,ec(eu.triggerHover,e,l)))}function i(e){if(D())return void V();_();let t=C(n.select("domReferenceElement"));k.restTimeout.clear(),k.restTimeoutPending=!1;let i=r.current.floatingContext??v?.();if(!I(e.relatedTarget)){if(M.current&&i){n.select("open")||k.openChangeTimeout.clear();let r=m.current;k.handler=M.current({...i,tree:x,x:e.clientX,y:e.clientY,onClose(){V(),_(),R.current&&!D()&&r===n.select("domReferenceElement")&&L(e,!0)}}),t.addEventListener("mousemove",k.handler),k.handler(e);return}"touch"===k.pointerType&&S(n.select("floatingElement"),e.relatedTarget)||L(e)}}},[_,V,r,O,L,n,o,M,k,y,P,D,I,h,f,A,m,x,R,v,j]),l.useMemo(()=>{if(o)return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select("domReferenceElement"),o=n.select("open"),s=P(i,r,e.target);if(h&&!W(k.pointerType))return;if(o&&s&&k.handleCloseOptions?.blockPointerEvents){let e=n.select("floatingElement");if(e){let t=k.handleCloseOptions?.getScope?.()??r.ownerDocument.body;tM(k,{scopeElement:t,referenceElement:r,floatingElement:e})}}let l=tN(A.current);function a(){if(k.restTimeoutPending=!1,D())return;let e=n.select("open");k.blockMouseMove||e&&!s||n.setOpen(!0,ec(eu.triggerHover,t,r))}(!o||s)&&0!==l&&(!s&&k.restTimeoutPending&&e.movementX**2+e.movementY**2<2||(k.restTimeout.clear(),"touch"===k.pointerType?eN.flushSync(()=>{a()}):s&&o?a():(k.restTimeoutPending=!0,k.restTimeout.start(l,a))))}};function e(e){k.pointerType=e.pointerType}},[o,k,D,P,h,n,A])}(B,{enabled:null!=B&&M&&("touch"!==Z||K!==eu.triggerPress),mouseOnly:!0,move:!1,handleClose:function(e={}){let{blockPointerEvents:t=!1}=e,n=new m,r=({x:e,y:t,placement:r,elements:i,onClose:o,nodeId:s,tree:l})=>{let c=r?.split("-")[0],u=!1,d=null,h=null,p="u">typeof performance?performance.now():0;return function(r){n.clear();let f=i.domReference,m=i.floating;if(!f||!m||null==c||null==e||null==t)return;let{clientX:g,clientY:y}=r,v=E(r),b="mouseleave"===r.type,w=S(m,v),x=S(f,v);if(w&&(u=!0,!b))return;if(x&&(u=!1,!b)){u=!0;return}if(b&&(0,a.isElement)(r.relatedTarget)&&S(m,r.relatedTarget))return;
2function C(){return!!(l&&U(l.nodesRef.current,s).length>0)}function k(){C()||(n.clear(),o())}if(C())return;let T=f.getBoundingClientRect(),M=m.getBoundingClientRect(),O=e>M.right-M.width/2,A=t>M.bottom-M.height/2,N=M.width>T.width,R=M.height>T.height,j=(N?T:M).left,D=(N?T:M).right,I=(R?T:M).top,P=(R?T:M).bottom;if("top"===c&&t>=T.bottom-1||"bottom"===c&&t<=T.top+1||"left"===c&&e>=T.right-1||"right"===c&&e<=T.left+1)return void k();let L=!1;switch(c){case"top":L=tx(g,y,j,T.top+1,D,M.bottom-1);break;case"bottom":L=tx(g,y,j,M.top+1,D,T.bottom-1);break;case"left":L=tx(g,y,M.right-1,P,T.left+1,I);break;case"right":L=tx(g,y,T.right-1,P,M.left+1,I)}if(L)return;if(u&&(!(g>=T.x)||!(g<=T.x+T.width)||!(y>=T.y)||!(y<=T.y+T.height))||!b&&function(e,t){let n=performance.now(),r=n-p;if(null===d||null===h||0===r)return d=e,h=t,p=n,!1;let i=e-d,o=t-h;return d=e,h=t,p=n,i*i+o*o<r*r*tv}(g,y))return void k();let _=!1;switch(c){case"top":{let n=N?.25:2,r=t+.5+1,i=O||N?M.bottom-.5:M.top,o=O?N?M.bottom-.5:M.top:M.bottom-.5;_=tw(g,y,N||O?e+n:e-n,r,N?e-n:O?e+n:e-n,r,M.left,i,M.right,o);break}case"bottom":{let n=N?.25:2,r=t-.5,i=O||N?M.top+.5:M.bottom,o=O?N?M.top+.5:M.bottom:M.top+.5;_=tw(g,y,N||O?e+n:e-n,r,N?e-n:O?e+n:e-n,r,M.left,i,M.right,o);break}case"left":{let n=R?.25:2,r=e+.5+1,i=A||R?M.right-.5:M.left,o=A?R?M.right-.5:M.left:M.right-.5;_=tw(g,y,i,M.top,o,M.bottom,r,R||A?t+n:t-n,r,R?t-n:A?t+n:t-n);break}case"right":{let n=R?.25:2,r=e-.5,i=A||R?M.left+.5:M.right,o=A?R?M.left+.5:M.right:M.left+.5;_=tw(g,y,r,R||A?t+n:t-n,r,R?t-n:A?t+n:t-n,i,M.top,o,M.bottom)}}_?u||n.start(40,k):k()}};return r.__options={...e,blockPointerEvents:t},r}(),restMs:O,delay:{close:A},triggerElementRef:F,isActiveTrigger:V,isClosing:()=>"ending"===L.select("transitionStatus")}),Q=ef([function(e,t={}){let n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:o="click",toggle:s=!0,ignoreMouse:a=!1,stickIfOpen:c=!0,touchOpenDelay:u=0,reason:d=eu.triggerPress}=t,h=l.useRef(void 0),p=ez(),f=g(),m=l.useMemo(()=>({onPointerDown(e){h.current=e.pointerType},onMouseDown(e){let t=h.current,i=e.nativeEvent,l=n.select("open");if(0!==e.button||"click"===o||W(t,!0)&&a)return;let m=r.current.openEvent,g=m?.type,y=n.select("domReferenceElement")!==e.currentTarget,v=l&&y||!(l&&s&&(!m||!c||"click"===g||"mousedown"===g)),b=E(i);if(j(b)){let e=ec(d,i,b);v&&"touch"===t&&u>0?f.start(u,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let w=e.currentTarget;p.request(()=>{let e=ec(d,i,w);v&&"touch"===t&&u>0?f.start(u,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if("mousedown-only"===o)return;let t=h.current;if("mousedown"===o&&t){h.current=void 0;return}if(W(t,!0)&&a)return;let i=n.select("open"),l=r.current.openEvent,p=n.select("domReferenceElement")!==e.currentTarget,m=i&&p||!(i&&s&&(!l||!c||q(l))),g=ec(d,e.nativeEvent,e.currentTarget);m&&"touch"===t&&u>0?f.start(u,()=>{n.setOpen(!0,g)}):n.setOpen(m,g)},onKeyDown(){h.current=void 0}}),[r,o,a,n,c,s,p,f,u,d]);return l.useMemo(()=>i?{reference:m}:ea,[i,m])}(B,{enabled:null!=B,stickIfOpen:J})]),ee=L.useState("triggerProps",$),{getButtonProps:et,buttonRef:en}=te({disabled:w,native:x}),er=l.useMemo(()=>({open:e=>e&&K===eu.triggerPress?tu(e):tc(e)}),[K]),eo=tg("button",e,{state:{disabled:w,open:H},ref:[en,t,z,F],props:[Q.getReferenceProps(),Y,ee,{[eP]:"",id:_},I,et],stateAttributesMapping:er}),{preFocusGuardRef:es,handlePreFocusGuardFocus:el,handleFocusTargetFocus:ed}=(p=l.useRef(null),f=b(e=>{eN.flushSync(()=>{L.setOpen(!1,ec(eu.focusOut,e.nativeEvent,e.currentTarget))});let t=tG(p.current,-1);t?.focus()}),{preFocusGuardRef:p,handlePreFocusGuardFocus:f,handleFocusTargetFocus:b(e=>{let t=L.select("positionerElement");if(t&&tY(e,t))L.context.beforeContentFocusGuardRef.current?.focus();else{eN.flushSync(()=>{L.setOpen(!1,ec(eu.focusOut,e.nativeEvent,e.currentTarget))});let n=tG(L.context.triggerFocusTargetRef.current||F.current,1);for(;null!==n&&S(t,n);){let e=n;if((n=tJ(n))===e)break}n?.focus()}})});return V&&!G?(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)(tL,{ref:es,onFocus:el}),(0,s.jsx)(l.Fragment,{children:eo},_),(0,s.jsx)(tL,{ref:L.context.triggerFocusTargetRef,onFocus:ed})]}):(0,s.jsx)(l.Fragment,{children:eo},_)});var eu=eu;let t0=l.createContext(null),t1=ed("portal"),t2=l.forwardRef(function(e,t){let{children:n,container:r,className:i,render:o,renderGuards:d,style:h,...p}=e,{portalNode:f,portalSubtree:m}=function(e={}){let{ref:t,container:n,componentProps:r=ea,elementProps:i}=e,o=Y(),s=l.useContext(t0),c=s?.portalNode,[u,d]=l.useState(null),[h,p]=l.useState(null),f=b(e=>{null!==e&&p(e)}),m=l.useRef(null);X(()=>
2{if(null===n){m.current&&(m.current=null,p(null),d(null));return}if(null==o)return;let e=(n&&((0,a.isNode)(n)?n:n.current))??c??document.body;if(null==e){m.current&&(m.current=null,p(null),d(null));return}m.current!==e&&(m.current=e,p(null),d(e))},[n,c,o]);let g=tg("div",r,{ref:[t,f],props:[{id:o,[t1]:""},i]});return{portalNode:h,portalSubtree:u&&g?eN.createPortal(g,u):null}}({container:r,ref:t,componentProps:e,elementProps:p}),g=l.useRef(null),y=l.useRef(null),v=l.useRef(null),w=l.useRef(null),[x,C]=l.useState(null),k=l.useRef(!1),S=x?.modal,E=x?.open,T="boolean"==typeof d?d:!!x&&!x.modal&&x.open&&!!f;l.useEffect(()=>{if(f&&!S)return u(c(f,"focusin",e,!0),c(f,"focusout",e,!0));function e(e){f&&e.relatedTarget&&tY(e)&&("focusin"===e.type?k.current&&(tX(f),k.current=!1):(tU(f).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}),k.current=!0))}},[f,S]),l.useEffect(()=>{f&&!1===E&&(tX(f),k.current=!1)},[E,f]);let M=l.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:y,beforeInsideRef:v,afterInsideRef:w,portalNode:f,setFocusManagerState:C}),[f]);return(0,s.jsxs)(l.Fragment,{children:[m,(0,s.jsxs)(t0.Provider,{value:M,children:[T&&f&&(0,s.jsx)(tL,{"data-type":"outside",ref:g,onFocus:e=>{if(tY(e,f))v.current?.focus();else{let e=tZ(x?x.domReference:null);e?.focus()}}}),T&&f&&(0,s.jsx)("span",{"aria-owns":f.id,style:e_}),f&&eN.createPortal(n,f),T&&f&&(0,s.jsx)(tL,{"data-type":"outside",ref:y,onFocus:e=>{if(tY(e,f))w.current?.focus();else{let t=tJ(x?x.domReference:null);t?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,ec(eu.focusOut,e.nativeEvent))}}})]})]})}),t9=l.createContext(void 0),t3=l.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=eA();return i.useState("mounted")||n?(0,s.jsx)(t9.Provider,{value:n,children:(0,s.jsx)(t2,{ref:t,...r})}):null});function t4(e){return eC>=19?e:e?"true":void 0}let t6=l.createContext(void 0);function t8(){let e=l.useContext(t6);if(!e)throw Error(ev(46));return e}var t5=e.i(89500),t7=a,ne=e.i(992486),nt=e.i(912953);let nn=l.createContext(void 0);function nr(){let e=l.useContext(nn);return e?.direction??"ltr"}let ni={name:"hide",async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,o=await (0,nt.hide)().fn(e);return{data:{referenceHidden:o.data?.referenceHidden||0===t&&0===n&&0===r&&0===i}}}};var t7=a;let no={sideX:"left",sideY:"top"},ns={name:"adaptiveOrigin",async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:o,strategy:s,placement:l}=e,a=(0,t7.getWindow)(i),c=a.getComputedStyle(i);if("0s"===c.transitionDuration||""===c.transitionDuration)return{x:t,y:n,data:no};let u=await o.getOffsetParent?.(i),d={width:0,height:0};
2if("fixed"===s&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(u===a){let e=C(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await o.isElement?.(u)&&(d=await o.getDimensions(u));let h=(0,t5.getSide)(l),p=t,f=n;return"left"===h&&(p=d.width-(t+r.width)),"top"===h&&(f=d.height-(n+r.height)),{x:p,y:f,data:{sideX:"left"===h?"right":no.sideX,sideY:"top"===h?"bottom":no.sideY}}}};function nl(e,t,n){let r="inline-start"===e||"inline-end"===e;return({top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"})[t]}function na(e,t,n){let{rects:r,placement:i}=e;return{side:nl(t,(0,t5.getSide)(i),n),align:(0,t5.getAlignment)(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function nc(e){return null!=e&&"current"in e}let nu=l.forwardRef(function(e,t){let n,{cutout:r,...i}=e;if(r){let e=r.getBoundingClientRect();n=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,s.jsx)("div",{ref:t,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:n}})});var eu=eu;
2function nd(e){return"starting"===e?eI:ea}var t7=a;let nh={},np={},nf="";class nm{lockCount=0;restore=null;timeoutLock=m.create();timeoutUnlock=m.create();acquire(e){return this.lockCount+=1,1===this.lockCount&&null===this.restore&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{this.lockCount-=1,0===this.lockCount&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{0===this.lockCount&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){let t,n,r,i,o;if(0===this.lockCount||null!==this.restore)return;let s=C(e).documentElement,l=(0,t7.getWindow)(s).getComputedStyle(s).overflowY;if("hidden"===l||"clip"===l){this.restore=el;return}let u=H||!function(e){if("u"<typeof document)return!1;let t=C(e);return(0,t7.getWindow)(t).innerWidth-t.documentElement.clientWidth>0}(e);this.restore=u?(n=(t=C(e)).documentElement,r=t.body,o={overflowY:(i=(0,a.isOverflowElement)(n)?n:r).style.overflowY,overflowX:i.style.overflowX},Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,o)}):function(e){let t=C(e),n=t.documentElement,r=t.body,i=(0,t7.getWindow)(n),o=0,s=0,l=!1,u=eF.create();if(B&&(i.visualViewport?.scale??1)!==1)return()=>{};function d(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),u=(t.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,s=n.scrollLeft,nh={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},nf=n.style.scrollBehavior,np={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let d=n.scrollHeight>n.clientHeight,h=n.scrollWidth>n.clientWidth,p="scroll"===t.overflowY||"scroll"===c.overflowY,f="scroll"===t.overflowX||"scroll"===c.overflowX,m=Math.max(0,i.innerWidth-r.clientWidth),g=Math.max(0,i.innerHeight-r.clientHeight),y=parseFloat(c.marginTop)+parseFloat(c.marginBottom),v=parseFloat(c.marginLeft)+parseFloat(c.marginRight),b=(0,a.isOverflowElement)(n)?n:r;if(l=function(e){if(!("u">typeof CSS&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||"u"<typeof document)return!1;let t=C(e),n=t.documentElement,r=t.body,i=(0,a.isOverflowElement)(n)?n:r,o=i.style.overflowY,s=n.style.scrollbarGutter;n.style.scrollbarGutter="stable",i.style.overflowY="scroll";let l=i.offsetWidth;i.style.overflowY="hidden";let c=i.offsetWidth;return i.style.overflowY=o,n.style.scrollbarGutter=s,l===c}(e)){n.style.scrollbarGutter=u,b.style.overflowY="hidden",b.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:u,overflowY:"hidden",overflowX:"hidden"}),(d||p)&&(n.style.overflowY="scroll"),(h||f)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:y||g?`calc(100dvh - ${y+g}px)`:"100dvh",width:v||m?`calc(100vw - ${v+m}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=s,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function h(){Object.assign(n.style,nh),Object.assign(r.style,np),l||(n.scrollTop=o,n.scrollLeft=s,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=nf)}d();let p=c(i,"resize",function(){h(),u.request(d)});return()=>{u.cancel(),h(),"function"==typeof i.removeEventListener&&p()}}(e)}}let ng=new nm,ny=l.forwardRef(function(e,t){let n,r,i,{render:o,className:c,anchor:u,positionMethod:d="absolute",side:p="bottom",align:f="center",sideOffset:m=0,alignOffset:g=0,collisionBoundary:y="clipping-ancestors",collisionPadding:v=5,arrowPadding:w=5,sticky:x=!1,disableAnchorTracking:k=!1,collisionAvoidance:S=eL,style:E,...T}=e,{store:M}=eA(),O=function(){let e=l.useContext(t9);if(void 0===e)throw Error(ev(45));return e}(),A=(n=Y(),r=ei(void 0),X(()=>{if(!n)return;let e={id:n,parentId:i};return r?.addNode(e),()=>{r?.removeNode(e)}},[r,n,i=er()]),n),N=M.useState("floatingRootContext"),R=M.useState("mounted"),j=M.useState("open"),D=M.useState("openChangeReason"),I=M.useState("activeTriggerElement"),P=M.useState("modal"),L=M.useState("openMethod"),_=M.useState("positionerElement"),V=M.useState("instantType"),B=M.use
2State("transitionStatus"),H=M.useState("hasViewport"),F=l.useRef(null),z=eJ(_,!1,!1),$=function(e){var t,n;let{anchor:r,positionMethod:i="absolute",side:o="bottom",sideOffset:s=0,align:c="center",alignOffset:u=0,collisionBoundary:d,collisionPadding:p=5,sticky:f=!1,arrowPadding:m=5,disableAnchorTracking:g=!1,keepMounted:y=!1,floatingRootContext:v,mounted:w,collisionAvoidance:x,shiftCrossAxis:k=!1,nodeId:S,adaptiveOrigin:E,lazyFlip:T=!1,externalTree:M}=e,[O,A]=l.useState(null);w||null===O||A(null);let N=x.side||"flip",R=x.align||"flip",j=x.fallbackAxisSide||"end",D="function"==typeof r?r:void 0,I=b(D),P=D?I:r,L=tC(r),_=tC(w),V="rtl"===nr(),B=O||({top:"top",right:"right",bottom:"bottom",left:"left","inline-end":V?"left":"right","inline-start":V?"right":"left"})[o],H="center"===c?B:`${B}-${c}`,F=p,z=+("bottom"===o),$=+("top"===o),W=+("right"===o),q=+("left"===o);"number"==typeof F?F={top:F+z,right:F+q,bottom:F+$,left:F+W}:F&&(F={top:(F.top||0)+z,right:(F.right||0)+q,bottom:(F.bottom||0)+$,left:(F.left||0)+W});let U={boundary:"clipping-ancestors"===d?"clippingAncestors":d,padding:F},K=l.useRef(null),J=tC(s),Z=tC(u),G=[(0,nt.offset)(e=>{let t=na(e,o,V),n="function"==typeof J.current?J.current(t):J.current,r="function"==typeof Z.current?Z.current(t):Z.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},["function"!=typeof s?s:0,"function"!=typeof u?u:0,V,o])],Q="none"===R&&"shift"!==N,ee=!Q&&(f||k||"shift"===N),et="none"===N?null:(0,nt.flip)({...U,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!k&&"flip"===N,crossAxis:"flip"===R&&"alignment",fallbackAxisSideDirection:j}),en=Q?null:(0,nt.shift)(e=>{let t=C(e.elements.floating).documentElement;return{...U,rootBoundary:k?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:"none"!==R,crossAxis:ee,limiter:f||k?void 0:(0,nt.limitShift)(e=>{if(!K.current)return{};let{width:t,height:n}=K.current.getBoundingClientRect(),r=(0,t5.getSideAxis)((0,t5.getSide)(e.placement)),i="y"===r?F.left+F.right:F.top+F.bottom;return{offset:("y"===r?t:n)/2+i/2}})}},[U,f,k,F,R]);"shift"===N||"shift"===R||"center"===c?G.push(en,et):G.push(et,en),G.push((0,nt.size)({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!_.current)return;let i=e.style;i.setProperty("--available-width",`${t}px`),i.setProperty("--available-height",`${n}px`);let o=(0,t7.getWindow)(e).devicePixelRatio||1,{x:s,y:l,width:a,height:c}=r.reference,u=(Math.round((s+a)*o)-Math.round(s*o))/o,d=(Math.round((l+c)*o)-Math.round(l*o))/o;i.setProperty("--anchor-width",`${u}px`),i.setProperty("--anchor-height",`${d}px`)}}),(t=()=>({element:K.current||C(K.current).createElement("div"),padding:m,offsetParent:"floating"}),n=[m],{...{name:"arrow",options:t,async fn(e){let{x:n,y:r,placement:i,rects:o,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0,offsetParent:d="real"}=(0,t5.evaluate)(t,e)||{};if(null==c)return{};let h=(0,t5.getPaddingObject)(u),p={x:n,y:r},f=(0,t5.getAlignmentAxis)(i),m=(0,t5.getAxisLength)(f),g=await s.getDimensions(c),y="y"===f,v=y?"clientHeight":"clientWidth",b=o.reference[m]+o.reference[f]-p[f]-o.floating[m],w=p[f]-o.reference[f],x="real"===d?await s.getOffsetParent?.(c):l.floating,C=l.floating[v]||o.floating[m];C&&await s.isElement?.(x)||(C=l.floating[v]||o.floating[m]);let k=C/2-g[m]/2-1,S=Math.min(h[y?"top":"left"],k),E=Math.min(h[y?"bottom":"right"],k),T=C-g[m]-E,M=C/2-g[m]/2+(b/2-w/2),O=(0,t5.clamp)(S,M,T),A=!a.arrow&&null!=(0,t5.getAlignment)(i)&&M!==O&&o.reference[m]/2-(M<S?S:E)-g[m]/2<0,N=A?M<S?M-S:M-T:0;return{[f]:p[f]+N,data:{[f]:O,centerOffset:M-O-N,...A&&{alignmentOffset:N}},reset:A}}},options:[t,n]}),{name:"transformOrigin",fn(e){let{elements:t,middlewareData:n,placement:r,rects:i,y:l}=e,a=(0,t5.getSide)(r),c=(0,t5.getSideAxis)(a),u=K.current,d=n.arrow?.x||0,h=n.arrow?.y||0,p=u?.clientWidth||0,f=u?.clientHeight||0,m=d+p/2,g=h+f/2,y=Math.abs(n.shift?.y||0),v=i.reference.height/2,b="function"==typeof s?s(na(e,o,V)):s,w=y>b,x={top:`${m}px calc(100% + ${b}px)`,bottom:`${m}px ${-b}px`,left:`calc(100% + ${b}px) ${g}px`,right:`${-b}px ${g}px`}[a],C=`${m}px ${i.reference.y+v-l}px`;return t.floating.style.setProperty("--transform-origin",ee&&"y"===c&&w?C:x),{}}},ni,E),X(()=>{!w&&v&&v.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[w,v]);let eo=l.useMemo(()=>({elementResize:!g&&"u">typeof ResizeObserver,layoutShift:!g&&"u">typeof IntersectionObserver}),[g]),{refs:es,elements:el,x:ea,y:ec,middlewareData:eu,update:ed,placement:eh,context:ep,isPositioned:ef,floatingStyles:em}=function(e={}){let{nodeId:t,externalTree:n}=e,r=function(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Y(),o=null!=er(),s=h(()=>new eM({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new eR,floatingId:i,syncOnly:!1,nested:o})).current;return X(()=>{let e={open:t,floatingId:i};void 0!==r.reference&&(e.referenceElement=r.reference,e.domReferenceElement=(0,a.isElement)(r.reference)?r.reference:null),void 0!==r.floating&&(e.floatingElement=r.floating),s.update(e)}
2,[t,i,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=o,s}(e),i=e.rootContext||r,o={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[s,c]=l.useState(null),u=l.useRef(null),d=ei(n);X(()=>{o.domReference&&(u.current=o.domReference)},[o.domReference]);let p=(0,nt.useFloating)({...e,elements:{...o,...s&&{reference:s}}}),f=l.useCallback(e=>{let t=(0,a.isElement)(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;c(t),p.refs.setReference(t)},[p.refs]),[m,g]=l.useState(void 0),[y,v]=l.useState(null);i.useSyncedValue("referenceElement",m??null);let b=(0,a.isElement)(m)?m:null;i.useSyncedValue("domReferenceElement",void 0===m?o.domReference:b),i.useSyncedValue("floatingElement",y);let w=l.useCallback(e=>{((0,a.isElement)(e)||null===e)&&(u.current=e,g(e)),((0,a.isElement)(p.refs.reference.current)||null===p.refs.reference.current||null!==e&&!(0,a.isElement)(e))&&p.refs.setReference(e)},[p.refs,g]),x=l.useCallback(e=>{v(e),p.refs.setFloating(e)},[p.refs]),C=l.useMemo(()=>({...p.refs,setReference:w,setFloating:x,setPositionReference:f,domReference:u}),[p.refs,w,x,f]),k=l.useMemo(()=>({...p.elements,domReference:o.domReference}),[p.elements,o.domReference]),S=i.useState("open"),E=i.useState("floatingId"),T=l.useMemo(()=>({...p,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:E,refs:C,elements:k,nodeId:t,rootStore:i}),[p,C,k,t,i,S,E]);return X(()=>{i.context.dataRef.current.floatingContext=T;let e=d?.nodesRef.current.find(e=>e.id===t);e&&(e.context=T)}),l.useMemo(()=>({...p,context:T,refs:C,elements:k,rootStore:i}),[p,C,k,T,i])}({rootContext:v,open:y?w:void 0,placement:H,middleware:G,strategy:i,whileElementsMounted:y?void 0:(...e)=>(0,ne.autoUpdate)(...e,eo),nodeId:S,externalTree:M}),{sideX:eg,sideY:ey}=eu.adaptiveOrigin||no,ev=ef?i:"fixed",eb=l.useMemo(()=>{let e=E?{position:ev,[eg]:ea,[ey]:ec}:{position:ev,...em};return ef||(e.opacity=0),e},[E,ev,eg,ea,ey,ec,em,ef]),ew=l.useRef(null);X(()=>{if(!w)return;let e=L.current,t="function"==typeof e?e():e,n=(nc(t)?t.current:t)||null;n!==ew.current&&(es.setPositionReference(n),ew.current=n)},[w,es,P,L]),l.useEffect(()=>{if(!w)return;let e=L.current;"function"!=typeof e&&nc(e)&&e.current!==ew.current&&(es.setPositionReference(e.current),ew.current=e.current)},[w,es,P,L]),l.useEffect(()=>{if(y&&w&&el.domReference&&el.floating)return(0,ne.autoUpdate)(el.domReference,el.floating,ed,eo)},[y,w,el,ed,eo]);let ex=(0,t5.getSide)(eh),eC=nl(o,ex,V),ek=(0,t5.getAlignment)(eh)||"center",eS=!!eu.hide?.referenceHidden;X(()=>{T&&w&&ef&&A(ex)},[T,w,ef,ex]);let eE=l.useMemo(()=>({position:"absolute",top:eu.arrow?.y,left:eu.arrow?.x}),[eu.arrow]),eT=eu.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:eb,arrowStyles:eE,arrowRef:K,arrowUncentered:eT,side:eC,align:ek,physicalSide:ex,anchorHidden:eS,refs:es,context:ep,isPositioned:ef,update:ed}),[eb,eE,K,eT,eC,ek,ex,eS,es,ep,ef,ed])}({anchor:u,floatingRootContext:N,positionMethod:d,mounted:R,side:p,sideOffset:m,align:f,alignOffset:g,arrowPadding:w,collisionBoundary:y,collisionPadding:v,sticky:x,disableAnchorTracking:k,keepMounted:O,nodeId:A,collisionAvoidance:S,adaptiveOrigin:H?ns:void 0}),W=N.useState("domReferenceElement");X(()=>{let e=F.current;if(W&&(F.current=W),e&&W&&W!==e){M.set("instantType",void 0);let e=new AbortController;return z(()=>{M.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[W,z,M]);let q={open:j,side:$.side,align:$.align,anchorHidden:$.anchorHidden,instant:V};!function(e,t,n,r){let[i,o]=l.useState(!1);X(()=>{if(!e||!t||null==n)return void o(!1);let r=C(n).documentElement.clientWidth,i=n.offsetWidth;o(r>0&&i>0&&i>=r-20)},[e,t,n]),function(e=!0,t=null){X(()=>{if(e)return ng.acquire(t)},[e,t])}(e&&(!t||i),r)}(j&&!0===P&&D!==eu.triggerHover,"touch"===L,_,I);let U=l.useCallback(e=>{M.set("positionerElement",e)},[M]),K=function(e,t,{styles:n,transitionStatus:r,props:i,refs:o,hidden:s,inert:l=!1}){let a={...n};return l&&(a.pointerEvents="none"),tg("div",e,{state:t,ref:o,props:[{role:"presentation",hidden:s,style:a},nd(r),i],stateAttributesMapping:td})}(e,q,{styles:$.positionerStyles,transitionStatus:B,props:T,refs:[t,U],hidden:!R,inert:!j});return(0,s.jsxs)(t6.Provider,{value:$,children:[R&&!0===P&&D!==eu.triggerHover&&(0,s.jsx)(nu,{ref:M.context.
2internalBackdropRef,inert:t4(!j),cutout:I}),(0,s.jsx)(eo,{id:A,children:K})]})});var t7=a,eu=eu;let nv=0;function nb(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(nv);let o=()=>e?.focus({preventScroll:n});if(i)return o(),el;let s=requestAnimationFrame(o);return nv=s,()=>{nv===s&&(cancelAnimationFrame(s),nv=0)}}let nw={inert:new WeakMap,"aria-hidden":new WeakMap},nx="data-base-ui-inert",nC={inert:new WeakSet,"aria-hidden":new WeakSet},nk=new WeakMap,nS=0,nE=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=function e(t){return t?(0,a.isShadowRoot)(t)?t.host:e(t.parentNode):null}(t);return e.contains(n)?n:null}).filter(e=>null!=e),nT=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},nM=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{"script"!==(0,a.getNodeName)(e)&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function nO(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:o=[]}=t,s=C(e[0]).body;return function(e,t,n,r,{mark:i=!0,markerIgnoreElements:o=[]}){let s=r?"inert":n?"aria-hidden":null,l=null,a=null,c=nE(t,e),u=new Set(i?nE(t,o):[]),d=i?nM(t,nT(c),new Set(c)).filter(e=>!u.has(e)):[],h=[],p=[];if(s){let e=nw[s],n=nC[s];a=n,l=e;let r=nE(t,Array.from(t.querySelectorAll("[aria-live]"))),i=c.concat(r);nM(t,nT(i),new Set(i)).forEach(t=>{let r=t.getAttribute(s),i=null!==r&&"false"!==r,o=(e.get(t)||0)+1;e.set(t,o),h.push(t),1===o&&i&&n.add(t),i||t.setAttribute(s,"inert"===s?"":"true")})}return i&&d.forEach(e=>{let t=(nk.get(e)||0)+1;nk.set(e,t),p.push(e),1===t&&e.setAttribute(nx,"")}),nS+=1,()=>{l&&h.forEach(e=>{let t=(l.get(e)||0)-1;l.set(e,t),t||(!a?.has(e)&&s&&e.removeAttribute(s),a?.delete(e))}),i&&p.forEach(e=>{let t=(nk.get(e)||0)-1;nk.set(e,t),t||e.removeAttribute(nx)}),(nS-=1)||(nw.inert=new WeakMap,nw["aria-hidden"]=new WeakMap,nC.inert=new WeakSet,nC["aria-hidden"]=new WeakSet,nk=new WeakMap)}}(e,s,n,r,{mark:i,markerIgnoreElements:o})}let nA=[];function nN(){nA=nA.filter(e=>e.deref()?.isConnected)}function nR(){return nN(),nA[nA.length-1]?.deref()}function nj(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;let n=tq(e).filter(e=>{let t=e.getAttribute("data-tabindex")||"";return tW(e)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")}),r=e.getAttribute("tabindex");t.current.includes("floating")||0===n.length?"0"!==r&&e.setAttribute("tabindex","0"):("-1"!==r||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function nD(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:o=!0,restoreFocus:d=!1,modal:h=!0,closeOnFocusOut:p=!0,openInteractionType:f="",nextFocusableElement:m,previousFocusableElement:y,beforeContentFocusGuardRef:v,externalTree:w,getInsideElements:x}=e,T="rootStore"in t?t.rootStore:t,M=T.useState("open"),O=T.useState("domReferenceElement"),A=T.useState("floatingElement"),{events:N,dataRef:R}=T.context,P=b(()=>R.current.floatingContext?.nodeId),L=!1===i,_=D(O)&&L,V=l.useRef(["content"]),H=tC(i),F=tC(o),W=tC(f),q=ei(w),J=l.useContext(t0),Z=l.useRef(!1),G=l.useRef(!1),Y=l.useRef(!1),Q=l.useRef(null),ee=l.useRef(""),et=l.useRef(""),en=l.useRef(null),er=l.useRef(null),eo=th(en,v,J?.beforeInsideRef),es=th(er,J?.afterInsideRef),el=g(),ea=g(),eh=ez(),ep=null!=J,ef=I(A),em=b((e=ef)=>e?tU(e):[]),eg=b(()=>x?.().filter(e=>null!=e)??[]);l.useEffect(()=>{if(!r&&h)return c(C(ef),"keydown",function(e){"Tab"===e.key&&S(ef,k(C(ef)))&&0===em().length&&!_&&(e.preventDefault(),e.stopPropagation())})},[r,O,ef,h,V,_,em]),l.useEffect(()=>{if(r||!M)return;let e=C(ef);function t(){Y.current=!1}return u(c(e,"pointerdown",function(e){let t=E(e),n=eg();Y.current=!(S(A,t)||S(O,t)||S(J?.portalNode,t)||n.some(e=>e===t||S(e,t))),et.current=e.pointerType||"keyboard",t?.closest(`[${eP}]`)&&(G.current=!0)},!0),c(e,"pointerup",t,!0),c(e,"pointercancel",t,!0),c(e,"keydown",function(){et.current="keyboard"},!0))},[r,A,O,ef,M,J,eg]),l.useEffect(()=>{if(r||!p)return;let e=C(ef);function t(t){let n=t.relatedTarget,r=t.currentTarget,i=E(t);queueMicrotask(()=>{let o=P(),s=T.context.triggerElements,l=eg(),c=n?.hasAttribute(ed("focus-guard"))&&[en.current,er.current,J?.beforeInsideRef.current,J?.afterInsideRef.current,J?.beforeOutsideRef.current,J?.afterOutsideRef.current,e$(y),e$(m)].includes(n),u=!(S(O,n)||S(A,n)||S(n,A)||S(J?.portalNode,n)||l.some(e=>e===n||S(e,n))||null!=n&&s.hasElement(n)||s.hasMatchingElement(e=>S(e,n))||c||q&&(U(q.nodesRef.current,o).find(e=>S(e.context?.elements.floating,n)||S(e.context?.elements.domReference,n))||K(q.nodesRef.current,o).find(e=>[e.context?.elements.floating,I(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===O&&ef&&nj(ef,V),d&&r!==O&&!t_(i)&&k(e)===e.body){if((0,a.isHTMLElement)(ef)&&(ef.focus(),"popup"===d))return void eh.request(()=>{ef.focus()});let e=em(),t=Q.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ef;(0,a.isHTMLElement)(n)&&n.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(_||!h)&&n&&u&&!G.current&&(_||n!==nR())&&(Z.current=!0,T.setOpen(!1,ec(eu.focusOut,t)))})}let n=(0,a.isHTMLElement)(O)?O:null;if(A||n)return u(n&&c(n,"focusout",t),n&&c(n,"pointerdown",function(){G.current=!0,ea.start(0,()=>{G.current=!1})}),A&&c(A,"focusin",function(e){let t=E(e);tW(t)&&(Q.current=t)}),A&&c(A,"focusout",t),A&&J&&c(A,"focusout",function(){Y.current||(R.current.insideReactTree=!0,el.start(0,()=>{R.current.insideReactTree=!1}))},!0))},[r,O,A,ef,h,q,J,T,p,d,em,_,P,V,R,el,ea,eh,m,y,eg]),l.useEffect(()=>{if(r||!A||!M)return;let e=Array.from(J?.portalNode?.querySelectorAll(`[${ed("portal")}]`)||[]),t=q?K(q.nodesRef.current,P()):[],n=t.find(e=>D(e.context?.elements.domReference||null))?.context?.elements.domReference,i=nO([A,...e,en.current,er.current,J?.beforeOutsideRef.current,J?.afterOutsideRef.current,...eg(),n,e$(y),e$(m),_?O:null].filter(e=>null!=e),{ariaHidden:h||_,mark:!1}),o=nO([A,...e].filter(e=>null!=e));return()=>{o(),i()}},[M,r,O,A,h,V,J,_,q,P,m,y,eg]),X(()=>
2{if(!M||r||!(0,a.isHTMLElement)(ef))return;let e=k(C(ef));queueMicrotask(()=>{let t,n=H.current,r="function"==typeof n?n(W.current||""):n;if(void 0===r||!1===r||S(ef,e))return;let i=null,o=()=>(null==i&&(i=em(ef)),i[0]||ef);nb(t=(t=!0===r||null===r?o():e$(r))||o(),{preventScroll:t===ef})})},[r,M,ef,L,em,H,W]),X(()=>{var e;if(r||!ef)return;let t=C(ef);function n(e){var t,n,r,i;let o;if(e.open||(t=e.nativeEvent,n=et.current,o=(0,t7.getWindow)(E(t)),ee.current=t instanceof o.KeyboardEvent?"keyboard":t instanceof o.FocusEvent?n||"keyboard":"pointerType"in t?t.pointerType||"keyboard":"touches"in t?"touch":t instanceof o.MouseEvent?n||(0===t.detail?"keyboard":"mouse"):""),e.reason===eu.triggerHover&&"mouseleave"===e.nativeEvent.type&&(Z.current=!0),e.reason===eu.outsidePress)if(e.nested)Z.current=!1;else if((""===(r=e.nativeEvent).pointerType&&r.isTrusted?0:z&&r.pointerType?"click"!==r.type||1!==r.buttons:0!==r.detail||r.pointerType)&&(i=e.nativeEvent,$?1:(z||0!==i.width||0!==i.height)&&(!z||1!==i.width||1!==i.height||0!==i.pressure||0!==i.detail||"mouse"!==i.pointerType)&&(!(i.width<1)||!(i.height<1)||0!==i.pressure||0!==i.detail||"touch"!==i.pointerType))){let e=!1;C(ef).createElement("div").focus({get preventScroll(){return e=!0,!1}}),e?Z.current=!1:Z.current=!0}else Z.current=!1}return e=k(t),nN(),e&&"body"!==(0,a.getNodeName)(e)&&(nA.push(new WeakRef(e)),nA.length>20&&(nA=nA.slice(-20))),N.on("openchange",n),()=>{N.off("openchange",n);let e=k(t),r=eg(),i=S(A,e)||r.some(t=>t===e||S(t,e))||q&&U(q.nodesRef.current,P(),!1).some(t=>S(t.context?.elements.floating,e)),o=F.current,s=function(){let e=F.current,t="function"==typeof e?e(ee.current):e;if(void 0===t||!1===t)return null;if(null===t&&(t=!0),"boolean"==typeof t){let e=O||nR();return e&&e.isConnected?e:null}let n=O||nR();return e$(t)||n||null}();queueMicrotask(()=>{let n=s?tW(s)?s:tU(s)[0]||s:null;o&&!Z.current&&(0,a.isHTMLElement)(n)&&("boolean"!=typeof o||n===e||e===t.body||i)&&n.focus({preventScroll:!0}),Z.current=!1})}},[r,A,ef,F,R,N,q,O,P,eg]),X(()=>{if(!B||M||!A)return;let e=k(C(A));(0,a.isHTMLElement)(e)&&j(e)&&S(A,e)&&e.blur()},[M,A]),X(()=>{if(!r&&J)return J.setFocusManagerState({modal:h,closeOnFocusOut:p,open:M,onOpenChange:T.setOpen,domReference:O}),()=>{J.setFocusManagerState(null)}},[r,J,h,M,T,p,O]),X(()=>{if(!r&&ef)return nj(ef,V),()=>{queueMicrotask(nN)}},[r,ef,V]);let ey=!r&&(!h||!_)&&(ep||h);return(0,s.jsxs)(l.Fragment,{children:[ey&&(0,s.jsx)(tL,{"data-type":"inside",ref:eo,onFocus:e=>{if(h){let e=em();nb(e[e.length-1])}else if(J?.portalNode)if(Z.current=!1,tY(e,J.portalNode)){let e=tJ(O);e?.focus()}else e$(y??J.beforeOutsideRef)?.focus()}}),n,ey&&(0,s.jsx)(tL,{"data-type":"inside",ref:es,onFocus:e=>{if(h)nb(em()[0]);else if(J?.portalNode)if(p&&(Z.current=!0),tY(e,J.portalNode)){let e=tZ(O);e?.focus()}else e$(m??J.afterOutsideRef)?.focus()}})]})}var eu=eu,eu=eu;let nI="ArrowUp",nP="ArrowDown",nL="ArrowLeft",n_="ArrowRight";[...new Set([...new Set([nL,n_]),...new Set([nI,nP])])];let nV=new Set([nI,nP,nL,n_,"Home","End"]),nB=l.createContext(void 0),nH=l.createContext(void 0);function nF(e){let{value:t,children:n}=e;return(0,s.jsx)(nH.Provider,{value:t,children:n})}let nz={...td,...eK},n$=l.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:o,style:d,...h}=e,{store:p}=eA(),f=t8(),m=null!=function(e){let t=l.useContext(nB);if(void 0===t&&!e)throw Error(ev(69));return t}(!0),{context:y,hasClosePart:v}=function(){let[e,t]=l.useState(0),n=b(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:l.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}(),w=p.useState("open"),x=p.useState("openMethod"),k=p.useState("instantType"),T=p.useState("transitionStatus"),M=p.useState("popupProps"),O=p.useState("titleElementId"),R=p.useState("descriptionElementId"),j=p.useState("modal"),D=p.useState("mounted"),I=p.useState("openChangeReason"),P=p.use
2State("activeTriggerElement"),L=p.useState("floatingRootContext");eZ({open:w,ref:p.context.popupRef,onComplete(){w&&p.context.onOpenChangeComplete?.(!0)}});let _=p.useState("disabled");!function(e,t={}){let n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingElement"),o=n.useState("domReferenceElement"),{dataRef:s}=n.context,{enabled:d=!0,closeDelay:h=0,nodeId:p}=t,f=tO(n),m=ei(),y=er(),v=b(()=>tR(s.current.openEvent?.type,f.interactedInside)),w=b(()=>{let e=s.current.openEvent?.type;return e?.includes("mouse")&&"mousedown"!==e}),x=b(e=>N(e,n.context.triggerElements)),k=l.useCallback(e=>{let t=tA(h,"close",f.pointerType),r=()=>{n.setOpen(!1,ec(eu.triggerHover,e)),m?.events.emit("floating.closed",e)};t?f.openChangeTimeout.start(t,r):(f.openChangeTimeout.clear(),r())},[h,n,f,m]),T=b(()=>{tT(f)}),M=b(e=>{let t=E(e);if(t?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${A}`)==null){f.interactedInside=!1;return}f.interactedInside=t?.closest("[aria-haspopup]")!=null});X(()=>{r||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,T())},[r,f,T]),l.useEffect(()=>T,[T]),X(()=>{if(d&&r&&f.handleCloseOptions?.blockPointerEvents&&w()&&(0,a.isElement)(o)&&i){let e=C(i),t=m?.nodesRef.current.find(e=>e.id===y)?.context?.elements.floating;t&&(t.style.pointerEvents="");let n=f.handleCloseOptions?.getScope?.()??f.pointerEventsScopeElement??t??o.closest("[data-rootownerid]")??e.body;return tM(f,{scopeElement:n,referenceElement:o,floatingElement:i}),()=>{T()}}},[d,r,o,i,f,w,m,y,T]);let O=g();l.useEffect(()=>{if(d)return u(i&&c(i,"mouseenter",function(){f.openChangeTimeout.clear(),O.clear(),m?.events.off("floating.closed",e),T()}),i&&c(i,"mouseleave",function(t){if(m&&y&&U(m.nodesRef.current,y).length>0)return void m.events.on("floating.closed",e);if(x(t.relatedTarget))return;let n=s.current.floatingContext?.nodeId??p,r=t.relatedTarget;if(!(m&&n&&(0,a.isElement)(r)&&U(m.nodesRef.current,n,!1).some(e=>S(e.context?.elements.floating,r)))){if(f.handler)return void f.handler(t);T(),v()||k(t)}}),i&&c(i,"pointerdown",M,!0),()=>{m?.events.off("floating.closed",e)});function e(t){m&&y&&!(U(m.nodesRef.current,y).length>0)&&O.start(0,()=>{m.events.off("floating.closed",e),n.setOpen(!1,ec(eu.triggerHover,t)),m.events.emit("floating.closed",t)})}},[d,i,n,s,p,v,x,k,T,M,f,m,y,O])}(L,{enabled:p.useState("openOnHover")&&!_,closeDelay:p.useState("closeDelay")});let V=void 0===i?function(e){return"touch"!==e||p.context.popupRef.current}:i,B={open:w,side:f.side,align:f.align,instant:k,transitionStatus:T},H=!1!==j&&v;p.useSyncedValue("focusManagerModal",H);let F=l.useCallback(e=>{p.set("popupElement",e)},[p]),z=tg("div",e,{state:B,ref:[t,p.context.popupRef,F],props:[M,{"aria-labelledby":O,"aria-describedby":R,onKeyDown(e){m&&nV.has(e.key)&&e.stopPropagation()}},nd(T),h],stateAttributesMapping:nz});return(0,s.jsx)(nD,{context:L,openInteractionType:x,modal:H,disabled:!D||I===eu.triggerHover,initialFocus:V,returnFocus:o,restoreFocus:"popup",previousFocusableElement:(0,a.isHTMLElement)(P)?P:void 0,nextFocusableElement:p.context.triggerFocusTargetRef,beforeContentFocusGuardRef:p.context.beforeContentFocusGuardRef,children:(0,s.jsx)(nF,{value:y,children:z})})}),nW=l.forwardRef(function(e,t){let{className:n,render:r,style:i,...o}=e,{store:s}=eA(),l=s.useState("open"),{arrowRef:a,side:c,align:u,arrowUncentered:d,arrowStyles:h}=t8();return tg("div",e,{state:{open:l,side:c,align:u,uncentered:d},ref:[t,a],props:[{style:h,"aria-hidden":!0},o],stateAttributesMapping:td})});var eu=eu;let nq={...td,...eK},nU=l.forwardRef(function(e,t){let{className:n,render:r,style:i,...o}=e,{store:s}=eA(),l=s.useState("open"),a=s.useState("mounted"),c=s.useState("transitionStatus"),u=s.useState("openChangeReason");return tg("div",e,{state:{open:l,transitionStatus:c},ref:[s.context.backdropRef,t],props:[{role:"presentation",hidden:!a,style:{pointerEvents:u===eu.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},o],stateAttributesMapping:nq})}),nK=l.forwardRef(function(e,t){let{render:n,className:r,style:i,...o}=e,{store:s}=eA(),l=tD(o.id);return X(()=>(s.set("titleElementId",l),()=>{s.set("titleElementId",void 0)}),[s,l]),tg("h2",e,{ref:t,props:[{id:l},o]})}),nJ=l.forwardRef(function(e,t){let{render:n,className:r,style:i,...o}=e,{store:s}=eA(),l=tD(o.id);return X(()=>(s.set("descriptionElementId",l),()=>{s.set("descriptionElementId",void 0)}),[s,l]),tg("p",e,{ref:t,props:[{id:l},o]})});var eu=eu;let nZ=l.forwardRef(function(e,t){let n,{render:r,className:i,disabled:o=!1,nativeButton:s=!0,style:a,...c}=e,{buttonRef:u,getButtonProps:d}=te({disabled:o,focusableWhenDisabled:!1,native:s}),{store:h}=eA();return X(()=>n?.register(),[n=l.useContext(nH)]),tg("button",e,{ref:[t,u],props:[{onClick(e){h.setOpen(!1,ec(eu.closePress,e.nativeEvent,e.currentTarget))}},c,d]})}),nG=((o={}).popupWidth="--popup-width",o.popupHeight="--popup-height",o);function nY(e){let t=(0,a.getComputedStyle)(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=(0,a.isHTMLElement)(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r;return((0,t5.round)(n)!==o||(0,t5.round)(r)!==s)&&(n=o,r=s),{width:n,height:r}}let nX=()=>!0;
2function nQ(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function n0(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(nQ(e,r,i));return n.length?()=>{n.forEach(e=>e())}:el}function n1(e,t){let n="auto"===t?"auto":`${t.width}px`,r="auto"===t?"auto":`${t.height}px`;e.style.setProperty("--popup-width",n),e.style.setProperty("--popup-height",r)}function n2(e,t){let n="max-content"===t?"max-content":`${t.width}px`,r="max-content"===t?"max-content":`${t.height}px`;e.style.setProperty("--positioner-width",n),e.style.setProperty("--positioner-height",r)}let n9={activationDirection:e=>e?{"data-activation-direction":e}:null},n3=l.forwardRef(function(e,t){let{render:n,className:r,style:i,children:o,...a}=e,{store:c}=eA(),{side:u}=t8(),d=c.useState("instantType"),{children:h,state:p}=function(e){let t,{store:n,side:r,cssVars:i,children:o}=e,a=nr(),c=n.useState("activeTriggerElement"),u=n.useState("activeTriggerId"),d=n.useState("open"),h=n.useState("payload"),p=n.useState("mounted"),f=n.useState("popupElement"),m=n.useState("positionerElement"),g=function(e){let[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}(d?c:null),y=function(e,t){let[n,r]=l.useState(0),i=l.useRef(e),o=l.useRef(t),s=l.useRef(!1);return X(()=>{let n=i.current,l=t!==o.current;e!==n?(r(e=>e+1),s.current=!l):s.current&&l&&(r(e=>e+1),s.current=!1),i.current=e,o.current=t},[e,t]),`${e??"current"}-${n}`}(u,h),v=l.useRef(null),[w,x]=l.useState(null),[k,S]=l.useState(null),E=l.useRef(null),T=l.useRef(null),M=eJ(E,!0,!1),O=ez(),[A,N]=l.useState(null),[R,j]=l.useState(!1);X(()=>(n.set("hasViewport",!0),()=>{n.set("hasViewport",!1)}),[n]);let D=b(()=>{E.current?.style.setProperty("animation","none"),E.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),I=b(e=>{E.current?.style.removeProperty("animation"),E.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),e&&N(e)}),P=l.useRef(null);X(()=>{var e,t;let n,r,i,o;c&&g&&c!==g&&P.current!==c&&v.current&&(x(v.current),j(!0),S((e=g,t=c,n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},{horizontal:(o={x:r.left+r.width/2,y:r.top+r.height/2}).x-i.x,vertical:o.y-i.y})),O.request(()=>{eN.flushSync(()=>{j(!1)}),M(()=>{x(null),N(null),v.current=null})}),P.current=c)},[c,g,w,M,O]),X(()=>{let e=E.current;if(!e)return;let t=C(e).createElement("div");for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));v.current=t});let L=null!=w;return t=L?(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)("div",{"data-previous":!0,inert:t4(!0),ref:T,style:{...A?{[i.popupWidth]:`${A.width}px`,[i.popupHeight]:`${A.height}px`}:null,position:"absolute"},"data-ending-style":R?void 0:""},"previous"),(0,s.jsx)("div",{"data-current":!0,ref:E,"data-starting-style":R?"":void 0,children:o},y)]}):(0,s.jsx)("div",{"data-current":!0,ref:E,children:o},y),X(()=>{let e=T.current;e&&w&&e.replaceChildren(...Array.from(w.childNodes))},[w]),!function(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:o=nX,onMeasureLayout:s,onMeasureLayoutComplete:a,side:c,direction:u}=e,d=eJ(t,!0,!1),h=ez(),p=l.useRef(null),f=l.useRef(null),m=l.useRef(!0),g=l.useRef(el),y=b(s),v=b(a),w=l.useMemo(()=>{let e="top"===c,t="left"===c;return"rtl"===u?(e=e||"inline-end"===c,t=t||"inline-end"===c):(e=e||"inline-start"===c,t=t||"inline-start"===c),e?{position:"absolute",["top"===c?"bottom":"top"]:"0",[t?"right":"left"]:"0"}:ea},[c,u]);X(()=>{if(!i||!o()||"function"!=typeof ResizeObserver){g.current=el,m.current=!0,p.current=null,f.current=null;return}if(!t||!n)return;g.current=n0(t,w);let e=new ResizeObserver(e=>{let t=e[0];t&&(f.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)})});e.observe(t),n1(t,"auto");let r=nQ(t,"position","static"),s=nQ(t,"transform","none"),l=nQ(t,"scale","1"),a=n0(n,{"--available-width":"max-content","--available-height":"max-content"});function c(){r(),s(),a(),l()}if(y?.(),m.current||null===p.current){n2(n,"max-content");let r=nY(t);return p.current=r,n2(n,r),c(),v?.(null,r),m.current=!1,()=>{e.disconnect(),g.current(),g.current=el}}n1(t,"auto"),n2(n,"max-content");let u=p.current??f.current,b=nY(t);if(p.current=b,!u)return n2(n,b),c(),v?.(null,b),()=>{e.disconnect(),h.cancel(),g.current(),g.current=el};n1(t,u),c(),v?.(u,b),n2(n,b);let x=new AbortController;return h.request(()=>{n1(t,b),d(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},x.signal)}
2),()=>{e.disconnect(),x.abort(),h.cancel(),g.current(),g.current=el}},[r,t,n,d,h,o,i,y,v,w])}({popupElement:f,positionerElement:m,mounted:p,content:h,onMeasureLayout:D,onMeasureLayoutComplete:I,side:r,direction:a}),{children:t,state:{activationDirection:function(e){if(e){var t,n;return`${(t=e.horizontal)>5?"right":t<-5?"left":""} ${(n=e.vertical)>5?"down":n<-5?"up":""}`}}(k),transitioning:L}}}({store:c,side:u,cssVars:nG,children:o});return tg("div",e,{state:{activationDirection:p.activationDirection,transitioning:p.transitioning,instant:d},ref:t,props:[a,{children:h}],stateAttributesMapping:n9})});var eu=eu;class n4{constructor(){this.store=new eB}open(e){let t=e?this.store.context.triggerElements.getById(e)??void 0:void 0;if(e&&!t)throw Error(ev(80,e));this.store.setOpen(!0,ec(eu.imperativeAction,void 0,t))}close(){this.store.setOpen(!1,ec(eu.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,nW,"Backdrop",0,nU,"Close",0,nZ,"Description",0,nJ,"Handle",0,n4,"Popup",0,n$,"Portal",0,t3,"Positioner",0,ny,"Root",0,function(e){return eA(!0)?(0,s.jsx)(eG,{props:e}):(0,s.jsx)(es,{children:(0,s.jsx)(eG,{props:e})})},"Title",0,nK,"Trigger",0,tQ,"Viewport",0,n3,"createHandle",0,function(){return new n4}],255946);var n6=e.i(255946);e.s(["Popover",0,n6],262653);var n6=n6,n8={default:"xck50v1",coral:"xck50v2"};e.s(["default",0,({actionsRef:e,Trigger:t,CloseButton:n,side:r,align:i,sideOffset:o,children:l,onOpenChange:a,variant:c="default"})=>(0,s.jsxs)(n6.Root,{actionsRef:e,onOpenChange:a,children:[(0,s.jsx)(n6.Trigger,{onClick:e=>{e.stopPropagation(),e.preventDefault()},children:t}),(0,s.jsx)(n6.Portal,{children:(0,s.jsx)(n6.Positioner,{align:i,side:r,sideOffset:o,className:"xck50v0",children:(0,s.jsx)(n6.Popup,{className:n8[c],children:l})})}),n&&(0,s.jsx)(n6.Close,{onClick:e=>{e.preventDefault(),e.stopPropagation()},children:n})]})],678506)},578746,366392,701447,437944,200381,932451,458938,e=>{"use strict";function t(e){this.content=e}t.prototype={constructor:t,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,n,r){var i=r&&r!=e?this.remove(r):this,o=i.find(e),s=i.content.slice();return -1==o?s.push(r||e,n):(s[o+1]=n,r&&(s[o]=r)),new t(s)},remove:function(e){var n=this.find(e);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new t(r)},addToStart:function(e,n){return new t([e,n].concat(this.remove(e).content))},addToEnd:function(e,n){var r=this.remove(e).content.slice();return r.push(e,n),new t(r)},addBefore:function(e,n,r){var i=this.remove(n),o=i.content.slice(),s=i.find(e);return o.splice(-1==s?o.length:s,0,n,r),new t(o)},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=t.from(e)).size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=t.from(e)).size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var n=this;e=t.from(e);for(var r=0;r<e.content.length;r+=2)n=n.remove(e.content[r]);return n},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var n=[];if(e)for(var r in e)n.push(r,e[r]);return new t(n)};class n{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,n,r=0,i){for(let o=0,s=0;s<t;o++){let l=this.content[o],a=s+l.nodeSize;if(a>e&&!1!==n(l,r+s,i||null,o)&&l.content.size){let i=s+1;l.nodesBetween(Math.max(0,e-i),Math.min(l.content.size,t-i),n,r+i)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let a=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&a||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=a},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new n(i,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let r=[],i=0;if(t>e)for(let n=0,o=0;o<t;n++){let s=this.content[n],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),r.push(s),i+=s.nodeSize),o=l}return new n(r,i)}cutByIndex(e,t){return e==t?n.empty:0==e&&t==this.content.length?this:new n(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;
2let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new n(i,o)}addToStart(e){return new n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new n(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,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let o=t.child(i),s=n.child(i);if(o==s){r+=o.nodeSize;continue}if(!o.sameMarkup(s))return r;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)r++;return r}if(o.content.size||s.content.size){let t=e(o.content,s.content,r+1);if(null!=t)return t}r+=o.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let o=t.childCount,s=n.childCount;;){if(0==o||0==s)return o==s?null:{a:r,b:i};let l=t.child(--o),a=n.child(--s),c=l.nodeSize;if(l==a){r-=c,i-=c;continue}if(!l.sameMarkup(a))return{a:r,b:i};if(l.isText&&l.text!=a.text){let e=0,t=Math.min(l.text.length,a.text.length);for(;e<t&&l.text[l.text.length-e-1]==a.text[a.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(l.content.size||a.content.size){let t=e(l.content,a.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return i(0,e);if(e==this.size)return i(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return i(t+1,r);return i(t,n)}n=r}}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 n.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return new n(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return n.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 n(t||e,r)}static from(e){if(!e)return n.empty;if(e instanceof n)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new n([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}n.empty=new n([],0);let r={index:0,offset:0};function i(e,t){return r.index=e,r.offset=t,r}function o(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!o(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!o(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class s{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||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&&o(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 n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;
2if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return s.none;if(e instanceof s)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}s.none=[];class l extends Error{}class a{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i){let{index:o,offset:s}=t.findIndex(n),l=t.maybeChild(o);if(s==n||l.isText)return i&&!i.canReplace(o,o,r)?null:t.cut(0,n).append(r).append(t.cut(n));let a=e(l.content,n-s-1,r,l);return a&&t.replaceChild(o,l.copy(a))}(this.content,e+this.openStart,t);return n&&new a(n,this.openStart,this.openEnd)}removeBetween(e,t){return new a(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:l,offset:a}=t.findIndex(r);if(o==n||s.isText){if(a!=r&&!t.child(l).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=l)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-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 a.empty;let r=t.openStart||0,i=t.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw RangeError("Invalid input for Slice.fromJSON");return new a(n.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new a(e,n,r)}}function c(e,t){if(!t.type.compatibleContent(e.type))throw new l("Cannot join "+t.type.name+" onto "+e.type.name)}function u(e,t,n){let r=e.node(n);return c(r,t.node(n)),r}function d(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function h(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(d(e.nodeAfter,r),o++));for(let e=o;e<s;e++)d(i.child(e),r);t&&t.depth==n&&t.textOffset&&d(t.nodeBefore,r)}function p(e,t){return e.type.checkContent(t),e.copy(t)}function f(e,t,r){let i=[];return h(null,e,r,i),e.depth>r&&d(p(u(e,t,r+1),f(e,t,r+1)),i),h(t,null,r,i),new n(i)}a.empty=new a(n.empty,0,0);class m{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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 n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return s.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new b(this,e,n);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 n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;
2i=s-1,r+=o+1}return new m(t,n,i)}static resolveCached(e,t){let n=v.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else v.set(e,n=new g);let r=n.elts[n.i]=m.resolve(e,t);return n.i=(n.i+1)%y,r}}class g{constructor(){this.elts=[],this.i=0}}let y=12,v=new WeakMap;class b{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let w=Object.create(null);class x{constructor(e,t,r,i=s.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||n.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,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}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,n){return this.type==e&&o(this.attrs,t||e.defaultAttrs||w)&&s.sameSet(this.marks,n||s.none)}copy(e=null){return e==this.content?this:new x(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new x(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,n=!1){if(e==t)return a.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new a(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,r){var i=this.resolve(e),o=this.resolve(t);if(r.openStart>i.depth)throw new l("Inserted content deeper than insertion position");if(i.depth-r.openStart!=o.depth-r.openEnd)throw new l("Inconsistent open depths");return function e(t,r,i,o){let s=t.index(o),l=t.node(o);if(s==r.index(o)&&o<t.depth-i.openStart){let n=e(t,r,i,o+1);return l.copy(l.content.replaceChild(s,n))}if(!i.content.size)return p(l,f(t,r,o));if(i.openStart||i.openEnd||t.depth!=o||r.depth!=o){let{start:e,end:s}=function(e,t){let r=t.depth-e.openStart,i=t.node(r).copy(e.content);for(let e=r-1;e>=0;e--)i=t.node(e).copy(n.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}(i,t);return p(l,function e(t,r,i,o,s){let l=t.depth>s&&u(t,r,s+1),a=o.depth>s&&u(i,o,s+1),m=[];return h(null,t,s,m),l&&a&&r.index(s)==i.index(s)?(c(l,a),d(p(l,e(t,r,i,o,s+1)),m)):(l&&d(p(l,f(t,r,s+1)),m),h(r,i,s,m),a&&d(p(a,f(i,o,s+1)),m)),h(o,null,s,m),new n(m)}(t,e,s,r,o))}{let e=t.parent,n=e.content;return p(e,n.cut(0,t.parentOffset).append(i.content).append(n.cut(r.parentOffset)))}}(i,o,r,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return m.resolveCached(this,e)}resolveNoCache(e){return m.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}
2toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),k(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=n.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let e=i;e<o;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.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=s.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!s.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.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 i=n.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}x.prototype.text=void 0;class C extends x{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):k(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 C(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new C(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 k(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class S{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new E(e,t);if(null==i.next)return S.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}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("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=T(e),r=n;return e.eat(",")&&(r="}"!=e.next?T(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}
2function i(e,t){e.forEach(e=>e.to=t)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);O(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new S(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(M);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(O(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),s}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,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];return function o(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return n.from(l.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==i.indexOf(n)){i.push(n);let e=o(n,l.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),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.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(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}S.empty=new S(!0);class E{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 T(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function M(e,t){return t-e}function O(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(M)}function A(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function N(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function R(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function j(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new I(e,r,t[r]);return n}class D{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=j(e,n.attrs),this.defaultAttrs=A(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==S.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:N(this.attrs,e)}create(e=null,t,r){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new x(this,this.computeAttrs(e),n.from(t),s.setFrom(r))}createChecked(e=null,t,r){return t=n.from(t),this.checkContent(t),new x(this,this.computeAttrs(e),t,s.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),(t=n.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(n.empty,!0);return o?new x(this,e,t.append(o),s.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);
2if(!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){R(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 n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:s.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new D(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class I{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class P{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=j(e,r.attrs),this.excluded=null;let i=A(this.attrs);this.instance=i?new s(this,i):null}create(e=null){return!e&&this.instance?this.instance:new s(this,N(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new P(e,r++,t,i)),n}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){R(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class L{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let t in e)n[t]=e[t];n.nodes=t.from(e.nodes),n.marks=t.from(e.marks||{}),this.nodes=D.compile(this.spec.nodes,this),this.marks=P.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]=S.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?_(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:_(this,n.split(" "))}this.nodeFromJSON=e=>x.fromJSON(this,e),this.markFromJSON=e=>s.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof D){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,n,r)}text(e,t){let n=this.nodes.text;return new C(n,n.defaultAttrs,e,s.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 _(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class V{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];
2t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new W(this,t,!1);return n.addAll(e,s.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new W(this,t,!0);return n.addAll(e,s.none,t.from,t.to),a.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=q(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=q(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new V(e,V.schemaRules(e)))}}let B={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},H={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},F={ol:!0,ul:!0};function z(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class ${constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=s.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(n.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):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=n.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(n.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&&!B.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class W{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=z(null,t.preserveWhitespace,0)|4*!!n;i=r?new $(r.type,r.attrs,s.none,!0,t.topMatch||r.type.contentMatch,o):n?new $(null,null,s.none,!0,null,o):new $(e.schema.topNodeType,null,s.none,!0,null,o),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 n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;F.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&F.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(l?l.ignore:H.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let n,r=this.needsBlock;if(B.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let s=l&&l.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,l,n,!1===l.consuming?s:void 0)}this.localPreserveWS=r}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 n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;
2if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],l=s.findWrapping(e);if(l&&(!r||r.length>l.length+o)&&(r=l,i=s,!l.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=s.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):U(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=z(e,i,o.options);4&o.options&&0==o.content.length&&(l|=4);let a=s.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!U(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new $(e,t,a,r,null,l)),this.open++,n}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 n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].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,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].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("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,o=(e,s)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];
2if(t.isTextblock&&t.defaultAttrs)return t}}}function q(e){let t={};for(let n in e)t[n]=e[n];return t}function U(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class K{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Z(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Y(Z(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Y(Z(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Y(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new K(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=J(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return J(e.marks)}}function J(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Z(e){return e.document||window.document}let G=new WeakMap;function Y(e,t,n,r){let i,o,s;if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let l=t[0],a;if("string"!=typeof l)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=G.get(r))&&G.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),a=o)&&a.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 c=l.indexOf(" ");c>0&&(n=l.slice(0,c),l=l.slice(c+1));let u=n?e.createElementNS(n,l):e.createElement(l),d=t[1],h=1;if(d&&"object"==typeof d&&null==d.nodeType&&!Array.isArray(d)){for(let e in h=2,d)if(null!=d[e]){let t=e.indexOf(" ");t>0?u.setAttributeNS(e.slice(0,t),e.slice(t+1),d[e]):"style"==e&&u.style?u.style.cssText=d[e]:u.setAttribute(e,d[e])}}for(let o=h;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>h)throw RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}{let{dom:t,contentDOM:o}=Y(e,s,n,r);if(u.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:u,contentDOM:i}}class X{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class Q{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Q.empty)return Q.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+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,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[s+i],c=this.ranges[s+o],u=l+a;if(e<=u){let i=a?e==l?-1:e==u?1:t:t,o=l+r+(i<0?0:c);if(n)return o;let d=e==(t<0?l:u)?null:s/3+(e-l)*65536,h=e==l?2:e==u?1:4;return(t<0?e!=l:e!=u)&&(h|=8),new X(o,h,d)}r+=c-a}return n?e+r:new X(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;
2for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[t+i];if(e<=s+l&&t==3*r)return!0;n+=this.ranges[t+o]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),l=o+(this.inverted?0:i),a=this.ranges[r+t],c=this.ranges[r+n];e(s,s+a,l,l+c),i+=c-a}}invert(){return new Q(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?Q.empty:new Q(e<0?[0,-e,0]:[0,0,e])}}Q.empty=new Q([]);class ee{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ee(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,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r: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,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new ee;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new X(e,r,null)}}let et=Object.create(null);class en{getMap(){return Q.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=et[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in et)throw RangeError("Duplicate use of step JSON ID "+e);return et[e]=t,t.prototype.jsonID=e,t}}class er{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new er(e,null)}static fail(e){return new er(null,e)}static fromReplace(e,t,n,r){try{return er.ok(e.replace(t,n,r))}catch(e){if(e instanceof l)return er.fail(e.message);throw e}}}function ei(e,t,r){let i=[];for(let n=0;n<e.childCount;n++){let o=e.child(n);o.content.size&&(o=o.copy(ei(o.content,t,o))),o.isInline&&(o=t(o,r,n)),i.push(o)}return n.fromArray(i)}class eo extends en{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new a(ei(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return er.fromReplace(e,this.from,this.to,i)}invert(){return new es(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new eo(t.pos,n.pos,this.mark)}merge(e){return e instanceof eo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eo(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 eo(t.from,t.to,e.markFromJSON(t.mark))}}en.jsonID("addMark",eo);class es extends en{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new a(ei(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return er.fromReplace(e,this.from,this.to,n)}invert(){return new eo(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new es(t.pos,n.pos,this.mark)}merge(e){return e instanceof es&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new es(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 es(t.from,t.to,e.markFromJSON(t.mark))}}en.jsonID("removeMark",es);class el extends en{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return er.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return er.fromReplace(e,this.pos,this.pos+1,new a(n.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 n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new el(this.pos,t.marks[n]);return new el(this.pos,this.mark)}}return new ea(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new el(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 el(t.pos,e.markFromJSON(t.mark))}}en.jsonID("addNodeMark",el);class ea extends en{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return er.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return er.fromReplace(e,this.pos,this.pos+1,new a(n.from(r),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new el(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ea(t.pos,this.mark)}
2toJSON(){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 ea(t.pos,e.markFromJSON(t.mark))}}en.jsonID("removeNodeMark",ea);class ec extends en{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ed(e,this.from,this.to)?er.fail("Structure replace would overwrite content"):er.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Q([this.from,this.to-this.from,this.slice.size])}invert(e){return new ec(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&ec.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new ec(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ec)||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?a.empty:new a(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ec(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?a.empty:new a(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ec(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 ec(t.from,t.to,a.fromJSON(e,t.slice),!!t.structure)}}ec.MAP_BIAS=1,en.jsonID("replace",ec);class eu extends en{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(ed(e,this.from,this.gapFrom)||ed(e,this.gapTo,this.to)))return er.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return er.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?er.fromReplace(e,this.from,this.to,n):er.fail("Content does not fit in gap")}getMap(){return new Q([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 eu(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),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new eu(t.pos,n.pos,r,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 eu(t.from,t.to,t.gapFrom,t.gapTo,a.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ed(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function eh(e,t,r,i=r.contentMatch,o=!0){let s=e.doc.nodeAt(t),l=[],c=t+1;for(let t=0;t<s.childCount;t++){let u=s.child(t),d=c+u.nodeSize,h=i.matchType(u.type);if(h){i=h;for(let t=0;t<u.marks.length;t++)r.allowsMarkType(u.marks[t].type)||e.step(new es(c,d,u.marks[t]));if(o&&u.isText&&"pre"!=r.whitespace){let e,t=/\r?\n|\r/g,i;for(;e=t.exec(u.text);)i||(i=new a(n.from(r.schema.text(" ",r.allowedMarks(u.marks))),0,0)),l.push(new ec(c+e.index,c+e.index+e[0].length,i))}}else l.push(new ec(c,d,a.empty));c=d}if(!i.validEnd){let t=i.fillBefore(n.empty,!0);
2e.replace(c,c,new a(t,0,0))}for(let t=l.length-1;t>=0;t--)e.step(l[t])}function ep(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,l=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,l,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(l==o.childCount||o.canReplace(0,l))))break;s&&(r=1),l<o.childCount&&(i=1)}return null}function ef(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;l&&e<i;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?s:null}(r,t);return o?i.map(em).concat({type:t,attrs:n}).concat(o.map(em)):null}function em(e){return{type:e,attrs:null}}function eg(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function ey(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function ev(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),l=r&&r[t+1];l&&(s=s.replaceChild(0,l.type.create(l.attrs)));let a=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!a.type.validContent(s))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function eb(e,t){let n=e.resolve(t),r=n.index();return ew(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ew(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function ex(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&ew(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function eC(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),l=!1;if(1==e)l=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);l=e&&s.canReplaceWith(o,o,e[0])}if(l)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function ek(e,t,n=t,r=a.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return eS(i,o,r)?new ec(t,n,r):new eE(i,o,r).fit()}function eS(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}en.jsonID("replaceAround",eu);class eE{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=n.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=n.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,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let l=new a(i,o,s);return e>-1?new eu(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new ec(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;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,i=(r?(e=eO(this.unplaced.content,r-1).firstChild).content:this.unplaced.content).firstChild;for(let o=this.depth;o>=0;o--){let{type:s,match:l}=this.frontier[o],a,c=null;if(1==t&&(i?l.matchType(i.type)||(c=l.fillBefore(n.from(i),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:r,frontierDepth:o,parent:e,inject:c};
vendor: 5,537 bytes, line 2
2if(2==t&&i&&(a=l.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:o,parent:e,wrap:a};if(e&&l.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eO(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new a(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eO(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new a(eT(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new a(eT(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let s=this.unplaced,l=r?r.content:s.content,c=s.openStart-e,u=0,d=[],{match:h,type:p}=this.frontier[t];if(i){for(let e=0;e<i.childCount;e++)d.push(i.child(e));h=h.matchFragment(i)}let f=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let e=l.child(u),t=h.matchType(e.type);if(!t)break;(++u>1||0==c||e.content.size)&&(h=t,d.push(function e(t,r,i){if(r<=0)return t;let o=t.content;return r>1&&(o=o.replaceChild(0,e(o.firstChild,r-1,1==o.childCount?i-1:0))),r>0&&(o=t.type.contentMatch.fillBefore(o).append(o),i<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(n.empty,!0)))),t.copy(o)}(e.mark(p.allowedMarks(e.marks)),1==u?c:0,u==l.childCount?f:-1)))}let m=u==l.childCount;m||(f=-1),this.placed=eM(this.placed,t,n.from(d)),this.frontier[t].match=h,m&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=l;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=m?0==e?a.empty:new a(eT(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new a(eT(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!eA(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=eA(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=eA(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:o,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=eM(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=eM(this.placed,this.depth,n.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(n.empty,!0);e.childCount&&(this.placed=eM(this.placed,this.frontier.length,e))}}function eT(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(eT(e.firstChild.content,t-1,n)))}function eM(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(eM(e.lastChild.content,t-1,n)))}function eO(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function eA(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?l:null}function eN(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<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;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class eR extends en{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return er.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 i=t.type.create(r,null,t.marks);return er.fromReplace(e,this.pos,this.pos+1,new a(n.from(i),0,+!t.isLeaf))}getMap(){return Q.empty}invert(e){return new eR(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 eR(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 eR(t.pos,t.attr,t.value)}}en.jsonID("attr",eR);class ej extends en{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return er.ok(n)}getMap(){return Q.empty}invert(e){return new ej(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 ej(t.attr,t.value)}}en.jsonID("docAttr",ej);
2let eD=class extends Error{};(eD=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),eD.prototype.constructor=eD,eD.prototype.name="TransformError";class eI{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ee}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eD(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 n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}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,n=a.empty){let r=ek(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,r){return this.replace(e,t,new a(n.from(r),0,0))}delete(e,t){return this.replace(e,t,a.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return!function(e,t,r,i){if(!i.size)return e.deleteRange(t,r);let o=e.doc.resolve(t),s=e.doc.resolve(r);if(eS(o,s,i))return e.step(new ec(t,r,i));let l=eN(o,s);0==l[l.length-1]&&l.pop();let c=-(o.depth+1);l.unshift(c);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;l.indexOf(e)>-1?c=e:o.before(e)==t&&l.splice(1,0,-e)}let u=l.indexOf(c),d=[],h=i.openStart;for(let e=i.content,t=0;;t++){let n=e.firstChild;if(d.push(n),t==i.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){var p;let t=d[e],n=(p=t.type).spec.defining||p.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(c)-1)))h=e;else if(n||!t.type.isTextblock)break}for(let t=i.openStart;t>=0;t--){let c=(t+h+1)%(i.openStart+1),p=d[c];if(p)for(let t=0;t<l.length;t++){let d=l[(t+u)%l.length],h=!0;d<0&&(h=!1,d=-d);let f=o.node(d-1),m=o.index(d-1);if(f.canReplaceWith(m,m,p.type,p.marks))return e.replace(o.before(d),h?s.after(d):r,new a(function e(t,r,i,o,s){if(r<i){let n=t.firstChild;t=t.replaceChild(0,n.copy(e(n.content,r+1,i,o,n)))}if(r>o){let e=s.contentMatchAt(0),r=e.fillBefore(t).append(t);t=r.append(e.matchFragment(r).fillBefore(n.empty,!0))}return t}(i.content,0,i.openStart,c),c,i.openEnd))}}let f=e.steps.length;for(let n=l.length-1;n>=0&&(e.replace(t,r,i),!(e.steps.length>f));n--){let e=l[n];e<0||(t=o.before(e),r=s.after(e))}}(this,e,t,r),this}replaceRangeWith(e,t,r){var i=e,o=t;if(!r.isInline&&i==o&&this.doc.resolve(i).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,i,r.type);null!=e&&(i=o=e)}return this.replaceRange(i,o,new a(n.from(r),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let o=eN(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,r){let{$from:i,$to:o,depth:s}=t,l=i.before(s+1),c=o.after(s+1),u=l,d=c,h=n.empty,p=0;for(let e=s,t=!1;e>r;e--)t||i.index(e)>
20?(t=!0,h=n.from(i.node(e).copy(h)),p++):u--;let f=n.empty,m=0;for(let e=s,t=!1;e>r;e--)t||o.after(e+1)<o.end(e)?(t=!0,f=n.from(o.node(e).copy(f)),m++):d++;e.step(new eu(u,d,l,c,new a(h.append(f),p,m),h.size-p,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let l=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);ey(e,r.node(),r.before(),l)}s.inlineContent&&eh(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let c=e.mapping.slice(l),u=c.map(t-n);if(e.step(new ec(u,c.map(t+n,-1),a.empty,!0)),!0===r){let t=e.doc.resolve(u);eg(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,r){let i=n.empty;for(let e=r.length-1;e>=0;e--){if(i.size){let t=r[e].type.contentMatch.matchFragment(i);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=n.from(r[e].type.create(r[e].attrs,i))}let o=t.start,s=t.end;e.step(new eu(o,s,o,s,new a(i,0,0),r.length,!0))}(this,e,t),this}setBlockType(e,t=e,r,i=null){var o=this;if(!r.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=o.steps.length;return o.doc.nodesBetween(e,t,(e,t)=>{var l,c,u;let d,h,p="function"==typeof i?i(e):i;if(e.isTextblock&&!e.hasMarkup(r,p)&&(l=o.doc,c=o.mapping.slice(s).map(t),u=r,h=(d=l.resolve(c)).index(),d.parent.canReplaceWith(h,h+1,u))){let i=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}!1===i&&ey(o,e,t,s),eh(o,o.mapping.slice(s).map(t,1),r,void 0,null===i);let l=o.mapping.slice(s),c=l.map(t,1),u=l.map(t+e.nodeSize,1);return o.step(new eu(c,u,c+1,u-1,new a(n.from(r.create(p,null,e.marks)),0,0),1,!0)),!0===i&&eg(o,e,t,s),!1}}),this}setNodeMarkup(e,t,r=null,i){return!function(e,t,r,i,o){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");r||(r=s.type);let l=r.create(i,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,l);if(!r.validContent(s.content))throw RangeError("Invalid content for node type "+r.name);e.step(new eu(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new a(n.from(l),0,0),1,!0))}(this,e,t,r,i),this}setNodeAttribute(e,t,n){return this.step(new eR(e,t,n)),this}setDocAttribute(e,t){return this.step(new ej(e,t)),this}addNodeMark(e,t){return this.step(new el(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof s)t.isInSet(n.marks)&&this.step(new ea(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new ea(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,r){return!function(e,t,r=1,i){let o=e.doc.resolve(t),s=n.empty,l=n.empty;for(let e=o.depth,t=o.depth-r,a=r-1;e>t;e--,a--){s=n.from(o.node(e).copy(s));let t=i&&i[a];l=n.from(t?t.type.create(t.attrs,l):o.node(e).copy(l))}e.step(new ec(t,t,new a(s.append(l),r,r),!0))}(this,e,t,r),this}addMark(e,t,n){var r;let i,o,s,l;return r=this,s=[],l=[],r.doc.nodesBetween(e,t,(r,a,c)=>{if(!r.isInline)return;let u=r.marks;if(!n.isInSet(u)&&c.type.allowsMarkType(n.type)){let c=Math.max(a,e),d=Math.min(a+r.nodeSize,t),h=n.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(u[e])?i.to=d:s.push(i=new es(c,d,u[e])));o&&o.to==c?o.to=d:l.push(o=new eo(c,d,n))}}),s.forEach(e=>r.step(e)),l.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let l=null;if(n instanceof P){let e=r.marks,t;for(;t=n.isInSet(e);)(l||(l=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(l=[n]):l=r.marks;if(l&&l.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<l.length;t++){let r=l[t],a;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(a=t)}a?(a.to=n,a.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}
2),i.forEach(e=>r.step(new es(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return eh(this,e,t,n),this}}let eP=Object.create(null);class eL{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new e_(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=a.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:c}=o[s],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),s?a.empty:t),0==s&&eK(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],l=e.mapping.slice(n),a=l.map(o.pos),c=l.map(s.pos);i?e.deleteRange(a,c):(e.replaceRangeWith(a,c,t),eK(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new eH(e):eU(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?eU(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):eU(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}
2static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new eW(e.node(0))}static atStart(e){return eU(e,e,0,0,1)||new eW(e)}static atEnd(e){return eU(e,e,e.content.size,e.childCount,-1)||new eW(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=eP[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in eP)throw RangeError("Duplicate use of selection JSON ID "+e);return eP[e]=t,t.prototype.jsonID=e,t}getBookmark(){return eH.between(this.$anchor,this.$head).getBookmark()}}eL.prototype.visible=!0;class e_{constructor(e,t){this.$from=e,this.$to=t}}let eV=!1;function eB(e){eV||e.parent.inlineContent||(eV=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class eH extends eL{constructor(e,t=e){eB(e),eB(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return eL.near(n);let r=e.resolve(t.map(this.anchor));return new eH(r.parent.inlineContent?r:n,n)}replace(e,t=a.empty){if(super.replace(e,t),t==a.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof eH&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new eF(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 eH(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=eL.findFrom(t,n,!0)||eL.findFrom(t,-n,!0);if(!e)return eL.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(eL.findFrom(e,-n,!0)||eL.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new eH(e,t)}}eL.jsonID("text",eH);class eF{constructor(e,t){this.anchor=e,this.head=t}map(e){return new eF(e.map(this.anchor),e.map(this.head))}resolve(e){return eH.between(e.resolve(this.anchor),e.resolve(this.head))}}class ez extends eL{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?eL.near(i):new ez(i)}content(){return new a(n.from(this.node),0,0)}eq(e){return e instanceof ez&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new e$(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new ez(e.resolve(t.anchor))}static create(e,t){return new ez(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}ez.prototype.visible=!1,eL.jsonID("node",ez);class e${constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new eF(n,n):new e$(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&ez.isSelectable(n)?new ez(t):eL.near(t)}}class eW extends eL{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=a.empty){if(t==a.empty){e.delete(0,e.doc.content.size);let t=eL.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new eW(e)}map(e){return new eW(e)}eq(e){return e instanceof eW}getBookmark(){return eq}}eL.jsonID("all",eW);let eq={map(){return this},resolve:e=>new eW(e)};function eU(e,t,n,r,i,o=!1){if(t.inlineContent)return eH.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&ez.isSelectable(r))return ez.create(e,n-(i<0?r.nodeSize:0))}else{let t=eU(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function eK(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof ec||o instanceof eu)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(eL.near(e.doc.resolve(r),n)))}class eJ extends eI{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 s.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 n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||s.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(eL.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 eZ(e,t){return t&&e?e.bind(t):e}class eG{constructor(e,t,n){this.name=e,this.init=eZ(t.init,n),this.apply=eZ(t.apply,n)}}let eY=[new eG("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new eG("selection",{init:(e,t)=>
2e.selection||eL.atStart(t.doc),apply:e=>e.selection}),new eG("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new eG("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class eX{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=eY.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 eG(e.key,e.spec.state,e))})}}class eQ{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 n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];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],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let l=r?r[o].n:0,a=r?r[o].state:this,c=l<t.length&&s.spec.appendTransaction.call(s,l?t.slice(l):t,a,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new eQ(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new eJ(this)}static create(e){let t=new eX(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new eQ(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new eX(this.schema,e.plugins),n=t.fields,r=new eQ(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}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 n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new eX(e.schema,e.plugins),i=new eQ(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=x.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=eL.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],l=s.spec.state;if(s.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[r.name]=l.fromJSON.call(s,e,t[o],i);return}}i[r.name]=r.init(e,i)}}),i}}class e0{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:e2("plugin")}getState(e){return e[this.key]}}let e1=Object.create(null);function e2(e){return e in e1?e+"$"+ ++e1[e]:(e1[e]=0,e+"$")}class e9{constructor(e="key"){this.key=e2(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let e3=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},e4=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},e6=null,e8=function(e,t,n){let r=e6||(e6=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},e5=function(){e6=null},e7=function(e,t,n,r){return n&&(tt(e,t,n,r,-1)||tt(e,t,n,r,1))},te=/^(img|br|input|textarea|hr)$/i;function tt(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;
2if(t==(i<0?0:tn(e))){let n=e.parentNode;if(!n||1!=n.nodeType||tr(e)||te.test(e.nodeName)||"false"==e.contentEditable)return!1;t=e3(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?tn(e):0}}}function tn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function tr(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let ti=function(e){return e.focusNode&&e7(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function to(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let ts="u">typeof navigator?navigator:null,tl="u">typeof document?document:null,ta=ts&&ts.userAgent||"",tc=/Edge\/(\d+)/.exec(ta),tu=/MSIE \d/.exec(ta),td=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ta),th=!!(tu||td||tc),tp=tu?document.documentMode:td?+td[1]:tc?+tc[1]:0,tf=!th&&/gecko\/(\d+)/i.test(ta);tf&&(/Firefox\/(\d+)/.exec(ta)||[0,0])[1];let tm=!th&&/Chrome\/(\d+)/.exec(ta),tg=!!tm,ty=tm?+tm[1]:0,tv=!th&&!!ts&&/Apple Computer/.test(ts.vendor),tb=tv&&(/Mobile\/\w+/.test(ta)||!!ts&&ts.maxTouchPoints>2),tw=tb||!!ts&&/Mac/.test(ts.platform),tx=!!ts&&/Win/.test(ts.platform),tC=/Android \d/.test(ta),tk=!!tl&&"webkitFontSmoothing"in tl.documentElement.style,tS=tk?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tE(e,t){return"number"==typeof e?e:e[t]}function tT(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=e4(s);continue}let e=s,n=e==o.body,l=n?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}}(o):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),a=0,c=0;if(t.top<l.top+tE(r,"top")?c=-(l.top-t.top+tE(i,"top")):t.bottom>l.bottom-tE(r,"bottom")&&(c=t.bottom-t.top>l.bottom-l.top?t.top+tE(i,"top")-l.top:t.bottom-l.bottom+tE(i,"bottom")),t.left<l.left+tE(r,"left")?a=-(l.left-t.left+tE(i,"left")):t.right>l.right-tE(r,"right")&&(a=t.right-l.right+tE(i,"right")),a||c)if(n)o.defaultView.scrollBy(a,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),a&&(e.scrollLeft+=a);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let u=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(u))break;s="absolute"==u?s.offsetParent:e4(s)}}function tM(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=e4(r));return t}function tO(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let tA=null;function tN(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function tR(e){return e.top<e.bottom||e.left<e.right}function tj(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(tR(e))return e}return Array.prototype.find.call(n,tR)||e.getBoundingClientRect()}let tD=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tI(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=tk||tf;if(3==r.nodeType)if(s&&(tD.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=tj(e8(r,i,i),n);if(tf&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=tj(e8(r,i-1,i-1),-1);if(t.top==e.top){let n=tj(e8(r,i,i+1),-1);if(n.top!=e.top)return tP(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,tP(tj(e8(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==tn(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return tL(e.getBoundingClientRect(),!1)}if(null==o&&i<tn(r)){let e=r.childNodes[i];if(1==e.nodeType)return tL(e.getBoundingClientRect(),!0)}return tL(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==tn(r))){let e=r.childNodes[i-1],t=3==e.nodeType?e8(e,tn(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return tP(tj(t,1),!1)}if(null==o&&i<tn(r)){let e=r.childNodes[i];for(;
2e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?e8(e,0,+!s):1==e.nodeType?e:null:null;if(t)return tP(tj(t,-1),!0)}return tP(tj(3==r.nodeType?e8(r):r,-n),n>=0)}function tP(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function tL(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function t_(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let tV=/[\u0590-\u08ac]/,tB=null,tH=null,tF=!1;class tz{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){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,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=t>e3(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>e||i instanceof tZ){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof t$&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?e3(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?e3(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],l=o+n.size;if(-1==r&&e<=l){let i=o+n.border;if(e>=i&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=e3(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||s==this.children.length-1)){t=l;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=e3(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,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:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,l=0;s<this.children.length;s++){let a=this.children[s],c=l+a.size;if(i>l&&o<c)return a.setSelection(e-l-a.border,t-l-a.border,n,r);l=c}let s=this.domFromPos(e,e?-1:1),l=t==e?s:this.domFromPos(t,t?-1:1),a=n.root.getSelection(),c=n.domSelectionRange(),u=!1;if((tf||tv)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((u=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=l={node:n.parentNode,offset:e3(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(tf&&c.focusNode&&c.focusNode!=l.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||u&&tv)&&e7(s.node,s.offset,c.anchorNode,c.anchorOffset)&&e7(l.node,l.offset,c.focusNode,c.focusOffset))return;let d=!1;if((a.extend||e==t)&&!(u&&tf)){a.collapse(s.node,s.offset);try{e!=t&&a.extend(l.node,l.offset),d=!0}catch(e){}}if(!d){if(e>t){let e=s;s=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.addRange(n)}}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 n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class t$ extends tz{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,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 tW extends tz{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}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 tq extends tz{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}
2static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=K.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new tq(e,t,o.dom,o.contentDOM||o.dom,o)}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,n){let r=tq.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=t6(i,t,o,n)),e>0&&(i=t6(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class tU extends tz{constructor(e,t,n,r,i,o,s,l,a){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],l,a=s&&s(t,i,()=>l?l.parent?l.parent.posBeforeChild(l):void 0:o,n,r),c=a&&a.dom,u=a&&a.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=K.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:u}=e)}u||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let d=c;return(c=t1(c,n,t),a)?l=new tG(e,t,n,r,c,u||null,d,a,i,o+1):t.isText?new tJ(e,t,n,r,c,d,i):new tU(e,t,n,r,c,u||null,d,i,o+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 n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>n.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&t2(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new t3(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d,h,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(u?(d||(d=[u])).push(e):u=e)}if(u)if(d){d.sort(t4);for(let e=0;e<d.length;e++)n(d[e],c,!!a)}else n(u,c,!!a);if(a)p=-1,h=a,a=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let e=0;e<l.length;e++)l[e].to<=o&&l.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let f=o+h.nodeSize;if(h.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(a=h.cut(e-o),h=h.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=h.isInline&&!h.isLeaf?l.filter(e=>!e.inline):l.slice();r(h,m,t.forChild(o,h),p),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&a.syncToMarks(i==this.node.childCount?s.none:this.node.child(i).marks,n,e,i),a.placeWidget(t,e,r)},(t,o,s,c)=>{let u;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,o,s,c)||l&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,s,u,e)||a.updateNextNode(t,o,s,e,c,r)||a.addNode(t,o,s,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let l=n[s],a=l.dom;if(a.parentNode==t){for(;a!=i;)i=t9(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(a,i);if(l instanceof tq){let n=i?i.previousSibling:t.lastChild;e(l.contentDOM,l.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=t9(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),tb&&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:n,to:r}=e.state.selection;if(!(e.state.selection instanceof eH)||n<t||r>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,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;a+=t.text}
2if(o>=n){if(o>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let e=l<r?a.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){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 o=new tW(this,i,t,r);e.input.compositionNodes.push(o),this.children=t6(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(t2(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=t0(this.dom,this.nodeDOM,tQ(this.outerDeco,this.node,t),tQ(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=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 tK(e,t,n,r,i){t1(r,t,e);let o=new tU(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class tJ extends tU{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){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,r.trackWrites==this.nodeDOM&&(r.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,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new tJ(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}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 tZ extends tz{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 tG extends tU{constructor(e,t,n,r,i,o,s,l,a,c){super(e,t,n,r,i,o,s,a,c),this.spec=l}update(e,t,n,r){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,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}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 tY=function(e){e&&(this.nodeName=e)};tY.prototype=Object.create(null);let tX=[new tY];function tQ(e,t,n){if(0==e.length)return tX;let r=n?tX[0]:new tY,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new tY(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new tY(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function t0(e,t,n,r){if(n==tX&&r==tX)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=tX[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);
2if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(i,s||tX[0],o)}return i}function t1(e,t,n){return t0(e,e,tX,tQ(t,n,1!=e.nodeType))}function t2(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function t9(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class t3{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];n:for(;i>0;){let l;for(;;)if(r){let e=n.children[r-1];if(e instanceof tq)n=e,r=e.children.length;else{l=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let a=l.node;if(a){if(a!=e.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.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 r=tq.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),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,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof tU){let a=this.preMatch.matched.get(l);if(null!=a&&a!=i)return!1;let c=l.dom,u,d=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&t2(t,l.outerDeco));if(!d&&l.update(e,t,n,r))return this.destroyBetween(this.index,s),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(l,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=2,u.updateChildren(r,o+1),u.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!t2(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=tU.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=tU.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new t$(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof tq;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof tJ)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((tv||tg)&&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 n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new tZ(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}
2isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function t4(e,t){return e.type.side-t.type.side}function t6(e,t,n,r,i){let o=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],c=l,u=l+=a.size;c>=n||u<=t?o.push(a):(c<t&&o.push(a.slice(0,t-c,r)),i&&(o.push(i),i=void 0),u>n&&o.push(a.slice(n-c,a.size,r)))}return o}function t8(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(ti(n)){for(a=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&ez.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==tn(e);r||i;){if(e==n)return!0;let t=e3(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==tn(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new ez(s==e?l:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[a,s]=i==e.state.selection.anchor?[i,t]:[t,i],l=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let n="pointer"==t||e.state.selection.head<l.pos&&!o?1:-1;c=ns(e,u,l,n)}return c}function t5(e){return e.editable?e.hasFocus():na(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function t7(e,t=!1){let n=e.state.selection;if(ni(e,n),t5(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&tg){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&e7(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,e3(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&th&&tp<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let i,o,s,l,{anchor:a,head:c}=n,u,d;ne&&!(n instanceof eH)&&(n.$from.parent.inlineContent||(u=nt(e,n.from)),n.empty||n.$from.parent.inlineContent||(d=nt(e,n.to))),e.docView.setSelection(a,c,e,t),ne&&(u&&nr(u),d&&nr(d)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=(r=e).dom.ownerDocument).removeEventListener("selectionchange",r.input.hideSelectionGuard),s=(o=r.domSelectionRange()).anchorNode,l=o.anchorOffset,i.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=l)&&(i.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!t5(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let ne=tv||tg&&ty<63;function nt(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(tv&&i&&"false"==i.contentEditable)return nn(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return nn(i);else if(o)return nn(o)}}function nn(e){return e.contentEditable="true",tv&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function nr(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function ni(e,t){if(t instanceof ez){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(no(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else no(e)}function no(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ns(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||eH.between(t,n,r)}function nl(e){return(!e.editable||!!e.hasFocus())&&na(e)}function na(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.focu
2sNode.parentNode:t.focusNode))}catch(e){return!1}}function nc(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&eL.findFrom(o,t)}function nu(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function nd(e,t,n){let r=e.state.selection;if(r instanceof eH){if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return nu(e,new eH(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=nc(e.state,t);return!!n&&n instanceof ez&&nu(e,n)}else if(!(tw&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(ez.isSelectable(i)?nu(e,new ez(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!tk&&nu(e,new eH(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof ez&&r.node.isInline)return nu(e,new eH(t>0?r.$to:r.$from));let n=nc(e.state,t);return!!n&&nu(e,n)}}function nh(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function np(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function nf(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(tf&&1==n.nodeType&&r<nh(n)&&np(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(np(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(nm(n))break;else{let t=n.previousSibling;for(;t&&np(t,-1);)i=n.parentNode,o=e3(t),t=t.previousSibling;if(t)r=nh(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?ng(e,n,r):i&&ng(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=nh(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(np(i.childNodes[o],1))t=i,n=++o;else break}else if(nm(i))break;else{let r=i.nextSibling;for(;r&&np(r,1);)t=r.parentNode,n=e3(r)+1,r=r.nextSibling;if(r)o=0,s=nh(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&ng(e,t,n)}(e)}function nm(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function ng(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!tr(e);)t=e3(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!tr(e);)t=e3(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(ti(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&t7(e)},50)}function ny(e,t){let n=e.state.doc.resolve(t);if(!(tg||tx)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function nv(e,t,n){let r=e.state.selection;if(r instanceof eH&&!r.empty||n.indexOf("s")>-1||tw&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=nc(e.state,t);if(n&&n instanceof ez)return nu(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof eW?eL.near(n,t):eL.findFrom(n,t);return!!s&&nu(e,s)}return!1}function nb(e,t){if(!(e.state.selection instanceof eH))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function nw(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function nx(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;
2n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||K.fromSchema(e.state.schema),l=nA(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&1==c.nodeType&&(u=nM[c.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=l.createElement(u[e]);for(;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t),d++}c=a.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`),{dom:a,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function nC(e,t,r,i,o){let s,l,c=o.parent.type.spec.code;if(!r&&!t)return null;let u=!!t&&(i||c||!r);if(u){if(e.someProp("transformPastedText",n=>{t=n(t,c||i,e)}),c)return l=new a(n.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{l=t(l,e,!0)}),l;let r=e.someProp("clipboardTextParser",n=>n(t,o,i,e));if(r)l=r;else{let n=o.marks(),{schema:r}=e.state,i=K.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(i.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{r=t(r,e)}),s=function(e){var t;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=nA().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),s;if((s=o&&nM[o[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(nN||(nN=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),nN.createHTML(t)):t),s)for(let e=0;e<s.length;e++)i=i.querySelector(s[e])||i;return i}(r),tk&&function(e){let t=e.querySelectorAll(tg?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let d=s&&s.querySelector("[data-pm-slice]"),h=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(l||(l=(e.someProp("clipboardParser")||e.someProp("domParser")||V.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(u||h),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||nk.test(e.parentNode.nodeName)?null:{ignore:!0}})),h)l=function(e,t){if(!e.size)return e;let r=e.content.firstChild.type.schema,i;try{i=JSON.parse(t)}catch(t){return e}let{content:o,openStart:s,openEnd:l}=e;for(let e=i.length-2;e>=0;e-=2){let t=r.nodes[i[e]];if(!t||t.hasRequiredAttrs())break;o=n.from(t.create(i[e+1],o)),s++,l++}return new a(o,s,l)}(nT(l,+h[1],+h[2]),h[4]);else if((l=a.maxOpen(function(e,t){if(e.childCount<2)return e;for(let r=t.depth;r>=0;r--){let i=t.node(r).contentMatchAt(t.index(r)),o,s=[];if(e.forEach(e=>{if(!s)return;let t=i.findWrapping(e.type),r;if(!t)return s=null;if(r=s.length&&o.length&&function e(t,r,i,o,s){if(s<t.length&&s<r.length&&t[s]==r[s]){let l=e(t,r,i,o.lastChild,s+1);if(l)return o.copy(o.content.replaceChild(o.childCount-1,l));if(o.contentMatchAt(o.childCount).matchType(s==t.length-1?i.type:t[s+1]))return o.copy(o.content.append(n.from(nS(i,t,s+1))))}}(t,o,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 i=t.content.replaceChild(t.childCount-1,e(t.lastChild,r-1)),o=t.contentMatchAt(t.childCount).fillBefore(n.empty,!0);return t.copy(i.append(o))}(s[s.length-1],o.length));let r=nS(e,t);s.push(r),i=i.matchType(r.type),o=t}}),s)return n.from(s)}return e}(l.content,o),!0)).openStart||l.openEnd){let e=0,t=0;for(let t=l.content.firstChild;e<l.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=l.content.lastChild;t<l.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);l=nT(l,e,t)}return e.someProp("transformPasted",t=>{l=t(l,e,u)}),l}let nk=/^(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 i=t.length-1;i>=r;i--)e=t[i].create(null,n.from(e));return e}
2function nE(e,t,r,i,o,s){let l=t<0?e.firstChild:e.lastChild,a=l.content;return e.childCount>1&&(s=0),o<i-1&&(a=nE(a,t,r,i,o+1,s)),o>=r&&(a=t<0?l.contentMatchAt(0).fillBefore(a,s<=o).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(n.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(a))}function nT(e,t,n){return t<e.openStart&&(e=new a(nE(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new a(nE(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let nM={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nO=null;function nA(){return nO||(nO=document.implementation.createHTMLDocument("title"))}let nN=null,nR={},nj={},nD={touchstart:!0,touchmove:!0};class nI{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 nP(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function nL(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>n_(e,t))})}function n_(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function nV(e){return{left:e.clientX,top:e.clientY}}function nB(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function nH(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}nj.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!n$(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!tC||!tg||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!tb||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||tw&&72==r&&"c"==i)return nb(e,-1)||nf(e,-1);if(46==r&&!t.shiftKey||tw&&68==r&&"c"==i)return nb(e,1)||nf(e,1);if(13==r||27==r)return!0;if(37==r||tw&&66==r&&"c"==i){let t=37==r?"ltr"==ny(e,e.state.selection.from)?-1:1:-1;return nd(e,t,i)||nf(e,t)}if(39==r||tw&&70==r&&"c"==i){let t=39==r?"ltr"==ny(e,e.state.selection.from)?1:-1:1;return nd(e,t,i)||nf(e,t)}else if(38==r||tw&&80==r&&"c"==i)return nv(e,-1,i)||nf(e,-1);else if(40==r||tw&&78==r&&"c"==i)return function(e){if(!tv||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;nw(e,n,"true"),setTimeout(()=>nw(e,n,"false"),20)}return!1}(e)||nv(e,1,i)||nf(e,1);else if(i==(tw?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():nP(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>
2t(e,to(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},nj.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},nj.keypress=(e,t)=>{if(n$(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||tw&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof eH)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let nF=tw?"metaKey":"ctrlKey";nR.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=nK(e),s=Date.now(),l="singleClick";s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[nF]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?l="doubleClick":"doubleClick"==e.input.lastClick.type&&(l="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:l,button:t.button};let a=e.posAtCoords(nV(t));a&&("singleClick"==l?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new nz(e,a,t,!!o)):("doubleClick"==l?function(e,t,n,r){return nB(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return nB(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(nH(e,eH.create(r,0,r.content.size),"pointer"),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)nH(e,eH.create(r,o+1,o+1+n.content.size),"pointer");else{if(!ez.isSelectable(n))continue;nH(e,ez.create(r,o),"pointer")}return!0}}(e,n,r)})(e,a.pos,a.inside,t)?t.preventDefault():nP(e,"pointer"))};class nz{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[nF],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:a}=e.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||a instanceof ez&&a.from<=o&&a.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&tf&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),nP(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>t7(this.view)),this.view.input.mouseDown=null}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(nV(e))),this.updateAllowDefault(e),this.allowDefault||!t)nP(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,nB(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof ez&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(ez.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}
2return null!=i&&(nH(e,ez.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&ez.isSelectable(r))&&(nH(e,new ez(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||tv&&this.mightDrag&&!this.mightDrag.node.isAtom||tg&&!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)))?(nH(this.view,eL.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):nP(this.view,"pointer")}}move(e){this.updateAllowDefault(e),nP(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function n$(e,t){return!!e.composing||!!(tv&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}nR.touchstart=e=>{e.input.lastTouch=Date.now(),nK(e),nP(e,"pointer")},nR.touchmove=e=>{e.input.lastTouch=Date.now(),nP(e,"pointer")},nR.contextmenu=e=>nK(e);let nW=tC?5e3:-1;function nq(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>nK(e),t))}function nU(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function nK(e,t=!1){if(!tC||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),nU(e),t||e.docView&&e.docView.dirty){let n=t8(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}nj.compositionstart=nj.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof eH&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||tg&&tx&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),nK(e,!0),e.markCursor=null;else if(nK(e,!t.selection.empty),tf&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}nq(e,nW)},nj.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,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++,nq(e,20))};let nJ=th&&tp<15||tb&&tS<604;function nZ(e,t,n,r,i){let o=nC(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||a.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,l=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nG(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}nR.copy=nj.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=nJ?null:t.clipboardData,{dom:o,text:s}=nx(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},nj.paste=(e,t)=>
2{if(e.composing&&!tC)return;let n=nJ?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&nZ(e,nG(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?nZ(e,r.value,null,i,t):nZ(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class nY{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let nX=tw?"altKey":"ctrlKey";function nQ(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[nX]}for(let e in nR.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(nV(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof ez?i.to-1:i.to));else if(r&&r.mightDrag)n=ez.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=ez.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:l,text:a,slice:c}=nx(e,s);t.dataTransfer.files.length&&tg&&!(ty>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(nJ?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",nJ||t.dataTransfer.setData("text/plain",a),e.dragging=new nY(c,nQ(e,t),n)},nR.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},nj.dragover=nj.dragenter=(e,t)=>t.preventDefault(),nj.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(nV(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=nC(e,nG(t.dataTransfer),nJ?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&nQ(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||a.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let l=o?eC(e.state.doc,i.pos,o):i.pos;null==l&&(l=i.pos);let c=e.state.tr;if(s){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(h))return;let p=c.doc.resolve(u);if(d&&ez.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new ez(p));else{let t=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(ns(e,p,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},nR.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())&&t7(e)},20))},nR.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)},nR.beforeinput=(e,t)=>{if(tg&&tC&&"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,to(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},nj)nR[e]=nj[e];function n0(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class n1{constructor(e,t){this.toDOM=e,this.spec=t||n6,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new n3(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof n1&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&n0(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class n2{constructor(e,t){this.attrs=e,this.spec=t||n6}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new n3(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof n2&&n0(this.attrs,e.attrs)&&n0(this.spec,e.spec)}static is(e){return e.type instanceof n2}destroy(){}}class n9{constructor(e,t){this.attrs=e,this.spec=t||n6}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new n3(i.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof n9&&n0(this.attrs,e.attrs)&&n0(this.spec,e.spec)}destroy(){}}class n3{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new n3(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,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new n3(e,e,new n1(t,n))}static inline(e,t,n,r){return new n3(e,t,new n2(n,r))}
vendor: 4,568 bytes, line 2
2static node(e,t,n,r){return new n3(e,t,new n9(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof n2}get widget(){return this.type instanceof n1}}let n4=[],n6={};class n8{constructor(e,t){this.local=e.length?e:n4,this.children=t.length?t:n4}static create(e,t){return t.length?rr(t,e,0,n6):n5}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==n5||0==e.maps.length?this:this.mapInner(e,t,0,0,n||n6)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,r);l&&l.type.valid(t,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let l=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<l.length;i+=3){let o=l[i+1];if(o<0||e>o+t-r)continue;let a=l[i]+t-r;n>=a?l[i+1]=e<=a?-2:-1:e>=t&&s&&(l[i]+=s,l[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let a=!1;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){if(-2==l[t+1]){a=!0,l[t+1]=-1;continue}let c=n.map(e[t]+o),u=c-i;if(u<0||u>=r.content.size){a=!0;continue}let d=n.map(e[t+1]+o,-1)-i,{index:h,offset:p}=r.content.findIndex(u),f=r.maybeChild(h);if(f&&p==u&&p+f.nodeSize==d){let r=l[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=n5?(l[t]=u,l[t+1]=d,l[t+2]=r):(l[t+1]=-2,a=!0)}else a=!0}if(a){let a=rr(function(e,t,n,r,i,o,s){for(let l=0;l<e.length;l+=3)-1==e[l+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let l=t.local[e].map(r,i,o);l?n.push(l):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[l+2],t[l]+o+1);return n}(l,e,t,n,i,o,s),r,0,s);t=a.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<a.children.length;e+=3){let n=a.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,a.children[e],a.children[e+1],a.children[e+2])}}return new n8(t.sort(ri),l)}(this.children,o||[],e,t,n,r,i):o?new n8(o.sort(ri),n4):n5}add(e,t){return t.length?this==n5?n8.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,l;if(l=rt(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,l,s+1):r.splice(i,0,o,o+e.nodeSize,rr(l,e,s+1,n6)),i+=3}});let o=re(i?rn(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new n8(o.length?this.local.concat(o).sort(ri):this.local,r||this.children)}remove(e){return 0==e.length||this==n5?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(i,o+1);l!=n5?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new n8(r,n):n5}forChild(e,t){let n,r;if(this==n5)return this;if(t.isLeaf)return n8.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof n2){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new n8(r.sort(ri),n4);return n?new n7([e,n]):e}return n||n5}eq(e){if(this==e)return!0;if(!(e instanceof n8)||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 ro(this.localsInner(e))}localsInner(e){if(this==n5)return n4;if(e.inlineContent||!this.local.some(n2.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof n2||t.push(this.local[e]);return t}forEachSet(e){e(this)}}n8.empty=new n8([],[]),n8.removeOverlap=ro;let n5=n8.empty;
2class n7{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,n6));return n7.from(n)}forChild(e,t){if(t.isLeaf)return n8.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=n5&&(i instanceof n7?n=n.concat(i.members):n.push(i))}return n7.from(n)}eq(e){if(!(e instanceof n7)||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,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?ro(n?t:t.sort(ri)):n4}static from(e){switch(e.length){case 0:return n5;case 1:return e[0];default:return new n7(e.every(e=>e instanceof n8)?e:e.reduce((e,t)=>e.concat(t instanceof n8?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function re(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new n3(i.from+t,i.to+t,i.type))}return n}function rt(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function rn(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function rr(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let l=rt(e,t,s+n);if(l){o=!0;let e=rr(l,t,n+s+1,r);e!=n5&&i.push(s,s+t.nodeSize,e)}});let s=re(o?rn(e):e,-n).sort(ri);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new n8(s,i):n5}function ri(e,t){return e.from-t.from||e.to-t.to}function ro(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),rs(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),rs(t,i,r.copy(o.from,r.to)));break}}return t}function rs(e,t,n){for(;t<e.length&&ri(n,e[t])>0;)t++;e.splice(t,0,n)}function rl(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=n5&&t.push(r)}),e.cursorWrapper&&t.push(n8.create(e.state.doc,[e.cursorWrapper.deco])),n7.from(t)}let ra={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},rc=th&&tp<=11;class ru{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 rd{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ru,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]);th&&tp<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():tv&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),rc&&(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,ra)),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(nl(this.view)){if(this.suppressingSelectionUpdates)return t7(this.view);if(th&&tp<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&e7(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,n;for(let n=e.focusNode;n;n=e4(n))t.add(n);for(let r=e.anchorNode;r;r=e4(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nl(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],a);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(l=!0))}if(a.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode)){for(let e of a)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(tf&&a.length){let e=a.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(t,n)!=e)&&r.remove()}}}let c=null;o<0&&i&&t.input.lastFocus>
2Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&ti(r)&&(c=t8(t))&&c.eq(eL.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,t7(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!rh.has(e)&&(rh.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=tf,rp||(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."),rp=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,a)),this.handleDOMChange(o,s,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||t7(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(th&&tp<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?e3(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?e3(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let rh=new WeakMap,rp=!1;function rf(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return e7(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function rm(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(tv&&/^(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||tv&&/^(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 rg=/^(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 ry(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:ns(e,t.resolve(n.anchor),t.resolve(n.head))}function rv(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function rb(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class rw{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 nI,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(rE),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=rk(this),rC(this),this.nodeViews=rS(this),this.docView=tK(this.state.doc,rx(this),rl(this),this.dom,this),this.domObserver=new rd(this,(e,t,r,i
2)=>(function(e,t,r,i,o){let s,l,a,c=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,n=t8(e,t);if(n&&!e.state.selection.eq(n)){if(tg&&tC&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,to(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),c&&r.setMeta("composition",c),e.dispatch(r)}return}let u=e.state.doc.resolve(t),d=u.sharedDepth(r);t=u.before(d+1),r=e.state.doc.resolve(r).after(d+1);let h=e.state.selection,p=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:l,to:a}=e.docView.parseRange(t,n),c=e.domSelectionRange(),u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(r=[{node:u,offset:c.anchorOffset}],ti(c)||r.push({node:c.focusNode,offset:c.focusOffset})),tg&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let d=e.state.doc,h=e.someProp("domParser")||V.fromSchema(e.state.schema),p=d.resolve(l),f=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:rm,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+l,head:t+l}}return{doc:m,sel:f,from:l,to:a}}(e,t,r),f=e.state.doc,m=f.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(s=e.state.selection.to,l="end"):(s=e.state.selection.from,l="start"),e.input.lastKeyCode=null;let g=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:l}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){let e=Math.max(0,o-Math.min(s,l));r-=s+e-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;(o-=e)&&o<t.size&&rb(t.textBetween(o-1,o+1))&&(o+=e?1:-1),l=o+(l-s),s=o}else if(l<o){let t=r<=o&&r>=l?o-r:0;(o-=t)&&o<e.size&&rb(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}(m.content,p.doc.content,p.from,s,l);if(g&&e.input.domChangeCount++,(tb&&e.input.lastIOSEnter>Date.now()-225||tC)&&o.some(e=>1==e.nodeType&&!rg.test(e.nodeName))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",t=>
2t(e,to(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!g)if(i&&h instanceof eH&&!h.empty&&h.$head.sameParent(h.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))g={start:h.from,endA:h.to,endB:h.to};else{if(p.sel){let t=ry(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);c&&n.setMeta("composition",c),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof eH&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),th&&tp<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&"  "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);let y=p.doc.resolveNoCache(g.start-p.from),v=p.doc.resolveNoCache(g.endB-p.from),b=f.resolve(g.start),w=y.sameParent(v)&&y.parent.inlineContent&&b.end()>=g.endA;if((tb&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!w&&y.pos<p.doc.content.size&&(!y.sameParent(v)||!y.parent.inlineContent)&&y.pos<v.pos&&!/\S/.test(p.doc.textBetween(y.pos,v.pos,"","")))&&e.someProp("handleKeyDown",t=>
2t(e,to(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>g.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||rv(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(rv(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||rv(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(f,g.start,g.endA,y,v)&&e.someProp("handleKeyDown",t=>t(e,to(8,"Backspace")))){tC&&tg&&e.domObserver.suppressSelectionUpdates();return}tg&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),tC&&!w&&y.start()!=v.start()&&0==v.parentOffset&&y.depth==v.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,v=p.doc.resolveNoCache(g.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,to(13,"Enter"))})},20));let x=g.start,C=g.endA,k=t=>{let n=t||e.state.tr.replace(x,C,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){let t=ry(e,n.doc,p.sel);t&&!(tg&&e.composing&&t.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==x||t.head==n.mapping.map(C)-1)||th&&t.empty&&t.head==x)&&n.setSelection(t)}return c&&n.setMeta("composition",c),n.scrollIntoView()};if(w)if(y.pos==v.pos){th&&tp<=11&&0==y.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>t7(e),20));let t=k(e.state.tr.delete(x,C)),n=f.resolve(g.start).marksAcross(f.resolve(g.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(g.endA==g.endB&&(a=function(e,t){let r=e.firstChild.marks,i=t.firstChild.marks,o=r,s=i,l,a,c;for(let e=0;e<i.length;e++)o=i[e].removeFromSet(o);for(let e=0;e<r.length;e++)s=r[e].removeFromSet(s);if(1==o.length&&0==s.length)a=o[0],l="add",c=e=>e.mark(a.addToSet(e.marks));else{if(0!=o.length||1!=s.length)return null;a=s[0],l="remove",c=e=>e.mark(a.removeFromSet(e.marks))}let u=[];for(let e=0;e<t.childCount;e++)u.push(c(t.child(e)));if(n.from(u).eq(e))return{mark:a,type:l}}(y.parent.content.cut(y.parentOffset,v.parentOffset),b.parent.content.cut(b.parentOffset,g.endA-b.start())))){let t=k(e.state.tr);"add"==a.type?t.addMark(x,C,a.mark):t.removeMark(x,C,a.mark),e.dispatch(t)}else if(y.parent.child(y.index()).isText&&y.index()==v.index()-!v.textOffset){let t=y.parent.textBetween(y.parentOffset,v.parentOffset),n=()=>k(e.state.tr.insertText(t,x,C));e.someProp("handleTextInput",r=>r(e,x,C,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())})(this,e,t,r,i)),this.domObserver.start(),function(e){for(let t in nR){let n=nR[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 n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||n_(e,t)||!e.editable&&t.type in nj||n(e,t)},nD[t]?{passive:!0}:void 0)}tv&&e.dom.addEventListener("input",()=>null),nL(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&&nL(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rE),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 n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(nU(this),l=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=rS(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&nL(this),this.editable=rk(this),rC(this);let c=rl(this),u=rx(this),d=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",h=s||!this.docView.matchesNode(e.doc,u,c);(h||!e.selection.eq(o.selection))&&(l=!0);let p="preserve"==d&&l&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=i-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:tM(e.dom)}}(this);if(l){let t,n,l;this.domObserver.stop();let a=h&&(th||tg)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,l=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(l)!=i.$anchor.start(l));if(h){let t=tg?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=tn(e=e.childNodes[t-1])}else{if(!e.parentNode||tr(e))return null;t=e3(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=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||tr(e))return null;t=e3(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);
2if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(s||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=tK(e.doc,u,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(a=!0)}a||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),e7(t.node,t.offset,n.anchorNode,n.anchorOffset)))?t7(this,a):(ni(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==d?this.dom.scrollTop=0:"to selection"==d?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;tO(n,0==r?0:r-t)}(p)}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 ez){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&tT(this,t.getBoundingClientRect(),e)}else tT(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 n=this.pluginViews[t];n.update&&n.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 n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new nY(e.slice,e.move,r<0?void 0:ez.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(th){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("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(tA)return e.focus(tA);let t=tM(e);e.focus(null==tA?{get preventScroll(){return tA={preventScroll:!0},!0}}:void 0),tA||(tA=!1,tO(t,0))}(this.dom),t7(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 n;let r,i,o=e.dom.ownerDocument,s,l=0,a=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(tn(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(tn(r.startContainer),r.startOffset)}}}(o,t.left,t.top);a&&({node:s,offset:l}=a);let c=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!tN(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(tN(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(tv)for(let e=c;s&&e;e=e4(e))e.draggable&&(s=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(tf&&1==s.nodeType&&(l=Math.min(l,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[l],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&l++}tk&&l&&1==s.nodeType&&1==(n=s.childNodes[l-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&l--,s==e.dom&&l==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>
2s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==l||1!=s.nodeType||"BR"!=s.childNodes[l-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,l,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,l,a=0,c=n.top,u=n.top;for(let e=t.firstChild,d=0;e;e=e.nextSibling,d++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=e8(e).getClientRects()}for(let h=0;h<t.length;h++){let p=t[h];if(p.top<=c&&p.bottom>=u){c=Math.max(p.bottom,c),u=Math.min(p.top,u);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<s){o=e,s=t,l=t&&3==o.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(a=d+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!o&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(a=d+1)}}return(!o&&r&&(o=r,l=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=tj(r,1);if(n.top!=n.bottom&&tN(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,l):!o||s&&1==o.nodeType?{node:t,offset:a}:e(o,l)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,c,t));let u=e.docView.nearestDesc(c,!0);return{pos:i,inside:u?u.posAtStart-u.border:-1}}(this,e)}coordsAtPos(e,t=1){return tI(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,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return tB==t&&tH==n?tF:(tB=t,tH=n,tF="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,t_(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=tI(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=e8(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"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?tV.test(r.parent.textContent)&&s.modify?t_(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:l}=e.domSelectionRange(),a=s.caretBidiLevel;s.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),h=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&i==d;try{s.collapse(o,l),t&&(t!=o||i!=l)&&s.extend&&s.extend(t,i)}catch(e){}return null!=a&&(s.caretBidiLevel=a),h}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return nZ(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return nZ(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return nx(this,e)}destroy(){if(this.docView){for(let e in 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,[],rl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,e5()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!n_(this,e)&&nR[e.type]&&(this.editable||!(e.type in nj))&&nR[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?tv&&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 n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return rf(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?rf(e,n):null}
2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function rx(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[n3.node(0,e.state.doc.content.size,t)]}function rC(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:n3.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function rk(e){return!e.someProp("editable",t=>!1===t(e.state))}function rS(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function rE(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")}rw.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var rT,rM,rO,rA,rN,rR,rj,rD,rI={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:"'"},rP={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rL="u">typeof navigator&&/Mac/.test(navigator.platform),r_="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),rV=0;rV<10;rV++)rI[48+rV]=rI[96+rV]=String(rV);for(var rV=1;rV<=24;rV++)rI[rV+111]="F"+rV;for(var rV=65;rV<=90;rV++)rI[rV]=String.fromCharCode(rV+32),rP[rV]=String.fromCharCode(rV);for(var rB in rI)rP.hasOwnProperty(rB)||(rP[rB]=rI[rB]);let rH="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),rF="u">typeof navigator&&/Win/.test(navigator.platform);function rz(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function r$(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))rH?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(rL&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||r_&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?rP:rI)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[rz(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[rz(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(rF&&n.ctrlKey&&n.altKey)&&(o=rI[n.keyCode])&&o!=i){let r=t[rz(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}let rW=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function rq(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let rU=(e,t,n)=>{let r=rq(e,n);if(!r)return!1;let i=rG(r);if(!i){let n=r.blockRange(),i=n&&ep(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(r6(e,i,t,-1))return!0;
2if(0==r.parent.content.size&&(rJ(o,"end")||ez.isSelectable(o)))for(let n=r.depth;;n--){let s=ek(e.doc,r.before(n),r.after(n),a.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(rJ(o,"end")?eL.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):ez.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)};function rK(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let o=t.nodeAfter,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let l=ek(e.doc,i,s,a.empty);if(!l||l.from!=i||l instanceof ec&&l.slice.size>=s-i)return!1;if(n){let t=e.tr.step(l);t.setSelection(eH.create(t.doc,i)),n(t.scrollIntoView())}return!0}function rJ(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let rZ=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=rG(r)}let s=o&&o.nodeBefore;return!!s&&!!ez.isSelectable(s)&&(t&&t(e.tr.setSelection(ez.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function rG(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 rY(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let rX=(e,t,n)=>{let r=rY(e,n);if(!r)return!1;let i=r0(r);if(!i)return!1;let o=i.nodeAfter;if(r6(e,i,t,1))return!0;if(0==r.parent.content.size&&(rJ(o,"start")||ez.isSelectable(o))){let n=ek(e.doc,r.before(),r.after(),a.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(rJ(o,"start")?eL.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):ez.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},rQ=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=r0(r)}let s=o&&o.nodeAfter;return!!s&&!!ez.isSelectable(s)&&(t&&t(e.tr.setSelection(ez.create(e.doc,o.pos)).scrollIntoView()),!0)};function r0(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}let r1=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function r2(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let r9=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=r2(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(eL.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},r3=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof eW||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=r2(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(eH.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},r4=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(ev(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&ep(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function r6(e,t,r,i){let o,s,l,c=t.nodeBefore,u=t.nodeAfter,d,h,p=c.type.spec.isolating||u.type.spec.isolating;if(!p&&(o=t.nodeBefore,s=t.nodeAfter,l=t.index(),o&&s&&o.type.compatibleContent(s.type)&&(!o.content.size&&t.parent.canReplace(l-1,l)?(r&&r(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(l,l+1)&&!!(s.isTextblock||eb(e.doc,t.pos))&&(r&&r(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let f=!p&&t.parent.canReplace(t.index(),t.index()+1);if(f&&(d=(h=c.contentMatchAt(c.childCount)).findWrapping(u.type))&&h.matchType(d[0]||u.type).validEnd){if(r){let i=t.pos+u.nodeSize,o=n.empty;for(let e=d.length-1;e>=0;e--)o=n.from(d[e].create(null,o));o=n.from(c.copy(o));let s=e.tr.step(new eu(t.pos-1,i,t.pos,i,new a(o,1,0),d.length,!0)),l=s.doc.resolve(i+2*d.length);l.nodeAfter&&l.nodeAfter.type==c.type&&eb(s.doc,l.pos)&&s.join(l.pos),r(s.scrollIntoView())}return!0}let m=u.type.spec.isolating||i>0&&p?null:eL.findFrom(t,1),g=m&&m.$from.blockRange(m.$to),y=g&&ep(g);if(null!=y&&y>=t.depth)return r&&r(e.tr.lift(g,y).scrollIntoView()),!0;if(f&&rJ(u,"start",!0)&&rJ(c,"end")){let i=c,o=[];for(;o.push(i),!i.isTextblock;)i=i.lastChild;let s=u,l=1;for(;!s.isTextblock;s=s.firstChild)l++;if(i.canReplace(i.childCount,i.childCount,s.content)){if(r){let i=n.empty;for(let e=o.length-1;e>=0;e--)i=n.from(o[e].copy(i));r(e.tr.step(new eu(t.pos-o.length,t.pos+u.nodeSize,t.pos+l,t.pos+u.nodeSize-l,new a(i,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function r8(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(eH.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let r5=r8(-1),r7=r8(1);function ie(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function it(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let ir=it(rW,rU,rZ),ii=it(rW,rX,rQ),io={Enter:it(r1,r3,r4,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof ez&&e.selection.node.isBlock)return!!n.parentOffset&&!!ev(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,s,l=!1,a=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;l=n.end(e)==n.pos+(n.depth-e),a=n.start(e)==n.pos-(n.depth-e),s=r2(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(l&&s?{type:s}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof eH||e.selection instanceof eW)&&c.deleteSelection();let u=c.mapping.map(n.pos),d=ev(c.doc,u,i.length,i);if(d||(i[0]=s?{type:s}:null,d=ev(c.doc,u,i.length,i)),!d)return!1;if(c.split(u,i.length,i),!l&&a&&n.node(o).type!=s){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);s&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&c.setNodeMarkup(c.mapping.map(n.before(o)),s)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":r9,Backspace:ir,"Mod-Backspace":ir,"Shift-Backspace":ir,Delete:ii,"Mod-Delete":ii,"Mod-a":(e,t)=>
2(t&&t(e.tr.setSelection(new eW(e.doc))),!0)},is={"Ctrl-h":io.Backspace,"Alt-Backspace":io["Mod-Backspace"],"Ctrl-d":io.Delete,"Ctrl-Alt-Backspace":io["Mod-Delete"],"Alt-Delete":io["Mod-Delete"],"Alt-d":io["Mod-Delete"],"Ctrl-a":r5,"Ctrl-e":r7};for(let e in io)is[e]=io[e];function il(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;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 o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();class ia{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:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],l=!!e,a=e||i.tr,c=()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(a),s.every(e=>!0===e)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(a,t),i=n(...e)(r);return s.push(i),u}])),run:c};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:il({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(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}}class ic{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}}function iu(e,t,n){return void 0===e.config[t]&&e.parent?iu(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?iu(e.parent,t,n):null}):e.config[t]}function id(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 ih(e){let t=[],{nodeExtensions:n,markExtensions:r}=id(e),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=iu(e,"addGlobalAttributes",n);r&&r().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}
2),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=iu(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"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:n,attribute:i})})}),t}function ip(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}function im(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=t?t.split(";").map(e=>e.trim()).filter(Boolean):[],i=n[e]?n[e].split(";").map(e=>e.trim()).filter(Boolean):[],o=new Map;i.forEach(e=>{let[t,n]=e.split(":").map(e=>e.trim());o.set(t,n)}),r.forEach(e=>{let[t,n]=e.split(":").map(e=>e.trim());o.set(t,n)}),n[e]=Array.from(o.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function ig(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)=>im(e,t),{})}function iy(e){return"function"==typeof e}function iv(e,t,...n){return iy(e)?t?e.bind(t)(...n):e(...n):e}function ib(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function iw(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 ix(e,t){return t.nodes[e]||t.marks[e]||null}function iC(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function ik(e,t){let n=K.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function iS(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class iE{constructor(e){this.find=e.find,this.handler=e.handler}}function iT(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let u=!1,d=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,l;let a=(null==(l=(s=e.type.spec).toText)?void 0:l.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?a:a.slice(0,Math.max(0,r-t))}),n})(c)+o;return s.forEach(e=>{if(u)return;let t=((e,t)=>{if(iS(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(d,e.find);if(!t)return;let s=a.state.tr,c=il({state:a.state,transaction:s}),h={from:r-(t[0].length-o.length),to:i}
2,{commands:p,chain:f,can:m}=new ia({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(s.setMeta(l,{transform:s,from:r,to:i,text:o}),a.dispatch(s),u=!0)}),u}function iM(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function iO(e,t){let n={...e};return iM(e)&&iM(t)&&Object.keys(t).forEach(r=>{iM(t[r])&&iM(e[r])?n[r]=iO(e[r],t[r]):n[r]=t[r]}),n}class iA{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=iv(iu(this,"addOptions",{name:this.name}))),this.storage=iv(iu(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new iA(e)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>iO(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new iA(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=iv(iu(t,"addOptions",{name:t.name})),t.storage=iv(iu(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}}class iN{constructor(e){this.find=e.find,this.handler=e.handler}}let iR=null;class ij{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=ij.resolve(e),this.schema=function(e,t){var n;let r=ih(e),{nodeExtensions:i,markExtensions:o}=id(e),s=null==(n=i.find(e=>iu(e,"topNode")))?void 0:n.name;return new L({topNode:s,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=iw({...e.reduce((e,t)=>{let r=iu(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:iv(iu(n,"content",o)),marks:iv(iu(n,"marks",o)),group:iv(iu(n,"group",o)),inline:iv(iu(n,"inline",o)),atom:iv(iu(n,"atom",o)),selectable:iv(iu(n,"selectable",o)),draggable:iv(iu(n,"draggable",o)),code:iv(iu(n,"code",o)),whitespace:iv(iu(n,"whitespace",o)),linebreakReplacement:iv(iu(n,"linebreakReplacement",o)),defining:iv(iu(n,"defining",o)),isolating:iv(iu(n,"isolating",o)),attrs:Object.fromEntries(i.map(e=>{var t;return[e.name,{default:null==(t=null==e?void 0:e.attribute)?void 0:t.default}]}))}),l=iv(iu(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>ib(e,i)));let a=iu(n,"renderHTML",o);a&&(s.toDOM=e=>a({node:e,HTMLAttributes:ig(e,i)}));let c=iu(n,"renderText",o);return c&&(s.toText=c),[n.name,s]})),marks:Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=iw({...e.reduce((e,t)=>{let r=iu(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:iv(iu(n,"inclusive",o)),excludes:iv(iu(n,"excludes",o)),group:iv(iu(n,"group",o)),spanning:iv(iu(n,"spanning",o)),code:iv(iu(n,"code",o)),attrs:Object.fromEntries(i.map(e=>{var t;return[e.name,{default:null==(t=null==e?void 0:e.attribute)?void 0:t.default}]}))}),l=iv(iu(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>ib(e,i)));let a=iu(n,"renderHTML",o);return a&&(s.toDOM=e=>a({mark:e,HTMLAttributes:ig(e,i)})),[n.name,s]}))})}(this.extensions,t),this.setupExtensions()}static resolve(e){var t;let n=ij.sort(ij.flatten(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=iu(e,"addExtensions",t);return n?[e,...this.flatten(n())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>
2{let n=iu(e,"priority")||100,r=iu(t,"priority")||100;return n>r?-1:+(n<r)})}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ix(t.name,this.schema)},r=iu(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this,t=ij.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(t=>{let n={name:t.name,options:t.options,storage:t.storage,editor:e,type:ix(t.name,this.schema)},o=[],s=iu(t,"addKeyboardShortcuts",n),l={};if("mark"===t.type&&iu(t,"exitable",n)&&(l.ArrowRight=()=>iA.handleExit({editor:e,mark:t})),s){let t=Object.fromEntries(Object.entries(s()).map(([t,n])=>[t,()=>n({editor:e})]));l={...l,...t}}let a=new e0({props:{handleKeyDown:r$(l)}});o.push(a);let c=iu(t,"addInputRules",n);iC(t,e.options.enableInputRules)&&c&&r.push(...c());let u=iu(t,"addPasteRules",n);iC(t,e.options.enablePasteRules)&&u&&i.push(...u());let d=iu(t,"addProseMirrorPlugins",n);if(d){let e=d();o.push(...e)}return o}).flat();return[function(e){let{editor:t,rules:r}=e,i=new e0({state:{init:()=>null,apply(e,o,s){let l=e.getMeta(i);if(l)return l;let a=e.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=ik(n.from(e),s.schema));let{from:o}=a,l=o+e.length;iT({editor:t,from:o,to:l,text:e,rules:r,plugin:i})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,n,o,s)=>iT({editor:t,from:n,to:o,text:s,rules:r,plugin:i}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:n}=e.state.selection;n&&iT({editor:t,from:n.pos,to:n.pos,text:"",rules:r,plugin:i})}),!1)},handleKeyDown(e,n){if("Enter"!==n.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&iT({editor:t,from:o.pos,to:o.pos,text:"\n",rules:r,plugin:i})}},isInputRules:!0});return i}({editor:e,rules:r}),...function(e){let t,{editor:r,rules:i}=e,o=null,s=!1,l=!1,a="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let c=({state:e,from:n,to:i,rule:o,pasteEvt:s})=>{let l=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=e,{commands:a,chain:c,can:u}=new ia({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(!e.isTextblock||e.type.spec.code)return;let h=Math.max(r,t),p=Math.min(i,t+e.content.size);((e,t,n)=>{if(iS(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.textBetween(h-t,p-t,void 0,""),o.find,s).forEach(e=>{if(void 0===e.index)return;let t=h+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=o.handler({state:n,range:i,match:e,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(p)})}),d.every(e=>null!==e)}({editor:r,state:il({state:e,transaction:l}),from:Math.max(n-1,0),to:i.b-1,rule:o,pasteEvent:s,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 i.map(e=>new e0({view(e){let t=t=>{var n;(o=(null==(n=e.dom.parentElement)?void 0:n.contains(t.target))?e.dom.parentElement:null)&&(iR=r)},n=()=>{iR&&(iR=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",n),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",n)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(l=o===e.dom.parentElement,t=n,!l){let e=iR;(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 n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,s=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,r,i)=>{let o=t[0],u="paste"===o.getMeta("uiEvent")&&!s,d="drop"===o.getMeta("uiEvent")&&!l,h=o.getMeta("applyPasteRules"),p=!!h;if(!u&&!d&&!p)return;if(p){var f,m;let t,{text:r}=h;"string"==typeof r||(r=ik(n.from(r),i.schema));let{from:o}=h,s=o+r.length;return c({rule:e,state:i,from:o,to:{b:s}
2,pasteEvt:(f=r,null==(m=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||m.setData("text/html",f),t)})}let g=r.doc.content.findDiffStart(i.doc.content),y=r.doc.content.findDiffEnd(i.doc.content);if("number"==typeof g&&y&&g!==y.b)return c({rule:e,state:i,from:g,to:y,pasteEvt:a})}}))}({editor:e,rules:i}),...o]}get attributes(){return ih(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=id(this.extensions);return Object.fromEntries(t.filter(e=>!!iu(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:t.storage,editor:e,type:ip(t.name,this.schema)},i=iu(t,"addNodeView",r);return i?[t.name,(r,o,s,l,a)=>{let c=ig(r,n);return i()({node:r,view:o,getPos:s,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;let n={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:ix(e.name,this.schema)};"mark"===e.type&&(null==(t=iv(iu(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=iu(e,"onBeforeCreate",n),i=iu(e,"onCreate",n),o=iu(e,"onUpdate",n),s=iu(e,"onSelectionUpdate",n),l=iu(e,"onTransaction",n),a=iu(e,"onFocus",n),c=iu(e,"onBlur",n),u=iu(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),l&&this.editor.on("transaction",l),a&&this.editor.on("focus",a),c&&this.editor.on("blur",c),u&&this.editor.on("destroy",u)})}}class iD{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=iv(iu(this,"addOptions",{name:this.name}))),this.storage=iv(iu(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new iD(e)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>iO(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new iD({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=iv(iu(t,"addOptions",{name:t.name})),t.storage=iv(iu(t,"addStorage",{name:t.name,options:t.options})),t}}function iI(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},l="";return e.nodesBetween(r,i,(e,n,a,c)=>{var u;e.isBlock&&n>r&&(l+=o);let d=null==s?void 0:s[e.type.name];if(d)return a&&(l+=d({node:e,pos:n,parent:a,index:c,range:t})),!1;e.isText&&(l+=null==(u=null==e?void 0:e.text)?void 0:u.slice(Math.max(r,n)-n,i-n))}),l}function iP(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}let iL=iD.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new e0({key:new e9("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),l=Math.max(...o.map(e=>e.$to.pos)),a=iP(n);return iI(r,{from:s,to:l},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}});function i_(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:iS(t[r])?t[r].test(e[r]):t[r]===e[r])}function iV(e,t,n={}){return e.find(e=>e.type===t&&i_(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function iB(e,t,n={}){return!!iV(e,t,n)}
2function iH(e,t,n){var r;if(!e||!t)return;let i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some(e=>e.type===t)||(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some(e=>e.type===t)||(n=n||(null==(r=i.node.marks[0])?void 0:r.attrs),!iV([...i.node.marks],t,n)))return;let o=i.index,s=e.start()+i.offset,l=o+1,a=s+i.node.nodeSize;for(;o>0&&iB([...e.parent.child(o-1).marks],t,n);)o-=1,s-=e.parent.child(o).nodeSize;for(;l<e.parent.childCount&&iB([...e.parent.child(l).marks],t,n);)a+=e.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function iF(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}function iz(e){return e instanceof eH}function i$(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function iW(e,t=null){if(!t)return null;let n=eL.atStart(e),r=eL.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,o=r.to;return"all"===t?eH.create(e,i$(0,i,o),i$(e.content.size,i,o)):eH.create(e,i$(t,i,o),i$(t,i,o))}function iq(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function iU(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}let iK=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&iK(r)}return e};function iJ(e){let t=`<body>${e}</body>`;return iK(new window.DOMParser().parseFromString(t,"text/html").body)}function iZ(e,t,r){if(e instanceof x||e instanceof n)return e;r={slice:!0,parseOptions:{},...r};let i="object"==typeof e&&null!==e,o="string"==typeof e;if(i)try{if(Array.isArray(e)&&e.length>0)return n.fromArray(e.map(e=>t.nodeFromJSON(e)));let i=t.nodeFromJSON(e);return r.errorOnInvalidContent&&i.check(),i}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(o){if(r.errorOnInvalidContent){let n=!1,i="",o=new L({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?V.fromSchema(o).parseSlice(iJ(e),r.parseOptions):V.fromSchema(o).parse(iJ(e),r.parseOptions),r.errorOnInvalidContent&&n)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let n=V.fromSchema(t);return r.slice?n.parseSlice(iJ(e),r.parseOptions).content:n.parse(iJ(e),r.parseOptions)}return iZ("",t,r)}function iG(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}function iY(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?ip(t,e.schema):null,l=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);l.push({node:e,from:n,to:o})});let a=i-r,c=l.filter(e=>!s||s.name===e.node.type.name).filter(e=>i_(e.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=a}function iX(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function iQ(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}function i0(e,t,n={},r={}){return iZ(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function i1(e,t){let n=iF(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let l=s.find(e=>e.type.name===n.name);return l?{...l.attrs}:{}}function i2(e,t){let n=new eI(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function i9(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function i3(e){return t=>(function(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}})(t.$from,e)}function i4(e,t){let n={from:0,to:e.content.size};return iI(e,n,t)}function i6(e,t){let n=iX("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=ip(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>
2e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?i1(e,t):{}}function i8(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),l=n.invert().map(o,-1),a=n.invert().map(s);i.push({oldRange:{from:l,to:a},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).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 i5(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=iH(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function i7(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function oe(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?iF(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>i_(e.attrs,n,{strict:!1}));let s=0,l=[];
2if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);s+=o-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:o})))})}),0===s)return!1;let a=l.filter(e=>!o||o.name===e.mark.type.name).filter(e=>i_(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=l.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(a>0?a+c:a)>=s}function ot(e,t){let{nodeExtensions:n}=id(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=iv(iu(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function on(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(on(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function or(e){return e instanceof ez}function oi(e,t,n){let r=e.state.doc.content.size,i=i$(t,0,r),o=i$(n,0,r),s=e.coordsAtPos(i),l=e.coordsAtPos(o,-1),a=Math.min(s.top,l.top),c=Math.max(s.bottom,l.bottom),u=Math.min(s.left,l.left),d=Math.max(s.right,l.right),h={top:a,bottom:c,left:u,right:d,width:d-u,height:c-a,x:u,y:a};return{...h,toJSON:()=>h}}function oo(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}let ol=(e,t)=>{let n=i3(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&eb(e.doc,n.pos))||(e.join(n.pos),!0)},oa=(e,t)=>{let n=i3(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&eb(e.doc,r))||(e.join(r),!0)};var oc=Object.freeze({__proto__:null,blur:()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),clearContent:(e=!1)=>({commands:t})=>t.setContent("",e),clearNodes:()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),l=o.blockRange(s);if(!l)return;let a=ep(l);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());t.setNodeMarkup(l.start,e)}(a||0===a)&&t.lift(l,a)})}),!0)},command:e=>t=>e(t),createParagraphNear:()=>({state:e,dispatch:t})=>r3(e,t),cut:(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new eH(r.doc.resolve(Math.max(s-1,0)))),!0},deleteCurrentNode:()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1},deleteNode:e=>({tr:t,state:n,dispatch:r})=>{let i=ip(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},deleteRange:e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},deleteSelection:()=>({state:e,dispatch:t})=>rW(e,t),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:t})=>r9(e,t),extendMarkRange:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=iF(e,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(i){let e=iH(a,o,t);if(e&&e.from<=c&&e.to>=u){let t=eH.create(s,e.from,e.to);n.setSelection(t)}}return!0},first:e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1},focus:(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{(iU()||iq())&&r.dom.focus(),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!iU()&&!iq()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&null===e||!1===e)return!0;
2if(o&&null===e&&!iz(n.state.selection))return s(),!0;let l=iW(i.doc,e)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},forEach:(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),insertContent:(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),insertContentAt:(e,t,r)=>({tr:i,dispatch:o,editor:s})=>{var l;if(o){let o,a;r={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};let c=e=>{s.emit("contentError",{editor:s,error:e,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{iZ(t,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(e){c(e)}try{o=iZ(t,s.schema,{parseOptions:u,errorOnInvalidContent:null!=(l=r.errorOnInvalidContent)?l:s.options.enableContentCheck})}catch(e){return c(e),!1}let{from:d,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,f=!0;if((!("type"in o)?o:[o]).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,f=!!f&&e.isBlock}),d===h&&f){let{parent:e}=i.doc.resolve(d);!e.isTextblock||e.type.spec.code||e.childCount||(d-=1,h+=1)}if(p){if(Array.isArray(t))a=t.map(e=>e.text||"").join("");else if(t instanceof n){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),a=e}else a="object"==typeof t&&t&&t.text?t.text:t;i.insertText(a,d,h)}else a=o,i.replaceWith(d,h,a);r.updateSelection&&function(e,t){let n=e.steps.length-1;if(n<t)return;let r=e.steps[n];if(!(r instanceof ec||r instanceof eu))return;let i=e.mapping.maps[n],o=0;i.forEach((e,t,n,r)=>{0===o&&(o=r)}),e.setSelection(eL.near(e.doc.resolve(o),-1))}(i,i.steps.length-1),r.applyInputRules&&i.setMeta("applyInputRules",{from:d,text:a}),r.applyPasteRules&&i.setMeta("applyPasteRules",{from:d,text:a})}return!0},joinBackward:()=>({state:e,dispatch:t})=>rU(e,t),joinDown:()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof ez){if(n.node.isTextblock||!eb(e.doc,n.to))return!1;r=n.to}else if(null==(r=ex(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),joinForward:()=>({state:e,dispatch:t})=>rX(e,t),joinItemBackward:()=>({state:e,dispatch:t,tr:n})=>{try{let r=ex(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},joinItemForward:()=>({state:e,dispatch:t,tr:n})=>{try{let r=ex(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},joinTextblockBackward:()=>({state:e,dispatch:t})=>((e,t)=>{let n=rq(e,void 0);if(!n)return!1;let r=rG(n);return!!r&&rK(e,r,t)})(e,t),joinTextblockForward:()=>({state:e,dispatch:t})=>((e,t)=>{let n=rY(e,void 0);if(!n)return!1;let r=r0(n);return!!r&&rK(e,r,t)})(e,t),joinUp:()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof ez,i;if(r){if(n.node.isTextblock||!eb(e.doc,n.from))return!1;i=n.from}else if(null==(i=ex(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(ez.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),keyboardShortcut:e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))iU()||iG()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),l=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});
2return null==a||a.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0},lift:(e,t={})=>({state:n,dispatch:r})=>{let i=ip(e,n.schema);return!!iY(n,i,t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&ep(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)})(n,r)},liftEmptyBlock:()=>({state:e,dispatch:t})=>r4(e,t),liftListItem:e=>({state:t,dispatch:r})=>{var i;return(i=ip(e,t.schema),function(e,t){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,e=>e.childCount>0&&e.firstChild.type==i);return!!s&&(!t||(r.node(s.depth-1).type==i?function(e,t,r,i){let o=e.tr,s=i.end,l=i.$to.end(i.depth);s<l&&(o.step(new eu(s-1,l,s,l,new a(n.from(r.create(null,i.parent.copy())),1,0),1,!0)),i=new b(o.doc.resolve(i.$from.pos),o.doc.resolve(l),i.depth));let c=ep(i);if(null==c)return!1;o.lift(i,c);let u=o.doc.resolve(o.mapping.map(s,-1)-1);return eb(o.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&o.join(u.pos),t(o.scrollIntoView()),!0}(e,t,i,s):function(e,t,r){let i=e.tr,o=r.parent;for(let e=r.end,t=r.endIndex-1,n=r.startIndex;t>n;t--)e-=o.child(t).nodeSize,i.delete(e-1,e+1);let s=i.doc.resolve(r.start),l=s.nodeAfter;if(i.mapping.map(r.end)!=r.start+s.nodeAfter.nodeSize)return!1;let c=0==r.startIndex,u=r.endIndex==o.childCount,d=s.node(-1),h=s.index(-1);if(!d.canReplace(h+ +!c,h+1,l.content.append(u?n.empty:n.from(o))))return!1;let p=s.pos,f=p+l.nodeSize;return i.step(new eu(p-!!c,f+ +!!u,p+1,f-1,new a((c?n.empty:n.from(o.copy(n.empty))).append(u?n.empty:n.from(o.copy(n.empty))),+!c,+!u),+!c)),t(i.scrollIntoView()),!0}(e,t,s)))})(t,r)},newlineInCode:()=>({state:e,dispatch:t})=>r1(e,t),resetAttributes:(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=iX("string"==typeof e?e:e.name,r.schema);return!!l&&("node"===l&&(o=ip(e,r.schema)),"mark"===l&&(s=iF(e,r.schema)),i&&n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&n.setNodeMarkup(r,void 0,iQ(e.attrs,t)),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&n.addMark(r,r+e.nodeSize,s.create(iQ(i.attrs,t)))})})}),!0)},scrollIntoView:()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:t})=>{if(t){let t=new eW(e.doc);e.setSelection(t)}return!0},selectNodeBackward:()=>({state:e,dispatch:t})=>rZ(e,t),selectNodeForward:()=>({state:e,dispatch:t})=>rQ(e,t),selectParentNode:()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return 0!=o&&(i=n.before(o),t&&t(e.tr.setSelection(ez.create(e.doc,i))),!0)})(e,t),selectTextblockEnd:()=>({state:e,dispatch:t})=>r7(e,t),selectTextblockStart:()=>({state:e,dispatch:t})=>r5(e,t),setContent:(e,t=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{var a,c;let{doc:u}=o;if("full"!==n.preserveWhitespace){let l=i0(e,i.schema,n,{errorOnInvalidContent:null!=(a=r.errorOnInvalidContent)?a:i.options.enableContentCheck});return s&&o.replaceWith(0,u.content.size,l).setMeta("preventUpdate",!t),!0}return s&&o.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:u.content.size},e,{parseOptions:n,errorOnInvalidContent:null!=(c=r.errorOnInvalidContent)?c:i.options.enableContentCheck})},setMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:l}=o,a=iF(e,r.schema);if(i)if(s){let e=i1(r,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),l=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&n.addMark(s,l,a.create({...e.attrs,...t}))}):n.addMark(s,l,a.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;
2if(iz(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return!!n.isInSet(t)||!t.some(e=>e.type.excludes(n))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,a)},setMeta:(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),setNode:(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o,s=ip(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!ie(s,{...o,...t})(n)||e.clearNodes()).command(({state:e})=>ie(s,{...o,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=i$(e,0,n.content.size),i=ez.create(n,r);t.setSelection(i)}return!0},setTextSelection:e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,o=eH.atStart(n).from,s=eH.atEnd(n).to,l=i$(r,o,s),a=i$(i,o,s),c=eH.create(n,l,a);t.setSelection(c)}return!0},sinkListItem:e=>({state:t,dispatch:r})=>{var i;return(i=ip(e,t.schema),function(e,t){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,e=>e.childCount>0&&e.firstChild.type==i);if(!s)return!1;let l=s.startIndex;if(0==l)return!1;let c=s.parent,u=c.child(l-1);if(u.type!=i)return!1;if(t){let r=u.lastChild&&u.lastChild.type==c.type,o=n.from(r?i.create():null),l=new a(n.from(i.create(null,n.from(c.type.create(null,o)))),r?3:1,0),d=s.start,h=s.end;t(e.tr.step(new eu(d-(r?3:1),h,d,h,l,1,!0)).scrollIntoView())}return!0})(t,r)},splitBlock:({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:l,$to:a}=o,c=i7(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(o instanceof ez&&o.node.isBlock)return!!l.parentOffset&&!!ev(s,l.pos)&&(r&&(e&&oo(n,i.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let u=a.parentOffset===a.parent.content.size,d=0===l.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=u&&d?[{type:d,attrs:c}]:void 0,p=ev(t.doc,t.mapping.map(l.pos),1,h);if(!h&&!p&&ev(t.doc,t.mapping.map(l.pos),1,d?[{type:d}]:void 0)&&(p=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(p&&(o instanceof eH&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,h),d&&!u&&!l.parentOffset&&l.parent.type!==d)){let e=t.mapping.map(l.before()),n=t.doc.resolve(e);l.node(-1).canReplaceWith(n.index(),n.index()+1,d)&&t.setNodeMarkup(t.mapping.map(l.before()),d)}e&&oo(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return p},splitListItem:(e,t={})=>({tr:r,state:i,dispatch:o,editor:s})=>{var l;let c=ip(e,i.schema),{$from:u,$to:d}=i.selection,h=i.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(d))return!1;let p=u.node(-1);if(p.type!==c)return!1;let f=s.extensionManager.attributes;if(0===u.parent.content.size&&u.node(-1).childCount===u.indexAfter(-1)){if(2===u.depth||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(o){let e=n.empty,i=u.index(-1)?1:u.index(-2)?2:3;for(let t=u.depth-i;t>=u.depth-3;t-=1)e=n.from(u.node(t).copy(e));let o=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,s={...i7(f,u.node().type.name,u.node().attrs),...t},d=(null==(l=c.contentMatch.defaultType)?void 0:l.createAndFill(s))||void 0;e=e.append(n.from(c.createAndFill(null,d)||void 0));let h=u.before(u.depth-(i-1));r.replace(h,u.after(-o),new a(e,4-i,0));let p=-1;r.doc.nodesBetween(h,r.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&r.setSelection(eH.near(r.doc.resolve(p))),r.scrollIntoView()}return!0}let m=d.pos===u.end()?p.contentMatchAt(0).defaultType:null,g={...i7(f,p.type.name,p.attrs),...t},y={...i7(f,u.node().type.name,u.node().attrs),...t};r.delete(u.pos,d.pos);let v=m?[{type:c,attrs:g},{type:m,attrs:y}]:[{type:c,attrs:g}];if(!ev(r.doc,u.pos,2))return!1;if(o){let{selection:e,storedMarks:t}=i,{splittableMarks:n}=s.extensionManager,l=t||e.$to.parentOffset&&e.$from.marks();if(r.split(u.pos,2,v).scrollIntoView(),!l||!o)return!0;let a=l.filter(e=>
2n.includes(e.type.name));r.ensureMarks(a)}return!0},toggleList:(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:u})=>{let{extensions:d,splittableMarks:h}=i.extensionManager,p=ip(e,s.schema),f=ip(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:v}=m,b=y.blockRange(v),w=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;let x=i3(e=>ot(e.type.name,d))(m);if(b.depth>=1&&x&&b.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(f);if(ot(x.node.type.name,d)&&p.validContent(x.node.content)&&l)return a().command(()=>(o.setNodeMarkup(x.pos,p),!0)).command(()=>ol(o,p)).command(()=>oa(o,p)).run()}return n&&w&&l?a().command(()=>{let e=u().wrapInList(p,r),t=w.filter(e=>h.includes(e.type.name));return o.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>ol(o,p)).command(()=>oa(o,p)).run():a().command(()=>!!u().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>ol(o,p)).command(()=>oa(o,p)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=iF(e,r.schema);return oe(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},toggleNode:(e,t,n={})=>({state:r,commands:i})=>{let o,s=ip(e,r.schema),l=ip(t,r.schema),a=iY(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),a)?i.setNode(l,o):i.setNode(s,{...o,...n})},toggleWrap:(e,t={})=>({state:n,commands:r})=>{let i=ip(e,n.schema);return iY(n,i,t)?r.lift(i):r.wrapIn(i,t)},undoInputRule:()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;
2return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=iF(e,r.schema),{$from:c,empty:u,ranges:d}=l;if(!i)return!0;if(u&&s){let{from:e,to:t}=l,r=null==(o=c.marks().find(e=>e.type===a))?void 0:o.attrs,i=iH(c,a,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,a)}else d.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,a)});return n.removeStoredMark(a),!0},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=iX("string"==typeof e?e:e.name,r.schema);return!!l&&("node"===l&&(o=ip(e,r.schema)),"mark"===l&&(s=iF(e,r.schema)),i&&n.selection.ranges.forEach(e=>{let i,l,a,c,u=e.$from.pos,d=e.$to.pos;n.selection.empty?r.doc.nodesBetween(u,d,(e,t)=>{o&&o===e.type&&(a=Math.max(t,u),c=Math.min(t+e.nodeSize,d),i=t,l=e)}):r.doc.nodesBetween(u,d,(e,r)=>{r<u&&o&&o===e.type&&(a=Math.max(r,u),c=Math.min(r+e.nodeSize,d),i=r,l=e),r>=u&&r<=d&&(o&&o===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type){let o=Math.max(r,u),l=Math.min(r+e.nodeSize,d);n.addMark(o,l,s.create({...i.attrs,...t}))}}))}),l&&(void 0!==i&&n.setNodeMarkup(i,void 0,{...l.attrs,...t}),s&&l.marks.length&&l.marks.forEach(e=>{s===e.type&&n.addMark(a,c,s.create({...e.attrs,...t}))}))}),!0)},wrapIn:(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&ef(s,e,t);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}})(ip(e,n.schema),t)(n,r),wrapInList:(e,t={})=>({state:r,dispatch:i})=>(function(e,t=null){return function(r,i){let{$from:o,$to:s}=r.selection,l=o.blockRange(s);if(!l)return!1;let c=i?r.tr:null;return!!function(e,t,r,i=null){let o=!1,s=t,l=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=l.resolve(t.start-2);s=new b(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new b(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let c=ef(s,r,i,t);return!!c&&(e&&function(e,t,r,i,o){let s=n.empty;for(let e=r.length-1;e>=0;e--)s=n.from(r[e].type.create(r[e].attrs,s));e.step(new eu(t.start-2*!!i,t.end,t.start,t.end,new a(s,0,0),r.length,!0));let l=0;for(let e=0;e<r.length;e++)r[e].type==o&&(l=e+1);let c=r.length-l,u=t.start+r.length-2*!!i,d=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&ev(e.doc,u,c)&&(e.split(u,c),u+=2*c),u+=d.child(n).nodeSize}(e,t,c,o,r),!0)}(c,l,e,t)&&(i&&i(c.scrollIntoView()),!0)}})(ip(e,r.schema),t)(r,i)});let ou=iD.create({name:"commands",addCommands:()=>({...oc})}),od=iD.create({name:"drop",addProseMirrorPlugins(){return[new e0({key:new e9("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),oh=iD.create({name:"editable",addProseMirrorPlugins(){return[new e0({key:new e9("editable"),props:{editable:()=>this.editor.options.editable}})]}}),op=new e9("focusEvents"),of=iD.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new e0({key:op,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),om=iD.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:o}=n,{pos:s,parent:l}=o,a=o.parent.isTextblock&&s>0?t.doc.resolve(s-1):o,c=a.parent.type.spec.isolating,u=o.pos-o.parentOffset,d=c&&1===a.parent.childCount?u===o.pos:eL.atStart(r).from===s;return!!i&&!!l.type.isTextblock&&!l.textContent.length&&!!d&&(!d||"paragraph"!==o.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()]),n={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()},r={...n},i={...n,"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 iU()||iG()?i:r},addProseMirrorPlugins(){return[new e0({key:new e9("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:l}=t.selection,a=eL.atStart(t.doc).from,c=eL.atEnd(t.doc).to;
2if(o||s!==a||l!==c||!on(n.doc))return;let u=n.tr,d=il({state:n,transaction:u}),{commands:h}=new ia({editor:this.editor,state:d});if(h.clearNodes(),u.steps.length)return u}})]}}),og=iD.create({name:"paste",addProseMirrorPlugins(){return[new e0({key:new e9("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),oy=iD.create({name:"tabindex",addProseMirrorPlugins(){return[new e0({key:new e9("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class ov{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}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,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},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 e=this.resolvedPos.start(this.resolvedPos.depth-1);return new ov(this.resolvedPos.doc.resolve(e),this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ov(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ov(e,this.editor)}get children(){let e=[];return this.node.content.forEach((t,n)=>{let r=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,o=this.pos+n+ +!i;if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;let s=this.resolvedPos.doc.resolve(o);if(!r&&s.depth<=this.depth)return;let l=new ov(s,this.editor,r,r?t:null);r&&(l.actualDepth=this.depth+1),e.push(new ov(s,this.editor,r,r?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}let ob=`.ProseMirror {
3  position: relative;
4}
5
6.ProseMirror {
7  word-wrap: break-word;
8  white-space: pre-wrap;
9  white-space: break-spaces;
10  -webkit-font-variant-ligatures: none;
11  font-variant-ligatures: none;
12  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
13}
14
15.ProseMirror [contenteditable="false"] {
16  white-space: normal;
17}
18
19.ProseMirror [contenteditable="false"] [contenteditable="true"] {
20  white-space: pre-wrap;
21}
22
23.ProseMirror pre {
24  white-space: pre-wrap;
25}
26
27img.ProseMirror-separator {
28  display: inline !important;
29  border: none !important;
30  margin: 0 !important;
31  width: 0 !important;
32  height: 0 !important;
33}
34
35.ProseMirror-gapcursor {
36  display: none;
37  pointer-events: none;
38  position: absolute;
39  margin: 0;
40}
41
42.ProseMirror-gapcursor:after {
43  content: "";
44  display: block;
45  position: absolute;
46  top: -2px;
47  width: 20px;
48  border-top: 1px solid black;
49  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
50}
51
52@keyframes ProseMirror-cursor-blink {
53  to {
54    visibility: hidden;
55  }
56}
57
58.ProseMirror-hideselection *::selection {
59  background: transparent;
60}
61
62.ProseMirror-hideselection *::-moz-selection {
63  background: transparent;
64}
65
66.ProseMirror-hideselection * {
67  caret-color: transparent;
68}
69
70.ProseMirror-focused .ProseMirror-gapcursor {
71  display: block;
72}
73
74.tippy-box[data-animation=fade][data-state=hidden] {
75  opacity: 0
76}`;class ow extends ic{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(e,t){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(ob,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){let n=iy(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[oh,iL.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),ou,of,om,oy,od,og].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 ij(n,this)}createCommandManager(){this.commandManager=new ia({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=i0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;
76this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),t=i0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let n=iW(t,this.options.autofocus);this.view=new rw(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null==(e=this.options.editorProps)?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:eQ.create({doc:t,selection:n||void 0})});let r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;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}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});let r=e.getMeta("focus"),i=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!e.docChanged||e.getMeta("preventUpdate")||this.emit("update",{editor:this,transaction:e})}getAttributes(e){return i6(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return iY(e,null,n)||oe(e,null,n);let r=iX(t,e.schema);return"node"===r?iY(e,t,n):"mark"===r&&oe(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ik(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return i4(this.state.doc,{blockSeparator:t,textSerializers:{...iP(this.schema),...n}})}get isEmpty(){return on(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(null==(e=this.view)?void 0:e.docView)}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){return new ov(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}}function ox(e){return new iE({find:e.find,handler:({state:t,range:n,match:r})=>{let i=iv(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:o}=t,s=r[r.length-1],l=r[0];if(s){let r=l.search(/\S/),a=n.from+l.indexOf(s),c=a+s.length;if(i5(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>a).length)return null;c<n.to&&o.delete(c,n.to),a>n.from&&o.delete(n.from+r,a);let u=n.from+r+s.length;o.addMark(n.from+r,u,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function oC(e){return new iE({find:e.find,handler:({state:t,range:n,match:r})=>{let i=iv(e.getAttributes,void 0,r)||{},{tr:o}=t,s=n.from,l=n.to,a=e.type.create(i);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>l?e=l:l=e+r[1].length;let t=r[0][r[0].length-1];o.insertText(t,s+r[0].length-1),o.replaceWith(e,l,a)}else if(r[0]){let t=e.type.isInline?s:s-1;o.insert(t,e.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()}})}function ok(e){return new iE({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),o=iv(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function oS(e){return new iE({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let o=iv(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&ef(l,e.type,o);if(!a)return null;if(s.wrap(l,a),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,o=r||n.$to.parentOffset&&n.$from.marks();if(o){let e=o.filter(e=>
76i.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,o).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&eb(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)}})}class oE{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=iv(iu(this,"addOptions",{name:this.name}))),this.storage=iv(iu(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new oE(e)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>iO(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new oE(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=iv(iu(t,"addOptions",{name:t.name})),t.storage=iv(iu(t,"addStorage",{name:t.name,options:t.options})),t}}function oT(e){return new iN({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let o=iv(e.getAttributes,void 0,r,i);if(!1===o||null===o)return null;let{tr:s}=t,l=r[r.length-1],a=r[0],c=n.to;if(l){let r=a.search(/\S/),i=n.from+a.indexOf(l),u=i+l.length;if(i5(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>i).length)return null;u<n.to&&s.delete(u,n.to),i>n.from&&s.delete(n.from+r,i),c=n.from+r+l.length,s.addMark(n.from+r,c,e.type.create(o||{})),s.removeStoredMark(e.type)}}})}function oM(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof ez){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;i-=1}return!1}e.s(["Editor",0,ow,"Extension",0,iD,"Mark",0,iA,"Node",0,oE,"NodeView",0,class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},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,n,r,i,o,s,l;let{view:a}=this.editor,c=e.target,u=3===c.nodeType?null==(t=c.parentElement)?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(c))||!u)return;let d=0,h=0;if(this.dom!==u){let t=this.dom.getBoundingClientRect(),n=u.getBoundingClientRect(),l=null!=(r=e.offsetX)?r:null==(i=e.nativeEvent)?void 0:i.offsetX,a=null!=(o=e.offsetY)?o:null==(s=e.nativeEvent)?void 0:s.offsetY;d=n.x-t.x+l,h=n.y-t.y+a}let p=this.dom.cloneNode(!0);null==(l=e.dataTransfer)||l.setDragImage(p,d,h);let f=this.getPos();if("number"!=typeof f)return;let m=ez.create(a.state.doc,f),g=a.state.tr.setSelection(m);a.dispatch(g)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});let n=e.target;if(!(this.dom.contains(n)&&!(null==(t=this.contentDOM)?void 0:t.contains(n))))return!1;let r=e.type.startsWith("drag"),i="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!r)return!0;let{isEditable:o}=this.editor,{isDragging:s}=this,l=!!this.node.type.spec.draggable,a=ez.isSelectable(this.node),c="copy"===e.type,u="paste"===e.type,d="cut"===e.type,h="mousedown"===e.type;if(!l&&a&&r&&e.target===this.dom&&e.preventDefault(),l&&r&&!s&&e.target===this.dom)return e.preventDefault(),!1;if(l&&o&&!s&&h){let e=n.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!s&&!i&&!c&&!u&&!d&&(!h||!a)}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&&(iU()||iq())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes
76)].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 n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,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})}},"callOrReturn",0,iv,"canInsertNode",0,oM,"combineTransactionSteps",0,i2,"findChildrenInRange",0,i9,"getAttributes",0,i6,"getChangedRanges",0,i8,"getExtensionField",0,iu,"getMarksBetween",0,i5,"getRenderedAttributes",0,ig,"getText",0,i4,"getTextSerializersFromSchema",0,iP,"isNodeEmpty",0,on,"isNodeSelection",0,or,"isTextSelection",0,iz,"markInputRule",0,ox,"markPasteRule",0,oT,"mergeAttributes",0,im,"nodeInputRule",0,oC,"posToDOMRect",0,oi,"textblockTypeInputRule",0,ok,"wrappingInputRule",0,oS],366392);let oO=iD.create({name:"characterCount",addOptions:()=>({limit:null,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,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new e0({key:new e9("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(null==i||0===i){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,o-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos;return e.deleteRange(o-(i-n),o),!(this.storage.characters({node:e.doc})>n)}})]}});e.s(["default",0,oO],578746);let oA="numeric",oN="ascii",oR="alpha",oj="asciinumeric",oD="alphanumeric",oI="domain",oP="emoji",oL="whitespace";function o_(e,t,n){for(let r in t[oA]&&(t[oj]=!0,t[oD]=!0),t[oN]&&(t[oj]=!0,t[oR]=!0),t[oj]&&(t[oD]=!0),t[oR]&&(t[oD]=!0),t[oD]&&(t[oI]=!0),t[oP]&&(t[oI]=!0),t){let t=(r in n||(n[r]=[]),n[r]);0>t.indexOf(e)&&t.push(e)}}function oV(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}oV.groups={},oV.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 n=this.jr[t][0],r=this.jr[t][1];if(r&&n.test(e))return r}return this.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){let i;return r=r||oV.groups,t&&t.j?i=t:(i=new oV(t),n&&r&&o_(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,o=e.length;if(!o)return i;for(let t=0;t<o-1;t++)i=i.tt(e[t]);return i.tt(e[o-1],t,n,r)},tt(e,t,n,r){if(r=r||oV.groups,t&&t.j)return this.j[e]=t,t;let i,o=this.go(e);return o?(Object.assign((i=new oV).j,o.j),i.jr.push.apply(i.jr,o.jr),i.jd=o.jd,i.t=o.t):i=new oV,t&&(r&&(i.t&&"string"==typeof i.t?o_(t,Object.assign(function(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(i.t,r),n),r):n&&o_(t,n,r)),i.t=t),this.j[e]=i,i}};let oB=(e,t,n,r,i)=>e.ta(t,n,r,i),oH=(e,t,n,r,i)=>e.tr(t,n,r,i),oF=(e,t,n,r,i)=>e.ts(t,n,r,i),oz=(e,t,n,r,i)=>e.tt(t,n,r,i),o$="WORD",oW="UWORD",oq="ASCIINUMERICAL",oU="ALPHANUMERICAL",oK="LOCALHOST",oJ="UTLD",oZ="SCHEME",oG="SLASH_SCHEME",oY="OPENBRACE",oX="CLOSEBRACE",oQ="OPENBRACKET",o0="CLOSEBRACKET",o1="OPENPAREN",o2="CLOSEPAREN",o9="OPENANGLEBRACKET",o3="CLOSEANGLEBRACKET",o4="FULLWIDTHLEFTPAREN",o6="FULLWIDTHRIGHTPAREN",o8="LEFTCORNERBRACKET",o5="RIGHTCORNERBRACKET",o7="LEFTWHITECORNERBRACKET",se="RIGHTWHITECORNERBRACKET",st="FULLWIDTHLESSTHAN",sn="FULLWIDTHGREATERTHAN",sr="AMPERSAND",si="APOSTROPHE",so="ASTERISK",ss="BACKSLASH",sl="BACKTICK",sa="CARET",sc="COLON",su="COMMA",sd="DOLLAR",sh="EQUALS",sp="EXCLAMATION",sf="HYPHEN",sm="PERCENT",sg="PIPE",sy="PLUS",sv="POUND",sb="QUERY",sw="QUOTE",sx="FULLWIDTHMIDDLEDOT",sC="SEMI",sk="SLASH",sS="TILDE",sE="UNDERSCORE",sT="EMOJI";var sM=Object.freeze({__proto__:null,ALPHANUMERICAL:oU,AMPERSAND:sr,APOSTROPHE:si,ASCIINUMERICAL:oq,ASTERISK:so,AT:"AT",BACKSLASH:ss,BACKTICK:sl,CARET:sa,CLOSEANGLEBRACKET:o3,CLOSEBRACE:oX,CLOSEBRACKET:o0,CLOSEPAREN:o2,COLON:sc,COMMA:su,DOLLAR:sd,DOT:"DOT",EMOJI:sT,EQUALS:sh,EXCLAMATION:sp,FULLWIDTHGREATERTHAN:sn,FULLWIDTHLEFTPAREN:o4,FULLWIDTHLESSTHAN:st,FULLWIDTHMIDDLEDOT:sx,FULLWIDTHRIGHTPAREN:o6,HYPHEN:sf,LEFTCORNERBRACKET:o8,LEFTWHITECORNERBRACKET:o7,LOCALHOST:oK,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:o9,OPENBRACE:oY,OPENBRACKET:oQ,OPENPAREN:o1,PERCENT:sm,PIPE:sg,PLUS:sy,POUND:sv,QUERY:sb,QUOTE:sw,RIGHTCORNERBRACKET:o5,RIGHTWHITECORNERBRACKET:se,SCHEME:oZ,SEMI:sC,SLASH:sk,SLASH_SCHEME:oG,SYM:"SYM",TILDE:sS,TLD:"TLD",UNDERSCORE:sE,UTLD:oJ,UWORD:oW,WORD:o$,WS:"WS"});let sO=/[a-z]/,sA=/\p{L}/u,sN=/\p{Emoji}
76/u,sR=/\d/,sj=/\s/,sD=null,sI=null;function sP(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r<n;){let i,o=e.charCodeAt(r),s=o<55296||o>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s<r;){let l=e,a=null,c=0,u=null,d=-1,h=-1;for(;s<r&&(a=l.go(n[s]));)(l=a).accepts()?(d=0,h=0,u=l):d>=0&&(d+=n[s].length,h++),c+=n[s].length,o+=n[s].length,s++;o-=d,s-=h,c-=d,i.push({t:u.t,v:t.slice(o-c,o),s:o-c,e:o})}return i}function sL(e,t,n,r,i){let o,s=t.length;for(let n=0;n<s-1;n++){let s=t[n];e.j[s]?o=e.j[s]:((o=new oV(r)).jr=i.slice(),e.j[s]=o),e=o}return(o=new oV(n)).jr=i.slice(),e.j[t[s-1]]=o,o}function s_(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;"0123456789".indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}let sV={defaultProtocol:"http",events:null,format:sH,formatHref:sH,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function sB(e,t=null){let n=Object.assign({},sV);e&&(n=Object.assign(n,e instanceof sB?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}function sH(e){return e}function sF(e,t){this.t="token",this.v=e,this.tk=t}function sz(e,t){class n extends sF{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}sB.prototype={o:sV,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){let r=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=n.t in i?i[n.t]:sV[e])&&r&&(i=i(t,n)):"function"==typeof i&&r&&(i=i(t,n.t,n))),i},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},sF.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},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=sV.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")),n=e.get("formatHref",t,this),r=e.get("tagName",t,this),i=this.toFormattedString(e),o={},s=e.get("className",t,this),l=e.get("target",t,this),a=e.get("rel",t,this),c=e.getObj("attributes",t,this),u=e.getObj("events",t,this);return o.href=n,s&&(o.class=s),l&&(o.target=l),a&&(o.rel=a),c&&Object.assign(o,c),{tagName:r,attributes:o,content:i,eventListeners:u}}};let s$=sz("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),sW=sz("text"),sq=sz("nl"),sU=sz("url",{isLink:!0,toHref(e=sV.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==oK&&e[1].t===sc}}),sK=e=>new oV(e);function sJ(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}let sZ="u">typeof console&&console&&console.warn||(()=>{}),sG={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function sY(){return oV.groups={},sG.scanner=null,sG.parser=null,sG.tokenQueue=[],sG.pluginQueue=[],sG.customSchemes=[],sG.initialized=!1,sG}function sX(e,t=!1){if(sG.initialized&&sZ(`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.
771. Must only contain digits, lowercase ASCII letters or "-"
782. Cannot start or end with "-"
793. "-" cannot repeat`);sG.customSchemes.push([e,t])}function sQ(e){return sG.initialized||function(){sG.scanner=function(e=[]){let t={};oV.groups=t;let n=new oV;null==sD&&(sD=s_("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
79ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==sI&&(sI=s_("ελ1υ2бг1ел3дети4ею2католик6ом3мÐ
79ºÐ´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")),oz(n,"'",si),oz(n,"{",oY),oz(n,"}",oX),oz(n,"[",oQ),oz(n,"]",o0),oz(n,"(",o1),oz(n,")",o2),oz(n,"<",o9),oz(n,">",o3),oz(n,"(",o4),oz(n,")",o6),oz(n,"「",o8),oz(n,"」",o5),oz(n,"『",o7),oz(n,"』",se),oz(n,"<",st),oz(n,">",sn),oz(n,"&",sr),oz(n,"*",so),oz(n,"@","AT"),oz(n,"`",sl),oz(n,"^",sa),oz(n,":",sc),oz(n,",",su),oz(n,"$",sd),oz(n,".","DOT"),oz(n,"=",sh),oz(n,"!",sp),oz(n,"-",sf),oz(n,"%",sm),oz(n,"|",sg),oz(n,"+",sy),oz(n,"#",sv),oz(n,"?",sb),oz(n,'"',sw),oz(n,"/",sk),oz(n,";",sC),oz(n,"~",sS),oz(n,"_",sE),oz(n,"\\",ss),oz(n,"・",sx);let r=oH(n,sR,"NUM",{[oA]:!0});oH(r,sR,r);let i=oH(r,sO,oq,{[oj]:!0}),o=oH(r,sA,oU,{[oD]:!0}),s=oH(n,sO,o$,{[oN]:!0});oH(s,sR,i),oH(s,sO,s),oH(i,sR,i),oH(i,sO,i);let l=oH(n,sA,oW,{[oR]:!0});oH(l,sO),oH(l,sR,o),oH(l,sA,l),oH(o,sR,o),oH(o,sO),oH(o,sA,o);let a=oz(n,"\n","NL",{[oL]:!0}),c=oz(n,"\r","WS",{[oL]:!0}),u=oH(n,sj,"WS",{[oL]:!0});oz(n,"",u),oz(c,"\n",a),oz(c,"",u),oH(c,sj,u),oz(u,"\r"),oz(u,"\n"),oH(u,sj,u),oz(u,"",u);let d=oH(n,sN,sT,{[oP]:!0});oz(d,"#"),oH(d,sN,d),oz(d,"️",d);let h=oz(d,"‍");oz(h,"#"),oH(h,sN,d);let p=[[sO,s],[sR,i]],f=[[sO,null],[sA,l],[sR,o]];for(let e=0;e<sD.length;e++)sL(n,sD[e],"TLD",o$,p);for(let e=0;e<sI.length;e++)sL(n,sI[e],oJ,oW,f);o_("TLD",{tld:!0,ascii:!0},t),o_(oJ,{utld:!0,alpha:!0},t),sL(n,"file",oZ,o$,p),sL(n,"mailto",oZ,o$,p),sL(n,"http",oG,o$,p),sL(n,"https",oG,o$,p),sL(n,"ftp",oG,o$,p),sL(n,"ftps",oG,o$,p),o_(oZ,{scheme:!0,ascii:!0},t),o_(oG,{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 r=e[t][0],i=e[t][1]?{scheme:!0}:{slashscheme:!0};r.indexOf("-")>=0?i[oI]=!0:sO.test(r)?sR.test(r)?i[oj]=!0:i[oN]=!0:i[oA]=!0,oF(n,r,r,i)}return oF(n,"localhost",oK,{ascii:!0}),n.jd=new oV("SYM"),{start:n,tokens:Object.assign({groups:t},sM)}}(sG.customSchemes);for(let e=0;e<sG.tokenQueue.length;e++)sG.tokenQueue[e][1]({scanner:sG.scanner});sG.parser=function({groups:e}){let t=e.domain.concat([sr,so,"AT",ss,sl,sa,sd,sh,sf,"NUM",sm,sg,sy,sv,sk,"SYM",sS,sE]),n=[si,sc,su,"DOT",sp,sm,sb,sw,sC,o9,o3,oY,oX,o0,oQ,o1,o2,o4,o6,o8,o5,o7,se,st,sn],r=[sr,si,so,ss,sl,sa,sd,sh,sf,oY,oX,sm,sg,sy,sv,sb,sk,"SYM",sS,sE],i=sK(),o=oz(i,sS);oB(o,r,o),oB(o,e.domain,o);let s=sK(),l=sK(),a=sK();oB(i,e.domain,s),oB(i,e.scheme,l),oB(i,e.slashscheme,a),oB(s,r,o),oB(s,e.domain,s);let c=oz(s,"AT");oz(o,"AT",c),oz(l,"AT",c),oz(a,"AT",c);let u=oz(o,"DOT");oB(u,r,o),oB(u,e.domain,o);let d=sK();oB(c,e.domain,d),oB(d,e.domain,d);let h=oz(d,"DOT");oB(h,e.domain,d);let p=sK(s$);oB(h,e.tld,p),oB(h,e.utld,p),oz(c,oK,p);let f=oz(d,sf);oz(f,sf,f),oB(f,e.domain,d),oB(p,e.domain,d),oz(p,"DOT",h),oz(p,sf,f),oB(oz(p,sc),e.numeric,s$);let m=oz(s,sf),g=oz(s,"DOT");oz(m,sf,m),oB(m,e.domain,s),oB(g,r,o),oB(g,e.domain,s);let y=sK(sU);oB(g,e.tld,y),oB(g,e.utld,y),oB(y,e.domain,s),oB(y,r,o),oz(y,"DOT",g),oz(y,sf,m),oz(y,"AT",c);let v=oz(y,sc),b=sK(sU);oB(v,e.numeric,b);let w=sK(sU),x=sK();oB(w,t,w),oB(w,n,x),oB(x,t,w),oB(x,n,x),oz(y,sk,w),oz(b,sk,w);let C=oz(l,sc),k=oz(a,sc),S=oz(k,sk),E=oz(S,sk);oB(l,e.domain,s),oz(l,"DOT",g),oz(l,sf,m),oB(a,e.domain,s),oz(a,"DOT",g),oz(a,sf,m),oB(C,e.domain,w),oz(C,sk,w),oz(C,sb,w),oB(E,e.domain,w),oB(E,t,w),oz(E,sk,w);let T=[[oY,oX],[oQ,o0],[o1,o2],[o9,o3],[o4,o6],[o8,o5],[o7,se],[st,sn]];for(let e=0;e<T.length;e++){let[r,i]=T[e],o=oz(w,r);oz(x,r,o),oz(o,i,w);let s=sK(sU);oB(o,t,s);let l=sK();oB(o,n),oB(s,t,s),oB(s,n,l),oB(l,t,s),oB(l,n,l),oz(s,i,w),oz(l,i,w)}return oz(i,oK,y),oz(i,"NL",sq),{start:i,tokens:sM}}(sG.scanner.tokens);for(let e=0;e<sG.pluginQueue.length;e++)sG.pluginQueue[e][1]({scanner:sG.scanner,parser:sG.parser});sG.initialized=!0}(),function(e,t,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let l=e,a=null,c=null,u=0,d=null,h=-1;for(;i<r&&!(a=l.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=a||l.go(n[i].t));)a=null,(l=c).accepts()?(h=0,d=l):h>=0&&h++,i++,u++;if(h<0)(i-=u)<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(sJ(sW,t,s)),s=[]),i-=h,u-=h;let e=d.t,r=n.slice(i-u,i);o.push(sJ(e,t,r))}}return s.length>0&&o.push(sJ(sW,t,s)),o}(sG.parser.start,e,sP(sG.scanner.start,e))}function s0(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new sB(n),i=sQ(e),o=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&o.push(n.toFormattedObject(r))}return o}sQ.scan=sP,e.s(["find",0,s0,"registerCustomProtocol",0,sX,"reset",0,sY,"test",0,function(e,t=null){let n=sQ(e);return 1===n.length&&n[0].isLink&&(!t||n[0].t===t)},"tokenize",0,sQ],701447);var s1="[\0-   ᠎ -\u2029  ]",s2=new RegExp(s1),s9=RegExp(`${s1}$`),s3=RegExp(s1,"g");function s4(e,t){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];
79return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(s3,"").match(RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var s6=iA.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?sX(e):sX(e.scheme,e.optionalSlashes)})},onDestroy(){sY()},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)=>!!s4(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;let r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),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=>!!s4(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!s4(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",im(this.options.HTMLAttributes,e),0]:["a",im(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 n,r,i,o;let s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",l=null!=(o=null==(i=e.attrs)?void 0:i.title)?o:"",a=t.renderChildren(e);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!s4(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:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!s4(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[oT({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=s0(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!s4(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t}
79,type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,n;let r=[],{protocols:i,defaultProtocol:o}=this.options;return this.options.autolink&&r.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!s4(e,i),protocols:i,defaultProtocol:o}),shouldAutoLink:this.options.shouldAutoLink},new e0({key:new e9("autolink"),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),o=t.some(e=>e.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r;if(i8(i2(n.doc,[...t])).forEach(({newRange:t})=>{let n,i,o=i9(r.doc,t,e=>e.isTextblock);if(o.length>1)n=o[0],i=r.doc.textBetween(n.pos,n.pos+n.node.nodeSize,void 0," ");else if(o.length){let e=r.doc.textBetween(t.from,t.to," "," ");if(!s9.test(e))return;n=o[0],i=r.doc.textBetween(n.pos,t.to,void 0," ")}if(n&&i){let t=i.split(s2).filter(Boolean);if(t.length<=0)return!1;let o=t[t.length-1],l=n.pos+i.lastIndexOf(o);if(!o)return!1;let a=sQ(o).map(t=>t.toObject(e.defaultProtocol));if(!(1===a.length?a[0].isLink:3===a.length&&!!a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;a.filter(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{i5(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||s.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),s.steps.length)return s}}))),r.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new e0({key:new e9("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(0!==r.button||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let e=r.target;if(!e)return!1;let n=t.editor.view.dom;(s=e.closest("a"))&&!n.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let n=i6(e.state,t.type.name),r=null!=(i=s.href)?i:n.href,a=null!=(o=s.target)?o:n.target;r&&(window.open(r,a),l=!0)}return l}}}))),this.options.linkOnPaste&&r.push((n={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new e0({key:new e9("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(e=>{a+=e.textContent});let c=s0(a,{defaultProtocol:n.defaultProtocol}).find(e=>e.isLink&&e.value===a);return!!a&&!!c&&(void 0===i||!!i(c.value))&&n.editor.commands.setMark(n.type,{href:c.href})}}}))),r}});e.s(["default",0,s6],437944);let s8=iD.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new e0({key:new e9("placeholder"),props:{decorations:({doc:e,selection:t})=>{let n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(!n)return null;let o=this.editor.isEmpty;return e.descendants((e,t)=>{let n=r>=t&&r<=t+e.nodeSize,s=!e.isLeaf&&on(e);if((n||!this.options.showOnlyCurrent)&&s){let r=[this.options.emptyNodeClass];o&&r.push(this.options.emptyEditorClass);let s=n3.node(t,t+e.nodeSize,{class:r.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:t,hasAnchor:n}):this.options.placeholder});i.push(s)}return this.options.includeChildren}),n8.create(e,i)}}})]}});function s5(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function s7(e){var t=s5(e).Element;return e instanceof t||e instanceof Element}function le(e){var t=s5(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function lt(e){if("u"<typeof ShadowRoot)return!1;var t=s5(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}e.s(["default",0,s8],200381);
79var ln=Math.max,lr=Math.min,li=Math.round;function lo(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ls(){return!/^((?!chrome|android).)*safari/i.test(lo())}function ll(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=e.getBoundingClientRect(),i=1,o=1;t&&le(e)&&(i=e.offsetWidth>0&&li(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&li(r.height)/e.offsetHeight||1);var s=(s7(e)?s5(e):window).visualViewport,l=!ls()&&n,a=(r.left+(l&&s?s.offsetLeft:0))/i,c=(r.top+(l&&s?s.offsetTop:0))/o,u=r.width/i,d=r.height/o;return{width:u,height:d,top:c,right:a+u,bottom:c+d,left:a,x:a,y:c}}function la(e){var t=s5(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function lc(e){return e?(e.nodeName||"").toLowerCase():null}function lu(e){return((s7(e)?e.ownerDocument:e.document)||window.document).documentElement}function ld(e){return ll(lu(e)).left+la(e).scrollLeft}function lh(e){return s5(e).getComputedStyle(e)}function lp(e){var t=lh(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function lf(e){var t=ll(e),n=e.offsetWidth,r=e.offsetHeight;return 1>=Math.abs(t.width-n)&&(n=t.width),1>=Math.abs(t.height-r)&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function lm(e){return"html"===lc(e)?e:e.assignedSlot||e.parentNode||(lt(e)?e.host:null)||lu(e)}function lg(e,t){void 0===t&&(t=[]);var n,r=function e(t){return["html","body","#document"].indexOf(lc(t))>=0?t.ownerDocument.body:le(t)&&lp(t)?t:e(lm(t))}(e),i=r===(null==(n=e.ownerDocument)?void 0:n.body),o=s5(r),s=i?[o].concat(o.visualViewport||[],lp(r)?r:[]):r,l=t.concat(s);return i?l:l.concat(lg(lm(s)))}function ly(e){return le(e)&&"fixed"!==lh(e).position?e.offsetParent:null}function lv(e){for(var t=s5(e),n=ly(e);n&&["table","td","th"].indexOf(lc(n))>=0&&"static"===lh(n).position;)n=ly(n);return n&&("html"===lc(n)||"body"===lc(n)&&"static"===lh(n).position)?t:n||function(e){var t=/firefox/i.test(lo());if(/Trident/i.test(lo())&&le(e)&&"fixed"===lh(e).position)return null;var n=lm(e);for(lt(n)&&(n=n.host);le(n)&&0>["html","body"].indexOf(lc(n));){var r=lh(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var lb="bottom",lw="right",lx="left",lC="auto",lk=["top",lb,lw,lx],lS="start",lE="viewport",lT="popper",lM=lk.reduce(function(e,t){return e.concat([t+"-"+lS,t+"-end"])},[]),lO=[].concat(lk,[lC]).reduce(function(e,t){return e.concat([t,t+"-"+lS,t+"-end"])},[]),lA=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function lN(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&lt(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function lR(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}
79function lj(e,t,n){var r,i,o,s,l,a,c,u,d,h;return t===lE?lR(function(e,t){var n=s5(e),r=lu(e),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,l=0,a=0;if(i){o=i.width,s=i.height;var c=ls();(c||!c&&"fixed"===t)&&(l=i.offsetLeft,a=i.offsetTop)}return{width:o,height:s,x:l+ld(e),y:a}}(e,n)):s7(t)?((r=ll(t,!1,"fixed"===n)).top=r.top+t.clientTop,r.left=r.left+t.clientLeft,r.bottom=r.top+t.clientHeight,r.right=r.left+t.clientWidth,r.width=t.clientWidth,r.height=t.clientHeight,r.x=r.left,r.y=r.top,r):lR((i=lu(e),s=lu(i),l=la(i),a=null==(o=i.ownerDocument)?void 0:o.body,c=ln(s.scrollWidth,s.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),u=ln(s.scrollHeight,s.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),d=-l.scrollLeft+ld(i),h=-l.scrollTop,"rtl"===lh(a||s).direction&&(d+=ln(s.clientWidth,a?a.clientWidth:0)-c),{width:c,height:u,x:d,y:h}))}function lD(e){return e.split("-")[0]}function lI(e){return e.split("-")[1]}function lP(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function lL(e){var t,n=e.reference,r=e.element,i=e.placement,o=i?lD(i):null,s=i?lI(i):null,l=n.x+n.width/2-r.width/2,a=n.y+n.height/2-r.height/2;switch(o){case"top":t={x:l,y:n.y-r.height};break;case lb:t={x:l,y:n.y+n.height};break;case lw:t={x:n.x+n.width,y:a};break;case lx:t={x:n.x-r.width,y:a};break;default:t={x:n.x,y:n.y}}var c=o?lP(o):null;if(null!=c){var u="y"===c?"height":"width";switch(s){case lS:t[c]=t[c]-(n[u]/2-r[u]/2);break;case"end":t[c]=t[c]+(n[u]/2-r[u]/2)}}return t}function l_(){return{top:0,right:0,bottom:0,left:0}}function lV(e){return Object.assign({},l_(),e)}function lB(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}function lH(e,t){void 0===t&&(t={});var n,r,i,o,s,l,a,c,u=t,d=u.placement,h=void 0===d?e.placement:d,p=u.strategy,f=void 0===p?e.strategy:p,m=u.boundary,g=u.rootBoundary,y=u.elementContext,v=void 0===y?lT:y,b=u.altBoundary,w=u.padding,x=void 0===w?0:w,C=lV("number"!=typeof x?x:lB(x,lk)),k=e.rects.popper,S=e.elements[void 0!==b&&b?v===lT?"reference":lT:v],E=(n=s7(S)?S:S.contextElement||lu(e.elements.popper),r=void 0===m?"clippingParents":m,i=void 0===g?lE:g,a=(l=[].concat("clippingParents"===r?(o=lg(lm(n)),!s7(s=["absolute","fixed"].indexOf(lh(n).position)>=0&&le(n)?lv(n):n)?[]:o.filter(function(e){return s7(e)&&lN(e,s)&&"body"!==lc(e)})):[].concat(r),[i]))[0],(c=l.reduce(function(e,t){var r=lj(n,t,f);return e.top=ln(r.top,e.top),e.right=lr(r.right,e.right),e.bottom=lr(r.bottom,e.bottom),e.left=ln(r.left,e.left),e},lj(n,a,f))).width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c),T=ll(e.elements.reference),M=lL({reference:T,element:k,strategy:"absolute",placement:h}),O=lR(Object.assign({},k,M)),A=v===lT?O:T,N={top:E.top-A.top+C.top,bottom:A.bottom-E.bottom+C.bottom,left:E.left-A.left+C.left,right:A.right-E.right+C.right},R=e.modifiersData.offset;if(v===lT&&R){var j=R[h];Object.keys(N).forEach(function(e){var t=[lw,lb].indexOf(e)>=0?1:-1,n=["top",lb].indexOf(e)>=0?"y":"x";N[e]+=j[n]*t})}return N}var lF={placement:"bottom",modifiers:[],strategy:"absolute"};function lz(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}var l$={passive:!0},lW={top:"auto",right:"auto",bottom:"auto",left:"auto"};function lq(e){var t,n,r,i,o,s,l,a=e.popper,c=e.popperRect,u=e.placement,d=e.variation,h=e.offsets,p=e.position,f=e.gpuAcceleration,m=e.adaptive,g=e.roundOffsets,y=e.isFixed,v=h.x,b=void 0===v?0:v,w=h.y,x=void 0===w?0:w,C="function"==typeof g?g({x:b,y:x}):{x:b,y:x};b=C.x,x=C.y;var k=h.hasOwnProperty("x"),S=h.hasOwnProperty("y"),E=lx,T="top",M=window;if(m){var O=lv(a),A="clientHeight",N="clientWidth";O===s5(a)&&"static"!==lh(O=lu(a)).position&&"absolute"===p&&(A="scrollHeight",N="scrollWidth"),("top"===u||(u===lx||u===lw)&&"end"===d)&&(T=lb,x-=(y&&O===M&&M.visualViewport?M.visualViewport.height:O[A])-c.height,x*=f?1:-1),(u===lx||("top"===u||u===lb)&&"end"===d)&&(E=lw,b-=(y&&O===M&&M.visualViewport?M.visualViewport.width:O[N])-c.width,b*=f?1:-1)}var R=Object.assign({position:p},m&&lW),j=!0===g?(t={x:b,y:x},n=s5(a),r=t.x,i=t.y,{x:li(r*(o=n.devicePixelRatio||1))/o||0,y:li(i*o)/o||0}):{x:b,y:x};return(b=j.x,x=j.y,f)?Object.assign({},R,((l={})[T]=S?"0":"",l[E]=k?"0":"",l.transform=1>=(M.devicePixelRatio||1)?"translate("+b+"px, "+x+"px)":"translate3d("+b+"px, "+x+"px, 0)",l)):Object.assign({},R,((s={})[T]=S?x+"px":"",s[E]=k?b+"px":"",s.transform="",s))}
79let lU={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];le(i)&&lc(i)&&(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},o=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]="",e},{});le(r)&&lc(r)&&(Object.assign(r.style,o),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}},requires:["computeStyles"]};var lK={left:"right",right:"left",bottom:"top",top:"bottom"};function lJ(e){return e.replace(/left|right|bottom|top/g,function(e){return lK[e]})}var lZ={start:"end",end:"start"};function lG(e){return e.replace(/start|end/g,function(e){return lZ[e]})}function lY(e,t,n){return ln(e,lr(t,n))}function lX(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function lQ(e){return["top",lw,lb,lx].some(function(t){return e[t]>=0})}var l0=(rO=void 0===(rM=(rT={defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=void 0===i||i,s=r.resize,l=void 0===s||s,a=s5(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&c.forEach(function(e){e.addEventListener("scroll",n.update,l$)}),l&&a.addEventListener("resize",n.update,l$),function(){o&&c.forEach(function(e){e.removeEventListener("scroll",n.update,l$)}),l&&a.removeEventListener("resize",n.update,l$)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=lL({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=n.adaptive,o=n.roundOffsets,s=void 0===o||o,l={placement:lD(t.placement),variation:lI(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:void 0===r||r,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,lq(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:void 0===i||i,roundOffsets:s})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,lq(Object.assign({},l,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:s})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},lU,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=void 0===i?[0,0]:i,s=lO.reduce(function(e,n){var r,i,s,l,a,c;return e[n]=(r=t.rects,s=[lx,"top"].indexOf(i=lD(n))>=0?-1:1,a=(l="function"==typeof o?o(Object.assign({},r,{placement:n})):o)[0],c=l[1],a=a||0,c=(c||0)*s,[lx,lw].indexOf(i)>=0?{x:c,y:a}:{x:a,y:c}),e},{}),l=s[t.placement],a=l.x,c=l.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=a,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=s}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=void 0===i||i,s=n.altAxis,l=void 0===s||s,a=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,f=void 0===p||p,m=n.allowedAutoPlacements,g=t.options.placement,y=lD(g)===g,v=a||(y||!f?[lJ(g)]:function(e){if(lD(e)===lC)return[];var t=lJ(e);return[lG(e),t,lG(t)]}(g)),b=[g].concat(v).reduce(function(e,n){var r,i,o,s,l,a,h,p,g,y,v,b;return e.concat(lD(n)===lC?(i=(r={placement:n,boundary:u,rootBoundary:d,padding:c,flipVariations:f,allowedAutoPlacements:m}).placement,o=r.boundary,s=r.rootBoundary,l=r.padding,a=r.flipVariations,p=void 0===(h=r.allowedAutoPlacements)?lO:h,0===(v=(y=(g=lI(i))?a?lM:lM.filter(function(e){return lI(e)===g}):lk).filter(function(e){return p.indexOf(e)>=0})).length&&(v=y),Object.keys(b=v.reduce(function(e,n){return e[n]=lH(t,{placement:n,boundary:o,rootBoundary:s,padding:l})[lD(n)],e},{})).sort(function(e,t){return b[e]-b[t]})):n)},[]),w=t.rects.reference,x=t.rects.popper,C=new Map,k=!0,S=b[0],E=0;E<b.length;E++){var T=b[E],M=lD(T),O=lI(T)===lS,A=["top",lb].indexOf(M)>=0,N=A?"width":"height",R=lH(t,{placement:T,boundary:u,rootBoundary:d,altBoundary:h,padding:c}),j=A?O?lw:lx:O?lb:"top";w[N]>x[N]&&(j=lJ(j));var D=lJ(j),I=[];if(o&&I.push(R[M]<=0),l&&I.push(R[j]<=0,R[D]<=0),I.every(function(e){return e})){S=T,k=!1;break}C.set(T,I)}if(k)for(var P=f?3:1,L=function(e){var t=b.find(function(t){var n=C.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return S=t,"break"},_=P;_>0&&"break"!==L(_);_--);t.placement!==S&&(t.modifiersData[r]._skip=!0,t.placement=S,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=n.altAxis,s=n.boundary,l=n.rootBoundary,a=n.altBoundary,c=n.padding,u=n.tether,d=void 0===u||u,h=n.tetherOffset,p=void 0===h?0:h,f=lH(t,{boundary:s,rootBoundary:l,padding:c,altBoundary:a}),m=lD(t.placement),g=lI(t.placement),y=!g,v=lP(m),b="x"===v?"y":"x",w=t.modifiersData.popperOffsets,x=t.rects.reference,C=t.rects.popper,k="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,S="number"==typeof k?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,T={x:0,y:0};if(w){if(void 0===i||i){var M,O="y"===v?"top":lx,A="y"===v?lb:lw,N="y"===v?"height":"width",R=w[v],j=R+f[O],D=R-f[A],I=d?-C[N]/2:0,P=g===lS?x[N]:C[N],L=g===lS?-C[N]:-x[N],_=t.elements.arrow,V=d&&_?lf(_):{width:0,height:0},B=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:l_(),H=B[O],F=B[A],z=lY(0,x[N],V[N]),$=y?x[N]/2-I-z-H-S.mainAxis:P-z-H-S.mainAxis,W=y?-x[N]/2+I+z+F+S.mainAxis:L+z+F+S.mainAxis,q=t.elements.arrow&&lv(t.elements.arrow),U=q?"y"===v?q.clientTop||0:q.clientLeft||0:0,K=null!=(M=null==E?void 0:E[v])?M:0,J=lY(d?lr(j,R+$-K-U):j,R,d?ln(D,R+W-K):D);w[v]=J,T[v]=J-R}if(void 0!==o&&o){var Z,G,Y="x"===v?"top":lx,X="x"===v?lb:lw,Q=w[b],ee="y"===b?"height":"width",et=Q+f[Y],en=Q-f[X],er=-1!==["top",lx].indexOf(m),ei=null!=(G=null==E?void 0:E[b])?G:0,eo=er?et:Q-x[ee]-C[ee]-ei+S.altAxis,es=er?Q+x[ee]+C[ee]-ei-S.altAxis:en,el=d&&er?(Z=lY(eo,Q,es))>es?es:Z:lY(d?eo:et,Q,d?es:en);w[b]=el,T[b]=el-Q}t.modifiersData[r]=T}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,l=lD(n.placement),a=lP(l),c=[lx,lw].indexOf(l)>=0?"height":"width";if(o&&s){var u,d=(u=i.padding,lV("number"!=typeof(u="function"==typeof u?u(Object.assign({},n.rects,{placement:n.placement})):u)?u:lB(u,lk))),h=lf(o),p="y"===a?"top":lx,f="y"===a?lb:lw,m=n.rects.reference[c]+n.rects.reference[a]-s[a]-n.rects.popper[c],g=s[a]-n.rects.reference[a],y=lv(o),v=y?"y"===a?y.clientHeight||0:y.clientWidth||0:0,b=d[p],w=v-h[c]-d[f],x=v/2-h[c]/2+(m/2-g/2),C=lY(b,x,w);n.modifiersData[r]=((t={})[a]=C,t.centerOffset=C-x,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null==r||("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&lN(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.re
79cts.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,s=lH(t,{elementContext:"reference"}),l=lH(t,{altBoundary:!0}),a=lX(s,r),c=lX(l,i,o),u=lQ(a),d=lQ(c);t.modifiersData[n]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}]}).defaultModifiers)?[]:rM,rN=void 0===(rA=rT.defaultOptions)?lF:rA,function(e,t,n){void 0===n&&(n=rN);var r,i,o={placement:"bottom",orderedModifiers:[],options:Object.assign({},lF,rN),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},s=[],l=!1,a={state:o,setOptions:function(n){var r,i,l,u,d,h,p="function"==typeof n?n(o.options):n;c(),o.options=Object.assign({},rN,o.options,p),o.scrollParents={reference:s7(e)?lg(e):e.contextElement?lg(e.contextElement):[],popper:lg(t)};var f=(i=Object.keys(r=[].concat(rO,o.options.modifiers).reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{})).map(function(e){return r[e]}),l=new Map,u=new Set,d=[],i.forEach(function(e){l.set(e.name,e)}),i.forEach(function(e){u.has(e.name)||function e(t){u.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){if(!u.has(t)){var n=l.get(t);n&&e(n)}}),d.push(t)}(e)}),h=d,lA.reduce(function(e,t){return e.concat(h.filter(function(e){return e.phase===t}))},[]));return o.orderedModifiers=f.filter(function(e){return e.enabled}),o.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=e.effect;if("function"==typeof r){var i=r({state:o,name:t,instance:a,options:void 0===n?{}:n});s.push(i||function(){})}}),a.update()},forceUpdate:function(){if(!l){var e=o.elements,t=e.reference,n=e.popper;if(lz(t,n)){o.rects={reference:(r=lv(n),i="fixed"===o.options.strategy,s=le(r),h=le(r)&&(u=li((c=r.getBoundingClientRect()).width)/r.offsetWidth||1,d=li(c.height)/r.offsetHeight||1,1!==u||1!==d),p=lu(r),f=ll(t,h,i),m={scrollLeft:0,scrollTop:0},g={x:0,y:0},(s||!s&&!i)&&(("body"!==lc(r)||lp(p))&&(m=function(e){return e!==s5(e)&&le(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:la(e)}(r)),le(r)?(g=ll(r,!0),g.x+=r.clientLeft,g.y+=r.clientTop):p&&(g.x=ld(p))),{x:f.left+m.scrollLeft-g.x,y:f.top+m.scrollTop-g.y,width:f.width,height:f.height}),popper:lf(n)},o.reset=!1,o.placement=o.options.placement,o.orderedModifiers.forEach(function(e){return o.modifiersData[e.name]=Object.assign({},e.data)});for(var r,i,s,c,u,d,h,p,f,m,g,y=0;y<o.orderedModifiers.length;y++){if(!0===o.reset){o.reset=!1,y=-1;continue}var v=o.orderedModifiers[y],b=v.fn,w=v.options,x=void 0===w?{}:w,C=v.name;"function"==typeof b&&(o=b({state:o,options:x,name:C,instance:a})||o)}}}},update:(r=function(){return new Promise(function(e){a.forceUpdate(),e(o)})},function(){return i||(i=new Promise(function(e){Promise.resolve().then(function(){i=void 0,e(r())})})),i}),destroy:function(){c(),l=!0}};if(!lz(e,t))return a;function c(){s.forEach(function(e){return e()}),s=[]}return a.setOptions(n).then(function(e){!l&&n.onFirstUpdate&&n.onFirstUpdate(e)}),a}),l1="tippy-content",l2="tippy-arrow",l9="tippy-svg-arrow",l3={passive:!0,capture:!0},l4=function(){return document.body};function l6(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function l8(e,t){var n=({}).toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function l5(e,t){return"function"==typeof e?e.apply(void 0,t):e}function l7(e,t){var n;return 0===t?e:function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function ae(e){return[].concat(e)}function at(e,t){-1===e.indexOf(t)&&e.push(t)}function an(e){return[].slice.call(e)}function ar(e){return Object.keys(e).reduce(function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t},{})}function ai(){return document.createElement("div")}function ao(e){return["Element","Fragment"].some(function(t){return l8(e,t)})}function as(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}function al(e,t){e.forEach(function(e){e&&e.setAttribute("data-state",t)})}
79function aa(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(t){e[r](t,n)})}function ac(e,t){for(var n,r=t;r;){if(e.contains(r))return!0;r=null==r.getRootNode||null==(n=r.getRootNode())?void 0:n.host}return!1}var au={isTouch:!1},ad=0;function ah(){!au.isTouch&&(au.isTouch=!0,window.performance&&document.addEventListener("mousemove",ap))}function ap(){var e=performance.now();e-ad<20&&(au.isTouch=!1,document.removeEventListener("mousemove",ap)),ad=e}function af(){var e=document.activeElement;if(e&&e._tippy&&e._tippy.reference===e){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var am=!!("u">typeof window&&"u">typeof document)&&!!window.msCrypto,ag=Object.assign({appendTo:l4,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),ay=Object.keys(ag);function av(e){var t=(e.plugins||[]).reduce(function(t,n){var r,i=n.name,o=n.defaultValue;return i&&(t[i]=void 0!==e[i]?e[i]:null!=(r=ag[i])?r:o),t},{});return Object.assign({},e,t)}function ab(e,t){var n,r=Object.assign({},t,{content:l5(t.content,[e])},t.ignoreAttributes?{}:((n=t.plugins)?Object.keys(av(Object.assign({},ag,{plugins:n}))):ay).reduce(function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t},{}));return r.aria=Object.assign({},ag.aria,r.aria),r.aria={expanded:"auto"===r.aria.expanded?t.interactive:r.aria.expanded,content:"auto"===r.aria.content?t.interactive?null:"describedby":r.aria.content},r}function aw(e,t){e.innerHTML=t}function ax(e){var t=ai();return!0===e?t.className=l2:(t.className=l9,ao(e)?t.appendChild(e):aw(t,e)),t}function aC(e,t){ao(t.content)?(aw(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?aw(e,t.content):e.textContent=t.content)}function ak(e){var t=e.firstElementChild,n=an(t.children);return{box:t,content:n.find(function(e){return e.classList.contains(l1)}),arrow:n.find(function(e){return e.classList.contains(l2)||e.classList.contains(l9)}),backdrop:n.find(function(e){return e.classList.contains("tippy-backdrop")})}}function aS(e){var t=ai(),n=ai();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=ai();function i(n,r){var i=ak(t),o=i.box,s=i.content,l=i.arrow;r.theme?o.setAttribute("data-theme",r.theme):o.removeAttribute("data-theme"),"string"==typeof r.animation?o.setAttribute("data-animation",r.animation):o.removeAttribute("data-animation"),r.inertia?o.setAttribute("data-inertia",""):o.removeAttribute("data-inertia"),o.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?o.setAttribute("role",r.role):o.removeAttribute("role"),(n.content!==r.content||n.allowHTML!==r.allowHTML)&&aC(s,e.props),r.arrow?l?n.arrow!==r.arrow&&(o.removeChild(l),o.appendChild(ax(r.arrow))):o.appendChild(ax(r.arrow)):l&&o.removeChild(l)}return r.className=l1,r.setAttribute("data-state","hidden"),aC(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props),{popper:t,onUpdate:i}}aS.$$tippy=!0;var aE=1,aT=[],aM=[];function aO(e,t){void 0===t&&(t={});var n,r=ag.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",ah,l3),window.addEventListener("blur",af);var i=Object.assign({},t,{plugins:r}),o=(ao(n=e)?[n]:l8(n,"NodeList")?an(n):Array.isArray(n)?n:an(document.querySelectorAll(n))).reduce(function(e,t){var n=t&&function(e,t){var n,r,i,o,s,l,a,c,u=ab(e,Object.assign({},ag,av(ar(t)))),d=!1,h=!1,p=!1,f=!1,m=[],g=l7(q,u.interactiveDebounce),y=aE++,v=(n=u.plugins).filter(function(e,t){return n.indexOf(e)===t}),b={id:y,reference:e,popper:ai(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:v,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)},setProps:function(t){if(!b.state.isDestroyed){R("onBeforeUpdate",[b,t]),$();var n=b.props,r=ab(e,Object.assign({},n,ar(t),{ignoreAttributes:!0}));b.props=r,z(),n.interactiveDebounce!==r.interactiveDebounce&&(I(),g=l7(q,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?ae(n.triggerTarget).forEach(function(e){e.removeAttribute("aria-expanded")}):r.triggerTarget&&e.removeAttribute("aria-expanded"),D(),N(),C&&C(n,r),b.popperInstance&&(Z(),Y().forEac
79h(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})),R("onAfterUpdate",[b,t])}},setContent:function(e){b.setProps({content:e})},show:function(){var t=b.state.isVisible,n=b.state.isDestroyed,r=!b.state.isEnabled,i=au.isTouch&&!b.props.touch,o=l6(b.props.duration,0,ag.duration);if(!(t||n||r||i||(c||e).hasAttribute("disabled"))&&(R("onShow",[b],!1),!1!==b.props.onShow(b))){if(b.state.isVisible=!0,M()&&(x.style.visibility="visible"),N(),V(),b.state.isMounted||(x.style.transition="none"),M()){var s,l,u,d=ak(x);as([d.box,d.content],0)}a=function(){var e;if(b.state.isVisible&&!f){if(f=!0,x.offsetHeight,x.style.transition=b.props.moveTransition,M()&&b.props.animation){var t=ak(x),n=t.box,r=t.content;as([n,r],o),al([n,r],"visible")}j(),D(),at(aM,b),null==(e=b.popperInstance)||e.forceUpdate(),R("onMount",[b]),b.props.animation&&M()&&H(o,function(){b.state.isShown=!0,R("onShown",[b])})}},l=b.props.appendTo,u=c||e,(s=b.props.interactive&&l===l4||"parent"===l?u.parentNode:l5(l,[u])).contains(x)||s.appendChild(x),b.state.isMounted=!0,Z()}},hide:function(){var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=l6(b.props.duration,1,ag.duration);
79if(!e&&!t&&!n&&(R("onHide",[b],!1),!1!==b.props.onHide(b))){if(b.state.isVisible=!1,b.state.isShown=!1,f=!1,d=!1,M()&&(x.style.visibility="hidden"),I(),B(),N(!0),M()){var i,o=ak(x),s=o.box,l=o.content;b.props.animation&&(as([s,l],r),al([s,l],"hidden"))}(j(),D(),b.props.animation)?M()&&(i=b.unmount,H(r,function(){!b.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&i()})):b.unmount()}},hideWithInteractivity:function(e){O().addEventListener("mousemove",g),at(aT,g),g(e)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){b.state.isVisible&&b.hide(),b.state.isMounted&&(G(),Y().forEach(function(e){e._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),aM=aM.filter(function(e){return e!==b}),b.state.isMounted=!1,R("onHidden",[b]))},destroy:function(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),$(),delete e._tippy,b.state.isDestroyed=!0,R("onDestroy",[b]))}};if(!u.render)return b;var w=u.render(b),x=w.popper,C=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+b.id,b.popper=x,e._tippy=b,x._tippy=b;var k=v.map(function(e){return e.fn(b)}),S=e.hasAttribute("aria-expanded");return z(),D(),N(),R("onCreate",[b]),u.showOnCreate&&X(),x.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&O().addEventListener("mousemove",g)}),b;function E(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function T(){return"hold"===E()[0]}function M(){var e;return!!(null!=(e=b.props.render)&&e.$$tippy)}function O(){var t,n,r=(c||e).parentNode;return r&&null!=(n=ae(r)[0])&&null!=(t=n.ownerDocument)&&t.body?n.ownerDocument:document}function A(e){return b.state.isMounted&&!b.state.isVisible||au.isTouch||s&&"focus"===s.type?0:l6(b.props.delay,+!e,ag.delay)}function N(e){void 0===e&&(e=!1),x.style.pointerEvents=b.props.interactive&&!e?"":"none",x.style.zIndex=""+b.props.zIndex}function R(e,t,n){if(void 0===n&&(n=!0),k.forEach(function(n){n[e]&&n[e].apply(n,t)}),n){var r;(r=b.props)[e].apply(r,t)}}function j(){var t=b.props.aria;if(t.content){var n="aria-"+t.content,r=x.id;ae(b.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+" "+r:r);else{var i=t&&t.replace(r,"").trim();i?e.setAttribute(n,i):e.removeAttribute(n)}})}}function D(){!S&&b.props.aria.expanded&&ae(b.props.triggerTarget||e).forEach(function(t){b.props.interactive?t.setAttribute("aria-expanded",b.state.isVisible&&t===(c||e)?"true":"false"):t.removeAttribute("aria-expanded")})}function I(){O().removeEventListener("mousemove",g),aT=aT.filter(function(e){return e!==g})}function P(t){if(!au.isTouch||!p&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!(b.props.interactive&&ac(x,n))){if(ae(b.props.triggerTarget||e).some(function(e){return ac(e,n)})){if(au.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[b,t]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),h=!0,setTimeout(function(){h=!1}),b.state.isMounted||B())}}}function L(){p=!0}function _(){p=!1}function V(){var e=O();e.addEventListener("mousedown",P,!0),e.addEventListener("touchend",P,l3),e.addEventListener("touchstart",_,l3),e.addEventListener("touchmove",L,l3)}function B(){var e=O();e.removeEventListener("mousedown",P,!0),e.removeEventListener("touchend",P,l3),e.removeEventListener("touchstart",_,l3),e.removeEventListener("touchmove",L,l3)}function H(e,t){var n=ak(x).box;function r(e){e.target===n&&(aa(n,"remove",r),t())}if(0===e)return t();aa(n,"remove",l),aa(n,"add",r),l=r}function F(t,n,r){void 0===r&&(r=!1),ae(b.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),m.push({node:e,eventType:t,handler:n,options:r})})}function z(){T()&&(F("touchstart",W,{passive:!0}),F("touchend",U,{passive:!0})),b.props.trigger.split(/\s+/).filter(Boolean).forEach(function(e){if("manual"!==e)switch(F(e,W),e){case"mouseenter":F("mouseleave",U);break;
79case"focus":F(am?"focusout":"blur",K);break;case"focusin":F("focusout",K)}})}function $(){m.forEach(function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)}),m=[]}function W(e){var t,n=!1;if(!(!b.state.isEnabled||J(e))&&!h){var r=(null==(t=s)?void 0:t.type)==="focus";s=e,c=e.currentTarget,D(),!b.state.isVisible&&l8(e,"MouseEvent")&&aT.forEach(function(t){return t(e)}),"click"===e.type&&(0>b.props.trigger.indexOf("mouseenter")||d)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:X(e),"click"===e.type&&(d=!n),n&&!r&&Q(e)}}function q(t){var n,r,i,o=t.target,s=(c||e).contains(o)||x.contains(o);("mousemove"!==t.type||!s)&&(n=Y().concat(x).map(function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:u}:null}).filter(Boolean),r=t.clientX,i=t.clientY,n.every(function(e){var t=e.popperRect,n=e.popperState,o=e.props.interactiveBorder,s=n.placement.split("-")[0],l=n.modifiersData.offset;if(!l)return!0;var a="bottom"===s?l.top.y:0,c="top"===s?l.bottom.y:0,u="right"===s?l.left.x:0,d="left"===s?l.right.x:0,h=t.top-i+a>o,p=i-t.bottom-c>o,f=t.left-r+u>o,m=r-t.right-d>o;return h||p||f||m})&&(I(),Q(t)))}function U(e){if(!(J(e)||b.props.trigger.indexOf("click")>=0&&d)){if(b.props.interactive)return void b.hideWithInteractivity(e);Q(e)}}function K(t){0>b.props.trigger.indexOf("focusin")&&t.target!==(c||e)||b.props.interactive&&t.relatedTarget&&x.contains(t.relatedTarget)||Q(t)}function J(e){return!!au.isTouch&&T()!==e.type.indexOf("touch")>=0}function Z(){G();var t=b.props,n=t.popperOptions,r=t.placement,i=t.offset,o=t.getReferenceClientRect,s=t.moveTransition,l=M()?ak(x).arrow:null,u=o?{getBoundingClientRect:o,contextElement:o.contextElement||c||e}:e,d=[{name:"offset",options:{offset:i}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(M()){var n=ak(x).box;["placement","reference-hidden","escaped"].forEach(function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)}),t.attributes.popper={}}}}];M()&&l&&d.push({name:"arrow",options:{element:l,padding:3}}),d.push.apply(d,(null==n?void 0:n.modifiers)||[]),b.popperInstance=l0(u,x,Object.assign({},n,{placement:r,onFirstUpdate:a,modifiers:d}))}function G(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Y(){return an(x.querySelectorAll("[data-tippy-root]"))}function X(e){b.clearDelayTimeouts(),e&&R("onTrigger",[b,e]),V();var t=A(!0),n=E(),i=n[0],o=n[1];au.isTouch&&"hold"===i&&o&&(t=o),t?r=setTimeout(function(){b.show()},t):b.show()}function Q(e){if(b.clearDelayTimeouts(),R("onUntrigger",[b,e]),!b.state.isVisible)return void B();if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0)||!d){var t=A(!1);t?i=setTimeout(function(){b.state.isVisible&&b.hide()},t):o=requestAnimationFrame(function(){b.hide()})}}}(t,i);return n&&e.push(n),e},[]);return ao(e)?o[0]:o}aO.defaultProps=ag,aO.setDefaultProps=function(e){Object.keys(e).forEach(function(t){ag[t]=e[t]})},aO.currentInput=au,Object.assign({},lU,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),aO.setDefaultProps({render:aS});class aA{constructor({editor:e,element:t,view:n,tippyOptions:r={},updateDelay:i=250,shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:o}=t,{empty:s}=o,l=!i.textBetween(n,r).length&&iz(t.selection),a=this.element.contains(document.activeElement);return!!(e.hasFocus()||a)&&!s&&!l&&!!this.editor.isEditable},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;if(this.preventHide){this.preventHide=!1;return}(null==e?void 0:e.relatedTarget)&&(null==(t=this.element.parentNode)?void 0:t.contains(e.relatedTarget))||(null==e?void 0:e.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=e=>{this.blurHandler({event:e})},this.handleDebouncedUpdate=(e,t)=>
79{let n=!(null==t?void 0:t.selection.eq(e.state.selection)),r=!(null==t?void 0:t.doc.eq(e.state.doc));(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{var i,o,s;let{state:l,composing:a}=e,{selection:c}=l;if(a||!t&&!n)return;this.createTooltip();let{ranges:u}=c,d=Math.min(...u.map(e=>e.$from.pos)),h=Math.max(...u.map(e=>e.$to.pos));(null==(i=this.shouldShow)?void 0:i.call(this,{editor:this.editor,element:this.element,view:e,state:l,oldState:r,from:d,to:h}))?(null==(o=this.tippy)||o.setProps({getReferenceClientRect:(null==(s=this.tippyOptions)?void 0:s.getReferenceClientRect)||(()=>{if(or(l.selection)){let t=e.nodeDOM(d);if(t){let e=t.dataset.nodeViewWrapper?t:t.querySelector("[data-node-view-wrapper]");if(e&&(t=e.firstChild),t)return t.getBoundingClientRect()}}return oi(e,d,h)})}),this.show()):this.hide()},this.editor=e,this.element=t,this.view=n,this.updateDelay=i,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:e}=this.editor.options,t=!!e.parentElement;this.element.tabIndex=0,!this.tippy&&t&&(this.tippy=aO(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r)return void this.handleDebouncedUpdate(e,t);let i=!(null==t?void 0:t.selection.eq(e.state.selection)),o=!(null==t?void 0:t.doc.eq(e.state.doc));this.updateHandler(e,i,o,t)}show(){var e;null==(e=this.tippy)||e.show()}hide(){var e;null==(e=this.tippy)||e.hide()}destroy(){var e,t;(null==(e=this.tippy)?void 0:e.popper.firstChild)&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),null==(t=this.tippy)||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}let aN=e=>new e0({key:"string"==typeof e.pluginKey?new e9(e.pluginKey):e.pluginKey,view:t=>new aA({view:t,...e})});iD.create({name:"bubbleMenu",addOptions:()=>({element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}),addProseMirrorPlugins(){return this.options.element?[aN({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});var aR=e.i(389959),aj=e.i(971131);class aD{getTextContent(e){return i4(e,{textSerializers:iP(this.editor.schema)})}constructor({editor:e,element:t,view:n,tippyOptions:r={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,o=1===r.depth,s=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&0===r.parent.childCount&&!this.getTextContent(r.parent);return!!e.hasFocus()&&!!i&&!!o&&!!s&&!!this.editor.isEditable},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;if(this.preventHide){this.preventHide=!1;return}(null==e?void 0:e.relatedTarget)&&(null==(t=this.element.parentNode)?void 0:t.contains(e.relatedTarget))||(null==e?void 0:e.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=e=>{this.blurHandler({event:e})},this.editor=e,this.element=t,this.view=n,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:e}=this.editor.options,t=!!e.parentElement;this.element.tabIndex=0,!this.tippy&&t&&(this.tippy=aO(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){var n,r,i;let{state:o}=e,{doc:s,selection:l}=o,{from:a,to:c}=l;t&&t.doc.eq(s)&&t.selection.eq(l)||((this.createTooltip(),null==(n=this.shouldShow)?void 0:n.call(this,{editor:this.editor,view:e,state:o,oldState:t}))?(null==(r=this.tippy)||r.setProps({getReferenceClientRect:(null==(i=this.tippyOptions)?void 0:i.getReferenceClientRect)||(()=>oi(e,a,c))}),this.show()):this.hide())}show(){var e;null==(e=this.tippy)||e.show()}hide(){var e;null==(e=this.tippy)||e.hide()}destroy(){var e,t;(null==(e=this.tippy)?void 0:e.popper.firstChild)&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),null==(t=this.tippy)||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}iD.create({name:"floatingMenu",addOptions:()=>({element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}),addProseMirrorPlugins(){let e;return this.options.element?[new e0({key:"string"==typeof(e={pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow}).pluginKey?new e9(e.pluginKey):e.pluginKey,view:t=>new aD({view:t,...e})})]:[]}});
79var aI={exports:{}},aP={};aI.exports=function(){if(rj)return aP;rj=1;var e=aR.default,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,r=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function s(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var l="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var l=t(),a=n({inst:{value:l,getSnapshot:t}}),c=a[0].inst,u=a[1];return i(function(){c.value=l,c.getSnapshot=t,s(c)&&u({inst:c})},[e,l,t]),r(function(){return s(c)&&u({inst:c}),e(function(){s(c)&&u({inst:c})})},[e]),o(l),l};return aP.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,aP}();var aL=aI.exports;let a_=({contentComponent:e})=>{let t=aL.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return aR.default.createElement(aR.default.Fragment,null,Object.values(t))};class aV extends aR.default.Component{constructor(e){var t;super(e),this.editorContentRef=aR.default.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(null==(t=e.editor)?void 0:t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){let t,n;if(e.contentComponent)return;let r=this.editorContentRef.current;r.append(...e.options.element.childNodes),e.setOptions({element:r}),t=new Set,n={},e.contentComponent={subscribe:e=>(t.add(e),()=>{t.delete(e)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(e,r){n={...n,[e]:aj.default.createPortal(r.reactElement,r.element,e)},t.forEach(e=>e())},removeRenderer(e){let r={...n};delete r[e],n=r,t.forEach(e=>e())}},this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){let e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;let t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){let{editor:e,innerRef:t,...n}=this.props;return aR.default.createElement(aR.default.Fragment,null,aR.default.createElement("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&aR.default.createElement(a_,{contentComponent:e.contentComponent}))}}let aB=(0,aR.forwardRef)((e,t)=>{let n=aR.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return aR.default.createElement(aV,{key:n,innerRef:t,...e})}),aH=aR.default.memo(aB);var aF=(rR=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var r,i,o,s=o[i];if(("_owner"!==s||!t.$$typeof)&&!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n}).__esModule&&Object.prototype.hasOwnProperty.call(rR,"default")?rR.default:rR,az={exports:{}},a$={};az.exports=function(){if(rD)return a$;rD=1;var e=aR.default,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=aL.useSyncExternalStore,r=e.useRef,i=e.useEffect,o=e.useMemo,s=e.useDebugValue;return a$.useSyncExternalStoreWithSelector=function(e,l,a,c,u){var d=r(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;var p=n(e,(d=o(function(){function e(e){if(!i){if(i=!0,n=e,e=c(e),void 0!==u&&h.hasValue){var o=h.value;if(u(o,e))return r=o}return r=e}if(o=r,t(n,e))return o;var s=c(e);return void 0!==u&&u(o,s)?o:(n=e,r=s)}var n,r,i=!1,o=void 0===a?null:a;return[function(){return e(l())},null===o?void 0:function(){return e(o())}]},[l,a,c,u]))[0],d[1]);return i(function(){h.hasValue=!0,h.value=p},[p]),s(p),p},a$}();var aW=az.exports;let aq="u">typeof window?aR.useLayoutEffect:aR.useEffect;class aU{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0}
79,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)}}}}function aK(e){var t;let[n]=(0,aR.useState)(()=>new aU(e.editor)),r=aW.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:aF);return aq(()=>n.watch(e.editor),[e.editor,n]),(0,aR.useDebugValue)(r),r}let aJ="u"<typeof window,aZ=aJ||!!("u">typeof window&&window.next);class aG{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(){return void 0===this.options.current.immediatelyRender?aJ||aZ?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender)?this.createEditor():null}createEditor(){return new ow({...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.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(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===e.length?aG.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){
79if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))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)}}let aY=(0,aR.createContext)({editor:null});aY.Consumer;let aX=(0,aR.createContext)({onDragStart:void 0});aR.default.forwardRef((e,t)=>{let{onDragStart:n}=(0,aR.useContext)(aX),r=e.as||"div";return aR.default.createElement(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})}),e.s(["BubbleMenu",0,e=>{let[t,n]=(0,aR.useState)(null),{editor:r}=(0,aR.useContext)(aY);return(0,aR.useEffect)(()=>{var n;if(!t||(null==(n=e.editor)?void 0:n.isDestroyed)||(null==r?void 0:r.isDestroyed))return;let{pluginKey:i="bubbleMenu",editor:o,tippyOptions:s={},updateDelay:l,shouldShow:a=null}=e,c=o||r;if(!c)return void console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");let u=aN({updateDelay:l,editor:c,element:t,pluginKey:i,shouldShow:a,tippyOptions:s});return c.registerPlugin(u),()=>{c.unregisterPlugin(i)}},[e.editor,r,t]),aR.default.createElement("div",{ref:n,className:e.className,style:{visibility:"hidden"}},e.children)},"EditorContent",0,aH,"useEditor",0,function(e={},t=[]){let n=(0,aR.useRef)(e);n.current=e;let[r]=(0,aR.useState)(()=>new aG(n)),i=aL.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,aR.useDebugValue)(i),(0,aR.useEffect)(r.onRender(t)),aK({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i},"useEditorState",0,aK],932451);let aQ=/^\s*>\s$/,a0=oE.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",im(this.options.HTMLAttributes,e),0]},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()}}
79,addInputRules(){return[oS({find:aQ,type:this.type})]}}),a1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,a2=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,a9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,a3=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,a4=iA.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["strong",im(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ox({find:a1,type:this.type}),ox({find:a9,type:this.t
79ype})]},addPasteRules(){return[oT({find:a2,type:this.type}),oT({find:a3,type:this.type})]}}),a6="textStyle",a8=/^\s*([-+*])\s$/,a5=oE.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",im(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(a6)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=oS({find:a8,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oS({find:a8,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(a6),editor:this.editor})),[e]}}),a7=/(^|[^`])`([^`]+)`(?!`)/,ce=/(^|[^`])`([^`]+)`(?!`)/g,ct=iA.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",im(this.options.HTMLAttributes,e),0]},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()}}
79,addInputRules(){return[ox({find:a7,type:this.type})]},addPasteRules(){return[oT({find:ce,type:this.type})]}}),cn=/^```([a-z]+)?[\s\n]$/,cr=/^~~~([a-z]+)?[\s\n]$/,ci=oE.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options,r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",im(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!n||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!!o&&!!s&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let s=i.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(eL.near(r.resolve(s))),!0)):e.commands.exitCode())}}}
79,addInputRules(){return[ok({find:cn,type:this.type,getAttributes:e=>({language:e[1]})}),ok({find:cr,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new e0({key:new e9("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=null==i?void 0:i.mode;if(!n||!o)return!1;let{tr:s,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(eH.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),co=oE.create({name:"doc",topNode:!0,content:"block+"});class cs{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}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,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),o=e?r.bottom:r.top;e&&t&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*a;i={left:r.left,right:r.right,top:o-s,bottom:o+s}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*l;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let c=this.editorView.dom.offsetParent;if(!this.element&&(this.element=c.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",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),c&&(c!=document.body||"static"!=getComputedStyle(c).position)){let n=c.getBoundingClientRect(),r=n.width/c.offsetWidth,i=n.height/c.offsetHeight;e=n.left-c.scrollLeft*r,t=n.top-c.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/l+"px",this.element.style.top=(i.top-t)/a+"px",this.element.style.width=(i.right-i.left)/l+"px",this.element.style.height=(i.bottom-i.top)/a+"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}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=eC(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)}}let cl=iD.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new e0({view:t=>new cs(t,e)})}(this.options)]}});class ca extends eL{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return ca.valid(n)?new ca(n):eL.near(n)}content(){return a.empty}eq(e){return e instanceof ca&&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 ca(e.resolve(t.pos))}getBookmark(){return new cc(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||cu(e.type))return!0;
79if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||cu(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){r:for(;;){if(!n&&ca.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(ca.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!ez.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue r}break}i=o,r+=t;let s=e.doc.resolve(r);if(ca.valid(s))return s}return null}}}ca.prototype.visible=!1,ca.findFrom=ca.findGapCursorFrom,eL.jsonID("gapcursor",ca);class cc{constructor(e){this.pos=e}map(e){return new cc(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ca.valid(t)?new ca(t):eL.near(t)}}function cu(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let cd=r$({ArrowLeft:ch("horiz",-1),ArrowRight:ch("horiz",1),ArrowUp:ch("vert",-1),ArrowDown:ch("vert",1)});function ch(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,l=o.empty;if(o instanceof eH){if(!i.endOfTextblock(n)||0==s.depth)return!1;l=!1,s=e.doc.resolve(t>0?s.after():s.before())}let a=ca.findGapCursorFrom(s,t,l);return!!a&&(r&&r(e.tr.setSelection(new ca(a))),!0)}}function cp(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!ca.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&ez.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new ca(r))),!0)}function cf(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof ca))return!1;let{$from:r}=e.state.selection,i=r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);if(!i)return!1;let o=n.empty;for(let e=i.length-1;e>=0;e--)o=n.from(i[e].createAndFill(null,o));let s=e.state.tr.replace(r.pos,r.pos,new a(o,0,0));return s.setSelection(eH.near(s.doc.resolve(r.pos+1))),e.dispatch(s),!1}function cm(e){if(!(e.selection instanceof ca))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",n8.create(e.doc,[n3.widget(e.selection.head,t,{key:"gapcursor"})])}let cg=iD.create({name:"gapCursor",addProseMirrorPlugins:()=>[new e0({props:{decorations:cm,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&ca.valid(n)?new ca(n):null,handleClick:cp,handleKeyDown:cd,handleDOMEvents:{beforeinput
79:cf}}})],extendNodeSchema(e){var t;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=iv(iu(e,"allowGapCursor",n)))?t:null}}}),cy=oE.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",im(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:s}=r.extensionManager,l=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&l&&o){let t=l.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),cv=oE.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 n=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${n}`,im(this.options.HTMLAttributes,t),0]},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=>ok({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}}
79)\\s$`),type:this.type,getAttributes:{level:e}}))}});var cb=function(){};cb.prototype.append=function(e){return e.length?(e=cb.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},cb.prototype.prepend=function(e){return e.length?cb.from(e).append(this):this},cb.prototype.appendInner=function(e){return new cx(this,e)},cb.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?cb.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},cb.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},cb.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},cb.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},cb.from=function(e){return e instanceof cb?e:e&&e.length?new cw(e):cb.empty};var cw=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 n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+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))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(cb);cb.empty=new cw([]);var cx=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.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,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,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}(cb);class cC{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}t&&(r=(n=this.remapping(s,this.items.length)).maps.length);let l=e.tr,a=[],c=[];return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(s,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new ck(e.map));let t=e.step.map(n.slice(r)),i;t&&l.maybeStep(t).doc&&(i=l.mapping.maps[l.mapping.maps.length-1],a.push(new ck(i,void 0,void 0,a.length+c.length))),r--,i&&n.appendMap(i,r)}else l.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new cC(this.items.slice(0,s).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:l,selection:i}}addTransform(e,t,n,r){var i,o;let s,l=[],a=this.eventCount,c=this.items,u=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),o=new ck(e.mapping.maps[n],i,t),s;(s=u&&u.merge(o))&&(o=s,n?l.pop():c=c.slice(0,c.length-1)),l.push(o),t&&(a++,t=void 0),r||(u=
79o)}let d=a-n.depth;return d>cE&&(i=c,o=d,i.forEach((e,t)=>{if(e.selection&&0==o--)return s=t,!1}),c=i.slice(s),a-=d),new cC(c.append(l),a)}remapping(e,t){let n=new ee;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new cC(this.items.append(e.map(e=>new ck(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let l=t;this.items.forEach(t=>{let r=i.getMirror(--l);if(null==r)return;o=Math.min(o,r);let a=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(l+1,r));c&&s++,n.push(new ck(a,o,c))}else n.push(new ck(a))},r);let a=[];for(let e=t;e<o;e++)a.push(new ck(i.maps[e]));let c=new cC(this.items.slice(0,r).append(a).append(n),s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=o.selection&&o.selection.map(t.slice(n));l&&i++;let a=new ck(s.invert(),e,l),c,u=r.length-1;(c=r.length&&r[u].merge(a))?r[u]=c:r.push(a)}}else o.map&&n--},this.items.length,0),new cC(cb.from(r.reverse()),i)}}cC.empty=new cC(cb.empty,0);class ck{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ck(t.getMap().invert(),t,this.selection)}}}class cS{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let cE=20;function cT(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function cM(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let cO=!1,cA=null;function cN(e){let t=e.plugins;if(cA!=t){cO=!1,cA=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){cO=!0;break}}return cO}let cR=new e9("history"),cj=new e9("closeHistory");function cD(e,t){return(n,r)=>{let i=cR.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=cN(t),i=cR.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),a=new cS(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(cR,{redo:n,historyState:a})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let cI=cD(!1,!0),cP=cD(!0,!0);cD(!1,!1),cD(!0,!1);let cL=iD.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>cI(e,t),redo:()=>({state:e,dispatch:t})=>cP(e,t)}),addProseMirrorPlugins(){return[function(e={}){return new e0({key:cR,state:{init:()=>new cS(cC.empty,cC.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(cR),o;if(i)return i.historyState;n.getMeta(cj)&&(e=new cS(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(cR))if(s.getMeta(cR).redo)return new cS(e.done.addTransform(n,void 0,r,cN(t)),e.undone,cT(n.mapping.maps),e.prevTime,e.prevComposition);else return new cS(e.done,e.undone.addTransform(n,void 0,r,cN(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new cS(e.done.rebased(n,o),e.undone.rebased(n,o),cM(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new cS(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),cM(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;
79return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),l=s?cM(e.prevRanges,n.mapping):cT(n.mapping.maps);return new cS(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,cN(t)),cC.empty,l,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?cI:"historyRedo"==n?cP:null;return!!r&&!!e.editable&&(t.preventDefault(),r(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()}}}),c_=oE.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",im(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!oM(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$from:r,$to:i}=n,o=e();return 0===r.parentOffset?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):or(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:e,dispatch:t})=>{var n;if(t){let{$to:t}=e.selection,r=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(eH.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(ez.create(e.doc,t.pos)):e.setSelection(eH.create(e.doc,t.pos));else{let i=null==(n=t.parent.type.contentMatch.defaultType)?void 0:n.create();i&&(e.insert(r,i),e.setSelection(eH.create(e.doc,r+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[oC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
79ype})]}}),cV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,cB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,cH=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,cF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,cz=iA.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",im(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ox({find:cV,type:this.type}),ox({find:cH,type:this.type})]},addPasteRules(){return[oT({find:cB,type:this.type}),oT({find:cF,type:this.type})]}}),c$=oE.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",im(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),cW="textStyle",cq=/^(\d+)\.\s$/,cU=oE.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=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return 1===t?["ol",im(this.options.HTMLAttributes,n),0]:["ol",im(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(cW)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=oS({find:cq,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oS({find:cq,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(cW)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),cK=oE.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",im(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cJ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,cZ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,cG=iA.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",im(this.options.HTMLAttributes,e),0]},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[ox({find:cJ,type:this.type})]}
79,addPasteRules(){return[oT({find:cZ,type:this.type})]}}),cY=oE.create({name:"text",group:"inline"}),cX=iD.create({name:"starterKit",addExtensions(){let e=[];return!1!==this.options.bold&&e.push(a4.configure(this.options.bold)),!1!==this.options.blockquote&&e.push(a0.configure(this.options.blockquote)),!1!==this.options.bulletList&&e.push(a5.configure(this.options.bulletList)),!1!==this.options.code&&e.push(ct.configure(this.options.code)),!1!==this.options.codeBlock&&e.push(ci.configure(this.options.codeBlock)),!1!==this.options.document&&e.push(co.configure(this.options.document)),!1!==this.options.dropcursor&&e.push(cl.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&e.push(cg.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&e.push(cy.configure(this.options.hardBreak)),!1!==this.options.heading&&e.push(cv.configure(this.options.heading)),!1!==this.options.history&&e.push(cL.configure(this.options.history)),!1!==this.options.horizontalRule&&e.push(c_.configure(this.options.horizontalRule)),!1!==this.options.italic&&e.push(cz.configure(this.options.italic)),!1!==this.options.listItem&&e.push(c$.configure(this.options.listItem)),!1!==this.options.orderedList&&e.push(cU.configure(this.options.orderedList)),!1!==this.options.paragraph&&e.push(cK.configure(this.options.paragraph)),!1!==this.options.strike&&e.push(cG.configure(this.options.strike)),!1!==this.options.text&&e.push(cY.configure(this.options.text)),e}});e.s(["default",0,cX],458938)},655744,e=>{"use strict";var t=e.i(389959),n=e=>e instanceof Date,r=e=>null==e,i=e=>!r(e)&&!Array.isArray(e)&&"object"==typeof e&&!n(e),o=e=>i(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,s=(e,t)=>t.split(".").some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join("."))),l="u">typeof window&&void 0!==window.HTMLElement&&"u">typeof document;function a(e){let t;if(e instanceof Date)return new Date(e);let n="u">typeof FileList&&e instanceof FileList;if(l&&(e instanceof Blob||n))return e;let r=Array.isArray(e);if(!r&&!(i(e)&&i(t=e.constructor&&e.constructor.prototype)&&t.hasOwnProperty("isPrototypeOf")))return e;let o=r?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(o[t]=a(e[t]));return o}var c=e=>void 0===e,u=e=>Array.isArray(e)?e.filter(Boolean):[],d=e=>u(e.replace(/["|']|\]/g,"").split(/\.|\[/)),h=(e,t,n)=>{if(!t||!i(e))return n;let o=(/^\w*$/.test(t)?[t]:d(t)).reduce((e,t)=>r(e)?e:e[t],e);return c(o)||o===e?c(e[t])?n:e[t]:o}
79,p=e=>"function"==typeof e,f=(e,t,n)=>{let r=-1,o=/^\w*$/.test(t)?[t]:d(t),s=o.length,l=s-1;for(;++r<s;){let t=o[r],s=n;if(r!==l){let n=e[t];s=i(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};let m="blur",g="trigger",y="onChange",v="onSubmit",b="maxLength",w="minLength",x="pattern",C="required",k="validate",S="form",E="root",T=t.default.createContext(null);T.displayName="HookFormControlContext";var M=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let o in e)Object.defineProperty(i,o,{get:()=>("all"!==t._proxyFormState[o]&&(t._proxyFormState[o]=!r||"all"),n&&(n[o]=!0),e[o])});return i};let O="u">typeof window?t.default.useLayoutEffect:t.default.useEffect;var A=e=>"string"==typeof e,N=(e,t,n,r,i)=>A(e)?(r&&t.watch.add(e),h(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),h(n,e))):(r&&(t.watchAll=!0),n),R=e=>r(e)||"object"!=typeof e;function j(e,t,r=new WeakSet){if(R(e)||R(t))return Object.is(e,t);if(n(e)&&n(t))return Object.is(e.getTime(),t.getTime());let o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;for(let l of(r.add(e),r.add(t),o)){let o=e[l];if(!s.includes(l))return!1;if("ref"!==l){let e=t[l];if(n(o)&&n(e)||(i(o)||Array.isArray(o))&&(i(e)||Array.isArray(e))?!j(o,e,r):!Object.is(o,e))return!1}}return!0}let D=t.default.createContext(null);D.displayName="HookFormContext";var I=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},P=e=>Array.isArray(e)?e:[e],L=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},_=e=>i(e)&&!Object.keys(e).length,V=e=>{if(!l)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},B=e=>V(e)&&e.isConnected;function H(e,t){let n=Array.isArray(t)?t:/^\w*$/.test(t)?[t]:d(t),r=1===n.length?e:function(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=c(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1,s=n[o];return r&&delete r[s],0!==o&&(i(r)&&_(r)||Array.isArray(r)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!c(e[t]))return!1;return!0}(r))&&H(e,n.slice(0,-1)),e}function F(e){return Array.isArray(e)||i(e)&&!(e=>{for(let t in e)if(p(e[t]))return!0;return!1})(e)}function z(e,t={}){for(let n in e){let r=e[n];F(r)?(t[n]=Array.isArray(r)?[]:{},z(r,t[n])):c(r)||(t[n]=!0)}return t}function $(e,t,n){for(let i in n||(n=z(t)),e){let o=e[i];if(F(o))c(t)||R(n[i])?n[i]=z(o,Array.isArray(o)?[]:{}):$(o,r(t)?{}:t[i],n[i]);else{let e=t[i];n[i]=!j(o,e)}}return n}let W={value:!1,isValid:!1},q={value:!0,isValid:!0};var U=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!c(e[0].attributes.value)?c(e[0].value)||""===e[0].value?q:{value:e[0].value,isValid:!0}:q:W}return W},K=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>c(e)?e:t?""===e?NaN:e?+e:e:n&&A(e)?new Date(e):r?r(e):e;let J={isValid:!1,value:null};var Z=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,J):J;function G(e){let t=e.ref;return"file"===t.type?t.files:"radio"===t.type?Z(e.refs).value:"select-multiple"===t.type?[...t.selectedOptions].map(({value:e})=>e):"checkbox"===t.type?U(e.refs).value:K(c(t.value)?e.ref.value:t.value,e)}var Y=e=>c(e)?e:e instanceof RegExp?e.source:i(e)?e.value instanceof RegExp?e.value.source:e.value:e,X=e=>({isOnSubmit:!e||e===v,isOnBlur:"onBlur"===e,isOnChange:e===y,isOnAll:"all"===e,isOnTouch:"onTouched"===e});let Q="AsyncFunction";var ee=e=>!!e&&!!e.validate&&!!(p(e.validate)&&e.validate.constructor.name===Q||i(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Q)),et=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let en=(e,t,n,r)=>{for(let o of n||Object.keys(e)){let n=h(e,o);if(n){let{_f:e,...s}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],o)&&!r)return!0;else if(e.ref&&t(e.ref,e.name)&&!r)return!0;else if(en(s,t))break}else if(i(s)&&en(s,t))break}}};function er(e,t,n){let r=h(e,n);if(r||/^\w*$/.test(n))return{error:r,name:n};let i=n.split(".");for(;i.length;){let r=i.join("."),o=h(t,r),s=h(e,r);if(o&&!Array.isArray(o)&&n!==r)break;
79if(s&&s.type)return{name:r,error:s};if(s&&s.root&&s.root.type)return{name:`${r}.root`,error:s.root};i.pop()}return{name:n}}var ei=(e,t,n)=>{let r=P(h(e,n));return f(r,E,t[n]),f(e,n,r),e};function eo(e,t,n="validate"){if(A(e)||Array.isArray(e)&&e.every(A)||"boolean"==typeof e&&!e)return{type:n,message:A(e)?e:"",ref:t}}var es=e=>!i(e)||e instanceof RegExp?{value:e,message:""}:e,el=async(e,t,n,o,s,l)=>{let{ref:a,refs:u,required:d,maxLength:f,minLength:m,min:g,max:y,pattern:v,validate:S,name:E,valueAsNumber:T,mount:M}=e._f,O=h(n,E);if(!M||t.has(E))return{};let N=u?u[0]:a,R=e=>{s&&N.reportValidity&&(N.setCustomValidity("boolean"==typeof e?"":e||""),N.reportValidity())},j={},D="radio"===a.type,P="checkbox"===a.type,L=(T||"file"===a.type)&&c(a.value)&&c(O)||V(a)&&""===a.value||""===O||Array.isArray(O)&&!O.length,B=I.bind(null,E,o,j),H=(e,t,n,r=b,i=w)=>{let o=e?t:n;j[E]={type:e?r:i,message:o,ref:a,...B(e?r:i,o)}};if(l?!Array.isArray(O)||!O.length:d&&(!(D||P)&&(L||r(O))||"boolean"==typeof O&&!O||P&&!U(u).isValid||D&&!Z(u).isValid)){let{value:e,message:t}=A(d)?{value:!!d,message:d}:es(d);if(e&&(j[E]={type:C,message:t,ref:N,...B(C,t)},!o))return R(t),j}if(!L&&(!r(g)||!r(y))){let e,t,n=es(y),i=es(g);if(r(O)||isNaN(O)){let r=a.valueAsDate||new Date(O),o=e=>new Date(new Date().toDateString()+" "+e),s="time"==a.type,l="week"==a.type;A(n.value)&&O&&(e=s?o(O)>o(n.value):l?O>n.value:r>new Date(n.value)),A(i.value)&&O&&(t=s?o(O)<o(i.value):l?O<i.value:r<new Date(i.value))}else{let o=a.valueAsNumber||(O?+O:O);r(n.value)||(e=o>n.value),r(i.value)||(t=o<i.value)}if((e||t)&&(H(!!e,n.message,i.message,"max","min"),!o))return R(j[E].message),j}if((f||m)&&!L&&(A(O)||l&&Array.isArray(O))){let e=es(f),t=es(m),n=!r(e.value)&&O.length>+e.value,i=!r(t.value)&&O.length<+t.value;if((n||i)&&(H(n,e.message,t.message),!o))return R(j[E].message),j}if(v&&!L&&A(O)){let{value:e,message:t}=es(v);if(e instanceof RegExp&&!O.match(e)&&(j[E]={type:x,message:t,ref:a,...B(x,t)},!o))return R(t),j}if(S){if(p(S)){let e=eo(await S(O,n),N);if(e&&(j[E]={...e,...B(k,e.message)},!o))return R(e.message),j}else if(i(S)){let e={};for(let t in S){if(!_(e)&&!o)break;let r=eo(await S[t](O,n),N,t);r&&(e={...r,...B(t,r.message)},R(r.message),o&&(j[E]=e))}if(!_(e)&&(j[E]={ref:N,...e},!o))return j}}return R(!0),j};let ea={mode:v,reValidateMode:y,shouldFocusError:!0};var ec=()=>{if("u">typeof crypto&&crypto.randomUUID)return crypto.randomUUID();let e="u"<typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let n=(16*Math.random()+e)%16|0;return("x"==t?n:3&n|8).toString(16)})},eu=(e,t,n={})=>n.shouldFocus||c(n.shouldFocus)?n.focusName||`${e}.${c(n.focusIndex)?t:n.focusIndex}.`:"",ed=(e,t)=>[...e,...P(t)],eh=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function ep(e,t,n){return[...e.slice(0,t),...P(n),...e.slice(t)]}var ef=(e,t,n)=>Array.isArray(e)?(c(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],em=(e,t)=>[...P(t),...P(e)],eg=(e,t)=>c(t)?[]:function(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return u(r).length?r:[]}(e,P(t).sort((e,t)=>e-t)),ey=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},ev=(e,t,n)=>(e[t]=n,e);e.s(["Controller",0,e=>e.render(function(e){let n=t.default.useContext(T),{name:r,disabled:i,control:l=n,shouldUnregister:u,defaultValue:d,exact:g=!0}=e,y=s(l._names.array,r),v=t.default.useMemo(()=>h(l._formValues,r,h(l._defaultValues,r,d)),[l,r,d]),b=function(e){let n=t.default.useContext(T),{control:r=n,name:i,defaultValue:o,disabled:s,exact:l,compute:a}=e||{},c=t.default.useRef(o),u=t.default.useRef(a),d=t.default.useRef(void 0),h=t.default.useRef(r),p=t.default.useRef(i);u.current=a;let[f,m]=t.default.useState(()=>{let e=r._getWatch(i,c.current);return u.current?u.current(e):e}),g=t.default.useCallback(e=>{let t=N(i,r._names,e||r._formValues,!1,c.current);return u.current?u.current(t):t},[r._formValues,r._names,i]),y=t.default.useCallback(e=>{if(!s){let t=N(i,r._names,e||r._formValues,!1,c.current);if(u.current){let e=u.current(t);j(e,d.current)||(m(e),d.current=e)}else m(t)}},[r._formValues,r._names,s,i]);O(()=>(h.current===r&&j(p.current,i)||(h.current=r,p.current=i,y()),r._subscribe({name:i,formState:{values:!0},exact:l,callback:e=>{y(e.values)}})),[r,l,i,y]),t.default.useEffect(()=>r._removeUnmounted());let v=h.current!==r,b=p.current,w=t.default.useMemo(()=>
79{if(s)return null;let e=!v&&!j(b,i);return v||e?g():null},[s,v,i,b,g]);return null!==w?w:f}({control:l,name:r,defaultValue:v,exact:g}),w=function(e){let n=t.default.useContext(T),{control:r=n,disabled:i,name:o,exact:s}=e||{},[l,a]=t.default.useState(r._formState),c=t.default.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return O(()=>r._subscribe({name:o,formState:c.current,exact:s,callback:e=>{i||a({...r._formState,...e})}}),[o,i,s]),t.default.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),t.default.useMemo(()=>M(l,r,c.current,!1),[l,r])}({control:l,name:r,exact:g}),x=t.default.useRef(e),C=t.default.useRef(void 0),k=t.default.useRef(l.register(r,{...e.rules,value:b,..."boolean"==typeof e.disabled?{disabled:e.disabled}:{}}));x.current=e;let S=t.default.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!h(w.errors,r)},isDirty:{enumerable:!0,get:()=>!!h(w.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!h(w.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!h(w.validatingFields,r)},error:{enumerable:!0,get:()=>h(w.errors,r)}}),[w,r]),E=t.default.useCallback(e=>k.current.onChange({target:{value:o(e),name:r},type:"change"}),[r]),A=t.default.useCallback(()=>k.current.onBlur({target:{value:h(l._formValues,r),name:r},type:m}),[r,l._formValues]),R=t.default.useCallback(e=>{let t=h(l._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>p(e.focus)&&e.focus(),select:()=>p(e.select)&&e.select(),setCustomValidity:t=>p(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>p(e.reportValidity)&&e.reportValidity()})},[l._fields,r]),D=t.default.useMemo(()=>({name:r,value:b,..."boolean"==typeof i||w.disabled?{disabled:w.disabled||i}:{},onChange:E,onBlur:A,ref:R}),[r,i,w.disabled,E,A,R,b]);return t.default.useEffect(()=>{let e=l._options.shouldUnregister||u,t=C.current;t&&t!==r&&!y&&l.unregister(t),l.register(r,{...x.current.rules,..."boolean"==typeof x.current.disabled?{disabled:x.current.disabled}:{}});let n=(e,t)=>{let n=h(l._fields,e);n&&n._f&&(n._f.mount=t)};if(n(r,!0),e){let e=a(h(l._options.defaultValues,r,x.current.defaultValue));f(l._defaultValues,r,e),c(h(l._formValues,r))&&f(l._formValues,r,e)}return y||l.register(r),C.current=r,()=>{(y?e&&!l._state.action:e)?l.unregister(r):n(r,!1)}},[r,l,y,u]),t.default.useEffect(()=>{l._setDisabledField({disabled:i,name:r})},[i,r,l]),t.default.useMemo(()=>({field:D,formState:w,fieldState:S}),[D,w,S])}(e)),"get",0,h,"useFieldArray",0,function(e){let n=t.default.useContext(T),{control:r=n,name:i,keyName:o="id",shouldUnregister:s,rules:l}=e,[c,u]=t.default.useState(r._getFieldArray(i)),d=t.default.useRef(r._getFieldArray(i).map(ec)),p=t.default.useRef(!1);r._names.array.add(i),t.default.useMemo(()=>l&&c.length>=0&&r.register(i,l),[r,i,c.length,l]),O(()=>r._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===i||!t){let t=h(e,i);Array.isArray(t)&&(u(t),d.current=t.map(ec))}}}).unsubscribe,[r,i]);let m=t.default.useCallback(e=>{p.current=!0,r._setFieldArray(i,e)},[r,i]);return t.default.useEffect(()=>{if(r._state.action=!1,et(i,r._names)&&r._subjects.state.next({...r._formState}),p.current&&(!X(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!X(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([i]).then(e=>{r._updateIsValidating([i]);let t=h(e.errors,i),n=h(r._formState.errors,i);(n?!t&&n.type||t&&(n.type!==t.type||n.message!==t.message):t&&t.type)&&(t?f(r._formState.errors,i,t):H(r._formState.errors,i),r._subjects.state.next({errors:r._formState.errors}))});else{let e=h(r._fields,i);e&&e._f&&!(X(r._options.reValidateMode).isOnSubmit&&X(r._options.mode).isOnSubmit)&&el(e,r._names.disabled,r._formValues,"all"===r._options.criteriaMode,r._options.shouldUseNativeValidation,!0).then(e=>!_(e)&&r._subjects.state.next({errors:ei(r._formState.errors,e,i)}))}r._subjects.state.next({name:i,values:a(r._formValues)}),r._names.focus&&en(r._fields,(e,t)=>{if(r._names.focus&&t.startsWith(r._names.focus)&&e.focus)return e.focus(),1}),r._names.focus="",r._setValid(),p.current=!1},[c,i,r]),t.default.useEffect(()=>(h(r._formValues,i)||r._setFieldArray(i),()=>{let e;r._options.shouldUnregister||s?r.unregister(i):(e=h(r._fields,i))&&e._f&&(e._f.mount=!1)}),[i,r,o,s]),{swap:t.default.useCallback((e,t)=>{let n=r._getFieldArray(i);ey(n,e,t),ey(d.current,e,t),m(n),u(n),r._setFieldArray(i,n,ey,{argA:e,argB:t},!1)},[m,i,r]),move:t.default.useCallback((e,t)=>{let n=r._getFieldArray(i);ef(n,e,t),ef(d.current,e,t),m(n),u(n),r._setFieldArray(i,n,ef,{argA:e,argB:t},!1)},[m,i,r]),prepend:t.default.useCallback((e,t)=>{let n=P(a(e)),o=em(r._getFieldArray(i),n);r._names.focus=eu(i,0,t),d.current=em(d.current,n.map(ec)),m(o),u(o),r._setFieldArray(i,o,em,{argA:eh(e)})},[m,i,r]),append:t.default.useCallback((e,t)=>{let n=P(a(e)),o=ed(r._getFieldArray(i),n);r._names.focus=eu(i,o.length-1,t),d.current=ed(d.current,n.map(ec)),m(o),u(o),r._setFieldArray(i,o,ed,{argA:eh(e)})},[m,i,r]),remove:t.default.useCallback(e=>{let t=eg(r._getFieldArray(i),e);d.current=eg(d.current,e),m(t),u(t),Array.isArray(h(r._fields,i))||f(r._fields,i,void 0),r._setFieldArray(i,t,eg,{argA:e})},[m,i,r]),insert:t.default.useCallback((e,t,n)=>{let o=P(a(t)),s=ep(r._getFieldArray(i),e,o);
79r._names.focus=eu(i,e,n),d.current=ep(d.current,e,o.map(ec)),m(s),u(s),r._setFieldArray(i,s,ep,{argA:e,argB:eh(t)})},[m,i,r]),update:t.default.useCallback((e,t)=>{let n=a(t),o=ev(r._getFieldArray(i),e,n);d.current=[...o].map((t,n)=>t&&n!==e?d.current[n]:ec()),m(o),u([...o]),r._setFieldArray(i,o,ev,{argA:e,argB:n},!0,!1)},[m,i,r]),replace:t.default.useCallback(e=>{let t=P(a(e));d.current=t.map(ec),m([...t]),u([...t]),r._setFieldArray(i,[...t],e=>e,{},!0,!1)},[m,i,r]),fields:t.default.useMemo(()=>c.map((e,t)=>({...e,[o]:d.current[t]||ec()})),[c,o])}},"useForm",0,function(e={}){let d=t.default.useRef(void 0),y=t.default.useRef(void 0),[v,b]=t.default.useState({isDirty:!1,isValidating:!1,isLoading:p(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:p(e.defaultValues)?void 0:e.defaultValues});if(!d.current)if(e.formControl)d.current={...e.formControl,formState:v},e.defaultValues&&!p(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:t,...y}=function(e={}){let t,d={...ea,...e},y={submitCount:0,isDirty:!1,isReady:!1,isLoading:p(d.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:d.errors||{},disabled:d.disabled||!1},v={},b=(i(d.defaultValues)||i(d.values))&&a(d.defaultValues||d.values)||{},w=d.shouldUnregister?{}:a(b),x={action:!1,mount:!1,watch:!1,keepIsValid:!1},C={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},T=0,M={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},O={...M},R={...O},D={array:L(),state:L()},I="all"===d.criteriaMode,F=async e=>{if(!x.keepIsValid&&!d.disabled&&(O.isValid||R.isValid||e)){let e;d.resolver?(e=_((await J()).errors),z()):e=await eo({fields:v,onlyCheckValid:!0,eventType:"valid"}),e!==y.isValid&&D.state.next({isValid:e})}},z=(e,t)=>{!d.disabled&&(O.isValidating||O.validatingFields||R.isValidating||R.validatingFields)&&((e||Array.from(C.mount)).forEach(e=>{e&&(t?f(y.validatingFields,e,t):H(y.validatingFields,e))}),D.state.next({validatingFields:y.validatingFields,isValidating:!_(y.validatingFields)}))},W=e=>{let t=$(b,w),n=e.substring(0,e.search(/\.\d+(\.|$)/))||e;f(y.dirtyFields,n,h(t,n))},q=(e,t,n,r)=>{let i=h(v,e);if(i){let o=h(w,e,c(n)?h(b,e):n);c(o)||r&&r.defaultChecked||t?f(w,e,t?o:G(i._f)):eu(e,o),x.mount&&!x.action&&F()}},U=(e,t,n,r,i)=>{let o=!1,s=!1,l={name:e};if(!d.disabled){if(!n||r){(O.isDirty||R.isDirty)&&(s=y.isDirty,y.isDirty=l.isDirty=es(),o=s!==l.isDirty);let n=j(h(b,e),t);s=!!h(y.dirtyFields,e),n?H(y.dirtyFields,e):f(y.dirtyFields,e,!0),l.dirtyFields=y.dirtyFields,o=o||(O.dirtyFields||R.dirtyFields)&&!n!==s}if(n){let t=h(y.touchedFields,e);t||(f(y.touchedFields,e,n),l.touchedFields=y.touchedFields,o=o||(O.touchedFields||R.touchedFields)&&t!==n)}o&&i&&D.state.next(l)}return o?l:{}},J=async e=>(z(e,!0),await d.resolver(w,d.context,((e,t,n,r)=>{let i={};for(let n of e){let e=h(t,n);e&&f(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||C.mount,v,d.criteriaMode,d.shouldUseNativeValidation))),Z=async e=>{let{errors:t}=await J(e);if(z(e),e)for(let n of e){let e=h(t,n);e?f(y.errors,n,e):H(y.errors,n)}else y.errors=t;return t},Q=async({name:t,eventType:n})=>{if(e.validate){let r=await e.validate({formValues:w,formState:y,name:t,eventType:n});if(i(r))for(let e in r)r[e]&&eb(`${S}.${e}`,{message:A(r.message)?r.message:"",type:k});else A(r)||!r?eb(S,{message:r||"",type:k}):ev(S);return r}return!0},eo=async({fields:t,onlyCheckValid:n,name:r,eventType:i,context:o={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(o.runRootValidation=!0,!await Q({name:r,eventType:i}))&&(o.valid=!1,n))return o.valid;for(let r in t){let s=t[r];if(s){let{_f:t,...l}=s;if(t){let r=C.array.has(t.name),i=s._f&&ee(s._f);i&&O.validatingFields&&z([t.name],!0);let l=await el(s,C.disabled,w,I,d.shouldUseNativeValidation&&!n,r);if(i&&O.validatingFields&&z([t.name]),l[t.name]&&(o.valid=!1,n)||
79(n||(h(l,t.name)?r?ei(y.errors,l,t.name):f(y.errors,t.name,l[t.name]):H(y.errors,t.name)),e.shouldUseNativeValidation&&l[t.name]))break}_(l)||await eo({context:o,onlyCheckValid:n,fields:l,name:r,eventType:i})}}return o.valid},es=(e,t)=>!d.disabled&&(e&&t&&f(w,e,t),!j(eg(),b)),ec=(e,t,n)=>N(e,C,{...x.mount?w:c(t)?b:A(e)?{[e]:t}:t},n,t),eu=(e,t,n={})=>{let i=h(v,e),o=t;if(i){let n=i._f;n&&(n.disabled||f(w,e,K(t,n)),o=V(n.ref)&&r(t)?"":t,"select-multiple"===n.ref.type?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?"checkbox"===n.ref.type?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):"file"===n.ref.type?n.ref.value="":(n.ref.value=o,n.ref.type||D.state.next({name:e,values:a(w)})))}(n.shouldDirty||n.shouldTouch)&&U(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&em(e)},ed=(e,t,r)=>{for(let o in t){if(!t.hasOwnProperty(o))return;let s=t[o],l=e+"."+o,a=h(v,l);(C.array.has(e)||i(s)||a&&!a._f)&&!n(s)?ed(l,s,r):eu(l,s,r)}},eh=(e,t,n={})=>{let i=h(v,e),o=C.array.has(e),s=a(t);f(w,e,s),o?(D.array.next({name:e,values:a(w)}),(O.isDirty||O.dirtyFields||R.isDirty||R.dirtyFields)&&n.shouldDirty&&(W(e),D.state.next({name:e,dirtyFields:y.dirtyFields,isDirty:es(e,s)}))):!i||i._f||r(s)?eu(e,s,n):ed(e,s,n),et(e,C)?D.state.next({...y,name:e,values:a(w)}):D.state.next({name:x.mount?e:void 0,values:a(w)})},ep=async r=>{x.mount=!0;
79let i=r.target,s=i.name,l=!0,c=h(v,s),u=e=>{l=Number.isNaN(e)||n(e)&&isNaN(e.getTime())||j(e,h(w,s,e))},p=X(d.mode),g=X(d.reValidateMode);if(c){var b,k,S,E,M;let n,x,L,V=i.type?G(c._f):o(r),B=r.type===m||"focusout"===r.type,$=!((L=c._f).mount&&(L.required||L.min||L.max||L.maxLength||L.minLength||L.pattern||L.validate))&&!e.validate&&!d.resolver&&!h(y.errors,s)&&!c._f.deps||(b=B,k=h(y.touchedFields,s),S=y.isSubmitted,E=g,!(M=p).isOnAll&&(!S&&M.isOnTouch?!(k||b):(S?E.isOnBlur:M.isOnBlur)?!b:(S?!E.isOnChange:!M.isOnChange)||b)),W=et(s,C,B);f(w,s,V),B?i&&i.readOnly||(c._f.onBlur&&c._f.onBlur(r),t&&t(0)):c._f.onChange&&c._f.onChange(r);let q=U(s,V,B),K=!_(q)||W;if(B||D.state.next({name:s,type:r.type,values:a(w)}),$)return(O.isValid||R.isValid)&&("onBlur"===d.mode?B&&F():B||F()),K&&D.state.next({name:s,...W?{}:q});if(!d.resolver&&e.validate&&await Q({name:s,eventType:r.type}),!B&&W&&D.state.next({...y}),d.resolver){let{errors:e}=await J([s]);if(z([s]),u(V),l){let t=er(y.errors,v,s),r=er(e,v,t.name||s);n=r.error,s=r.name,x=_(e)}}else z([s],!0),n=(await el(c,C.disabled,w,I,d.shouldUseNativeValidation))[s],z([s]),u(V),l&&(n?x=!1:(O.isValid||R.isValid)&&(x=await eo({fields:v,onlyCheckValid:!0,name:s,eventType:r.type})));if(l){c._f.deps&&(!Array.isArray(c._f.deps)||c._f.deps.length>0)&&em(c._f.deps);var A=s,N=x,P=n;let e=h(y.errors,A),r=(O.isValid||R.isValid)&&"boolean"==typeof N&&y.isValid!==N;if(d.delayError&&P){let e;e=()=>{f(y.errors,A,P),D.state.next({errors:y.errors})},(t=t=>{clearTimeout(T),T=setTimeout(e,t)})(d.delayError)}else clearTimeout(T),t=null,P?f(y.errors,A,P):H(y.errors,A);if((P?!j(e,P):e)||!_(q)||r){let e={...q,...r&&"boolean"==typeof N?{isValid:N}:{},errors:y.errors,name:A};y={...y,...e},D.state.next(e)}}}},ef=(e,t)=>{if(h(y.errors,t)&&e.focus)return e.focus(),1},em=async(e,t={})=>{let n,r,i=P(e);if(d.resolver){let t=await Z(c(e)?e:i);n=_(t),r=e?!i.some(e=>h(t,e)):n}else e?((r=(await Promise.all(i.map(async e=>{let t=h(v,e);return await eo({fields:t&&t._f?{[e]:t}:t,eventType:g})}))).every(Boolean))||y.isValid)&&F():r=n=await eo({fields:v,name:e,eventType:g});return D.state.next({...!A(e)||(O.isValid||R.isValid)&&n!==y.isValid?{}:{name:e},...d.resolver||!e?{isValid:n}:{},errors:y.errors}),t.shouldFocus&&!r&&en(v,ef,e?i:C.mount),r},eg=(e,t)=>{let n={...x.mount?w:b};return t&&(n=function e(t,n){let r={};for(let o in t)if(t.hasOwnProperty(o)){let s=t[o],l=n[o];if(s&&i(s)&&l){let t=e(s,l);i(t)&&(r[o]=t)}else t[o]&&(r[o]=l)}return r}(t.dirtyFields?y.dirtyFields:y.touchedFields,n)),c(e)?n:A(e)?h(n,e):e.map(e=>h(n,e))},ey=(e,t)=>({invalid:!!h((t||y).errors,e),isDirty:!!h((t||y).dirtyFields,e),error:h((t||y).errors,e),isValidating:!!h(y.validatingFields,e),isTouched:!!h((t||y).touchedFields,e)}),ev=e=>{let t=e?P(e):void 0;null==t||t.forEach(e=>H(y.errors,e)),t?t.forEach(e=>{D.state.next({name:e,errors:y.errors})}):D.state.next({errors:{}})},eb=(e,t,n)=>{let r=(h(v,e,{_f:{}})._f||{}).ref,{ref:i,message:o,type:s,...l}=h(y.errors,e)||{};f(y.errors,e,{...l,...t,ref:r}),D.state.next({name:e,errors:y.errors,isValid:!1}),n&&n.shouldFocus&&r&&r.focus&&r.focus()},ew=e=>D.state.subscribe({next:t=>{let n,r,i;n=e.name,r=t.name,i=e.exact,(!n||!r||n===r||P(n).some(e=>e&&(i?e===r:e.startsWith(r)||r.startsWith(e))))&&((e,t,n,r)=>{n(e);let{name:i,...o}=e;return _(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!r||"all"))})(t,e.formState||O,eO,e.reRenderRoot)&&e.callback({values:{...w},...y,...t,defaultValues:b})}}).unsubscribe,ex=(e,t={})=>{for(let n of e?P(e):C.mount)C.mount.delete(n),C.array.delete(n),t.keepValue||(H(v,n),H(w,n)),t.keepError||H(y.errors,n),t.keepDirty||H(y.dirtyFields,n),t.keepTouched||H(y.touchedFields,n),t.keepIsValidating||H(y.validatingFields,n),d.shouldUnregister||t.keepDefaultValue||H(b,n);D.state.next({values:a(w)}),D.state.next({...y,...!t.keepDirty?{}:{isDirty:es()}}),t.keepIsValid||F()},eC=({disabled:e,name:t})=>{if("boolean"==typeof e&&x.mount||e||C.disabled.has(t)){let n=C.disabled.has(t);e?C.disabled.add(t):C.disabled.delete(t),!!e!==n&&x.mount&&!x.action&&F()}},ek=(e,t={})=>{let n=h(v,e),r="boolean"==typeof t.disabled||"boolean"==typeof d.disabled,i=!C.registerName.has(e)&&n&&!n._f.mount;return(f(v,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}
79),C.mount.add(e),n&&!i)?eC({disabled:"boolean"==typeof t.disabled?t.disabled:d.disabled,name:e}):q(e,!0,t.value),{...r?{disabled:t.disabled||d.disabled}:{},...d.progressive?{required:!!t.required,min:Y(t.min),max:Y(t.max),minLength:Y(t.minLength),maxLength:Y(t.maxLength),pattern:Y(t.pattern)}:{},name:e,onChange:ep,onBlur:ep,ref:r=>{if(r){let i;C.registerName.add(e),ek(e,t),C.registerName.delete(e),n=h(v,e);let o=c(r.value)&&r.querySelectorAll&&r.querySelectorAll("input,select,textarea")[0]||r,s="radio"===(i=o).type||"checkbox"===i.type,l=n._f.refs||[];(s?l.find(e=>e===o):o===n._f.ref)||(f(v,e,{_f:{...n._f,...s?{refs:[...l.filter(B),o,...Array.isArray(h(b,e))?[{}]:[]],ref:{type:o.type,name:e}}:{ref:o}}}),q(e,!1,void 0,o))}else(n=h(v,e,{}))._f&&(n._f.mount=!1),(d.shouldUnregister||t.shouldUnregister)&&!(s(C.array,e)&&x.action)&&C.unMount.add(e)}}},eS=()=>d.shouldFocusError&&en(v,ef,C.mount),eE=(e,t)=>async n=>{let r;n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist());let i=a(w);if(D.state.next({isSubmitting:!0}),d.resolver){let{errors:e,values:t}=await J();z(),y.errors=e,i=a(t)}else await eo({fields:v,eventType:"submit"});if(C.disabled.size)for(let e of C.disabled)H(i,e);if(H(y.errors,E),_(y.errors)){D.state.next({errors:{}});try{await e(i,n)}catch(e){r=e}}else t&&await t({...y.errors},n),eS(),setTimeout(eS);if(D.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:_(y.errors)&&!r,submitCount:y.submitCount+1,errors:y.errors}),r)throw r},eT=(e,t={})=>{let n=e?a(e):b,r=a(n),i=_(e),o=i?b:r;if(t.keepDefaultValues||(b=n),!t.keepValues){if(t.keepDirtyValues)for(let e of Array.from(new Set([...C.mount,...Object.keys($(b,w))]))){let t=h(y.dirtyFields,e),n=h(w,e),r=h(o,e);t&&!c(n)?f(o,e,n):t||c(r)||eh(e,r)}else{if(l&&c(e))for(let e of C.mount){let t=h(v,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(V(e)){let t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(let e of C.mount)eh(e,h(o,e));else v={}}w=d.shouldUnregister?t.keepDefaultValues?a(b):{}:a(o),D.array.next({values:{...o}}),D.state.next({values:{...o}})}C={mount:t.keepDirtyValues?C.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},x.mount=!O.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!d.shouldUnregister&&!_(o),x.watch=!!d.shouldUnregister,x.keepIsValid=!!t.keepIsValid,x.action=!1,t.keepErrors||(y.errors={}),D.state.next({submitCount:t.keepSubmitCount?y.submitCount:0,isDirty:!i&&(t.keepDirty?y.isDirty:!!(t.keepDefaultValues&&!j(e,b))),isSubmitted:!!t.keepIsSubmitted&&y.isSubmitted,dirtyFields:i?{}:t.keepDirtyValues?t.keepDefaultValues&&w?$(b,w):y.dirtyFields:t.keepDefaultValues&&e?$(b,e):t.keepDirty?y.dirtyFields:{},touchedFields:t.keepTouched?y.touchedFields:{},errors:t.keepErrors?y.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&y.isSubmitSuccessful,isSubmitting:!1,defaultValues:b})},eM=(e,t)=>eT(p(e)?e(w):e,{...d.resetOptions,...t}),eO=e=>{y={...y,...e}},eA={control:{register:ek,unregister:ex,getFieldState:ey,handleSubmit:eE,setError:eb,_subscribe:ew,_runSchema:J,_updateIsValidating:z,_focusError:eS,_getWatch:ec,_getDirty:es,_setValid:F,_setFieldArray:(e,t=[],n,r,i=!0,o=!0)=>{if(r&&n&&!d.disabled){if(x.action=!0,o&&Array.isArray(h(v,e))){let t=n(h(v,e),r.argA,r.argB);i&&f(v,e,t)}if(o&&Array.isArray(h(y.errors,e))){let t,o=n(h(y.errors,e),r.argA,r.argB);i&&f(y.errors,e,o),u(h(t=y.errors,e)).length||H(t,e)}if((O.touchedFields||R.touchedFields)&&o&&Array.isArray(h(y.touchedFields,e))){let t=n(h(y.touchedFields,e),r.argA,r.argB);i&&f(y.touchedFields,e,t)}(O.dirtyFields||R.dirtyFields)&&W(e),D.state.next({name:e,isDirty:es(e,t),dirtyFields:y.dirtyFields,errors:y.errors,isValid:y.isValid})}else f(w,e,t)},_setDisabledField:eC,_setErrors:e=>{y.errors=e,D.state.next({errors:y.errors,isValid:!1})},_getFieldArray:e=>u(h(x.mount?w:b,e,d.shouldUnregister?h(b,e,[]):[])),_reset:eT,_resetDefaultValues:()=>p(d.defaultValues)&&d.defaultValues().then(e=>{eM(e,d.resetOptions),D.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(let e of C.unMount){let t=h(v,e);t&&(t._f.refs?t._f.refs.every(e=>!B(e)):!B(t._f.ref))&&ex(e)}C.unMount=new Set},_disableForm:e=>{"boolean"==typeof e&&(D.state.next({disabled:e}),en(v,(t,n)=>
79{let r=h(v,n);r&&(t.disabled=r._f.disabled||e,Array.isArray(r._f.refs)&&r._f.refs.forEach(t=>{t.disabled=r._f.disabled||e}))},0,!1))},_subjects:D,_proxyFormState:O,get _fields(){return v},get _formValues(){return w},get _state(){return x},set _state(value){x=value},get _defaultValues(){return b},get _names(){return C},set _names(value){C=value},get _formState(){return y},get _options(){return d},set _options(value){d={...d,...value}}},subscribe:e=>(x.mount=!0,R={...R,...e.formState},ew({...e,formState:{...M,...e.formState}})),trigger:em,register:ek,handleSubmit:eE,watch:(e,t)=>p(e)?D.state.subscribe({next:n=>"values"in n&&e(ec(void 0,t),n)}):ec(e,t,!0),setValue:eh,getValues:eg,reset:eM,resetField:(e,t={})=>{h(v,e)&&(c(t.defaultValue)?eh(e,a(h(b,e))):(eh(e,t.defaultValue),f(b,e,a(t.defaultValue))),t.keepTouched||H(y.touchedFields,e),t.keepDirty||(H(y.dirtyFields,e),y.isDirty=t.defaultValue?es(e,a(h(b,e))):es()),!t.keepError&&(H(y.errors,e),O.isValid&&F()),D.state.next({...y}))},clearErrors:ev,unregister:ex,setError:eb,setFocus:(e,t={})=>{let n=h(v,e),r=n&&n._f;if(r){let e=r.refs?r.refs[0]:r.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&p(e.select)&&e.select()})}},getFieldState:ey};return{...eA,formControl:eA}}(e);d.current={...y,formState:v}}let w=d.current.control;return w._options=e,O(()=>{let e=w._subscribe({formState:w._proxyFormState,callback:()=>b({...w._formState}),reRenderRoot:!0});return b(e=>({...e,isReady:!0})),w._formState.isReady=!0,e},[w]),t.default.useEffect(()=>w._disableForm(e.disabled),[w,e.disabled]),t.default.useEffect(()=>{e.mode&&(w._options.mode=e.mode),e.reValidateMode&&(w._options.reValidateMode=e.reValidateMode)},[w,e.mode,e.reValidateMode]),t.default.useEffect(()=>{e.errors&&(w._setErrors(e.errors),w._focusError())},[w,e.errors]),t.default.useEffect(()=>{e.shouldUnregister&&w._subjects.state.next({values:w._getWatch()})},[w,e.shouldUnregister]),t.default.useEffect(()=>{if(w._proxyFormState.isDirty){let e=w._getDirty();e!==v.isDirty&&w._subjects.state.next({isDirty:e})}},[w,v.isDirty]),t.default.useEffect(()=>{var t;e.values&&!j(e.values,y.current)?(w._reset(e.values,{keepFieldsRef:!0,...w._options.resetOptions}),(null==(t=w._options.resetOptions)?void 0:t.keepIsValid)||w._setValid(),y.current=e.values,b(e=>({...e}))):w._resetDefaultValues()},[w,e.values]),t.default.useEffect(()=>{w._state.mount||(w._setValid(),w._state.mount=!0),w._state.watch&&(w._state.watch=!1,w._subjects.state.next({...w._formState})),w._removeUnmounted()}),d.current.formState=t.default.useMemo(()=>M(v,w),[w,v]),d.current},"useFormContext",0,()=>t.default.useContext(D)])},576164,e=>{"use strict";var t=e.i(389959);function n(e){let t=new Date(e);if(!Number.isNaN(t.valueOf()))return t;let n=String(e).match(/\d+/g);if(null==n||n.length<=2)return t;{let[e,t,...r]=n.map(e=>parseInt(e));return new Date(Date.UTC(e,t-1,...r))}}let r=(e,t,n)=>e+" "+(1!==e?t+"s":t)+" "+n;function i(){return(i=Object.assign.bind()).apply(null,arguments)}let o=()=>Date.now();e.s(["default",0,function({date:e,formatter:s,component:l="time",live:a=!0,minPeriod:c=0,maxPeriod:u=604800,title:d,now:h=o,...p}){let f,[m,g]=(0,t.useState)(h());(0,t.useEffect)(()=>{if(!a)return;let t=(()=>{let t=n(e).valueOf();if(!t)return console.warn("[react-timeago] Invalid Date provided"),0;let r=Math.round(Math.abs(m-t)/1e3),i=Math.min(Math.max(r<60?1e3:r<3600?6e4:r<86400?36e5:6048e5,1e3*c),1e3*u);return i?setTimeout(()=>{g(h())},i):0})();return()=>{t&&clearTimeout(t)}},[e,a,u,c,h,m]),(0,t.useEffect)(()=>{g(h())},[e]);let y=n(e).valueOf();if(!y)return null;let v=Math.round(Math.abs(m-y)/1e3),b=y<m?"ago":"from now",[w,x]=v<60?[Math.round(v),"second"]:v<3600?[Math.round(v/60),"minute"]:v<86400?[Math.round(v/3600),"hour"]:v<604800?[Math.round(v/86400),"day"]:v<2592e3?[Math.round(v/604800),"week"]:v<31536e3?[Math.round(v/2592e3),"month"]:[Math.round(v/31536e3),"year"],C=void 0===d?"string"==typeof e?e:n(e).toISOString().substring(0,16).replace("T"," "):d,k="time"===l?{...p,dateTime:n(e).toISOString()}:p,S=(e=e,t=t,n=n,i=y,o=r,s=s)=>r(e,t,n);try{(f=(s||r)(w,x,b,y,S,h))||(f=r(w,x,b))}catch(e){console.error("[react-timeago] Formatter threw an error:",e),f=r(w,x,b)}return t.createElement(l,i({},k,{title:C}),f)}],576164)},82224,(e,t,n)=>{"use strict";var r=e.r(389959),i=e.r(623921),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,l=r.useRef,a=r.useEffect,c=r.useMemo,u=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=l(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;var p=s(e,(d=c(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),void 0!==i&&h.hasValue){var t=h.value;if(i(t,e))return l=t}return l=e}if(t=l,o(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,l=n)}var s,l,a=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]))[0],d[1]);return a(function(){h.hasValue=!0,h.value=p},[p]),u(p),p}},114095,(e,t,n)=>{"use strict";
79t.exports=e.r(82224)},465149,e=>{"use strict";var t,n,r=e.i(389959),i=e.i(478902);let o=((t={}).FanPost="FanPost",t.QuickPost="QuickPost",t.Unknown="Unknown",t),s=((n={}).HomepageWidget="HomepageWidget",n.List="List",n.FanPostEntry="FanPostEntry",n.ArticleBody="ArticleBody",n.Unknown="Unknown",n),l=(0,r.createContext)({location:s.Unknown});e.s(["ContentLocation",0,s,"ContentLocationProvider",0,({children:e,...t})=>(0,i.jsx)(l.Provider,{value:t,children:e}),"ContentObjectType",0,o,"useContentLocationContext",0,()=>{let e=(0,r.useContext)(l);if(!e)throw Error("useContentLocationContext must be used within a ContentLocationProvider");let t=(0,r.useMemo)(()=>{let t=new Map;switch(e.location){case s.HomepageWidget:t.set(o.FanPost,{truncated:!0,showObjectActions:!1,canReply:!1,dropshadow:!1,numBodyClampLines:2,contentColumnGap:"small",feedPadding:!1,showPinned:!1,showHoverStyles:!1,showStaffBadgeText:!1,showActionsHoverStyles:!1,showShareButton:!1,canRec:!1,showXIconInCompactAttachment:!1});break;case s.List:t.set(o.FanPost,{truncated:!0,showObjectActions:!0,showShareButton:!0,canReply:!1,dropshadow:!1,numBodyClampLines:4,contentColumnGap:"large",feedPadding:!0,showPinned:!0,showHoverStyles:!0,showStaffBadgeText:!0,showActionsHoverStyles:!0,canRec:!0,showXIconInCompactAttachment:!0});break;case s.FanPostEntry:t.set(o.FanPost,{truncated:!1,showObjectActions:!0,showShareButton:!0,canReply:!1,dropshadow:!0,numBodyClampLines:2,contentColumnGap:"small",feedPadding:!1,showPinned:!1,showHoverStyles:!1,showStaffBadgeText:!0,showActionsHoverStyles:!0,canRec:!0,showXIconInCompactAttachment:!0}),t.set(o.QuickPost,{truncated:!1,showObjectActions:!0,showShareButton:!0,canReply:!0,dropshadow:!1,numBodyClampLines:2,contentColumnGap:"small",feedPadding:!1,showPinned:!1,showHoverStyles:!1,showStaffBadgeText:!0,showActionsHoverStyles:!0,canRec:!0,showXIconInCompactAttachment:!0});break;case s.ArticleBody:t.set(o.QuickPost,{truncated:!1,showObjectActions:!0,showShareButton:!0,canReply:!0,dropshadow:!1,numBodyClampLines:2,contentColumnGap:"small",feedPadding:!1,showPinned:!1,showHoverStyles:!1,showStaffBadgeText:!0,showActionsHoverStyles:!0,canRec:!0,showXIconInCompactAttachment:!0})}return t},[e.location]);return{context:(0,r.useContext)(l),compositionSet:t,getComposition:e=>t.has(e)?t.get(e):t.get("default")}}])},948335,e=>{"use strict";var t=e.i(645904),n=e.i(722010);let r=[{type:n.AttachmentType.Youtube,pattern:/(https?:\/\/)?(www\.|m\.)?(youtube\.com\/(watch\?v=[-_a-zA-Z0-9]{1,12}|shorts\/[-_a-zA-Z0-9]{1,12}|live\/[-_a-zA-Z0-9]{1,12})|youtu\.be\/[-_a-zA-Z0-9]{1,12})/g},{type:n.AttachmentType.Twitter,pattern:/(https?:\/\/)?(www\.|mobile\.)?(twitter\.com\/[a-zA-z0-9]+\/status\/[0-9]+)/g},{type:n.AttachmentType.Twitter,pattern:/(https?:\/\/)?(www\.|mobile\.)?(x\.com\/[a-zA-z0-9]+\/status\/[0-9]+)/g},{type:n.AttachmentType.Instagram,pattern:/(https?:\/\/)?(www\.)?(instagram\.com)[\s\S]*/g},{type:n.AttachmentType.GIF,pattern:/(https?:\/\/)?((media\.)?tenor\.com|(static\.)?klipy\.com)[\s\S]*/g},{type:n.AttachmentType.TikTok,pattern:/(https?:\/\/)?(www\.)?(tiktok\.com)[\s\S]*/g},{type:n.AttachmentType.Bluesky,pattern:/(https?:\/\/)?(bsky\.app)[\s\S]*/g}],i=async e=>{try{let t=await fetch(`/api/opengraph?url=${encodeURIComponent(e)}`);
79if(!t.ok)return;return await t.json()}catch(e){console.error("Error fetching opengraph data:",e);return}},o=async e=>{try{let t=await fetch(`/api/oembed?type=${e.type.toLowerCase()}&url=${encodeURIComponent(e.url)}`);if(!t.ok)return;return await t.json()}catch(e){console.error("Error fetching Oembed data:",e);return}},s=async e=>new Promise(t=>{let n=new window.Image;n.onload=()=>{t(n)},n.src=URL.createObjectURL(e)}),l=async(e,t,n)=>{let r,i=new FormData;for(let t=0;t<e.length;t++){let n=e[t].file;if(n instanceof File){let e=encodeURIComponent(n.name);i.append("file",n,e)}else i.append("file",n)}try{let e=await fetch(`${t}/upload/v2`,{headers:{Authorization:`Bearer ${n}`},cache:"reload",method:"POST",body:i});if(!e.body)return void console.error("unable to read image upload response body");let o=new TextDecoder("utf-8"),s=e.body.getReader(),l=[],a=async()=>{let{value:e,done:t}=await s.read();if(t)return;let n=o.decode(e);l.push(n),await a()};await a(),r=l.join("")}catch(e){console.error("error uploading images:",e)}if(!r)return;let o=JSON.parse(`[${r.replace(/}\s*{/g,"},{")}]`),s=o.length>0?o.pop():void 0,l=s&&"files"in s?s.files:void 0;return l&&(l=l.map(e=>({...e,filename:decodeURIComponent(e.filename)}))),l},a=async(e,n,r)=>{try{let i=await (0,t.fetchWithAuth)(`${n}/upload/v2/delete`,{method:"POST",body:JSON.stringify({id:e})},r);204!==i.status&&console.error("there was an error deleting image id:",e)}catch(e){console.error("error deleting image:",e)}};e.s(["UPLOAD_MAX_FILES",0,4,"UPLOAD_MAX_SIZE",0,0x1900000,"fetchOembedData",0,o,"fetchOpengraphData",0,i,"getAttachmentType",0,e=>{let t=r.find(t=>e.match(t.pattern));return t?t.type:n.AttachmentType.Link},"getUploadedImage",0,s,"removeUploadedImage",0,a,"shouldFallbackYoutubeAttachmentToLink",0,(e,t)=>e===n.AttachmentType.Youtube&&!t?.html,"uploadImages",0,l])},657569,761201,e=>{"use strict";function t(e){return[...new Set(e.filter(e=>!!e))]}function n(e,t,n,r){return e?t?`reply_draft_${t}`:null:n?`edit_draft_${n}`:t?`comment_draft_${t}`:r?.allowFeedFallback===!1?null:"feed_post_draft"}function r(e,t,r,i){let o=n(e,t,r,i);o&&(sessionStorage.removeItem(o),localStorage.removeItem(o))}function i(e,t,r,i){let o=n(e,t,r,i);return o?(e||r?sessionStorage.getItem(o):localStorage.getItem(o))??null:null}function o(e,t,r,i,o){let s=n(t,r,i,o);if(s)try{t||i?sessionStorage.setItem(s,JSON.stringify(e)):localStorage.setItem(s,JSON.stringify(e))}catch{}}e.s(["getDraft",0,i,"removeDraft",0,r,"removeDrafts",0,function(e,n,i,o){let s=t(n);if(0===s.length)return void r(e,void 0,i,o);for(let t of s)r(e,t,i,o)},"saveDraft",0,o,"takeDraft",0,function(e,n,s,l){if(s)return i(e,n[0]??void 0,s,l);let a=t(n),c=a[0];for(let t of a){let n=i(e,t,void 0,l);if(n){if(c&&t!==c)try{o(JSON.parse(n),e,c,void 0,l),r(e,t,void 0,l)}catch{}return n}}return null}],657569);var s=e.i(649784);e.s(["getStaffBadgeProps",0,function({composition:e,role:t}){return{includeStaffBadge:!!t&&s.COMMUNITY_STAFF_ROLES.includes(t),showStaffBadgeText:e?.showStaffBadgeText??!1}}],761201)},593296,e=>{"use strict";var t=e.i(389959),n=e.i(478902);let r=(0,t.createContext)(null);e.s(["StoreProvider",0,({children:e,...t})=>(0,n.jsx)(r.Provider,{value:t,children:e}),"useStore",0,()=>{let e=(0,t.useContext)(r);if(!e)throw Error("useStore must be used within a StoreProvider");let{externalRootStore:n,fanPostStore:i,fanPostIndexStore:o,contentStore:s,communityStore:l,repliesStore:a,viewerStore:c}=e.store;return{externalRootStore:n,fanPostStore:i,fanPostIndexStore:o,contentStore:s,communityStore:l,repliesStore:a,viewerStore:c}}])},977082,924965,239981,e=>{"use strict";var t=e.i(478902),n=e.i(197649),r=e.i(183821),i={standard:"_1tkg4tn1 _1tkg4tn0",withLogo:"_1tkg4tn2 _1tkg4tn0"},o="_1tkg4tn3",s="_1tkg4tn4",l="_1tkg4tn5",a="_1tkg4tn7",c={xsmall:"_1tkg4tn8 _1tkg4tn6 _1tkg4tn5",small:"_1tkg4tn9 _1tkg4tn6 _1tkg4tn5",medium:"_1tkg4tna _1tkg4tn6 _1tkg4tn5",large:"_1tkg4tnb _1tkg4tn6 _1tkg4tn5"},u={default:"_1tkg4tnc",primaryText:"_1tkg4tnd"};e.s(["avatar",0,c,"avatarContainer",0,i,"avatarImage",0,l,"communityBadge",0,o,"communityBadgeImage",0,s,"fallbackColorScheme",0,u,"profileURL",0,a],924965),e.s(["default",0,({avatarUrl:e,username:d,avatarSize:h="small",fallbackColorScheme:p="default",profileURL:f,communityLogoUrl:m,communityName:g,showCommunityLogo:y=!1})=>{let v=function({avatarUrl:e,username:i,avatarSize:o,fallbackColorScheme:s}){return e?(0,t.jsx)("div",{className:c[o],children:(0,t.jsx)(r.default,{src:e,alt:i??"",className:l})}):i?(0,t.jsx)("div",{className:(0,n.clsx)(c[o],u[s]),children:i[0]?.toUpperCase()}):null}({avatarUrl:e,username:d,avatarSize:h,fallbackColorScheme:p}),b=y&&!!m&&!!v;return(0,t.jsxs)("div",{className:i[b?"withLogo":"standard"],children:[f&&v?(0,t.jsx)("a",{href:f,className:a,children:v}):v,b&&(0,t.jsx)("div",{className:o,"aria-hidden":"true",children:(0,t.jsx)(r.default,{src:m,alt:g??"Community",className:s})})]})}],239981),e.s([],977082)},819366,384076,e=>{"use strict";var t=e.i(478902),n=e.i(389959),r=e.i(22834),i="_1a43y1y0";let o=({children:e})=>{let o=(0,n.useId)();return(0,r.default)(o),(0,t.jsx)("div",{id:o,className:i,children:e})};e.s(["default",0,({children:e,includeLightbox:n=!1})=>n?(0,t.jsx)(o,{children:e}):(0,t.jsx)("div",{className:i,children:e})],384076),e.s([],819366)},586831,89693,e=>{"use strict";var t=e.i(478902),n=e.i(389959),r=e.i(738886),i=e.i(210982),o=e.i(396902);e.s(["default",0,({logo:e,message:s,buttonText:l,onClick:a,source:c})=>{let u=(0,i.useAnalytics)(),{communityConfig:d}
79=(0,o.useConfigContext)(),[h,p]=(0,n.useState)("/auth/login?returnPath=/");return(0,n.useEffect)(()=>{let{ssoAuthDomain:e,isPrimaryCommunity:t}=d,{protocol:n,href:r,pathname:i}=window.location;p(e&&!t?`${n}//${e}/auth/sso?returnTo=${encodeURIComponent(r)}`:`/auth/login?returnPath=${encodeURIComponent(i)}`)},[]),(0,t.jsxs)("div",{className:"_1acxchq0",children:[e&&(0,t.jsx)("div",{className:"_1acxchq1",children:e}),(0,t.jsx)("p",{className:"_1acxchq2",children:s??(0,t.jsx)("span",{children:"Join the conversation. Sign in to write, rec, reply, and vote."})}),(0,t.jsx)("div",{className:"_1acxchq3",children:(0,t.jsx)(r.default,{className:"_1acxchq4",text:l??"Sign In",href:h,onClick:()=>{a&&a(),u?.emit({event:"authentication",authentication:{method:"comments"===c?"sign in and join the conversation":`sign_in_${c}_feedpost`}})}})})]})}],89693),e.s([],586831)},431686,371536,557380,220255,195826,322226,e=>{"use strict";var t=e.i(478902),n=e.i(197649),r=e.i(640978),i=e.i(322532),o={full:"jmo2vn3 jmo2vn2",compact:"jmo2vn4 jmo2vn2"},s="jmo2vn7";e.s(["default",0,({username:e,displayType:l=r.FanPostCardDisplayType.full,profileURL:a,isOP:c=!1,includeStaffBadge:u=!1,showStaffBadgeText:d=!1,className:h,usernameClassName:p})=>(0,t.jsxs)("div",{className:(0,n.default)("jmo2vn0",h),children:[(0,t.jsx)("div",{className:(0,n.default)(o[l],p),children:a?(0,t.jsx)("a",{className:"jmo2vn5",href:a,children:e}):(0,t.jsx)(t.Fragment,{children:e})}),!!(u||c)&&(0,t.jsxs)("div",{className:"jmo2vn6",children:[!!u&&(0,t.jsxs)("div",{className:s,children:[(0,t.jsx)(i.default,{className:"jmo2vn9"}),!!d&&(0,t.jsx)("span",{className:"jmo2vn8",children:"Staff"})]}),!!c&&(0,t.jsx)("div",{className:s,children:(0,t.jsx)("span",{className:"jmo2vna",children:"OP"})})]})]})],371536),e.s([],431686),e.s(["default",0,({className:e="",fill:n="currentColor",width:r=24,height:i=24})=>(0,t.jsx)("svg",{className:e,width:r,height:i,viewBox:"0 0 26 20",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M19.7917 5M10.02 13.528C9.684 13.96 9.312 14.264 8.904 14.44C8.496 14.608 8.084 14.692 7.668 14.692C7.012 14.692 6.42 14.58 5.892 14.356C5.372 14.124 4.932 13.808 4.572 13.408C4.212 13.008 3.936 12.54 3.744 12.004C3.552 11.46 3.456 10.876 3.456 10.252C3.456 9.612 3.552 9.02 3.744 8.476C3.936 7.924 4.212 7.444 4.572 7.036C4.932 6.628 5.372 6.308 5.892 6.076C6.42 5.844 7.012 5.728 7.668 5.728C8.108 5.728 8.532 5.796 8.94 5.932C9.356 6.06 9.728 6.252 10.056 6.508C10.392 6.764 10.668 7.08 10.884 7.456C11.1 7.832 11.232 8.264 11.28 8.752H9.48C9.368 8.272 9.152 7.912 8.832 7.672C8.512 7.432 8.124 7.312 7.668 7.312C7.244 7.312 6.884 7.396 6.588 7.564C6.292 7.724 6.052 7.944 5.868 8.224C5.684 8.496 5.548 8.808 5.46 9.16C5.38 9.512 5.34 9.876 5.34 10.252C5.34 10.612 5.38 10.964 5.46 11.308C5.548 11.644 5.684 11.948 5.868 12.22C6.052 12.492 6.292 12.712 6.588 12.88C6.884 13.04 7.244 13.12 7.668 13.12C8.292 13.12 8.772 12.964 9.108 12.652C9.452 12.332 9.652 11.872 9.708 11.272H7.812V9.868H11.412V14.5H10.212L10.02 13.528ZM12.9335 5.932H14.8175V14.5H12.9335V5.932ZM16.4725 5.932H22.4965V7.516H18.3565V9.496H21.9445V10.96H18.3565V14.5H16.4725V5.932Z.70833V20.2917H5.20833V5.70833H19.7917ZM19.7917 3.625H5.20833C4.0625 3.625 3.125 4.5625 3.125 5.70833V20.2917C3.125 21.4375 4.0625 22.375 5.20833 22.375H19.7917C20.9375 22.375 21.875 21.4375 21.875 20.2917V5.70833C21.875 4.5625 20.9375 3.625 19.7917 3.625ZM14.7292 12.8542L11.6042 16.8854L9.375 14.1875L6.25 18.2083H18.75L14.7292 12.8542Z",fill:n})})],557380),e.s(["default",0,({className:e="",fill:n="currentColor",width:r=24,height:i=24})=>(0,t.jsx)("svg",{className:e,width:r,height:i,viewBox:"0 -960 960 960",xmlns:"http://www.w3.org/2000/svg",fill:n,children:(0,t.jsx)("path",{d:"M480-480ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h320v80H200v560h560v-320h80v320q0 33-23.5 56.5T760-120H200Zm40-160h480L570-480 450-320l-90-120-120 160Zm440-320v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"})})],220255),e.s(["default",0,({className:e="",fill:n="currentColor",width:r=24,height:i=24})=>(0,t.jsx)("svg",{className:e,width:r,height:i,viewBox:"0 0 25 26",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M19.7917 5.70833V20.2917H5.20833V5.70833H19.7917ZM19.7917 3.625H5.20833C4.0625 3.625 3.125 4.5625 3.125 5.70833V20.2917C3.125 21.4375 4.0625 22.375 5.20833 22.375H19.7917C20.9375 22.375 21.875 21.4375 21.875 20.2917V5.70833C21.875 4.5625 20.9375 3.625 19.7917 3.625ZM14.7292 12.8542L11.6042 16.8854L9.375 14.1875L6.25 18.2083H18.75L14.7292 12.8542Z",fill:n})})],195826),e.s(["default",0,({className:e="",fill:n="currentColor",width:r=20,height:i=20})=>(0,t.jsxs)("svg",{className:e,width:r,height:i,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{x:"2",y:"5.5",width:"3",height:"3",rx:"1.5",stroke:n}),(0,t.jsx)("path",{d:"M7 7H18",stroke:n,strokeWidth:"2"}),(0,t.jsx)("rect",{x:"2",y:"11.5",width:"3",height:"3",rx:"1.5",fill:n,stroke:n}),(0,t.jsx)("path",{d:"M7 13H18",stroke:n,strokeWidth:"2"})]})],322226)},555831,808660,249922,e=>{"use strict";var t,n,r,i,o,s,l=e.i(478902),a=e.i(197649);e.i(807738);var c=e.i(738886),u=e.i(389959),d="_1blr0dd0";let h=({url:e,overlayText:t,icon:n,favicon:r,overlayIcon:i})=>e?(0,l.jsx)("div",{className:d,children:(0,l.jsx)("div",{className:"_1blr0dd2",style:{backgroundImage:`url(${e})`},children:(t||r)&&(0,l.jsxs)("div",{className:"_1blr0dd3",children:[i&&(0,l.jsx)("div",{className:"_1blr0dd4",children:i}),r&&!i&&(0,l.jsx)("img",{className:"_1blr0dd5",src:r,alt:""}),t&&(0,l.jsx)("p",{className:"_1blr0dd6",children:t})]})})}):n?(0,l.jsx)("div",{className:(0,a.default)(d,"_1blr0dd1"),children:(0,l.jsx)("div",{className:"_1blr0dd7",children:n})}):null;(t=i||(i={})).Twitter="Twitter",t.Youtube="Youtube",t.Instagram="Instagram",t.TikTok="TikTok",t.Bluesky="Bluesky",t.Link="Link",t.GIF="GIF",t.ImageLink="ImageLink",t.Upload="Upload",(n=o||(o={})).compact="compact",n.full="full",n.medium="medium",n.preview="preview",(r=s||(s={})).Threads="threads",r.Bluesky="bluesky",r.Instagram="instagram",r.Reddit="reddit",r.Facebook="facebook",r.LinkedIn="linkedin",r.Mastodon="mastodon",r.TikTok="tiktok",e.s(["AttachmentDisplayType",0,o,"AttachmentType",0,i,"LinkType",0,s],808660);let p=[{type:s.Threads,pattern:/(https?:\/\/)?(www\.)?(threads\.com)[\s\S]*/g},{type:s.Bluesky,pattern:/(https?:\/\/)?(bsky\.app)[\s\S]*/g},{type:s.Instagram,pattern:/(https?:\/\/)?(www\.)?(instagram\.com)[\s\S]*/g},{type:s.Reddit,pattern:/(https?:\/\/)?(www\.)?(reddit\.com)[\s\S]*/g},{type:s.Facebook,pattern:/(https?:\/\/)?(www\.)?(facebook\.com)[\s\S]*/g},{type:s.LinkedIn,pattern:/(https?:\/\/)?(www\.)?(linkedin\.com)[\s\S]*/g},{type:s.Mastodon,pattern:/(https?:\/\/)?(www\.)?(mastodon\.social)[\
79s\S]*/g},{type:s.TikTok,pattern:/(https?:\/\/)?(www\.)?(tiktok\.com)[\s\S]*/g}],f=({url:e,platformIcon:t,border:n=!0})=>{let r,{domain:i}={domain:(r=new URL(e)).hostname,path:r.pathname,query:r.search,hash:r.hash,protocol:r.protocol,port:r.port,origin:r.origin,href:r.href,searchParams:r.searchParams},o=i.replace(/^www\./,"");return(0,l.jsx)("a",{className:"kmpp0n1",href:e,target:"_blank",rel:"noreferrer noopener",children:(0,l.jsxs)("div",{className:(0,a.default)("kmpp0n2",n&&"kmpp0n3"),children:[(0,l.jsx)("div",{className:"kmpp0n4","aria-hidden":"true",children:t}),(0,l.jsxs)("span",{className:"kmpp0n0",children:["Link from ",o]})]})})};var m=e.i(407570),g=e.i(358546),y=e.i(919071),v=e.i(971195),b=e.i(794569),w=e.i(748690);e.i(689219);var x=e.i(169967),C=e.i(798240),k=e.i(964081);let S=({attachment:e,contentID:t,type:n=o.full,onDimensionsChange:r,onPersistDimensions:s})=>{let c=(0,C.useCurrentCycloneCommunity)(),{isConsentAccepted:d}=(0,k.useCookieConsent)("socialMediaAndEmbeds"),{html:p,url:S,type:E}=e,[T,M]=(0,u.useState)(null),O=E===i.Youtube&&S.includes("/shorts/");(0,u.useEffect)(()=>{p&&E===i.Instagram&&d&&window.instgrm?.Embeds.process()},[p,E,d]);let A=(0,u.useCallback)(l=>{if(!l||e.type!==i.Twitter&&e.type!==i.Instagram&&e.type!==i.TikTok&&e.type!==i.Bluesky||(r&&r({height:l.offsetHeight,width:l.offsetWidth}),n===o.preview))return;if(e.heightToWidthRatio){let t=l.offsetWidth;if(E===i.TikTok){let e=l.querySelector("blockquote");t=e?parseInt(e.style.minWidth,10):l.offsetWidth}M(t*e.heightToWidthRatio)}let a=!1;if(E===i.Twitter)a=l.innerHTML.includes("twitter-tweet-rendered");else if(E===i.Instagram)a=l.innerHTML.includes("instagram-media-rendered");else if(E===i.TikTok){let e=l.querySelector("iframe");a=!!e&&e.hasAttribute("style")&&""!==e.style.maxHeight}else if(E===i.Bluesky){let e=l.querySelector("iframe");a=!!e&&e.hasAttribute("style")&&""!==e.style.height}if(a){let n=l.offsetHeight/l.offsetWidth;if(!e.heightToWidthRatio||n!==e.heightToWidthRatio){if(M(l.offsetHeight),!t||!s)return;s({communityID:c.cycloneCommunityId,contentID:t,heightToWidthRatio:n,attachmentID:e.id})}}},[e,r,s,t,c.cycloneCommunityId,n,E]),N=(e=>{switch(e){case i.Youtube:return(0,l.jsx)(w.default,{});case i.Instagram:return(0,l.jsx)(y.default,{});case i.TikTok:return(0,l.jsx)(v.default,{});case i.Twitter:return(0,l.jsx)(b.default,{});case i.Bluesky:return(0,l.jsx)(g.default,{});default:return(0,l.jsx)(m.default,{})}})(e.type),R=(0,l.jsx)(f,{url:S,platformIcon:N});if(n===o.compact){if(e.type===i.Youtube)return e.thumbnailUrl?(0,l.jsx)(h,{url:e.thumbnailUrl,overlayText:"youtube.com",overlayIcon:(0,l.jsx)(w.default,{height:12,width:12})}):(0,l.jsx)(h,{icon:(0,l.jsx)(w.default,{})});if(e.type===i.Twitter)return(0,l.jsx)(h,{icon:(0,l.jsx)(b.default,{})});if(e.type===i.Bluesky)return e.thumbnailUrl?(0,l.jsx)(h,{url:e.thumbnailUrl,overlayText:"bsky.app",overlayIcon:(0,l.jsx)(g.default,{})}):(0,l.jsx)(h,{icon:(0,l.jsx)(g.default,{})});if(e.type===i.Instagram)return e.thumbnailUrl?(0,l.jsx)(h,{url:e.thumbnailUrl,overlayText:"instagram.com",overlayIcon:(0,l.jsx)(y.default,{})}):(0,l.jsx)(h,{icon:(0,l.jsx)(y.default,{})});if(e.type===i.TikTok)return e.thumbnailUrl?(0,l.jsx)(h,{url:e.thumbnailUrl,overlayText:"tiktok.com",overlayIcon:(0,l.jsx)(v.default,{height:12,width:12})}):(0,l.jsx)(h,{icon:(0,l.jsx)(v.default,{})})}return p&&(R=(0,l.jsx)(x.default,{type:E.toLowerCase(),html:p,className:(0,a.default)("_7mktju0",E===i.Youtube&&"_7mktju1",E===i.Twitter&&"_7mktju2",E===i.Instagram&&"_7mktju6",E===i.TikTok&&"_7mktju4",E===i.Bluesky&&"_7mktju3",O&&"_7mktju5"),onLayoutChange:A,overrideInView:!0,overrideInlineStylesReset:!0})),(0,l.jsx)("div",{className:"_7mktju7",style:T?{minHeight:T}:void 0,children:R})};var E={full:"_1ilgl8g2 _1ilgl8g1",medium:"_1ilgl8g3 _1ilgl8g1",compact:"_1ilgl8g4 _1ilgl8g1",preview:"_1ilgl8g5 _1ilgl8g1"};let T=({attachment:e,type:t})=>{let{url:n,altText:r}=e;return t===o.compact?(0,l.jsx)(h,{url:e.thumbnailUrl??"",overlayText:"gif"}):(0,l.jsx)("div",{className:E[t],children:(0,l.jsx)("img",{className:"_1ilgl8g0",src:n,alt:r??""})})},M=({className:e,width:t="350",height:n="auto"})=>(0,l.jsxs)("svg",{className:e,width:t,height:n,viewBox:"0 0 196 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("rect",{width:"196",height:"128",rx:"12.7907",fill:"#E9E9E9"}),(0,l.jsx)("rect",{x:"5.75744",y:"5.5969",width:"184.485",height:"116.806",rx:"8.91473",fill:"#E9E9E9"}),(0,l.jsx)("rect",{x:"5.75744",y:"5.5969",width:"184.485",height:"116.806",rx:"8.91473",stroke:"#909090",strokeWidth:"0.775194",strokeDasharray:"2.33 2.33"}),(0,l.jsxs)("g",{clipPath:"url(#clip0_1088_11911)",children:[(0,l.jsx)("rect",{x:"71.3127",y:"39.4537",width:"53.8502",height:"38.0215",rx:"5.13415",fill:"#F1F1F1"}),(0,l.jsx)("path",{d:"M102.813 50.0668C103.999 48.5087 106.343 48.5087 107.53 50.0668L126.242 74.6391C127.728 76.5906 126.336 79.3998 123.883 79.3998H74.3608C71.9098 79.3996 70.5181 76.594 72.0004 74.642L84.851 57.7201C86.0374 56.1579 88.3863 56.1579 89.5727 57.7201L93.2729 62.5932L102.813 50.0668Z",fill:"#949494"}),(0,l.jsx)("circle",{cx:"86.9899",cy:"47.776",r:"4.40592",fill:"#949494"}
79),(0,l.jsx)("path",{d:"M72.834 40.936L62.9969 35.2566",stroke:"white",strokeWidth:"0.808528"})]}),(0,l.jsx)("rect",{x:"71.3127",y:"39.4537",width:"53.8502",height:"38.0215",rx:"5.13415",stroke:"#949494",strokeWidth:"0.695334"}),(0,l.jsx)("path",{d:"M67.5338 94.0639H65.2021V93.2843H65.8788V89.7095H65.2021V88.9299H67.5338V89.7095H66.8497V93.2843H67.5338V94.0639ZM69.3638 94.0639H68.4223V90.2244H69.3638V90.8643H69.4005C69.4741 90.6633 69.5918 90.4917 69.7536 90.3495C69.9203 90.2073 70.1459 90.1362 70.4303 90.1362C70.6951 90.1362 70.9231 90.1999 71.1143 90.3274C71.3105 90.4549 71.4527 90.6486 71.541 90.9085H71.5557C71.6243 90.6976 71.7616 90.5162 71.9676 90.3642C72.1735 90.2122 72.4285 90.1362 72.7325 90.1362C73.1052 90.1362 73.3945 90.2686 73.6005 90.5333C73.8064 90.7932 73.9094 91.161 73.9094 91.6367V94.0639H72.9679V91.7323C72.9679 91.4577 72.9164 91.2517 72.8134 91.1144C72.7154 90.9771 72.5609 90.9085 72.3501 90.9085C72.2275 90.9085 72.1098 90.933 71.997 90.982C71.8891 91.0262 71.8009 91.0948 71.7322 91.188C71.6685 91.2762 71.6366 91.389 71.6366 91.5263V94.0639H70.6951V91.7323C70.6951 91.4577 70.6436 91.2517 70.5406 91.1144C70.4376 90.9771 70.2832 90.9085 70.0772 90.9085C69.9595 90.9085 69.8443 90.933 69.7315 90.982C69.6236 91.0262 69.5354 91.0948 69.4667 91.188C69.3981 91.2762 69.3638 91.389 69.3638 91.5263V94.0639ZM78.2538 94.0639H77.7315C77.5893 94.0639 77.4618 94.0321 77.349 93.9683C77.2412 93.8997 77.1554 93.8016 77.0916 93.6741C77.0328 93.5466 77.0033 93.3971 77.0033 93.2254V93.1445L77.2387 93.402H76.9739C76.9102 93.6471 76.7778 93.8335 76.5767 93.961C76.3806 94.0885 76.1403 94.1522 75.8559 94.1522C75.4636 94.1522 75.162 94.0492 74.9512 93.8433C74.7403 93.6324 74.6349 93.3578 74.6349 93.0195C74.6349 92.7547 74.6986 92.5365 74.8261 92.3648C74.9585 92.1932 75.1473 92.0633 75.3925 91.975C75.6377 91.8867 75.9319 91.8426 76.2752 91.8426H76.9298V91.5631C76.9298 91.3523 76.8734 91.188 76.7606 91.0703C76.6478 90.9477 76.4664 90.8864 76.2163 90.8864C75.9956 90.8864 75.8167 90.9354 75.6794 91.0335C75.547 91.1267 75.4342 91.2395 75.341 91.3719L74.782 90.8717C74.9242 90.651 75.113 90.4745 75.3484 90.3421C75.5837 90.2048 75.8951 90.1362 76.2825 90.1362C76.7974 90.1362 77.1897 90.2563 77.4594 90.4966C77.734 90.7319 77.8713 91.0678 77.8713 91.5043V93.3137H78.2538V94.0639ZM76.9298 92.409H76.3266C76.0815 92.409 75.8976 92.4507 75.775 92.534C75.6524 92.6125 75.5911 92.7277 75.5911 92.8797V93.0048C75.5911 93.1568 75.6426 93.272 75.7456 93.3505C75.8485 93.4289 75.9907 93.4682 76.1722 93.4682C76.3144 93.4682 76.4419 93.4485 76.5547 93.4093C76.6674 93.3652 76.7582 93.3014 76.8268 93.2181C76.8955 93.1347 76.9298 93.0342 76.9298 92.9165V92.409ZM82.4356 94.3876C82.4356 94.6524 82.3694 94.8755 82.237 95.0569C82.1046 95.2433 81.8912 95.383 81.597 95.4762C81.3028 95.5743 80.9105 95.6233 80.4202 95.6233C79.9886 95.6233 79.6405 95.5865 79.3757 95.513C79.1158 95.4443 78.927 95.3413 78.8093 95.204C78.6916 95.0667 78.6328 94.9049 78.6328 94.7186C78.6328 94.5028 78.6941 94.3336 78.8167 94.2111C78.9393 94.0934 79.106 94.0174 79.3169 93.983V93.9021C79.1599 93.858 79.0373 93.7795 78.9491 93.6668C78.8657 93.554 78.824 93.4191 78.824 93.2622C78.824 93.0661 78.8951 92.9141 79.0373 92.8062C79.1796 92.6983 79.3438 92.6247 79.5302 92.5855V92.5561C79.2997 92.4482 79.1256 92.2986 79.0079 92.1074C78.8902 91.9162 78.8314 91.6931 78.8314 91.4381C78.8314 91.1782 78.8902 90.9502 79.0079 90.754C79.1305 90.5579 79.3095 90.4059 79.5449 90.298C79.7851 90.1901 80.0769 90.1362 80.4202 90.1362C80.5477 90.1362 80.6678 90.1435 80.7806 90.1582C80.8934 90.1729 80.9963 90.1974 81.0895 90.2318V90.1067C81.0895 89.9204 81.1361 89.7806 81.2293 89.6875C81.3224 89.5943 81.4573 89.5477 81.6338 89.5477H82.2296V90.2686H81.4131V90.3715C81.6142 90.4843 81.7638 90.6339 81.8618 90.8202C81.9599 91.0016 82.0089 91.2076 82.0089 91.4381C82.0089 91.6931 81.9476 91.9186 81.8251 92.1148C81.7074 92.3109 81.5308 92.4629 81.2955 92.5708C81.0601 92.6738 80.7683 92.7253 80.4202 92.7253C80.3123 92.7253 80.2069 92.7204 80.1039 92.7106C80.0058 92.6958 79.9151 92.6787 79.8317 92.6591C79.7582 92.6934 79.6944 92.74 79.6405 92.7988C79.5866 92.8528 79.5596 92.9214 79.5596 93.0048C79.5596 93.1028 79.6013 93.1764 79.6846 93.2254C79.768 93.2696 79.893 93.2916 80.0597 93.2916H81.0895C81.5603 93.2916 81.9011 93.3873 82.1119 93.5785C82.3277 93.7697 82.4356 94.0394 82.4356 94.3876ZM81.5529 94.4979C81.5529 94.3753 81.5039 94.2797 81.4058 94.2111C81.3077 94.1424 81.1385 94.1081 80.8983 94.1081H79.589C79.5204 94.162 79.4689 94.2233 79.4345 94.292C79.4051 94.3606 79.3904 94.4317 79.3904 94.5053C79.3904 94.6524 79.4517 94.7676 79.5743 94.851C79.6969 94.9343 79.9053 94.976 80.1995 94.976H80.6702C80.9743 94.976 81.1974 94.9368 81.3396 94.8583C81.4818 94.7799 81.5529 94.6597 81.5529 94.4979ZM80.4202 92.0853C80.6457 92.0853 80.8174 92.0363 80.935 91.9382C81.0527 91.8353 81.1116 91.6881 81.1116 91.4969V91.3719C81.1116 91.1757 81.0527 91.0286 80.935 90.9305C80.8174 90.8325 80.6457 90.7834 80.4202 90.7834C80.1995 90.7834 80.0279 90.8325 79.9053 90.9305C79.7876 91.0286 79.7288 91.1757 79.7288 91.3719V91.4969C79.7288 91.6881 79.7876 91.8353 79.9053 91.9382C80.0279 92.0363 80.1995 92.0853 80.4202 92.0853ZM84.4436 94.1522C84.066 94.1522 83.7424 94.0713 83.4727 93.9095C83.203 93.7428 82.9946 93.5098 82.8475 93.2107C82.7053 92.9067 82.6341 92.5487 82.6341 92.1368C82.6341 91.7347 82.7053 91.3841 82.8475 91.085C82.9897 90.781 83.1932 90.5481 83.458 90.3862C83.7228 90.2195 84.0415 90.1362 84.4142 90.1362C84.8163 90.1362 85.1448 90.2244 85.3998 90.4009C85.6597 90.5775 85.8509 90.8129 85.9735 91.1071C86.101 91.3964 86.1648 91.7176 86.1648 92.0706V92.3796H83.6124V92.4752C83.6124 92.7498 83.6909 92.9729 83.8478 93.1445C84.0047 93.3161 84.2376 93.402 84.5466 93.402C84.777 93.402 84.9683 93.3529 85.1203 93.2549C85.2723 93.1519 85.4071 93.0268 85.5248 92.8797L86.0324 93.4461C85.8754 93.6569 85.6597 93.8286 85.3851 93.961C85.1154 94.0885 84.8015 94.1522 84.4436 94.1522ZM84.4289 90.8423C84.2621 90.8423 84.1175 90.8815 83.9949 90.96C83.8723 91.0335 83.7767 91.1389 83.708 91.2762C83.6443 91.4086 83.6124 91.5631 83.6124 91.7396V91.7985H85.1865V91.7323C85.1865 91.5508 85.1571 91.3964 85.0982 91.2689C85.0394 91.1365 84.9536 91.0335 84.8408 90.96C84.728 90.8815 84.5907 90.8423 84.4289 90.8423ZM89.5837 94.0639H88.6422V90.2244H89.5837V90.8643H89.6205C89.6989 90.6584 89.8215 90.4868 89.9883 90.3495C90.1599 90.2073 90.3953 90.1362 90.6944 90.1362C91.0867 90.1362 91.3882 90.2686 91.5991 90.5333C91.8148 90.7932 91.9227 91.161 91.9227 91.6367V94.0639H90.9812V91.7323C90.9812 91.4626 90.9322 91.2591 90.8341 91.1218C90.7361 90.9796 90.5742 90.9085 90.3487 90.9085C90.2212 90.9085 90.0986 90.933 89.9809 90.982C89.8632 91.0262 89.7676 91.0948 89.694 91.188C89.6205 91.2762 89.5837 91.389 89.5837 91.5263V94.0639ZM94.4444 94.1522C94.0815 94.1522 93.7652 94.0713 93.4955 93.9095C93.2307 93.7428 93.0248 93.5098 92.8777 93.2107C92.735
795 92.9067 92.6644 92.5487 92.6644 92.1368C92.6644 91.7249 92.7355 91.3719 92.8777 91.0776C93.0248 90.7785 93.2307 90.5481 93.4955 90.3862C93.7652 90.2195 94.0815 90.1362 94.4444 90.1362C94.8121 90.1362 95.1284 90.2195 95.3932 90.3862C95.6629 90.5481 95.8689 90.7785 96.0111 91.0776C96.1582 91.3719 96.2317 91.7249 96.2317 92.1368C96.2317 92.5487 96.1582 92.9067 96.0111 93.2107C95.8689 93.5098 95.6629 93.7428 95.3932 93.9095C95.1284 94.0713 94.8121 94.1522 94.4444 94.1522ZM94.4444 93.3946C94.6945 93.3946 94.8906 93.3186 95.0328 93.1666C95.175 93.0097 95.2461 92.7866 95.2461 92.4972V91.7838C95.2461 91.4945 95.175 91.2738 95.0328 91.1218C94.8906 90.9698 94.6945 90.8938 94.4444 90.8938C94.2041 90.8938 94.0104 90.9698 93.8633 91.1218C93.7211 91.2738 93.65 91.4945 93.65 91.7838V92.4972C93.65 92.7866 93.7211 93.0097 93.8633 93.1666C94.0104 93.3186 94.2041 93.3946 94.4444 93.3946ZM98.8687 94.0639H98.192C97.8684 94.0639 97.6208 93.9806 97.4491 93.8139C97.2824 93.6422 97.199 93.3995 97.199 93.0857V90.9673H96.6327V90.2244H96.9269C97.0691 90.2244 97.1647 90.1925 97.2138 90.1288C97.2677 90.0601 97.2947 89.9596 97.2947 89.8272V89.1726H98.1405V90.2244H98.9276V90.9673H98.1405V93.3137H98.8687V94.0639ZM104.74 94.0639H104.218C104.076 94.0639 103.948 94.0321 103.835 93.9683C103.727 93.8997 103.642 93.8016 103.578 93.6741C103.519 93.5466 103.49 93.3971 103.49 93.2254V93.1445L103.725 93.402H103.46C103.396 93.6471 103.264 93.8335 103.063 93.961C102.867 94.0885 102.627 94.1522 102.342 94.1522C101.95 94.1522 101.648 94.0492 101.437 93.8433C101.227 93.6324 101.121 93.3578 101.121 93.0195C101.121 92.7547 101.185 92.5365 101.312 92.3648C101.445 92.1932 101.634 92.0633 101.879 91.975C102.124 91.8867 102.418 91.8426 102.761 91.8426H103.416V91.5631C103.416 91.3523 103.36 91.188 103.247 91.0703C103.134 90.9477 102.953 90.8864 102.703 90.8864C102.482 90.8864 102.303 90.9354 102.166 91.0335C102.033 91.1267 101.92 91.2395 101.827 91.3719L101.268 90.8717C101.41 90.651 101.599 90.4745 101.835 90.3421C102.07 90.2048 102.381 90.1362 102.769 90.1362C103.284 90.1362 103.676 90.2563 103.946 90.4966C104.22 90.7319 104.358 91.0678 104.358 91.5043V93.3137H104.74V94.0639ZM103.416 92.409H102.813C102.568 92.409 102.384 92.4507 102.261 92.534C102.139 92.6125 102.077 92.7277 102.077 92.8797V93.0048C102.077 93.1568 102.129 93.272 102.232 93.3505C102.335 93.4289 102.477 93.4682 102.658 93.4682C102.801 93.4682 102.928 93.4485 103.041 93.4093C103.154 93.3652 103.244 93.3014 103.313 93.2181C103.382 93.1347 103.416 93.0342 103.416 92.9165V92.409ZM107.335 94.0639H106.217L104.937 90.2244H105.864L106.4 91.8794L106.776 93.2475H106.827L107.202 91.8794L107.724 90.2244H108.622L107.335 94.0639ZM112.488 94.0639H111.965C111.823 94.0639 111.696 94.0321 111.583 93.9683C111.475 93.8997 111.389 93.8016 111.325 93.6741C111.267 93.5466 111.237 93.3971 111.237 93.2254V93.1445L111.472 93.402H111.208C111.144 93.6471 111.012 93.8335 110.81 93.961C110.614 94.0885 110.374 94.1522 110.09 94.1522C109.697 94.1522 109.396 94.0492 109.185 93.8433C108.974 93.6324 108.869 93.3578 108.869 93.0195C108.869 92.7547 108.932 92.5365 109.06 92.3648C109.192 92.1932 109.381 92.0633 109.626 91.975C109.871 91.8867 110.166 91.8426 110.509 91.8426H111.164V91.5631C111.164 91.3523 111.107 91.188 110.994 91.0703C110.882 90.9477 110.7 90.8864 110.45 90.8864C110.229 90.8864 110.05 90.9354 109.913 91.0335C109.781 91.1267 109.668 91.2395 109.575 91.3719L109.016 90.8717C109.158 90.651 109.347 90.4745 109.582 90.3421C109.818 90.2048 110.129 90.1362 110.516 90.1362C111.031 90.1362 111.423 90.2563 111.693 90.4966C111.968 90.7319 112.105 91.0678 112.105 91.5043V93.3137H112.488V94.0639ZM111.164 92.409H110.56C110.315 92.409 110.131 92.4507 110.009 92.534C109.886 92.6125 109.825 92.7277 109.825 92.8797V93.0048C109.825 93.1568 109.876 93.272 109.979 93.3505C110.082 93.4289 110.225 93.4682 110.406 93.4682C110.548 93.4682 110.676 93.4485 110.788 93.4093C110.901 93.3652 110.992 93.3014 111.061 93.2181C111.129 93.1347 111.164 93.0342 111.164 92.9165V92.409ZM113.676 89.6654C113.484 89.6654 113.345 89.6213 113.256 89.533C113.168 89.4398 113.124 89.3271 113.124 89.1947V89.0476C113.124 88.9103 113.168 88.7975 113.256 88.7092C113.345 88.6209 113.484 88.5768 113.676 88.5768C113.867 88.5768 114.007 88.6209 114.095 88.7092C114.183 88.7975 114.227 88.9103 114.227 89.0476V89.1947C114.227 89.3271 114.183 89.4398 114.095 89.533C114.007 89.6213 113.867 89.6654 113.676 89.6654ZM113.205 94.0639V90.2244H114.146V94.0639H113.205ZM116.635 94.0639H116.127C115.809 94.0639 115.571 93.983 115.414 93.8212C115.262 93.6594 115.186 93.4314 115.186 93.1372V88.6209H116.127V93.3137H116.635V94.0639ZM120.65 94.0639H120.128C119.986 94.0639 119.858 94.0321 119.745 93.9683C119.638 93.8997 119.552 93.8016 119.488 93.6741C119.429 93.5466 119.4 93.3971 119.4 93.2254V93.1445L119.635 93.402H119.37C119.307 93.6471 119.174 93.8335 118.973 93.961C118.777 94.0885 118.537 94.1522 118.252 94.1522C117.86 94.1522 117.558 94.0492 117.348 93.8433C117.137 93.6324 117.031 93.3578 117.031 93.0195C117.031 92.7547 117.095 92.5365 117.223 92.3648C117.355 92.1932 117.544 92.0633 117.789 91.975C118.034 91.8867 118.328 91.8426 118.672 91.8426H119.326V91.5631C119.326 91.3523 119.27 91.188 119.157 91.0703C119.044 90.9477 118.8
7963 90.8864 118.613 90.8864C118.392 90.8864 118.213 90.9354 118.076 91.0335C117.943 91.1267 117.831 91.2395 117.737 91.3719L117.178 90.8717C117.321 90.651 117.509 90.4745 117.745 90.3421C117.98 90.2048 118.292 90.1362 118.679 90.1362C119.194 90.1362 119.586 90.2563 119.856 90.4966C120.13 90.7319 120.268 91.0678 120.268 91.5043V93.3137H120.65V94.0639ZM119.326 92.409H118.723C118.478 92.409 118.294 92.4507 118.171 92.534C118.049 92.6125 117.987 92.7277 117.987 92.8797V93.0048C117.987 93.1568 118.039 93.272 118.142 93.3505C118.245 93.4289 118.387 93.4682 118.569 93.4682C118.711 93.4682 118.838 93.4485 118.951 93.4093C119.064 93.3652 119.155 93.3014 119.223 93.2181C119.292 93.1347 119.326 93.0342 119.326 92.9165V92.409ZM121.368 94.0639V88.6209H122.309V90.857H122.338C122.407 90.6363 122.537 90.4622 122.728 90.3348C122.924 90.2024 123.148 90.1362 123.398 90.1362C123.726 90.1362 124.001 90.2146 124.221 90.3715C124.442 90.5284 124.611 90.7565 124.729 91.0556C124.847 91.3498 124.905 91.7102 124.905 92.1368C124.905 92.5634 124.847 92.9288 124.729 93.2328C124.611 93.5319 124.442 93.7599 124.221 93.9168C124.001 94.0738 123.726 94.1522 123.398 94.1522C123.148 94.1522 122.927 94.086 122.736 93.9536C122.544 93.8212 122.412 93.6447 122.338 93.424H122.309V94.0639H121.368ZM123.096 93.3725C123.341 93.3725 123.54 93.2916 123.692 93.1298C123.844 92.9631 123.92 92.7449 123.92 92.4752V91.8132C123.92 91.5386 123.844 91.3204 123.692 91.1586C123.54 90.9918 123.341 90.9085 123.096 90.9085C122.949 90.9085 122.814 90.9354 122.692 90.9894C122.574 91.0384 122.481 91.1095 122.412 91.2027C122.343 91.2959 122.309 91.4037 122.309 91.5263V92.7473C122.309 92.8797 122.343 92.9925 122.412 93.0857C122.481 93.1788 122.574 93.2499 122.692 93.299C122.814 93.348 122.949 93.3725 123.096 93.3725ZM127.182 94.0639H126.675C126.356 94.0639 126.118 93.983 125.961 93.8212C125.809 93.6594 125.733 93.4314 125.733 93.1372V88.6209H126.675V93.3137H127.182V94.0639ZM129.403 94.1522C129.025 94.1522 128.702 94.0713 128.432 93.9095C128.162 93.7428 127.954 93.5098 127.807 93.2107C127.664 92.9067 127.593 92.5487 127.593 92.1368C127.593 91.7347 127.664 91.3841 127.807 91.085C127.949 90.781 128.152 90.5481 128.417 90.3862C128.682 90.2195 129.001 90.1362 129.373 90.1362C129.775 90.1362 130.104 90.2244 130.359 90.4009C130.619 90.5775 130.81 90.8129 130.933 91.1071C131.06 91.3964 131.124 91.7176 131.124 92.0706V92.3796H128.572V92.4752C128.572 92.7498 128.65 92.9729 128.807 93.1445C128.964 93.3161 129.197 93.402 129.506 93.402C129.736 93.402 129.928 93.3529 130.08 93.2549C130.232 93.1519 130.366 93.0268 130.484 92.8797L130.992 93.4461C130.835 93.6569 130.619 93.8286 130.344 93.961C130.075 94.0885 129.761 94.1522 129.403 94.1522ZM129.388 90.8423C129.221 90.8423 129.077 90.8815 128.954 90.96C128.832 91.0335 128.736 91.1389 128.667 91.2762C128.604 91.4086 128.572 91.5631 128.572 91.7396V91.7985H130.146V91.7323C130.146 91.5508 130.116 91.3964 130.057 91.2689C129.999 91.1365 129.913 91.0335 129.8 90.96C129.687 90.8815 129.55 90.8423 129.388 90.8423Z",fill:"#949494"}),(0,l.jsx)("defs",{children:(0,l.jsx)("clipPath",{id:"clip0_1088_11911",children:(0,l.jsx)("rect",{x:"71.3127",y:"39.4537",width:"53.8502",height:"38.0215",rx:"5.13415",fill:"white"})})})]});var O=e.i(971131);let A=({children:e,...t})=>{let[n,r]=(0,u.useState)(null),i=(()=>{try{return n?.contentWindow?.document.body??null}catch(e){return console.warn(e),null}})(),[o,s]=(0,u.useState)(null);return(0,u.useEffect)(()=>{if(n&&n.contentWindow){let e=n.contentWindow.document;e.body.style.margin="0",e.body.style.height="fit-content",e.body.style.width="fit-content",new ResizeObserver(e=>{let t=e[0]||null,n=t?.contentBoxSize[0]??null;null===n?console.warn("ResizeObserver contains invalid `contentBoxSize`",e):s(n.blockSize)}).observe(e.body)}},[n]),(0,l.jsx)("iframe",{...t,ref:r,style:{...t.style,maxWidth:"100%",height:o?`${o}px`:"auto",width:"100%",overflow:"hidden"},sandbox:"allow-same-origin",children:i&&(0,O.createPortal)(e,i)})};var N={full:"_1i3djvc1 _1i3djvc0",medium:"_1i3djvc2 _1i3djvc0",compact:"_1i3djvc3 _1i3djvc0",preview:"_1i3djvc4 _1i3djvc0"};let R=({attachment:e,type:t,onError:n})=>{let[r,i]=(0,u.useState)(!1),{url:s}=e;
79return t===o.compact?null:(0,l.jsxs)("div",{className:N[t],children:[r&&(0,l.jsx)("div",{"data-origin-src":s,"aria-label":"Image not available",children:(0,l.jsx)(M,{})}),!r&&(0,l.jsx)(A,{title:"external image",children:(0,l.jsx)("img",{alt:"",src:s,style:{minHeight:"50px",maxWidth:"100%",maxHeight:"500px"},onError:()=>{i(!0),n&&n()}})})]})};var j=e.i(838941),D=e.i(545492),I=e.i(674432);let P=({className:e="",fill:t="",width:n=40,height:r=40})=>(0,l.jsxs)("svg",{className:e,width:n,height:r,viewBox:"0 0 40 40",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:"Reddit"}),(0,l.jsx)("path",{d:"M20 3C29.3825 3 37 10.6175 37 20C37 29.3825 29.3825 37 20 37C10.6175 37 3 29.3825 3 20C3 10.6175 10.6175 3 20 3ZM31.3334 20C31.3334 18.628 30.2199 17.5146 28.848 17.5146C28.172 17.5146 27.5754 17.7731 27.138 18.2106C25.448 16.9976 23.1018 16.2024 20.517 16.1029L21.6503 10.7942L25.3286 11.5696C25.3684 12.5041 26.1438 13.2596 27.0982 13.2596C28.0725 13.2596 28.8678 12.4644 28.8678 11.49C28.8678 10.5158 28.0725 9.72045 27.0982 9.72045C26.4024 9.72045 25.8058 10.1182 25.5275 10.7146L21.4117 9.83978C21.2924 9.81986 21.1731 9.83978 21.0737 9.89941C20.9742 9.95904 20.9146 10.0585 20.8748 10.1778L19.6222 16.1029C16.9778 16.1824 14.6117 16.9579 12.9018 18.2106C12.4644 17.793 11.848 17.5146 11.1918 17.5146C9.81986 17.5146 8.70642 18.628 8.70642 20C8.70642 21.014 9.30295 21.869 10.1778 22.2666C10.138 22.5052 10.1182 22.7638 10.1182 23.0222C10.1182 26.8398 14.552 29.9216 20.0398 29.9216C25.5275 29.9216 29.9614 26.8398 29.9614 23.0222C29.9614 22.7638 29.9415 22.5252 29.9018 22.2866C30.717 21.8889 31.3334 21.014 31.3334 20ZM24.2152 26.4421C23.0024 27.655 20.6959 27.7345 20.0199 27.7345C19.3438 27.7345 17.0176 27.6351 15.8246 26.4421C15.6456 26.2632 15.6456 25.9649 15.8246 25.786C16.0035 25.607 16.3018 25.607 16.4807 25.786C17.2362 26.5415 18.8666 26.8199 20.0398 26.8199C21.2128 26.8199 22.8234 26.5415 23.5988 25.786C23.7778 25.607 24.076 25.607 24.255 25.786C24.3942 25.9848 24.3942 26.2632 24.2152 26.4421ZM14.3334 21.7696C14.3334 20.7953 15.1286 20 16.1029 20C17.0772 20 17.8725 20.7953 17.8725 21.7696C17.8725 22.7438 17.0772 23.5392 16.1029 23.5392C15.1286 23.5392 14.3334 22.7438 14.3334 21.7696ZM23.8971 23.5392C22.9228 23.5392 22.1275 22.7438 22.1275 21.7696C22.1275 20.7953 22.9228 20 23.8971 20C24.8714 20 25.6666 20.7953 25.6666 21.7696C25.6666 22.7438 24.8714 23.5392 23.8971 23.5392Z",fill:t})]});var L=e.i(824290);e.i(55336);var _=e.i(183821),V="lnjcm20",B={full:"lnjcm22 lnjcm21",compact:"lnjcm23 lnjcm21",medium:"lnjcm24 lnjcm21",preview:"lnjcm25 lnjcm21"},H={full:"lnjcm27 lnjcm26",compact:"lnjcm28 lnjcm26",medium:"lnjcm29 lnjcm26",preview:"lnjcm2a lnjcm26"},F={full:"lnjcm2d lnjcm2c",compact:"lnjcm2e lnjcm2c",medium:"lnjcm2f lnjcm2c",preview:"lnjcm2g lnjcm2c"},z={full:"lnjcm2j lnjcm2i",compact:"lnjcm2k lnjcm2i",medium:"lnjcm2l lnjcm2i",preview:"lnjcm2m lnjcm2i"},$="lnjcm2r";let W=({attachment:e,type:t=o.full})=>{let{url:n,ogDescription:r,ogTitle:i,ogImage:a,ogSiteName:c,favicon:u}=e,d=(e=>{if(!e)return null;try{return new URL(e).origin.replace("https://","").replace("http://","").replace("www.","")}catch{return null}})(n),b=p.find(e=>n.match(e.pattern)),w=b?(e=>{switch(e){case s.Threads:return(0,l.jsx)(L.default,{});case s.Bluesky:return(0,l.jsx)(g.default,{});case s.Instagram:return(0,l.jsx)(y.default,{});case s.Reddit:return(0,l.jsx)(P,{});case s.Facebook:return(0,l.jsx)(j.default,{});case s.LinkedIn:return(0,l.jsx)(D.default,{});case s.Mastodon:return(0,l.jsx)(I.default,{});case s.TikTok:return(0,l.jsx)(v.default,{});default:return(0,l.jsx)(m.default,{fill:"#111"})}})(b.type):(0,l.jsx)(m.default,{fill:"#111"}),x=!!(a&&a.url);return t===o.compact?x?(0,l.jsx)(h,{url:a.url,overlayText:d,favicon:u}):(0,l.jsx)(h,{icon:w,overlayText:d,favicon:u}):i||r?(0,l.jsx)("a",{href:n,target:"_blank",rel:"noreferrer",className:$,children:(0,l.jsx)("div",{className:V,children:(0,l.jsxs)("div",{className:B[t],children:[(0,l.jsx)("div",{className:H[t],children:x?(0,l.jsx)("img",{className:"lnjcm2b",src:a.url,alt:a.altText??i??"Open Graph Image"}):(0,l.jsx)("div",{className:F[t],children:w})}),(0,l.jsxs)("div",{className:"lnjcm2h",children:[(0,l.jsxs)("div",{className:"lnjcm2p",children:[u&&(0,l.jsx)("div",{className:"lnjcm2q",children:(0,l.jsx)(_.default,{src:u,alt:"favicon",sizes:"20px"})}),(c||d)&&(0,l.jsx)("p",{className:"lnjcm2n",children:c??d})]}),(0,l.jsxs)("div",{children:[i&&(0,l.jsx)("p",{className:z[t],children:i}),r&&(0,l.jsx)("p",{className:"lnjcm2o",children:r})]})]})]})})}):(0,l.jsx)("div",{className:$,children:(0,l.jsx)("div",{className:V,children:(0,l.jsx)(f,{url:n,platformIcon:w,border:!1})})})};var q=e.i(734626),U=e.i(22834),K={full:"t9i1gy5 t9i1gy4",medium:"t9i1gy6 t9i1gy4",compact:"t9i1gy7 t9i1gy4",preview:"t9i1gy8 t9i1gy4"};let J=({children:e})=>{let t=(0,u.useId)();return(0,U.default)(t),(0,l.jsx)("div",{id:t,className:"t9i1gy3",children:e})},Z=({attachment:e,type:t=o.full,overlayText:n,includeLightbox:r=!1,displayAtOriginalRatio:i,singleAttachment:s=!0,linkOverride:c})=>{let{url:d,altText:p,height:f,width:m}=e,g="preview"===e.id,y=(0,u.useMemo)(()=>{switch(t){case o.full:return 300;case o.medium:return 200;default:return 300}},[t]),v=f&&m?f/m:null;if(t===o.compact)return(0,l.jsx)(h,{url:d,overlayText:n,overlayIcon:(0,l.jsx)(q.default,{height:12,width:12,fill:"white"})});let b=(0,l.jsx)("div",{className:(0,a.default)("t9i1gy0",s&&"t9i1gy1",g&&"t9i1gy2",!i&&K[t],i&&!!(v&&v>1&&v<2)&&"t9i1gya",i&&!!(v&&v>=2)&&"t9i1gyb"),children:(0,l.jsx)("a",{className:"t9i1gyd",href:c??d,"data-pswp-height":f??300,"data-pswp-width":m??300,onClick:e=>{e.stopPropagation()},children:(0,l.jsx)(_.default,{className:(0,a.default)("t9i1gy9",i&&"t9i1gyc"),height:i?f??y:void 0,width:i?m??y:void 0,sizes:`${i?m??y:y}px`,src:d,alt:p??"",unoptimized:!0})})});return r?(0,l.jsx)(J,{children:b}):b};var G=e.i(391228),Y={full:"phfdzx1 phfdzx0",compact:"phfdzx2 phfdzx0",medium:"phfdzx3 phfdzx0",preview:"phfdzx4 phfdzx0"};e.s(["default",0,({attachment:e,contentID:t,onRemove:n,type:r=o.full,overlayText:s,onDimensionsChange:u,onPersistDimensions:d,includeLightbox:h=!1,displayAtOriginalRatio:p=!1,singleAttachment:f=!0,linkOverride:m})=>{let g=(0,l.jsx)("div",{className:"phfdzx7",children:(0,l.jsx)("p",{children:"Unable to load attachment"})});return e.type===i.Link&&(g=(0,l.jsx)(W,{attachment:e,type:r})),(e.type===i.Twitter||e.type===i.Youtube||e.type===i.Instagram||e.type===i.TikTok||e.type===i.Bluesky)&&(g=(0,l.jsx)(S,{contentID:t,attachment:e,type:r,onDimensionsChange:e=>{u&&u(e)},onPersistDimensions:d})),e.type===i.Upload&&(g=(0,l.jsx)(Z,{attachment:e,type:r,overlayText:s,includeLightbox:h,displayAtOriginalRatio:p,singleAttachment:f,linkOverride:m})),e.type===i.GIF&&(g=(0,l.jsx)(T,{attachment:e,type:r})),e.type===i.ImageLink&&(g=(0,l.jsx)(R,{attachment:e,type:r,onError:()=>{n&&n(null)}})),(0,l.jsxs)("div",{className:(0,a.default)(Y[r],e.type===i.ImageLink&&"phfdzx5"),children:[n&&(0,l.jsx)(c.default,{iconLeft:(0,l.jsx)(G.default,{width:16,height:16}),text:"",onClick:e=>n(e),className:"phfdzx6",displayType:"cyclone"}),g]})}],249922),e.s([],555831)},640978,e=>{"use strict";var t,n;(n=t||(t={})).compact="compact",n.full="full",e.s(["FanPostCardDisplayType",0,t])},322532,e=>{"use strict";var t=e.i(478902);e.s(["default",0,({className:e="",width:n=24,height:r=24,fill:i="currentColor"})=>(0,t.jsxs)("svg",{className:e,width:n,height:r,viewBox:"0 0 960 960",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("title",{children:"Star"}),(0,t.jsx)("path",{d:"M233 840l65-281L80 370l288-25 112-265 112 265 288 25-218 189 65 281-247-149L233 840Z",fill:i})]})])},553662,e=>{"use strict";let t=e=>`${e||""}/post/`;e.s(["getCommunityAdvancedEditorPath",0,e=>`${e||""}/post/new`,"getCommunityFeedPath",0,e=>`${e||""}/feed`,"getCommunityPostPath",0,(e,n)=>`${t(n)}${e}`,"getCommunityPostReplyPath",0,(e,n,r)=>`${t(r)}${e}/reply/${n}`])}]);
80
81//# debugId=214e3156-40cb-1826-41c8-2295538d06e3
82//# sourceMappingURL=28g9s1-d7y-4u.js.map

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.