diff --git a/js/BrowserStorage-D8B0KvVv.chunk.mjs b/js/BrowserStorage-D8B0KvVv.chunk.mjs deleted file mode 100644 index 5f257d301..000000000 --- a/js/BrowserStorage-D8B0KvVv.chunk.mjs +++ /dev/null @@ -1,2 +0,0 @@ -import{ag as o}from"./_plugin-vue_export-helper-CH0UJGgl.chunk.mjs";const i=o("notifications").clearOnLogout().persist().build();export{i as B}; -//# sourceMappingURL=BrowserStorage-D8B0KvVv.chunk.mjs.map diff --git a/js/BrowserStorage-Dp9iRanT.chunk.mjs b/js/BrowserStorage-Dp9iRanT.chunk.mjs new file mode 100644 index 000000000..14ef9a0fa --- /dev/null +++ b/js/BrowserStorage-Dp9iRanT.chunk.mjs @@ -0,0 +1,2 @@ +import{ag as o}from"./_plugin-vue_export-helper-DqxYO0VT.chunk.mjs";const i=o("notifications").clearOnLogout().persist().build();export{i as B}; +//# sourceMappingURL=BrowserStorage-Dp9iRanT.chunk.mjs.map diff --git a/js/BrowserStorage-D8B0KvVv.chunk.mjs.license b/js/BrowserStorage-Dp9iRanT.chunk.mjs.license similarity index 100% rename from js/BrowserStorage-D8B0KvVv.chunk.mjs.license rename to js/BrowserStorage-Dp9iRanT.chunk.mjs.license diff --git a/js/BrowserStorage-D8B0KvVv.chunk.mjs.map b/js/BrowserStorage-Dp9iRanT.chunk.mjs.map similarity index 87% rename from js/BrowserStorage-D8B0KvVv.chunk.mjs.map rename to js/BrowserStorage-Dp9iRanT.chunk.mjs.map index 508cfbaf4..532ce6785 100644 --- a/js/BrowserStorage-D8B0KvVv.chunk.mjs.map +++ b/js/BrowserStorage-Dp9iRanT.chunk.mjs.map @@ -1 +1 @@ -{"version":3,"file":"BrowserStorage-D8B0KvVv.chunk.mjs","sources":["../src/services/BrowserStorage.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { getBuilder } from '@nextcloud/browser-storage'\n\nexport default getBuilder('notifications').clearOnLogout().persist().build()\n"],"names":["BrowserStorage","getBuilder"],"mappings":"oEAOA,MAAAA,EAAeC,EAAW,eAAe,EAAE,cAAa,EAAG,QAAO,EAAG,MAAK"} \ No newline at end of file +{"version":3,"file":"BrowserStorage-Dp9iRanT.chunk.mjs","sources":["../src/services/BrowserStorage.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { getBuilder } from '@nextcloud/browser-storage'\n\nexport default getBuilder('notifications').clearOnLogout().persist().build()\n"],"names":["BrowserStorage","getBuilder"],"mappings":"oEAOA,MAAAA,EAAeC,EAAW,eAAe,EAAE,cAAa,EAAG,QAAO,EAAG,MAAK"} \ No newline at end of file diff --git a/js/BrowserStorage-D8B0KvVv.chunk.mjs.map.license b/js/BrowserStorage-Dp9iRanT.chunk.mjs.map.license similarity index 100% rename from js/BrowserStorage-D8B0KvVv.chunk.mjs.map.license rename to js/BrowserStorage-Dp9iRanT.chunk.mjs.map.license diff --git a/js/NcProfileHoverCard-EthqH19m.chunk.mjs b/js/NcProfileHoverCard-DsPWCnY_.chunk.mjs similarity index 97% rename from js/NcProfileHoverCard-EthqH19m.chunk.mjs rename to js/NcProfileHoverCard-DsPWCnY_.chunk.mjs index 5ae3a32c4..475c7416f 100644 --- a/js/NcProfileHoverCard-EthqH19m.chunk.mjs +++ b/js/NcProfileHoverCard-DsPWCnY_.chunk.mjs @@ -1,2 +1,2 @@ -import{d as A,a4 as ne,c as F,g as P,K as W,U as E,n as g,ab as j,G,e as K,ac as oe,an as ue,ao as R,r as ce,ap as de}from"./_plugin-vue_export-helper-CH0UJGgl.chunk.mjs";import{g as ve,N as Y,b as fe,d as pe,e as he,f as _e,h as ge}from"./NotificationsApp-CtR4ZZxS.chunk.mjs";import{l as me,j as z,v as S,R as ye,o as i,e as r,g as y,u as h,F as M,b as o,a as m,w as C,f as u,t as d,N as q,n as J,h as w,p as b,I as ke,C as Ce,k}from"./style-Blm0XmjK.chunk.mjs";import"./vite-preload-helper-DxYC2qmj.chunk.mjs";import"./BrowserStorage-D8B0KvVv.chunk.mjs";const be={name:"AccountOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},we=["aria-hidden","aria-label"],Ae=["fill","width","height"],ze={d:"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z"},Se={key:0};function Me(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon account-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",ze,[t.title?(i(),r("title",Se,d(t.title),1)):u("",!0)])],8,Ae))],16,we)}const Ie=A(be,[["render",Me]]),Le={name:"BriefcaseOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ve=["aria-hidden","aria-label"],Ue=["fill","width","height"],xe={d:"M20,6C20.58,6 21.05,6.2 21.42,6.59C21.8,7 22,7.45 22,8V19C22,19.55 21.8,20 21.42,20.41C21.05,20.8 20.58,21 20,21H4C3.42,21 2.95,20.8 2.58,20.41C2.2,20 2,19.55 2,19V8C2,7.45 2.2,7 2.58,6.59C2.95,6.2 3.42,6 4,6H8V4C8,3.42 8.2,2.95 8.58,2.58C8.95,2.2 9.42,2 10,2H14C14.58,2 15.05,2.2 15.42,2.58C15.8,2.95 16,3.42 16,4V6H20M4,8V19H20V8H4M14,6V4H10V6H14Z"},He={key:0};function Ne(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon briefcase-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",xe,[t.title?(i(),r("title",He,d(t.title),1)):u("",!0)])],8,Ue))],16,Ve)}const $e=A(Le,[["render",Ne]]),Be={name:"ClockOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Oe=["aria-hidden","aria-label"],Te=["fill","width","height"],Ze={d:"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z"},De={key:0};function Fe(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon clock-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",Ze,[t.title?(i(),r("title",De,d(t.title),1)):u("",!0)])],8,Te))],16,Oe)}const Pe=A(Be,[["render",Fe]]),We={name:"MapMarkerOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ee=["aria-hidden","aria-label"],je=["fill","width","height"],Ge={d:"M12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5M12,2A7,7 0 0,1 19,9C19,14.25 12,22 12,22C12,22 5,14.25 5,9A7,7 0 0,1 12,2M12,4A5,5 0 0,0 7,9C7,10 7,12 12,18.71C17,12 17,10 17,9A5,5 0 0,0 12,4Z"},Ke={key:0};function Re(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon map-marker-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",Ge,[t.title?(i(),r("title",Ke,d(t.title),1)):u("",!0)])],8,je))],16,Ee)}const Ye=A(We,[["render",Re]]),qe={name:"PencilOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Je=["aria-hidden","aria-label"],Qe=["fill","width","height"],Xe={d:"M14.06,9L15,9.94L5.92,19H5V18.08L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z"},ea={key:0};function aa(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon pencil-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",Xe,[t.title?(i(),r("title",ea,d(t.title),1)):u("",!0)])],8,Qe))],16,Je)}const ta=A(qe,[["render",aa]]);ce(de);const Q=1800*1e3,N=new Map,H=new Map;function X(s){const a=N.get(s);return a?Date.now()>=a.expiresAt?(N.delete(s),null):a.data:null}function I(s,a,t=Q){N.set(s,{data:a,expiresAt:Date.now()+t})}async function la(s,a,t=Q){const f=X(s);if(f)return f;const l=H.get(s);if(l)return l;const n=(async()=>{try{const c=await a();return c&&I(s,c,t),c}finally{H.delete(s)}})();return H.set(s,n),n}const ia=["aria-label"],ra={key:0,class:"profile-hover-card__loading"},sa={class:"profile-hover-card__header"},na={class:"profile-hover-card__header__container"},oa={key:1,class:"profile-hover-card__header__container__placeholder"},ua={class:"profile-hover-card__header__container__identity"},ca={class:"profile-hover-card__header__container__displayname"},da={key:0,class:"profile-hover-card__header__container__pronoun-separator"},va={key:1,class:"profile-hover-card__header__container__pronouns"},fa={key:0,class:"profile-hover-card__header__container__status"},pa={class:"profile-hover-card__header__container__status-content"},ha={class:"profile-hover-card__body"},_a={class:"profile-hover-card__content"},ga={class:"profile-hover-card__sidebar"},ma={class:"user-actions"},ya={key:0,class:"user-actions__loading"},ka=["src"],Ca=["src"],ba={class:"profile-hover-card__blocks"},wa={key:0,class:"profile-hover-card__blocks-details"},Aa={key:0,class:"detail"},za={key:0},Sa={key:1,class:"detail"},Ma={key:2,class:"detail"},Ia={key:0,class:"profile-hover-card__blocks-headline"},La={key:1,class:"profile-hover-card__blocks-biography"},Va={key:2,class:"profile-hover-card__error"},Ua=me({__name:"NcProfileHoverCard",props:{user:{default:null},profile:{default:null},preloadedUserStatus:{default:null},open:{type:Boolean,default:!1},actions:{default:null},actionsLoading:{type:Boolean,default:!1}},setup(s){const a=s,t=z(!1),f=z(!1),l=z(a.profile),n=z(a.preloadedUserStatus??{}),c=ue();a.user&&a.profile&&I(a.user,a.profile);const $=k(()=>!!a.user&&E()?.uid===a.user),ee=ne("/settings/user"),L=k(()=>a.actions&&a.actions.length>0?a.actions.filter(e=>e.appId!=="timezone"):(l.value?.actions??[]).filter(e=>e.appId!=="timezone").map(e=>({id:e.id,appId:e.appId,text:e.title,href:e.target||void 0,icon:e.icon,target:e.id==="phone"?"_self":"_blank",rel:e.id==="fediverse"?"me":void 0}))),V=k(()=>{const e=le(new Date);return e?g("Local time: {time}",{time:e}):null}),_=k(()=>L.value[0]),B=k(()=>L.value.slice(1)),ae=k(()=>{const e=_.value;return e?e.to?{to:e.to}:e.href?{href:e.href,target:e.target??(e.href.startsWith("tel:")?"_self":"_blank"),rel:e.rel}:{}:{}}),te=k(()=>{if($.value)return g("You have not added any info yet");const e=l.value?.displayname||a.user||"";return g("{user} has not added any info yet",{user:e})}),O=k(()=>({status:n.value.status??null,icon:n.value.icon??null,message:n.value.message??null}));function le(e){const p=l.value?.timezone;if(p)try{return new Intl.DateTimeFormat(R(),{timeZone:p,hour:"2-digit",minute:"2-digit"}).format(e)}catch{}if(typeof l.value?.timezoneOffset=="number"){const v=new Date(e.getTime()+l.value.timezoneOffset*1e3);return new Intl.DateTimeFormat(R(),{timeZone:"UTC",hour:"2-digit",minute:"2-digit"}).format(v)}return null}function T(e){return!!e&&(/^(https?:)?\/\//.test(e)||e.startsWith("/")||e.startsWith("data:"))}function ie(e){return e.to?he:e.onClick&&!e.href?_e:ge}function re(e){return e.to?{to:e.to,closeAfterClick:!0}:e.onClick&&!e.href?{onClick:e.onClick,closeAfterClick:!0}:{href:e.href,target:e.target??(e.href?.startsWith("tel:")?"_self":"_blank"),rel:e.rel,closeAfterClick:!0}}S(()=>a.profile,e=>{e&&(l.value=e,a.user&&I(a.user,e),f.value=!1)}),S(()=>a.preloadedUserStatus,e=>{e&&(n.value=e)}),S(()=>a.user,()=>{l.value=a.profile,n.value=a.preloadedUserStatus??{},f.value=!1,a.user&&a.profile&&I(a.user,a.profile),a.open&&U()}),S(()=>a.open,e=>{e&&U()}),ye(()=>{a.open&&U()});function Z(){return a.preloadedUserStatus!==null||!!(n.value.icon||n.value.message||n.value.status)}async function se(e){Z()||(n.value=await D(e))}async function U(){if(!a.user||t.value)return;const e=a.user;if(!l.value){const p=X(e);p&&(l.value=p)}if(l.value){await se(e);return}t.value=!0,f.value=!1;try{const[p,v]=await Promise.all([la(e,async()=>{const{data:x}=await F.get(P("/profile/{userId}",{userId:e}));return x.ocs?.data??null}),Z()?Promise.resolve(n.value):D(e)]);l.value=p,n.value=v,l.value||(f.value=!0)}catch(p){W.debug("Failed to load profile for hovercard",{error:p,user:e}),f.value=!0}finally{t.value=!1}}async function D(e){try{if(!ve()?.user_status?.enabled||!E())return{};const{data:p}=await F.get(P("/apps/user_status/api/v1/statuses/{userId}",{userId:e}));return p.ocs?.data??{}}catch(p){return W.debug("Failed to load user status for hovercard",{error:p,userId:e}),{}}}return(e,p)=>(i(),r("div",{class:"profile-hover-card",role:"dialog","aria-label":h(g)("Profile of {user}",{user:l.value?.displayname||s.user||""})},[t.value?(i(),r("div",ra,[y(j,{size:32,name:h(g)("Loading profile")},null,8,["name"])])):l.value&&!f.value?(i(),r(M,{key:1},[o("div",sa,[$.value?(i(),m(G,{key:0,class:"profile-hover-card__header__edit",variant:"tertiary","aria-label":h(g)("Edit profile"),title:h(g)("Edit profile"),href:h(ee),target:"_blank"},{icon:C(()=>[y(ta,{size:20})]),_:1},8,["aria-label","title","href"])):u("",!0),o("div",na,[h(c)?(i(),m(Y,{key:0,class:"avatar profile-hover-card__header__container__avatar",user:l.value.userId,size:96,disableMenu:"",disableTooltip:"",preloadedUserStatus:O.value,isNoUser:!l.value.isUserAvatarVisible},null,8,["user","preloadedUserStatus","isNoUser"])):(i(),r("div",oa)),o("div",ua,[o("div",ca,[o("h2",null,d(l.value.displayname||l.value.userId),1),l.value.pronouns?(i(),r("span",da,"·")):u("",!0),l.value.pronouns?(i(),r("span",va,d(l.value.pronouns),1)):u("",!0)]),n.value.icon||n.value.message?(i(),r("div",fa,[o("span",pa,[o("span",null,d(n.value.icon)+" "+d(n.value.message),1)])])):u("",!0)])])]),o("div",ha,[o("div",_a,[o("div",ga,[h(c)?u("",!0):(i(),m(Y,{key:0,class:"avatar",user:l.value.userId,size:135,disableMenu:"",disableTooltip:"",preloadedUserStatus:O.value,isNoUser:!l.value.isUserAvatarVisible},null,8,["user","preloadedUserStatus","isNoUser"])),o("div",ma,[s.actionsLoading&&L.value.length===0?(i(),r("div",ya,[y(j,{size:20,name:h(g)("Loading actions")},null,8,["name"])])):(i(),r(M,{key:1},[_.value?(i(),m(G,b({key:0,variant:"primary",class:"user-actions__primary"},ae.value,{onClick:_.value.onClick}),q({default:C(()=>[w(" "+d(_.value.text),1)]),_:2},[_.value.iconSvg||_.value.icon?{name:"icon",fn:C(()=>[_.value.iconSvg?(i(),m(h(K),{key:0,svg:_.value.iconSvg},null,8,["svg"])):T(_.value.icon)?(i(),r("img",{key:1,src:_.value.icon,alt:"",class:"user-actions__primary__icon"},null,8,ka)):(i(),r("span",{key:2,"aria-hidden":"true",class:J(["user-actions__primary__icon-class",_.value.icon])},null,2))]),key:"0"}:void 0]),1040,["onClick"])):u("",!0),B.value.length>0?(i(),m(oe,{key:1,class:"user-actions__other",inline:h(c)?5:4},{default:C(()=>[(i(!0),r(M,null,ke(B.value,(v,x)=>(i(),m(Ce(ie(v)),b({key:v.id||v.href||x},{ref_for:!0},re(v)),q({default:C(()=>[w(" "+d(v.text),1)]),_:2},[v.iconSvg||v.icon?{name:"icon",fn:C(()=>[v.iconSvg?(i(),m(h(K),{key:0,svg:v.iconSvg},null,8,["svg"])):T(v.icon)?(i(),r("img",{key:1,src:v.icon,alt:"",class:"user-actions__other__icon"},null,8,Ca)):(i(),r("span",{key:2,"aria-hidden":"true",class:J(["user-actions__other__icon-class",v.icon])},null,2))]),key:"0"}:void 0]),1040))),128))]),_:1},8,["inline"])):u("",!0)],64))])]),o("div",ba,[l.value.organisation||l.value.role||l.value.address||V.value?(i(),r("div",wa,[l.value.organisation||l.value.role?(i(),r("div",Aa,[o("p",null,[y($e,{class:"detail-icon",size:16,title:""}),w(" "+d(l.value.organisation)+" ",1),l.value.organisation&&l.value.role?(i(),r("span",za,"•")):u("",!0),w(" "+d(l.value.role),1)])])):u("",!0),l.value.address?(i(),r("div",Sa,[o("p",null,[y(Ye,{class:"detail-icon",size:16,title:""}),w(" "+d(l.value.address),1)])])):u("",!0),V.value?(i(),r("div",Ma,[o("p",null,[y(Pe,{class:"detail-icon",size:16,title:""}),w(" "+d(V.value),1)])])):u("",!0)])):u("",!0),l.value.headline||l.value.biography?(i(),r(M,{key:1},[l.value.headline?(i(),r("h3",Ia,d(l.value.headline),1)):u("",!0),l.value.biography?(i(),r("div",La,[y(fe,{text:l.value.biography,useExtendedMarkdown:""},null,8,["text"])])):u("",!0)],64)):(i(),m(pe,{key:2,class:"profile-hover-card__blocks-empty-info",name:te.value,description:h(g)("The headline and about sections will show up here")},{icon:C(()=>[y(Ie,{size:40})]),_:1},8,["name","description"]))])])])],64)):(i(),r("div",Va,d(h(g)("Failed to load profile")),1))],8,ia))}}),Oa=A(Ua,[["__scopeId","data-v-dc040af1"]]);export{Oa as default}; -//# sourceMappingURL=NcProfileHoverCard-EthqH19m.chunk.mjs.map +import{d as A,a4 as ne,c as F,g as P,K as W,U as E,n as g,ab as j,G,e as K,ac as oe,an as ue,ao as R,r as ce,ap as de}from"./_plugin-vue_export-helper-DqxYO0VT.chunk.mjs";import{g as ve,N as Y,b as fe,d as pe,e as he,f as _e,h as ge}from"./NotificationsApp-AOJLgejJ.chunk.mjs";import{l as me,j as z,v as S,R as ye,o as i,e as r,g as y,u as h,F as M,b as o,a as m,w as C,f as u,t as d,N as q,n as J,h as w,p as b,I as ke,C as Ce,k}from"./style-D66n12eC.chunk.mjs";import"./vite-preload-helper-DxYC2qmj.chunk.mjs";import"./BrowserStorage-Dp9iRanT.chunk.mjs";const be={name:"AccountOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},we=["aria-hidden","aria-label"],Ae=["fill","width","height"],ze={d:"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z"},Se={key:0};function Me(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon account-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",ze,[t.title?(i(),r("title",Se,d(t.title),1)):u("",!0)])],8,Ae))],16,we)}const Ie=A(be,[["render",Me]]),Le={name:"BriefcaseOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ve=["aria-hidden","aria-label"],Ue=["fill","width","height"],xe={d:"M20,6C20.58,6 21.05,6.2 21.42,6.59C21.8,7 22,7.45 22,8V19C22,19.55 21.8,20 21.42,20.41C21.05,20.8 20.58,21 20,21H4C3.42,21 2.95,20.8 2.58,20.41C2.2,20 2,19.55 2,19V8C2,7.45 2.2,7 2.58,6.59C2.95,6.2 3.42,6 4,6H8V4C8,3.42 8.2,2.95 8.58,2.58C8.95,2.2 9.42,2 10,2H14C14.58,2 15.05,2.2 15.42,2.58C15.8,2.95 16,3.42 16,4V6H20M4,8V19H20V8H4M14,6V4H10V6H14Z"},He={key:0};function Ne(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon briefcase-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",xe,[t.title?(i(),r("title",He,d(t.title),1)):u("",!0)])],8,Ue))],16,Ve)}const $e=A(Le,[["render",Ne]]),Be={name:"ClockOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Oe=["aria-hidden","aria-label"],Te=["fill","width","height"],Ze={d:"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z"},De={key:0};function Fe(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon clock-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",Ze,[t.title?(i(),r("title",De,d(t.title),1)):u("",!0)])],8,Te))],16,Oe)}const Pe=A(Be,[["render",Fe]]),We={name:"MapMarkerOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ee=["aria-hidden","aria-label"],je=["fill","width","height"],Ge={d:"M12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5M12,2A7,7 0 0,1 19,9C19,14.25 12,22 12,22C12,22 5,14.25 5,9A7,7 0 0,1 12,2M12,4A5,5 0 0,0 7,9C7,10 7,12 12,18.71C17,12 17,10 17,9A5,5 0 0,0 12,4Z"},Ke={key:0};function Re(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon map-marker-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",Ge,[t.title?(i(),r("title",Ke,d(t.title),1)):u("",!0)])],8,je))],16,Ee)}const Ye=A(We,[["render",Re]]),qe={name:"PencilOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Je=["aria-hidden","aria-label"],Qe=["fill","width","height"],Xe={d:"M14.06,9L15,9.94L5.92,19H5V18.08L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z"},ea={key:0};function aa(s,a,t,f,l,n){return i(),r("span",b(s.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon pencil-outline-icon",role:"img",onClick:a[0]||(a[0]=c=>s.$emit("click",c))}),[(i(),r("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[o("path",Xe,[t.title?(i(),r("title",ea,d(t.title),1)):u("",!0)])],8,Qe))],16,Je)}const ta=A(qe,[["render",aa]]);ce(de);const Q=1800*1e3,N=new Map,H=new Map;function X(s){const a=N.get(s);return a?Date.now()>=a.expiresAt?(N.delete(s),null):a.data:null}function I(s,a,t=Q){N.set(s,{data:a,expiresAt:Date.now()+t})}async function la(s,a,t=Q){const f=X(s);if(f)return f;const l=H.get(s);if(l)return l;const n=(async()=>{try{const c=await a();return c&&I(s,c,t),c}finally{H.delete(s)}})();return H.set(s,n),n}const ia=["aria-label"],ra={key:0,class:"profile-hover-card__loading"},sa={class:"profile-hover-card__header"},na={class:"profile-hover-card__header__container"},oa={key:1,class:"profile-hover-card__header__container__placeholder"},ua={class:"profile-hover-card__header__container__identity"},ca={class:"profile-hover-card__header__container__displayname"},da={key:0,class:"profile-hover-card__header__container__pronoun-separator"},va={key:1,class:"profile-hover-card__header__container__pronouns"},fa={key:0,class:"profile-hover-card__header__container__status"},pa={class:"profile-hover-card__header__container__status-content"},ha={class:"profile-hover-card__body"},_a={class:"profile-hover-card__content"},ga={class:"profile-hover-card__sidebar"},ma={class:"user-actions"},ya={key:0,class:"user-actions__loading"},ka=["src"],Ca=["src"],ba={class:"profile-hover-card__blocks"},wa={key:0,class:"profile-hover-card__blocks-details"},Aa={key:0,class:"detail"},za={key:0},Sa={key:1,class:"detail"},Ma={key:2,class:"detail"},Ia={key:0,class:"profile-hover-card__blocks-headline"},La={key:1,class:"profile-hover-card__blocks-biography"},Va={key:2,class:"profile-hover-card__error"},Ua=me({__name:"NcProfileHoverCard",props:{user:{default:null},profile:{default:null},preloadedUserStatus:{default:null},open:{type:Boolean,default:!1},actions:{default:null},actionsLoading:{type:Boolean,default:!1}},setup(s){const a=s,t=z(!1),f=z(!1),l=z(a.profile),n=z(a.preloadedUserStatus??{}),c=ue();a.user&&a.profile&&I(a.user,a.profile);const $=k(()=>!!a.user&&E()?.uid===a.user),ee=ne("/settings/user"),L=k(()=>a.actions&&a.actions.length>0?a.actions.filter(e=>e.appId!=="timezone"):(l.value?.actions??[]).filter(e=>e.appId!=="timezone").map(e=>({id:e.id,appId:e.appId,text:e.title,href:e.target||void 0,icon:e.icon,target:e.id==="phone"?"_self":"_blank",rel:e.id==="fediverse"?"me":void 0}))),V=k(()=>{const e=le(new Date);return e?g("Local time: {time}",{time:e}):null}),_=k(()=>L.value[0]),B=k(()=>L.value.slice(1)),ae=k(()=>{const e=_.value;return e?e.to?{to:e.to}:e.href?{href:e.href,target:e.target??(e.href.startsWith("tel:")?"_self":"_blank"),rel:e.rel}:{}:{}}),te=k(()=>{if($.value)return g("You have not added any info yet");const e=l.value?.displayname||a.user||"";return g("{user} has not added any info yet",{user:e})}),O=k(()=>({status:n.value.status??null,icon:n.value.icon??null,message:n.value.message??null}));function le(e){const p=l.value?.timezone;if(p)try{return new Intl.DateTimeFormat(R(),{timeZone:p,hour:"2-digit",minute:"2-digit"}).format(e)}catch{}if(typeof l.value?.timezoneOffset=="number"){const v=new Date(e.getTime()+l.value.timezoneOffset*1e3);return new Intl.DateTimeFormat(R(),{timeZone:"UTC",hour:"2-digit",minute:"2-digit"}).format(v)}return null}function T(e){return!!e&&(/^(https?:)?\/\//.test(e)||e.startsWith("/")||e.startsWith("data:"))}function ie(e){return e.to?he:e.onClick&&!e.href?_e:ge}function re(e){return e.to?{to:e.to,closeAfterClick:!0}:e.onClick&&!e.href?{onClick:e.onClick,closeAfterClick:!0}:{href:e.href,target:e.target??(e.href?.startsWith("tel:")?"_self":"_blank"),rel:e.rel,closeAfterClick:!0}}S(()=>a.profile,e=>{e&&(l.value=e,a.user&&I(a.user,e),f.value=!1)}),S(()=>a.preloadedUserStatus,e=>{e&&(n.value=e)}),S(()=>a.user,()=>{l.value=a.profile,n.value=a.preloadedUserStatus??{},f.value=!1,a.user&&a.profile&&I(a.user,a.profile),a.open&&U()}),S(()=>a.open,e=>{e&&U()}),ye(()=>{a.open&&U()});function Z(){return a.preloadedUserStatus!==null||!!(n.value.icon||n.value.message||n.value.status)}async function se(e){Z()||(n.value=await D(e))}async function U(){if(!a.user||t.value)return;const e=a.user;if(!l.value){const p=X(e);p&&(l.value=p)}if(l.value){await se(e);return}t.value=!0,f.value=!1;try{const[p,v]=await Promise.all([la(e,async()=>{const{data:x}=await F.get(P("/profile/{userId}",{userId:e}));return x.ocs?.data??null}),Z()?Promise.resolve(n.value):D(e)]);l.value=p,n.value=v,l.value||(f.value=!0)}catch(p){W.debug("Failed to load profile for hovercard",{error:p,user:e}),f.value=!0}finally{t.value=!1}}async function D(e){try{if(!ve()?.user_status?.enabled||!E())return{};const{data:p}=await F.get(P("/apps/user_status/api/v1/statuses/{userId}",{userId:e}));return p.ocs?.data??{}}catch(p){return W.debug("Failed to load user status for hovercard",{error:p,userId:e}),{}}}return(e,p)=>(i(),r("div",{class:"profile-hover-card",role:"dialog","aria-label":h(g)("Profile of {user}",{user:l.value?.displayname||s.user||""})},[t.value?(i(),r("div",ra,[y(j,{size:32,name:h(g)("Loading profile")},null,8,["name"])])):l.value&&!f.value?(i(),r(M,{key:1},[o("div",sa,[$.value?(i(),m(G,{key:0,class:"profile-hover-card__header__edit",variant:"tertiary","aria-label":h(g)("Edit profile"),title:h(g)("Edit profile"),href:h(ee),target:"_blank"},{icon:C(()=>[y(ta,{size:20})]),_:1},8,["aria-label","title","href"])):u("",!0),o("div",na,[h(c)?(i(),m(Y,{key:0,class:"avatar profile-hover-card__header__container__avatar",user:l.value.userId,size:96,disableMenu:"",disableTooltip:"",preloadedUserStatus:O.value,isNoUser:!l.value.isUserAvatarVisible},null,8,["user","preloadedUserStatus","isNoUser"])):(i(),r("div",oa)),o("div",ua,[o("div",ca,[o("h2",null,d(l.value.displayname||l.value.userId),1),l.value.pronouns?(i(),r("span",da,"·")):u("",!0),l.value.pronouns?(i(),r("span",va,d(l.value.pronouns),1)):u("",!0)]),n.value.icon||n.value.message?(i(),r("div",fa,[o("span",pa,[o("span",null,d(n.value.icon)+" "+d(n.value.message),1)])])):u("",!0)])])]),o("div",ha,[o("div",_a,[o("div",ga,[h(c)?u("",!0):(i(),m(Y,{key:0,class:"avatar",user:l.value.userId,size:135,disableMenu:"",disableTooltip:"",preloadedUserStatus:O.value,isNoUser:!l.value.isUserAvatarVisible},null,8,["user","preloadedUserStatus","isNoUser"])),o("div",ma,[s.actionsLoading&&L.value.length===0?(i(),r("div",ya,[y(j,{size:20,name:h(g)("Loading actions")},null,8,["name"])])):(i(),r(M,{key:1},[_.value?(i(),m(G,b({key:0,variant:"primary",class:"user-actions__primary"},ae.value,{onClick:_.value.onClick}),q({default:C(()=>[w(" "+d(_.value.text),1)]),_:2},[_.value.iconSvg||_.value.icon?{name:"icon",fn:C(()=>[_.value.iconSvg?(i(),m(h(K),{key:0,svg:_.value.iconSvg},null,8,["svg"])):T(_.value.icon)?(i(),r("img",{key:1,src:_.value.icon,alt:"",class:"user-actions__primary__icon"},null,8,ka)):(i(),r("span",{key:2,"aria-hidden":"true",class:J(["user-actions__primary__icon-class",_.value.icon])},null,2))]),key:"0"}:void 0]),1040,["onClick"])):u("",!0),B.value.length>0?(i(),m(oe,{key:1,class:"user-actions__other",inline:h(c)?5:4},{default:C(()=>[(i(!0),r(M,null,ke(B.value,(v,x)=>(i(),m(Ce(ie(v)),b({key:v.id||v.href||x},{ref_for:!0},re(v)),q({default:C(()=>[w(" "+d(v.text),1)]),_:2},[v.iconSvg||v.icon?{name:"icon",fn:C(()=>[v.iconSvg?(i(),m(h(K),{key:0,svg:v.iconSvg},null,8,["svg"])):T(v.icon)?(i(),r("img",{key:1,src:v.icon,alt:"",class:"user-actions__other__icon"},null,8,Ca)):(i(),r("span",{key:2,"aria-hidden":"true",class:J(["user-actions__other__icon-class",v.icon])},null,2))]),key:"0"}:void 0]),1040))),128))]),_:1},8,["inline"])):u("",!0)],64))])]),o("div",ba,[l.value.organisation||l.value.role||l.value.address||V.value?(i(),r("div",wa,[l.value.organisation||l.value.role?(i(),r("div",Aa,[o("p",null,[y($e,{class:"detail-icon",size:16,title:""}),w(" "+d(l.value.organisation)+" ",1),l.value.organisation&&l.value.role?(i(),r("span",za,"•")):u("",!0),w(" "+d(l.value.role),1)])])):u("",!0),l.value.address?(i(),r("div",Sa,[o("p",null,[y(Ye,{class:"detail-icon",size:16,title:""}),w(" "+d(l.value.address),1)])])):u("",!0),V.value?(i(),r("div",Ma,[o("p",null,[y(Pe,{class:"detail-icon",size:16,title:""}),w(" "+d(V.value),1)])])):u("",!0)])):u("",!0),l.value.headline||l.value.biography?(i(),r(M,{key:1},[l.value.headline?(i(),r("h3",Ia,d(l.value.headline),1)):u("",!0),l.value.biography?(i(),r("div",La,[y(fe,{text:l.value.biography,useExtendedMarkdown:""},null,8,["text"])])):u("",!0)],64)):(i(),m(pe,{key:2,class:"profile-hover-card__blocks-empty-info",name:te.value,description:h(g)("The headline and about sections will show up here")},{icon:C(()=>[y(Ie,{size:40})]),_:1},8,["name","description"]))])])])],64)):(i(),r("div",Va,d(h(g)("Failed to load profile")),1))],8,ia))}}),Oa=A(Ua,[["__scopeId","data-v-dc040af1"]]);export{Oa as default}; +//# sourceMappingURL=NcProfileHoverCard-DsPWCnY_.chunk.mjs.map diff --git a/js/NcProfileHoverCard-EthqH19m.chunk.mjs.license b/js/NcProfileHoverCard-DsPWCnY_.chunk.mjs.license similarity index 100% rename from js/NcProfileHoverCard-EthqH19m.chunk.mjs.license rename to js/NcProfileHoverCard-DsPWCnY_.chunk.mjs.license diff --git a/js/NcProfileHoverCard-EthqH19m.chunk.mjs.map b/js/NcProfileHoverCard-DsPWCnY_.chunk.mjs.map similarity index 99% rename from js/NcProfileHoverCard-EthqH19m.chunk.mjs.map rename to js/NcProfileHoverCard-DsPWCnY_.chunk.mjs.map index 2ea42ede4..6b7c99c3a 100644 --- a/js/NcProfileHoverCard-EthqH19m.chunk.mjs.map +++ b/js/NcProfileHoverCard-DsPWCnY_.chunk.mjs.map @@ -1 +1 @@ -{"version":3,"file":"NcProfileHoverCard-EthqH19m.chunk.mjs","sources":["../node_modules/@nextcloud/vue/dist/chunks/NcProfileHoverCard.mjs"],"sourcesContent":["import '../assets/NcProfileHoverCard.css';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode, toDisplayString, createCommentVNode, defineComponent, ref, computed, watch, onMounted, unref, createVNode, Fragment, createBlock, withCtx, createSlots, createTextVNode, normalizeClass, renderList, resolveDynamicComponent } from \"vue\";\nimport { getCurrentUser } from \"@nextcloud/auth\";\nimport axios from \"@nextcloud/axios\";\nimport { getCapabilities } from \"@nextcloud/capabilities\";\nimport { getCanonicalLocale } from \"@nextcloud/l10n\";\nimport { generateUrl, generateOcsUrl } from \"@nextcloud/router\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { N as NcActionButton } from \"./NcActionButton.mjs\";\nimport { N as NcActionLink } from \"./NcActionLink.mjs\";\nimport { N as NcActionRouter } from \"./NcActionRouter.mjs\";\nimport { N as NcActions } from \"./NcActions.mjs\";\nimport { N as NcAvatar } from \"./NcAvatar.mjs\";\nimport { N as NcButton } from \"./NcButton.mjs\";\nimport { N as NcEmptyContent } from \"./NcEmptyContent.mjs\";\nimport { N as NcLoadingIcon } from \"./NcLoadingIcon.mjs\";\nimport { N as NcRichText } from \"./NcRichText.mjs\";\nimport { useIsSmallMobile } from \"../composables/useIsMobile/index.mjs\";\nimport { r as register, Q as t1, a as t } from \"./_l10n.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper.mjs\";\nconst _sfc_main$5 = {\n name: \"AccountOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$5 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$5 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$5 = { d: \"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z\" };\nconst _hoisted_4$5 = { key: 0 };\nfunction _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon account-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$5, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$5, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$5))\n ], 16, _hoisted_1$5);\n}\nconst AccountIcon = /* @__PURE__ */ _export_sfc(_sfc_main$5, [[\"render\", _sfc_render$4]]);\nconst _sfc_main$4 = {\n name: \"BriefcaseOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$4 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$4 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$4 = { d: \"M20,6C20.58,6 21.05,6.2 21.42,6.59C21.8,7 22,7.45 22,8V19C22,19.55 21.8,20 21.42,20.41C21.05,20.8 20.58,21 20,21H4C3.42,21 2.95,20.8 2.58,20.41C2.2,20 2,19.55 2,19V8C2,7.45 2.2,7 2.58,6.59C2.95,6.2 3.42,6 4,6H8V4C8,3.42 8.2,2.95 8.58,2.58C8.95,2.2 9.42,2 10,2H14C14.58,2 15.05,2.2 15.42,2.58C15.8,2.95 16,3.42 16,4V6H20M4,8V19H20V8H4M14,6V4H10V6H14Z\" };\nconst _hoisted_4$4 = { key: 0 };\nfunction _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon briefcase-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$4, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$4, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$4))\n ], 16, _hoisted_1$4);\n}\nconst BriefcaseIcon = /* @__PURE__ */ _export_sfc(_sfc_main$4, [[\"render\", _sfc_render$3]]);\nconst _sfc_main$3 = {\n name: \"ClockOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$3 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$3 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$3 = { d: \"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\" };\nconst _hoisted_4$3 = { key: 0 };\nfunction _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon clock-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$3, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$3, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$3))\n ], 16, _hoisted_1$3);\n}\nconst ClockIcon = /* @__PURE__ */ _export_sfc(_sfc_main$3, [[\"render\", _sfc_render$2]]);\nconst _sfc_main$2 = {\n name: \"MapMarkerOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$2 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$2 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$2 = { d: \"M12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5M12,2A7,7 0 0,1 19,9C19,14.25 12,22 12,22C12,22 5,14.25 5,9A7,7 0 0,1 12,2M12,4A5,5 0 0,0 7,9C7,10 7,12 12,18.71C17,12 17,10 17,9A5,5 0 0,0 12,4Z\" };\nconst _hoisted_4$2 = { key: 0 };\nfunction _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon map-marker-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$2, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$2, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$2))\n ], 16, _hoisted_1$2);\n}\nconst MapMarkerIcon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render$1]]);\nconst _sfc_main$1 = {\n name: \"PencilOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$1 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$1 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$1 = { d: \"M14.06,9L15,9.94L5.92,19H5V18.08L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z\" };\nconst _hoisted_4$1 = { key: 0 };\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon pencil-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$1, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$1, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$1))\n ], 16, _hoisted_1$1);\n}\nconst PencilIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [[\"render\", _sfc_render]]);\nregister(t1);\n/*!\n * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst PROFILE_CACHE_TTL_MS = 30 * 60 * 1e3;\nconst cache = /* @__PURE__ */ new Map();\nconst inflight = /* @__PURE__ */ new Map();\nfunction getCachedProfile(userId) {\n const entry = cache.get(userId);\n if (!entry) {\n return null;\n }\n if (Date.now() >= entry.expiresAt) {\n cache.delete(userId);\n return null;\n }\n return entry.data;\n}\nfunction setCachedProfile(userId, data, ttlMs = PROFILE_CACHE_TTL_MS) {\n cache.set(userId, {\n data,\n expiresAt: Date.now() + ttlMs\n });\n}\nasync function fetchProfileCached(userId, fetcher, ttlMs = PROFILE_CACHE_TTL_MS) {\n const cached = getCachedProfile(userId);\n if (cached) {\n return cached;\n }\n const pending = inflight.get(userId);\n if (pending) {\n return pending;\n }\n const promise = (async () => {\n try {\n const data = await fetcher();\n if (data) {\n setCachedProfile(userId, data, ttlMs);\n }\n return data;\n } finally {\n inflight.delete(userId);\n }\n })();\n inflight.set(userId, promise);\n return promise;\n}\nconst _hoisted_1 = [\"aria-label\"];\nconst _hoisted_2 = {\n key: 0,\n class: \"profile-hover-card__loading\"\n};\nconst _hoisted_3 = { class: \"profile-hover-card__header\" };\nconst _hoisted_4 = { class: \"profile-hover-card__header__container\" };\nconst _hoisted_5 = {\n key: 1,\n class: \"profile-hover-card__header__container__placeholder\"\n};\nconst _hoisted_6 = { class: \"profile-hover-card__header__container__identity\" };\nconst _hoisted_7 = { class: \"profile-hover-card__header__container__displayname\" };\nconst _hoisted_8 = {\n key: 0,\n class: \"profile-hover-card__header__container__pronoun-separator\"\n};\nconst _hoisted_9 = {\n key: 1,\n class: \"profile-hover-card__header__container__pronouns\"\n};\nconst _hoisted_10 = {\n key: 0,\n class: \"profile-hover-card__header__container__status\"\n};\nconst _hoisted_11 = { class: \"profile-hover-card__header__container__status-content\" };\nconst _hoisted_12 = { class: \"profile-hover-card__body\" };\nconst _hoisted_13 = { class: \"profile-hover-card__content\" };\nconst _hoisted_14 = { class: \"profile-hover-card__sidebar\" };\nconst _hoisted_15 = { class: \"user-actions\" };\nconst _hoisted_16 = {\n key: 0,\n class: \"user-actions__loading\"\n};\nconst _hoisted_17 = [\"src\"];\nconst _hoisted_18 = [\"src\"];\nconst _hoisted_19 = { class: \"profile-hover-card__blocks\" };\nconst _hoisted_20 = {\n key: 0,\n class: \"profile-hover-card__blocks-details\"\n};\nconst _hoisted_21 = {\n key: 0,\n class: \"detail\"\n};\nconst _hoisted_22 = { key: 0 };\nconst _hoisted_23 = {\n key: 1,\n class: \"detail\"\n};\nconst _hoisted_24 = {\n key: 2,\n class: \"detail\"\n};\nconst _hoisted_25 = {\n key: 0,\n class: \"profile-hover-card__blocks-headline\"\n};\nconst _hoisted_26 = {\n key: 1,\n class: \"profile-hover-card__blocks-biography\"\n};\nconst _hoisted_27 = {\n key: 2,\n class: \"profile-hover-card__error\"\n};\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcProfileHoverCard\",\n props: {\n user: { default: null },\n profile: { default: null },\n preloadedUserStatus: { default: null },\n open: { type: Boolean, default: false },\n actions: { default: null },\n actionsLoading: { type: Boolean, default: false }\n },\n setup(__props) {\n const props = __props;\n const loading = ref(false);\n const error = ref(false);\n const profileData = ref(props.profile);\n const userStatus = ref(props.preloadedUserStatus ?? {});\n const isMobile = useIsSmallMobile();\n if (props.user && props.profile) {\n setCachedProfile(props.user, props.profile);\n }\n const isCurrentUser = computed(() => !!props.user && getCurrentUser()?.uid === props.user);\n const settingsUrl = generateUrl(\"/settings/user\");\n const resolvedActions = computed(() => {\n if (props.actions && props.actions.length > 0) {\n return props.actions.filter((action) => action.appId !== \"timezone\");\n }\n return (profileData.value?.actions ?? []).filter((action) => action.appId !== \"timezone\").map((action) => ({\n id: action.id,\n appId: action.appId,\n text: action.title,\n href: action.target || void 0,\n icon: action.icon,\n target: action.id === \"phone\" ? \"_self\" : \"_blank\",\n rel: action.id === \"fediverse\" ? \"me\" : void 0\n }));\n });\n const localTimeLabel = computed(() => {\n const time = formatProfileLocalTime(/* @__PURE__ */ new Date());\n if (!time) {\n return null;\n }\n return t(\"Local time: {time}\", { time });\n });\n const primaryAction = computed(() => resolvedActions.value[0]);\n const otherActions = computed(() => resolvedActions.value.slice(1));\n const primaryActionButtonProps = computed(() => {\n const action = primaryAction.value;\n if (!action) {\n return {};\n }\n if (action.to) {\n return { to: action.to };\n }\n if (action.href) {\n return {\n href: action.href,\n target: action.target ?? (action.href.startsWith(\"tel:\") ? \"_self\" : \"_blank\"),\n rel: action.rel\n };\n }\n return {};\n });\n const emptyProfileMessage = computed(() => {\n if (isCurrentUser.value) {\n return t(\"You have not added any info yet\");\n }\n const name = profileData.value?.displayname || props.user || \"\";\n return t(\"{user} has not added any info yet\", { user: name });\n });\n const avatarUserStatus = computed(() => ({\n status: userStatus.value.status ?? null,\n icon: userStatus.value.icon ?? null,\n message: userStatus.value.message ?? null\n }));\n function formatProfileLocalTime(date) {\n const timeZone = profileData.value?.timezone;\n if (timeZone) {\n try {\n return new Intl.DateTimeFormat(getCanonicalLocale(), {\n timeZone,\n hour: \"2-digit\",\n minute: \"2-digit\"\n }).format(date);\n } catch {\n }\n }\n if (typeof profileData.value?.timezoneOffset === \"number\") {\n const shifted = new Date(date.getTime() + profileData.value.timezoneOffset * 1e3);\n return new Intl.DateTimeFormat(getCanonicalLocale(), {\n timeZone: \"UTC\",\n hour: \"2-digit\",\n minute: \"2-digit\"\n }).format(shifted);\n }\n return null;\n }\n function isIconUrl(icon) {\n return !!icon && (/^(https?:)?\\/\\//.test(icon) || icon.startsWith(\"/\") || icon.startsWith(\"data:\"));\n }\n function otherActionComponent(action) {\n if (action.to) {\n return NcActionRouter;\n }\n if (action.onClick && !action.href) {\n return NcActionButton;\n }\n return NcActionLink;\n }\n function otherActionProps(action) {\n if (action.to) {\n return { to: action.to, closeAfterClick: true };\n }\n if (action.onClick && !action.href) {\n return { onClick: action.onClick, closeAfterClick: true };\n }\n return {\n href: action.href,\n target: action.target ?? (action.href?.startsWith(\"tel:\") ? \"_self\" : \"_blank\"),\n rel: action.rel,\n closeAfterClick: true\n };\n }\n watch(() => props.profile, (value) => {\n if (value) {\n profileData.value = value;\n if (props.user) {\n setCachedProfile(props.user, value);\n }\n error.value = false;\n }\n });\n watch(() => props.preloadedUserStatus, (value) => {\n if (value) {\n userStatus.value = value;\n }\n });\n watch(() => props.user, () => {\n profileData.value = props.profile;\n userStatus.value = props.preloadedUserStatus ?? {};\n error.value = false;\n if (props.user && props.profile) {\n setCachedProfile(props.user, props.profile);\n }\n if (props.open) {\n loadProfile();\n }\n });\n watch(() => props.open, (isOpen) => {\n if (isOpen) {\n loadProfile();\n }\n });\n onMounted(() => {\n if (props.open) {\n loadProfile();\n }\n });\n function hasPreloadedUserStatus() {\n return props.preloadedUserStatus !== null || !!(userStatus.value.icon || userStatus.value.message || userStatus.value.status);\n }\n async function ensureUserStatus(userId) {\n if (!hasPreloadedUserStatus()) {\n userStatus.value = await fetchUserStatus(userId);\n }\n }\n async function loadProfile() {\n if (!props.user || loading.value) {\n return;\n }\n const userId = props.user;\n if (!profileData.value) {\n const cached = getCachedProfile(userId);\n if (cached) {\n profileData.value = cached;\n }\n }\n if (profileData.value) {\n await ensureUserStatus(userId);\n return;\n }\n loading.value = true;\n error.value = false;\n try {\n const [profile, status] = await Promise.all([\n fetchProfileCached(userId, async () => {\n const { data } = await axios.get(generateOcsUrl(\"/profile/{userId}\", { userId }));\n return data.ocs?.data ?? null;\n }),\n hasPreloadedUserStatus() ? Promise.resolve(userStatus.value) : fetchUserStatus(userId)\n ]);\n profileData.value = profile;\n userStatus.value = status;\n if (!profileData.value) {\n error.value = true;\n }\n } catch (e) {\n logger.debug(\"Failed to load profile for hovercard\", { error: e, user: userId });\n error.value = true;\n } finally {\n loading.value = false;\n }\n }\n async function fetchUserStatus(userId) {\n try {\n if (!getCapabilities()?.user_status?.enabled || !getCurrentUser()) {\n return {};\n }\n const { data } = await axios.get(generateOcsUrl(\"/apps/user_status/api/v1/statuses/{userId}\", { userId }));\n return data.ocs?.data ?? {};\n } catch (e) {\n logger.debug(\"Failed to load user status for hovercard\", { error: e, userId });\n return {};\n }\n }\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", {\n class: \"profile-hover-card\",\n role: \"dialog\",\n \"aria-label\": unref(t)(\"Profile of {user}\", { user: profileData.value?.displayname || __props.user || \"\" })\n }, [\n loading.value ? (openBlock(), createElementBlock(\"div\", _hoisted_2, [\n createVNode(NcLoadingIcon, {\n size: 32,\n name: unref(t)(\"Loading profile\")\n }, null, 8, [\"name\"])\n ])) : profileData.value && !error.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [\n createElementVNode(\"div\", _hoisted_3, [\n isCurrentUser.value ? (openBlock(), createBlock(NcButton, {\n key: 0,\n class: \"profile-hover-card__header__edit\",\n variant: \"tertiary\",\n \"aria-label\": unref(t)(\"Edit profile\"),\n title: unref(t)(\"Edit profile\"),\n href: unref(settingsUrl),\n target: \"_blank\"\n }, {\n icon: withCtx(() => [\n createVNode(PencilIcon, { size: 20 })\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"href\"])) : createCommentVNode(\"\", true),\n createElementVNode(\"div\", _hoisted_4, [\n unref(isMobile) ? (openBlock(), createBlock(NcAvatar, {\n key: 0,\n class: \"avatar profile-hover-card__header__container__avatar\",\n user: profileData.value.userId,\n size: 96,\n disableMenu: \"\",\n disableTooltip: \"\",\n preloadedUserStatus: avatarUserStatus.value,\n isNoUser: !profileData.value.isUserAvatarVisible\n }, null, 8, [\"user\", \"preloadedUserStatus\", \"isNoUser\"])) : (openBlock(), createElementBlock(\"div\", _hoisted_5)),\n createElementVNode(\"div\", _hoisted_6, [\n createElementVNode(\"div\", _hoisted_7, [\n createElementVNode(\"h2\", null, toDisplayString(profileData.value.displayname || profileData.value.userId), 1),\n profileData.value.pronouns ? (openBlock(), createElementBlock(\"span\", _hoisted_8, \"·\")) : createCommentVNode(\"\", true),\n profileData.value.pronouns ? (openBlock(), createElementBlock(\"span\", _hoisted_9, toDisplayString(profileData.value.pronouns), 1)) : createCommentVNode(\"\", true)\n ]),\n userStatus.value.icon || userStatus.value.message ? (openBlock(), createElementBlock(\"div\", _hoisted_10, [\n createElementVNode(\"span\", _hoisted_11, [\n createElementVNode(\"span\", null, toDisplayString(userStatus.value.icon) + \" \" + toDisplayString(userStatus.value.message), 1)\n ])\n ])) : createCommentVNode(\"\", true)\n ])\n ])\n ]),\n createElementVNode(\"div\", _hoisted_12, [\n createElementVNode(\"div\", _hoisted_13, [\n createElementVNode(\"div\", _hoisted_14, [\n !unref(isMobile) ? (openBlock(), createBlock(NcAvatar, {\n key: 0,\n class: \"avatar\",\n user: profileData.value.userId,\n size: 135,\n disableMenu: \"\",\n disableTooltip: \"\",\n preloadedUserStatus: avatarUserStatus.value,\n isNoUser: !profileData.value.isUserAvatarVisible\n }, null, 8, [\"user\", \"preloadedUserStatus\", \"isNoUser\"])) : createCommentVNode(\"\", true),\n createElementVNode(\"div\", _hoisted_15, [\n __props.actionsLoading && resolvedActions.value.length === 0 ? (openBlock(), createElementBlock(\"div\", _hoisted_16, [\n createVNode(NcLoadingIcon, {\n size: 20,\n name: unref(t)(\"Loading actions\")\n }, null, 8, [\"name\"])\n ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [\n primaryAction.value ? (openBlock(), createBlock(NcButton, mergeProps({\n key: 0,\n variant: \"primary\",\n class: \"user-actions__primary\"\n }, primaryActionButtonProps.value, {\n onClick: primaryAction.value.onClick\n }), createSlots({\n default: withCtx(() => [\n createTextVNode(\" \" + toDisplayString(primaryAction.value.text), 1)\n ]),\n _: 2\n }, [\n primaryAction.value.iconSvg || primaryAction.value.icon ? {\n name: \"icon\",\n fn: withCtx(() => [\n primaryAction.value.iconSvg ? (openBlock(), createBlock(unref(NcIconSvgWrapper), {\n key: 0,\n svg: primaryAction.value.iconSvg\n }, null, 8, [\"svg\"])) : isIconUrl(primaryAction.value.icon) ? (openBlock(), createElementBlock(\"img\", {\n key: 1,\n src: primaryAction.value.icon,\n alt: \"\",\n class: \"user-actions__primary__icon\"\n }, null, 8, _hoisted_17)) : (openBlock(), createElementBlock(\"span\", {\n key: 2,\n \"aria-hidden\": \"true\",\n class: normalizeClass([\"user-actions__primary__icon-class\", primaryAction.value.icon])\n }, null, 2))\n ]),\n key: \"0\"\n } : void 0\n ]), 1040, [\"onClick\"])) : createCommentVNode(\"\", true),\n otherActions.value.length > 0 ? (openBlock(), createBlock(NcActions, {\n key: 1,\n class: \"user-actions__other\",\n inline: unref(isMobile) ? 5 : 4\n }, {\n default: withCtx(() => [\n (openBlock(true), createElementBlock(Fragment, null, renderList(otherActions.value, (action, index) => {\n return openBlock(), createBlock(resolveDynamicComponent(otherActionComponent(action)), mergeProps({\n key: action.id || action.href || index\n }, { ref_for: true }, otherActionProps(action)), createSlots({\n default: withCtx(() => [\n createTextVNode(\" \" + toDisplayString(action.text), 1)\n ]),\n _: 2\n }, [\n action.iconSvg || action.icon ? {\n name: \"icon\",\n fn: withCtx(() => [\n action.iconSvg ? (openBlock(), createBlock(unref(NcIconSvgWrapper), {\n key: 0,\n svg: action.iconSvg\n }, null, 8, [\"svg\"])) : isIconUrl(action.icon) ? (openBlock(), createElementBlock(\"img\", {\n key: 1,\n src: action.icon,\n alt: \"\",\n class: \"user-actions__other__icon\"\n }, null, 8, _hoisted_18)) : (openBlock(), createElementBlock(\"span\", {\n key: 2,\n \"aria-hidden\": \"true\",\n class: normalizeClass([\"user-actions__other__icon-class\", action.icon])\n }, null, 2))\n ]),\n key: \"0\"\n } : void 0\n ]), 1040);\n }), 128))\n ]),\n _: 1\n }, 8, [\"inline\"])) : createCommentVNode(\"\", true)\n ], 64))\n ])\n ]),\n createElementVNode(\"div\", _hoisted_19, [\n profileData.value.organisation || profileData.value.role || profileData.value.address || localTimeLabel.value ? (openBlock(), createElementBlock(\"div\", _hoisted_20, [\n profileData.value.organisation || profileData.value.role ? (openBlock(), createElementBlock(\"div\", _hoisted_21, [\n createElementVNode(\"p\", null, [\n createVNode(BriefcaseIcon, {\n class: \"detail-icon\",\n size: 16,\n title: \"\"\n }),\n createTextVNode(\" \" + toDisplayString(profileData.value.organisation) + \" \", 1),\n profileData.value.organisation && profileData.value.role ? (openBlock(), createElementBlock(\"span\", _hoisted_22, \"•\")) : createCommentVNode(\"\", true),\n createTextVNode(\" \" + toDisplayString(profileData.value.role), 1)\n ])\n ])) : createCommentVNode(\"\", true),\n profileData.value.address ? (openBlock(), createElementBlock(\"div\", _hoisted_23, [\n createElementVNode(\"p\", null, [\n createVNode(MapMarkerIcon, {\n class: \"detail-icon\",\n size: 16,\n title: \"\"\n }),\n createTextVNode(\" \" + toDisplayString(profileData.value.address), 1)\n ])\n ])) : createCommentVNode(\"\", true),\n localTimeLabel.value ? (openBlock(), createElementBlock(\"div\", _hoisted_24, [\n createElementVNode(\"p\", null, [\n createVNode(ClockIcon, {\n class: \"detail-icon\",\n size: 16,\n title: \"\"\n }),\n createTextVNode(\" \" + toDisplayString(localTimeLabel.value), 1)\n ])\n ])) : createCommentVNode(\"\", true)\n ])) : createCommentVNode(\"\", true),\n profileData.value.headline || profileData.value.biography ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [\n profileData.value.headline ? (openBlock(), createElementBlock(\"h3\", _hoisted_25, toDisplayString(profileData.value.headline), 1)) : createCommentVNode(\"\", true),\n profileData.value.biography ? (openBlock(), createElementBlock(\"div\", _hoisted_26, [\n createVNode(NcRichText, {\n text: profileData.value.biography,\n useExtendedMarkdown: \"\"\n }, null, 8, [\"text\"])\n ])) : createCommentVNode(\"\", true)\n ], 64)) : (openBlock(), createBlock(NcEmptyContent, {\n key: 2,\n class: \"profile-hover-card__blocks-empty-info\",\n name: emptyProfileMessage.value,\n description: unref(t)(\"The headline and about sections will show up here\")\n }, {\n icon: withCtx(() => [\n createVNode(AccountIcon, { size: 40 })\n ]),\n _: 1\n }, 8, [\"name\", \"description\"]))\n ])\n ])\n ])\n ], 64)) : (openBlock(), createElementBlock(\"div\", _hoisted_27, toDisplayString(unref(t)(\"Failed to load profile\")), 1))\n ], 8, _hoisted_1);\n };\n }\n});\nconst NcProfileHoverCard = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-dc040af1\"]]);\nexport {\n NcProfileHoverCard as default\n};\n//# sourceMappingURL=NcProfileHoverCard.mjs.map\n"],"names":["_sfc_main$5","_hoisted_1$5","_hoisted_2$5","_hoisted_3$5","_hoisted_4$5","_sfc_render$4","_ctx","_cache","$props","$setup","$data","$options","openBlock","createElementBlock","mergeProps","$event","createElementVNode","toDisplayString","createCommentVNode","AccountIcon","_export_sfc","_sfc_main$4","_hoisted_1$4","_hoisted_2$4","_hoisted_3$4","_hoisted_4$4","_sfc_render$3","BriefcaseIcon","_sfc_main$3","_hoisted_1$3","_hoisted_2$3","_hoisted_3$3","_hoisted_4$3","_sfc_render$2","ClockIcon","_sfc_main$2","_hoisted_1$2","_hoisted_2$2","_hoisted_3$2","_hoisted_4$2","_sfc_render$1","MapMarkerIcon","_sfc_main$1","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","_sfc_render","PencilIcon","register","t1","PROFILE_CACHE_TTL_MS","cache","inflight","getCachedProfile","userId","entry","setCachedProfile","data","ttlMs","fetchProfileCached","fetcher","cached","pending","promise","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_sfc_main","defineComponent","__props","props","loading","ref","error","profileData","userStatus","isMobile","useIsSmallMobile","isCurrentUser","computed","getCurrentUser","settingsUrl","generateUrl","resolvedActions","action","localTimeLabel","time","formatProfileLocalTime","t","primaryAction","otherActions","primaryActionButtonProps","emptyProfileMessage","name","avatarUserStatus","date","timeZone","getCanonicalLocale","shifted","isIconUrl","icon","otherActionComponent","NcActionRouter","NcActionButton","NcActionLink","otherActionProps","watch","value","loadProfile","isOpen","onMounted","hasPreloadedUserStatus","ensureUserStatus","fetchUserStatus","profile","status","axios","generateOcsUrl","e","logger","getCapabilities","unref","createVNode","NcLoadingIcon","Fragment","createBlock","NcButton","withCtx","NcAvatar","createSlots","createTextVNode","NcIconSvgWrapper","normalizeClass","NcActions","renderList","index","resolveDynamicComponent","NcRichText","NcEmptyContent","NcProfileHoverCard"],"mappings":"4iBAqBA,MAAMA,GAAc,CAClB,KAAM,qBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,gRAAgR,EACpSC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAcC,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CACpE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,4CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQb,GAAc,CACvCK,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAAST,GAAca,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGhB,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMkB,GAA8BC,EAAYpB,GAAa,CAAC,CAAC,SAAUK,EAAa,CAAC,CAAC,EAClFgB,GAAc,CAClB,KAAM,uBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,+VAA+V,EACnXC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAcpB,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CACpE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,8CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQQ,GAAc,CACvChB,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAASY,GAAcR,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGK,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMK,GAAgCP,EAAYC,GAAa,CAAC,CAAC,SAAUK,EAAa,CAAC,CAAC,EACpFE,GAAc,CAClB,KAAM,mBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,oMAAoM,EACxNC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAc3B,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CACpE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,0CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQe,GAAc,CACvCvB,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAASmB,GAAcf,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGY,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMK,GAA4Bd,EAAYQ,GAAa,CAAC,CAAC,SAAUK,EAAa,CAAC,CAAC,EAChFE,GAAc,CAClB,KAAM,uBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,8OAA8O,EAClQC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAclC,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CACpE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,+CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQsB,GAAc,CACvC9B,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAAS0B,GAActB,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGmB,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMK,GAAgCrB,EAAYe,GAAa,CAAC,CAAC,SAAUK,EAAa,CAAC,CAAC,EACpFE,GAAc,CAClB,KAAM,oBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,oOAAoO,EACxPC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAYzC,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CAClE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,2CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQ6B,GAAc,CACvCrC,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAASiC,GAAc7B,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAG0B,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMK,GAA6B5B,EAAYsB,GAAa,CAAC,CAAC,SAAUK,EAAW,CAAC,CAAC,EACrFE,GAASC,EAAE,EAKX,MAAMC,EAAuB,KAAU,IACjCC,EAAwB,IAAI,IAC5BC,EAA2B,IAAI,IACrC,SAASC,EAAiBC,EAAQ,CAChC,MAAMC,EAAQJ,EAAM,IAAIG,CAAM,EAC9B,OAAKC,EAGD,KAAK,OAASA,EAAM,WACtBJ,EAAM,OAAOG,CAAM,EACZ,MAEFC,EAAM,KANJ,IAOX,CACA,SAASC,EAAiBF,EAAQG,EAAMC,EAAQR,EAAsB,CACpEC,EAAM,IAAIG,EAAQ,CAChB,KAAAG,EACA,UAAW,KAAK,MAAQC,CAC5B,CAAG,CACH,CACA,eAAeC,GAAmBL,EAAQM,EAASF,EAAQR,EAAsB,CAC/E,MAAMW,EAASR,EAAiBC,CAAM,EACtC,GAAIO,EACF,OAAOA,EAET,MAAMC,EAAUV,EAAS,IAAIE,CAAM,EACnC,GAAIQ,EACF,OAAOA,EAET,MAAMC,GAAW,SAAY,CAC3B,GAAI,CACF,MAAMN,EAAO,MAAMG,EAAO,EAC1B,OAAIH,GACFD,EAAiBF,EAAQG,EAAMC,CAAK,EAE/BD,CACT,QAAA,CACEL,EAAS,OAAOE,CAAM,CACxB,CACF,GAAC,EACD,OAAAF,EAAS,IAAIE,EAAQS,CAAO,EACrBA,CACT,CACA,MAAMC,GAAa,CAAC,YAAY,EAC1BC,GAAa,CACjB,IAAK,EACL,MAAO,6BACT,EACMC,GAAa,CAAE,MAAO,4BAA4B,EAClDC,GAAa,CAAE,MAAO,uCAAuC,EAC7DC,GAAa,CACjB,IAAK,EACL,MAAO,oDACT,EACMC,GAAa,CAAE,MAAO,iDAAiD,EACvEC,GAAa,CAAE,MAAO,oDAAoD,EAC1EC,GAAa,CACjB,IAAK,EACL,MAAO,0DACT,EACMC,GAAa,CACjB,IAAK,EACL,MAAO,iDACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,+CACT,EACMC,GAAc,CAAE,MAAO,uDAAuD,EAC9EC,GAAc,CAAE,MAAO,0BAA0B,EACjDC,GAAc,CAAE,MAAO,6BAA6B,EACpDC,GAAc,CAAE,MAAO,6BAA6B,EACpDC,GAAc,CAAE,MAAO,cAAc,EACrCC,GAAc,CAClB,IAAK,EACL,MAAO,uBACT,EACMC,GAAc,CAAC,KAAK,EACpBC,GAAc,CAAC,KAAK,EACpBC,GAAc,CAAE,MAAO,4BAA4B,EACnDC,GAAc,CAClB,IAAK,EACL,MAAO,oCACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,QACT,EACMC,GAAc,CAAE,IAAK,CAAC,EACtBC,GAAc,CAClB,IAAK,EACL,MAAO,QACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,QACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,qCACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,sCACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,2BACT,EACMC,GAA4BC,GAAgB,CAChD,OAAQ,qBACR,MAAO,CACL,KAAM,CAAE,QAAS,IAAI,EACrB,QAAS,CAAE,QAAS,IAAI,EACxB,oBAAqB,CAAE,QAAS,IAAI,EACpC,KAAM,CAAE,KAAM,QAAS,QAAS,EAAK,EACrC,QAAS,CAAE,QAAS,IAAI,EACxB,eAAgB,CAAE,KAAM,QAAS,QAAS,EAAK,CACnD,EACE,MAAMC,EAAS,CACb,MAAMC,EAAQD,EACRE,EAAUC,EAAI,EAAK,EACnBC,EAAQD,EAAI,EAAK,EACjBE,EAAcF,EAAIF,EAAM,OAAO,EAC/BK,EAAaH,EAAIF,EAAM,qBAAuB,CAAA,CAAE,EAChDM,EAAWC,GAAgB,EAC7BP,EAAM,MAAQA,EAAM,SACtBtC,EAAiBsC,EAAM,KAAMA,EAAM,OAAO,EAE5C,MAAMQ,EAAgBC,EAAS,IAAM,CAAC,CAACT,EAAM,MAAQU,KAAkB,MAAQV,EAAM,IAAI,EACnFW,GAAcC,GAAY,gBAAgB,EAC1CC,EAAkBJ,EAAS,IAC3BT,EAAM,SAAWA,EAAM,QAAQ,OAAS,EACnCA,EAAM,QAAQ,OAAQc,GAAWA,EAAO,QAAU,UAAU,GAE7DV,EAAY,OAAO,SAAW,CAAA,GAAI,OAAQU,GAAWA,EAAO,QAAU,UAAU,EAAE,IAAKA,IAAY,CACzG,GAAIA,EAAO,GACX,MAAOA,EAAO,MACd,KAAMA,EAAO,MACb,KAAMA,EAAO,QAAU,OACvB,KAAMA,EAAO,KACb,OAAQA,EAAO,KAAO,QAAU,QAAU,SAC1C,IAAKA,EAAO,KAAO,YAAc,KAAO,MAChD,EAAQ,CACH,EACKC,EAAiBN,EAAS,IAAM,CACpC,MAAMO,EAAOC,GAAuC,IAAI,IAAM,EAC9D,OAAKD,EAGEE,EAAE,qBAAsB,CAAE,KAAAF,EAAM,EAF9B,IAGX,CAAC,EACKG,EAAgBV,EAAS,IAAMI,EAAgB,MAAM,CAAC,CAAC,EACvDO,EAAeX,EAAS,IAAMI,EAAgB,MAAM,MAAM,CAAC,CAAC,EAC5DQ,GAA2BZ,EAAS,IAAM,CAC9C,MAAMK,EAASK,EAAc,MAC7B,OAAKL,EAGDA,EAAO,GACF,CAAE,GAAIA,EAAO,EAAE,EAEpBA,EAAO,KACF,CACL,KAAMA,EAAO,KACb,OAAQA,EAAO,SAAWA,EAAO,KAAK,WAAW,MAAM,EAAI,QAAU,UACrE,IAAKA,EAAO,GACtB,EAEa,CAAA,EAZE,CAAA,CAaX,CAAC,EACKQ,GAAsBb,EAAS,IAAM,CACzC,GAAID,EAAc,MAChB,OAAOU,EAAE,iCAAiC,EAE5C,MAAMK,EAAOnB,EAAY,OAAO,aAAeJ,EAAM,MAAQ,GAC7D,OAAOkB,EAAE,oCAAqC,CAAE,KAAMK,CAAI,CAAE,CAC9D,CAAC,EACKC,EAAmBf,EAAS,KAAO,CACvC,OAAQJ,EAAW,MAAM,QAAU,KACnC,KAAMA,EAAW,MAAM,MAAQ,KAC/B,QAASA,EAAW,MAAM,SAAW,IAC3C,EAAM,EACF,SAASY,GAAuBQ,EAAM,CACpC,MAAMC,EAAWtB,EAAY,OAAO,SACpC,GAAIsB,EACF,GAAI,CACF,OAAO,IAAI,KAAK,eAAeC,IAAsB,CACnD,SAAAD,EACA,KAAM,UACN,OAAQ,SACpB,CAAW,EAAE,OAAOD,CAAI,CAChB,MAAQ,CACR,CAEF,GAAI,OAAOrB,EAAY,OAAO,gBAAmB,SAAU,CACzD,MAAMwB,EAAU,IAAI,KAAKH,EAAK,QAAO,EAAKrB,EAAY,MAAM,eAAiB,GAAG,EAChF,OAAO,IAAI,KAAK,eAAeuB,IAAsB,CACnD,SAAU,MACV,KAAM,UACN,OAAQ,SAClB,CAAS,EAAE,OAAOC,CAAO,CACnB,CACA,OAAO,IACT,CACA,SAASC,EAAUC,EAAM,CACvB,MAAO,CAAC,CAACA,IAAS,kBAAkB,KAAKA,CAAI,GAAKA,EAAK,WAAW,GAAG,GAAKA,EAAK,WAAW,OAAO,EACnG,CACA,SAASC,GAAqBjB,EAAQ,CACpC,OAAIA,EAAO,GACFkB,GAELlB,EAAO,SAAW,CAACA,EAAO,KACrBmB,GAEFC,EACT,CACA,SAASC,GAAiBrB,EAAQ,CAChC,OAAIA,EAAO,GACF,CAAE,GAAIA,EAAO,GAAI,gBAAiB,EAAI,EAE3CA,EAAO,SAAW,CAACA,EAAO,KACrB,CAAE,QAASA,EAAO,QAAS,gBAAiB,EAAI,EAElD,CACL,KAAMA,EAAO,KACb,OAAQA,EAAO,SAAWA,EAAO,MAAM,WAAW,MAAM,EAAI,QAAU,UACtE,IAAKA,EAAO,IACZ,gBAAiB,EACzB,CACI,CACAsB,EAAM,IAAMpC,EAAM,QAAUqC,GAAU,CAChCA,IACFjC,EAAY,MAAQiC,EAChBrC,EAAM,MACRtC,EAAiBsC,EAAM,KAAMqC,CAAK,EAEpClC,EAAM,MAAQ,GAElB,CAAC,EACDiC,EAAM,IAAMpC,EAAM,oBAAsBqC,GAAU,CAC5CA,IACFhC,EAAW,MAAQgC,EAEvB,CAAC,EACDD,EAAM,IAAMpC,EAAM,KAAM,IAAM,CAC5BI,EAAY,MAAQJ,EAAM,QAC1BK,EAAW,MAAQL,EAAM,qBAAuB,CAAA,EAChDG,EAAM,MAAQ,GACVH,EAAM,MAAQA,EAAM,SACtBtC,EAAiBsC,EAAM,KAAMA,EAAM,OAAO,EAExCA,EAAM,MACRsC,EAAW,CAEf,CAAC,EACDF,EAAM,IAAMpC,EAAM,KAAOuC,GAAW,CAC9BA,GACFD,EAAW,CAEf,CAAC,EACDE,GAAU,IAAM,CACVxC,EAAM,MACRsC,EAAW,CAEf,CAAC,EACD,SAASG,GAAyB,CAChC,OAAOzC,EAAM,sBAAwB,MAAQ,CAAC,EAAEK,EAAW,MAAM,MAAQA,EAAW,MAAM,SAAWA,EAAW,MAAM,OACxH,CACA,eAAeqC,GAAiBlF,EAAQ,CACjCiF,EAAsB,IACzBpC,EAAW,MAAQ,MAAMsC,EAAgBnF,CAAM,EAEnD,CACA,eAAe8E,GAAc,CAC3B,GAAI,CAACtC,EAAM,MAAQC,EAAQ,MACzB,OAEF,MAAMzC,EAASwC,EAAM,KACrB,GAAI,CAACI,EAAY,MAAO,CACtB,MAAMrC,EAASR,EAAiBC,CAAM,EAClCO,IACFqC,EAAY,MAAQrC,EAExB,CACA,GAAIqC,EAAY,MAAO,CACrB,MAAMsC,GAAiBlF,CAAM,EAC7B,MACF,CACAyC,EAAQ,MAAQ,GAChBE,EAAM,MAAQ,GACd,GAAI,CACF,KAAM,CAACyC,EAASC,CAAM,EAAI,MAAM,QAAQ,IAAI,CAC1ChF,GAAmBL,EAAQ,SAAY,CACrC,KAAM,CAAE,KAAAG,GAAS,MAAMmF,EAAM,IAAIC,EAAe,oBAAqB,CAAE,OAAAvF,CAAM,CAAE,CAAC,EAChF,OAAOG,EAAK,KAAK,MAAQ,IAC3B,CAAC,EACD8E,EAAsB,EAAK,QAAQ,QAAQpC,EAAW,KAAK,EAAIsC,EAAgBnF,CAAM,CAC/F,CAAS,EACD4C,EAAY,MAAQwC,EACpBvC,EAAW,MAAQwC,EACdzC,EAAY,QACfD,EAAM,MAAQ,GAElB,OAAS6C,EAAG,CACVC,EAAO,MAAM,uCAAwC,CAAE,MAAOD,EAAG,KAAMxF,EAAQ,EAC/E2C,EAAM,MAAQ,EAChB,QAAA,CACEF,EAAQ,MAAQ,EAClB,CACF,CACA,eAAe0C,EAAgBnF,EAAQ,CACrC,GAAI,CACF,GAAI,CAAC0F,GAAe,GAAI,aAAa,SAAW,CAACxC,EAAc,EAC7D,MAAO,CAAA,EAET,KAAM,CAAE,KAAA/C,GAAS,MAAMmF,EAAM,IAAIC,EAAe,6CAA8C,CAAE,OAAAvF,CAAM,CAAE,CAAC,EACzG,OAAOG,EAAK,KAAK,MAAQ,CAAA,CAC3B,OAASqF,EAAG,CACV,OAAAC,EAAO,MAAM,2CAA4C,CAAE,MAAOD,EAAG,OAAAxF,EAAQ,EACtE,CAAA,CACT,CACF,CACA,MAAO,CAACjD,EAAMC,KACLK,EAAS,EAAIC,EAAmB,MAAO,CAC5C,MAAO,qBACP,KAAM,SACN,aAAcqI,EAAMjC,CAAC,EAAE,oBAAqB,CAAE,KAAMd,EAAY,OAAO,aAAeL,EAAQ,MAAQ,EAAE,CAAE,CAClH,EAAS,CACDE,EAAQ,OAASpF,EAAS,EAAIC,EAAmB,MAAOqD,GAAY,CAClEiF,EAAYC,EAAe,CACzB,KAAM,GACN,KAAMF,EAAMjC,CAAC,EAAE,iBAAiB,CAC5C,EAAa,KAAM,EAAG,CAAC,MAAM,CAAC,CAC9B,CAAS,GAAKd,EAAY,OAAS,CAACD,EAAM,OAAStF,EAAS,EAAIC,EAAmBwI,EAAU,CAAE,IAAK,CAAC,EAAI,CAC/FrI,EAAmB,MAAOmD,GAAY,CACpCoC,EAAc,OAAS3F,IAAa0I,EAAYC,EAAU,CACxD,IAAK,EACL,MAAO,mCACP,QAAS,WACT,aAAcL,EAAMjC,CAAC,EAAE,cAAc,EACrC,MAAOiC,EAAMjC,CAAC,EAAE,cAAc,EAC9B,KAAMiC,EAAMxC,EAAW,EACvB,OAAQ,QACtB,EAAe,CACD,KAAM8C,EAAQ,IAAM,CAClBL,EAAYnG,GAAY,CAAE,KAAM,EAAE,CAAE,CACpD,CAAe,EACD,EAAG,CACjB,EAAe,EAAG,CAAC,aAAc,QAAS,MAAM,CAAC,GAAK9B,EAAmB,GAAI,EAAI,EACrEF,EAAmB,MAAOoD,GAAY,CACpC8E,EAAM7C,CAAQ,GAAKzF,EAAS,EAAI0I,EAAYG,EAAU,CACpD,IAAK,EACL,MAAO,uDACP,KAAMtD,EAAY,MAAM,OACxB,KAAM,GACN,YAAa,GACb,eAAgB,GAChB,oBAAqBoB,EAAiB,MACtC,SAAU,CAACpB,EAAY,MAAM,mBAC7C,EAAiB,KAAM,EAAG,CAAC,OAAQ,sBAAuB,UAAU,CAAC,IAAMvF,EAAS,EAAIC,EAAmB,MAAOwD,EAAU,GAC9GrD,EAAmB,MAAOsD,GAAY,CACpCtD,EAAmB,MAAOuD,GAAY,CACpCvD,EAAmB,KAAM,KAAMC,EAAgBkF,EAAY,MAAM,aAAeA,EAAY,MAAM,MAAM,EAAG,CAAC,EAC5GA,EAAY,MAAM,UAAYvF,EAAS,EAAIC,EAAmB,OAAQ2D,GAAY,GAAG,GAAKtD,EAAmB,GAAI,EAAI,EACrHiF,EAAY,MAAM,UAAYvF,EAAS,EAAIC,EAAmB,OAAQ4D,GAAYxD,EAAgBkF,EAAY,MAAM,QAAQ,EAAG,CAAC,GAAKjF,EAAmB,GAAI,EAAI,CAClL,CAAiB,EACDkF,EAAW,MAAM,MAAQA,EAAW,MAAM,SAAWxF,IAAaC,EAAmB,MAAO6D,GAAa,CACvG1D,EAAmB,OAAQ2D,GAAa,CACtC3D,EAAmB,OAAQ,KAAMC,EAAgBmF,EAAW,MAAM,IAAI,EAAI,IAAMnF,EAAgBmF,EAAW,MAAM,OAAO,EAAG,CAAC,CAChJ,CAAmB,CACnB,CAAiB,GAAKlF,EAAmB,GAAI,EAAI,CACjD,CAAe,CACf,CAAa,CACb,CAAW,EACDF,EAAmB,MAAO4D,GAAa,CACrC5D,EAAmB,MAAO6D,GAAa,CACrC7D,EAAmB,MAAO8D,GAAa,CACpCoE,EAAM7C,CAAQ,EAS6CnF,EAAmB,GAAI,EAAI,GATnEN,EAAS,EAAI0I,EAAYG,EAAU,CACrD,IAAK,EACL,MAAO,SACP,KAAMtD,EAAY,MAAM,OACxB,KAAM,IACN,YAAa,GACb,eAAgB,GAChB,oBAAqBoB,EAAiB,MACtC,SAAU,CAACpB,EAAY,MAAM,mBAC/C,EAAmB,KAAM,EAAG,CAAC,OAAQ,sBAAuB,UAAU,CAAC,GACvDnF,EAAmB,MAAO+D,GAAa,CACrCe,EAAQ,gBAAkBc,EAAgB,MAAM,SAAW,GAAKhG,IAAaC,EAAmB,MAAOmE,GAAa,CAClHmE,EAAYC,EAAe,CACzB,KAAM,GACN,KAAMF,EAAMjC,CAAC,EAAE,iBAAiB,CACtD,EAAuB,KAAM,EAAG,CAAC,MAAM,CAAC,CACxC,CAAmB,IAAMrG,EAAS,EAAIC,EAAmBwI,EAAU,CAAE,IAAK,GAAK,CAC3DnC,EAAc,OAAStG,EAAS,EAAI0I,EAAYC,EAAUzI,EAAW,CACnE,IAAK,EACL,QAAS,UACT,MAAO,uBAC7B,EAAuBsG,GAAyB,MAAO,CACjC,QAASF,EAAc,MAAM,OACnD,CAAqB,EAAGwC,EAAY,CACd,QAASF,EAAQ,IAAM,CACrBG,EAAgB,IAAM1I,EAAgBiG,EAAc,MAAM,IAAI,EAAG,CAAC,CAC1F,CAAuB,EACD,EAAG,CACzB,EAAuB,CACDA,EAAc,MAAM,SAAWA,EAAc,MAAM,KAAO,CACxD,KAAM,OACN,GAAIsC,EAAQ,IAAM,CAChBtC,EAAc,MAAM,SAAWtG,EAAS,EAAI0I,EAAYJ,EAAMU,CAAgB,EAAG,CAC/E,IAAK,EACL,IAAK1C,EAAc,MAAM,OACrD,EAA6B,KAAM,EAAG,CAAC,KAAK,CAAC,GAAKU,EAAUV,EAAc,MAAM,IAAI,GAAKtG,EAAS,EAAIC,EAAmB,MAAO,CACpG,IAAK,EACL,IAAKqG,EAAc,MAAM,KACzB,IAAK,GACL,MAAO,6BACnC,EAA6B,KAAM,EAAGjC,EAAW,IAAMrE,EAAS,EAAIC,EAAmB,OAAQ,CACnE,IAAK,EACL,cAAe,OACf,MAAOgJ,EAAe,CAAC,oCAAqC3C,EAAc,MAAM,IAAI,CAAC,CACjH,EAA6B,KAAM,CAAC,EACpC,CAAyB,EACD,IAAK,GAC7B,EAA0B,MAC1B,CAAqB,EAAG,KAAM,CAAC,SAAS,CAAC,GAAKhG,EAAmB,GAAI,EAAI,EACrDiG,EAAa,MAAM,OAAS,GAAKvG,EAAS,EAAI0I,EAAYQ,GAAW,CACnE,IAAK,EACL,MAAO,sBACP,OAAQZ,EAAM7C,CAAQ,EAAI,EAAI,CACpD,EAAuB,CACD,QAASmD,EAAQ,IAAM,EACpB5I,EAAU,EAAI,EAAGC,EAAmBwI,EAAU,KAAMU,GAAW5C,EAAa,MAAO,CAACN,EAAQmD,KACpFpJ,EAAS,EAAI0I,EAAYW,GAAwBnC,GAAqBjB,CAAM,CAAC,EAAG/F,EAAW,CAChG,IAAK+F,EAAO,IAAMA,EAAO,MAAQmD,CAC7D,EAA6B,CAAE,QAAS,EAAI,EAAI9B,GAAiBrB,CAAM,CAAC,EAAG6C,EAAY,CAC3D,QAASF,EAAQ,IAAM,CACrBG,EAAgB,IAAM1I,EAAgB4F,EAAO,IAAI,EAAG,CAAC,CACnF,CAA6B,EACD,EAAG,CAC/B,EAA6B,CACDA,EAAO,SAAWA,EAAO,KAAO,CAC9B,KAAM,OACN,GAAI2C,EAAQ,IAAM,CAChB3C,EAAO,SAAWjG,EAAS,EAAI0I,EAAYJ,EAAMU,CAAgB,EAAG,CAClE,IAAK,EACL,IAAK/C,EAAO,OAC9C,EAAmC,KAAM,EAAG,CAAC,KAAK,CAAC,GAAKe,EAAUf,EAAO,IAAI,GAAKjG,IAAaC,EAAmB,MAAO,CACvF,IAAK,EACL,IAAKgG,EAAO,KACZ,IAAK,GACL,MAAO,2BACzC,EAAmC,KAAM,EAAG3B,EAAW,IAAMtE,EAAS,EAAIC,EAAmB,OAAQ,CACnE,IAAK,EACL,cAAe,OACf,MAAOgJ,EAAe,CAAC,kCAAmChD,EAAO,IAAI,CAAC,CACxG,EAAmC,KAAM,CAAC,EAC1C,CAA+B,EACD,IAAK,GACnC,EAAgC,MAChC,CAA2B,EAAG,IAAI,EACT,EAAG,GAAG,EAC/B,CAAuB,EACD,EAAG,CACzB,EAAuB,EAAG,CAAC,QAAQ,CAAC,GAAK3F,EAAmB,GAAI,EAAI,CACpE,EAAqB,EAAE,EACvB,CAAiB,CACjB,CAAe,EACDF,EAAmB,MAAOmE,GAAa,CACrCgB,EAAY,MAAM,cAAgBA,EAAY,MAAM,MAAQA,EAAY,MAAM,SAAWW,EAAe,OAASlG,EAAS,EAAIC,EAAmB,MAAOuE,GAAa,CACnKe,EAAY,MAAM,cAAgBA,EAAY,MAAM,MAAQvF,IAAaC,EAAmB,MAAOwE,GAAa,CAC9GrE,EAAmB,IAAK,KAAM,CAC5BmI,EAAYxH,GAAe,CACzB,MAAO,cACP,KAAM,GACN,MAAO,EAC/B,CAAuB,EACDgI,EAAgB,IAAM1I,EAAgBkF,EAAY,MAAM,YAAY,EAAI,IAAK,CAAC,EAC9EA,EAAY,MAAM,cAAgBA,EAAY,MAAM,MAAQvF,EAAS,EAAIC,EAAmB,OAAQyE,GAAa,GAAG,GAAKpE,EAAmB,GAAI,EAAI,EACpJyI,EAAgB,IAAM1I,EAAgBkF,EAAY,MAAM,IAAI,EAAG,CAAC,CACtF,CAAqB,CACrB,CAAmB,GAAKjF,EAAmB,GAAI,EAAI,EACjCiF,EAAY,MAAM,SAAWvF,EAAS,EAAIC,EAAmB,MAAO0E,GAAa,CAC/EvE,EAAmB,IAAK,KAAM,CAC5BmI,EAAY1G,GAAe,CACzB,MAAO,cACP,KAAM,GACN,MAAO,EAC/B,CAAuB,EACDkH,EAAgB,IAAM1I,EAAgBkF,EAAY,MAAM,OAAO,EAAG,CAAC,CACzF,CAAqB,CACrB,CAAmB,GAAKjF,EAAmB,GAAI,EAAI,EACjC4F,EAAe,OAASlG,EAAS,EAAIC,EAAmB,MAAO2E,GAAa,CAC1ExE,EAAmB,IAAK,KAAM,CAC5BmI,EAAYjH,GAAW,CACrB,MAAO,cACP,KAAM,GACN,MAAO,EAC/B,CAAuB,EACDyH,EAAgB,IAAM1I,EAAgB6F,EAAe,KAAK,EAAG,CAAC,CACpF,CAAqB,CACrB,CAAmB,GAAK5F,EAAmB,GAAI,EAAI,CACnD,CAAiB,GAAKA,EAAmB,GAAI,EAAI,EACjCiF,EAAY,MAAM,UAAYA,EAAY,MAAM,WAAavF,EAAS,EAAIC,EAAmBwI,EAAU,CAAE,IAAK,CAAC,EAAI,CACjHlD,EAAY,MAAM,UAAYvF,EAAS,EAAIC,EAAmB,KAAM4E,GAAaxE,EAAgBkF,EAAY,MAAM,QAAQ,EAAG,CAAC,GAAKjF,EAAmB,GAAI,EAAI,EAC/JiF,EAAY,MAAM,WAAavF,EAAS,EAAIC,EAAmB,MAAO6E,GAAa,CACjFyD,EAAYe,GAAY,CACtB,KAAM/D,EAAY,MAAM,UACxB,oBAAqB,EAC3C,EAAuB,KAAM,EAAG,CAAC,MAAM,CAAC,CACxC,CAAmB,GAAKjF,EAAmB,GAAI,EAAI,CACnD,EAAmB,EAAE,IAAMN,IAAa0I,EAAYa,GAAgB,CAClD,IAAK,EACL,MAAO,wCACP,KAAM9C,GAAoB,MAC1B,YAAa6B,EAAMjC,CAAC,EAAE,mDAAmD,CAC3F,EAAmB,CACD,KAAMuC,EAAQ,IAAM,CAClBL,EAAYhI,GAAa,CAAE,KAAM,EAAE,CAAE,CACzD,CAAmB,EACD,EAAG,CACrB,EAAmB,EAAG,CAAC,OAAQ,aAAa,CAAC,EAC7C,CAAe,CACf,CAAa,CACb,CAAW,CACX,EAAW,EAAE,IAAMP,IAAaC,EAAmB,MAAO8E,GAAa1E,EAAgBiI,EAAMjC,CAAC,EAAE,wBAAwB,CAAC,EAAG,CAAC,EAC7H,EAAS,EAAGhD,EAAU,EAEpB,CACF,CAAC,EACKmG,GAAqChJ,EAAYwE,GAAW,CAAC,CAAC,YAAa,iBAAiB,CAAC,CAAC","x_google_ignoreList":[0]} \ No newline at end of file +{"version":3,"file":"NcProfileHoverCard-DsPWCnY_.chunk.mjs","sources":["../node_modules/@nextcloud/vue/dist/chunks/NcProfileHoverCard.mjs"],"sourcesContent":["import '../assets/NcProfileHoverCard.css';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode, toDisplayString, createCommentVNode, defineComponent, ref, computed, watch, onMounted, unref, createVNode, Fragment, createBlock, withCtx, createSlots, createTextVNode, normalizeClass, renderList, resolveDynamicComponent } from \"vue\";\nimport { getCurrentUser } from \"@nextcloud/auth\";\nimport axios from \"@nextcloud/axios\";\nimport { getCapabilities } from \"@nextcloud/capabilities\";\nimport { getCanonicalLocale } from \"@nextcloud/l10n\";\nimport { generateUrl, generateOcsUrl } from \"@nextcloud/router\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { N as NcActionButton } from \"./NcActionButton.mjs\";\nimport { N as NcActionLink } from \"./NcActionLink.mjs\";\nimport { N as NcActionRouter } from \"./NcActionRouter.mjs\";\nimport { N as NcActions } from \"./NcActions.mjs\";\nimport { N as NcAvatar } from \"./NcAvatar.mjs\";\nimport { N as NcButton } from \"./NcButton.mjs\";\nimport { N as NcEmptyContent } from \"./NcEmptyContent.mjs\";\nimport { N as NcLoadingIcon } from \"./NcLoadingIcon.mjs\";\nimport { N as NcRichText } from \"./NcRichText.mjs\";\nimport { useIsSmallMobile } from \"../composables/useIsMobile/index.mjs\";\nimport { r as register, Q as t1, a as t } from \"./_l10n.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper.mjs\";\nconst _sfc_main$5 = {\n name: \"AccountOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$5 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$5 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$5 = { d: \"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z\" };\nconst _hoisted_4$5 = { key: 0 };\nfunction _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon account-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$5, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$5, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$5))\n ], 16, _hoisted_1$5);\n}\nconst AccountIcon = /* @__PURE__ */ _export_sfc(_sfc_main$5, [[\"render\", _sfc_render$4]]);\nconst _sfc_main$4 = {\n name: \"BriefcaseOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$4 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$4 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$4 = { d: \"M20,6C20.58,6 21.05,6.2 21.42,6.59C21.8,7 22,7.45 22,8V19C22,19.55 21.8,20 21.42,20.41C21.05,20.8 20.58,21 20,21H4C3.42,21 2.95,20.8 2.58,20.41C2.2,20 2,19.55 2,19V8C2,7.45 2.2,7 2.58,6.59C2.95,6.2 3.42,6 4,6H8V4C8,3.42 8.2,2.95 8.58,2.58C8.95,2.2 9.42,2 10,2H14C14.58,2 15.05,2.2 15.42,2.58C15.8,2.95 16,3.42 16,4V6H20M4,8V19H20V8H4M14,6V4H10V6H14Z\" };\nconst _hoisted_4$4 = { key: 0 };\nfunction _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon briefcase-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$4, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$4, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$4))\n ], 16, _hoisted_1$4);\n}\nconst BriefcaseIcon = /* @__PURE__ */ _export_sfc(_sfc_main$4, [[\"render\", _sfc_render$3]]);\nconst _sfc_main$3 = {\n name: \"ClockOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$3 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$3 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$3 = { d: \"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\" };\nconst _hoisted_4$3 = { key: 0 };\nfunction _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon clock-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$3, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$3, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$3))\n ], 16, _hoisted_1$3);\n}\nconst ClockIcon = /* @__PURE__ */ _export_sfc(_sfc_main$3, [[\"render\", _sfc_render$2]]);\nconst _sfc_main$2 = {\n name: \"MapMarkerOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$2 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$2 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$2 = { d: \"M12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5M12,2A7,7 0 0,1 19,9C19,14.25 12,22 12,22C12,22 5,14.25 5,9A7,7 0 0,1 12,2M12,4A5,5 0 0,0 7,9C7,10 7,12 12,18.71C17,12 17,10 17,9A5,5 0 0,0 12,4Z\" };\nconst _hoisted_4$2 = { key: 0 };\nfunction _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon map-marker-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$2, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$2, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$2))\n ], 16, _hoisted_1$2);\n}\nconst MapMarkerIcon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render$1]]);\nconst _sfc_main$1 = {\n name: \"PencilOutlineIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$1 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$1 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$1 = { d: \"M14.06,9L15,9.94L5.92,19H5V18.08L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z\" };\nconst _hoisted_4$1 = { key: 0 };\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon pencil-outline-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$1, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$1, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$1))\n ], 16, _hoisted_1$1);\n}\nconst PencilIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [[\"render\", _sfc_render]]);\nregister(t1);\n/*!\n * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst PROFILE_CACHE_TTL_MS = 30 * 60 * 1e3;\nconst cache = /* @__PURE__ */ new Map();\nconst inflight = /* @__PURE__ */ new Map();\nfunction getCachedProfile(userId) {\n const entry = cache.get(userId);\n if (!entry) {\n return null;\n }\n if (Date.now() >= entry.expiresAt) {\n cache.delete(userId);\n return null;\n }\n return entry.data;\n}\nfunction setCachedProfile(userId, data, ttlMs = PROFILE_CACHE_TTL_MS) {\n cache.set(userId, {\n data,\n expiresAt: Date.now() + ttlMs\n });\n}\nasync function fetchProfileCached(userId, fetcher, ttlMs = PROFILE_CACHE_TTL_MS) {\n const cached = getCachedProfile(userId);\n if (cached) {\n return cached;\n }\n const pending = inflight.get(userId);\n if (pending) {\n return pending;\n }\n const promise = (async () => {\n try {\n const data = await fetcher();\n if (data) {\n setCachedProfile(userId, data, ttlMs);\n }\n return data;\n } finally {\n inflight.delete(userId);\n }\n })();\n inflight.set(userId, promise);\n return promise;\n}\nconst _hoisted_1 = [\"aria-label\"];\nconst _hoisted_2 = {\n key: 0,\n class: \"profile-hover-card__loading\"\n};\nconst _hoisted_3 = { class: \"profile-hover-card__header\" };\nconst _hoisted_4 = { class: \"profile-hover-card__header__container\" };\nconst _hoisted_5 = {\n key: 1,\n class: \"profile-hover-card__header__container__placeholder\"\n};\nconst _hoisted_6 = { class: \"profile-hover-card__header__container__identity\" };\nconst _hoisted_7 = { class: \"profile-hover-card__header__container__displayname\" };\nconst _hoisted_8 = {\n key: 0,\n class: \"profile-hover-card__header__container__pronoun-separator\"\n};\nconst _hoisted_9 = {\n key: 1,\n class: \"profile-hover-card__header__container__pronouns\"\n};\nconst _hoisted_10 = {\n key: 0,\n class: \"profile-hover-card__header__container__status\"\n};\nconst _hoisted_11 = { class: \"profile-hover-card__header__container__status-content\" };\nconst _hoisted_12 = { class: \"profile-hover-card__body\" };\nconst _hoisted_13 = { class: \"profile-hover-card__content\" };\nconst _hoisted_14 = { class: \"profile-hover-card__sidebar\" };\nconst _hoisted_15 = { class: \"user-actions\" };\nconst _hoisted_16 = {\n key: 0,\n class: \"user-actions__loading\"\n};\nconst _hoisted_17 = [\"src\"];\nconst _hoisted_18 = [\"src\"];\nconst _hoisted_19 = { class: \"profile-hover-card__blocks\" };\nconst _hoisted_20 = {\n key: 0,\n class: \"profile-hover-card__blocks-details\"\n};\nconst _hoisted_21 = {\n key: 0,\n class: \"detail\"\n};\nconst _hoisted_22 = { key: 0 };\nconst _hoisted_23 = {\n key: 1,\n class: \"detail\"\n};\nconst _hoisted_24 = {\n key: 2,\n class: \"detail\"\n};\nconst _hoisted_25 = {\n key: 0,\n class: \"profile-hover-card__blocks-headline\"\n};\nconst _hoisted_26 = {\n key: 1,\n class: \"profile-hover-card__blocks-biography\"\n};\nconst _hoisted_27 = {\n key: 2,\n class: \"profile-hover-card__error\"\n};\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcProfileHoverCard\",\n props: {\n user: { default: null },\n profile: { default: null },\n preloadedUserStatus: { default: null },\n open: { type: Boolean, default: false },\n actions: { default: null },\n actionsLoading: { type: Boolean, default: false }\n },\n setup(__props) {\n const props = __props;\n const loading = ref(false);\n const error = ref(false);\n const profileData = ref(props.profile);\n const userStatus = ref(props.preloadedUserStatus ?? {});\n const isMobile = useIsSmallMobile();\n if (props.user && props.profile) {\n setCachedProfile(props.user, props.profile);\n }\n const isCurrentUser = computed(() => !!props.user && getCurrentUser()?.uid === props.user);\n const settingsUrl = generateUrl(\"/settings/user\");\n const resolvedActions = computed(() => {\n if (props.actions && props.actions.length > 0) {\n return props.actions.filter((action) => action.appId !== \"timezone\");\n }\n return (profileData.value?.actions ?? []).filter((action) => action.appId !== \"timezone\").map((action) => ({\n id: action.id,\n appId: action.appId,\n text: action.title,\n href: action.target || void 0,\n icon: action.icon,\n target: action.id === \"phone\" ? \"_self\" : \"_blank\",\n rel: action.id === \"fediverse\" ? \"me\" : void 0\n }));\n });\n const localTimeLabel = computed(() => {\n const time = formatProfileLocalTime(/* @__PURE__ */ new Date());\n if (!time) {\n return null;\n }\n return t(\"Local time: {time}\", { time });\n });\n const primaryAction = computed(() => resolvedActions.value[0]);\n const otherActions = computed(() => resolvedActions.value.slice(1));\n const primaryActionButtonProps = computed(() => {\n const action = primaryAction.value;\n if (!action) {\n return {};\n }\n if (action.to) {\n return { to: action.to };\n }\n if (action.href) {\n return {\n href: action.href,\n target: action.target ?? (action.href.startsWith(\"tel:\") ? \"_self\" : \"_blank\"),\n rel: action.rel\n };\n }\n return {};\n });\n const emptyProfileMessage = computed(() => {\n if (isCurrentUser.value) {\n return t(\"You have not added any info yet\");\n }\n const name = profileData.value?.displayname || props.user || \"\";\n return t(\"{user} has not added any info yet\", { user: name });\n });\n const avatarUserStatus = computed(() => ({\n status: userStatus.value.status ?? null,\n icon: userStatus.value.icon ?? null,\n message: userStatus.value.message ?? null\n }));\n function formatProfileLocalTime(date) {\n const timeZone = profileData.value?.timezone;\n if (timeZone) {\n try {\n return new Intl.DateTimeFormat(getCanonicalLocale(), {\n timeZone,\n hour: \"2-digit\",\n minute: \"2-digit\"\n }).format(date);\n } catch {\n }\n }\n if (typeof profileData.value?.timezoneOffset === \"number\") {\n const shifted = new Date(date.getTime() + profileData.value.timezoneOffset * 1e3);\n return new Intl.DateTimeFormat(getCanonicalLocale(), {\n timeZone: \"UTC\",\n hour: \"2-digit\",\n minute: \"2-digit\"\n }).format(shifted);\n }\n return null;\n }\n function isIconUrl(icon) {\n return !!icon && (/^(https?:)?\\/\\//.test(icon) || icon.startsWith(\"/\") || icon.startsWith(\"data:\"));\n }\n function otherActionComponent(action) {\n if (action.to) {\n return NcActionRouter;\n }\n if (action.onClick && !action.href) {\n return NcActionButton;\n }\n return NcActionLink;\n }\n function otherActionProps(action) {\n if (action.to) {\n return { to: action.to, closeAfterClick: true };\n }\n if (action.onClick && !action.href) {\n return { onClick: action.onClick, closeAfterClick: true };\n }\n return {\n href: action.href,\n target: action.target ?? (action.href?.startsWith(\"tel:\") ? \"_self\" : \"_blank\"),\n rel: action.rel,\n closeAfterClick: true\n };\n }\n watch(() => props.profile, (value) => {\n if (value) {\n profileData.value = value;\n if (props.user) {\n setCachedProfile(props.user, value);\n }\n error.value = false;\n }\n });\n watch(() => props.preloadedUserStatus, (value) => {\n if (value) {\n userStatus.value = value;\n }\n });\n watch(() => props.user, () => {\n profileData.value = props.profile;\n userStatus.value = props.preloadedUserStatus ?? {};\n error.value = false;\n if (props.user && props.profile) {\n setCachedProfile(props.user, props.profile);\n }\n if (props.open) {\n loadProfile();\n }\n });\n watch(() => props.open, (isOpen) => {\n if (isOpen) {\n loadProfile();\n }\n });\n onMounted(() => {\n if (props.open) {\n loadProfile();\n }\n });\n function hasPreloadedUserStatus() {\n return props.preloadedUserStatus !== null || !!(userStatus.value.icon || userStatus.value.message || userStatus.value.status);\n }\n async function ensureUserStatus(userId) {\n if (!hasPreloadedUserStatus()) {\n userStatus.value = await fetchUserStatus(userId);\n }\n }\n async function loadProfile() {\n if (!props.user || loading.value) {\n return;\n }\n const userId = props.user;\n if (!profileData.value) {\n const cached = getCachedProfile(userId);\n if (cached) {\n profileData.value = cached;\n }\n }\n if (profileData.value) {\n await ensureUserStatus(userId);\n return;\n }\n loading.value = true;\n error.value = false;\n try {\n const [profile, status] = await Promise.all([\n fetchProfileCached(userId, async () => {\n const { data } = await axios.get(generateOcsUrl(\"/profile/{userId}\", { userId }));\n return data.ocs?.data ?? null;\n }),\n hasPreloadedUserStatus() ? Promise.resolve(userStatus.value) : fetchUserStatus(userId)\n ]);\n profileData.value = profile;\n userStatus.value = status;\n if (!profileData.value) {\n error.value = true;\n }\n } catch (e) {\n logger.debug(\"Failed to load profile for hovercard\", { error: e, user: userId });\n error.value = true;\n } finally {\n loading.value = false;\n }\n }\n async function fetchUserStatus(userId) {\n try {\n if (!getCapabilities()?.user_status?.enabled || !getCurrentUser()) {\n return {};\n }\n const { data } = await axios.get(generateOcsUrl(\"/apps/user_status/api/v1/statuses/{userId}\", { userId }));\n return data.ocs?.data ?? {};\n } catch (e) {\n logger.debug(\"Failed to load user status for hovercard\", { error: e, userId });\n return {};\n }\n }\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", {\n class: \"profile-hover-card\",\n role: \"dialog\",\n \"aria-label\": unref(t)(\"Profile of {user}\", { user: profileData.value?.displayname || __props.user || \"\" })\n }, [\n loading.value ? (openBlock(), createElementBlock(\"div\", _hoisted_2, [\n createVNode(NcLoadingIcon, {\n size: 32,\n name: unref(t)(\"Loading profile\")\n }, null, 8, [\"name\"])\n ])) : profileData.value && !error.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [\n createElementVNode(\"div\", _hoisted_3, [\n isCurrentUser.value ? (openBlock(), createBlock(NcButton, {\n key: 0,\n class: \"profile-hover-card__header__edit\",\n variant: \"tertiary\",\n \"aria-label\": unref(t)(\"Edit profile\"),\n title: unref(t)(\"Edit profile\"),\n href: unref(settingsUrl),\n target: \"_blank\"\n }, {\n icon: withCtx(() => [\n createVNode(PencilIcon, { size: 20 })\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"href\"])) : createCommentVNode(\"\", true),\n createElementVNode(\"div\", _hoisted_4, [\n unref(isMobile) ? (openBlock(), createBlock(NcAvatar, {\n key: 0,\n class: \"avatar profile-hover-card__header__container__avatar\",\n user: profileData.value.userId,\n size: 96,\n disableMenu: \"\",\n disableTooltip: \"\",\n preloadedUserStatus: avatarUserStatus.value,\n isNoUser: !profileData.value.isUserAvatarVisible\n }, null, 8, [\"user\", \"preloadedUserStatus\", \"isNoUser\"])) : (openBlock(), createElementBlock(\"div\", _hoisted_5)),\n createElementVNode(\"div\", _hoisted_6, [\n createElementVNode(\"div\", _hoisted_7, [\n createElementVNode(\"h2\", null, toDisplayString(profileData.value.displayname || profileData.value.userId), 1),\n profileData.value.pronouns ? (openBlock(), createElementBlock(\"span\", _hoisted_8, \"·\")) : createCommentVNode(\"\", true),\n profileData.value.pronouns ? (openBlock(), createElementBlock(\"span\", _hoisted_9, toDisplayString(profileData.value.pronouns), 1)) : createCommentVNode(\"\", true)\n ]),\n userStatus.value.icon || userStatus.value.message ? (openBlock(), createElementBlock(\"div\", _hoisted_10, [\n createElementVNode(\"span\", _hoisted_11, [\n createElementVNode(\"span\", null, toDisplayString(userStatus.value.icon) + \" \" + toDisplayString(userStatus.value.message), 1)\n ])\n ])) : createCommentVNode(\"\", true)\n ])\n ])\n ]),\n createElementVNode(\"div\", _hoisted_12, [\n createElementVNode(\"div\", _hoisted_13, [\n createElementVNode(\"div\", _hoisted_14, [\n !unref(isMobile) ? (openBlock(), createBlock(NcAvatar, {\n key: 0,\n class: \"avatar\",\n user: profileData.value.userId,\n size: 135,\n disableMenu: \"\",\n disableTooltip: \"\",\n preloadedUserStatus: avatarUserStatus.value,\n isNoUser: !profileData.value.isUserAvatarVisible\n }, null, 8, [\"user\", \"preloadedUserStatus\", \"isNoUser\"])) : createCommentVNode(\"\", true),\n createElementVNode(\"div\", _hoisted_15, [\n __props.actionsLoading && resolvedActions.value.length === 0 ? (openBlock(), createElementBlock(\"div\", _hoisted_16, [\n createVNode(NcLoadingIcon, {\n size: 20,\n name: unref(t)(\"Loading actions\")\n }, null, 8, [\"name\"])\n ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [\n primaryAction.value ? (openBlock(), createBlock(NcButton, mergeProps({\n key: 0,\n variant: \"primary\",\n class: \"user-actions__primary\"\n }, primaryActionButtonProps.value, {\n onClick: primaryAction.value.onClick\n }), createSlots({\n default: withCtx(() => [\n createTextVNode(\" \" + toDisplayString(primaryAction.value.text), 1)\n ]),\n _: 2\n }, [\n primaryAction.value.iconSvg || primaryAction.value.icon ? {\n name: \"icon\",\n fn: withCtx(() => [\n primaryAction.value.iconSvg ? (openBlock(), createBlock(unref(NcIconSvgWrapper), {\n key: 0,\n svg: primaryAction.value.iconSvg\n }, null, 8, [\"svg\"])) : isIconUrl(primaryAction.value.icon) ? (openBlock(), createElementBlock(\"img\", {\n key: 1,\n src: primaryAction.value.icon,\n alt: \"\",\n class: \"user-actions__primary__icon\"\n }, null, 8, _hoisted_17)) : (openBlock(), createElementBlock(\"span\", {\n key: 2,\n \"aria-hidden\": \"true\",\n class: normalizeClass([\"user-actions__primary__icon-class\", primaryAction.value.icon])\n }, null, 2))\n ]),\n key: \"0\"\n } : void 0\n ]), 1040, [\"onClick\"])) : createCommentVNode(\"\", true),\n otherActions.value.length > 0 ? (openBlock(), createBlock(NcActions, {\n key: 1,\n class: \"user-actions__other\",\n inline: unref(isMobile) ? 5 : 4\n }, {\n default: withCtx(() => [\n (openBlock(true), createElementBlock(Fragment, null, renderList(otherActions.value, (action, index) => {\n return openBlock(), createBlock(resolveDynamicComponent(otherActionComponent(action)), mergeProps({\n key: action.id || action.href || index\n }, { ref_for: true }, otherActionProps(action)), createSlots({\n default: withCtx(() => [\n createTextVNode(\" \" + toDisplayString(action.text), 1)\n ]),\n _: 2\n }, [\n action.iconSvg || action.icon ? {\n name: \"icon\",\n fn: withCtx(() => [\n action.iconSvg ? (openBlock(), createBlock(unref(NcIconSvgWrapper), {\n key: 0,\n svg: action.iconSvg\n }, null, 8, [\"svg\"])) : isIconUrl(action.icon) ? (openBlock(), createElementBlock(\"img\", {\n key: 1,\n src: action.icon,\n alt: \"\",\n class: \"user-actions__other__icon\"\n }, null, 8, _hoisted_18)) : (openBlock(), createElementBlock(\"span\", {\n key: 2,\n \"aria-hidden\": \"true\",\n class: normalizeClass([\"user-actions__other__icon-class\", action.icon])\n }, null, 2))\n ]),\n key: \"0\"\n } : void 0\n ]), 1040);\n }), 128))\n ]),\n _: 1\n }, 8, [\"inline\"])) : createCommentVNode(\"\", true)\n ], 64))\n ])\n ]),\n createElementVNode(\"div\", _hoisted_19, [\n profileData.value.organisation || profileData.value.role || profileData.value.address || localTimeLabel.value ? (openBlock(), createElementBlock(\"div\", _hoisted_20, [\n profileData.value.organisation || profileData.value.role ? (openBlock(), createElementBlock(\"div\", _hoisted_21, [\n createElementVNode(\"p\", null, [\n createVNode(BriefcaseIcon, {\n class: \"detail-icon\",\n size: 16,\n title: \"\"\n }),\n createTextVNode(\" \" + toDisplayString(profileData.value.organisation) + \" \", 1),\n profileData.value.organisation && profileData.value.role ? (openBlock(), createElementBlock(\"span\", _hoisted_22, \"•\")) : createCommentVNode(\"\", true),\n createTextVNode(\" \" + toDisplayString(profileData.value.role), 1)\n ])\n ])) : createCommentVNode(\"\", true),\n profileData.value.address ? (openBlock(), createElementBlock(\"div\", _hoisted_23, [\n createElementVNode(\"p\", null, [\n createVNode(MapMarkerIcon, {\n class: \"detail-icon\",\n size: 16,\n title: \"\"\n }),\n createTextVNode(\" \" + toDisplayString(profileData.value.address), 1)\n ])\n ])) : createCommentVNode(\"\", true),\n localTimeLabel.value ? (openBlock(), createElementBlock(\"div\", _hoisted_24, [\n createElementVNode(\"p\", null, [\n createVNode(ClockIcon, {\n class: \"detail-icon\",\n size: 16,\n title: \"\"\n }),\n createTextVNode(\" \" + toDisplayString(localTimeLabel.value), 1)\n ])\n ])) : createCommentVNode(\"\", true)\n ])) : createCommentVNode(\"\", true),\n profileData.value.headline || profileData.value.biography ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [\n profileData.value.headline ? (openBlock(), createElementBlock(\"h3\", _hoisted_25, toDisplayString(profileData.value.headline), 1)) : createCommentVNode(\"\", true),\n profileData.value.biography ? (openBlock(), createElementBlock(\"div\", _hoisted_26, [\n createVNode(NcRichText, {\n text: profileData.value.biography,\n useExtendedMarkdown: \"\"\n }, null, 8, [\"text\"])\n ])) : createCommentVNode(\"\", true)\n ], 64)) : (openBlock(), createBlock(NcEmptyContent, {\n key: 2,\n class: \"profile-hover-card__blocks-empty-info\",\n name: emptyProfileMessage.value,\n description: unref(t)(\"The headline and about sections will show up here\")\n }, {\n icon: withCtx(() => [\n createVNode(AccountIcon, { size: 40 })\n ]),\n _: 1\n }, 8, [\"name\", \"description\"]))\n ])\n ])\n ])\n ], 64)) : (openBlock(), createElementBlock(\"div\", _hoisted_27, toDisplayString(unref(t)(\"Failed to load profile\")), 1))\n ], 8, _hoisted_1);\n };\n }\n});\nconst NcProfileHoverCard = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-dc040af1\"]]);\nexport {\n NcProfileHoverCard as default\n};\n//# sourceMappingURL=NcProfileHoverCard.mjs.map\n"],"names":["_sfc_main$5","_hoisted_1$5","_hoisted_2$5","_hoisted_3$5","_hoisted_4$5","_sfc_render$4","_ctx","_cache","$props","$setup","$data","$options","openBlock","createElementBlock","mergeProps","$event","createElementVNode","toDisplayString","createCommentVNode","AccountIcon","_export_sfc","_sfc_main$4","_hoisted_1$4","_hoisted_2$4","_hoisted_3$4","_hoisted_4$4","_sfc_render$3","BriefcaseIcon","_sfc_main$3","_hoisted_1$3","_hoisted_2$3","_hoisted_3$3","_hoisted_4$3","_sfc_render$2","ClockIcon","_sfc_main$2","_hoisted_1$2","_hoisted_2$2","_hoisted_3$2","_hoisted_4$2","_sfc_render$1","MapMarkerIcon","_sfc_main$1","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","_sfc_render","PencilIcon","register","t1","PROFILE_CACHE_TTL_MS","cache","inflight","getCachedProfile","userId","entry","setCachedProfile","data","ttlMs","fetchProfileCached","fetcher","cached","pending","promise","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_sfc_main","defineComponent","__props","props","loading","ref","error","profileData","userStatus","isMobile","useIsSmallMobile","isCurrentUser","computed","getCurrentUser","settingsUrl","generateUrl","resolvedActions","action","localTimeLabel","time","formatProfileLocalTime","t","primaryAction","otherActions","primaryActionButtonProps","emptyProfileMessage","name","avatarUserStatus","date","timeZone","getCanonicalLocale","shifted","isIconUrl","icon","otherActionComponent","NcActionRouter","NcActionButton","NcActionLink","otherActionProps","watch","value","loadProfile","isOpen","onMounted","hasPreloadedUserStatus","ensureUserStatus","fetchUserStatus","profile","status","axios","generateOcsUrl","e","logger","getCapabilities","unref","createVNode","NcLoadingIcon","Fragment","createBlock","NcButton","withCtx","NcAvatar","createSlots","createTextVNode","NcIconSvgWrapper","normalizeClass","NcActions","renderList","index","resolveDynamicComponent","NcRichText","NcEmptyContent","NcProfileHoverCard"],"mappings":"4iBAqBA,MAAMA,GAAc,CAClB,KAAM,qBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,gRAAgR,EACpSC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAcC,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CACpE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,4CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQb,GAAc,CACvCK,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAAST,GAAca,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGhB,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMkB,GAA8BC,EAAYpB,GAAa,CAAC,CAAC,SAAUK,EAAa,CAAC,CAAC,EAClFgB,GAAc,CAClB,KAAM,uBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,+VAA+V,EACnXC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAcpB,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CACpE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,8CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQQ,GAAc,CACvChB,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAASY,GAAcR,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGK,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMK,GAAgCP,EAAYC,GAAa,CAAC,CAAC,SAAUK,EAAa,CAAC,CAAC,EACpFE,GAAc,CAClB,KAAM,mBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,oMAAoM,EACxNC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAc3B,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CACpE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,0CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQe,GAAc,CACvCvB,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAASmB,GAAcf,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGY,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMK,GAA4Bd,EAAYQ,GAAa,CAAC,CAAC,SAAUK,EAAa,CAAC,CAAC,EAChFE,GAAc,CAClB,KAAM,uBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,8OAA8O,EAClQC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAclC,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CACpE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,+CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQsB,GAAc,CACvC9B,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAAS0B,GAActB,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGmB,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMK,GAAgCrB,EAAYe,GAAa,CAAC,CAAC,SAAUK,EAAa,CAAC,CAAC,EACpFE,GAAc,CAClB,KAAM,oBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,GAAe,CAAC,cAAe,YAAY,EAC3CC,GAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,GAAe,CAAE,EAAG,oOAAoO,EACxPC,GAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,GAAYzC,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CAClE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,2CACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQ6B,GAAc,CACvCrC,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAASiC,GAAc7B,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAG0B,EAAY,EACtB,EAAK,GAAID,EAAY,CACrB,CACA,MAAMK,GAA6B5B,EAAYsB,GAAa,CAAC,CAAC,SAAUK,EAAW,CAAC,CAAC,EACrFE,GAASC,EAAE,EAKX,MAAMC,EAAuB,KAAU,IACjCC,EAAwB,IAAI,IAC5BC,EAA2B,IAAI,IACrC,SAASC,EAAiBC,EAAQ,CAChC,MAAMC,EAAQJ,EAAM,IAAIG,CAAM,EAC9B,OAAKC,EAGD,KAAK,OAASA,EAAM,WACtBJ,EAAM,OAAOG,CAAM,EACZ,MAEFC,EAAM,KANJ,IAOX,CACA,SAASC,EAAiBF,EAAQG,EAAMC,EAAQR,EAAsB,CACpEC,EAAM,IAAIG,EAAQ,CAChB,KAAAG,EACA,UAAW,KAAK,MAAQC,CAC5B,CAAG,CACH,CACA,eAAeC,GAAmBL,EAAQM,EAASF,EAAQR,EAAsB,CAC/E,MAAMW,EAASR,EAAiBC,CAAM,EACtC,GAAIO,EACF,OAAOA,EAET,MAAMC,EAAUV,EAAS,IAAIE,CAAM,EACnC,GAAIQ,EACF,OAAOA,EAET,MAAMC,GAAW,SAAY,CAC3B,GAAI,CACF,MAAMN,EAAO,MAAMG,EAAO,EAC1B,OAAIH,GACFD,EAAiBF,EAAQG,EAAMC,CAAK,EAE/BD,CACT,QAAA,CACEL,EAAS,OAAOE,CAAM,CACxB,CACF,GAAC,EACD,OAAAF,EAAS,IAAIE,EAAQS,CAAO,EACrBA,CACT,CACA,MAAMC,GAAa,CAAC,YAAY,EAC1BC,GAAa,CACjB,IAAK,EACL,MAAO,6BACT,EACMC,GAAa,CAAE,MAAO,4BAA4B,EAClDC,GAAa,CAAE,MAAO,uCAAuC,EAC7DC,GAAa,CACjB,IAAK,EACL,MAAO,oDACT,EACMC,GAAa,CAAE,MAAO,iDAAiD,EACvEC,GAAa,CAAE,MAAO,oDAAoD,EAC1EC,GAAa,CACjB,IAAK,EACL,MAAO,0DACT,EACMC,GAAa,CACjB,IAAK,EACL,MAAO,iDACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,+CACT,EACMC,GAAc,CAAE,MAAO,uDAAuD,EAC9EC,GAAc,CAAE,MAAO,0BAA0B,EACjDC,GAAc,CAAE,MAAO,6BAA6B,EACpDC,GAAc,CAAE,MAAO,6BAA6B,EACpDC,GAAc,CAAE,MAAO,cAAc,EACrCC,GAAc,CAClB,IAAK,EACL,MAAO,uBACT,EACMC,GAAc,CAAC,KAAK,EACpBC,GAAc,CAAC,KAAK,EACpBC,GAAc,CAAE,MAAO,4BAA4B,EACnDC,GAAc,CAClB,IAAK,EACL,MAAO,oCACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,QACT,EACMC,GAAc,CAAE,IAAK,CAAC,EACtBC,GAAc,CAClB,IAAK,EACL,MAAO,QACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,QACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,qCACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,sCACT,EACMC,GAAc,CAClB,IAAK,EACL,MAAO,2BACT,EACMC,GAA4BC,GAAgB,CAChD,OAAQ,qBACR,MAAO,CACL,KAAM,CAAE,QAAS,IAAI,EACrB,QAAS,CAAE,QAAS,IAAI,EACxB,oBAAqB,CAAE,QAAS,IAAI,EACpC,KAAM,CAAE,KAAM,QAAS,QAAS,EAAK,EACrC,QAAS,CAAE,QAAS,IAAI,EACxB,eAAgB,CAAE,KAAM,QAAS,QAAS,EAAK,CACnD,EACE,MAAMC,EAAS,CACb,MAAMC,EAAQD,EACRE,EAAUC,EAAI,EAAK,EACnBC,EAAQD,EAAI,EAAK,EACjBE,EAAcF,EAAIF,EAAM,OAAO,EAC/BK,EAAaH,EAAIF,EAAM,qBAAuB,CAAA,CAAE,EAChDM,EAAWC,GAAgB,EAC7BP,EAAM,MAAQA,EAAM,SACtBtC,EAAiBsC,EAAM,KAAMA,EAAM,OAAO,EAE5C,MAAMQ,EAAgBC,EAAS,IAAM,CAAC,CAACT,EAAM,MAAQU,KAAkB,MAAQV,EAAM,IAAI,EACnFW,GAAcC,GAAY,gBAAgB,EAC1CC,EAAkBJ,EAAS,IAC3BT,EAAM,SAAWA,EAAM,QAAQ,OAAS,EACnCA,EAAM,QAAQ,OAAQc,GAAWA,EAAO,QAAU,UAAU,GAE7DV,EAAY,OAAO,SAAW,CAAA,GAAI,OAAQU,GAAWA,EAAO,QAAU,UAAU,EAAE,IAAKA,IAAY,CACzG,GAAIA,EAAO,GACX,MAAOA,EAAO,MACd,KAAMA,EAAO,MACb,KAAMA,EAAO,QAAU,OACvB,KAAMA,EAAO,KACb,OAAQA,EAAO,KAAO,QAAU,QAAU,SAC1C,IAAKA,EAAO,KAAO,YAAc,KAAO,MAChD,EAAQ,CACH,EACKC,EAAiBN,EAAS,IAAM,CACpC,MAAMO,EAAOC,GAAuC,IAAI,IAAM,EAC9D,OAAKD,EAGEE,EAAE,qBAAsB,CAAE,KAAAF,EAAM,EAF9B,IAGX,CAAC,EACKG,EAAgBV,EAAS,IAAMI,EAAgB,MAAM,CAAC,CAAC,EACvDO,EAAeX,EAAS,IAAMI,EAAgB,MAAM,MAAM,CAAC,CAAC,EAC5DQ,GAA2BZ,EAAS,IAAM,CAC9C,MAAMK,EAASK,EAAc,MAC7B,OAAKL,EAGDA,EAAO,GACF,CAAE,GAAIA,EAAO,EAAE,EAEpBA,EAAO,KACF,CACL,KAAMA,EAAO,KACb,OAAQA,EAAO,SAAWA,EAAO,KAAK,WAAW,MAAM,EAAI,QAAU,UACrE,IAAKA,EAAO,GACtB,EAEa,CAAA,EAZE,CAAA,CAaX,CAAC,EACKQ,GAAsBb,EAAS,IAAM,CACzC,GAAID,EAAc,MAChB,OAAOU,EAAE,iCAAiC,EAE5C,MAAMK,EAAOnB,EAAY,OAAO,aAAeJ,EAAM,MAAQ,GAC7D,OAAOkB,EAAE,oCAAqC,CAAE,KAAMK,CAAI,CAAE,CAC9D,CAAC,EACKC,EAAmBf,EAAS,KAAO,CACvC,OAAQJ,EAAW,MAAM,QAAU,KACnC,KAAMA,EAAW,MAAM,MAAQ,KAC/B,QAASA,EAAW,MAAM,SAAW,IAC3C,EAAM,EACF,SAASY,GAAuBQ,EAAM,CACpC,MAAMC,EAAWtB,EAAY,OAAO,SACpC,GAAIsB,EACF,GAAI,CACF,OAAO,IAAI,KAAK,eAAeC,IAAsB,CACnD,SAAAD,EACA,KAAM,UACN,OAAQ,SACpB,CAAW,EAAE,OAAOD,CAAI,CAChB,MAAQ,CACR,CAEF,GAAI,OAAOrB,EAAY,OAAO,gBAAmB,SAAU,CACzD,MAAMwB,EAAU,IAAI,KAAKH,EAAK,QAAO,EAAKrB,EAAY,MAAM,eAAiB,GAAG,EAChF,OAAO,IAAI,KAAK,eAAeuB,IAAsB,CACnD,SAAU,MACV,KAAM,UACN,OAAQ,SAClB,CAAS,EAAE,OAAOC,CAAO,CACnB,CACA,OAAO,IACT,CACA,SAASC,EAAUC,EAAM,CACvB,MAAO,CAAC,CAACA,IAAS,kBAAkB,KAAKA,CAAI,GAAKA,EAAK,WAAW,GAAG,GAAKA,EAAK,WAAW,OAAO,EACnG,CACA,SAASC,GAAqBjB,EAAQ,CACpC,OAAIA,EAAO,GACFkB,GAELlB,EAAO,SAAW,CAACA,EAAO,KACrBmB,GAEFC,EACT,CACA,SAASC,GAAiBrB,EAAQ,CAChC,OAAIA,EAAO,GACF,CAAE,GAAIA,EAAO,GAAI,gBAAiB,EAAI,EAE3CA,EAAO,SAAW,CAACA,EAAO,KACrB,CAAE,QAASA,EAAO,QAAS,gBAAiB,EAAI,EAElD,CACL,KAAMA,EAAO,KACb,OAAQA,EAAO,SAAWA,EAAO,MAAM,WAAW,MAAM,EAAI,QAAU,UACtE,IAAKA,EAAO,IACZ,gBAAiB,EACzB,CACI,CACAsB,EAAM,IAAMpC,EAAM,QAAUqC,GAAU,CAChCA,IACFjC,EAAY,MAAQiC,EAChBrC,EAAM,MACRtC,EAAiBsC,EAAM,KAAMqC,CAAK,EAEpClC,EAAM,MAAQ,GAElB,CAAC,EACDiC,EAAM,IAAMpC,EAAM,oBAAsBqC,GAAU,CAC5CA,IACFhC,EAAW,MAAQgC,EAEvB,CAAC,EACDD,EAAM,IAAMpC,EAAM,KAAM,IAAM,CAC5BI,EAAY,MAAQJ,EAAM,QAC1BK,EAAW,MAAQL,EAAM,qBAAuB,CAAA,EAChDG,EAAM,MAAQ,GACVH,EAAM,MAAQA,EAAM,SACtBtC,EAAiBsC,EAAM,KAAMA,EAAM,OAAO,EAExCA,EAAM,MACRsC,EAAW,CAEf,CAAC,EACDF,EAAM,IAAMpC,EAAM,KAAOuC,GAAW,CAC9BA,GACFD,EAAW,CAEf,CAAC,EACDE,GAAU,IAAM,CACVxC,EAAM,MACRsC,EAAW,CAEf,CAAC,EACD,SAASG,GAAyB,CAChC,OAAOzC,EAAM,sBAAwB,MAAQ,CAAC,EAAEK,EAAW,MAAM,MAAQA,EAAW,MAAM,SAAWA,EAAW,MAAM,OACxH,CACA,eAAeqC,GAAiBlF,EAAQ,CACjCiF,EAAsB,IACzBpC,EAAW,MAAQ,MAAMsC,EAAgBnF,CAAM,EAEnD,CACA,eAAe8E,GAAc,CAC3B,GAAI,CAACtC,EAAM,MAAQC,EAAQ,MACzB,OAEF,MAAMzC,EAASwC,EAAM,KACrB,GAAI,CAACI,EAAY,MAAO,CACtB,MAAMrC,EAASR,EAAiBC,CAAM,EAClCO,IACFqC,EAAY,MAAQrC,EAExB,CACA,GAAIqC,EAAY,MAAO,CACrB,MAAMsC,GAAiBlF,CAAM,EAC7B,MACF,CACAyC,EAAQ,MAAQ,GAChBE,EAAM,MAAQ,GACd,GAAI,CACF,KAAM,CAACyC,EAASC,CAAM,EAAI,MAAM,QAAQ,IAAI,CAC1ChF,GAAmBL,EAAQ,SAAY,CACrC,KAAM,CAAE,KAAAG,GAAS,MAAMmF,EAAM,IAAIC,EAAe,oBAAqB,CAAE,OAAAvF,CAAM,CAAE,CAAC,EAChF,OAAOG,EAAK,KAAK,MAAQ,IAC3B,CAAC,EACD8E,EAAsB,EAAK,QAAQ,QAAQpC,EAAW,KAAK,EAAIsC,EAAgBnF,CAAM,CAC/F,CAAS,EACD4C,EAAY,MAAQwC,EACpBvC,EAAW,MAAQwC,EACdzC,EAAY,QACfD,EAAM,MAAQ,GAElB,OAAS6C,EAAG,CACVC,EAAO,MAAM,uCAAwC,CAAE,MAAOD,EAAG,KAAMxF,EAAQ,EAC/E2C,EAAM,MAAQ,EAChB,QAAA,CACEF,EAAQ,MAAQ,EAClB,CACF,CACA,eAAe0C,EAAgBnF,EAAQ,CACrC,GAAI,CACF,GAAI,CAAC0F,GAAe,GAAI,aAAa,SAAW,CAACxC,EAAc,EAC7D,MAAO,CAAA,EAET,KAAM,CAAE,KAAA/C,GAAS,MAAMmF,EAAM,IAAIC,EAAe,6CAA8C,CAAE,OAAAvF,CAAM,CAAE,CAAC,EACzG,OAAOG,EAAK,KAAK,MAAQ,CAAA,CAC3B,OAASqF,EAAG,CACV,OAAAC,EAAO,MAAM,2CAA4C,CAAE,MAAOD,EAAG,OAAAxF,EAAQ,EACtE,CAAA,CACT,CACF,CACA,MAAO,CAACjD,EAAMC,KACLK,EAAS,EAAIC,EAAmB,MAAO,CAC5C,MAAO,qBACP,KAAM,SACN,aAAcqI,EAAMjC,CAAC,EAAE,oBAAqB,CAAE,KAAMd,EAAY,OAAO,aAAeL,EAAQ,MAAQ,EAAE,CAAE,CAClH,EAAS,CACDE,EAAQ,OAASpF,EAAS,EAAIC,EAAmB,MAAOqD,GAAY,CAClEiF,EAAYC,EAAe,CACzB,KAAM,GACN,KAAMF,EAAMjC,CAAC,EAAE,iBAAiB,CAC5C,EAAa,KAAM,EAAG,CAAC,MAAM,CAAC,CAC9B,CAAS,GAAKd,EAAY,OAAS,CAACD,EAAM,OAAStF,EAAS,EAAIC,EAAmBwI,EAAU,CAAE,IAAK,CAAC,EAAI,CAC/FrI,EAAmB,MAAOmD,GAAY,CACpCoC,EAAc,OAAS3F,IAAa0I,EAAYC,EAAU,CACxD,IAAK,EACL,MAAO,mCACP,QAAS,WACT,aAAcL,EAAMjC,CAAC,EAAE,cAAc,EACrC,MAAOiC,EAAMjC,CAAC,EAAE,cAAc,EAC9B,KAAMiC,EAAMxC,EAAW,EACvB,OAAQ,QACtB,EAAe,CACD,KAAM8C,EAAQ,IAAM,CAClBL,EAAYnG,GAAY,CAAE,KAAM,EAAE,CAAE,CACpD,CAAe,EACD,EAAG,CACjB,EAAe,EAAG,CAAC,aAAc,QAAS,MAAM,CAAC,GAAK9B,EAAmB,GAAI,EAAI,EACrEF,EAAmB,MAAOoD,GAAY,CACpC8E,EAAM7C,CAAQ,GAAKzF,EAAS,EAAI0I,EAAYG,EAAU,CACpD,IAAK,EACL,MAAO,uDACP,KAAMtD,EAAY,MAAM,OACxB,KAAM,GACN,YAAa,GACb,eAAgB,GAChB,oBAAqBoB,EAAiB,MACtC,SAAU,CAACpB,EAAY,MAAM,mBAC7C,EAAiB,KAAM,EAAG,CAAC,OAAQ,sBAAuB,UAAU,CAAC,IAAMvF,EAAS,EAAIC,EAAmB,MAAOwD,EAAU,GAC9GrD,EAAmB,MAAOsD,GAAY,CACpCtD,EAAmB,MAAOuD,GAAY,CACpCvD,EAAmB,KAAM,KAAMC,EAAgBkF,EAAY,MAAM,aAAeA,EAAY,MAAM,MAAM,EAAG,CAAC,EAC5GA,EAAY,MAAM,UAAYvF,EAAS,EAAIC,EAAmB,OAAQ2D,GAAY,GAAG,GAAKtD,EAAmB,GAAI,EAAI,EACrHiF,EAAY,MAAM,UAAYvF,EAAS,EAAIC,EAAmB,OAAQ4D,GAAYxD,EAAgBkF,EAAY,MAAM,QAAQ,EAAG,CAAC,GAAKjF,EAAmB,GAAI,EAAI,CAClL,CAAiB,EACDkF,EAAW,MAAM,MAAQA,EAAW,MAAM,SAAWxF,IAAaC,EAAmB,MAAO6D,GAAa,CACvG1D,EAAmB,OAAQ2D,GAAa,CACtC3D,EAAmB,OAAQ,KAAMC,EAAgBmF,EAAW,MAAM,IAAI,EAAI,IAAMnF,EAAgBmF,EAAW,MAAM,OAAO,EAAG,CAAC,CAChJ,CAAmB,CACnB,CAAiB,GAAKlF,EAAmB,GAAI,EAAI,CACjD,CAAe,CACf,CAAa,CACb,CAAW,EACDF,EAAmB,MAAO4D,GAAa,CACrC5D,EAAmB,MAAO6D,GAAa,CACrC7D,EAAmB,MAAO8D,GAAa,CACpCoE,EAAM7C,CAAQ,EAS6CnF,EAAmB,GAAI,EAAI,GATnEN,EAAS,EAAI0I,EAAYG,EAAU,CACrD,IAAK,EACL,MAAO,SACP,KAAMtD,EAAY,MAAM,OACxB,KAAM,IACN,YAAa,GACb,eAAgB,GAChB,oBAAqBoB,EAAiB,MACtC,SAAU,CAACpB,EAAY,MAAM,mBAC/C,EAAmB,KAAM,EAAG,CAAC,OAAQ,sBAAuB,UAAU,CAAC,GACvDnF,EAAmB,MAAO+D,GAAa,CACrCe,EAAQ,gBAAkBc,EAAgB,MAAM,SAAW,GAAKhG,IAAaC,EAAmB,MAAOmE,GAAa,CAClHmE,EAAYC,EAAe,CACzB,KAAM,GACN,KAAMF,EAAMjC,CAAC,EAAE,iBAAiB,CACtD,EAAuB,KAAM,EAAG,CAAC,MAAM,CAAC,CACxC,CAAmB,IAAMrG,EAAS,EAAIC,EAAmBwI,EAAU,CAAE,IAAK,GAAK,CAC3DnC,EAAc,OAAStG,EAAS,EAAI0I,EAAYC,EAAUzI,EAAW,CACnE,IAAK,EACL,QAAS,UACT,MAAO,uBAC7B,EAAuBsG,GAAyB,MAAO,CACjC,QAASF,EAAc,MAAM,OACnD,CAAqB,EAAGwC,EAAY,CACd,QAASF,EAAQ,IAAM,CACrBG,EAAgB,IAAM1I,EAAgBiG,EAAc,MAAM,IAAI,EAAG,CAAC,CAC1F,CAAuB,EACD,EAAG,CACzB,EAAuB,CACDA,EAAc,MAAM,SAAWA,EAAc,MAAM,KAAO,CACxD,KAAM,OACN,GAAIsC,EAAQ,IAAM,CAChBtC,EAAc,MAAM,SAAWtG,EAAS,EAAI0I,EAAYJ,EAAMU,CAAgB,EAAG,CAC/E,IAAK,EACL,IAAK1C,EAAc,MAAM,OACrD,EAA6B,KAAM,EAAG,CAAC,KAAK,CAAC,GAAKU,EAAUV,EAAc,MAAM,IAAI,GAAKtG,EAAS,EAAIC,EAAmB,MAAO,CACpG,IAAK,EACL,IAAKqG,EAAc,MAAM,KACzB,IAAK,GACL,MAAO,6BACnC,EAA6B,KAAM,EAAGjC,EAAW,IAAMrE,EAAS,EAAIC,EAAmB,OAAQ,CACnE,IAAK,EACL,cAAe,OACf,MAAOgJ,EAAe,CAAC,oCAAqC3C,EAAc,MAAM,IAAI,CAAC,CACjH,EAA6B,KAAM,CAAC,EACpC,CAAyB,EACD,IAAK,GAC7B,EAA0B,MAC1B,CAAqB,EAAG,KAAM,CAAC,SAAS,CAAC,GAAKhG,EAAmB,GAAI,EAAI,EACrDiG,EAAa,MAAM,OAAS,GAAKvG,EAAS,EAAI0I,EAAYQ,GAAW,CACnE,IAAK,EACL,MAAO,sBACP,OAAQZ,EAAM7C,CAAQ,EAAI,EAAI,CACpD,EAAuB,CACD,QAASmD,EAAQ,IAAM,EACpB5I,EAAU,EAAI,EAAGC,EAAmBwI,EAAU,KAAMU,GAAW5C,EAAa,MAAO,CAACN,EAAQmD,KACpFpJ,EAAS,EAAI0I,EAAYW,GAAwBnC,GAAqBjB,CAAM,CAAC,EAAG/F,EAAW,CAChG,IAAK+F,EAAO,IAAMA,EAAO,MAAQmD,CAC7D,EAA6B,CAAE,QAAS,EAAI,EAAI9B,GAAiBrB,CAAM,CAAC,EAAG6C,EAAY,CAC3D,QAASF,EAAQ,IAAM,CACrBG,EAAgB,IAAM1I,EAAgB4F,EAAO,IAAI,EAAG,CAAC,CACnF,CAA6B,EACD,EAAG,CAC/B,EAA6B,CACDA,EAAO,SAAWA,EAAO,KAAO,CAC9B,KAAM,OACN,GAAI2C,EAAQ,IAAM,CAChB3C,EAAO,SAAWjG,EAAS,EAAI0I,EAAYJ,EAAMU,CAAgB,EAAG,CAClE,IAAK,EACL,IAAK/C,EAAO,OAC9C,EAAmC,KAAM,EAAG,CAAC,KAAK,CAAC,GAAKe,EAAUf,EAAO,IAAI,GAAKjG,IAAaC,EAAmB,MAAO,CACvF,IAAK,EACL,IAAKgG,EAAO,KACZ,IAAK,GACL,MAAO,2BACzC,EAAmC,KAAM,EAAG3B,EAAW,IAAMtE,EAAS,EAAIC,EAAmB,OAAQ,CACnE,IAAK,EACL,cAAe,OACf,MAAOgJ,EAAe,CAAC,kCAAmChD,EAAO,IAAI,CAAC,CACxG,EAAmC,KAAM,CAAC,EAC1C,CAA+B,EACD,IAAK,GACnC,EAAgC,MAChC,CAA2B,EAAG,IAAI,EACT,EAAG,GAAG,EAC/B,CAAuB,EACD,EAAG,CACzB,EAAuB,EAAG,CAAC,QAAQ,CAAC,GAAK3F,EAAmB,GAAI,EAAI,CACpE,EAAqB,EAAE,EACvB,CAAiB,CACjB,CAAe,EACDF,EAAmB,MAAOmE,GAAa,CACrCgB,EAAY,MAAM,cAAgBA,EAAY,MAAM,MAAQA,EAAY,MAAM,SAAWW,EAAe,OAASlG,EAAS,EAAIC,EAAmB,MAAOuE,GAAa,CACnKe,EAAY,MAAM,cAAgBA,EAAY,MAAM,MAAQvF,IAAaC,EAAmB,MAAOwE,GAAa,CAC9GrE,EAAmB,IAAK,KAAM,CAC5BmI,EAAYxH,GAAe,CACzB,MAAO,cACP,KAAM,GACN,MAAO,EAC/B,CAAuB,EACDgI,EAAgB,IAAM1I,EAAgBkF,EAAY,MAAM,YAAY,EAAI,IAAK,CAAC,EAC9EA,EAAY,MAAM,cAAgBA,EAAY,MAAM,MAAQvF,EAAS,EAAIC,EAAmB,OAAQyE,GAAa,GAAG,GAAKpE,EAAmB,GAAI,EAAI,EACpJyI,EAAgB,IAAM1I,EAAgBkF,EAAY,MAAM,IAAI,EAAG,CAAC,CACtF,CAAqB,CACrB,CAAmB,GAAKjF,EAAmB,GAAI,EAAI,EACjCiF,EAAY,MAAM,SAAWvF,EAAS,EAAIC,EAAmB,MAAO0E,GAAa,CAC/EvE,EAAmB,IAAK,KAAM,CAC5BmI,EAAY1G,GAAe,CACzB,MAAO,cACP,KAAM,GACN,MAAO,EAC/B,CAAuB,EACDkH,EAAgB,IAAM1I,EAAgBkF,EAAY,MAAM,OAAO,EAAG,CAAC,CACzF,CAAqB,CACrB,CAAmB,GAAKjF,EAAmB,GAAI,EAAI,EACjC4F,EAAe,OAASlG,EAAS,EAAIC,EAAmB,MAAO2E,GAAa,CAC1ExE,EAAmB,IAAK,KAAM,CAC5BmI,EAAYjH,GAAW,CACrB,MAAO,cACP,KAAM,GACN,MAAO,EAC/B,CAAuB,EACDyH,EAAgB,IAAM1I,EAAgB6F,EAAe,KAAK,EAAG,CAAC,CACpF,CAAqB,CACrB,CAAmB,GAAK5F,EAAmB,GAAI,EAAI,CACnD,CAAiB,GAAKA,EAAmB,GAAI,EAAI,EACjCiF,EAAY,MAAM,UAAYA,EAAY,MAAM,WAAavF,EAAS,EAAIC,EAAmBwI,EAAU,CAAE,IAAK,CAAC,EAAI,CACjHlD,EAAY,MAAM,UAAYvF,EAAS,EAAIC,EAAmB,KAAM4E,GAAaxE,EAAgBkF,EAAY,MAAM,QAAQ,EAAG,CAAC,GAAKjF,EAAmB,GAAI,EAAI,EAC/JiF,EAAY,MAAM,WAAavF,EAAS,EAAIC,EAAmB,MAAO6E,GAAa,CACjFyD,EAAYe,GAAY,CACtB,KAAM/D,EAAY,MAAM,UACxB,oBAAqB,EAC3C,EAAuB,KAAM,EAAG,CAAC,MAAM,CAAC,CACxC,CAAmB,GAAKjF,EAAmB,GAAI,EAAI,CACnD,EAAmB,EAAE,IAAMN,IAAa0I,EAAYa,GAAgB,CAClD,IAAK,EACL,MAAO,wCACP,KAAM9C,GAAoB,MAC1B,YAAa6B,EAAMjC,CAAC,EAAE,mDAAmD,CAC3F,EAAmB,CACD,KAAMuC,EAAQ,IAAM,CAClBL,EAAYhI,GAAa,CAAE,KAAM,EAAE,CAAE,CACzD,CAAmB,EACD,EAAG,CACrB,EAAmB,EAAG,CAAC,OAAQ,aAAa,CAAC,EAC7C,CAAe,CACf,CAAa,CACb,CAAW,CACX,EAAW,EAAE,IAAMP,IAAaC,EAAmB,MAAO8E,GAAa1E,EAAgBiI,EAAMjC,CAAC,EAAE,wBAAwB,CAAC,EAAG,CAAC,EAC7H,EAAS,EAAGhD,EAAU,EAEpB,CACF,CAAC,EACKmG,GAAqChJ,EAAYwE,GAAW,CAAC,CAAC,YAAa,iBAAiB,CAAC,CAAC","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/js/NcProfileHoverCard-EthqH19m.chunk.mjs.map.license b/js/NcProfileHoverCard-DsPWCnY_.chunk.mjs.map.license similarity index 100% rename from js/NcProfileHoverCard-EthqH19m.chunk.mjs.map.license rename to js/NcProfileHoverCard-DsPWCnY_.chunk.mjs.map.license diff --git a/js/NcSettingsSection-BWTcz41N.chunk.mjs b/js/NcSettingsSection-DXf6H0mA.chunk.mjs similarity index 90% rename from js/NcSettingsSection-BWTcz41N.chunk.mjs rename to js/NcSettingsSection-DXf6H0mA.chunk.mjs index 03d79e5e0..77bfacf0f 100644 --- a/js/NcSettingsSection-BWTcz41N.chunk.mjs +++ b/js/NcSettingsSection-DXf6H0mA.chunk.mjs @@ -1,2 +1,2 @@ -import{r as f,k as m,d as r,n as g}from"./_plugin-vue_export-helper-CH0UJGgl.chunk.mjs";import{l as u,o as i,e as s,b as c,h,t as l,u as o,g as _,f as n,m as C,p as b}from"./style-Blm0XmjK.chunk.mjs";const k={name:"HelpCircleIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},v=["aria-hidden","aria-label"],y=["fill","width","height"],A={d:"M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"},H={key:0};function w(t,a,e,d,$,L){return i(),s("span",b(t.$attrs,{"aria-hidden":e.title?null:"true","aria-label":e.title,class:"material-design-icon help-circle-icon",role:"img",onClick:a[0]||(a[0]=p=>t.$emit("click",p))}),[(i(),s("svg",{fill:e.fillColor,class:"material-design-icon__svg",width:e.size,height:e.size,viewBox:"0 0 24 24"},[c("path",A,[e.title?(i(),s("title",H,l(e.title),1)):n("",!0)])],8,y))],16,v)}const z=r(k,[["render",w]]);f(m);const S={class:"settings-section"},x={class:"settings-section__name"},M=["aria-label","href","title"],N={key:0,class:"settings-section__desc"},U=u({__name:"NcSettingsSection",props:{name:{},description:{default:""},docUrl:{default:""}},setup(t){const a=g("External documentation");return(e,d)=>(i(),s("div",S,[c("h2",x,[h(l(t.name)+" ",1),t.docUrl?(i(),s("a",{key:0,"aria-label":o(a),class:"settings-section__info",href:t.docUrl,rel:"noreferrer nofollow",target:"_blank",title:o(a)},[_(z,{size:20})],8,M)):n("",!0)]),t.description?(i(),s("p",N,l(t.description),1)):n("",!0),C(e.$slots,"default",{},void 0,!0)]))}}),E=r(U,[["__scopeId","data-v-9cedb949"]]);export{E as N}; -//# sourceMappingURL=NcSettingsSection-BWTcz41N.chunk.mjs.map +import{r as f,k as m,d as r,n as g}from"./_plugin-vue_export-helper-DqxYO0VT.chunk.mjs";import{l as u,o as i,e as s,b as c,h,t as l,u as o,g as _,f as n,m as C,p as b}from"./style-D66n12eC.chunk.mjs";const k={name:"HelpCircleIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},v=["aria-hidden","aria-label"],y=["fill","width","height"],A={d:"M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"},H={key:0};function w(t,a,e,d,$,L){return i(),s("span",b(t.$attrs,{"aria-hidden":e.title?null:"true","aria-label":e.title,class:"material-design-icon help-circle-icon",role:"img",onClick:a[0]||(a[0]=p=>t.$emit("click",p))}),[(i(),s("svg",{fill:e.fillColor,class:"material-design-icon__svg",width:e.size,height:e.size,viewBox:"0 0 24 24"},[c("path",A,[e.title?(i(),s("title",H,l(e.title),1)):n("",!0)])],8,y))],16,v)}const z=r(k,[["render",w]]);f(m);const S={class:"settings-section"},x={class:"settings-section__name"},M=["aria-label","href","title"],N={key:0,class:"settings-section__desc"},U=u({__name:"NcSettingsSection",props:{name:{},description:{default:""},docUrl:{default:""}},setup(t){const a=g("External documentation");return(e,d)=>(i(),s("div",S,[c("h2",x,[h(l(t.name)+" ",1),t.docUrl?(i(),s("a",{key:0,"aria-label":o(a),class:"settings-section__info",href:t.docUrl,rel:"noreferrer nofollow",target:"_blank",title:o(a)},[_(z,{size:20})],8,M)):n("",!0)]),t.description?(i(),s("p",N,l(t.description),1)):n("",!0),C(e.$slots,"default",{},void 0,!0)]))}}),E=r(U,[["__scopeId","data-v-9cedb949"]]);export{E as N}; +//# sourceMappingURL=NcSettingsSection-DXf6H0mA.chunk.mjs.map diff --git a/js/NcSettingsSection-BWTcz41N.chunk.mjs.license b/js/NcSettingsSection-DXf6H0mA.chunk.mjs.license similarity index 100% rename from js/NcSettingsSection-BWTcz41N.chunk.mjs.license rename to js/NcSettingsSection-DXf6H0mA.chunk.mjs.license diff --git a/js/NcSettingsSection-BWTcz41N.chunk.mjs.map b/js/NcSettingsSection-DXf6H0mA.chunk.mjs.map similarity index 98% rename from js/NcSettingsSection-BWTcz41N.chunk.mjs.map rename to js/NcSettingsSection-DXf6H0mA.chunk.mjs.map index 21fa86b32..51cf83724 100644 --- a/js/NcSettingsSection-BWTcz41N.chunk.mjs.map +++ b/js/NcSettingsSection-DXf6H0mA.chunk.mjs.map @@ -1 +1 @@ -{"version":3,"file":"NcSettingsSection-BWTcz41N.chunk.mjs","sources":["../node_modules/@nextcloud/vue/dist/chunks/NcSettingsSection.mjs"],"sourcesContent":["import '../assets/NcSettingsSection.css';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode, toDisplayString, createCommentVNode, defineComponent, createTextVNode, unref, createVNode, renderSlot } from \"vue\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { r as register, E as t27, a as t } from \"./_l10n.mjs\";\nconst _sfc_main$1 = {\n name: \"HelpCircleIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$1 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$1 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$1 = { d: \"M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z\" };\nconst _hoisted_4$1 = { key: 0 };\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon help-circle-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$1, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$1, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$1))\n ], 16, _hoisted_1$1);\n}\nconst HelpCircle = /* @__PURE__ */ _export_sfc(_sfc_main$1, [[\"render\", _sfc_render]]);\nregister(t27);\nconst _hoisted_1 = { class: \"settings-section\" };\nconst _hoisted_2 = { class: \"settings-section__name\" };\nconst _hoisted_3 = [\"aria-label\", \"href\", \"title\"];\nconst _hoisted_4 = {\n key: 0,\n class: \"settings-section__desc\"\n};\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcSettingsSection\",\n props: {\n name: {},\n description: { default: \"\" },\n docUrl: { default: \"\" }\n },\n setup(__props) {\n const ariaLabel = t(\"External documentation\");\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", _hoisted_1, [\n createElementVNode(\"h2\", _hoisted_2, [\n createTextVNode(toDisplayString(__props.name) + \" \", 1),\n __props.docUrl ? (openBlock(), createElementBlock(\"a\", {\n key: 0,\n \"aria-label\": unref(ariaLabel),\n class: \"settings-section__info\",\n href: __props.docUrl,\n rel: \"noreferrer nofollow\",\n target: \"_blank\",\n title: unref(ariaLabel)\n }, [\n createVNode(HelpCircle, { size: 20 })\n ], 8, _hoisted_3)) : createCommentVNode(\"\", true)\n ]),\n __props.description ? (openBlock(), createElementBlock(\"p\", _hoisted_4, toDisplayString(__props.description), 1)) : createCommentVNode(\"\", true),\n renderSlot(_ctx.$slots, \"default\", {}, void 0, true)\n ]);\n };\n }\n});\nconst NcSettingsSection = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-9cedb949\"]]);\nexport {\n NcSettingsSection as N\n};\n//# sourceMappingURL=NcSettingsSection.mjs.map\n"],"names":["_sfc_main$1","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","openBlock","createElementBlock","mergeProps","$event","createElementVNode","toDisplayString","createCommentVNode","HelpCircle","_export_sfc","register","t27","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_sfc_main","defineComponent","__props","ariaLabel","t","createTextVNode","unref","createVNode","renderSlot","NcSettingsSection"],"mappings":"wMAIA,MAAMA,EAAc,CAClB,KAAM,iBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,EAAe,CAAC,cAAe,YAAY,EAC3CC,EAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,EAAe,CAAE,EAAG,mUAAmU,EACvVC,EAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,EAAYC,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CAClE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,wCACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQb,EAAc,CACvCK,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAAST,EAAca,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGhB,CAAY,EACtB,EAAK,GAAID,CAAY,CACrB,CACA,MAAMkB,EAA6BC,EAAYpB,EAAa,CAAC,CAAC,SAAUK,CAAW,CAAC,CAAC,EACrFgB,EAASC,CAAG,EACZ,MAAMC,EAAa,CAAE,MAAO,kBAAkB,EACxCC,EAAa,CAAE,MAAO,wBAAwB,EAC9CC,EAAa,CAAC,aAAc,OAAQ,OAAO,EAC3CC,EAAa,CACjB,IAAK,EACL,MAAO,wBACT,EACMC,EAA4BC,EAAgB,CAChD,OAAQ,oBACR,MAAO,CACL,KAAM,CAAA,EACN,YAAa,CAAE,QAAS,EAAE,EAC1B,OAAQ,CAAE,QAAS,EAAE,CACzB,EACE,MAAMC,EAAS,CACb,MAAMC,EAAYC,EAAE,wBAAwB,EAC5C,MAAO,CAACzB,EAAMC,KACLK,EAAS,EAAIC,EAAmB,MAAOU,EAAY,CACxDP,EAAmB,KAAMQ,EAAY,CACnCQ,EAAgBf,EAAgBY,EAAQ,IAAI,EAAI,IAAK,CAAC,EACtDA,EAAQ,QAAUjB,IAAaC,EAAmB,IAAK,CACrD,IAAK,EACL,aAAcoB,EAAMH,CAAS,EAC7B,MAAO,yBACP,KAAMD,EAAQ,OACd,IAAK,sBACL,OAAQ,SACR,MAAOI,EAAMH,CAAS,CAClC,EAAa,CACDI,EAAYf,EAAY,CAAE,KAAM,EAAE,CAAE,CAChD,EAAa,EAAGM,CAAU,GAAKP,EAAmB,GAAI,EAAI,CAC1D,CAAS,EACDW,EAAQ,aAAejB,EAAS,EAAIC,EAAmB,IAAKa,EAAYT,EAAgBY,EAAQ,WAAW,EAAG,CAAC,GAAKX,EAAmB,GAAI,EAAI,EAC/IiB,EAAW7B,EAAK,OAAQ,UAAW,CAAA,EAAI,OAAQ,EAAI,CAC3D,CAAO,EAEL,CACF,CAAC,EACK8B,EAAoChB,EAAYO,EAAW,CAAC,CAAC,YAAa,iBAAiB,CAAC,CAAC","x_google_ignoreList":[0]} \ No newline at end of file +{"version":3,"file":"NcSettingsSection-DXf6H0mA.chunk.mjs","sources":["../node_modules/@nextcloud/vue/dist/chunks/NcSettingsSection.mjs"],"sourcesContent":["import '../assets/NcSettingsSection.css';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode, toDisplayString, createCommentVNode, defineComponent, createTextVNode, unref, createVNode, renderSlot } from \"vue\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { r as register, E as t27, a as t } from \"./_l10n.mjs\";\nconst _sfc_main$1 = {\n name: \"HelpCircleIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$1 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$1 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$1 = { d: \"M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z\" };\nconst _hoisted_4$1 = { key: 0 };\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon help-circle-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$1, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$1, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$1))\n ], 16, _hoisted_1$1);\n}\nconst HelpCircle = /* @__PURE__ */ _export_sfc(_sfc_main$1, [[\"render\", _sfc_render]]);\nregister(t27);\nconst _hoisted_1 = { class: \"settings-section\" };\nconst _hoisted_2 = { class: \"settings-section__name\" };\nconst _hoisted_3 = [\"aria-label\", \"href\", \"title\"];\nconst _hoisted_4 = {\n key: 0,\n class: \"settings-section__desc\"\n};\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcSettingsSection\",\n props: {\n name: {},\n description: { default: \"\" },\n docUrl: { default: \"\" }\n },\n setup(__props) {\n const ariaLabel = t(\"External documentation\");\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", _hoisted_1, [\n createElementVNode(\"h2\", _hoisted_2, [\n createTextVNode(toDisplayString(__props.name) + \" \", 1),\n __props.docUrl ? (openBlock(), createElementBlock(\"a\", {\n key: 0,\n \"aria-label\": unref(ariaLabel),\n class: \"settings-section__info\",\n href: __props.docUrl,\n rel: \"noreferrer nofollow\",\n target: \"_blank\",\n title: unref(ariaLabel)\n }, [\n createVNode(HelpCircle, { size: 20 })\n ], 8, _hoisted_3)) : createCommentVNode(\"\", true)\n ]),\n __props.description ? (openBlock(), createElementBlock(\"p\", _hoisted_4, toDisplayString(__props.description), 1)) : createCommentVNode(\"\", true),\n renderSlot(_ctx.$slots, \"default\", {}, void 0, true)\n ]);\n };\n }\n});\nconst NcSettingsSection = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-9cedb949\"]]);\nexport {\n NcSettingsSection as N\n};\n//# sourceMappingURL=NcSettingsSection.mjs.map\n"],"names":["_sfc_main$1","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","openBlock","createElementBlock","mergeProps","$event","createElementVNode","toDisplayString","createCommentVNode","HelpCircle","_export_sfc","register","t27","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_sfc_main","defineComponent","__props","ariaLabel","t","createTextVNode","unref","createVNode","renderSlot","NcSettingsSection"],"mappings":"wMAIA,MAAMA,EAAc,CAClB,KAAM,iBACN,MAAO,CAAC,OAAO,EACf,MAAO,CACL,MAAO,CACL,KAAM,MACZ,EACI,UAAW,CACT,KAAM,OACN,QAAS,cACf,EACI,KAAM,CACJ,KAAM,OACN,QAAS,EACf,CACA,CACA,EACMC,EAAe,CAAC,cAAe,YAAY,EAC3CC,EAAe,CAAC,OAAQ,QAAS,QAAQ,EACzCC,EAAe,CAAE,EAAG,mUAAmU,EACvVC,EAAe,CAAE,IAAK,CAAC,EAC7B,SAASC,EAAYC,EAAMC,EAAQC,EAAQC,EAAQC,EAAOC,EAAU,CAClE,OAAOC,EAAS,EAAIC,EAAmB,OAAQC,EAAWR,EAAK,OAAQ,CACrE,cAAeE,EAAO,MAAQ,KAAO,OACrC,aAAcA,EAAO,MACrB,MAAO,wCACP,KAAM,MACN,QAASD,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKQ,GAAWT,EAAK,MAAM,QAASS,CAAM,EAC7E,CAAG,EAAG,EACDH,EAAS,EAAIC,EAAmB,MAAO,CACtC,KAAML,EAAO,UACb,MAAO,4BACP,MAAOA,EAAO,KACd,OAAQA,EAAO,KACf,QAAS,WACf,EAAO,CACDQ,EAAmB,OAAQb,EAAc,CACvCK,EAAO,OAASI,EAAS,EAAIC,EAAmB,QAAST,EAAca,EAAgBT,EAAO,KAAK,EAAG,CAAC,GAAKU,EAAmB,GAAI,EAAI,CAC/I,CAAO,CACP,EAAO,EAAGhB,CAAY,EACtB,EAAK,GAAID,CAAY,CACrB,CACA,MAAMkB,EAA6BC,EAAYpB,EAAa,CAAC,CAAC,SAAUK,CAAW,CAAC,CAAC,EACrFgB,EAASC,CAAG,EACZ,MAAMC,EAAa,CAAE,MAAO,kBAAkB,EACxCC,EAAa,CAAE,MAAO,wBAAwB,EAC9CC,EAAa,CAAC,aAAc,OAAQ,OAAO,EAC3CC,EAAa,CACjB,IAAK,EACL,MAAO,wBACT,EACMC,EAA4BC,EAAgB,CAChD,OAAQ,oBACR,MAAO,CACL,KAAM,CAAA,EACN,YAAa,CAAE,QAAS,EAAE,EAC1B,OAAQ,CAAE,QAAS,EAAE,CACzB,EACE,MAAMC,EAAS,CACb,MAAMC,EAAYC,EAAE,wBAAwB,EAC5C,MAAO,CAACzB,EAAMC,KACLK,EAAS,EAAIC,EAAmB,MAAOU,EAAY,CACxDP,EAAmB,KAAMQ,EAAY,CACnCQ,EAAgBf,EAAgBY,EAAQ,IAAI,EAAI,IAAK,CAAC,EACtDA,EAAQ,QAAUjB,IAAaC,EAAmB,IAAK,CACrD,IAAK,EACL,aAAcoB,EAAMH,CAAS,EAC7B,MAAO,yBACP,KAAMD,EAAQ,OACd,IAAK,sBACL,OAAQ,SACR,MAAOI,EAAMH,CAAS,CAClC,EAAa,CACDI,EAAYf,EAAY,CAAE,KAAM,EAAE,CAAE,CAChD,EAAa,EAAGM,CAAU,GAAKP,EAAmB,GAAI,EAAI,CAC1D,CAAS,EACDW,EAAQ,aAAejB,EAAS,EAAIC,EAAmB,IAAKa,EAAYT,EAAgBY,EAAQ,WAAW,EAAG,CAAC,GAAKX,EAAmB,GAAI,EAAI,EAC/IiB,EAAW7B,EAAK,OAAQ,UAAW,CAAA,EAAI,OAAQ,EAAI,CAC3D,CAAO,EAEL,CACF,CAAC,EACK8B,EAAoChB,EAAYO,EAAW,CAAC,CAAC,YAAa,iBAAiB,CAAC,CAAC","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/js/NcSettingsSection-BWTcz41N.chunk.mjs.map.license b/js/NcSettingsSection-DXf6H0mA.chunk.mjs.map.license similarity index 100% rename from js/NcSettingsSection-BWTcz41N.chunk.mjs.map.license rename to js/NcSettingsSection-DXf6H0mA.chunk.mjs.map.license diff --git a/js/NotificationsApp-CtR4ZZxS.chunk.mjs b/js/NotificationsApp-AOJLgejJ.chunk.mjs similarity index 99% rename from js/NotificationsApp-CtR4ZZxS.chunk.mjs rename to js/NotificationsApp-AOJLgejJ.chunk.mjs index 7ba132213..45b954ddc 100644 --- a/js/NotificationsApp-CtR4ZZxS.chunk.mjs +++ b/js/NotificationsApp-AOJLgejJ.chunk.mjs @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('notifications', '', 'js/index-8liJTFpf.chunk.mjs'),window.OC.filePath('notifications', '', 'js/_plugin-vue_export-helper-CH0UJGgl.chunk.mjs'),window.OC.filePath('notifications', '', 'js/style-Blm0XmjK.chunk.mjs'),window.OC.filePath('notifications', '', 'css/style-CctA-ipJ.chunk.css'),window.OC.filePath('notifications', '', 'css/_plugin-vue_export-helper-Bb52jssi.chunk.css'),window.OC.filePath('notifications', '', 'js/vite-preload-helper-DxYC2qmj.chunk.mjs'),window.OC.filePath('notifications', '', 'js/BrowserStorage-D8B0KvVv.chunk.mjs'),window.OC.filePath('notifications', '', 'js/NcProfileHoverCard-EthqH19m.chunk.mjs'),window.OC.filePath('notifications', '', 'css/NcProfileHoverCard-Drr0qM5-.chunk.css')])))=>i.map(i=>d[i]); -import{o as rn,p as lr,q as La,u as Oa,v as Ea,w as Hn,x as Pa,y as Da,l as et,z as Je,c as me,d as xe,A as it,B as Vn,C as Na,D as Fa,E as za,F as Ba,G as lt,_ as Qe,H as Ra,I as ja,J as io,K as Ue,L as Rr,M as oo,O as jr,P as Ua,n as K,r as Pe,Q as Ha,R as ao,S as Va,T as qa,a as $a,e as ur,U as Bt,g as Ee,V as Wa,W as so,X as Ga,Y as Ur,Z as Za,$ as Xa,a0 as Qa,a1 as Ka,a2 as Ya,t as je,a3 as Ja,a4 as cr,a5 as es,a6 as ts,a7 as ns,a8 as cn,a9 as rs,aa as lo,ab as is,ac as os,ad as as,ae as vt,af as ss,ag as ls,ah as us,s as qn,ai as on,aj as Ct,ak as cs,al as Hr,am as ds}from"./_plugin-vue_export-helper-CH0UJGgl.chunk.mjs";import{l as Ke,i as fs,q as Rt,s as re,k as H,u as le,j as be,v as xt,x as ps,y as uo,o as A,e as T,m as ge,f as q,h as Ze,t as j,z as bt,A as $n,a as G,w as X,g as ce,B as en,b as U,n as de,C as jt,p as Xe,D as Vr,E as hs,G as De,H as qr,r as Y,F as at,I as Ut,J as co,K as Wn,L as ms,M as gs,N as Gn,d as ys,O as _s,T as vs,P as bs}from"./style-Blm0XmjK.chunk.mjs";import{_ as fo}from"./vite-preload-helper-DxYC2qmj.chunk.mjs";import{B as se}from"./BrowserStorage-D8B0KvVv.chunk.mjs";function $r(e,n){return(e.aliasOf||e)===(n.aliasOf||n)}function ks(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(var t in e)if(!ws(e[t],n[t]))return!1;return!0}function ws(e,n){return rn(e)?Wr(e,n):rn(n)?Wr(n,e):(e&&e.valueOf())===(n&&n.valueOf())}function Wr(e,n){return rn(n)?e.length===n.length&&e.every((t,r)=>t===n[r]):e.length===1&&e[0]===n}function Gr(e){const n=Rt(lr),t=Rt(La),r=H(()=>{const c=le(e.to);return n.resolve(c)}),i=H(()=>{const{matched:c}=r.value,{length:f}=c,p=c[f-1],s=t.matched;if(!p||!s.length)return-1;const l=s.findIndex($r.bind(null,p));if(l>-1)return l;const d=Zr(c[f-2]);return f>1&&Zr(p)===d&&s[s.length-1].path!==d?s.findIndex($r.bind(null,c[f-2])):l}),o=H(()=>i.value>-1&&As(t.params,r.value.params)),a=H(()=>i.value>-1&&i.value===t.matched.length-1&&ks(t.params,r.value.params));function u(c={}){if(Ss(c)){const f=n[le(e.replace)?"replace":"push"](le(e.to)).catch(Oa);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>f),f}return Promise.resolve()}return{route:r,href:H(()=>r.value.href),isActive:o,isExactActive:a,navigate:u}}function xs(e){return e.length===1?e[0]:e}const dr=Ke({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Gr,setup(e,{slots:n}){const t=fs(Gr(e)),{options:r}=Rt(lr),i=H(()=>({[Xr(e.activeClass,r.linkActiveClass,"router-link-active")]:t.isActive,[Xr(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const o=n.default&&xs(n.default(t));return e.custom?o:re("a",{"aria-current":t.isExactActive?e.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:i.value},o)}}});function Ss(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const n=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(n))return}return e.preventDefault&&e.preventDefault(),!0}}function As(e,n){for(const t in n){const r=n[t],i=e[t];if(typeof r=="string"){if(r!==i)return!1}else if(!rn(i)||i.length!==r.length||r.some((o,a)=>o.valueOf()!==i[a].valueOf()))return!1}return!0}function Zr(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Xr=(e,n,t)=>e??n??t,Is=Symbol.for("nc:theme:enforced");function Ts(e){const n=H(()=>uo(e)??document.body),t=be(Hn(n.value)),r=Da();function i(){t.value=Hn(n.value)}return Pa(n,i,{attributes:!0}),xt(n,i),xt(r,i,{immediate:!0}),ps(t)}const Cs=Ea(()=>Ts());function Ms(){const e=Cs(),n=Rt(Is,void 0);return H(()=>n?.value?n.value==="dark":e.value)}function Wt(){try{return et("core","capabilities")}catch{return console.debug("Could not find capabilities initial state fall back to _oc_capabilities"),"_oc_capabilities"in window?window._oc_capabilities:{}}}function Ls(e,n,t={}){return Os(t),window._notify_push_listeners[e]||(window._notify_push_listeners[e]=[]),window._notify_push_listeners[e].push(n),window._notify_push_ws!==null&&typeof window._notify_push_ws=="object"&&window._notify_push_ready?window._notify_push_ws.send("listen "+e):fr(t),window._notify_push_available}function Os(e={}){typeof window._notify_push_listeners>"u"&&(window._notify_push_listeners={},window._notify_push_ws=null,window._notify_push_online=!0,window._notify_push_available=!1,window._notify_push_error_count=0,window._notify_push_ready=!1,Je("networkOffline",()=>{window._notify_push_online=!1,window._notify_push_ws=null,window._notify_push_ready=!1}),Je("networkOnline",()=>{window._notify_push_error_count=0,window._notify_push_online=!0,fr(e)}))}async function fr(e={}){if(window._notify_push_ws)return!0;window._notify_push_ws=!0;const n=Wt();if(!n.notify_push)return window._notify_push_available=!1,window._notify_push_ws=null,!1;window._notify_push_available=!0;let t;return e.credentials||(t=(await me.post(n.notify_push.endpoints.pre_auth)).data),window._notify_push_ws=new WebSocket(n.notify_push.endpoints.websocket),window._notify_push_ws.onopen=()=>{if(typeof window._notify_push_ws=="object"&&window._notify_push_ws){t?(window._notify_push_ws.send(""),window._notify_push_ws.send(t)):e.credentials&&(window._notify_push_ws.send(e.credentials.username),window._notify_push_ws.send(e.credentials.password)),window._notify_push_ready=!0;for(let r in window._notify_push_listeners)window._notify_push_ws.send("listen "+r)}},window._notify_push_ws.onmessage=r=>{if(r.data==="authenticated")window._notify_push_error_count=0;else{const i=r.data.indexOf(" ");let[o,a]=i>0?[r.data.slice(0,i),r.data.slice(i+1)]:[r.data,null];if(a&&(a=JSON.parse(a)),window._notify_push_listeners[o])for(let u of window._notify_push_listeners[o])u(o,a)}},window._notify_push_ws.onerror=window._notify_push_ws.onclose=()=>{window._notify_push_ws=null,window._notify_push_error_count+=1,window._notify_push_ready=!1,setTimeout(()=>{window._notify_push_online&&fr(e)},1e3*window._notify_push_error_count)},!0}const Es=["aria-labelledby"],Ps={key:0,class:"empty-content__icon","aria-hidden":"true"},Ds=["id"],Ns={key:2,class:"empty-content__description"},Fs={key:3,class:"empty-content__action"},zs=Ke({__name:"NcEmptyContent",props:{description:{default:""},name:{default:""}},setup(e){const n=it();return(t,r)=>(A(),T("div",{"aria-labelledby":le(n),class:"empty-content",role:"note"},[t.$slots.icon?(A(),T("div",Ps,[ge(t.$slots,"icon",{},void 0,!0)])):q("",!0),e.name!==""||t.$slots.name?(A(),T("div",{key:1,id:le(n),class:"empty-content__name"},[ge(t.$slots,"name",{},()=>[Ze(j(e.name),1)],!0)],8,Ds)):q("",!0),e.description!==""||t.$slots.description?(A(),T("p",Ns,[ge(t.$slots,"description",{},()=>[Ze(j(e.description),1)],!0)])):q("",!0),t.$slots.action?(A(),T("div",Fs,[ge(t.$slots,"action",{},void 0,!0)])):q("",!0)],8,Es))}}),Bs=xe(zs,[["__scopeId","data-v-8609a4c1"]]),Rs=["id"],js=["id"],Us={ref:"contentContainer",class:"header-menu__content"},Hs=Ke({__name:"NcHeaderMenu",props:{id:{},ariaLabel:{default:()=>{}},open:{type:Boolean,default:!1},isNav:{type:Boolean,default:!1},description:{default:()=>{}},excludeClickOutsideSelectors:{default:()=>[]}},emits:["closed","opened","update:open"],setup(e,{emit:n}){const t=n,r=it(),i=it(),o=be(),a=be(e.open),u=H(()=>e.isNav?"nav":"div"),c=bt("contentContainer"),f=bt("headerMenu"),p=bt("triggerButton"),s=H(()=>Array.isArray(e.excludeClickOutsideSelectors)?e.excludeClickOutsideSelectors:e.excludeClickOutsideSelectors.split(" "));Vn(f,()=>d(!1),{ignore:s}),Na("Escape",()=>d(!1),{prevent:!0}),Fa(a,{disabled:()=>!e.isNav}),xt(()=>e.open,m=>d(m));function l(){d(!a.value)}async function d(m){m!==a.value&&(a.value=m,t("update:open",m),await $n(),await(m?g():y()),t(m?"opened":"closed"))}function h(m){e.isNav&&m.relatedTarget instanceof Node&&f.value?.contains(m.relatedTarget)&&d(!1)}async function g(){e.isNav||o.value||(o.value=za(c.value,{allowOutsideClick:!0,trapStack:Ba(),fallbackFocus:p.value?.$el}),o.value.activate())}function y(){o.value?.deactivate(),o.value=void 0}return(m,b)=>(A(),G(jt(u.value),{id:e.id,ref:"headerMenu","aria-labelledby":e.isNav?le(i):null,class:de([{"header-menu--opened":a.value},"header-menu"]),onFocusout:h},{default:X(()=>[ce(le(lt),{id:e.isNav?le(i):null,ref:"triggerButton","aria-controls":`header-menu-${e.id}`,"aria-expanded":a.value.toString(),"aria-label":e.ariaLabel,class:"header-menu__trigger",size:"large",variant:"tertiary-no-background",onClick:en(l,["prevent"])},{icon:X(()=>[ge(m.$slots,"trigger",{},void 0,!0)]),_:3},8,["id","aria-controls","aria-expanded","aria-label"]),e.description?(A(),T("span",{key:0,id:le(r),class:"header-menu__description hidden-visually"},j(e.description),9,Rs)):q("",!0),U("div",{id:`header-menu-${e.id}`,class:"header-menu__wrapper"},[U("div",Us,[ge(m.$slots,"default",{},void 0,!0)],512)],8,js)]),_:3},40,["id","aria-labelledby","class"]))}}),Vs=xe(Hs,[["__scopeId","data-v-ba632a98"]]),qs={name:"BellOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},$s=["aria-hidden","aria-label"],Ws=["fill","width","height"],Gs={d:"M10 21H14C14 22.1 13.1 23 12 23S10 22.1 10 21M21 19V20H3V19L5 17V11C5 7.9 7 5.2 10 4.3V4C10 2.9 10.9 2 12 2S14 2.9 14 4V4.3C17 5.2 19 7.9 19 11V17L21 19M17 11C17 8.2 14.8 6 12 6S7 8.2 7 11V18H17V11Z"},Zs={key:0};function Xs(e,n,t,r,i,o){return A(),T("span",Xe(e.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon bell-outline-icon",role:"img",onClick:n[0]||(n[0]=a=>e.$emit("click",a))}),[(A(),T("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[U("path",Gs,[t.title?(A(),T("title",Zs,j(t.title),1)):q("",!0)])],8,Ws))],16,$s)}const Qs=Qe(qs,[["render",Xs]]),Ks={name:"CloseIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ys=["aria-hidden","aria-label"],Js=["fill","width","height"],el={d:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"},tl={key:0};function nl(e,n,t,r,i,o){return A(),T("span",Xe(e.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon close-icon",role:"img",onClick:n[0]||(n[0]=a=>e.$emit("click",a))}),[(A(),T("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[U("path",el,[t.title?(A(),T("title",tl,j(t.title),1)):q("",!0)])],8,Js))],16,Ys)}const po=Qe(Ks,[["render",nl]]),rl={name:"MessageOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},il=["aria-hidden","aria-label"],ol=["fill","width","height"],al={d:"M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M20 16H5.2L4 17.2V4H20V16Z"},sl={key:0};function ll(e,n,t,r,i,o){return A(),T("span",Xe(e.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon message-outline-icon",role:"img",onClick:n[0]||(n[0]=a=>e.$emit("click",a))}),[(A(),T("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[U("path",al,[t.title?(A(),T("title",sl,j(t.title),1)):q("",!0)])],8,ol))],16,il)}const ho=Qe(rl,[["render",ll]]),ul={name:"BellIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},cl=["aria-hidden","aria-label"],dl=["fill","width","height"],fl={d:"M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M14,21A2,2 0 0,1 12,23A2,2 0 0,1 10,21"},pl={key:0};function hl(e,n,t,r,i,o){return A(),T("span",Xe(e.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon bell-icon",role:"img",onClick:n[0]||(n[0]=a=>e.$emit("click",a))}),[(A(),T("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[U("path",fl,[t.title?(A(),T("title",pl,j(t.title),1)):q("",!0)])],8,dl))],16,cl)}const ml=Qe(ul,[["render",hl]]),gl={key:0,class:"notifications-button__icon"},yl=["width","height"],_l={__name:"IconNotification",props:{showDot:{type:Boolean,default:!1},showWarning:{type:Boolean,default:!1},size:{type:Number,default:20}},setup(e){const n=Wt()?.theming,t=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function r(a){const u=parseInt(a.substring(1,3),16)/255,c=parseInt(a.substring(3,5),16)/255,f=parseInt(a.substring(5,7),16)/255,p=Math.max(u,c,f),s=Math.min(u,c,f);let l=0,d=0;const h=(p+s)/2;if(p!==s){const g=p-s;switch(d=h>.5?g/(2-p-s):g/(p+s),p){case u:l=(c-f)/g+(c{if(!n?.color||!t.test(n?.color))return!1;const[a,u,c]=r(n.color);return(a>=330||a<=15)&&u>.4&&(c>.1||c<.6)}),o=H(()=>{if(!n?.color||!t.test(n?.color))return!1;const[a,u,c]=r(n.color);return(a>=305||a<=64)&&u>.7&&(c>.1||c<.6)});return(a,u)=>e.showDot||e.showWarning?(A(),T("span",gl,[(A(),T("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"currentColor"},[u[0]||(u[0]=U("path",{d:"M 19,11.79 C 18.5,11.92 18,12 17.5,12 14.47,12 12,9.53 12,6.5 12,5.03 12.58,3.7 13.5,2.71 13.15,2.28 12.61,2 12,2 10.9,2 10,2.9 10,4 V 4.29 C 7.03,5.17 5,7.9 5,11 v 6 l -2,2 v 1 H 21 V 19 L 19,17 V 11.79 M 12,23 c 1.11,0 2,-0.89 2,-2 h -4 c 0,1.11 0.9,2 2,2 z"},null,-1)),U("path",{class:de(["notification__dot",{"notification__dot--warning":e.showWarning&&!o.value,"notification__dot--white":i.value||e.showWarning&&o.value}]),d:"M 21,6.5 C 21,8.43 19.43,10 17.5,10 15.57,10 14,8.43 14,6.5 14,4.57 15.57,3 17.5,3 19.43,3 21,4.57 21,6.5"},null,2)],8,yl))])):(A(),G(ml,{key:1,class:"notifications-button__icon",size:e.size},null,8,["size"]))}},vl=["data-timestamp","title","textContent"],bl=Ke({__name:"NcDateTime",props:{timestamp:{},format:{default:()=>({timeStyle:"medium",dateStyle:"short"})},relativeTime:{type:[Boolean,String],default:"long"},ignoreSeconds:{type:Boolean}},setup(e){const n=e,t=H(()=>({format:n.format})),r=H(()=>({ignoreSeconds:n.ignoreSeconds,relativeTime:n.relativeTime||"long",update:n.relativeTime!==!1})),i=ja(Vr(()=>n.timestamp),t),o=Ra(Vr(()=>n.timestamp),r),a=H(()=>n.relativeTime?o.value:i.value);return(u,c)=>(A(),T("span",{class:"nc-datetime",dir:"auto","data-timestamp":e.timestamp,title:le(i),textContent:j(a.value)},null,8,vl))}}),kl={};function dn(e,n){const t=kl,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return mo(e,r,i)}function mo(e,n,t){if(wl(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Qr(e.children,n,t)}return Array.isArray(e)?Qr(e,n,t):""}function Qr(e,n,t){const r=[];let i=-1;for(;++i{const t=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=n[i];switch(o){case fn:case go:return t(a,i);case Dt:{const u=t([],i);for(const c of a)u.push(r(c));return u}case an:{const u=t({},i);for(const[c,f]of a)u[r(c)]=r(f);return u}case pr:return t(new Date(a),i);case hr:{const{source:u,flags:c}=a;return t(new RegExp(u,c),i)}case mr:{const u=t(new Map,i);for(const[c,f]of a)u.set(r(c),r(f));return u}case gr:{const u=t(new Set,i);for(const c of a)u.add(r(c));return u}case yo:{const{name:u,message:c}=a;return t(new Kr[u](c),i)}case _o:return t(BigInt(a),i);case"BigInt":return t(Object(BigInt(a)),i);case"ArrayBuffer":return t(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return t(new DataView(u),a)}}return t(new Kr[o](a),i)};return r},Yr=e=>xl(new Map,e)(0),ht="",{toString:Sl}={},{keys:Al}=Object,Mt=e=>{const n=typeof e;if(n!=="object"||!e)return[fn,n];const t=Sl.call(e).slice(8,-1);switch(t){case"Array":return[Dt,ht];case"Object":return[an,ht];case"Date":return[pr,ht];case"RegExp":return[hr,ht];case"Map":return[mr,ht];case"Set":return[gr,ht];case"DataView":return[Dt,t]}return t.includes("Array")?[Dt,t]:t.includes("Error")?[yo,t]:[an,t]},Qt=([e,n])=>e===fn&&(n==="function"||n==="symbol"),Il=(e,n,t,r)=>{const i=(a,u)=>{const c=r.push(a)-1;return t.set(u,c),c},o=a=>{if(t.has(a))return t.get(a);let[u,c]=Mt(a);switch(u){case fn:{let p=a;switch(c){case"bigint":u=_o,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return i([go],a)}return i([u,p],a)}case Dt:{if(c){let l=a;return c==="DataView"?l=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(l=new Uint8Array(a)),i([c,[...l]],a)}const p=[],s=i([u,p],a);for(const l of a)p.push(o(l));return s}case an:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(n&&"toJSON"in a)return o(a.toJSON());const p=[],s=i([u,p],a);for(const l of Al(a))(e||!Qt(Mt(a[l])))&&p.push([o(l),o(a[l])]);return s}case pr:return i([u,a.toISOString()],a);case hr:{const{source:p,flags:s}=a;return i([u,{source:p,flags:s}],a)}case mr:{const p=[],s=i([u,p],a);for(const[l,d]of a)(e||!(Qt(Mt(l))||Qt(Mt(d))))&&p.push([o(l),o(d)]);return s}case gr:{const p=[],s=i([u,p],a);for(const l of a)(e||!Qt(Mt(l)))&&p.push(o(l));return s}}const{message:f}=a;return i([u,{name:c,message:f}],a)};return o},Jr=(e,{json:n,lossy:t}={})=>{const r=[];return Il(!(n||t),!!n,new Map,r)(e),r},ot=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Yr(Jr(e,n)):structuredClone(e):(e,n)=>Yr(Jr(e,n)),vo=(function(e){if(e==null)return Ml;if(typeof e=="string")return Cl(e);if(typeof e=="object")return Tl(e);if(typeof e=="function")return yr(e);throw new Error("Expected function, string, or array as `test`")});function Tl(e){const n=[];let t=-1;for(;++t":""))+")"})}return l;function l(){let d=bo,h,g,y;if((!n||o(c,f,p[p.length-1]||void 0))&&(d=Hl(t(c,p)),d[0]===Zn))return d;if("children"in c&&c.children){const m=c;if(m.children&&d[0]!==hn)for(g=(r?m.children.length:-1)+a,y=p.concat(m);g>-1&&g0&&(o.properties.rel=[...l]),d&&(o.properties.target=d),p){const g=Lt(n.contentProperties,o)||{};o.children.push({type:"element",tagName:"span",properties:ot(g),children:ot(p)})}}}})}}function Lt(e,n){return typeof e=="function"?e(n):e}function Gl(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const Zl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xl=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ql={};function ei(e,n){return(Ql.jsx?Xl:Zl).test(e)}const Kl=/[ \t\n\f\r]/g;function Yl(e){return typeof e=="object"?e.type==="text"?ti(e.value):!1:ti(e)}function ti(e){return e.replace(Kl,"")===""}class Nt{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Nt.prototype.normal={},Nt.prototype.property={},Nt.prototype.space=void 0;function ko(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Nt(t,r,n)}function Xn(e){return e.toLowerCase()}class ve{constructor(n,t){this.attribute=t,this.property=n}}ve.prototype.attribute="",ve.prototype.booleanish=!1,ve.prototype.boolean=!1,ve.prototype.commaOrSpaceSeparated=!1,ve.prototype.commaSeparated=!1,ve.prototype.defined=!1,ve.prototype.mustUseProperty=!1,ve.prototype.number=!1,ve.prototype.overloadedBoolean=!1,ve.prototype.property="",ve.prototype.spaceSeparated=!1,ve.prototype.space=void 0;let Jl=0;const V=ut(),oe=ut(),Qn=ut(),I=ut(),ee=ut(),kt=ut(),Ie=ut();function ut(){return 2**++Jl}const Kn=Object.freeze(Object.defineProperty({__proto__:null,boolean:V,booleanish:oe,commaOrSpaceSeparated:Ie,commaSeparated:kt,number:I,overloadedBoolean:Qn,spaceSeparated:ee},Symbol.toStringTag,{value:"Module"})),bn=Object.keys(Kn);class vr extends ve{constructor(n,t,r,i){let o=-1;if(super(n,t),ni(this,"space",i),typeof r=="number")for(;++o4&&t.slice(0,4)==="data"&&iu.test(n)){if(n.charAt(4)==="-"){const o=n.slice(5).replace(ri,su);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=n.slice(4);if(!ri.test(o)){let a=o.replace(ru,au);a.charAt(0)!=="-"&&(a="-"+a),n="data"+a}}i=vr}return new i(r,n)}function au(e){return"-"+e.toLowerCase()}function su(e){return e.charAt(1).toUpperCase()}const lu=ko([wo,eu,Ao,Io,To],"html"),br=ko([wo,tu,Ao,Io,To],"svg");var mt={},kn,ii;function uu(){if(ii)return kn;ii=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,u=/^\s+|\s+$/g,c=` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('notifications', '', 'js/index-BLabbPfc.chunk.mjs'),window.OC.filePath('notifications', '', 'js/_plugin-vue_export-helper-DqxYO0VT.chunk.mjs'),window.OC.filePath('notifications', '', 'js/style-D66n12eC.chunk.mjs'),window.OC.filePath('notifications', '', 'css/style-CctA-ipJ.chunk.css'),window.OC.filePath('notifications', '', 'css/_plugin-vue_export-helper-Bb52jssi.chunk.css'),window.OC.filePath('notifications', '', 'js/vite-preload-helper-DxYC2qmj.chunk.mjs'),window.OC.filePath('notifications', '', 'js/BrowserStorage-Dp9iRanT.chunk.mjs'),window.OC.filePath('notifications', '', 'js/NcProfileHoverCard-DsPWCnY_.chunk.mjs'),window.OC.filePath('notifications', '', 'css/NcProfileHoverCard-Drr0qM5-.chunk.css')])))=>i.map(i=>d[i]); +import{o as rn,p as lr,q as La,u as Oa,v as Ea,w as Hn,x as Pa,y as Da,l as et,z as Je,c as me,d as xe,A as it,B as Vn,C as Na,D as Fa,E as za,F as Ba,G as lt,_ as Qe,H as Ra,I as ja,J as io,K as Ue,L as Rr,M as oo,O as jr,P as Ua,n as K,r as Pe,Q as Ha,R as ao,S as Va,T as qa,a as $a,e as ur,U as Bt,g as Ee,V as Wa,W as so,X as Ga,Y as Ur,Z as Za,$ as Xa,a0 as Qa,a1 as Ka,a2 as Ya,t as je,a3 as Ja,a4 as cr,a5 as es,a6 as ts,a7 as ns,a8 as cn,a9 as rs,aa as lo,ab as is,ac as os,ad as as,ae as vt,af as ss,ag as ls,ah as us,s as qn,ai as on,aj as Ct,ak as cs,al as Hr,am as ds}from"./_plugin-vue_export-helper-DqxYO0VT.chunk.mjs";import{l as Ke,i as fs,q as Rt,s as re,k as H,u as le,j as be,v as xt,x as ps,y as uo,o as A,e as T,m as ge,f as q,h as Ze,t as j,z as bt,A as $n,a as G,w as X,g as ce,B as en,b as U,n as de,C as jt,p as Xe,D as Vr,E as hs,G as De,H as qr,r as Y,F as at,I as Ut,J as co,K as Wn,L as ms,M as gs,N as Gn,d as ys,O as _s,T as vs,P as bs}from"./style-D66n12eC.chunk.mjs";import{_ as fo}from"./vite-preload-helper-DxYC2qmj.chunk.mjs";import{B as se}from"./BrowserStorage-Dp9iRanT.chunk.mjs";function $r(e,n){return(e.aliasOf||e)===(n.aliasOf||n)}function ks(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(var t in e)if(!ws(e[t],n[t]))return!1;return!0}function ws(e,n){return rn(e)?Wr(e,n):rn(n)?Wr(n,e):(e&&e.valueOf())===(n&&n.valueOf())}function Wr(e,n){return rn(n)?e.length===n.length&&e.every((t,r)=>t===n[r]):e.length===1&&e[0]===n}function Gr(e){const n=Rt(lr),t=Rt(La),r=H(()=>{const c=le(e.to);return n.resolve(c)}),i=H(()=>{const{matched:c}=r.value,{length:f}=c,p=c[f-1],s=t.matched;if(!p||!s.length)return-1;const l=s.findIndex($r.bind(null,p));if(l>-1)return l;const d=Zr(c[f-2]);return f>1&&Zr(p)===d&&s[s.length-1].path!==d?s.findIndex($r.bind(null,c[f-2])):l}),o=H(()=>i.value>-1&&As(t.params,r.value.params)),a=H(()=>i.value>-1&&i.value===t.matched.length-1&&ks(t.params,r.value.params));function u(c={}){if(Ss(c)){const f=n[le(e.replace)?"replace":"push"](le(e.to)).catch(Oa);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>f),f}return Promise.resolve()}return{route:r,href:H(()=>r.value.href),isActive:o,isExactActive:a,navigate:u}}function xs(e){return e.length===1?e[0]:e}const dr=Ke({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Gr,setup(e,{slots:n}){const t=fs(Gr(e)),{options:r}=Rt(lr),i=H(()=>({[Xr(e.activeClass,r.linkActiveClass,"router-link-active")]:t.isActive,[Xr(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const o=n.default&&xs(n.default(t));return e.custom?o:re("a",{"aria-current":t.isExactActive?e.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:i.value},o)}}});function Ss(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const n=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(n))return}return e.preventDefault&&e.preventDefault(),!0}}function As(e,n){for(const t in n){const r=n[t],i=e[t];if(typeof r=="string"){if(r!==i)return!1}else if(!rn(i)||i.length!==r.length||r.some((o,a)=>o.valueOf()!==i[a].valueOf()))return!1}return!0}function Zr(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Xr=(e,n,t)=>e??n??t,Is=Symbol.for("nc:theme:enforced");function Ts(e){const n=H(()=>uo(e)??document.body),t=be(Hn(n.value)),r=Da();function i(){t.value=Hn(n.value)}return Pa(n,i,{attributes:!0}),xt(n,i),xt(r,i,{immediate:!0}),ps(t)}const Cs=Ea(()=>Ts());function Ms(){const e=Cs(),n=Rt(Is,void 0);return H(()=>n?.value?n.value==="dark":e.value)}function Wt(){try{return et("core","capabilities")}catch{return console.debug("Could not find capabilities initial state fall back to _oc_capabilities"),"_oc_capabilities"in window?window._oc_capabilities:{}}}function Ls(e,n,t={}){return Os(t),window._notify_push_listeners[e]||(window._notify_push_listeners[e]=[]),window._notify_push_listeners[e].push(n),window._notify_push_ws!==null&&typeof window._notify_push_ws=="object"&&window._notify_push_ready?window._notify_push_ws.send("listen "+e):fr(t),window._notify_push_available}function Os(e={}){typeof window._notify_push_listeners>"u"&&(window._notify_push_listeners={},window._notify_push_ws=null,window._notify_push_online=!0,window._notify_push_available=!1,window._notify_push_error_count=0,window._notify_push_ready=!1,Je("networkOffline",()=>{window._notify_push_online=!1,window._notify_push_ws=null,window._notify_push_ready=!1}),Je("networkOnline",()=>{window._notify_push_error_count=0,window._notify_push_online=!0,fr(e)}))}async function fr(e={}){if(window._notify_push_ws)return!0;window._notify_push_ws=!0;const n=Wt();if(!n.notify_push)return window._notify_push_available=!1,window._notify_push_ws=null,!1;window._notify_push_available=!0;let t;return e.credentials||(t=(await me.post(n.notify_push.endpoints.pre_auth)).data),window._notify_push_ws=new WebSocket(n.notify_push.endpoints.websocket),window._notify_push_ws.onopen=()=>{if(typeof window._notify_push_ws=="object"&&window._notify_push_ws){t?(window._notify_push_ws.send(""),window._notify_push_ws.send(t)):e.credentials&&(window._notify_push_ws.send(e.credentials.username),window._notify_push_ws.send(e.credentials.password)),window._notify_push_ready=!0;for(let r in window._notify_push_listeners)window._notify_push_ws.send("listen "+r)}},window._notify_push_ws.onmessage=r=>{if(r.data==="authenticated")window._notify_push_error_count=0;else{const i=r.data.indexOf(" ");let[o,a]=i>0?[r.data.slice(0,i),r.data.slice(i+1)]:[r.data,null];if(a&&(a=JSON.parse(a)),window._notify_push_listeners[o])for(let u of window._notify_push_listeners[o])u(o,a)}},window._notify_push_ws.onerror=window._notify_push_ws.onclose=()=>{window._notify_push_ws=null,window._notify_push_error_count+=1,window._notify_push_ready=!1,setTimeout(()=>{window._notify_push_online&&fr(e)},1e3*window._notify_push_error_count)},!0}const Es=["aria-labelledby"],Ps={key:0,class:"empty-content__icon","aria-hidden":"true"},Ds=["id"],Ns={key:2,class:"empty-content__description"},Fs={key:3,class:"empty-content__action"},zs=Ke({__name:"NcEmptyContent",props:{description:{default:""},name:{default:""}},setup(e){const n=it();return(t,r)=>(A(),T("div",{"aria-labelledby":le(n),class:"empty-content",role:"note"},[t.$slots.icon?(A(),T("div",Ps,[ge(t.$slots,"icon",{},void 0,!0)])):q("",!0),e.name!==""||t.$slots.name?(A(),T("div",{key:1,id:le(n),class:"empty-content__name"},[ge(t.$slots,"name",{},()=>[Ze(j(e.name),1)],!0)],8,Ds)):q("",!0),e.description!==""||t.$slots.description?(A(),T("p",Ns,[ge(t.$slots,"description",{},()=>[Ze(j(e.description),1)],!0)])):q("",!0),t.$slots.action?(A(),T("div",Fs,[ge(t.$slots,"action",{},void 0,!0)])):q("",!0)],8,Es))}}),Bs=xe(zs,[["__scopeId","data-v-8609a4c1"]]),Rs=["id"],js=["id"],Us={ref:"contentContainer",class:"header-menu__content"},Hs=Ke({__name:"NcHeaderMenu",props:{id:{},ariaLabel:{default:()=>{}},open:{type:Boolean,default:!1},isNav:{type:Boolean,default:!1},description:{default:()=>{}},excludeClickOutsideSelectors:{default:()=>[]}},emits:["closed","opened","update:open"],setup(e,{emit:n}){const t=n,r=it(),i=it(),o=be(),a=be(e.open),u=H(()=>e.isNav?"nav":"div"),c=bt("contentContainer"),f=bt("headerMenu"),p=bt("triggerButton"),s=H(()=>Array.isArray(e.excludeClickOutsideSelectors)?e.excludeClickOutsideSelectors:e.excludeClickOutsideSelectors.split(" "));Vn(f,()=>d(!1),{ignore:s}),Na("Escape",()=>d(!1),{prevent:!0}),Fa(a,{disabled:()=>!e.isNav}),xt(()=>e.open,m=>d(m));function l(){d(!a.value)}async function d(m){m!==a.value&&(a.value=m,t("update:open",m),await $n(),await(m?g():y()),t(m?"opened":"closed"))}function h(m){e.isNav&&m.relatedTarget instanceof Node&&f.value?.contains(m.relatedTarget)&&d(!1)}async function g(){e.isNav||o.value||(o.value=za(c.value,{allowOutsideClick:!0,trapStack:Ba(),fallbackFocus:p.value?.$el}),o.value.activate())}function y(){o.value?.deactivate(),o.value=void 0}return(m,b)=>(A(),G(jt(u.value),{id:e.id,ref:"headerMenu","aria-labelledby":e.isNav?le(i):null,class:de([{"header-menu--opened":a.value},"header-menu"]),onFocusout:h},{default:X(()=>[ce(le(lt),{id:e.isNav?le(i):null,ref:"triggerButton","aria-controls":`header-menu-${e.id}`,"aria-expanded":a.value.toString(),"aria-label":e.ariaLabel,class:"header-menu__trigger",size:"large",variant:"tertiary-no-background",onClick:en(l,["prevent"])},{icon:X(()=>[ge(m.$slots,"trigger",{},void 0,!0)]),_:3},8,["id","aria-controls","aria-expanded","aria-label"]),e.description?(A(),T("span",{key:0,id:le(r),class:"header-menu__description hidden-visually"},j(e.description),9,Rs)):q("",!0),U("div",{id:`header-menu-${e.id}`,class:"header-menu__wrapper"},[U("div",Us,[ge(m.$slots,"default",{},void 0,!0)],512)],8,js)]),_:3},40,["id","aria-labelledby","class"]))}}),Vs=xe(Hs,[["__scopeId","data-v-ba632a98"]]),qs={name:"BellOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},$s=["aria-hidden","aria-label"],Ws=["fill","width","height"],Gs={d:"M10 21H14C14 22.1 13.1 23 12 23S10 22.1 10 21M21 19V20H3V19L5 17V11C5 7.9 7 5.2 10 4.3V4C10 2.9 10.9 2 12 2S14 2.9 14 4V4.3C17 5.2 19 7.9 19 11V17L21 19M17 11C17 8.2 14.8 6 12 6S7 8.2 7 11V18H17V11Z"},Zs={key:0};function Xs(e,n,t,r,i,o){return A(),T("span",Xe(e.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon bell-outline-icon",role:"img",onClick:n[0]||(n[0]=a=>e.$emit("click",a))}),[(A(),T("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[U("path",Gs,[t.title?(A(),T("title",Zs,j(t.title),1)):q("",!0)])],8,Ws))],16,$s)}const Qs=Qe(qs,[["render",Xs]]),Ks={name:"CloseIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ys=["aria-hidden","aria-label"],Js=["fill","width","height"],el={d:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"},tl={key:0};function nl(e,n,t,r,i,o){return A(),T("span",Xe(e.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon close-icon",role:"img",onClick:n[0]||(n[0]=a=>e.$emit("click",a))}),[(A(),T("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[U("path",el,[t.title?(A(),T("title",tl,j(t.title),1)):q("",!0)])],8,Js))],16,Ys)}const po=Qe(Ks,[["render",nl]]),rl={name:"MessageOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},il=["aria-hidden","aria-label"],ol=["fill","width","height"],al={d:"M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M20 16H5.2L4 17.2V4H20V16Z"},sl={key:0};function ll(e,n,t,r,i,o){return A(),T("span",Xe(e.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon message-outline-icon",role:"img",onClick:n[0]||(n[0]=a=>e.$emit("click",a))}),[(A(),T("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[U("path",al,[t.title?(A(),T("title",sl,j(t.title),1)):q("",!0)])],8,ol))],16,il)}const ho=Qe(rl,[["render",ll]]),ul={name:"BellIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},cl=["aria-hidden","aria-label"],dl=["fill","width","height"],fl={d:"M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M14,21A2,2 0 0,1 12,23A2,2 0 0,1 10,21"},pl={key:0};function hl(e,n,t,r,i,o){return A(),T("span",Xe(e.$attrs,{"aria-hidden":t.title?null:"true","aria-label":t.title,class:"material-design-icon bell-icon",role:"img",onClick:n[0]||(n[0]=a=>e.$emit("click",a))}),[(A(),T("svg",{fill:t.fillColor,class:"material-design-icon__svg",width:t.size,height:t.size,viewBox:"0 0 24 24"},[U("path",fl,[t.title?(A(),T("title",pl,j(t.title),1)):q("",!0)])],8,dl))],16,cl)}const ml=Qe(ul,[["render",hl]]),gl={key:0,class:"notifications-button__icon"},yl=["width","height"],_l={__name:"IconNotification",props:{showDot:{type:Boolean,default:!1},showWarning:{type:Boolean,default:!1},size:{type:Number,default:20}},setup(e){const n=Wt()?.theming,t=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function r(a){const u=parseInt(a.substring(1,3),16)/255,c=parseInt(a.substring(3,5),16)/255,f=parseInt(a.substring(5,7),16)/255,p=Math.max(u,c,f),s=Math.min(u,c,f);let l=0,d=0;const h=(p+s)/2;if(p!==s){const g=p-s;switch(d=h>.5?g/(2-p-s):g/(p+s),p){case u:l=(c-f)/g+(c{if(!n?.color||!t.test(n?.color))return!1;const[a,u,c]=r(n.color);return(a>=330||a<=15)&&u>.4&&(c>.1||c<.6)}),o=H(()=>{if(!n?.color||!t.test(n?.color))return!1;const[a,u,c]=r(n.color);return(a>=305||a<=64)&&u>.7&&(c>.1||c<.6)});return(a,u)=>e.showDot||e.showWarning?(A(),T("span",gl,[(A(),T("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"currentColor"},[u[0]||(u[0]=U("path",{d:"M 19,11.79 C 18.5,11.92 18,12 17.5,12 14.47,12 12,9.53 12,6.5 12,5.03 12.58,3.7 13.5,2.71 13.15,2.28 12.61,2 12,2 10.9,2 10,2.9 10,4 V 4.29 C 7.03,5.17 5,7.9 5,11 v 6 l -2,2 v 1 H 21 V 19 L 19,17 V 11.79 M 12,23 c 1.11,0 2,-0.89 2,-2 h -4 c 0,1.11 0.9,2 2,2 z"},null,-1)),U("path",{class:de(["notification__dot",{"notification__dot--warning":e.showWarning&&!o.value,"notification__dot--white":i.value||e.showWarning&&o.value}]),d:"M 21,6.5 C 21,8.43 19.43,10 17.5,10 15.57,10 14,8.43 14,6.5 14,4.57 15.57,3 17.5,3 19.43,3 21,4.57 21,6.5"},null,2)],8,yl))])):(A(),G(ml,{key:1,class:"notifications-button__icon",size:e.size},null,8,["size"]))}},vl=["data-timestamp","title","textContent"],bl=Ke({__name:"NcDateTime",props:{timestamp:{},format:{default:()=>({timeStyle:"medium",dateStyle:"short"})},relativeTime:{type:[Boolean,String],default:"long"},ignoreSeconds:{type:Boolean}},setup(e){const n=e,t=H(()=>({format:n.format})),r=H(()=>({ignoreSeconds:n.ignoreSeconds,relativeTime:n.relativeTime||"long",update:n.relativeTime!==!1})),i=ja(Vr(()=>n.timestamp),t),o=Ra(Vr(()=>n.timestamp),r),a=H(()=>n.relativeTime?o.value:i.value);return(u,c)=>(A(),T("span",{class:"nc-datetime",dir:"auto","data-timestamp":e.timestamp,title:le(i),textContent:j(a.value)},null,8,vl))}}),kl={};function dn(e,n){const t=kl,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return mo(e,r,i)}function mo(e,n,t){if(wl(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Qr(e.children,n,t)}return Array.isArray(e)?Qr(e,n,t):""}function Qr(e,n,t){const r=[];let i=-1;for(;++i{const t=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=n[i];switch(o){case fn:case go:return t(a,i);case Dt:{const u=t([],i);for(const c of a)u.push(r(c));return u}case an:{const u=t({},i);for(const[c,f]of a)u[r(c)]=r(f);return u}case pr:return t(new Date(a),i);case hr:{const{source:u,flags:c}=a;return t(new RegExp(u,c),i)}case mr:{const u=t(new Map,i);for(const[c,f]of a)u.set(r(c),r(f));return u}case gr:{const u=t(new Set,i);for(const c of a)u.add(r(c));return u}case yo:{const{name:u,message:c}=a;return t(new Kr[u](c),i)}case _o:return t(BigInt(a),i);case"BigInt":return t(Object(BigInt(a)),i);case"ArrayBuffer":return t(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return t(new DataView(u),a)}}return t(new Kr[o](a),i)};return r},Yr=e=>xl(new Map,e)(0),ht="",{toString:Sl}={},{keys:Al}=Object,Mt=e=>{const n=typeof e;if(n!=="object"||!e)return[fn,n];const t=Sl.call(e).slice(8,-1);switch(t){case"Array":return[Dt,ht];case"Object":return[an,ht];case"Date":return[pr,ht];case"RegExp":return[hr,ht];case"Map":return[mr,ht];case"Set":return[gr,ht];case"DataView":return[Dt,t]}return t.includes("Array")?[Dt,t]:t.includes("Error")?[yo,t]:[an,t]},Qt=([e,n])=>e===fn&&(n==="function"||n==="symbol"),Il=(e,n,t,r)=>{const i=(a,u)=>{const c=r.push(a)-1;return t.set(u,c),c},o=a=>{if(t.has(a))return t.get(a);let[u,c]=Mt(a);switch(u){case fn:{let p=a;switch(c){case"bigint":u=_o,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return i([go],a)}return i([u,p],a)}case Dt:{if(c){let l=a;return c==="DataView"?l=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(l=new Uint8Array(a)),i([c,[...l]],a)}const p=[],s=i([u,p],a);for(const l of a)p.push(o(l));return s}case an:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(n&&"toJSON"in a)return o(a.toJSON());const p=[],s=i([u,p],a);for(const l of Al(a))(e||!Qt(Mt(a[l])))&&p.push([o(l),o(a[l])]);return s}case pr:return i([u,a.toISOString()],a);case hr:{const{source:p,flags:s}=a;return i([u,{source:p,flags:s}],a)}case mr:{const p=[],s=i([u,p],a);for(const[l,d]of a)(e||!(Qt(Mt(l))||Qt(Mt(d))))&&p.push([o(l),o(d)]);return s}case gr:{const p=[],s=i([u,p],a);for(const l of a)(e||!Qt(Mt(l)))&&p.push(o(l));return s}}const{message:f}=a;return i([u,{name:c,message:f}],a)};return o},Jr=(e,{json:n,lossy:t}={})=>{const r=[];return Il(!(n||t),!!n,new Map,r)(e),r},ot=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Yr(Jr(e,n)):structuredClone(e):(e,n)=>Yr(Jr(e,n)),vo=(function(e){if(e==null)return Ml;if(typeof e=="string")return Cl(e);if(typeof e=="object")return Tl(e);if(typeof e=="function")return yr(e);throw new Error("Expected function, string, or array as `test`")});function Tl(e){const n=[];let t=-1;for(;++t":""))+")"})}return l;function l(){let d=bo,h,g,y;if((!n||o(c,f,p[p.length-1]||void 0))&&(d=Hl(t(c,p)),d[0]===Zn))return d;if("children"in c&&c.children){const m=c;if(m.children&&d[0]!==hn)for(g=(r?m.children.length:-1)+a,y=p.concat(m);g>-1&&g0&&(o.properties.rel=[...l]),d&&(o.properties.target=d),p){const g=Lt(n.contentProperties,o)||{};o.children.push({type:"element",tagName:"span",properties:ot(g),children:ot(p)})}}}})}}function Lt(e,n){return typeof e=="function"?e(n):e}function Gl(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const Zl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xl=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ql={};function ei(e,n){return(Ql.jsx?Xl:Zl).test(e)}const Kl=/[ \t\n\f\r]/g;function Yl(e){return typeof e=="object"?e.type==="text"?ti(e.value):!1:ti(e)}function ti(e){return e.replace(Kl,"")===""}class Nt{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Nt.prototype.normal={},Nt.prototype.property={},Nt.prototype.space=void 0;function ko(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Nt(t,r,n)}function Xn(e){return e.toLowerCase()}class ve{constructor(n,t){this.attribute=t,this.property=n}}ve.prototype.attribute="",ve.prototype.booleanish=!1,ve.prototype.boolean=!1,ve.prototype.commaOrSpaceSeparated=!1,ve.prototype.commaSeparated=!1,ve.prototype.defined=!1,ve.prototype.mustUseProperty=!1,ve.prototype.number=!1,ve.prototype.overloadedBoolean=!1,ve.prototype.property="",ve.prototype.spaceSeparated=!1,ve.prototype.space=void 0;let Jl=0;const V=ut(),oe=ut(),Qn=ut(),I=ut(),ee=ut(),kt=ut(),Ie=ut();function ut(){return 2**++Jl}const Kn=Object.freeze(Object.defineProperty({__proto__:null,boolean:V,booleanish:oe,commaOrSpaceSeparated:Ie,commaSeparated:kt,number:I,overloadedBoolean:Qn,spaceSeparated:ee},Symbol.toStringTag,{value:"Module"})),bn=Object.keys(Kn);class vr extends ve{constructor(n,t,r,i){let o=-1;if(super(n,t),ni(this,"space",i),typeof r=="number")for(;++o4&&t.slice(0,4)==="data"&&iu.test(n)){if(n.charAt(4)==="-"){const o=n.slice(5).replace(ri,su);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=n.slice(4);if(!ri.test(o)){let a=o.replace(ru,au);a.charAt(0)!=="-"&&(a="-"+a),n="data"+a}}i=vr}return new i(r,n)}function au(e){return"-"+e.toLowerCase()}function su(e){return e.charAt(1).toUpperCase()}const lu=ko([wo,eu,Ao,Io,To],"html"),br=ko([wo,tu,Ao,Io,To],"svg");var mt={},kn,ii;function uu(){if(ii)return kn;ii=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,u=/^\s+|\s+$/g,c=` `,f="/",p="*",s="",l="comment",d="declaration";kn=function(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};var m=1,b=1;function w(N){var O=N.match(n);O&&(m+=O.length);var z=N.lastIndexOf(c);b=~z?N.length-z:b+N.length}function M(){var N={line:m,column:b};return function(O){return O.position=new P(N),W(),O}}function P(N){this.start=N,this.end={line:m,column:b},this.source=y.source}P.prototype.content=g;function x(N){var O=new Error(y.source+":"+m+":"+b+": "+N);if(O.reason=N,O.filename=y.source,O.line=m,O.column=b,O.source=g,!y.silent)throw O}function F(N){var O=N.exec(g);if(O){var z=O[0];return w(z),g=g.slice(z.length),O}}function W(){F(t)}function L(N){var O;for(N=N||[];O=k();)O!==!1&&N.push(O);return N}function k(){var N=M();if(!(f!=g.charAt(0)||p!=g.charAt(1))){for(var O=2;s!=g.charAt(O)&&(p!=g.charAt(O)||f!=g.charAt(O+1));)++O;if(O+=2,s===g.charAt(O-1))return x("End of comment missing");var z=g.slice(2,O-2);return b+=2,w(z),g=g.slice(O),b+=2,N({type:l,comment:z})}}function E(){var N=M(),O=F(r);if(O){if(k(),!F(i))return x("property missing ':'");var z=F(o),ie=N({type:d,property:h(O[0].replace(e,s)),value:z?h(z[0].replace(e,s)):s});return F(a),ie}}function D(){var N=[];L(N);for(var O;O=E();)O!==!1&&(N.push(O),L(N));return N}return W(),D()};function h(g){return g?g.replace(u,s):s}return kn}var oi;function cu(){if(oi)return mt;oi=1;var e=mt&&mt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(mt,"__esModule",{value:!0}),mt.default=t;var n=e(uu());function t(r,i){var o=null;if(!r||typeof r!="string")return o;var a=(0,n.default)(r),u=typeof i=="function";return a.forEach(function(c){if(c.type==="declaration"){var f=c.property,p=c.value;u?i(f,p,c):p&&(o=o||{},o[f]=p)}}),o}return mt}var Ot={},ai;function du(){if(ai)return Ot;ai=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,t=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(f){return!f||t.test(f)||e.test(f)},a=function(f,p){return p.toUpperCase()},u=function(f,p){return"".concat(p,"-")},c=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(i,u):f=f.replace(r,u),f.replace(n,a))};return Ot.camelCase=c,Ot}var Et,si;function fu(){if(si)return Et;si=1;var e=Et&&Et.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},n=e(cu()),t=du();function r(i,o){var a={};return!i||typeof i!="string"||(0,n.default)(i,function(u,c){u&&c&&(a[(0,t.camelCase)(u,o)]=c)}),a}return r.default=r,Et=r,Et}var pu=fu();const hu=io(pu),Co=Mo("end"),kr=Mo("start");function Mo(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function mu(e){const n=kr(e),t=Co(e);if(n&&t)return{start:n,end:t}}function Ft(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?li(e.position):"start"in e||"end"in e?li(e):"line"in e||"column"in e?Yn(e):""}function Yn(e){return ui(e&&e.line)+":"+ui(e&&e.column)}function li(e){return Yn(e&&e.start)+"-"+Yn(e&&e.end)}function ui(e){return e&&typeof e=="number"?e:1}class ue extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",o={},a=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof n=="string"?i=n:!o.cause&&n&&(a=!0,i=n.message,o.cause=n),!o.ruleId&&!o.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?o.ruleId=r:(o.source=r.slice(0,c),o.ruleId=r.slice(c+1))}if(!o.place&&o.ancestors&&o.ancestors){const c=o.ancestors[o.ancestors.length-1];c&&(o.place=c.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=u?u.line:void 0,this.name=Ft(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}ue.prototype.file="",ue.prototype.name="",ue.prototype.reason="",ue.prototype.message="",ue.prototype.stack="",ue.prototype.column=void 0,ue.prototype.line=void 0,ue.prototype.ancestors=void 0,ue.prototype.cause=void 0,ue.prototype.fatal=void 0,ue.prototype.place=void 0,ue.prototype.ruleId=void 0,ue.prototype.source=void 0;const wr={}.hasOwnProperty,gu=new Map,yu=/[A-Z]/g,_u=new Set(["table","tbody","thead","tfoot","tr"]),vu=new Set(["td","th"]),Lo="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bu(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Cu(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Tu(t,n.jsx,n.jsxs)}const i={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?br:lu,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},o=Oo(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function Oo(e,n,t){if(n.type==="element")return ku(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return wu(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Su(e,n,t);if(n.type==="mdxjsEsm")return xu(e,n);if(n.type==="root")return Au(e,n,t);if(n.type==="text")return Iu(e,n)}function ku(e,n,t){const r=e.schema;let i=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=br,e.schema=i),e.ancestors.push(n);const o=Po(e,n.tagName,!1),a=Mu(e,n);let u=Sr(e,n);return _u.has(n.tagName)&&(u=u.filter(function(c){return typeof c=="string"?!Yl(c):!0})),Eo(e,a,o,n),xr(a,u),e.ancestors.pop(),e.schema=r,e.create(n,o,a,t)}function wu(e,n){if(n.data&&n.data.estree&&e.evaluater){const t=n.data.estree.body[0];return t.type,e.evaluater.evaluateExpression(t.expression)}Vt(e,n.position)}function xu(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Vt(e,n.position)}function Su(e,n,t){const r=e.schema;let i=r;n.name==="svg"&&r.space==="html"&&(i=br,e.schema=i),e.ancestors.push(n);const o=n.name===null?e.Fragment:Po(e,n.name,!0),a=Lu(e,n),u=Sr(e,n);return Eo(e,a,o,n),xr(a,u),e.ancestors.pop(),e.schema=r,e.create(n,o,a,t)}function Au(e,n,t){const r={};return xr(r,Sr(e,n)),e.create(n,e.Fragment,r,t)}function Iu(e,n){return n.value}function Eo(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function xr(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function Tu(e,n,t){return r;function r(i,o,a,u){const c=Array.isArray(a.children)?t:n;return u?c(o,a,u):c(o,a)}}function Cu(e,n){return t;function t(r,i,o,a){const u=Array.isArray(o.children),c=kr(r);return n(i,o,a,u,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Mu(e,n){const t={};let r,i;for(i in n.properties)if(i!=="children"&&wr.call(n.properties,i)){const o=Ou(e,i,n.properties[i]);if(o){const[a,u]=o;e.tableCellAlignToStyle&&a==="align"&&typeof u=="string"&&vu.has(n.tagName)?r=u:t[a]=u}}if(r){const o=t.style||(t.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function Lu(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(t,e.evaluater.evaluateExpression(a.argument))}else Vt(e,n.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else Vt(e,n.position);else o=r.value===null?!0:r.value;t[i]=o}return t}function Sr(e,n){const t=[];let r=-1;const i=e.passKeys?new Map:gu;for(;++r0?{type:"text",value:M}:void 0),M===!1?s.lastIndex=b+1:(d!==b&&y.push({type:"text",value:c.value.slice(d,b)}),Array.isArray(M)?y.push(...M):M&&y.push(M),d=b+m[0].length,g=!0),!s.global)break;m=s.exec(c.value)}return g?(di?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)a=Array.from(r),a.unshift(n,t),e.splice(...a);else for(t&&e.splice(n,t);o0?(He(e,e.length,0,n),e):n}const di={}.hasOwnProperty;function $u(e){const n={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function wt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Re=nt(/[A-Za-z]/),Te=nt(/[\dA-Za-z]/),Zu=nt(/[#-'*+\--9=?A-Z^-~]/);function Jn(e){return e!==null&&(e<32||e===127)}const er=nt(/\d/),Xu=nt(/[\dA-Fa-f]/),Qu=nt(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function ke(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}const Ku=nt(new RegExp("\\p{P}|\\p{S}","u")),Yu=nt(/\s/);function nt(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function At(e){const n=[];let t=-1,r=0,i=0;for(;++t55295&&o<57344){const u=e.charCodeAt(t+1);o<56320&&u>56319&&u<57344?(a=String.fromCharCode(o,u),i=1):a="�"}else a=String.fromCharCode(o);a&&(n.push(e.slice(r,t),encodeURIComponent(a)),r=t+i+1,a=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function te(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(c){return Z(c)?(e.enter(t),u(c)):n(c)}function u(c){return Z(c)&&o++a))return;const F=n.events.length;let W=F,L,k;for(;W--;)if(n.events[W][0]==="exit"&&n.events[W][1].type==="chunkFlow"){if(L){k=n.events[W][1].end;break}L=!0}for(m(r),x=F;xw;){const P=t[M];n.containerState=P[1],P[0].exit.call(n,e)}t.length=w}function b(){i.write([null]),o=void 0,i=void 0,n.containerState._closeFlow=void 0}}function rc(e,n,t){return te(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function pi(e){if(e===null||ke(e)||Yu(e))return 1;if(Ku(e))return 2}function Ir(e,n,t){const r=[];let i=-1;for(;++i1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const s={...e[r][1].end},l={...e[t][1].start};hi(s,-c),hi(l,c),a={type:c>1?"strongSequence":"emphasisSequence",start:s,end:{...e[r][1].end}},u={type:c>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:l},o={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...u.end}},e[r][1].end={...a.start},e[t][1].start={...u.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Oe(f,[["enter",e[r][1],n],["exit",e[r][1],n]])),f=Oe(f,[["enter",i,n],["enter",a,n],["exit",a,n],["enter",o,n]]),f=Oe(f,Ir(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),f=Oe(f,[["exit",o,n],["enter",u,n],["exit",u,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(p=2,f=Oe(f,[["enter",e[t][1],n],["exit",e[t][1],n]])):p=0,He(e,r-1,t-r+3,f),t=r+f.length-p-2;break}}for(t=-1;++t0&&Z(x)?te(e,b,"linePrefix",o+1)(x):b(x)}function b(x){return x===null||B(x)?e.check(mi,g,M)(x):(e.enter("codeFlowValue"),w(x))}function w(x){return x===null||B(x)?(e.exit("codeFlowValue"),b(x)):(e.consume(x),w)}function M(x){return e.exit("codeFenced"),n(x)}function P(x,F,W){let L=0;return k;function k(z){return x.enter("lineEnding"),x.consume(z),x.exit("lineEnding"),E}function E(z){return x.enter("codeFencedFence"),Z(z)?te(x,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):D(z)}function D(z){return z===u?(x.enter("codeFencedFenceSequence"),N(z)):W(z)}function N(z){return z===u?(L++,x.consume(z),N):L>=a?(x.exit("codeFencedFenceSequence"),Z(z)?te(x,O,"whitespace")(z):O(z)):W(z)}function O(z){return z===null||B(z)?(x.exit("codeFencedFence"),F(z)):W(z)}}}function mc(e,n,t){const r=this;return i;function i(a){return a===null?t(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?t(a):n(a)}}const wn={name:"codeIndented",tokenize:yc},gc={partial:!0,tokenize:_c};function yc(e,n,t){const r=this;return i;function i(f){return e.enter("codeIndented"),te(e,o,"linePrefix",5)(f)}function o(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(f):t(f)}function a(f){return f===null?c(f):B(f)?e.attempt(gc,a,c)(f):(e.enter("codeFlowValue"),u(f))}function u(f){return f===null||B(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),u)}function c(f){return e.exit("codeIndented"),n(f)}}function _c(e,n,t){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?t(a):B(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):te(e,o,"linePrefix",5)(a)}function o(a){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?n(a):B(a)?i(a):t(a)}}const vc={name:"codeText",previous:kc,resolve:bc,tokenize:wc};function bc(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return nthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const i=t||0;this.setCursor(Math.trunc(n));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Pt(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),Pt(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Pt(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n=4?n(a):e.interrupt(r.parser.constructs.flow,t,n)(a)}}function Ro(e,n,t,r,i,o,a,u,c){const f=c||Number.POSITIVE_INFINITY;let p=0;return s;function s(m){return m===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(m),e.exit(o),l):m===null||m===32||m===41||Jn(m)?t(m):(e.enter(r),e.enter(a),e.enter(u),e.enter("chunkString",{contentType:"string"}),g(m))}function l(m){return m===62?(e.enter(o),e.consume(m),e.exit(o),e.exit(i),e.exit(r),n):(e.enter(u),e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===62?(e.exit("chunkString"),e.exit(u),l(m)):m===null||m===60||B(m)?t(m):(e.consume(m),m===92?h:d)}function h(m){return m===60||m===62||m===92?(e.consume(m),d):d(m)}function g(m){return!p&&(m===null||m===41||ke(m))?(e.exit("chunkString"),e.exit(u),e.exit(a),e.exit(r),n(m)):p999||d===null||d===91||d===93&&!c||d===94&&!u&&"_hiddenFootnoteSupport"in a.parser.constructs?t(d):d===93?(e.exit(o),e.enter(i),e.consume(d),e.exit(i),e.exit(r),n):B(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),s(d))}function s(d){return d===null||d===91||d===93||B(d)||u++>999?(e.exit("chunkString"),p(d)):(e.consume(d),c||(c=!Z(d)),d===92?l:s)}function l(d){return d===91||d===92||d===93?(e.consume(d),u++,s):s(d)}}function Uo(e,n,t,r,i,o){let a;return u;function u(l){return l===34||l===39||l===40?(e.enter(r),e.enter(i),e.consume(l),e.exit(i),a=l===40?41:l,c):t(l)}function c(l){return l===a?(e.enter(i),e.consume(l),e.exit(i),e.exit(r),n):(e.enter(o),f(l))}function f(l){return l===a?(e.exit(o),c(a)):l===null?t(l):B(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),te(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(l))}function p(l){return l===a||l===null||B(l)?(e.exit("chunkString"),f(l)):(e.consume(l),l===92?s:p)}function s(l){return l===a||l===92?(e.consume(l),p):p(l)}}function zt(e,n){let t;return r;function r(i){return B(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):Z(i)?te(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}const Lc={name:"definition",tokenize:Ec},Oc={partial:!0,tokenize:Pc};function Ec(e,n,t){const r=this;let i;return o;function o(d){return e.enter("definition"),a(d)}function a(d){return jo.call(r,e,u,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function u(d){return i=wt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),c):t(d)}function c(d){return ke(d)?zt(e,f)(d):f(d)}function f(d){return Ro(e,p,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function p(d){return e.attempt(Oc,s,s)(d)}function s(d){return Z(d)?te(e,l,"whitespace")(d):l(d)}function l(d){return d===null||B(d)?(e.exit("definition"),r.parser.defined.push(i),n(d)):t(d)}}function Pc(e,n,t){return r;function r(u){return ke(u)?zt(e,i)(u):t(u)}function i(u){return Uo(e,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return Z(u)?te(e,a,"whitespace")(u):a(u)}function a(u){return u===null||B(u)?n(u):t(u)}}const Dc={name:"hardBreakEscape",tokenize:Nc};function Nc(e,n,t){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return B(o)?(e.exit("hardBreakEscape"),n(o)):t(o)}}const Fc={name:"headingAtx",resolve:zc,tokenize:Bc};function zc(e,n){let t=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},o={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},He(e,r,t-r+1,[["enter",i,n],["enter",o,n],["exit",o,n],["exit",i,n]])),e}function Bc(e,n,t){let r=0;return i;function i(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||ke(p)?(e.exit("atxHeadingSequence"),u(p)):t(p)}function u(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||B(p)?(e.exit("atxHeading"),n(p)):Z(p)?te(e,u,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),u(p))}function f(p){return p===null||p===35||ke(p)?(e.exit("atxHeadingText"),u(p)):(e.consume(p),f)}}const Rc=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],yi=["pre","script","style","textarea"],jc={concrete:!0,name:"htmlFlow",resolveTo:Vc,tokenize:qc},Uc={partial:!0,tokenize:Wc},Hc={partial:!0,tokenize:$c};function Vc(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function qc(e,n,t){const r=this;let i,o,a,u,c;return f;function f(v){return p(v)}function p(v){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(v),s}function s(v){return v===33?(e.consume(v),l):v===47?(e.consume(v),o=!0,g):v===63?(e.consume(v),i=3,r.interrupt?n:_):Re(v)?(e.consume(v),a=String.fromCharCode(v),y):t(v)}function l(v){return v===45?(e.consume(v),i=2,d):v===91?(e.consume(v),i=5,u=0,h):Re(v)?(e.consume(v),i=4,r.interrupt?n:_):t(v)}function d(v){return v===45?(e.consume(v),r.interrupt?n:_):t(v)}function h(v){const fe="CDATA[";return v===fe.charCodeAt(u++)?(e.consume(v),u===fe.length?r.interrupt?n:D:h):t(v)}function g(v){return Re(v)?(e.consume(v),a=String.fromCharCode(v),y):t(v)}function y(v){if(v===null||v===47||v===62||ke(v)){const fe=v===47,$=a.toLowerCase();return!fe&&!o&&yi.includes($)?(i=1,r.interrupt?n(v):D(v)):Rc.includes(a.toLowerCase())?(i=6,fe?(e.consume(v),m):r.interrupt?n(v):D(v)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(v):o?b(v):w(v))}return v===45||Te(v)?(e.consume(v),a+=String.fromCharCode(v),y):t(v)}function m(v){return v===62?(e.consume(v),r.interrupt?n:D):t(v)}function b(v){return Z(v)?(e.consume(v),b):k(v)}function w(v){return v===47?(e.consume(v),k):v===58||v===95||Re(v)?(e.consume(v),M):Z(v)?(e.consume(v),w):k(v)}function M(v){return v===45||v===46||v===58||v===95||Te(v)?(e.consume(v),M):P(v)}function P(v){return v===61?(e.consume(v),x):Z(v)?(e.consume(v),P):w(v)}function x(v){return v===null||v===60||v===61||v===62||v===96?t(v):v===34||v===39?(e.consume(v),c=v,F):Z(v)?(e.consume(v),x):W(v)}function F(v){return v===c?(e.consume(v),c=null,L):v===null||B(v)?t(v):(e.consume(v),F)}function W(v){return v===null||v===34||v===39||v===47||v===60||v===61||v===62||v===96||ke(v)?P(v):(e.consume(v),W)}function L(v){return v===47||v===62||Z(v)?w(v):t(v)}function k(v){return v===62?(e.consume(v),E):t(v)}function E(v){return v===null||B(v)?D(v):Z(v)?(e.consume(v),E):t(v)}function D(v){return v===45&&i===2?(e.consume(v),ie):v===60&&i===1?(e.consume(v),ae):v===62&&i===4?(e.consume(v),Se):v===63&&i===3?(e.consume(v),_):v===93&&i===5?(e.consume(v),Ce):B(v)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Uc,Me,N)(v)):v===null||B(v)?(e.exit("htmlFlowData"),N(v)):(e.consume(v),D)}function N(v){return e.check(Hc,O,Me)(v)}function O(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),z}function z(v){return v===null||B(v)?N(v):(e.enter("htmlFlowData"),D(v))}function ie(v){return v===45?(e.consume(v),_):D(v)}function ae(v){return v===47?(e.consume(v),a="",ye):D(v)}function ye(v){if(v===62){const fe=a.toLowerCase();return yi.includes(fe)?(e.consume(v),Se):D(v)}return Re(v)&&a.length<8?(e.consume(v),a+=String.fromCharCode(v),ye):D(v)}function Ce(v){return v===93?(e.consume(v),_):D(v)}function _(v){return v===62?(e.consume(v),Se):v===45&&i===2?(e.consume(v),_):D(v)}function Se(v){return v===null||B(v)?(e.exit("htmlFlowData"),Me(v)):(e.consume(v),Se)}function Me(v){return e.exit("htmlFlow"),n(v)}}function $c(e,n,t){const r=this;return i;function i(a){return B(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):t(a)}function o(a){return r.parser.lazy[r.now().line]?t(a):n(a)}}function Wc(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(mn,n,t)}}const Gc={name:"htmlText",tokenize:Zc};function Zc(e,n,t){const r=this;let i,o,a;return u;function u(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),c}function c(_){return _===33?(e.consume(_),f):_===47?(e.consume(_),P):_===63?(e.consume(_),w):Re(_)?(e.consume(_),W):t(_)}function f(_){return _===45?(e.consume(_),p):_===91?(e.consume(_),o=0,h):Re(_)?(e.consume(_),b):t(_)}function p(_){return _===45?(e.consume(_),d):t(_)}function s(_){return _===null?t(_):_===45?(e.consume(_),l):B(_)?(a=s,ae(_)):(e.consume(_),s)}function l(_){return _===45?(e.consume(_),d):s(_)}function d(_){return _===62?ie(_):_===45?l(_):s(_)}function h(_){const Se="CDATA[";return _===Se.charCodeAt(o++)?(e.consume(_),o===Se.length?g:h):t(_)}function g(_){return _===null?t(_):_===93?(e.consume(_),y):B(_)?(a=g,ae(_)):(e.consume(_),g)}function y(_){return _===93?(e.consume(_),m):g(_)}function m(_){return _===62?ie(_):_===93?(e.consume(_),m):g(_)}function b(_){return _===null||_===62?ie(_):B(_)?(a=b,ae(_)):(e.consume(_),b)}function w(_){return _===null?t(_):_===63?(e.consume(_),M):B(_)?(a=w,ae(_)):(e.consume(_),w)}function M(_){return _===62?ie(_):w(_)}function P(_){return Re(_)?(e.consume(_),x):t(_)}function x(_){return _===45||Te(_)?(e.consume(_),x):F(_)}function F(_){return B(_)?(a=F,ae(_)):Z(_)?(e.consume(_),F):ie(_)}function W(_){return _===45||Te(_)?(e.consume(_),W):_===47||_===62||ke(_)?L(_):t(_)}function L(_){return _===47?(e.consume(_),ie):_===58||_===95||Re(_)?(e.consume(_),k):B(_)?(a=L,ae(_)):Z(_)?(e.consume(_),L):ie(_)}function k(_){return _===45||_===46||_===58||_===95||Te(_)?(e.consume(_),k):E(_)}function E(_){return _===61?(e.consume(_),D):B(_)?(a=E,ae(_)):Z(_)?(e.consume(_),E):L(_)}function D(_){return _===null||_===60||_===61||_===62||_===96?t(_):_===34||_===39?(e.consume(_),i=_,N):B(_)?(a=D,ae(_)):Z(_)?(e.consume(_),D):(e.consume(_),O)}function N(_){return _===i?(e.consume(_),i=void 0,z):_===null?t(_):B(_)?(a=N,ae(_)):(e.consume(_),N)}function O(_){return _===null||_===34||_===39||_===60||_===61||_===96?t(_):_===47||_===62||ke(_)?L(_):(e.consume(_),O)}function z(_){return _===47||_===62||ke(_)?L(_):t(_)}function ie(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),n):t(_)}function ae(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),ye}function ye(_){return Z(_)?te(e,Ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Ce(_)}function Ce(_){return e.enter("htmlTextData"),a(_)}}const Tr={name:"labelEnd",resolveAll:Yc,resolveTo:Jc,tokenize:ed},Xc={tokenize:td},Qc={tokenize:nd},Kc={tokenize:rd};function Yc(e){let n=-1;const t=[];for(;++n=3&&(f===null||B(f))?(e.exit("thematicBreak"),n(f)):t(f)}function c(f){return f===i?(e.consume(f),r++,c):(e.exit("thematicBreakSequence"),Z(f)?te(e,u,"whitespace")(f):u(f))}}const _e={continuation:{tokenize:pd},exit:md,name:"list",tokenize:fd},cd={partial:!0,tokenize:gd},dd={partial:!0,tokenize:hd};function fd(e,n,t){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return u;function u(d){const h=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:er(d)){if(r.containerState.type||(r.containerState.type=h,e.enter(h,{_container:!0})),h==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(tn,t,f)(d):f(d);if(!r.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(d)}return t(d)}function c(d){return er(d)&&++a<10?(e.consume(d),c):(!r.interrupt||a<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),f(d)):t(d)}function f(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,e.check(mn,r.interrupt?t:p,e.attempt(cd,l,s))}function p(d){return r.containerState.initialBlankLine=!0,o++,l(d)}function s(d){return Z(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),l):t(d)}function l(d){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(d)}}function pd(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(mn,i,o);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,te(e,n,"listItemIndent",r.containerState.size+1)(u)}function o(u){return r.containerState.furtherBlankLines||!Z(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(dd,n,a)(u))}function a(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,te(e,e.attempt(_e,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function hd(e,n,t){const r=this;return te(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?n(o):t(o)}}function md(e){e.exit(this.containerState.type)}function gd(e,n,t){const r=this;return te(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Z(o)&&a&&a[1].type==="listItemPrefixWhitespace"?n(o):t(o)}}const _i={name:"setextUnderline",resolveTo:yd,tokenize:_d};function yd(e,n){let t=e.length,r,i,o;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!o&&e[t][1].type==="definition"&&(o=t);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,n]),e.splice(o+1,0,["exit",e[r][1],n]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,n]),e}function _d(e,n,t){const r=this;let i;return o;function o(f){let p=r.events.length,s;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){s=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter("setextHeadingLine"),i=f,a(f)):t(f)}function a(f){return e.enter("setextHeadingLineSequence"),u(f)}function u(f){return f===i?(e.consume(f),u):(e.exit("setextHeadingLineSequence"),Z(f)?te(e,c,"lineSuffix")(f):c(f))}function c(f){return f===null||B(f)?(e.exit("setextHeadingLine"),n(f)):t(f)}}const vd={tokenize:bd};function bd(e){const n=this,t=e.attempt(mn,r,e.attempt(this.parser.constructs.flowInitial,i,te(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Ac,i)),"linePrefix")));return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const kd={resolveAll:Vo()},wd=Ho("string"),xd=Ho("text");function Ho(e){return{resolveAll:Vo(e==="text"?Sd:void 0),tokenize:n};function n(t){const r=this,i=this.parser.constructs[e],o=t.attempt(i,a,u);return a;function a(p){return f(p)?o(p):u(p)}function u(p){if(p===null){t.consume(p);return}return t.enter("data"),t.consume(p),c}function c(p){return f(p)?(t.exit("data"),o(p)):(t.consume(p),c)}function f(p){if(p===null)return!0;const s=i[p];let l=-1;if(s)for(;++l-1){const u=a[0];typeof u=="string"?a[0]=u.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function zd(e,n){let t=-1;const r=[];let i;for(;++t0){const Fe=R.tokenStack[R.tokenStack.length-1];(Fe[1]||bi).call(R,void 0,Fe[0])}for(C.position={start:Ye(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:Ye(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},ne=-1;++ne",...c.current()})),f+=c.move(">")):(u=t.enter("destinationRaw"),f+=c.move(t.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=t.enter(`title${o}`),f+=c.move(" "+i),f+=c.move(t.safe(e.title,{before:f,after:i,...c.current()})),f+=c.move(i),u()),f+=c.move(")"),a(),f}function Lh(){return"!"}ra.peek=Oh;function ra(e,n,t,r){const i=e.referenceType,o=t.enter("imageReference");let a=t.enter("label");const u=t.createTracker(r);let c=u.move("![");const f=t.safe(e.alt,{before:c,after:"]",...u.current()});c+=u.move(f+"]["),a();const p=t.stack;t.stack=[],a=t.enter("reference");const s=t.safe(t.associationId(e),{before:c,after:"]",...u.current()});return a(),t.stack=p,o(),i==="full"||!f||f!==s?c+=u.move(s+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function Oh(){return"!"}ia.peek=Eh;function ia(e,n,t){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o\u007F]/.test(e.url))}aa.peek=Ph;function aa(e,n,t,r){const i=Or(t),o=i==='"'?"Quote":"Apostrophe",a=t.createTracker(r);let u,c;if(oa(e,t)){const p=t.stack;t.stack=[],u=t.enter("autolink");let s=a.move("<");return s+=a.move(t.containerPhrasing(e,{before:s,after:">",...a.current()})),s+=a.move(">"),u(),t.stack=p,s}u=t.enter("link"),c=t.enter("label");let f=a.move("[");return f+=a.move(t.containerPhrasing(e,{before:f,after:"](",...a.current()})),f+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=t.enter("destinationLiteral"),f+=a.move("<"),f+=a.move(t.safe(e.url,{before:f,after:">",...a.current()})),f+=a.move(">")):(c=t.enter("destinationRaw"),f+=a.move(t.safe(e.url,{before:f,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=t.enter(`title${o}`),f+=a.move(" "+i),f+=a.move(t.safe(e.title,{before:f,after:i,...a.current()})),f+=a.move(i),c()),f+=a.move(")"),u(),f}function Ph(e,n,t){return oa(e,t)?"<":"["}sa.peek=Dh;function sa(e,n,t,r){const i=e.referenceType,o=t.enter("linkReference");let a=t.enter("label");const u=t.createTracker(r);let c=u.move("[");const f=t.containerPhrasing(e,{before:c,after:"]",...u.current()});c+=u.move(f+"]["),a();const p=t.stack;t.stack=[],a=t.enter("reference");const s=t.safe(t.associationId(e),{before:c,after:"]",...u.current()});return a(),t.stack=p,o(),i==="full"||!f||f!==s?c+=u.move(s+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function Dh(){return"["}function Er(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function Nh(e){const n=Er(e),t=e.options.bulletOther;if(!t)return n==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+t+"`) to be different");return t}function Fh(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function la(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function zh(e,n,t,r){const i=t.enter("list"),o=t.bulletCurrent;let a=e.ordered?Fh(t):Er(t);const u=e.ordered?a==="."?")":".":Nh(t);let c=n&&t.bulletLastUsed?a===t.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(c=!0),la(t)===a&&p){let s=-1;for(;++s-1?n.start:1)+(t.options.incrementListMarker===!1?0:n.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(a=Math.ceil(a/4)*4);const u=t.createTracker(r);u.move(o+" ".repeat(a-o.length)),u.shift(a);const c=t.enter("listItem"),f=t.indentLines(t.containerFlow(e,u.current()),p);return c(),f;function p(s,l,d){return l?(d?"":" ".repeat(a))+s:(d?o:o+" ".repeat(a-o.length))+s}}function jh(e,n,t,r){const i=t.enter("paragraph"),o=t.enter("phrasing"),a=t.containerPhrasing(e,r);return o(),i(),a}const Uh=Lr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Hh(e,n,t,r){return(e.children.some(function(i){return Uh(i)})?t.containerPhrasing:t.containerFlow).call(t,e,r)}function Vh(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}ua.peek=qh;function ua(e,n,t,r){const i=Vh(t),o=t.enter("strong"),a=t.createTracker(r),u=a.move(i+i);let c=a.move(t.containerPhrasing(e,{after:i,before:u,...a.current()}));const f=c.charCodeAt(0),p=un(r.before.charCodeAt(r.before.length-1),f,i);p.inside&&(c=$t(f)+c.slice(1));const s=c.charCodeAt(c.length-1),l=un(r.after.charCodeAt(0),s,i);l.inside&&(c=c.slice(0,-1)+$t(s));const d=a.move(i+i);return o(),t.attentionEncodeSurroundingInfo={after:l.outside,before:p.outside},u+c+d}function qh(e,n,t){return t.options.strong||"*"}function $h(e,n,t,r){return t.safe(e.value,r)}function Wh(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function Gh(e,n,t){const r=(la(t)+(t.options.ruleSpaces?" ":"")).repeat(Wh(t));return t.options.ruleSpaces?r.slice(0,-1):r}const ca={blockquote:mh,break:ji,code:kh,definition:xh,emphasis:ea,hardBreak:ji,heading:Ch,html:ta,image:na,imageReference:ra,inlineCode:ia,link:aa,linkReference:sa,list:zh,listItem:Rh,paragraph:jh,root:Hh,strong:ua,text:$h,thematicBreak:Gh};function Zh(){return{enter:{table:Xh,tableData:Ui,tableHeader:Ui,tableRow:Kh},exit:{codeText:Yh,table:Qh,tableData:Fn,tableHeader:Fn,tableRow:Fn}}}function Xh(e){const n=e._align;this.enter({type:"table",align:n.map(function(t){return t==="none"?null:t}),children:[]},e),this.data.inTable=!0}function Qh(e){this.exit(e),this.data.inTable=void 0}function Kh(e){this.enter({type:"tableRow",children:[]},e)}function Fn(e){this.exit(e)}function Ui(e){this.enter({type:"tableCell",children:[]},e)}function Yh(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,Jh));const t=this.stack[this.stack.length-1];t.type,t.value=n,this.exit(e)}function Jh(e,n){return n==="|"?n:e}function em(e){const n=e||{},t=n.tableCellPadding,r=n.tablePipeAlign,i=n.stringLength,o=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:l,table:a,tableCell:c,tableRow:u}};function a(d,h,g,y){return f(p(d,g,y),d.align)}function u(d,h,g,y){const m=s(d,g,y),b=f([m]);return b.slice(0,b.indexOf(` -`))}function c(d,h,g,y){const m=g.enter("tableCell"),b=g.enter("phrasing"),w=g.containerPhrasing(d,{...y,before:o,after:o});return b(),m(),w}function f(d,h){return ph(d,{align:h,alignDelimiters:r,padding:t,stringLength:i})}function p(d,h,g){const y=d.children;let m=-1;const b=[],w=h.enter("table");for(;++mi?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)a=Array.from(r),a.unshift(n,t),e.splice(...a);else for(t&&e.splice(n,t);o0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}function km(e,n,t){const r=[];let i=-1;for(;++i999||s===93&&!a||s===null||s===91||we(s))return t(s);if(s===93){e.exit("chunkString");const l=e.exit("gfmFootnoteCallString");return i.includes(Zt(r.sliceSerialize(l)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(s)}return we(s)||(a=!0),o++,e.consume(s),s===92?p:f}function p(s){return s===91||s===92||s===93?(e.consume(s),o++,f):f(s)}}function Mm(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,u;return c;function c(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):t(h)}function p(h){if(a>999||h===93&&!u||h===null||h===91||we(h))return t(h);if(h===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return o=Zt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),l}return we(h)||(u=!0),a++,e.consume(h),h===92?s:p}function s(h){return h===91||h===92||h===93?(e.consume(h),a++,p):p(h)}function l(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),i.includes(o)||i.push(o),Ge(e,d,"gfmFootnoteDefinitionWhitespace")):t(h)}function d(h){return n(h)}}function Lm(e,n,t){return e.check(wm,n,e.attempt(Sm,n,t))}function Om(e){e.exit("gfmFootnoteDefinition")}function Em(e,n,t){const r=this;return Ge(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?n(o):t(o)}}function Pm(e){let n=(e||{}).singleTilde;const t={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:t},insideSpan:{null:[t]},attentionMarkers:{null:[126]}};function r(o,a){let u=-1;for(;++u1?u(d):(o.consume(d),p++,l);if(p<2&&!n)return u(d);const g=o.exit("strikethroughSequenceTemporary"),y=ln(d);return g._open=!y||y===2&&!!h,g._close=!h||h===2&&!!y,a(d)}}}class Dm{constructor(){this.map=[]}add(n,t,r){Nm(this,n,t,r)}consume(n){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let i=r.pop();for(;i;){for(const o of i)n.push(o);i=r.pop()}this.map.length=0}}function Nm(e,n,t,r){let i=0;if(!(t===0&&r.length===0)){for(;i-1;){const O=r.events[E][1].type;if(O==="lineEnding"||O==="linePrefix")E--;else break}const D=E>-1?r.events[E][1].type:null,N=D==="tableHead"||D==="tableRow"?x:c;return N===x&&r.parser.lazy[r.now().line]?t(k):N(k)}function c(k){return e.enter("tableHead"),e.enter("tableRow"),f(k)}function f(k){return k===124||(a=!0,o+=1),p(k)}function p(k){return k===null?t(k):_t(k)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),d):t(k):We(k)?Ge(e,p,"whitespace")(k):(o+=1,a&&(a=!1,i+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),s(k)))}function s(k){return k===null||k===124||we(k)?(e.exit("data"),p(k)):(e.consume(k),k===92?l:s)}function l(k){return k===92||k===124?(e.consume(k),s):s(k)}function d(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(k):(e.enter("tableDelimiterRow"),a=!1,We(k)?Ge(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):h(k))}function h(k){return k===45||k===58?y(k):k===124?(a=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),g):P(k)}function g(k){return We(k)?Ge(e,y,"whitespace")(k):y(k)}function y(k){return k===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),m):k===45?(o+=1,m(k)):k===null||_t(k)?M(k):P(k)}function m(k){return k===45?(e.enter("tableDelimiterFiller"),b(k)):P(k)}function b(k){return k===45?(e.consume(k),b):k===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(k))}function w(k){return We(k)?Ge(e,M,"whitespace")(k):M(k)}function M(k){return k===124?h(k):k===null||_t(k)?!a||i!==o?P(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(k)):P(k)}function P(k){return t(k)}function x(k){return e.enter("tableRow"),F(k)}function F(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),F):k===null||_t(k)?(e.exit("tableRow"),n(k)):We(k)?Ge(e,F,"whitespace")(k):(e.enter("data"),W(k))}function W(k){return k===null||k===124||we(k)?(e.exit("data"),F(k)):(e.consume(k),k===92?L:W)}function L(k){return k===92||k===124?(e.consume(k),W):W(k)}}function Rm(e,n){let t=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,f,p,s;const l=new Dm;for(;++tt[2]+1){const h=t[2]+1,g=t[3]-t[2]-1;e.add(h,g,[])}}e.add(t[3]+1,0,[["exit",s,n]])}return i!==void 0&&(o.end=Object.assign({},gt(n.events,i)),e.add(i,0,[["exit",o,n]]),o=void 0),o}function Wi(e,n,t,r,i){const o=[],a=gt(n.events,t);i&&(i.end=Object.assign({},a),o.push(["exit",i,n])),r.end=Object.assign({},a),o.push(["exit",r,n]),e.add(t+1,0,o)}function gt(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const jm={name:"tasklistCheck",tokenize:Hm};function Um(){return{text:{91:jm}}}function Hm(e,n,t){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return we(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):t(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):t(c)}function u(c){return _t(c)?n(c):We(c)?e.check({tokenize:Vm},n,t)(c):t(c)}}function Vm(e,n,t){return Ge(e,r,"whitespace");function r(i){return i===null?t(i):n(i)}}function qm(e){return sm([fm(),Am(),Pm(e),zm(),Um()])}const $m={};function Wm(e){const n=this,t=e||$m,r=n.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(qm(t)),o.push(om()),a.push(am(t))}const Gm=Ke({__name:"NcRichTextCopyButton",props:{contentId:{}},setup(e){const{copy:n,icon:t,altText:r}=wp(()=>document.getElementById(e.contentId).textContent);return(i,o)=>(A(),G(lt,{variant:"tertiary",size:"small","aria-label":le(r),title:le(r),onClick:le(n)},{icon:X(()=>[ce(ur,{path:le(t),inline:""},null,8,["path"])]),_:1},8,["aria-label","title","onClick"]))}});function Zm(e){return e.type==="text"}const Xm=function(e){tt(e,Zm,(n,t)=>{const r=t.at(-1),i=r.children.indexOf(n),o=n.value.split(/(\{[a-z\-_.0-9]+\})/ig).map(a=>{const u=a.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!u)return yt("text",a);const[,c]=u;return yt("element",{tagName:`#${c}`,children:[]})});r.children.splice(i,1,...o)})},Qm=()=>Xm;function Km(e){return["code","inlineCode"].includes(e.type)}const Ym=function(){return function(e){tt(e,Km,(n,t)=>{const r=t.at(-1),i=r.children.indexOf(n);return r.children.splice(i,1,{...n,value:""}),[hn,i+1]})}};function Jm(e){return["text","code","inlineCode"].includes(e.type)}const eg=function(){return function(e){tt(e,Jm,(n,t)=>{const r=t.at(-1),i=r.children.indexOf(n);return r.children.splice(i,1,{...n,value:n.value.replace(/</gmi,"<").replace(/>/gmi,">")}),[hn,i+1]})}},tg=["http","https","mailto","tel"],ar=be(null);async function ng(){const e=await fo(()=>import("./index-8liJTFpf.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url);ar.value=e.default}const rg={name:"NcRichText",components:{NcReferenceList:En},props:{text:{type:String,default:""},arguments:{type:Object,default:()=>({})},referenceLimit:{type:Number,default:0},referenceInteractive:{type:Boolean,default:!0},referenceInteractiveOptIn:{type:Boolean,default:!1},references:{type:Array,default:null},useMarkdown:{type:Boolean,default:!1},useExtendedMarkdown:{type:Boolean,default:!1},interactive:{type:Boolean,default:!1},autolink:{type:Boolean,default:!0}},emits:["interactTodo"],data(){return{parentId:it()}},methods:{renderPlaintext(){const e=this.text.split(/(\{[a-z\-_.0-9]+\})/ig).map(n=>{const t=n.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!t)return this.prepareTextNode(n);const r=t[1],i=this.arguments[r];if(typeof i=="object"){const{component:o,props:a}=i;return re(typeof o=="string"?Y(o):o,{...a,class:"rich-text--component"})}return i?re("span",{class:"rich-text--fallback"},i):n});return re("div",{class:"rich-text--wrapper"},[re("div",{},e.flat()),this.referenceLimit>0?re("div",{class:"rich-text--reference-widget"},[re(En,{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn})]):null])},renderMarkdown(){const e=Li().use(ki).use(fp,{autolink:this.autolink,useMarkdown:this.useMarkdown,useExtendedMarkdown:this.useExtendedMarkdown}).use(eg).use(this.useExtendedMarkdown?Wm:void 0).use(qu).use(Of,{except:tg}).use(Mf,{handlers:{component(n,t){return n(t,t.component,{value:t.value})}}}).use(this.useExtendedMarkdown?ar.value:void 0).use(Qm).use(Wl,{target:"_blank",rel:["noopener noreferrer"]}).use(Fu,{Fragment:at,jsx:this.createElement,jsxs:this.createElement,elementAttributeNameCase:"html",prefix:!1}).processSync(this.text.replace(/<[^>]+>/g,n=>n.replace(/")).result;return re("div",{class:"rich-text--wrapper rich-text--wrapper-markdown"},[e,this.referenceLimit>0?re("div",{class:"rich-text--reference-widget"},[re(En,{text:this.prepareReferenceSource(this.text),referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn})]):null])},prepareTextNode(e){return this.autolink&&(e=Xo(e)),Array.isArray(e)?e.map(n=>{if(typeof n=="string")return n;const{component:t,props:r}=n;return re(t,{...r,class:"rich-text--component"})}):e},prepareReferenceSource(e){if(!this.useMarkdown&&!this.useExtendedMarkdown)return e;const n=Li();return n.compiler=t=>dn(t),n.use(ki).use(Ym).processSync(e.replace(/\s/g," ")).value},createElement(e,n,t){t&&(n.key=t);const r=n.children??[];if(delete n.children,!String(e).startsWith("#")){["h1","h2","h3","h4","h5","h6"].includes(String(e))&&(e=`h${Math.min(+String(e)[1]+3,6)}`);let o=null;if(this.useExtendedMarkdown){if(String(e)==="code"&&!ar.value&&n?.class?.includes("language")&&ng(),String(e)==="pre"&&r&&String(r.type)==="code"){const a=this.parentId+"-code-block-"+it();return re("p",{class:"rich-text__code-block"},[re(e,{...n,id:a},r),re(Gm,{class:"rich-text__code-block-button",contentId:a})])}if(String(e)==="li"&&Array.isArray(r)&&r.length!==0&&r[0].type==="input"&&r[0].props.type==="checkbox"){const[a,,...u]=r,c=u.findIndex(l=>["ul","ol","li","blockquote","pre"].includes(l.type));c!==-1&&(o=u[c],u.splice(c));const f=this.parentId+"-markdown-input-"+it(),p={...a.props};delete p.checked;const s=re($a,{...p,modelValue:a.props.checked,id:f,disabled:!this.interactive,"onUpdate:modelValue":()=>{this.$emit("interactTodo",f)}},{default:()=>u});return re(e,n,[s,o])}}if(String(e)==="a"){const a=sn(this.$router,n.href);return a?(delete n.href,delete n.target,re(dr,{...n,to:a},{default:()=>r})):/^(https?:\/\/|tel:|mailto:)/.test(n.href)?(n.href=n.href.trim(),re(Zo,n,r)):(delete n.href,delete n.target,re("span",n,r))}return re(e,n,r)}const i=this.arguments[e.slice(1)];return i?i.component?re(typeof i.component=="string"?Y(i.component):i.component,{...n,...i.props,class:"rich-text--component"},{default:()=>r}):re("span",{...n},[i]):re("span",{...n,class:"rich-text--fallback"},[`{${e.slice(1)}}`])}},render(){return this.useMarkdown||this.useExtendedMarkdown?this.renderMarkdown():this.renderPlaintext()}},ig=xe(rg,[["__scopeId","data-v-80e57a29"]]);window._vue_richtext_custom_picker_elements??={},window._registerCustomPickerElement??=og;function og(e,n,t=()=>{},r="large"){if(window._vue_richtext_custom_picker_elements[e]){Ue.error(`Custom reference picker element for id ${e} already registered`);return}window._vue_richtext_custom_picker_elements[e]={id:e,callback:n,onDestroy:t,size:r}}function ag(e,n=100,t={}){if(typeof e!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(n<0)throw new RangeError("`wait` must not be negative.");if(typeof t=="boolean")throw new TypeError("The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.");const{immediate:r}=t;let i,o,a,u,c;function f(){const l=i,d=o;return i=void 0,o=void 0,c=e.apply(l,d),c}function p(){const l=Date.now()-u;l=0?a=setTimeout(p,n-l):(a=void 0,r||(c=f()))}const s=function(...l){if(i&&this!==i&&Object.getPrototypeOf(this)===Object.getPrototypeOf(i))throw new Error("Debounced method called with different contexts of the same prototype.");i=this,o=l,u=Date.now();const d=r&&!a;if(a||(a=setTimeout(p,n)),d)return c=f(),c};return Object.defineProperty(s,"isPending",{get(){return a!==void 0}}),s.clear=()=>{a&&(clearTimeout(a),a=void 0,i=void 0,o=void 0)},s.flush=()=>{a&&s.trigger()},s.trigger=()=>{c=f(),s.clear()},s}Pe(Wa),K("Any link"),so("core","filetypes/link.svg"),window._vue_richtext_reference_providers??=et("core","reference-provider-list",[]),window._vue_richtext_reference_provider_timestamps??=et("core","reference-provider-timestamps",{}),Pe(Ur,Ga),Pe(Za),Pe(Qa,Ur,Xa),Pe(Ya,Ka);const sg={__name:"ActionButton",props:{action:{type:Object,required:!0}},emits:["click"],setup(e,{emit:n}){const t=e,r=n,i=H(()=>t.action.type==="WEB");function o(a){const u={url:t.action.link,type:t.action.type||"GET"};r("click",{event:a,action:u})}return(a,u)=>(A(),G(le(lt),{variant:i.value||e.action.primary?"primary":"secondary",href:i.value?e.action.link:void 0,class:"action-button pull-right",onClick:o},{default:X(()=>[Ze(j(e.action.label),1)]),_:1},8,["variant","href"]))}},lg={name:"DefaultParameter",props:{type:{type:String,required:!0},id:{type:[Number,String],required:!0},name:{type:String,required:!0},link:{type:String,default:""}},computed:{hasInternalLink(){return this.link&&(this.type==="deck-board"||this.type==="deck-card")}}},ug=["href"],cg=["href"],dg={key:2};function fg(e,n,t,r,i,o){return o.hasInternalLink?(A(),T("a",{key:0,href:t.link},[U("strong",null,j(t.name),1)],8,ug)):t.link?(A(),T("a",{key:1,href:t.link,class:"external",target:"_blank",rel:"noopener noreferrer"},[U("strong",null,j(t.name),1)],8,cg)):(A(),T("strong",dg,j(t.name),1))}const pg=Qe(lg,[["render",fg],["__scopeId","data-v-9803ab31"]]),hg={name:"FileParameter",props:{type:{type:String,required:!0},id:{type:[Number,String],required:!0},name:{type:String,required:!0},path:{type:String,default:""},link:{type:String,default:""}},computed:{title(){const e=this.path.lastIndexOf("/"),n=this.path.indexOf("/"),t=this.path.substring(n===0?1:0,e);return t.length===0?"":je("notifications","in {path}",{path:t})}}},mg=["title","href"];function gg(e,n,t,r,i,o){return A(),T("a",{title:o.title,class:"filename",href:t.link},j(t.name),9,mg)}const yg=Qe(hg,[["render",gg]]),zn=new WeakMap,_g={mounted(e,n){const t=!n.modifiers.bubble;let r;if(typeof n.value=="function")r=Vn(e,n.value,{capture:t});else{const[i,o]=n.value;r=Vn(e,i,Object.assign({capture:t},o))}zn.set(e,r)},unmounted(e){const n=zn.get(e);n&&typeof n=="function"?n():n?.stop(),zn.delete(e)}};function Gi(e){return window._nc_contacts_menu_hooks?Object.values(window._nc_contacts_menu_hooks).filter(n=>n.enabled(e)):[]}const vg=new Int32Array(4);class pe{static hashStr(n,t=!1){return this.onePassHasher.start().appendStr(n).end(t)}static hashAsciiStr(n,t=!1){return this.onePassHasher.start().appendAsciiStr(n).end(t)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new pe;static _hex(n){const t=pe.hexChars,r=pe.hexOut;let i,o,a,u;for(u=0;u<4;u+=1)for(o=u*8,i=n[u],a=0;a<8;a+=2)r[o+1+a]=t.charAt(i&15),i>>>=4,r[o+0+a]=t.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(n,t){let r=n[0],i=n[1],o=n[2],a=n[3];r+=(i&o|~i&a)+t[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[1]-389564586|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[2]+606105819|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[6]-1473231341|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[10]-42063|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[13]-40341101|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[14]-1502002290|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&a|o&~a)+t[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[11]+643717713|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[10]+38016083|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[15]-660478335|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[3]-187363961|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[2]-51403784|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[7]+1735328473|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^a)+t[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[11]+1839030562|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[7]-155497632|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[0]-358537222|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[3]-722521979|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[12]-421815835|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[15]+530742520|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~a))+t[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[14]-1416354905|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[10]-1051523|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[15]-30611744|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[6]-1560198380|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[2]+718787259|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[9]-343485551|0,i=(i<<21|i>>>11)+o|0,n[0]=r+n[0]|0,n[1]=i+n[1]|0,n[2]=o+n[2]|0,n[3]=a+n[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(pe.stateIdentity),this}appendStr(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a;for(a=0;a>>6)+192,t[i++]=o&63|128;else if(o<55296||o>56319)t[i++]=(o>>>12)+224,t[i++]=o>>>6&63|128,t[i++]=o&63|128;else{if(o=(o-55296)*1024+(n.charCodeAt(++a)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(o>>>18)+240,t[i++]=o>>>12&63|128,t[i++]=o>>>6&63|128,t[i++]=o&63|128}i>=64&&(this._dataLength+=64,pe._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a=0;for(;;){for(o=Math.min(n.length-a,64-i);o--;)t[i++]=n.charCodeAt(a++);if(i<64)break;this._dataLength+=64,pe._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a=0;for(;;){for(o=Math.min(n.length-a,64-i);o--;)t[i++]=n[a++];if(i<64)break;this._dataLength+=64,pe._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const n=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[n[0],n[1],n[2],n[3]]}}setState(n){const t=n.buffer,r=n.state,i=this._state;let o;for(this._dataLength=n.length,this._bufferLength=n.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o>2)+1;this._dataLength+=t;const a=this._dataLength*8;if(r[t]=128,r[t+1]=r[t+2]=r[t+3]=0,i.set(pe.buffer32Identity.subarray(o),o),t>55&&(pe._md5cycle(this._state,i),i.set(pe.buffer32Identity)),a<=4294967295)i[14]=a;else{const u=a.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return n?vg:"";const c=parseInt(u[2],16),f=parseInt(u[1],16)||0;i[14]=c,i[15]=f}return pe._md5cycle(this._state,i),n?this._state:pe._hex(this._state)}}if(pe.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");Pe(Ja);class he{constructor(n,t,r,i){this.r=n,this.g=t,this.b=r,this.name=i,this.r=Math.min(n,255),this.g=Math.min(t,255),this.b=Math.min(r,255),this.name=i}r;g;b;name;get color(){const n=t=>`00${t.toString(16)}`.slice(-2);return`#${n(this.r)}${n(this.g)}${n(this.b)}`}}function bg(e,n,t){return{r:(t.r-n.r)/e,g:(t.g-n.g)/e,b:(t.b-n.b)/e}}function Bn(e,n,t){const r=[];r.push(n);const i=bg(e,n,t);for(let o=1;o/g,u=/<\/?([^\s\/>]+)/;function c(h,g,y){h=h||"",g=g||[],y=y||"";let m=p(g,y);return s(h,m)}function f(h,g){h=h||[],g=g||"";let y=p(h,g);return function(m){return s(m||"",y)}}c.init_streaming_mode=f;function p(h,g){return h=l(h),{allowable_tags:h,tag_replacement:g,state:r,tag_buffer:"",depth:0,in_quote_char:""}}function s(h,g){if(typeof h!="string")throw new TypeError("'html' parameter must be a string");let y=g.allowable_tags,m=g.tag_replacement,b=g.state,w=g.tag_buffer,M=g.depth,P=g.in_quote_char,x="";for(let F=0,W=h.length;F":if(P)break;if(M){M--;break}P="",b=r,w+=">",y.has(d(w))?x+=w:x+=m,w="";break;case'"':case"'":L===P?P="":P=P||L,w+=L;break;case"-":w==="i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)a=Array.from(r),a.unshift(n,t),e.splice(...a);else for(t&&e.splice(n,t);o0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}function km(e,n,t){const r=[];let i=-1;for(;++i999||s===93&&!a||s===null||s===91||we(s))return t(s);if(s===93){e.exit("chunkString");const l=e.exit("gfmFootnoteCallString");return i.includes(Zt(r.sliceSerialize(l)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(s)}return we(s)||(a=!0),o++,e.consume(s),s===92?p:f}function p(s){return s===91||s===92||s===93?(e.consume(s),o++,f):f(s)}}function Mm(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,u;return c;function c(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):t(h)}function p(h){if(a>999||h===93&&!u||h===null||h===91||we(h))return t(h);if(h===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return o=Zt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),l}return we(h)||(u=!0),a++,e.consume(h),h===92?s:p}function s(h){return h===91||h===92||h===93?(e.consume(h),a++,p):p(h)}function l(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),i.includes(o)||i.push(o),Ge(e,d,"gfmFootnoteDefinitionWhitespace")):t(h)}function d(h){return n(h)}}function Lm(e,n,t){return e.check(wm,n,e.attempt(Sm,n,t))}function Om(e){e.exit("gfmFootnoteDefinition")}function Em(e,n,t){const r=this;return Ge(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?n(o):t(o)}}function Pm(e){let n=(e||{}).singleTilde;const t={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:t},insideSpan:{null:[t]},attentionMarkers:{null:[126]}};function r(o,a){let u=-1;for(;++u1?u(d):(o.consume(d),p++,l);if(p<2&&!n)return u(d);const g=o.exit("strikethroughSequenceTemporary"),y=ln(d);return g._open=!y||y===2&&!!h,g._close=!h||h===2&&!!y,a(d)}}}class Dm{constructor(){this.map=[]}add(n,t,r){Nm(this,n,t,r)}consume(n){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let i=r.pop();for(;i;){for(const o of i)n.push(o);i=r.pop()}this.map.length=0}}function Nm(e,n,t,r){let i=0;if(!(t===0&&r.length===0)){for(;i-1;){const O=r.events[E][1].type;if(O==="lineEnding"||O==="linePrefix")E--;else break}const D=E>-1?r.events[E][1].type:null,N=D==="tableHead"||D==="tableRow"?x:c;return N===x&&r.parser.lazy[r.now().line]?t(k):N(k)}function c(k){return e.enter("tableHead"),e.enter("tableRow"),f(k)}function f(k){return k===124||(a=!0,o+=1),p(k)}function p(k){return k===null?t(k):_t(k)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),d):t(k):We(k)?Ge(e,p,"whitespace")(k):(o+=1,a&&(a=!1,i+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),s(k)))}function s(k){return k===null||k===124||we(k)?(e.exit("data"),p(k)):(e.consume(k),k===92?l:s)}function l(k){return k===92||k===124?(e.consume(k),s):s(k)}function d(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(k):(e.enter("tableDelimiterRow"),a=!1,We(k)?Ge(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):h(k))}function h(k){return k===45||k===58?y(k):k===124?(a=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),g):P(k)}function g(k){return We(k)?Ge(e,y,"whitespace")(k):y(k)}function y(k){return k===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),m):k===45?(o+=1,m(k)):k===null||_t(k)?M(k):P(k)}function m(k){return k===45?(e.enter("tableDelimiterFiller"),b(k)):P(k)}function b(k){return k===45?(e.consume(k),b):k===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(k))}function w(k){return We(k)?Ge(e,M,"whitespace")(k):M(k)}function M(k){return k===124?h(k):k===null||_t(k)?!a||i!==o?P(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(k)):P(k)}function P(k){return t(k)}function x(k){return e.enter("tableRow"),F(k)}function F(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),F):k===null||_t(k)?(e.exit("tableRow"),n(k)):We(k)?Ge(e,F,"whitespace")(k):(e.enter("data"),W(k))}function W(k){return k===null||k===124||we(k)?(e.exit("data"),F(k)):(e.consume(k),k===92?L:W)}function L(k){return k===92||k===124?(e.consume(k),W):W(k)}}function Rm(e,n){let t=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,f,p,s;const l=new Dm;for(;++tt[2]+1){const h=t[2]+1,g=t[3]-t[2]-1;e.add(h,g,[])}}e.add(t[3]+1,0,[["exit",s,n]])}return i!==void 0&&(o.end=Object.assign({},gt(n.events,i)),e.add(i,0,[["exit",o,n]]),o=void 0),o}function Wi(e,n,t,r,i){const o=[],a=gt(n.events,t);i&&(i.end=Object.assign({},a),o.push(["exit",i,n])),r.end=Object.assign({},a),o.push(["exit",r,n]),e.add(t+1,0,o)}function gt(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const jm={name:"tasklistCheck",tokenize:Hm};function Um(){return{text:{91:jm}}}function Hm(e,n,t){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return we(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):t(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):t(c)}function u(c){return _t(c)?n(c):We(c)?e.check({tokenize:Vm},n,t)(c):t(c)}}function Vm(e,n,t){return Ge(e,r,"whitespace");function r(i){return i===null?t(i):n(i)}}function qm(e){return sm([fm(),Am(),Pm(e),zm(),Um()])}const $m={};function Wm(e){const n=this,t=e||$m,r=n.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(qm(t)),o.push(om()),a.push(am(t))}const Gm=Ke({__name:"NcRichTextCopyButton",props:{contentId:{}},setup(e){const{copy:n,icon:t,altText:r}=wp(()=>document.getElementById(e.contentId).textContent);return(i,o)=>(A(),G(lt,{variant:"tertiary",size:"small","aria-label":le(r),title:le(r),onClick:le(n)},{icon:X(()=>[ce(ur,{path:le(t),inline:""},null,8,["path"])]),_:1},8,["aria-label","title","onClick"]))}});function Zm(e){return e.type==="text"}const Xm=function(e){tt(e,Zm,(n,t)=>{const r=t.at(-1),i=r.children.indexOf(n),o=n.value.split(/(\{[a-z\-_.0-9]+\})/ig).map(a=>{const u=a.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!u)return yt("text",a);const[,c]=u;return yt("element",{tagName:`#${c}`,children:[]})});r.children.splice(i,1,...o)})},Qm=()=>Xm;function Km(e){return["code","inlineCode"].includes(e.type)}const Ym=function(){return function(e){tt(e,Km,(n,t)=>{const r=t.at(-1),i=r.children.indexOf(n);return r.children.splice(i,1,{...n,value:""}),[hn,i+1]})}};function Jm(e){return["text","code","inlineCode"].includes(e.type)}const eg=function(){return function(e){tt(e,Jm,(n,t)=>{const r=t.at(-1),i=r.children.indexOf(n);return r.children.splice(i,1,{...n,value:n.value.replace(/</gmi,"<").replace(/>/gmi,">")}),[hn,i+1]})}},tg=["http","https","mailto","tel"],ar=be(null);async function ng(){const e=await fo(()=>import("./index-BLabbPfc.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url);ar.value=e.default}const rg={name:"NcRichText",components:{NcReferenceList:En},props:{text:{type:String,default:""},arguments:{type:Object,default:()=>({})},referenceLimit:{type:Number,default:0},referenceInteractive:{type:Boolean,default:!0},referenceInteractiveOptIn:{type:Boolean,default:!1},references:{type:Array,default:null},useMarkdown:{type:Boolean,default:!1},useExtendedMarkdown:{type:Boolean,default:!1},interactive:{type:Boolean,default:!1},autolink:{type:Boolean,default:!0}},emits:["interactTodo"],data(){return{parentId:it()}},methods:{renderPlaintext(){const e=this.text.split(/(\{[a-z\-_.0-9]+\})/ig).map(n=>{const t=n.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!t)return this.prepareTextNode(n);const r=t[1],i=this.arguments[r];if(typeof i=="object"){const{component:o,props:a}=i;return re(typeof o=="string"?Y(o):o,{...a,class:"rich-text--component"})}return i?re("span",{class:"rich-text--fallback"},i):n});return re("div",{class:"rich-text--wrapper"},[re("div",{},e.flat()),this.referenceLimit>0?re("div",{class:"rich-text--reference-widget"},[re(En,{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn})]):null])},renderMarkdown(){const e=Li().use(ki).use(fp,{autolink:this.autolink,useMarkdown:this.useMarkdown,useExtendedMarkdown:this.useExtendedMarkdown}).use(eg).use(this.useExtendedMarkdown?Wm:void 0).use(qu).use(Of,{except:tg}).use(Mf,{handlers:{component(n,t){return n(t,t.component,{value:t.value})}}}).use(this.useExtendedMarkdown?ar.value:void 0).use(Qm).use(Wl,{target:"_blank",rel:["noopener noreferrer"]}).use(Fu,{Fragment:at,jsx:this.createElement,jsxs:this.createElement,elementAttributeNameCase:"html",prefix:!1}).processSync(this.text.replace(/<[^>]+>/g,n=>n.replace(/")).result;return re("div",{class:"rich-text--wrapper rich-text--wrapper-markdown"},[e,this.referenceLimit>0?re("div",{class:"rich-text--reference-widget"},[re(En,{text:this.prepareReferenceSource(this.text),referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn})]):null])},prepareTextNode(e){return this.autolink&&(e=Xo(e)),Array.isArray(e)?e.map(n=>{if(typeof n=="string")return n;const{component:t,props:r}=n;return re(t,{...r,class:"rich-text--component"})}):e},prepareReferenceSource(e){if(!this.useMarkdown&&!this.useExtendedMarkdown)return e;const n=Li();return n.compiler=t=>dn(t),n.use(ki).use(Ym).processSync(e.replace(/\s/g," ")).value},createElement(e,n,t){t&&(n.key=t);const r=n.children??[];if(delete n.children,!String(e).startsWith("#")){["h1","h2","h3","h4","h5","h6"].includes(String(e))&&(e=`h${Math.min(+String(e)[1]+3,6)}`);let o=null;if(this.useExtendedMarkdown){if(String(e)==="code"&&!ar.value&&n?.class?.includes("language")&&ng(),String(e)==="pre"&&r&&String(r.type)==="code"){const a=this.parentId+"-code-block-"+it();return re("p",{class:"rich-text__code-block"},[re(e,{...n,id:a},r),re(Gm,{class:"rich-text__code-block-button",contentId:a})])}if(String(e)==="li"&&Array.isArray(r)&&r.length!==0&&r[0].type==="input"&&r[0].props.type==="checkbox"){const[a,,...u]=r,c=u.findIndex(l=>["ul","ol","li","blockquote","pre"].includes(l.type));c!==-1&&(o=u[c],u.splice(c));const f=this.parentId+"-markdown-input-"+it(),p={...a.props};delete p.checked;const s=re($a,{...p,modelValue:a.props.checked,id:f,disabled:!this.interactive,"onUpdate:modelValue":()=>{this.$emit("interactTodo",f)}},{default:()=>u});return re(e,n,[s,o])}}if(String(e)==="a"){const a=sn(this.$router,n.href);return a?(delete n.href,delete n.target,re(dr,{...n,to:a},{default:()=>r})):/^(https?:\/\/|tel:|mailto:)/.test(n.href)?(n.href=n.href.trim(),re(Zo,n,r)):(delete n.href,delete n.target,re("span",n,r))}return re(e,n,r)}const i=this.arguments[e.slice(1)];return i?i.component?re(typeof i.component=="string"?Y(i.component):i.component,{...n,...i.props,class:"rich-text--component"},{default:()=>r}):re("span",{...n},[i]):re("span",{...n,class:"rich-text--fallback"},[`{${e.slice(1)}}`])}},render(){return this.useMarkdown||this.useExtendedMarkdown?this.renderMarkdown():this.renderPlaintext()}},ig=xe(rg,[["__scopeId","data-v-80e57a29"]]);window._vue_richtext_custom_picker_elements??={},window._registerCustomPickerElement??=og;function og(e,n,t=()=>{},r="large"){if(window._vue_richtext_custom_picker_elements[e]){Ue.error(`Custom reference picker element for id ${e} already registered`);return}window._vue_richtext_custom_picker_elements[e]={id:e,callback:n,onDestroy:t,size:r}}function ag(e,n=100,t={}){if(typeof e!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(n<0)throw new RangeError("`wait` must not be negative.");if(typeof t=="boolean")throw new TypeError("The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.");const{immediate:r}=t;let i,o,a,u,c;function f(){const l=i,d=o;return i=void 0,o=void 0,c=e.apply(l,d),c}function p(){const l=Date.now()-u;l=0?a=setTimeout(p,n-l):(a=void 0,r||(c=f()))}const s=function(...l){if(i&&this!==i&&Object.getPrototypeOf(this)===Object.getPrototypeOf(i))throw new Error("Debounced method called with different contexts of the same prototype.");i=this,o=l,u=Date.now();const d=r&&!a;if(a||(a=setTimeout(p,n)),d)return c=f(),c};return Object.defineProperty(s,"isPending",{get(){return a!==void 0}}),s.clear=()=>{a&&(clearTimeout(a),a=void 0,i=void 0,o=void 0)},s.flush=()=>{a&&s.trigger()},s.trigger=()=>{c=f(),s.clear()},s}Pe(Wa),K("Any link"),so("core","filetypes/link.svg"),window._vue_richtext_reference_providers??=et("core","reference-provider-list",[]),window._vue_richtext_reference_provider_timestamps??=et("core","reference-provider-timestamps",{}),Pe(Ur,Ga),Pe(Za),Pe(Qa,Ur,Xa),Pe(Ya,Ka);const sg={__name:"ActionButton",props:{action:{type:Object,required:!0}},emits:["click"],setup(e,{emit:n}){const t=e,r=n,i=H(()=>t.action.type==="WEB");function o(a){const u={url:t.action.link,type:t.action.type||"GET"};r("click",{event:a,action:u})}return(a,u)=>(A(),G(le(lt),{variant:i.value||e.action.primary?"primary":"secondary",href:i.value?e.action.link:void 0,class:"action-button pull-right",onClick:o},{default:X(()=>[Ze(j(e.action.label),1)]),_:1},8,["variant","href"]))}},lg={name:"DefaultParameter",props:{type:{type:String,required:!0},id:{type:[Number,String],required:!0},name:{type:String,required:!0},link:{type:String,default:""}},computed:{hasInternalLink(){return this.link&&(this.type==="deck-board"||this.type==="deck-card")}}},ug=["href"],cg=["href"],dg={key:2};function fg(e,n,t,r,i,o){return o.hasInternalLink?(A(),T("a",{key:0,href:t.link},[U("strong",null,j(t.name),1)],8,ug)):t.link?(A(),T("a",{key:1,href:t.link,class:"external",target:"_blank",rel:"noopener noreferrer"},[U("strong",null,j(t.name),1)],8,cg)):(A(),T("strong",dg,j(t.name),1))}const pg=Qe(lg,[["render",fg],["__scopeId","data-v-9803ab31"]]),hg={name:"FileParameter",props:{type:{type:String,required:!0},id:{type:[Number,String],required:!0},name:{type:String,required:!0},path:{type:String,default:""},link:{type:String,default:""}},computed:{title(){const e=this.path.lastIndexOf("/"),n=this.path.indexOf("/"),t=this.path.substring(n===0?1:0,e);return t.length===0?"":je("notifications","in {path}",{path:t})}}},mg=["title","href"];function gg(e,n,t,r,i,o){return A(),T("a",{title:o.title,class:"filename",href:t.link},j(t.name),9,mg)}const yg=Qe(hg,[["render",gg]]),zn=new WeakMap,_g={mounted(e,n){const t=!n.modifiers.bubble;let r;if(typeof n.value=="function")r=Vn(e,n.value,{capture:t});else{const[i,o]=n.value;r=Vn(e,i,Object.assign({capture:t},o))}zn.set(e,r)},unmounted(e){const n=zn.get(e);n&&typeof n=="function"?n():n?.stop(),zn.delete(e)}};function Gi(e){return window._nc_contacts_menu_hooks?Object.values(window._nc_contacts_menu_hooks).filter(n=>n.enabled(e)):[]}const vg=new Int32Array(4);class pe{static hashStr(n,t=!1){return this.onePassHasher.start().appendStr(n).end(t)}static hashAsciiStr(n,t=!1){return this.onePassHasher.start().appendAsciiStr(n).end(t)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new pe;static _hex(n){const t=pe.hexChars,r=pe.hexOut;let i,o,a,u;for(u=0;u<4;u+=1)for(o=u*8,i=n[u],a=0;a<8;a+=2)r[o+1+a]=t.charAt(i&15),i>>>=4,r[o+0+a]=t.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(n,t){let r=n[0],i=n[1],o=n[2],a=n[3];r+=(i&o|~i&a)+t[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[1]-389564586|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[2]+606105819|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[6]-1473231341|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[10]-42063|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[13]-40341101|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[14]-1502002290|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&a|o&~a)+t[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[11]+643717713|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[10]+38016083|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[15]-660478335|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[3]-187363961|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[2]-51403784|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[7]+1735328473|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^a)+t[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[11]+1839030562|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[7]-155497632|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[0]-358537222|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[3]-722521979|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[12]-421815835|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[15]+530742520|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~a))+t[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[14]-1416354905|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[10]-1051523|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[15]-30611744|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[6]-1560198380|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[2]+718787259|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[9]-343485551|0,i=(i<<21|i>>>11)+o|0,n[0]=r+n[0]|0,n[1]=i+n[1]|0,n[2]=o+n[2]|0,n[3]=a+n[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(pe.stateIdentity),this}appendStr(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a;for(a=0;a>>6)+192,t[i++]=o&63|128;else if(o<55296||o>56319)t[i++]=(o>>>12)+224,t[i++]=o>>>6&63|128,t[i++]=o&63|128;else{if(o=(o-55296)*1024+(n.charCodeAt(++a)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(o>>>18)+240,t[i++]=o>>>12&63|128,t[i++]=o>>>6&63|128,t[i++]=o&63|128}i>=64&&(this._dataLength+=64,pe._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a=0;for(;;){for(o=Math.min(n.length-a,64-i);o--;)t[i++]=n.charCodeAt(a++);if(i<64)break;this._dataLength+=64,pe._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a=0;for(;;){for(o=Math.min(n.length-a,64-i);o--;)t[i++]=n[a++];if(i<64)break;this._dataLength+=64,pe._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const n=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[n[0],n[1],n[2],n[3]]}}setState(n){const t=n.buffer,r=n.state,i=this._state;let o;for(this._dataLength=n.length,this._bufferLength=n.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o>2)+1;this._dataLength+=t;const a=this._dataLength*8;if(r[t]=128,r[t+1]=r[t+2]=r[t+3]=0,i.set(pe.buffer32Identity.subarray(o),o),t>55&&(pe._md5cycle(this._state,i),i.set(pe.buffer32Identity)),a<=4294967295)i[14]=a;else{const u=a.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return n?vg:"";const c=parseInt(u[2],16),f=parseInt(u[1],16)||0;i[14]=c,i[15]=f}return pe._md5cycle(this._state,i),n?this._state:pe._hex(this._state)}}if(pe.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");Pe(Ja);class he{constructor(n,t,r,i){this.r=n,this.g=t,this.b=r,this.name=i,this.r=Math.min(n,255),this.g=Math.min(t,255),this.b=Math.min(r,255),this.name=i}r;g;b;name;get color(){const n=t=>`00${t.toString(16)}`.slice(-2);return`#${n(this.r)}${n(this.g)}${n(this.b)}`}}function bg(e,n,t){return{r:(t.r-n.r)/e,g:(t.g-n.g)/e,b:(t.b-n.b)/e}}function Bn(e,n,t){const r=[];r.push(n);const i=bg(e,n,t);for(let o=1;o/g,u=/<\/?([^\s\/>]+)/;function c(h,g,y){h=h||"",g=g||[],y=y||"";let m=p(g,y);return s(h,m)}function f(h,g){h=h||[],g=g||"";let y=p(h,g);return function(m){return s(m||"",y)}}c.init_streaming_mode=f;function p(h,g){return h=l(h),{allowable_tags:h,tag_replacement:g,state:r,tag_buffer:"",depth:0,in_quote_char:""}}function s(h,g){if(typeof h!="string")throw new TypeError("'html' parameter must be a string");let y=g.allowable_tags,m=g.tag_replacement,b=g.state,w=g.tag_buffer,M=g.depth,P=g.in_quote_char,x="";for(let F=0,W=h.length;F":if(P)break;if(M){M--;break}P="",b=r,w+=">",y.has(d(w))?x+=w:x+=m,w="";break;case'"':case"'":L===P?P="":P=P||L,w+=L;break;case"-":w===""?(w.slice(-2)=="--"&&(b=r),w=""):w+=L)}return g.state=b,g.tag_buffer=w,g.depth=M,g.in_quote_char=P,x}function l(h){let g=new Set;if(typeof h=="string"){let y;for(;y=a.exec(h);)g.add(y[1])}else!t.nonNative&&typeof h[t.iterator]=="function"?g=new Set(h):typeof h.forEach=="function"&&h.forEach(g.add,g);return g}function d(h){let g=u.exec(h);return g?g[1].toLowerCase():null}e.exports?e.exports=c:n.striptags=c})(xg)})(sr)),sr.exports}Sg();function Ag(e,n){const t=(n?.size||64)<=64?64:512,r=n?.isGuest?"/guest":"",i=n?.isDarkTheme??Hn(document.body)?"/dark":"";return cr(`/avatar${r}/{user}/{size}${i}?guestFallback=true`,{user:e,size:t})}const Ig=`\n\n\n\n\n","import { defineComponent, computed, toRef, openBlock, createElementBlock, toDisplayString, unref } from \"vue\";\nimport { useFormatTime, useFormatRelativeTime } from \"../composables/useFormatDateTime/index.mjs\";\nconst _hoisted_1 = [\"data-timestamp\", \"title\", \"textContent\"];\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcDateTime\",\n props: {\n timestamp: {},\n format: { default: () => ({ timeStyle: \"medium\", dateStyle: \"short\" }) },\n relativeTime: { type: [Boolean, String], default: \"long\" },\n ignoreSeconds: { type: Boolean }\n },\n setup(__props) {\n const props = __props;\n const timeOptions = computed(() => ({ format: props.format }));\n const relativeTimeOptions = computed(() => ({\n ignoreSeconds: props.ignoreSeconds,\n relativeTime: props.relativeTime || \"long\",\n update: props.relativeTime !== false\n }));\n const title = useFormatTime(toRef(() => props.timestamp), timeOptions);\n const relativeTime = useFormatRelativeTime(toRef(() => props.timestamp), relativeTimeOptions);\n const formattedTime = computed(() => props.relativeTime ? relativeTime.value : title.value);\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"span\", {\n class: \"nc-datetime\",\n dir: \"auto\",\n \"data-timestamp\": __props.timestamp,\n title: unref(title),\n textContent: toDisplayString(formattedTime.value)\n }, null, 8, _hoisted_1);\n };\n }\n});\nexport {\n _sfc_main as _\n};\n//# sourceMappingURL=NcDateTime.vue_vue_type_script_setup_true_lang.mjs.map\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean | null | undefined} [includeImageAlt=true]\n * Whether to use `alt` for `image`s (default: `true`).\n * @property {boolean | null | undefined} [includeHtml=true]\n * Whether to use `value` of HTML (default: `true`).\n */\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Get the text content of a node or list of nodes.\n *\n * Prefers the node’s plain-text fields, otherwise serializes its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} [value]\n * Thing to serialize, typically `Node`.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized `value`.\n */\nexport function toString(value, options) {\n const settings = options || emptyOptions\n const includeImageAlt =\n typeof settings.includeImageAlt === 'boolean'\n ? settings.includeImageAlt\n : true\n const includeHtml =\n typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true\n\n return one(value, includeImageAlt, includeHtml)\n}\n\n/**\n * One node or several nodes.\n *\n * @param {unknown} value\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized node.\n */\nfunction one(value, includeImageAlt, includeHtml) {\n if (node(value)) {\n if ('value' in value) {\n return value.type === 'html' && !includeHtml ? '' : value.value\n }\n\n if (includeImageAlt && 'alt' in value && value.alt) {\n return value.alt\n }\n\n if ('children' in value) {\n return all(value.children, includeImageAlt, includeHtml)\n }\n }\n\n if (Array.isArray(value)) {\n return all(value, includeImageAlt, includeHtml)\n }\n\n return ''\n}\n\n/**\n * Serialize a list of nodes.\n *\n * @param {Array} values\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized nodes.\n */\nfunction all(values, includeImageAlt, includeHtml) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt, includeHtml)\n }\n\n return result.join('')\n}\n\n/**\n * Check if `value` looks like a node.\n *\n * @param {unknown} value\n * Thing.\n * @returns {value is Nodes}\n * Whether `value` is a node.\n */\nfunction node(value) {\n return Boolean(value && typeof value === 'object')\n}\n","export const VOID = -1;\nexport const PRIMITIVE = 0;\nexport const ARRAY = 1;\nexport const OBJECT = 2;\nexport const DATE = 3;\nexport const REGEXP = 4;\nexport const MAP = 5;\nexport const SET = 6;\nexport const ERROR = 7;\nexport const BIGINT = 8;\n// export const SYMBOL = 9;\n","import {\n VOID, PRIMITIVE,\n ARRAY, OBJECT,\n DATE, REGEXP, MAP, SET,\n ERROR, BIGINT\n} from './types.js';\n\nconst env = typeof self === 'object' ? self : globalThis;\n\nconst deserializer = ($, _) => {\n const as = (out, index) => {\n $.set(index, out);\n return out;\n };\n\n const unpair = index => {\n if ($.has(index))\n return $.get(index);\n\n const [type, value] = _[index];\n switch (type) {\n case PRIMITIVE:\n case VOID:\n return as(value, index);\n case ARRAY: {\n const arr = as([], index);\n for (const index of value)\n arr.push(unpair(index));\n return arr;\n }\n case OBJECT: {\n const object = as({}, index);\n for (const [key, index] of value)\n object[unpair(key)] = unpair(index);\n return object;\n }\n case DATE:\n return as(new Date(value), index);\n case REGEXP: {\n const {source, flags} = value;\n return as(new RegExp(source, flags), index);\n }\n case MAP: {\n const map = as(new Map, index);\n for (const [key, index] of value)\n map.set(unpair(key), unpair(index));\n return map;\n }\n case SET: {\n const set = as(new Set, index);\n for (const index of value)\n set.add(unpair(index));\n return set;\n }\n case ERROR: {\n const {name, message} = value;\n return as(new env[name](message), index);\n }\n case BIGINT:\n return as(BigInt(value), index);\n case 'BigInt':\n return as(Object(BigInt(value)), index);\n case 'ArrayBuffer':\n return as(new Uint8Array(value).buffer, value);\n case 'DataView': {\n const { buffer } = new Uint8Array(value);\n return as(new DataView(buffer), value);\n }\n }\n return as(new env[type](value), index);\n };\n\n return unpair;\n};\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns a deserialized value from a serialized array of Records.\n * @param {Record[]} serialized a previously serialized value.\n * @returns {any}\n */\nexport const deserialize = serialized => deserializer(new Map, serialized)(0);\n","import {\n VOID, PRIMITIVE,\n ARRAY, OBJECT,\n DATE, REGEXP, MAP, SET,\n ERROR, BIGINT\n} from './types.js';\n\nconst EMPTY = '';\n\nconst {toString} = {};\nconst {keys} = Object;\n\nconst typeOf = value => {\n const type = typeof value;\n if (type !== 'object' || !value)\n return [PRIMITIVE, type];\n\n const asString = toString.call(value).slice(8, -1);\n switch (asString) {\n case 'Array':\n return [ARRAY, EMPTY];\n case 'Object':\n return [OBJECT, EMPTY];\n case 'Date':\n return [DATE, EMPTY];\n case 'RegExp':\n return [REGEXP, EMPTY];\n case 'Map':\n return [MAP, EMPTY];\n case 'Set':\n return [SET, EMPTY];\n case 'DataView':\n return [ARRAY, asString];\n }\n\n if (asString.includes('Array'))\n return [ARRAY, asString];\n\n if (asString.includes('Error'))\n return [ERROR, asString];\n\n return [OBJECT, asString];\n};\n\nconst shouldSkip = ([TYPE, type]) => (\n TYPE === PRIMITIVE &&\n (type === 'function' || type === 'symbol')\n);\n\nconst serializer = (strict, json, $, _) => {\n\n const as = (out, value) => {\n const index = _.push(out) - 1;\n $.set(value, index);\n return index;\n };\n\n const pair = value => {\n if ($.has(value))\n return $.get(value);\n\n let [TYPE, type] = typeOf(value);\n switch (TYPE) {\n case PRIMITIVE: {\n let entry = value;\n switch (type) {\n case 'bigint':\n TYPE = BIGINT;\n entry = value.toString();\n break;\n case 'function':\n case 'symbol':\n if (strict)\n throw new TypeError('unable to serialize ' + type);\n entry = null;\n break;\n case 'undefined':\n return as([VOID], value);\n }\n return as([TYPE, entry], value);\n }\n case ARRAY: {\n if (type) {\n let spread = value;\n if (type === 'DataView') {\n spread = new Uint8Array(value.buffer);\n }\n else if (type === 'ArrayBuffer') {\n spread = new Uint8Array(value);\n }\n return as([type, [...spread]], value);\n }\n\n const arr = [];\n const index = as([TYPE, arr], value);\n for (const entry of value)\n arr.push(pair(entry));\n return index;\n }\n case OBJECT: {\n if (type) {\n switch (type) {\n case 'BigInt':\n return as([type, value.toString()], value);\n case 'Boolean':\n case 'Number':\n case 'String':\n return as([type, value.valueOf()], value);\n }\n }\n\n if (json && ('toJSON' in value))\n return pair(value.toJSON());\n\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const key of keys(value)) {\n if (strict || !shouldSkip(typeOf(value[key])))\n entries.push([pair(key), pair(value[key])]);\n }\n return index;\n }\n case DATE:\n return as([TYPE, value.toISOString()], value);\n case REGEXP: {\n const {source, flags} = value;\n return as([TYPE, {source, flags}], value);\n }\n case MAP: {\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const [key, entry] of value) {\n if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))\n entries.push([pair(key), pair(entry)]);\n }\n return index;\n }\n case SET: {\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const entry of value) {\n if (strict || !shouldSkip(typeOf(entry)))\n entries.push(pair(entry));\n }\n return index;\n }\n }\n\n const {message} = value;\n return as([TYPE, {name: type, message}], value);\n };\n\n return pair;\n};\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} value a serializable value.\n * @param {{json?: boolean, lossy?: boolean}?} options an object with a `lossy` or `json` property that,\n * if `true`, will not throw errors on incompatible types, and behave more\n * like JSON stringify would behave. Symbol and Function will be discarded.\n * @returns {Record[]}\n */\n export const serialize = (value, {json, lossy} = {}) => {\n const _ = [];\n return serializer(!(json || lossy), !!json, new Map, _)(value), _;\n};\n","import {deserialize} from './deserialize.js';\nimport {serialize} from './serialize.js';\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} any a serializable value.\n * @param {{transfer?: any[], json?: boolean, lossy?: boolean}?} options an object with\n * a transfer option (ignored when polyfilled) and/or non standard fields that\n * fallback to the polyfill if present.\n * @returns {Record[]}\n */\nexport default typeof structuredClone === \"function\" ?\n /* c8 ignore start */\n (any, options) => (\n options && ('json' in options || 'lossy' in options) ?\n deserialize(serialize(any, options)) : structuredClone(any)\n ) :\n (any, options) => deserialize(serialize(any, options));\n /* c8 ignore stop */\n\nexport {deserialize, serialize};\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Parents} Parents\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is an element.\n * @param {unknown} this\n * Context object (`this`) to call `test` with\n * @param {unknown} [element]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * Position of `element` in its parent.\n * @param {Parents | null | undefined} [parent]\n * Parent of `element`.\n * @returns {boolean}\n * Whether this is an element and passes a test.\n *\n * @typedef {Array | TestFunction | string | null | undefined} Test\n * Check for an arbitrary element.\n *\n * * when `string`, checks that the element has that tag name\n * * when `function`, see `TestFunction`\n * * when `Array`, checks if one of the subtests pass\n *\n * @callback TestFunction\n * Check if an element passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Element} element\n * An element.\n * @param {number | undefined} [index]\n * Position of `element` in its parent.\n * @param {Parents | undefined} [parent]\n * Parent of `element`.\n * @returns {boolean | undefined | void}\n * Whether this element passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `element` is an `Element` and whether it passes the given test.\n *\n * @param element\n * Thing to check, typically `element`.\n * @param test\n * Check for a specific element.\n * @param index\n * Position of `element` in its parent.\n * @param parent\n * Parent of `element`.\n * @param context\n * Context object (`this`) to call `test` with.\n * @returns\n * Whether `element` is an `Element` and passes a test.\n * @throws\n * When an incorrect `test`, `index`, or `parent` is given; there is no error\n * thrown when `element` is not a node or not an element.\n */\nexport const isElement =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((element: unknown, test: Condition, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate) &\n * ((element: unknown, test: Condition, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &\n * ((element?: null | undefined) => false) &\n * ((element: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &\n * ((element: unknown, test?: Test, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [element]\n * @param {Test | undefined} [test]\n * @param {number | null | undefined} [index]\n * @param {Parents | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (element, test, index, parent, context) {\n const check = convertElement(test)\n\n if (\n index !== null &&\n index !== undefined &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite `index`')\n }\n\n if (\n parent !== null &&\n parent !== undefined &&\n (!parent.type || !parent.children)\n ) {\n throw new Error('Expected valid `parent`')\n }\n\n if (\n (index === null || index === undefined) !==\n (parent === null || parent === undefined)\n ) {\n throw new Error('Expected both `index` and `parent`')\n }\n\n return looksLikeAnElement(element)\n ? check.call(context, element, index, parent)\n : false\n }\n )\n\n/**\n * Generate a check from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * an `element`, `index`, and `parent`.\n *\n * @param test\n * A test for a specific element.\n * @returns\n * A check.\n */\nexport const convertElement =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate) &\n * ((test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &\n * ((test?: null | undefined) => (element?: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test | null | undefined} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return element\n }\n\n if (typeof test === 'string') {\n return tagNameFactory(test)\n }\n\n // Assume array.\n if (typeof test === 'object') {\n return anyFactory(test)\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n throw new Error('Expected function, string, or array as `test`')\n }\n )\n\n/**\n * Handle multiple tests.\n *\n * @param {Array} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convertElement(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn a string into a test for an element with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction tagNameFactory(check) {\n return castFactory(tagName)\n\n /**\n * @param {Element} element\n * @returns {boolean}\n */\n function tagName(element) {\n return element.tagName === check\n }\n}\n\n/**\n * Turn a custom test into a test for an element that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeAnElement(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\n/**\n * Make sure something is an element.\n *\n * @param {unknown} element\n * @returns {element is Element}\n */\nfunction element(element) {\n return Boolean(\n element &&\n typeof element === 'object' &&\n 'type' in element &&\n element.type === 'element' &&\n 'tagName' in element &&\n typeof element.tagName === 'string'\n )\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Element}\n */\nfunction looksLikeAnElement(value) {\n return (\n value !== null &&\n typeof value === 'object' &&\n 'type' in value &&\n 'tagName' in value\n )\n}\n","// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1\n// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/;\n\n// Windows paths like `c:\\`\nconst WINDOWS_PATH_REGEX = /^[a-zA-Z]:\\\\/;\n\nexport default function isAbsoluteUrl(url) {\n\tif (typeof url !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof url}\\``);\n\t}\n\n\tif (WINDOWS_PATH_REGEX.test(url)) {\n\t\treturn false;\n\t}\n\n\treturn ABSOLUTE_URL_REGEX.test(url);\n}\n","/**\n * Parse space-separated tokens to an array of strings.\n *\n * @param {string} value\n * Space-separated tokens.\n * @returns {Array}\n * List of tokens.\n */\nexport function parse(value) {\n const input = String(value || '').trim()\n return input ? input.split(/[ \\t\\n\\r\\f]+/g) : []\n}\n\n/**\n * Serialize an array of strings as space separated-tokens.\n *\n * @param {Array} values\n * List of tokens.\n * @returns {string}\n * Space-separated tokens.\n */\nexport function stringify(values) {\n return values.join(' ').trim()\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test) ? anyFactory(test) : propsFactory(test)\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propsFactory(check) {\n const checkAsRecord = /** @type {Record} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @import {Node as UnistNode, Parent as UnistParent} from 'unist'\n */\n\n/**\n * @typedef {Exclude | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate extends Value\n * ? Predicate\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends ReadonlyArray\n * ? MatchesOne\n * : Check extends Array\n * ? MatchesOne\n * : MatchesOne\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent\n * | InternalAncestor, Max, Increment>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {InternalAncestor, Child>} Ancestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n * Union of the action types.\n *\n * @typedef {number} Index\n * Move to the sibling at `index` next (after node itself is completely\n * traversed).\n *\n * Useful if mutating the tree, such as removing the node the visitor is\n * currently on, or any of its previous siblings.\n * Results less than 0 or greater than or equal to `children.length` stop\n * traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n * List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n * Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform the parent of node (the last of `ancestors`).\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of an ancestor still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Array} ancestors\n * Ancestors of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor, Check>, Ancestor, Check>>>} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n * Tree type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} test\n * `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n * Handle each node.\n * @param {boolean | null | undefined} [reverse]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n /** @type {Test} */\n let check\n\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n // @ts-expect-error no visitor given, so `visitor` is test.\n visitor = test\n } else {\n // @ts-expect-error visitor given, so `test` isn’t a visitor.\n check = test\n }\n\n const is = convert(check)\n const step = reverse ? -1 : 1\n\n factory(tree, undefined, [])()\n\n /**\n * @param {UnistNode} node\n * @param {number | undefined} index\n * @param {Array} parents\n */\n function factory(node, index, parents) {\n const value = /** @type {Record} */ (\n node && typeof node === 'object' ? node : {}\n )\n\n if (typeof value.type === 'string') {\n const name =\n // `hast`\n typeof value.tagName === 'string'\n ? value.tagName\n : // `xast`\n typeof value.name === 'string'\n ? value.name\n : undefined\n\n Object.defineProperty(visit, 'name', {\n value:\n 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n })\n }\n\n return visit\n\n function visit() {\n /** @type {Readonly} */\n let result = empty\n /** @type {Readonly} */\n let subresult\n /** @type {number} */\n let offset\n /** @type {Array} */\n let grandparents\n\n if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n // @ts-expect-error: `visitor` is now a visitor.\n result = toResult(visitor(node, parents))\n\n if (result[0] === EXIT) {\n return result\n }\n }\n\n if ('children' in node && node.children) {\n const nodeAsParent = /** @type {UnistParent} */ (node)\n\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = (reverse ? nodeAsParent.children.length : -1) + step\n grandparents = parents.concat(nodeAsParent)\n\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset]\n\n subresult = factory(child, offset, grandparents)()\n\n if (subresult[0] === EXIT) {\n return subresult\n }\n\n offset =\n typeof subresult[1] === 'number' ? subresult[1] : offset + step\n }\n }\n }\n\n return result\n }\n }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n * Valid return values from visitors.\n * @returns {Readonly}\n * Clean result.\n */\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value\n }\n\n if (typeof value === 'number') {\n return [CONTINUE, value]\n }\n\n return value === null || value === undefined ? empty : [value]\n}\n","/**\n * @import {Node as UnistNode, Parent as UnistParent} from 'unist'\n * @import {VisitorResult} from 'unist-util-visit-parents'\n */\n\n/**\n * @typedef {Exclude | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n// To do: use types from `unist-util-visit-parents` when it’s released.\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate extends Value\n * ? Predicate\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends ReadonlyArray\n * ? MatchesOne\n * : MatchesOne\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent\n * | InternalAncestor, Max, Increment>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform `parent`.\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of `parent` still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Visited extends UnistNode ? number | undefined : never} index\n * Index of `node` in `parent`.\n * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent\n * Parent of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [Ancestor=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor>} BuildVisitorFromMatch\n * Build a typed `Visitor` function from a node and all possible parents.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Visited\n * Node type.\n * @template {UnistParent} Ancestor\n * Parent type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromMatch<\n * Matches,\n * Extract\n * >\n * )} BuildVisitorFromDescendants\n * Build a typed `Visitor` function from a list of descendants and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Descendant\n * Node type.\n * @template {Test} Check\n * Test type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromDescendants<\n * InclusiveDescendant,\n * Check\n * >\n * )} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} [Tree=UnistNode]\n * Node type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} testOrVisitor\n * `unist-util-is`-compatible test (optional, omit to pass a visitor).\n * @param {Visitor | boolean | null | undefined} [visitorOrReverse]\n * Handle each node (when test is omitted, pass `reverse`).\n * @param {boolean | null | undefined} [maybeReverse=false]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n /** @type {boolean | null | undefined} */\n let reverse\n /** @type {Test} */\n let test\n /** @type {Visitor} */\n let visitor\n\n if (\n typeof testOrVisitor === 'function' &&\n typeof visitorOrReverse !== 'function'\n ) {\n test = undefined\n visitor = testOrVisitor\n reverse = visitorOrReverse\n } else {\n // @ts-expect-error: assume the overload with test was given.\n test = testOrVisitor\n // @ts-expect-error: assume the overload with test was given.\n visitor = visitorOrReverse\n reverse = maybeReverse\n }\n\n visitParents(tree, test, overload, reverse)\n\n /**\n * @param {UnistNode} node\n * @param {Array} parents\n */\n function overload(node, parents) {\n const parent = parents[parents.length - 1]\n const index = parent ? parent.children.indexOf(node) : undefined\n return visitor(node, index, parent)\n }\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('hast').Root} Root\n * @typedef {import('hast-util-is-element').Test} Test\n */\n\n/**\n * @callback CreateContent\n * Create a target for the element.\n * @param {Element} element\n * Element to check.\n * @returns {Array | ElementContent | null | undefined}\n * Content to add.\n *\n * @callback CreateProperties\n * Create properties for an element.\n * @param {Element} element\n * Element to check.\n * @returns {Properties | null | undefined}\n * Properties to add.\n *\n * @callback CreateRel\n * Create a `rel` for the element.\n * @param {Element} element\n * Element to check.\n * @returns {Array | string | null | undefined}\n * `rel` to use.\n *\n * @callback CreateTarget\n * Create a `target` for the element.\n * @param {Element} element\n * Element to check.\n * @returns {Target | null | undefined}\n * `target` to use.\n *\n * @typedef Options\n * Configuration.\n * @property {Array | CreateContent | ElementContent | null | undefined} [content]\n * Content to insert at the end of external links (optional); will be\n * inserted in a `` element; useful for improving accessibility by\n * giving users advanced warning when opening a new window.\n * @property {CreateProperties | Properties | null | undefined} [contentProperties]\n * Properties to add to the `span` wrapping `content` (optional).\n * @property {CreateProperties | Properties | null | undefined} [properties]\n * Properties to add to the link itself (optional).\n * @property {Array | null | undefined} [protocols=['http', 'https']]\n * Protocols to check, such as `mailto` or `tel` (default: `['http',\n * 'https']`).\n * @property {Array | CreateRel | string | null | undefined} [rel=['nofollow']]\n * Link types to hint about the referenced documents (default:\n * `['nofollow']`); pass an empty array (`[]`) to not set `rel`s on links;\n * when using a `target`, add `noopener` and `noreferrer` to avoid\n * exploitation of the `window.opener` API.\n * @property {CreateTarget | Target | null | undefined} [target]\n * How to display referenced documents; the default (nothing) is to not set\n * `target`s on links.\n * @property {Test | null | undefined} [test]\n * Extra test to define which external link elements are modified (optional);\n * any test that can be given to `hast-util-is-element` is supported.\n *\n * @typedef {'_blank' | '_parent' | '_self' | '_top'} Target\n * Target.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {convertElement} from 'hast-util-is-element'\nimport isAbsoluteUrl from 'is-absolute-url'\nimport {parse} from 'space-separated-tokens'\nimport {visit} from 'unist-util-visit'\n\nconst defaultProtocols = ['http', 'https']\nconst defaultRel = ['nofollow']\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Automatically add `rel` (and `target`?) to external links.\n *\n * ###### Notes\n *\n * You should [likely not configure `target`][css-tricks].\n *\n * You should at least set `rel` to `['nofollow']`.\n * When using a `target`, add `noopener` and `noreferrer` to avoid exploitation\n * of the `window.opener` API.\n *\n * When using a `target`, you should set `content` to adhere to accessibility\n * guidelines by giving users advanced warning when opening a new window.\n *\n * [css-tricks]: https://css-tricks.com/use-target_blank/\n *\n * @param {Readonly | null | undefined} [options]\n * Configuration (optional).\n * @returns\n * Transform.\n */\nexport default function rehypeExternalLinks(options) {\n const settings = options || emptyOptions\n const protocols = settings.protocols || defaultProtocols\n const is = convertElement(settings.test)\n\n /**\n * Transform.\n *\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n return function (tree) {\n visit(tree, 'element', function (node, index, parent) {\n if (\n node.tagName === 'a' &&\n typeof node.properties.href === 'string' &&\n is(node, index, parent)\n ) {\n const url = node.properties.href\n\n if (\n isAbsoluteUrl(url)\n ? protocols.includes(url.slice(0, url.indexOf(':')))\n : url.startsWith('//')\n ) {\n const contentRaw = createIfNeeded(settings.content, node)\n const content =\n contentRaw && !Array.isArray(contentRaw) ? [contentRaw] : contentRaw\n const relRaw = createIfNeeded(settings.rel, node) || defaultRel\n const rel = typeof relRaw === 'string' ? parse(relRaw) : relRaw\n const target = createIfNeeded(settings.target, node)\n\n const properties = createIfNeeded(settings.properties, node)\n\n if (properties) {\n Object.assign(node.properties, structuredClone(properties))\n }\n\n if (rel.length > 0) {\n node.properties.rel = [...rel]\n }\n\n if (target) {\n node.properties.target = target\n }\n\n if (content) {\n const properties =\n createIfNeeded(settings.contentProperties, node) || {}\n\n node.children.push({\n type: 'element',\n tagName: 'span',\n properties: structuredClone(properties),\n children: structuredClone(content)\n })\n }\n }\n }\n })\n }\n}\n\n/**\n * Call a function to get a return value or use the value.\n *\n * @template T\n * Type of value.\n * @param {T} value\n * Value.\n * @param {Element} element\n * Element.\n * @returns {T extends Function ? ReturnType : T}\n * Result.\n */\nfunction createIfNeeded(value, element) {\n return typeof value === 'function' ? value(element) : value\n}\n","/**\n * @typedef Options\n * Configuration for `stringify`.\n * @property {boolean} [padLeft=true]\n * Whether to pad a space before a token.\n * @property {boolean} [padRight=false]\n * Whether to pad a space after a token.\n */\n\n/**\n * @typedef {Options} StringifyOptions\n * Please use `StringifyOptions` instead.\n */\n\n/**\n * Parse comma-separated tokens to an array.\n *\n * @param {string} value\n * Comma-separated tokens.\n * @returns {Array}\n * List of tokens.\n */\nexport function parse(value) {\n /** @type {Array} */\n const tokens = []\n const input = String(value || '')\n let index = input.indexOf(',')\n let start = 0\n /** @type {boolean} */\n let end = false\n\n while (!end) {\n if (index === -1) {\n index = input.length\n end = true\n }\n\n const token = input.slice(start, index).trim()\n\n if (token || !end) {\n tokens.push(token)\n }\n\n start = index + 1\n index = input.indexOf(',', start)\n }\n\n return tokens\n}\n\n/**\n * Serialize an array of strings or numbers to comma-separated tokens.\n *\n * @param {Array} values\n * List of tokens.\n * @param {Options} [options]\n * Configuration for `stringify` (optional).\n * @returns {string}\n * Comma-separated tokens.\n */\nexport function stringify(values, options) {\n const settings = options || {}\n\n // Ensure the last empty entry is seen.\n const input = values[values.length - 1] === '' ? [...values, ''] : values\n\n return input\n .join(\n (settings.padRight ? ' ' : '') +\n ',' +\n (settings.padLeft === false ? '' : ' ')\n )\n .trim()\n}\n","/**\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [jsx=false]\n * Support JSX identifiers (default: `false`).\n */\n\nconst startRe = /[$_\\p{ID_Start}]/u\nconst contRe = /[$_\\u{200C}\\u{200D}\\p{ID_Continue}]/u\nconst contReJsx = /[-$_\\u{200C}\\u{200D}\\p{ID_Continue}]/u\nconst nameRe = /^[$_\\p{ID_Start}][$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u\nconst nameReJsx = /^[$_\\p{ID_Start}][-$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Checks if the given code point can start an identifier.\n *\n * @param {number | undefined} code\n * Code point to check.\n * @returns {boolean}\n * Whether `code` can start an identifier.\n */\n// Note: `undefined` is supported so you can pass the result from `''.codePointAt`.\nexport function start(code) {\n return code ? startRe.test(String.fromCodePoint(code)) : false\n}\n\n/**\n * Checks if the given code point can continue an identifier.\n *\n * @param {number | undefined} code\n * Code point to check.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {boolean}\n * Whether `code` can continue an identifier.\n */\n// Note: `undefined` is supported so you can pass the result from `''.codePointAt`.\nexport function cont(code, options) {\n const settings = options || emptyOptions\n const re = settings.jsx ? contReJsx : contRe\n return code ? re.test(String.fromCodePoint(code)) : false\n}\n\n/**\n * Checks if the given value is a valid identifier name.\n *\n * @param {string} name\n * Identifier to check.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {boolean}\n * Whether `name` can be an identifier.\n */\nexport function name(name, options) {\n const settings = options || emptyOptions\n const re = settings.jsx ? nameReJsx : nameRe\n return re.test(name)\n}\n","/**\n * @typedef {import('hast').Nodes} Nodes\n */\n\n// HTML whitespace expression.\n// See .\nconst re = /[ \\t\\n\\f\\r]/g\n\n/**\n * Check if the given value is *inter-element whitespace*.\n *\n * @param {Nodes | string} thing\n * Thing to check (`Node` or `string`).\n * @returns {boolean}\n * Whether the `value` is inter-element whitespace (`boolean`): consisting of\n * zero or more of space, tab (`\\t`), line feed (`\\n`), carriage return\n * (`\\r`), or form feed (`\\f`); if a node is passed it must be a `Text` node,\n * whose `value` field is checked.\n */\nexport function whitespace(thing) {\n return typeof thing === 'object'\n ? thing.type === 'text'\n ? empty(thing.value)\n : false\n : empty(thing)\n}\n\n/**\n * @param {string} value\n * @returns {boolean}\n */\nfunction empty(value) {\n return value.replace(re, '') === ''\n}\n","/**\n * @import {Schema as SchemaType, Space} from 'property-information'\n */\n\n/** @type {SchemaType} */\nexport class Schema {\n /**\n * @param {SchemaType['property']} property\n * Property.\n * @param {SchemaType['normal']} normal\n * Normal.\n * @param {Space | undefined} [space]\n * Space.\n * @returns\n * Schema.\n */\n constructor(property, normal, space) {\n this.normal = normal\n this.property = property\n\n if (space) {\n this.space = space\n }\n }\n}\n\nSchema.prototype.normal = {}\nSchema.prototype.property = {}\nSchema.prototype.space = undefined\n","/**\n * @import {Info, Space} from 'property-information'\n */\n\nimport {Schema} from './schema.js'\n\n/**\n * @param {ReadonlyArray} definitions\n * Definitions.\n * @param {Space | undefined} [space]\n * Space.\n * @returns {Schema}\n * Schema.\n */\nexport function merge(definitions, space) {\n /** @type {Record} */\n const property = {}\n /** @type {Record} */\n const normal = {}\n\n for (const definition of definitions) {\n Object.assign(property, definition.property)\n Object.assign(normal, definition.normal)\n }\n\n return new Schema(property, normal, space)\n}\n","/**\n * Get the cleaned case insensitive form of an attribute or property.\n *\n * @param {string} value\n * An attribute-like or property-like name.\n * @returns {string}\n * Value that can be used to look up the properly cased property on a\n * `Schema`.\n */\nexport function normalize(value) {\n return value.toLowerCase()\n}\n","/**\n * @import {Info as InfoType} from 'property-information'\n */\n\n/** @type {InfoType} */\nexport class Info {\n /**\n * @param {string} property\n * Property.\n * @param {string} attribute\n * Attribute.\n * @returns\n * Info.\n */\n constructor(property, attribute) {\n this.attribute = attribute\n this.property = property\n }\n}\n\nInfo.prototype.attribute = ''\nInfo.prototype.booleanish = false\nInfo.prototype.boolean = false\nInfo.prototype.commaOrSpaceSeparated = false\nInfo.prototype.commaSeparated = false\nInfo.prototype.defined = false\nInfo.prototype.mustUseProperty = false\nInfo.prototype.number = false\nInfo.prototype.overloadedBoolean = false\nInfo.prototype.property = ''\nInfo.prototype.spaceSeparated = false\nInfo.prototype.space = undefined\n","let powers = 0\n\nexport const boolean = increment()\nexport const booleanish = increment()\nexport const overloadedBoolean = increment()\nexport const number = increment()\nexport const spaceSeparated = increment()\nexport const commaSeparated = increment()\nexport const commaOrSpaceSeparated = increment()\n\nfunction increment() {\n return 2 ** ++powers\n}\n","/**\n * @import {Space} from 'property-information'\n */\n\nimport {Info} from './info.js'\nimport * as types from './types.js'\n\nconst checks = /** @type {ReadonlyArray} */ (\n Object.keys(types)\n)\n\nexport class DefinedInfo extends Info {\n /**\n * @constructor\n * @param {string} property\n * Property.\n * @param {string} attribute\n * Attribute.\n * @param {number | null | undefined} [mask]\n * Mask.\n * @param {Space | undefined} [space]\n * Space.\n * @returns\n * Info.\n */\n constructor(property, attribute, mask, space) {\n let index = -1\n\n super(property, attribute)\n\n mark(this, 'space', space)\n\n if (typeof mask === 'number') {\n while (++index < checks.length) {\n const check = checks[index]\n mark(this, checks[index], (mask & types[check]) === types[check])\n }\n }\n }\n}\n\nDefinedInfo.prototype.defined = true\n\n/**\n * @template {keyof DefinedInfo} Key\n * Key type.\n * @param {DefinedInfo} values\n * Info.\n * @param {Key} key\n * Key.\n * @param {DefinedInfo[Key]} value\n * Value.\n * @returns {undefined}\n * Nothing.\n */\nfunction mark(values, key, value) {\n if (value) {\n values[key] = value\n }\n}\n","/**\n * @import {Info, Space} from 'property-information'\n */\n\n/**\n * @typedef Definition\n * Definition of a schema.\n * @property {Record | undefined} [attributes]\n * Normalzed names to special attribute case.\n * @property {ReadonlyArray | undefined} [mustUseProperty]\n * Normalized names that must be set as properties.\n * @property {Record} properties\n * Property names to their types.\n * @property {Space | undefined} [space]\n * Space.\n * @property {Transform} transform\n * Transform a property name.\n */\n\n/**\n * @callback Transform\n * Transform.\n * @param {Record} attributes\n * Attributes.\n * @param {string} property\n * Property.\n * @returns {string}\n * Attribute.\n */\n\nimport {normalize} from '../normalize.js'\nimport {DefinedInfo} from './defined-info.js'\nimport {Schema} from './schema.js'\n\n/**\n * @param {Definition} definition\n * Definition.\n * @returns {Schema}\n * Schema.\n */\nexport function create(definition) {\n /** @type {Record} */\n const properties = {}\n /** @type {Record} */\n const normals = {}\n\n for (const [property, value] of Object.entries(definition.properties)) {\n const info = new DefinedInfo(\n property,\n definition.transform(definition.attributes || {}, property),\n value,\n definition.space\n )\n\n if (\n definition.mustUseProperty &&\n definition.mustUseProperty.includes(property)\n ) {\n info.mustUseProperty = true\n }\n\n properties[property] = info\n\n normals[normalize(property)] = property\n normals[normalize(info.attribute)] = property\n }\n\n return new Schema(properties, normals, definition.space)\n}\n","import {create} from './util/create.js'\nimport {booleanish, number, spaceSeparated} from './util/types.js'\n\nexport const aria = create({\n properties: {\n ariaActiveDescendant: null,\n ariaAtomic: booleanish,\n ariaAutoComplete: null,\n ariaBusy: booleanish,\n ariaChecked: booleanish,\n ariaColCount: number,\n ariaColIndex: number,\n ariaColSpan: number,\n ariaControls: spaceSeparated,\n ariaCurrent: null,\n ariaDescribedBy: spaceSeparated,\n ariaDetails: null,\n ariaDisabled: booleanish,\n ariaDropEffect: spaceSeparated,\n ariaErrorMessage: null,\n ariaExpanded: booleanish,\n ariaFlowTo: spaceSeparated,\n ariaGrabbed: booleanish,\n ariaHasPopup: null,\n ariaHidden: booleanish,\n ariaInvalid: null,\n ariaKeyShortcuts: null,\n ariaLabel: null,\n ariaLabelledBy: spaceSeparated,\n ariaLevel: number,\n ariaLive: null,\n ariaModal: booleanish,\n ariaMultiLine: booleanish,\n ariaMultiSelectable: booleanish,\n ariaOrientation: null,\n ariaOwns: spaceSeparated,\n ariaPlaceholder: null,\n ariaPosInSet: number,\n ariaPressed: booleanish,\n ariaReadOnly: booleanish,\n ariaRelevant: null,\n ariaRequired: booleanish,\n ariaRoleDescription: spaceSeparated,\n ariaRowCount: number,\n ariaRowIndex: number,\n ariaRowSpan: number,\n ariaSelected: booleanish,\n ariaSetSize: number,\n ariaSort: null,\n ariaValueMax: number,\n ariaValueMin: number,\n ariaValueNow: number,\n ariaValueText: null,\n role: null\n },\n transform(_, property) {\n return property === 'role'\n ? property\n : 'aria-' + property.slice(4).toLowerCase()\n }\n})\n","/**\n * @param {Record} attributes\n * Attributes.\n * @param {string} attribute\n * Attribute.\n * @returns {string}\n * Transformed attribute.\n */\nexport function caseSensitiveTransform(attributes, attribute) {\n return attribute in attributes ? attributes[attribute] : attribute\n}\n","import {caseSensitiveTransform} from './case-sensitive-transform.js'\n\n/**\n * @param {Record} attributes\n * Attributes.\n * @param {string} property\n * Property.\n * @returns {string}\n * Transformed property.\n */\nexport function caseInsensitiveTransform(attributes, property) {\n return caseSensitiveTransform(attributes, property.toLowerCase())\n}\n","import {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\nimport {create} from './util/create.js'\nimport {\n booleanish,\n boolean,\n commaSeparated,\n number,\n overloadedBoolean,\n spaceSeparated\n} from './util/types.js'\n\nexport const html = create({\n attributes: {\n acceptcharset: 'accept-charset',\n classname: 'class',\n htmlfor: 'for',\n httpequiv: 'http-equiv'\n },\n mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],\n properties: {\n // Standard Properties.\n abbr: null,\n accept: commaSeparated,\n acceptCharset: spaceSeparated,\n accessKey: spaceSeparated,\n action: null,\n allow: null,\n allowFullScreen: boolean,\n allowPaymentRequest: boolean,\n allowUserMedia: boolean,\n alt: null,\n as: null,\n async: boolean,\n autoCapitalize: null,\n autoComplete: spaceSeparated,\n autoFocus: boolean,\n autoPlay: boolean,\n blocking: spaceSeparated,\n capture: null,\n charSet: null,\n checked: boolean,\n cite: null,\n className: spaceSeparated,\n cols: number,\n colSpan: null,\n content: null,\n contentEditable: booleanish,\n controls: boolean,\n controlsList: spaceSeparated,\n coords: number | commaSeparated,\n crossOrigin: null,\n data: null,\n dateTime: null,\n decoding: null,\n default: boolean,\n defer: boolean,\n dir: null,\n dirName: null,\n disabled: boolean,\n download: overloadedBoolean,\n draggable: booleanish,\n encType: null,\n enterKeyHint: null,\n fetchPriority: null,\n form: null,\n formAction: null,\n formEncType: null,\n formMethod: null,\n formNoValidate: boolean,\n formTarget: null,\n headers: spaceSeparated,\n height: number,\n hidden: overloadedBoolean,\n high: number,\n href: null,\n hrefLang: null,\n htmlFor: spaceSeparated,\n httpEquiv: spaceSeparated,\n id: null,\n imageSizes: null,\n imageSrcSet: null,\n inert: boolean,\n inputMode: null,\n integrity: null,\n is: null,\n isMap: boolean,\n itemId: null,\n itemProp: spaceSeparated,\n itemRef: spaceSeparated,\n itemScope: boolean,\n itemType: spaceSeparated,\n kind: null,\n label: null,\n lang: null,\n language: null,\n list: null,\n loading: null,\n loop: boolean,\n low: number,\n manifest: null,\n max: null,\n maxLength: number,\n media: null,\n method: null,\n min: null,\n minLength: number,\n multiple: boolean,\n muted: boolean,\n name: null,\n nonce: null,\n noModule: boolean,\n noValidate: boolean,\n onAbort: null,\n onAfterPrint: null,\n onAuxClick: null,\n onBeforeMatch: null,\n onBeforePrint: null,\n onBeforeToggle: null,\n onBeforeUnload: null,\n onBlur: null,\n onCancel: null,\n onCanPlay: null,\n onCanPlayThrough: null,\n onChange: null,\n onClick: null,\n onClose: null,\n onContextLost: null,\n onContextMenu: null,\n onContextRestored: null,\n onCopy: null,\n onCueChange: null,\n onCut: null,\n onDblClick: null,\n onDrag: null,\n onDragEnd: null,\n onDragEnter: null,\n onDragExit: null,\n onDragLeave: null,\n onDragOver: null,\n onDragStart: null,\n onDrop: null,\n onDurationChange: null,\n onEmptied: null,\n onEnded: null,\n onError: null,\n onFocus: null,\n onFormData: null,\n onHashChange: null,\n onInput: null,\n onInvalid: null,\n onKeyDown: null,\n onKeyPress: null,\n onKeyUp: null,\n onLanguageChange: null,\n onLoad: null,\n onLoadedData: null,\n onLoadedMetadata: null,\n onLoadEnd: null,\n onLoadStart: null,\n onMessage: null,\n onMessageError: null,\n onMouseDown: null,\n onMouseEnter: null,\n onMouseLeave: null,\n onMouseMove: null,\n onMouseOut: null,\n onMouseOver: null,\n onMouseUp: null,\n onOffline: null,\n onOnline: null,\n onPageHide: null,\n onPageShow: null,\n onPaste: null,\n onPause: null,\n onPlay: null,\n onPlaying: null,\n onPopState: null,\n onProgress: null,\n onRateChange: null,\n onRejectionHandled: null,\n onReset: null,\n onResize: null,\n onScroll: null,\n onScrollEnd: null,\n onSecurityPolicyViolation: null,\n onSeeked: null,\n onSeeking: null,\n onSelect: null,\n onSlotChange: null,\n onStalled: null,\n onStorage: null,\n onSubmit: null,\n onSuspend: null,\n onTimeUpdate: null,\n onToggle: null,\n onUnhandledRejection: null,\n onUnload: null,\n onVolumeChange: null,\n onWaiting: null,\n onWheel: null,\n open: boolean,\n optimum: number,\n pattern: null,\n ping: spaceSeparated,\n placeholder: null,\n playsInline: boolean,\n popover: null,\n popoverTarget: null,\n popoverTargetAction: null,\n poster: null,\n preload: null,\n readOnly: boolean,\n referrerPolicy: null,\n rel: spaceSeparated,\n required: boolean,\n reversed: boolean,\n rows: number,\n rowSpan: number,\n sandbox: spaceSeparated,\n scope: null,\n scoped: boolean,\n seamless: boolean,\n selected: boolean,\n shadowRootClonable: boolean,\n shadowRootDelegatesFocus: boolean,\n shadowRootMode: null,\n shape: null,\n size: number,\n sizes: null,\n slot: null,\n span: number,\n spellCheck: booleanish,\n src: null,\n srcDoc: null,\n srcLang: null,\n srcSet: null,\n start: number,\n step: null,\n style: null,\n tabIndex: number,\n target: null,\n title: null,\n translate: null,\n type: null,\n typeMustMatch: boolean,\n useMap: null,\n value: booleanish,\n width: number,\n wrap: null,\n writingSuggestions: null,\n\n // Legacy.\n // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis\n align: null, // Several. Use CSS `text-align` instead,\n aLink: null, // ``. Use CSS `a:active {color}` instead\n archive: spaceSeparated, // ``. List of URIs to archives\n axis: null, // `` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: boolean, // Lists. Use CSS to reduce space between items instead\n declare: boolean, // ``\n event: null, // `\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationRawTagOpen(code) {\n if (code === 47) {\n effects.consume(code);\n buffer = '';\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In raw continuation, after ` | \n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function continuationRawEndTag(code) {\n if (code === 62) {\n const name = buffer.toLowerCase();\n if (htmlRawNames.includes(name)) {\n effects.consume(code);\n return continuationClose;\n }\n return continuation(code);\n }\n if (asciiAlpha(code) && buffer.length < 8) {\n // Always the case.\n effects.consume(code);\n buffer += String.fromCharCode(code);\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In cdata continuation, after `]`, expecting `]>`.\n *\n * ```markdown\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationCdataInside(code) {\n if (code === 93) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In declaration or instruction continuation, at `>`.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationDeclarationInside(code) {\n if (code === 62) {\n effects.consume(code);\n return continuationClose;\n }\n\n // More dashes.\n if (code === 45 && marker === 2) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In closed continuation: everything we get until the eol/eof is part of it.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationClose(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"htmlFlowData\");\n return continuationAfter(code);\n }\n effects.consume(code);\n return continuationClose;\n }\n\n /**\n * Done.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationAfter(code) {\n effects.exit(\"htmlFlow\");\n // // Feel free to interrupt.\n // tokenizer.interrupt = false\n // // No longer concrete.\n // tokenizer.concrete = false\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuationStart(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * At eol, before continuation.\n *\n * ```markdown\n * > | * ```js\n * ^\n * | b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (markdownLineEnding(code)) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * A continuation.\n *\n * ```markdown\n * | * ```js\n * > | b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLineBefore(effects, ok, nok) {\n return start;\n\n /**\n * Before eol, expecting blank line.\n *\n * ```markdown\n * > |
\n * ^\n * |\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return effects.attempt(blankLine, ok, nok);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlText(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable | undefined} */\n let marker;\n /** @type {number} */\n let index;\n /** @type {State} */\n let returnState;\n return start;\n\n /**\n * Start of HTML (text).\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"htmlText\");\n effects.enter(\"htmlTextData\");\n effects.consume(code);\n return open;\n }\n\n /**\n * After `<`, at tag name or other stuff.\n *\n * ```markdown\n * > | a c\n * ^\n * > | a c\n * ^\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 33) {\n effects.consume(code);\n return declarationOpen;\n }\n if (code === 47) {\n effects.consume(code);\n return tagCloseStart;\n }\n if (code === 63) {\n effects.consume(code);\n return instruction;\n }\n\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagOpen;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * > | a c\n * ^\n * > | a &<]]> c\n * ^\n * ```\n *\n * @type {State}\n */\n function declarationOpen(code) {\n if (code === 45) {\n effects.consume(code);\n return commentOpenInside;\n }\n if (code === 91) {\n effects.consume(code);\n index = 0;\n return cdataOpenInside;\n }\n if (asciiAlpha(code)) {\n effects.consume(code);\n return declaration;\n }\n return nok(code);\n }\n\n /**\n * In a comment, after ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentOpenInside(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return nok(code);\n }\n\n /**\n * In comment.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function comment(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 45) {\n effects.consume(code);\n return commentClose;\n }\n if (markdownLineEnding(code)) {\n returnState = comment;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return comment;\n }\n\n /**\n * In comment, after `-`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentClose(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return comment(code);\n }\n\n /**\n * In comment, after `--`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentEnd(code) {\n return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code);\n }\n\n /**\n * After ` | a &<]]> b\n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function cdataOpenInside(code) {\n const value = \"CDATA[\";\n if (code === value.charCodeAt(index++)) {\n effects.consume(code);\n return index === value.length ? cdata : cdataOpenInside;\n }\n return nok(code);\n }\n\n /**\n * In CDATA.\n *\n * ```markdown\n * > | a &<]]> b\n * ^^^\n * ```\n *\n * @type {State}\n */\n function cdata(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataClose;\n }\n if (markdownLineEnding(code)) {\n returnState = cdata;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return cdata;\n }\n\n /**\n * In CDATA, after `]`, at another `]`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataClose(code) {\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In CDATA, after `]]`, at `>`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataEnd(code) {\n if (code === 62) {\n return end(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In declaration.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function declaration(code) {\n if (code === null || code === 62) {\n return end(code);\n }\n if (markdownLineEnding(code)) {\n returnState = declaration;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return declaration;\n }\n\n /**\n * In instruction.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instruction(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 63) {\n effects.consume(code);\n return instructionClose;\n }\n if (markdownLineEnding(code)) {\n returnState = instruction;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return instruction;\n }\n\n /**\n * In instruction, after `?`, at `>`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instructionClose(code) {\n return code === 62 ? end(code) : instruction(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseStart(code) {\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagClose;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagClose(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagClose;\n }\n return tagCloseBetween(code);\n }\n\n /**\n * In closing tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseBetween(code) {\n if (markdownLineEnding(code)) {\n returnState = tagCloseBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagCloseBetween;\n }\n return end(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpen(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpen;\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In opening tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenBetween(code) {\n if (code === 47) {\n effects.consume(code);\n return end;\n }\n\n // ASCII alphabetical and `:` and `_`.\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenBetween;\n }\n return end(code);\n }\n\n /**\n * In attribute name.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeName(code) {\n // ASCII alphabetical and `-`, `.`, `:`, and `_`.\n if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n return tagOpenAttributeNameAfter(code);\n }\n\n /**\n * After attribute name, before initializer, the end of the tag, or\n * whitespace.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeNameAfter;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeNameAfter;\n }\n return tagOpenBetween(code);\n }\n\n /**\n * Before unquoted, double quoted, or single quoted attribute value, allowing\n * whitespace.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueBefore(code) {\n if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n return nok(code);\n }\n if (code === 34 || code === 39) {\n effects.consume(code);\n marker = code;\n return tagOpenAttributeValueQuoted;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueBefore;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * In double or single quoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuoted(code) {\n if (code === marker) {\n effects.consume(code);\n marker = undefined;\n return tagOpenAttributeValueQuotedAfter;\n }\n if (code === null) {\n return nok(code);\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueQuoted;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueQuoted;\n }\n\n /**\n * In unquoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueUnquoted(code) {\n if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) {\n return nok(code);\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * After double or single quoted attribute value, before whitespace or the end\n * of the tag.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuotedAfter(code) {\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In certain circumstances of a tag where only an `>` is allowed.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function end(code) {\n if (code === 62) {\n effects.consume(code);\n effects.exit(\"htmlTextData\");\n effects.exit(\"htmlText\");\n return ok;\n }\n return nok(code);\n }\n\n /**\n * At eol.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * > | a \n * ```\n *\n * @type {State}\n */\n function lineEndingBefore(code) {\n effects.exit(\"htmlTextData\");\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return lineEndingAfter;\n }\n\n /**\n * After eol, at optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfter(code) {\n // Always populated by defaults.\n\n return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code);\n }\n\n /**\n * After eol, after optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfterPrefix(code) {\n effects.enter(\"htmlTextData\");\n return returnState(code);\n }\n}","/**\n * @import {\n * Construct,\n * Event,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer,\n * Token\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const labelEnd = {\n name: 'labelEnd',\n resolveAll: resolveAllLabelEnd,\n resolveTo: resolveToLabelEnd,\n tokenize: tokenizeLabelEnd\n};\n\n/** @type {Construct} */\nconst resourceConstruct = {\n tokenize: tokenizeResource\n};\n/** @type {Construct} */\nconst referenceFullConstruct = {\n tokenize: tokenizeReferenceFull\n};\n/** @type {Construct} */\nconst referenceCollapsedConstruct = {\n tokenize: tokenizeReferenceCollapsed\n};\n\n/** @type {Resolver} */\nfunction resolveAllLabelEnd(events) {\n let index = -1;\n /** @type {Array} */\n const newEvents = [];\n while (++index < events.length) {\n const token = events[index][1];\n newEvents.push(events[index]);\n if (token.type === \"labelImage\" || token.type === \"labelLink\" || token.type === \"labelEnd\") {\n // Remove the marker.\n const offset = token.type === \"labelImage\" ? 4 : 2;\n token.type = \"data\";\n index += offset;\n }\n }\n\n // If the events are equal, we don't have to copy newEvents to events\n if (events.length !== newEvents.length) {\n splice(events, 0, events.length, newEvents);\n }\n return events;\n}\n\n/** @type {Resolver} */\nfunction resolveToLabelEnd(events, context) {\n let index = events.length;\n let offset = 0;\n /** @type {Token} */\n let token;\n /** @type {number | undefined} */\n let open;\n /** @type {number | undefined} */\n let close;\n /** @type {Array} */\n let media;\n\n // Find an opening.\n while (index--) {\n token = events[index][1];\n if (open) {\n // If we see another link, or inactive link label, we’ve been here before.\n if (token.type === \"link\" || token.type === \"labelLink\" && token._inactive) {\n break;\n }\n\n // Mark other link openings as inactive, as we can’t have links in\n // links.\n if (events[index][0] === 'enter' && token.type === \"labelLink\") {\n token._inactive = true;\n }\n } else if (close) {\n if (events[index][0] === 'enter' && (token.type === \"labelImage\" || token.type === \"labelLink\") && !token._balanced) {\n open = index;\n if (token.type !== \"labelLink\") {\n offset = 2;\n break;\n }\n }\n } else if (token.type === \"labelEnd\") {\n close = index;\n }\n }\n const group = {\n type: events[open][1].type === \"labelLink\" ? \"link\" : \"image\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n const label = {\n type: \"label\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[close][1].end\n }\n };\n const text = {\n type: \"labelText\",\n start: {\n ...events[open + offset + 2][1].end\n },\n end: {\n ...events[close - 2][1].start\n }\n };\n media = [['enter', group, context], ['enter', label, context]];\n\n // Opening marker.\n media = push(media, events.slice(open + 1, open + offset + 3));\n\n // Text open.\n media = push(media, [['enter', text, context]]);\n\n // Always populated by defaults.\n\n // Between.\n media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));\n\n // Text close, marker close, label close.\n media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]);\n\n // Reference, resource, or so.\n media = push(media, events.slice(close + 1));\n\n // Media close.\n media = push(media, [['exit', group, context]]);\n splice(events, open, events.length, media);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelEnd(effects, ok, nok) {\n const self = this;\n let index = self.events.length;\n /** @type {Token} */\n let labelStart;\n /** @type {boolean} */\n let defined;\n\n // Find an opening.\n while (index--) {\n if ((self.events[index][1].type === \"labelImage\" || self.events[index][1].type === \"labelLink\") && !self.events[index][1]._balanced) {\n labelStart = self.events[index][1];\n break;\n }\n }\n return start;\n\n /**\n * Start of label end.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // If there is not an okay opening.\n if (!labelStart) {\n return nok(code);\n }\n\n // If the corresponding label (link) start is marked as inactive,\n // it means we’d be wrapping a link, like this:\n //\n // ```markdown\n // > | a [b [c](d) e](f) g.\n // ^\n // ```\n //\n // We can’t have that, so it’s just balanced brackets.\n if (labelStart._inactive) {\n return labelEndNok(code);\n }\n defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })));\n effects.enter(\"labelEnd\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelEnd\");\n return after;\n }\n\n /**\n * After `]`.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // Note: `markdown-rs` also parses GFM footnotes here, which for us is in\n // an extension.\n\n // Resource (`[asd](fgh)`)?\n if (code === 40) {\n return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code);\n }\n\n // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n if (code === 91) {\n return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code);\n }\n\n // Shortcut (`[asd]`) reference?\n return defined ? labelEndOk(code) : labelEndNok(code);\n }\n\n /**\n * After `]`, at `[`, but not at a full reference.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceNotFull(code) {\n return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);\n }\n\n /**\n * Done, we found something.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndOk(code) {\n // Note: `markdown-rs` does a bunch of stuff here.\n return ok(code);\n }\n\n /**\n * Done, it’s nothing.\n *\n * There was an okay opening, but we didn’t match anything.\n *\n * ```markdown\n * > | [a](b c\n * ^\n * > | [a][b c\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndNok(code) {\n labelStart._balanced = true;\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeResource(effects, ok, nok) {\n return resourceStart;\n\n /**\n * At a resource.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceStart(code) {\n effects.enter(\"resource\");\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n return resourceBefore;\n }\n\n /**\n * In resource, after `(`, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBefore(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code);\n }\n\n /**\n * In resource, after optional whitespace, at `)` or a destination.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceOpen(code) {\n if (code === 41) {\n return resourceEnd(code);\n }\n return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, \"resourceDestination\", \"resourceDestinationLiteral\", \"resourceDestinationLiteralMarker\", \"resourceDestinationRaw\", \"resourceDestinationString\", 32)(code);\n }\n\n /**\n * In resource, after destination, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code);\n }\n\n /**\n * At invalid destination.\n *\n * ```markdown\n * > | [a](<<) b\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationMissing(code) {\n return nok(code);\n }\n\n /**\n * In resource, after destination and whitespace, at `(` or title.\n *\n * ```markdown\n * > | [a](b ) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBetween(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(effects, resourceTitleAfter, nok, \"resourceTitle\", \"resourceTitleMarker\", \"resourceTitleString\")(code);\n }\n return resourceEnd(code);\n }\n\n /**\n * In resource, after title, at optional whitespace.\n *\n * ```markdown\n * > | [a](b \"c\") d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceTitleAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code);\n }\n\n /**\n * In resource, at `)`.\n *\n * ```markdown\n * > | [a](b) d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceEnd(code) {\n if (code === 41) {\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n effects.exit(\"resource\");\n return ok;\n }\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceFull(effects, ok, nok) {\n const self = this;\n return referenceFull;\n\n /**\n * In a reference (full), at the `[`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFull(code) {\n return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, \"reference\", \"referenceMarker\", \"referenceString\")(code);\n }\n\n /**\n * In a reference (full), after `]`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullAfter(code) {\n return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code);\n }\n\n /**\n * In reference (full) that was missing.\n *\n * ```markdown\n * > | [a][b d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullMissing(code) {\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceCollapsed(effects, ok, nok) {\n return referenceCollapsedStart;\n\n /**\n * In reference (collapsed), at `[`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedStart(code) {\n // We only attempt a collapsed label if there’s a `[`.\n\n effects.enter(\"reference\");\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n return referenceCollapsedOpen;\n }\n\n /**\n * In reference (collapsed), at `]`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedOpen(code) {\n if (code === 93) {\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n effects.exit(\"reference\");\n return ok;\n }\n return nok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartImage = {\n name: 'labelStartImage',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartImage\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (image) start.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelImage\");\n effects.enter(\"labelImageMarker\");\n effects.consume(code);\n effects.exit(\"labelImageMarker\");\n return open;\n }\n\n /**\n * After `!`, at `[`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 91) {\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelImage\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * After `![`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * This is needed in because, when GFM footnotes are enabled, images never\n * form when started with a `^`.\n * Instead, links form:\n *\n * ```markdown\n * ![^a](b)\n *\n * ![^a][b]\n *\n * [b]: c\n * ```\n *\n * ```html\n *

!^a

\n *

!^a

\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // To do: use a new field to do this, this is still needed for\n // `micromark-extension-gfm-footnote`, but the `label-start-link`\n // behavior isn’t.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartLink = {\n name: 'labelStartLink',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartLink\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (link) start.\n *\n * ```markdown\n * > | a [b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelLink\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelLink\");\n return after;\n }\n\n /** @type {State} */\n function after(code) {\n // To do: this isn’t needed in `micromark-extension-gfm-footnote`,\n // remove.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const lineEnding = {\n name: 'lineEnding',\n tokenize: tokenizeLineEnding\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLineEnding(effects, ok) {\n return start;\n\n /** @type {State} */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return factorySpace(effects, ok, \"linePrefix\");\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const thematicBreak = {\n name: 'thematicBreak',\n tokenize: tokenizeThematicBreak\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeThematicBreak(effects, ok, nok) {\n let size = 0;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * Start of thematic break.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"thematicBreak\");\n // To do: parse indent like `markdown-rs`.\n return before(code);\n }\n\n /**\n * After optional whitespace, at marker.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n marker = code;\n return atBreak(code);\n }\n\n /**\n * After something, before something else.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === marker) {\n effects.enter(\"thematicBreakSequence\");\n return sequence(code);\n }\n if (size >= 3 && (code === null || markdownLineEnding(code))) {\n effects.exit(\"thematicBreak\");\n return ok(code);\n }\n return nok(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function sequence(code) {\n if (code === marker) {\n effects.consume(code);\n size++;\n return sequence;\n }\n effects.exit(\"thematicBreakSequence\");\n return markdownSpace(code) ? factorySpace(effects, atBreak, \"whitespace\")(code) : atBreak(code);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * Exiter,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiDigit, markdownSpace } from 'micromark-util-character';\nimport { blankLine } from './blank-line.js';\nimport { thematicBreak } from './thematic-break.js';\n\n/** @type {Construct} */\nexport const list = {\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd,\n name: 'list',\n tokenize: tokenizeListStart\n};\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n partial: true,\n tokenize: tokenizeListItemPrefixWhitespace\n};\n\n/** @type {Construct} */\nconst indentConstruct = {\n partial: true,\n tokenize: tokenizeIndent\n};\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this;\n const tail = self.events[self.events.length - 1];\n let initialSize = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n let size = 0;\n return start;\n\n /** @type {State} */\n function start(code) {\n const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? \"listUnordered\" : \"listOrdered\");\n if (kind === \"listUnordered\" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {\n if (!self.containerState.type) {\n self.containerState.type = kind;\n effects.enter(kind, {\n _container: true\n });\n }\n if (kind === \"listUnordered\") {\n effects.enter(\"listItemPrefix\");\n return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code);\n }\n if (!self.interrupt || code === 49) {\n effects.enter(\"listItemPrefix\");\n effects.enter(\"listItemValue\");\n return inside(code);\n }\n }\n return nok(code);\n }\n\n /** @type {State} */\n function inside(code) {\n if (asciiDigit(code) && ++size < 10) {\n effects.consume(code);\n return inside;\n }\n if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {\n effects.exit(\"listItemValue\");\n return atMarker(code);\n }\n return nok(code);\n }\n\n /**\n * @type {State}\n **/\n function atMarker(code) {\n effects.enter(\"listItemMarker\");\n effects.consume(code);\n effects.exit(\"listItemMarker\");\n self.containerState.marker = self.containerState.marker || code;\n return effects.check(blankLine,\n // Can’t be empty when interrupting.\n self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));\n }\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.initialBlankLine = true;\n initialSize++;\n return endOfPrefix(code);\n }\n\n /** @type {State} */\n function otherPrefix(code) {\n if (markdownSpace(code)) {\n effects.enter(\"listItemPrefixWhitespace\");\n effects.consume(code);\n effects.exit(\"listItemPrefixWhitespace\");\n return endOfPrefix;\n }\n return nok(code);\n }\n\n /** @type {State} */\n function endOfPrefix(code) {\n self.containerState.size = initialSize + self.sliceSerialize(effects.exit(\"listItemPrefix\"), true).length;\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListContinuation(effects, ok, nok) {\n const self = this;\n self.containerState._closeFlow = undefined;\n return effects.check(blankLine, onBlank, notBlank);\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;\n\n // We have a blank line.\n // Still, try to consume at most the items size.\n return factorySpace(effects, ok, \"listItemIndent\", self.containerState.size + 1)(code);\n }\n\n /** @type {State} */\n function notBlank(code) {\n if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return notInCurrentItem(code);\n }\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);\n }\n\n /** @type {State} */\n function notInCurrentItem(code) {\n // While we do continue, we signal that the flow should be closed.\n self.containerState._closeFlow = true;\n // As we’re closing flow, we’re no longer interrupting.\n self.interrupt = undefined;\n // Always populated by defaults.\n\n return factorySpace(effects, effects.attempt(list, ok, nok), \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"listItemIndent\", self.containerState.size + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"listItemIndent\" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Exiter}\n */\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type);\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this;\n\n // Always populated by defaults.\n\n return factorySpace(effects, afterPrefix, \"listItemPrefixWhitespace\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return !markdownSpace(code) && tail && tail[1].type === \"listItemPrefixWhitespace\" ? ok(code) : nok(code);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const setextUnderline = {\n name: 'setextUnderline',\n resolveTo: resolveToSetextUnderline,\n tokenize: tokenizeSetextUnderline\n};\n\n/** @type {Resolver} */\nfunction resolveToSetextUnderline(events, context) {\n // To do: resolve like `markdown-rs`.\n let index = events.length;\n /** @type {number | undefined} */\n let content;\n /** @type {number | undefined} */\n let text;\n /** @type {number | undefined} */\n let definition;\n\n // Find the opening of the content.\n // It’ll always exist: we don’t tokenize if it isn’t there.\n while (index--) {\n if (events[index][0] === 'enter') {\n if (events[index][1].type === \"content\") {\n content = index;\n break;\n }\n if (events[index][1].type === \"paragraph\") {\n text = index;\n }\n }\n // Exit\n else {\n if (events[index][1].type === \"content\") {\n // Remove the content end (if needed we’ll add it later)\n events.splice(index, 1);\n }\n if (!definition && events[index][1].type === \"definition\") {\n definition = index;\n }\n }\n }\n const heading = {\n type: \"setextHeading\",\n start: {\n ...events[content][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n\n // Change the paragraph to setext heading text.\n events[text][1].type = \"setextHeadingText\";\n\n // If we have definitions in the content, we’ll keep on having content,\n // but we need move it.\n if (definition) {\n events.splice(text, 0, ['enter', heading, context]);\n events.splice(definition + 1, 0, ['exit', events[content][1], context]);\n events[content][1].end = {\n ...events[definition][1].end\n };\n } else {\n events[content][1] = heading;\n }\n\n // Add the heading exit at the end.\n events.push(['exit', heading, context]);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * At start of heading (setext) underline.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n let index = self.events.length;\n /** @type {boolean | undefined} */\n let paragraph;\n // Find an opening.\n while (index--) {\n // Skip enter/exit of line ending, line prefix, and content.\n // We can now either have a definition or a paragraph.\n if (self.events[index][1].type !== \"lineEnding\" && self.events[index][1].type !== \"linePrefix\" && self.events[index][1].type !== \"content\") {\n paragraph = self.events[index][1].type === \"paragraph\";\n break;\n }\n }\n\n // To do: handle lazy/pierce like `markdown-rs`.\n // To do: parse indent like `markdown-rs`.\n if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n effects.enter(\"setextHeadingLine\");\n marker = code;\n return before(code);\n }\n return nok(code);\n }\n\n /**\n * After optional whitespace, at `-` or `=`.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n effects.enter(\"setextHeadingLineSequence\");\n return inside(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n if (code === marker) {\n effects.consume(code);\n return inside;\n }\n effects.exit(\"setextHeadingLineSequence\");\n return markdownSpace(code) ? factorySpace(effects, after, \"lineSuffix\")(code) : after(code);\n }\n\n /**\n * After sequence, after optional whitespace.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"setextHeadingLine\");\n return ok(code);\n }\n return nok(code);\n }\n}","/**\n * @import {\n * InitialConstruct,\n * Initializer,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nimport { blankLine, content } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const flow = {\n tokenize: initializeFlow\n};\n\n/**\n * @this {TokenizeContext}\n * Self.\n * @type {Initializer}\n * Initializer.\n */\nfunction initializeFlow(effects) {\n const self = this;\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine, atBlankEnding,\n // Try to parse initial flow (essentially, only code).\n effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), \"linePrefix\")));\n return initial;\n\n /** @type {State} */\n function atBlankEnding(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEndingBlank\");\n effects.consume(code);\n effects.exit(\"lineEndingBlank\");\n self.currentConstruct = undefined;\n return initial;\n }\n\n /** @type {State} */\n function afterConstruct(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n self.currentConstruct = undefined;\n return initial;\n }\n}","/**\n * @import {\n * Code,\n * InitialConstruct,\n * Initializer,\n * Resolver,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nexport const resolver = {\n resolveAll: createResolver()\n};\nexport const string = initializeFactory('string');\nexport const text = initializeFactory('text');\n\n/**\n * @param {'string' | 'text'} field\n * Field.\n * @returns {InitialConstruct}\n * Construct.\n */\nfunction initializeFactory(field) {\n return {\n resolveAll: createResolver(field === 'text' ? resolveAllLineSuffixes : undefined),\n tokenize: initializeText\n };\n\n /**\n * @this {TokenizeContext}\n * Context.\n * @type {Initializer}\n */\n function initializeText(effects) {\n const self = this;\n const constructs = this.parser.constructs[field];\n const text = effects.attempt(constructs, start, notText);\n return start;\n\n /** @type {State} */\n function start(code) {\n return atBreak(code) ? text(code) : notText(code);\n }\n\n /** @type {State} */\n function notText(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"data\");\n effects.consume(code);\n return data;\n }\n\n /** @type {State} */\n function data(code) {\n if (atBreak(code)) {\n effects.exit(\"data\");\n return text(code);\n }\n\n // Data.\n effects.consume(code);\n return data;\n }\n\n /**\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether the code is a break.\n */\n function atBreak(code) {\n if (code === null) {\n return true;\n }\n const list = constructs[code];\n let index = -1;\n if (list) {\n // Always populated by defaults.\n\n while (++index < list.length) {\n const item = list[index];\n if (!item.previous || item.previous.call(self, self.previous)) {\n return true;\n }\n }\n }\n return false;\n }\n }\n}\n\n/**\n * @param {Resolver | undefined} [extraResolver]\n * Resolver.\n * @returns {Resolver}\n * Resolver.\n */\nfunction createResolver(extraResolver) {\n return resolveAllText;\n\n /** @type {Resolver} */\n function resolveAllText(events, context) {\n let index = -1;\n /** @type {number | undefined} */\n let enter;\n\n // A rather boring computation (to merge adjacent `data` events) which\n // improves mm performance by 29%.\n while (++index <= events.length) {\n if (enter === undefined) {\n if (events[index] && events[index][1].type === \"data\") {\n enter = index;\n index++;\n }\n } else if (!events[index] || events[index][1].type !== \"data\") {\n // Don’t do anything if there is one data token.\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end;\n events.splice(enter + 2, index - enter - 2);\n index = enter + 2;\n }\n enter = undefined;\n }\n }\n return extraResolver ? extraResolver(events, context) : events;\n }\n}\n\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\nfunction resolveAllLineSuffixes(events, context) {\n let eventIndex = 0; // Skip first.\n\n while (++eventIndex <= events.length) {\n if ((eventIndex === events.length || events[eventIndex][1].type === \"lineEnding\") && events[eventIndex - 1][1].type === \"data\") {\n const data = events[eventIndex - 1][1];\n const chunks = context.sliceStream(data);\n let index = chunks.length;\n let bufferIndex = -1;\n let size = 0;\n /** @type {boolean | undefined} */\n let tabs;\n while (index--) {\n const chunk = chunks[index];\n if (typeof chunk === 'string') {\n bufferIndex = chunk.length;\n while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n size++;\n bufferIndex--;\n }\n if (bufferIndex) break;\n bufferIndex = -1;\n }\n // Number\n else if (chunk === -2) {\n tabs = true;\n size++;\n } else if (chunk === -1) {\n // Empty\n } else {\n // Replacement character, exit.\n index++;\n break;\n }\n }\n\n // Allow final trailing whitespace.\n if (context._contentTypeTextTrailing && eventIndex === events.length) {\n size = 0;\n }\n if (size) {\n const token = {\n type: eventIndex === events.length || tabs || size < 2 ? \"lineSuffix\" : \"hardBreakTrailing\",\n start: {\n _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex,\n _index: data.start._index + index,\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size\n },\n end: {\n ...data.end\n }\n };\n data.end = {\n ...token.start\n };\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token);\n } else {\n events.splice(eventIndex, 0, ['enter', token, context], ['exit', token, context]);\n eventIndex += 2;\n }\n }\n eventIndex++;\n }\n }\n return events;\n}","/**\n * @import {Extension} from 'micromark-util-types'\n */\n\nimport { attention, autolink, blockQuote, characterEscape, characterReference, codeFenced, codeIndented, codeText, definition, hardBreakEscape, headingAtx, htmlFlow, htmlText, labelEnd, labelStartImage, labelStartLink, lineEnding, list, setextUnderline, thematicBreak } from 'micromark-core-commonmark';\nimport { resolver as resolveText } from './initialize/text.js';\n\n/** @satisfies {Extension['document']} */\nexport const document = {\n [42]: list,\n [43]: list,\n [45]: list,\n [48]: list,\n [49]: list,\n [50]: list,\n [51]: list,\n [52]: list,\n [53]: list,\n [54]: list,\n [55]: list,\n [56]: list,\n [57]: list,\n [62]: blockQuote\n};\n\n/** @satisfies {Extension['contentInitial']} */\nexport const contentInitial = {\n [91]: definition\n};\n\n/** @satisfies {Extension['flowInitial']} */\nexport const flowInitial = {\n [-2]: codeIndented,\n [-1]: codeIndented,\n [32]: codeIndented\n};\n\n/** @satisfies {Extension['flow']} */\nexport const flow = {\n [35]: headingAtx,\n [42]: thematicBreak,\n [45]: [setextUnderline, thematicBreak],\n [60]: htmlFlow,\n [61]: setextUnderline,\n [95]: thematicBreak,\n [96]: codeFenced,\n [126]: codeFenced\n};\n\n/** @satisfies {Extension['string']} */\nexport const string = {\n [38]: characterReference,\n [92]: characterEscape\n};\n\n/** @satisfies {Extension['text']} */\nexport const text = {\n [-5]: lineEnding,\n [-4]: lineEnding,\n [-3]: lineEnding,\n [33]: labelStartImage,\n [38]: characterReference,\n [42]: attention,\n [60]: [autolink, htmlText],\n [91]: labelStartLink,\n [92]: [hardBreakEscape, characterEscape],\n [93]: labelEnd,\n [95]: attention,\n [96]: codeText\n};\n\n/** @satisfies {Extension['insideSpan']} */\nexport const insideSpan = {\n null: [attention, resolveText]\n};\n\n/** @satisfies {Extension['attentionMarkers']} */\nexport const attentionMarkers = {\n null: [42, 95]\n};\n\n/** @satisfies {Extension['disable']} */\nexport const disable = {\n null: []\n};","/**\n * @import {\n * Chunk,\n * Code,\n * ConstructRecord,\n * Construct,\n * Effects,\n * InitialConstruct,\n * ParseContext,\n * Point,\n * State,\n * TokenizeContext,\n * Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @callback Restore\n * Restore the state.\n * @returns {undefined}\n * Nothing.\n *\n * @typedef Info\n * Info.\n * @property {Restore} restore\n * Restore.\n * @property {number} from\n * From.\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * Construct.\n * @param {Info} info\n * Info.\n * @returns {undefined}\n * Nothing.\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n * Parser.\n * @param {InitialConstruct} initialize\n * Construct.\n * @param {Omit | undefined} [from]\n * Point (optional).\n * @returns {TokenizeContext}\n * Context.\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = {\n _bufferIndex: -1,\n _index: 0,\n line: from && from.line || 1,\n column: from && from.column || 1,\n offset: from && from.offset || 0\n };\n /** @type {Record} */\n const columnStart = {};\n /** @type {Array} */\n const resolveAllConstructs = [];\n /** @type {Array} */\n let chunks = [];\n /** @type {Array} */\n let stack = [];\n /** @type {boolean | undefined} */\n let consumed = true;\n\n /**\n * Tools used for tokenizing.\n *\n * @type {Effects}\n */\n const effects = {\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\n consume,\n enter,\n exit,\n interrupt: constructFactory(onsuccessfulcheck, {\n interrupt: true\n })\n };\n\n /**\n * State and tools for resolving and serializing.\n *\n * @type {TokenizeContext}\n */\n const context = {\n code: null,\n containerState: {},\n defineSkip,\n events: [],\n now,\n parser,\n previous: null,\n sliceSerialize,\n sliceStream,\n write\n };\n\n /**\n * The state function.\n *\n * @type {State | undefined}\n */\n let state = initialize.tokenize.call(context, effects);\n\n /**\n * Track which character we expect to be consumed, to catch bugs.\n *\n * @type {Code}\n */\n let expectedCode;\n if (initialize.resolveAll) {\n resolveAllConstructs.push(initialize);\n }\n return context;\n\n /** @type {TokenizeContext['write']} */\n function write(slice) {\n chunks = push(chunks, slice);\n main();\n\n // Exit if we’re not done, resolve might change stuff.\n if (chunks[chunks.length - 1] !== null) {\n return [];\n }\n addResult(initialize, 0);\n\n // Otherwise, resolve, and exit.\n context.events = resolveAll(resolveAllConstructs, context.events, context);\n return context.events;\n }\n\n //\n // Tools.\n //\n\n /** @type {TokenizeContext['sliceSerialize']} */\n function sliceSerialize(token, expandTabs) {\n return serializeChunks(sliceStream(token), expandTabs);\n }\n\n /** @type {TokenizeContext['sliceStream']} */\n function sliceStream(token) {\n return sliceChunks(chunks, token);\n }\n\n /** @type {TokenizeContext['now']} */\n function now() {\n // This is a hot path, so we clone manually instead of `Object.assign({}, point)`\n const {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n } = point;\n return {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n };\n }\n\n /** @type {TokenizeContext['defineSkip']} */\n function defineSkip(value) {\n columnStart[value.line] = value.column;\n accountForPotentialSkip();\n }\n\n //\n // State management.\n //\n\n /**\n * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n * `consume`).\n * Here is where we walk through the chunks, which either include strings of\n * several characters, or numerical character codes.\n * The reason to do this in a loop instead of a call is so the stack can\n * drain.\n *\n * @returns {undefined}\n * Nothing.\n */\n function main() {\n /** @type {number} */\n let chunkIndex;\n while (point._index < chunks.length) {\n const chunk = chunks[point._index];\n\n // If we’re in a buffer chunk, loop through it.\n if (typeof chunk === 'string') {\n chunkIndex = point._index;\n if (point._bufferIndex < 0) {\n point._bufferIndex = 0;\n }\n while (point._index === chunkIndex && point._bufferIndex < chunk.length) {\n go(chunk.charCodeAt(point._bufferIndex));\n }\n } else {\n go(chunk);\n }\n }\n }\n\n /**\n * Deal with one code.\n *\n * @param {Code} code\n * Code.\n * @returns {undefined}\n * Nothing.\n */\n function go(code) {\n consumed = undefined;\n expectedCode = code;\n state = state(code);\n }\n\n /** @type {Effects['consume']} */\n function consume(code) {\n if (markdownLineEnding(code)) {\n point.line++;\n point.column = 1;\n point.offset += code === -3 ? 2 : 1;\n accountForPotentialSkip();\n } else if (code !== -1) {\n point.column++;\n point.offset++;\n }\n\n // Not in a string chunk.\n if (point._bufferIndex < 0) {\n point._index++;\n } else {\n point._bufferIndex++;\n\n // At end of string chunk.\n if (point._bufferIndex ===\n // Points w/ non-negative `_bufferIndex` reference\n // strings.\n /** @type {string} */\n chunks[point._index].length) {\n point._bufferIndex = -1;\n point._index++;\n }\n }\n\n // Expose the previous character.\n context.previous = code;\n\n // Mark as consumed.\n consumed = true;\n }\n\n /** @type {Effects['enter']} */\n function enter(type, fields) {\n /** @type {Token} */\n // @ts-expect-error Patch instead of assign required fields to help GC.\n const token = fields || {};\n token.type = type;\n token.start = now();\n context.events.push(['enter', token, context]);\n stack.push(token);\n return token;\n }\n\n /** @type {Effects['exit']} */\n function exit(type) {\n const token = stack.pop();\n token.end = now();\n context.events.push(['exit', token, context]);\n return token;\n }\n\n /**\n * Use results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulconstruct(construct, info) {\n addResult(construct, info.from);\n }\n\n /**\n * Discard results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulcheck(_, info) {\n info.restore();\n }\n\n /**\n * Factory to attempt/check/interrupt.\n *\n * @param {ReturnHandle} onreturn\n * Callback.\n * @param {{interrupt?: boolean | undefined} | undefined} [fields]\n * Fields.\n */\n function constructFactory(onreturn, fields) {\n return hook;\n\n /**\n * Handle either an object mapping codes to constructs, a list of\n * constructs, or a single construct.\n *\n * @param {Array | ConstructRecord | Construct} constructs\n * Constructs.\n * @param {State} returnState\n * State.\n * @param {State | undefined} [bogusState]\n * State.\n * @returns {State}\n * State.\n */\n function hook(constructs, returnState, bogusState) {\n /** @type {ReadonlyArray} */\n let listOfConstructs;\n /** @type {number} */\n let constructIndex;\n /** @type {Construct} */\n let currentConstruct;\n /** @type {Info} */\n let info;\n return Array.isArray(constructs) ? /* c8 ignore next 1 */\n handleListOfConstructs(constructs) : 'tokenize' in constructs ?\n // Looks like a construct.\n handleListOfConstructs([(/** @type {Construct} */constructs)]) : handleMapOfConstructs(constructs);\n\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleMapOfConstructs(map) {\n return start;\n\n /** @type {State} */\n function start(code) {\n const left = code !== null && map[code];\n const all = code !== null && map.null;\n const list = [\n // To do: add more extension tests.\n /* c8 ignore next 2 */\n ...(Array.isArray(left) ? left : left ? [left] : []), ...(Array.isArray(all) ? all : all ? [all] : [])];\n return handleListOfConstructs(list)(code);\n }\n }\n\n /**\n * Handle a list of construct.\n *\n * @param {ReadonlyArray} list\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleListOfConstructs(list) {\n listOfConstructs = list;\n constructIndex = 0;\n if (list.length === 0) {\n return bogusState;\n }\n return handleConstruct(list[constructIndex]);\n }\n\n /**\n * Handle a single construct.\n *\n * @param {Construct} construct\n * Construct.\n * @returns {State}\n * State.\n */\n function handleConstruct(construct) {\n return start;\n\n /** @type {State} */\n function start(code) {\n // To do: not needed to store if there is no bogus state, probably?\n // Currently doesn’t work because `inspect` in document does a check\n // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n // by not storing.\n info = store();\n currentConstruct = construct;\n if (!construct.partial) {\n context.currentConstruct = construct;\n }\n\n // Always populated by defaults.\n\n if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {\n return nok(code);\n }\n return construct.tokenize.call(\n // If we do have fields, create an object w/ `context` as its\n // prototype.\n // This allows a “live binding”, which is needed for `interrupt`.\n fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code);\n }\n }\n\n /** @type {State} */\n function ok(code) {\n consumed = true;\n onreturn(currentConstruct, info);\n return returnState;\n }\n\n /** @type {State} */\n function nok(code) {\n consumed = true;\n info.restore();\n if (++constructIndex < listOfConstructs.length) {\n return handleConstruct(listOfConstructs[constructIndex]);\n }\n return bogusState;\n }\n }\n }\n\n /**\n * @param {Construct} construct\n * Construct.\n * @param {number} from\n * From.\n * @returns {undefined}\n * Nothing.\n */\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct);\n }\n if (construct.resolve) {\n splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));\n }\n if (construct.resolveTo) {\n context.events = construct.resolveTo(context.events, context);\n }\n }\n\n /**\n * Store state.\n *\n * @returns {Info}\n * Info.\n */\n function store() {\n const startPoint = now();\n const startPrevious = context.previous;\n const startCurrentConstruct = context.currentConstruct;\n const startEventsIndex = context.events.length;\n const startStack = Array.from(stack);\n return {\n from: startEventsIndex,\n restore\n };\n\n /**\n * Restore state.\n *\n * @returns {undefined}\n * Nothing.\n */\n function restore() {\n point = startPoint;\n context.previous = startPrevious;\n context.currentConstruct = startCurrentConstruct;\n context.events.length = startEventsIndex;\n stack = startStack;\n accountForPotentialSkip();\n }\n }\n\n /**\n * Move the current point a bit forward in the line when it’s on a column\n * skip.\n *\n * @returns {undefined}\n * Nothing.\n */\n function accountForPotentialSkip() {\n if (point.line in columnStart && point.column < 2) {\n point.column = columnStart[point.line];\n point.offset += columnStart[point.line] - 1;\n }\n }\n}\n\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {Pick} token\n * Token.\n * @returns {Array}\n * Chunks.\n */\nfunction sliceChunks(chunks, token) {\n const startIndex = token.start._index;\n const startBufferIndex = token.start._bufferIndex;\n const endIndex = token.end._index;\n const endBufferIndex = token.end._bufferIndex;\n /** @type {Array} */\n let view;\n if (startIndex === endIndex) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];\n } else {\n view = chunks.slice(startIndex, endIndex);\n if (startBufferIndex > -1) {\n const head = view[0];\n if (typeof head === 'string') {\n view[0] = head.slice(startBufferIndex);\n /* c8 ignore next 4 -- used to be used, no longer */\n } else {\n view.shift();\n }\n }\n if (endBufferIndex > 0) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view.push(chunks[endIndex].slice(0, endBufferIndex));\n }\n }\n return view;\n}\n\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {boolean | undefined} [expandTabs=false]\n * Whether to expand tabs (default: `false`).\n * @returns {string}\n * Result.\n */\nfunction serializeChunks(chunks, expandTabs) {\n let index = -1;\n /** @type {Array} */\n const result = [];\n /** @type {boolean | undefined} */\n let atTab;\n while (++index < chunks.length) {\n const chunk = chunks[index];\n /** @type {string} */\n let value;\n if (typeof chunk === 'string') {\n value = chunk;\n } else switch (chunk) {\n case -5:\n {\n value = \"\\r\";\n break;\n }\n case -4:\n {\n value = \"\\n\";\n break;\n }\n case -3:\n {\n value = \"\\r\" + \"\\n\";\n break;\n }\n case -2:\n {\n value = expandTabs ? \" \" : \"\\t\";\n break;\n }\n case -1:\n {\n if (!expandTabs && atTab) continue;\n value = \" \";\n break;\n }\n default:\n {\n // Currently only replacement character.\n value = String.fromCharCode(chunk);\n }\n }\n atTab = chunk === -2;\n result.push(value);\n }\n return result.join('');\n}","/**\n * @import {\n * Create,\n * FullNormalizedExtension,\n * InitialConstruct,\n * ParseContext,\n * ParseOptions\n * } from 'micromark-util-types'\n */\n\nimport { combineExtensions } from 'micromark-util-combine-extensions';\nimport { content } from './initialize/content.js';\nimport { document } from './initialize/document.js';\nimport { flow } from './initialize/flow.js';\nimport { string, text } from './initialize/text.js';\nimport * as defaultConstructs from './constructs.js';\nimport { createTokenizer } from './create-tokenizer.js';\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n * Configuration (optional).\n * @returns {ParseContext}\n * Parser.\n */\nexport function parse(options) {\n const settings = options || {};\n const constructs = /** @type {FullNormalizedExtension} */\n combineExtensions([defaultConstructs, ...(settings.extensions || [])]);\n\n /** @type {ParseContext} */\n const parser = {\n constructs,\n content: create(content),\n defined: [],\n document: create(document),\n flow: create(flow),\n lazy: {},\n string: create(string),\n text: create(text)\n };\n return parser;\n\n /**\n * @param {InitialConstruct} initial\n * Construct to start with.\n * @returns {Create}\n * Create a tokenizer.\n */\n function create(initial) {\n return creator;\n /** @type {Create} */\n function creator(from) {\n return createTokenizer(parser, initial, from);\n }\n }\n}","/**\n * @import {Event} from 'micromark-util-types'\n */\n\nimport { subtokenize } from 'micromark-util-subtokenize';\n\n/**\n * @param {Array} events\n * Events.\n * @returns {Array}\n * Events.\n */\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n return events;\n}","/**\n * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'\n */\n\n/**\n * @callback Preprocessor\n * Preprocess a value.\n * @param {Value} value\n * Value.\n * @param {Encoding | null | undefined} [encoding]\n * Encoding when `value` is a typed array (optional).\n * @param {boolean | null | undefined} [end=false]\n * Whether this is the last chunk (default: `false`).\n * @returns {Array}\n * Chunks.\n */\n\nconst search = /[\\0\\t\\n\\r]/g;\n\n/**\n * @returns {Preprocessor}\n * Preprocess a value.\n */\nexport function preprocess() {\n let column = 1;\n let buffer = '';\n /** @type {boolean | undefined} */\n let start = true;\n /** @type {boolean | undefined} */\n let atCarriageReturn;\n return preprocessor;\n\n /** @type {Preprocessor} */\n // eslint-disable-next-line complexity\n function preprocessor(value, encoding, end) {\n /** @type {Array} */\n const chunks = [];\n /** @type {RegExpMatchArray | null} */\n let match;\n /** @type {number} */\n let next;\n /** @type {number} */\n let startPosition;\n /** @type {number} */\n let endPosition;\n /** @type {Code} */\n let code;\n value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));\n startPosition = 0;\n buffer = '';\n if (start) {\n // To do: `markdown-rs` actually parses BOMs (byte order mark).\n if (value.charCodeAt(0) === 65279) {\n startPosition++;\n }\n start = undefined;\n }\n while (startPosition < value.length) {\n search.lastIndex = startPosition;\n match = search.exec(value);\n endPosition = match && match.index !== undefined ? match.index : value.length;\n code = value.charCodeAt(endPosition);\n if (!match) {\n buffer = value.slice(startPosition);\n break;\n }\n if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n chunks.push(-3);\n atCarriageReturn = undefined;\n } else {\n if (atCarriageReturn) {\n chunks.push(-5);\n atCarriageReturn = undefined;\n }\n if (startPosition < endPosition) {\n chunks.push(value.slice(startPosition, endPosition));\n column += endPosition - startPosition;\n }\n switch (code) {\n case 0:\n {\n chunks.push(65533);\n column++;\n break;\n }\n case 9:\n {\n next = Math.ceil(column / 4) * 4;\n chunks.push(-2);\n while (column++ < next) chunks.push(-1);\n break;\n }\n case 10:\n {\n chunks.push(-4);\n column = 1;\n break;\n }\n default:\n {\n atCarriageReturn = true;\n column = 1;\n }\n }\n }\n startPosition = endPosition + 1;\n }\n if (end) {\n if (atCarriageReturn) chunks.push(-5);\n if (buffer) chunks.push(buffer);\n chunks.push(null);\n }\n return chunks;\n }\n}","import { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nconst characterEscapeOrReference = /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi;\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * Value to decode.\n * @returns {string}\n * Decoded value.\n */\nexport function decodeString(value) {\n return value.replace(characterEscapeOrReference, decode);\n}\n\n/**\n * @param {string} $0\n * Match.\n * @param {string} $1\n * Character escape.\n * @param {string} $2\n * Character reference.\n * @returns {string}\n * Decoded value\n */\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1;\n }\n\n // Reference.\n const head = $2.charCodeAt(0);\n if (head === 35) {\n const head = $2.charCodeAt(1);\n const hex = head === 120 || head === 88;\n return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);\n }\n return decodeNamedCharacterReference($2) || $0;\n}","/**\n * @import {\n * Break,\n * Blockquote,\n * Code,\n * Definition,\n * Emphasis,\n * Heading,\n * Html,\n * Image,\n * InlineCode,\n * Link,\n * ListItem,\n * List,\n * Nodes,\n * Paragraph,\n * PhrasingContent,\n * ReferenceType,\n * Root,\n * Strong,\n * Text,\n * ThematicBreak\n * } from 'mdast'\n * @import {\n * Encoding,\n * Event,\n * Token,\n * Value\n * } from 'micromark-util-types'\n * @import {Point} from 'unist'\n * @import {\n * CompileContext,\n * CompileData,\n * Config,\n * Extension,\n * Handle,\n * OnEnterError,\n * Options\n * } from './types.js'\n */\n\nimport { toString } from 'mdast-util-to-string';\nimport { parse, postprocess, preprocess } from 'micromark';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nimport { decodeString } from 'micromark-util-decode-string';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { stringifyPosition } from 'unist-util-stringify-position';\nconst own = {}.hasOwnProperty;\n\n/**\n * Turn markdown into a syntax tree.\n *\n * @overload\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @overload\n * @param {Value} value\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @param {Value} value\n * Markdown to parse.\n * @param {Encoding | Options | null | undefined} [encoding]\n * Character encoding for when `value` is `Buffer`.\n * @param {Options | null | undefined} [options]\n * Configuration.\n * @returns {Root}\n * mdast tree.\n */\nexport function fromMarkdown(value, encoding, options) {\n if (typeof encoding !== 'string') {\n options = encoding;\n encoding = undefined;\n }\n return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));\n}\n\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options | null | undefined} [options]\n */\nfunction compiler(options) {\n /** @type {Config} */\n const config = {\n transforms: [],\n canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],\n enter: {\n autolink: opener(link),\n autolinkProtocol: onenterdata,\n autolinkEmail: onenterdata,\n atxHeading: opener(heading),\n blockQuote: opener(blockQuote),\n characterEscape: onenterdata,\n characterReference: onenterdata,\n codeFenced: opener(codeFlow),\n codeFencedFenceInfo: buffer,\n codeFencedFenceMeta: buffer,\n codeIndented: opener(codeFlow, buffer),\n codeText: opener(codeText, buffer),\n codeTextData: onenterdata,\n data: onenterdata,\n codeFlowValue: onenterdata,\n definition: opener(definition),\n definitionDestinationString: buffer,\n definitionLabelString: buffer,\n definitionTitleString: buffer,\n emphasis: opener(emphasis),\n hardBreakEscape: opener(hardBreak),\n hardBreakTrailing: opener(hardBreak),\n htmlFlow: opener(html, buffer),\n htmlFlowData: onenterdata,\n htmlText: opener(html, buffer),\n htmlTextData: onenterdata,\n image: opener(image),\n label: buffer,\n link: opener(link),\n listItem: opener(listItem),\n listItemValue: onenterlistitemvalue,\n listOrdered: opener(list, onenterlistordered),\n listUnordered: opener(list),\n paragraph: opener(paragraph),\n reference: onenterreference,\n referenceString: buffer,\n resourceDestinationString: buffer,\n resourceTitleString: buffer,\n setextHeading: opener(heading),\n strong: opener(strong),\n thematicBreak: opener(thematicBreak)\n },\n exit: {\n atxHeading: closer(),\n atxHeadingSequence: onexitatxheadingsequence,\n autolink: closer(),\n autolinkEmail: onexitautolinkemail,\n autolinkProtocol: onexitautolinkprotocol,\n blockQuote: closer(),\n characterEscapeValue: onexitdata,\n characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n characterReferenceValue: onexitcharacterreferencevalue,\n characterReference: onexitcharacterreference,\n codeFenced: closer(onexitcodefenced),\n codeFencedFence: onexitcodefencedfence,\n codeFencedFenceInfo: onexitcodefencedfenceinfo,\n codeFencedFenceMeta: onexitcodefencedfencemeta,\n codeFlowValue: onexitdata,\n codeIndented: closer(onexitcodeindented),\n codeText: closer(onexitcodetext),\n codeTextData: onexitdata,\n data: onexitdata,\n definition: closer(),\n definitionDestinationString: onexitdefinitiondestinationstring,\n definitionLabelString: onexitdefinitionlabelstring,\n definitionTitleString: onexitdefinitiontitlestring,\n emphasis: closer(),\n hardBreakEscape: closer(onexithardbreak),\n hardBreakTrailing: closer(onexithardbreak),\n htmlFlow: closer(onexithtmlflow),\n htmlFlowData: onexitdata,\n htmlText: closer(onexithtmltext),\n htmlTextData: onexitdata,\n image: closer(onexitimage),\n label: onexitlabel,\n labelText: onexitlabeltext,\n lineEnding: onexitlineending,\n link: closer(onexitlink),\n listItem: closer(),\n listOrdered: closer(),\n listUnordered: closer(),\n paragraph: closer(),\n referenceString: onexitreferencestring,\n resourceDestinationString: onexitresourcedestinationstring,\n resourceTitleString: onexitresourcetitlestring,\n resource: onexitresource,\n setextHeading: closer(onexitsetextheading),\n setextHeadingLineSequence: onexitsetextheadinglinesequence,\n setextHeadingText: onexitsetextheadingtext,\n strong: closer(),\n thematicBreak: closer()\n }\n };\n configure(config, (options || {}).mdastExtensions || []);\n\n /** @type {CompileData} */\n const data = {};\n return compile;\n\n /**\n * Turn micromark events into an mdast tree.\n *\n * @param {Array} events\n * Events.\n * @returns {Root}\n * mdast tree.\n */\n function compile(events) {\n /** @type {Root} */\n let tree = {\n type: 'root',\n children: []\n };\n /** @type {Omit} */\n const context = {\n stack: [tree],\n tokenStack: [],\n config,\n enter,\n exit,\n buffer,\n resume,\n data\n };\n /** @type {Array} */\n const listStack = [];\n let index = -1;\n while (++index < events.length) {\n // We preprocess lists to add `listItem` tokens, and to infer whether\n // items the list itself are spread out.\n if (events[index][1].type === \"listOrdered\" || events[index][1].type === \"listUnordered\") {\n if (events[index][0] === 'enter') {\n listStack.push(index);\n } else {\n const tail = listStack.pop();\n index = prepareList(events, tail, index);\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n const handler = config[events[index][0]];\n if (own.call(handler, events[index][1].type)) {\n handler[events[index][1].type].call(Object.assign({\n sliceSerialize: events[index][2].sliceSerialize\n }, context), events[index][1]);\n }\n }\n\n // Handle tokens still being open.\n if (context.tokenStack.length > 0) {\n const tail = context.tokenStack[context.tokenStack.length - 1];\n const handler = tail[1] || defaultOnError;\n handler.call(context, undefined, tail[0]);\n }\n\n // Figure out `root` position.\n tree.position = {\n start: point(events.length > 0 ? events[0][1].start : {\n line: 1,\n column: 1,\n offset: 0\n }),\n end: point(events.length > 0 ? events[events.length - 2][1].end : {\n line: 1,\n column: 1,\n offset: 0\n })\n };\n\n // Call transforms.\n index = -1;\n while (++index < config.transforms.length) {\n tree = config.transforms[index](tree) || tree;\n }\n return tree;\n }\n\n /**\n * @param {Array} events\n * @param {number} start\n * @param {number} length\n * @returns {number}\n */\n function prepareList(events, start, length) {\n let index = start - 1;\n let containerBalance = -1;\n let listSpread = false;\n /** @type {Token | undefined} */\n let listItem;\n /** @type {number | undefined} */\n let lineIndex;\n /** @type {number | undefined} */\n let firstBlankLineIndex;\n /** @type {boolean | undefined} */\n let atMarker;\n while (++index <= length) {\n const event = events[index];\n switch (event[1].type) {\n case \"listUnordered\":\n case \"listOrdered\":\n case \"blockQuote\":\n {\n if (event[0] === 'enter') {\n containerBalance++;\n } else {\n containerBalance--;\n }\n atMarker = undefined;\n break;\n }\n case \"lineEndingBlank\":\n {\n if (event[0] === 'enter') {\n if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) {\n firstBlankLineIndex = index;\n }\n atMarker = undefined;\n }\n break;\n }\n case \"linePrefix\":\n case \"listItemValue\":\n case \"listItemMarker\":\n case \"listItemPrefix\":\n case \"listItemPrefixWhitespace\":\n {\n // Empty.\n\n break;\n }\n default:\n {\n atMarker = undefined;\n }\n }\n if (!containerBalance && event[0] === 'enter' && event[1].type === \"listItemPrefix\" || containerBalance === -1 && event[0] === 'exit' && (event[1].type === \"listUnordered\" || event[1].type === \"listOrdered\")) {\n if (listItem) {\n let tailIndex = index;\n lineIndex = undefined;\n while (tailIndex--) {\n const tailEvent = events[tailIndex];\n if (tailEvent[1].type === \"lineEnding\" || tailEvent[1].type === \"lineEndingBlank\") {\n if (tailEvent[0] === 'exit') continue;\n if (lineIndex) {\n events[lineIndex][1].type = \"lineEndingBlank\";\n listSpread = true;\n }\n tailEvent[1].type = \"lineEnding\";\n lineIndex = tailIndex;\n } else if (tailEvent[1].type === \"linePrefix\" || tailEvent[1].type === \"blockQuotePrefix\" || tailEvent[1].type === \"blockQuotePrefixWhitespace\" || tailEvent[1].type === \"blockQuoteMarker\" || tailEvent[1].type === \"listItemIndent\") {\n // Empty\n } else {\n break;\n }\n }\n if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {\n listItem._spread = true;\n }\n\n // Fix position.\n listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);\n events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);\n index++;\n length++;\n }\n\n // Create a new list item.\n if (event[1].type === \"listItemPrefix\") {\n /** @type {Token} */\n const item = {\n type: 'listItem',\n _spread: false,\n start: Object.assign({}, event[1].start),\n // @ts-expect-error: we’ll add `end` in a second.\n end: undefined\n };\n listItem = item;\n events.splice(index, 0, ['enter', item, event[2]]);\n index++;\n length++;\n firstBlankLineIndex = undefined;\n atMarker = true;\n }\n }\n }\n events[start][1]._spread = listSpread;\n return length;\n }\n\n /**\n * Create an opener handle.\n *\n * @param {(token: Token) => Nodes} create\n * Create a node.\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function opener(create, and) {\n return open;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function open(token) {\n enter.call(this, create(token), token);\n if (and) and.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['buffer']}\n */\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n });\n }\n\n /**\n * @type {CompileContext['enter']}\n */\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = parent.children;\n siblings.push(node);\n this.stack.push(node);\n this.tokenStack.push([token, errorHandler || undefined]);\n node.position = {\n start: point(token.start),\n // @ts-expect-error: `end` will be patched later.\n end: undefined\n };\n }\n\n /**\n * Create a closer handle.\n *\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function closer(and) {\n return close;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function close(token) {\n if (and) and.call(this, token);\n exit.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['exit']}\n */\n function exit(token, onExitError) {\n const node = this.stack.pop();\n const open = this.tokenStack.pop();\n if (!open) {\n throw new Error('Cannot close `' + token.type + '` (' + stringifyPosition({\n start: token.start,\n end: token.end\n }) + '): it’s not open');\n } else if (open[0].type !== token.type) {\n if (onExitError) {\n onExitError.call(this, token, open[0]);\n } else {\n const handler = open[1] || defaultOnError;\n handler.call(this, token, open[0]);\n }\n }\n node.position.end = point(token.end);\n }\n\n /**\n * @type {CompileContext['resume']}\n */\n function resume() {\n return toString(this.stack.pop());\n }\n\n //\n // Handlers.\n //\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistordered() {\n this.data.expectingFirstListItemValue = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistitemvalue(token) {\n if (this.data.expectingFirstListItemValue) {\n const ancestor = this.stack[this.stack.length - 2];\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);\n this.data.expectingFirstListItemValue = undefined;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfenceinfo() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.lang = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfencemeta() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.meta = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfence() {\n // Exit if this is the closing fence.\n if (this.data.flowCodeInside) return;\n this.buffer();\n this.data.flowCodeInside = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefenced() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '');\n this.data.flowCodeInside = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodeindented() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/(\\r?\\n|\\r)$/g, '');\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitionlabelstring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.label = label;\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiontitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiondestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitatxheadingsequence(token) {\n const node = this.stack[this.stack.length - 1];\n if (!node.depth) {\n const depth = this.sliceSerialize(token).length;\n node.depth = depth;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadingtext() {\n this.data.setextHeadingSlurpLineEnding = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadinglinesequence(token) {\n const node = this.stack[this.stack.length - 1];\n node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheading() {\n this.data.setextHeadingSlurpLineEnding = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterdata(token) {\n const node = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = node.children;\n let tail = siblings[siblings.length - 1];\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text();\n tail.position = {\n start: point(token.start),\n // @ts-expect-error: we’ll add `end` later.\n end: undefined\n };\n siblings.push(tail);\n }\n this.stack.push(tail);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitdata(token) {\n const tail = this.stack.pop();\n tail.value += this.sliceSerialize(token);\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlineending(token) {\n const context = this.stack[this.stack.length - 1];\n // If we’re at a hard break, include the line ending in there.\n if (this.data.atHardBreak) {\n const tail = context.children[context.children.length - 1];\n tail.position.end = point(token.end);\n this.data.atHardBreak = undefined;\n return;\n }\n if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {\n onenterdata.call(this, token);\n onexitdata.call(this, token);\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithardbreak() {\n this.data.atHardBreak = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmlflow() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmltext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcodetext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlink() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitimage() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabeltext(token) {\n const string = this.sliceSerialize(token);\n const ancestor = this.stack[this.stack.length - 2];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n ancestor.label = decodeString(string);\n // @ts-expect-error: same as above.\n ancestor.identifier = normalizeIdentifier(string).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabel() {\n const fragment = this.stack[this.stack.length - 1];\n const value = this.resume();\n const node = this.stack[this.stack.length - 1];\n // Assume a reference.\n this.data.inReference = true;\n if (node.type === 'link') {\n /** @type {Array} */\n const children = fragment.children;\n node.children = children;\n } else {\n node.alt = value;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcedestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcetitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresource() {\n this.data.inReference = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterreference() {\n this.data.referenceType = 'collapsed';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitreferencestring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n node.label = label;\n // @ts-expect-error: same as above.\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n this.data.referenceType = 'full';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcharacterreferencemarker(token) {\n this.data.characterReferenceType = token.type;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreferencevalue(token) {\n const data = this.sliceSerialize(token);\n const type = this.data.characterReferenceType;\n /** @type {string} */\n let value;\n if (type) {\n value = decodeNumericCharacterReference(data, type === \"characterReferenceMarkerNumeric\" ? 10 : 16);\n this.data.characterReferenceType = undefined;\n } else {\n const result = decodeNamedCharacterReference(data);\n value = result;\n }\n const tail = this.stack[this.stack.length - 1];\n tail.value += value;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreference(token) {\n const tail = this.stack.pop();\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkprotocol(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = this.sliceSerialize(token);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkemail(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = 'mailto:' + this.sliceSerialize(token);\n }\n\n //\n // Creaters.\n //\n\n /** @returns {Blockquote} */\n function blockQuote() {\n return {\n type: 'blockquote',\n children: []\n };\n }\n\n /** @returns {Code} */\n function codeFlow() {\n return {\n type: 'code',\n lang: null,\n meta: null,\n value: ''\n };\n }\n\n /** @returns {InlineCode} */\n function codeText() {\n return {\n type: 'inlineCode',\n value: ''\n };\n }\n\n /** @returns {Definition} */\n function definition() {\n return {\n type: 'definition',\n identifier: '',\n label: null,\n title: null,\n url: ''\n };\n }\n\n /** @returns {Emphasis} */\n function emphasis() {\n return {\n type: 'emphasis',\n children: []\n };\n }\n\n /** @returns {Heading} */\n function heading() {\n return {\n type: 'heading',\n // @ts-expect-error `depth` will be set later.\n depth: 0,\n children: []\n };\n }\n\n /** @returns {Break} */\n function hardBreak() {\n return {\n type: 'break'\n };\n }\n\n /** @returns {Html} */\n function html() {\n return {\n type: 'html',\n value: ''\n };\n }\n\n /** @returns {Image} */\n function image() {\n return {\n type: 'image',\n title: null,\n url: '',\n alt: null\n };\n }\n\n /** @returns {Link} */\n function link() {\n return {\n type: 'link',\n title: null,\n url: '',\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {List}\n */\n function list(token) {\n return {\n type: 'list',\n ordered: token.type === 'listOrdered',\n start: null,\n spread: token._spread,\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {ListItem}\n */\n function listItem(token) {\n return {\n type: 'listItem',\n spread: token._spread,\n checked: null,\n children: []\n };\n }\n\n /** @returns {Paragraph} */\n function paragraph() {\n return {\n type: 'paragraph',\n children: []\n };\n }\n\n /** @returns {Strong} */\n function strong() {\n return {\n type: 'strong',\n children: []\n };\n }\n\n /** @returns {Text} */\n function text() {\n return {\n type: 'text',\n value: ''\n };\n }\n\n /** @returns {ThematicBreak} */\n function thematicBreak() {\n return {\n type: 'thematicBreak'\n };\n }\n}\n\n/**\n * Copy a point-like value.\n *\n * @param {Point} d\n * Point-like value.\n * @returns {Point}\n * unist point.\n */\nfunction point(d) {\n return {\n line: d.line,\n column: d.column,\n offset: d.offset\n };\n}\n\n/**\n * @param {Config} combined\n * @param {Array | Extension>} extensions\n * @returns {undefined}\n */\nfunction configure(combined, extensions) {\n let index = -1;\n while (++index < extensions.length) {\n const value = extensions[index];\n if (Array.isArray(value)) {\n configure(combined, value);\n } else {\n extension(combined, value);\n }\n }\n}\n\n/**\n * @param {Config} combined\n * @param {Extension} extension\n * @returns {undefined}\n */\nfunction extension(combined, extension) {\n /** @type {keyof Extension} */\n let key;\n for (key in extension) {\n if (own.call(extension, key)) {\n switch (key) {\n case 'canContainEols':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'transforms':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'enter':\n case 'exit':\n {\n const right = extension[key];\n if (right) {\n Object.assign(combined[key], right);\n }\n break;\n }\n // No default\n }\n }\n }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error('Cannot close `' + left.type + '` (' + stringifyPosition({\n start: left.start,\n end: left.end\n }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is open');\n } else {\n throw new Error('Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is still open');\n }\n}","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} FromMarkdownOptions\n * @typedef {import('unified').Parser} Parser\n * @typedef {import('unified').Processor} Processor\n */\n\n/**\n * @typedef {Omit} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * Aadd support for parsing from markdown.\n *\n * @param {Readonly | null | undefined} [options]\n * Configuration (optional).\n * @returns {undefined}\n * Nothing.\n */\nexport default function remarkParse(options) {\n /** @type {Processor} */\n // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n const self = this\n\n self.parser = parser\n\n /**\n * @type {Parser}\n */\n function parser(doc) {\n return fromMarkdown(doc, {\n ...self.data('settings'),\n ...options,\n // Note: these options are not in the readme.\n // The goal is for them to be set by plugins on `data` instead of being\n // passed by users.\n extensions: self.data('micromarkExtensions') || [],\n mdastExtensions: self.data('fromMarkdownExtensions') || []\n })\n }\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Blockquote} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `blockquote` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Blockquote} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function blockquote(state, node) {\n /** @type {Element} */\n const result = {\n type: 'element',\n tagName: 'blockquote',\n properties: {},\n children: state.wrap(state.all(node), true)\n }\n state.patch(node, result)\n return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {Break} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `break` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Break} node\n * mdast node.\n * @returns {Array}\n * hast element content.\n */\nexport function hardBreak(state, node) {\n /** @type {Element} */\n const result = {type: 'element', tagName: 'br', properties: {}, children: []}\n state.patch(node, result)\n return [state.applyData(node, result), {type: 'text', value: '\\n'}]\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Code} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `code` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Code} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function code(state, node) {\n const value = node.value ? node.value + '\\n' : ''\n /** @type {Properties} */\n const properties = {}\n // Someone can write `js python ruby`.\n const language = node.lang ? node.lang.split(/\\s+/) : []\n\n // GH/CM still drop the non-first languages.\n if (language.length > 0) {\n properties.className = ['language-' + language[0]]\n }\n\n // Create ``.\n /** @type {Element} */\n let result = {\n type: 'element',\n tagName: 'code',\n properties,\n children: [{type: 'text', value}]\n }\n\n if (node.meta) {\n result.data = {meta: node.meta}\n }\n\n state.patch(node, result)\n result = state.applyData(node, result)\n\n // Create `
`.\n  result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Delete} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `delete` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Delete} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strikethrough(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'del',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Emphasis} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `emphasis` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Emphasis} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function emphasis(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'em',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {FootnoteReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `footnoteReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {FootnoteReference} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function footnoteReference(state, node) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const id = String(node.identifier).toUpperCase()\n  const safeId = normalizeUri(id.toLowerCase())\n  const index = state.footnoteOrder.indexOf(id)\n  /** @type {number} */\n  let counter\n\n  let reuseCounter = state.footnoteCounts.get(id)\n\n  if (reuseCounter === undefined) {\n    reuseCounter = 0\n    state.footnoteOrder.push(id)\n    counter = state.footnoteOrder.length\n  } else {\n    counter = index + 1\n  }\n\n  reuseCounter += 1\n  state.footnoteCounts.set(id, reuseCounter)\n\n  /** @type {Element} */\n  const link = {\n    type: 'element',\n    tagName: 'a',\n    properties: {\n      href: '#' + clobberPrefix + 'fn-' + safeId,\n      id:\n        clobberPrefix +\n        'fnref-' +\n        safeId +\n        (reuseCounter > 1 ? '-' + reuseCounter : ''),\n      dataFootnoteRef: true,\n      ariaDescribedBy: ['footnote-label']\n    },\n    children: [{type: 'text', value: String(counter)}]\n  }\n  state.patch(node, link)\n\n  /** @type {Element} */\n  const sup = {\n    type: 'element',\n    tagName: 'sup',\n    properties: {},\n    children: [link]\n  }\n  state.patch(node, sup)\n  return state.applyData(node, sup)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Heading} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `heading` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Heading} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function heading(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'h' + node.depth,\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Html} from 'mdast'\n * @import {State} from '../state.js'\n * @import {Raw} from '../../index.js'\n */\n\n/**\n * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise\n * nothing).\n *\n * @param {State} state\n *   Info passed around.\n * @param {Html} node\n *   mdast node.\n * @returns {Element | Raw | undefined}\n *   hast node.\n */\nexport function html(state, node) {\n  if (state.options.allowDangerousHtml) {\n    /** @type {Raw} */\n    const result = {type: 'raw', value: node.value}\n    state.patch(node, result)\n    return state.applyData(node, result)\n  }\n\n  return undefined\n}\n","/**\n * @import {ElementContent} from 'hast'\n * @import {Reference, Nodes} from 'mdast'\n * @import {State} from './state.js'\n */\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Extract} node\n *   Reference node (image, link).\n * @returns {Array}\n *   hast content.\n */\nexport function revert(state, node) {\n  const subtype = node.referenceType\n  let suffix = ']'\n\n  if (subtype === 'collapsed') {\n    suffix += '[]'\n  } else if (subtype === 'full') {\n    suffix += '[' + (node.label || node.identifier) + ']'\n  }\n\n  if (node.type === 'imageReference') {\n    return [{type: 'text', value: '![' + node.alt + suffix}]\n  }\n\n  const contents = state.all(node)\n  const head = contents[0]\n\n  if (head && head.type === 'text') {\n    head.value = '[' + head.value\n  } else {\n    contents.unshift({type: 'text', value: '['})\n  }\n\n  const tail = contents[contents.length - 1]\n\n  if (tail && tail.type === 'text') {\n    tail.value += suffix\n  } else {\n    contents.push({type: 'text', value: suffix})\n  }\n\n  return contents\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ImageReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `imageReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ImageReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function imageReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(definition.url || ''), alt: node.alt}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Image} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `image` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Image} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function image(state, node) {\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(node.url)}\n\n  if (node.alt !== null && node.alt !== undefined) {\n    properties.alt = node.alt\n  }\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {InlineCode} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `inlineCode` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {InlineCode} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function inlineCode(state, node) {\n  /** @type {Text} */\n  const text = {type: 'text', value: node.value.replace(/\\r?\\n|\\r/g, ' ')}\n  state.patch(node, text)\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'code',\n    properties: {},\n    children: [text]\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {LinkReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `linkReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {LinkReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function linkReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(definition.url || '')}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Link} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `link` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Link} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function link(state, node) {\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(node.url)}\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ListItem, Parents} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `listItem` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ListItem} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function listItem(state, node, parent) {\n  const results = state.all(node)\n  const loose = parent ? listLoose(parent) : listItemLoose(node)\n  /** @type {Properties} */\n  const properties = {}\n  /** @type {Array} */\n  const children = []\n\n  if (typeof node.checked === 'boolean') {\n    const head = results[0]\n    /** @type {Element} */\n    let paragraph\n\n    if (head && head.type === 'element' && head.tagName === 'p') {\n      paragraph = head\n    } else {\n      paragraph = {type: 'element', tagName: 'p', properties: {}, children: []}\n      results.unshift(paragraph)\n    }\n\n    if (paragraph.children.length > 0) {\n      paragraph.children.unshift({type: 'text', value: ' '})\n    }\n\n    paragraph.children.unshift({\n      type: 'element',\n      tagName: 'input',\n      properties: {type: 'checkbox', checked: node.checked, disabled: true},\n      children: []\n    })\n\n    // According to github-markdown-css, this class hides bullet.\n    // See: .\n    properties.className = ['task-list-item']\n  }\n\n  let index = -1\n\n  while (++index < results.length) {\n    const child = results[index]\n\n    // Add eols before nodes, except if this is a loose, first paragraph.\n    if (\n      loose ||\n      index !== 0 ||\n      child.type !== 'element' ||\n      child.tagName !== 'p'\n    ) {\n      children.push({type: 'text', value: '\\n'})\n    }\n\n    if (child.type === 'element' && child.tagName === 'p' && !loose) {\n      children.push(...child.children)\n    } else {\n      children.push(child)\n    }\n  }\n\n  const tail = results[results.length - 1]\n\n  // Add a final eol.\n  if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {\n    children.push({type: 'text', value: '\\n'})\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'li', properties, children}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n\n/**\n * @param {Parents} node\n * @return {Boolean}\n */\nfunction listLoose(node) {\n  let loose = false\n  if (node.type === 'list') {\n    loose = node.spread || false\n    const children = node.children\n    let index = -1\n\n    while (!loose && ++index < children.length) {\n      loose = listItemLoose(children[index])\n    }\n  }\n\n  return loose\n}\n\n/**\n * @param {ListItem} node\n * @return {Boolean}\n */\nfunction listItemLoose(node) {\n  const spread = node.spread\n\n  return spread === null || spread === undefined\n    ? node.children.length > 1\n    : spread\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {List} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `list` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {List} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function list(state, node) {\n  /** @type {Properties} */\n  const properties = {}\n  const results = state.all(node)\n  let index = -1\n\n  if (typeof node.start === 'number' && node.start !== 1) {\n    properties.start = node.start\n  }\n\n  // Like GitHub, add a class for custom styling.\n  while (++index < results.length) {\n    const child = results[index]\n\n    if (\n      child.type === 'element' &&\n      child.tagName === 'li' &&\n      child.properties &&\n      Array.isArray(child.properties.className) &&\n      child.properties.className.includes('task-list-item')\n    ) {\n      properties.className = ['contains-task-list']\n      break\n    }\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: node.ordered ? 'ol' : 'ul',\n    properties,\n    children: state.wrap(results, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Paragraph} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `paragraph` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Paragraph} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function paragraph(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'p',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Parents as HastParents, Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `root` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastRoot} node\n *   mdast node.\n * @returns {HastParents}\n *   hast node.\n */\nexport function root(state, node) {\n  /** @type {HastRoot} */\n  const result = {type: 'root', children: state.wrap(state.all(node))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Strong} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `strong` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Strong} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strong(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'strong',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Table} from 'mdast'\n * @import {Element} from 'hast'\n * @import {State} from '../state.js'\n */\n\nimport {pointEnd, pointStart} from 'unist-util-position'\n\n/**\n * Turn an mdast `table` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Table} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function table(state, node) {\n  const rows = state.all(node)\n  const firstRow = rows.shift()\n  /** @type {Array} */\n  const tableContent = []\n\n  if (firstRow) {\n    /** @type {Element} */\n    const head = {\n      type: 'element',\n      tagName: 'thead',\n      properties: {},\n      children: state.wrap([firstRow], true)\n    }\n    state.patch(node.children[0], head)\n    tableContent.push(head)\n  }\n\n  if (rows.length > 0) {\n    /** @type {Element} */\n    const body = {\n      type: 'element',\n      tagName: 'tbody',\n      properties: {},\n      children: state.wrap(rows, true)\n    }\n\n    const start = pointStart(node.children[1])\n    const end = pointEnd(node.children[node.children.length - 1])\n    if (start && end) body.position = {start, end}\n    tableContent.push(body)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'table',\n    properties: {},\n    children: state.wrap(tableContent, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, ElementContent, Properties} from 'hast'\n * @import {Parents, TableRow} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableRow` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableRow} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function tableRow(state, node, parent) {\n  const siblings = parent ? parent.children : undefined\n  // Generate a body row when without parent.\n  const rowIndex = siblings ? siblings.indexOf(node) : 1\n  const tagName = rowIndex === 0 ? 'th' : 'td'\n  // To do: option to use `style`?\n  const align = parent && parent.type === 'table' ? parent.align : undefined\n  const length = align ? align.length : node.children.length\n  let cellIndex = -1\n  /** @type {Array} */\n  const cells = []\n\n  while (++cellIndex < length) {\n    // Note: can also be undefined.\n    const cell = node.children[cellIndex]\n    /** @type {Properties} */\n    const properties = {}\n    const alignValue = align ? align[cellIndex] : undefined\n\n    if (alignValue) {\n      properties.align = alignValue\n    }\n\n    /** @type {Element} */\n    let result = {type: 'element', tagName, properties, children: []}\n\n    if (cell) {\n      result.children = state.all(cell)\n      state.patch(cell, result)\n      result = state.applyData(cell, result)\n    }\n\n    cells.push(result)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'tr',\n    properties: {},\n    children: state.wrap(cells, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {TableCell} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableCell` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableCell} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function tableCell(state, node) {\n  // Note: this function is normally not called: see `table-row` for how rows\n  // and their cells are compiled.\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'td', // Assume body cell.\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n *   Value to trim.\n * @returns {string}\n *   Trimmed value.\n */\nexport function trimLines(value) {\n  const source = String(value)\n  const search = /\\r?\\n|\\r/g\n  let match = search.exec(source)\n  let last = 0\n  /** @type {Array} */\n  const lines = []\n\n  while (match) {\n    lines.push(\n      trimLine(source.slice(last, match.index), last > 0, true),\n      match[0]\n    )\n\n    last = match.index + match[0].length\n    match = search.exec(source)\n  }\n\n  lines.push(trimLine(source.slice(last), last > 0, false))\n\n  return lines.join('')\n}\n\n/**\n * @param {string} value\n *   Line to trim.\n * @param {boolean} start\n *   Whether to trim the start of the line.\n * @param {boolean} end\n *   Whether to trim the end of the line.\n * @returns {string}\n *   Trimmed line.\n */\nfunction trimLine(value, start, end) {\n  let startIndex = 0\n  let endIndex = value.length\n\n  if (start) {\n    let code = value.codePointAt(startIndex)\n\n    while (code === tab || code === space) {\n      startIndex++\n      code = value.codePointAt(startIndex)\n    }\n  }\n\n  if (end) {\n    let code = value.codePointAt(endIndex - 1)\n\n    while (code === tab || code === space) {\n      endIndex--\n      code = value.codePointAt(endIndex - 1)\n    }\n  }\n\n  return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n","/**\n * @import {Element as HastElement, Text as HastText} from 'hast'\n * @import {Text as MdastText} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {trimLines} from 'trim-lines'\n\n/**\n * Turn an mdast `text` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastText} node\n *   mdast node.\n * @returns {HastElement | HastText}\n *   hast node.\n */\nexport function text(state, node) {\n  /** @type {HastText} */\n  const result = {type: 'text', value: trimLines(String(node.value))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {ThematicBreak} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `thematicBreak` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ThematicBreak} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function thematicBreak(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'hr',\n    properties: {},\n    children: []\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Handlers} from '../state.js'\n */\n\nimport {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {strikethrough} from './delete.js'\nimport {emphasis} from './emphasis.js'\nimport {footnoteReference} from './footnote-reference.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {imageReference} from './image-reference.js'\nimport {image} from './image.js'\nimport {inlineCode} from './inline-code.js'\nimport {linkReference} from './link-reference.js'\nimport {link} from './link.js'\nimport {listItem} from './list-item.js'\nimport {list} from './list.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {table} from './table.js'\nimport {tableRow} from './table-row.js'\nimport {tableCell} from './table-cell.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default handlers for nodes.\n *\n * @satisfies {Handlers}\n */\nexport const handlers = {\n  blockquote,\n  break: hardBreak,\n  code,\n  delete: strikethrough,\n  emphasis,\n  footnoteReference,\n  heading,\n  html,\n  imageReference,\n  image,\n  inlineCode,\n  linkReference,\n  link,\n  listItem,\n  list,\n  paragraph,\n  // @ts-expect-error: root is different, but hard to type.\n  root,\n  strong,\n  table,\n  tableCell,\n  tableRow,\n  text,\n  thematicBreak,\n  toml: ignore,\n  yaml: ignore,\n  definition: ignore,\n  footnoteDefinition: ignore\n}\n\n// Return nothing for nodes that are ignored.\nfunction ignore() {\n  return undefined\n}\n","/**\n * @import {ElementContent, Element} from 'hast'\n * @import {State} from './state.js'\n */\n\n/**\n * @callback FootnoteBackContentTemplate\n *   Generate content for the backreference dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array | ElementContent | string}\n *   Content for the backreference when linking back from definitions to their\n *   reference.\n *\n * @callback FootnoteBackLabelTemplate\n *   Generate a back label dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Back label to use when linking back from definitions to their reference.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Generate the default content that GitHub uses on backreferences.\n *\n * @param {number} _\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array}\n *   Content.\n */\nexport function defaultFootnoteBackContent(_, rereferenceIndex) {\n  /** @type {Array} */\n  const result = [{type: 'text', value: '↩'}]\n\n  if (rereferenceIndex > 1) {\n    result.push({\n      type: 'element',\n      tagName: 'sup',\n      properties: {},\n      children: [{type: 'text', value: String(rereferenceIndex)}]\n    })\n  }\n\n  return result\n}\n\n/**\n * Generate the default label that GitHub uses on backreferences.\n *\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Label.\n */\nexport function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n  return (\n    'Back to reference ' +\n    (referenceIndex + 1) +\n    (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n  )\n}\n\n/**\n * Generate a hast footer for called footnote definitions.\n *\n * @param {State} state\n *   Info passed around.\n * @returns {Element | undefined}\n *   `section` element or `undefined`.\n */\n// eslint-disable-next-line complexity\nexport function footer(state) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const footnoteBackContent =\n    state.options.footnoteBackContent || defaultFootnoteBackContent\n  const footnoteBackLabel =\n    state.options.footnoteBackLabel || defaultFootnoteBackLabel\n  const footnoteLabel = state.options.footnoteLabel || 'Footnotes'\n  const footnoteLabelTagName = state.options.footnoteLabelTagName || 'h2'\n  const footnoteLabelProperties = state.options.footnoteLabelProperties || {\n    className: ['sr-only']\n  }\n  /** @type {Array} */\n  const listItems = []\n  let referenceIndex = -1\n\n  while (++referenceIndex < state.footnoteOrder.length) {\n    const definition = state.footnoteById.get(\n      state.footnoteOrder[referenceIndex]\n    )\n\n    if (!definition) {\n      continue\n    }\n\n    const content = state.all(definition)\n    const id = String(definition.identifier).toUpperCase()\n    const safeId = normalizeUri(id.toLowerCase())\n    let rereferenceIndex = 0\n    /** @type {Array} */\n    const backReferences = []\n    const counts = state.footnoteCounts.get(id)\n\n    // eslint-disable-next-line no-unmodified-loop-condition\n    while (counts !== undefined && ++rereferenceIndex <= counts) {\n      if (backReferences.length > 0) {\n        backReferences.push({type: 'text', value: ' '})\n      }\n\n      let children =\n        typeof footnoteBackContent === 'string'\n          ? footnoteBackContent\n          : footnoteBackContent(referenceIndex, rereferenceIndex)\n\n      if (typeof children === 'string') {\n        children = {type: 'text', value: children}\n      }\n\n      backReferences.push({\n        type: 'element',\n        tagName: 'a',\n        properties: {\n          href:\n            '#' +\n            clobberPrefix +\n            'fnref-' +\n            safeId +\n            (rereferenceIndex > 1 ? '-' + rereferenceIndex : ''),\n          dataFootnoteBackref: '',\n          ariaLabel:\n            typeof footnoteBackLabel === 'string'\n              ? footnoteBackLabel\n              : footnoteBackLabel(referenceIndex, rereferenceIndex),\n          className: ['data-footnote-backref']\n        },\n        children: Array.isArray(children) ? children : [children]\n      })\n    }\n\n    const tail = content[content.length - 1]\n\n    if (tail && tail.type === 'element' && tail.tagName === 'p') {\n      const tailTail = tail.children[tail.children.length - 1]\n      if (tailTail && tailTail.type === 'text') {\n        tailTail.value += ' '\n      } else {\n        tail.children.push({type: 'text', value: ' '})\n      }\n\n      tail.children.push(...backReferences)\n    } else {\n      content.push(...backReferences)\n    }\n\n    /** @type {Element} */\n    const listItem = {\n      type: 'element',\n      tagName: 'li',\n      properties: {id: clobberPrefix + 'fn-' + safeId},\n      children: state.wrap(content, true)\n    }\n\n    state.patch(definition, listItem)\n\n    listItems.push(listItem)\n  }\n\n  if (listItems.length === 0) {\n    return\n  }\n\n  return {\n    type: 'element',\n    tagName: 'section',\n    properties: {dataFootnotes: true, className: ['footnotes']},\n    children: [\n      {\n        type: 'element',\n        tagName: footnoteLabelTagName,\n        properties: {\n          ...structuredClone(footnoteLabelProperties),\n          id: 'footnote-label'\n        },\n        children: [{type: 'text', value: footnoteLabel}]\n      },\n      {type: 'text', value: '\\n'},\n      {\n        type: 'element',\n        tagName: 'ol',\n        properties: {},\n        children: state.wrap(listItems, true)\n      },\n      {type: 'text', value: '\\n'}\n    ]\n  }\n}\n","/**\n * @import {\n *   ElementContent as HastElementContent,\n *   Element as HastElement,\n *   Nodes as HastNodes,\n *   Properties as HastProperties,\n *   RootContent as HastRootContent,\n *   Text as HastText\n * } from 'hast'\n * @import {\n *   Definition as MdastDefinition,\n *   FootnoteDefinition as MdastFootnoteDefinition,\n *   Nodes as MdastNodes,\n *   Parents as MdastParents\n * } from 'mdast'\n * @import {VFile} from 'vfile'\n * @import {\n *   FootnoteBackContentTemplate,\n *   FootnoteBackLabelTemplate\n * } from './footer.js'\n */\n\n/**\n * @callback Handler\n *   Handle a node.\n * @param {State} state\n *   Info passed around.\n * @param {any} node\n *   mdast node to handle.\n * @param {MdastParents | undefined} parent\n *   Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n *   hast node.\n *\n * @typedef {Partial>} Handlers\n *   Handle nodes.\n *\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n *   Whether to persist raw HTML in markdown in the hast tree (default:\n *   `false`).\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n *   Prefix to use before the `id` property on footnotes to prevent them from\n *   *clobbering* (default: `'user-content-'`).\n *\n *   Pass `''` for trusted markdown and when you are careful with\n *   polyfilling.\n *   You could pass a different prefix.\n *\n *   DOM clobbering is this:\n *\n *   ```html\n *   

\n * \n * ```\n *\n * The above example shows that elements are made available by browsers, by\n * their ID, on the `window` object.\n * This is a security risk because you might be expecting some other variable\n * at that place.\n * It can also break polyfills.\n * Using a prefix solves these problems.\n * @property {VFile | null | undefined} [file]\n * Corresponding virtual file representing the input document (optional).\n * @property {FootnoteBackContentTemplate | string | null | undefined} [footnoteBackContent]\n * Content of the backreference back to references (default: `defaultFootnoteBackContent`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackContent(_, rereferenceIndex) {\n * const result = [{type: 'text', value: '↩'}]\n *\n * if (rereferenceIndex > 1) {\n * result.push({\n * type: 'element',\n * tagName: 'sup',\n * properties: {},\n * children: [{type: 'text', value: String(rereferenceIndex)}]\n * })\n * }\n *\n * return result\n * }\n * ```\n *\n * This content is used in the `a` element of each backreference (the `↩`\n * links).\n * @property {FootnoteBackLabelTemplate | string | null | undefined} [footnoteBackLabel]\n * Label to describe the backreference back to references (default:\n * `defaultFootnoteBackLabel`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n * return (\n * 'Back to reference ' +\n * (referenceIndex + 1) +\n * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n * )\n * }\n * ```\n *\n * Change it when the markdown is not in English.\n *\n * This label is used in the `ariaLabel` property on each backreference\n * (the `↩` links).\n * It affects users of assistive technology.\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n * Textual label to use for the footnotes section (default: `'Footnotes'`).\n *\n * Change it when the markdown is not in English.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n * Properties to use on the footnote label (default: `{className:\n * ['sr-only']}`).\n *\n * Change it to show the label and add other properties.\n *\n * This label is typically hidden visually (assuming an `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass an empty string.\n * You can also add different properties.\n *\n * > **Note**: `id: 'footnote-label'` is always added, because footnote\n * > calls use it with `aria-describedby` to provide an accessible label.\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n * HTML tag name to use for the footnote label element (default: `'h2'`).\n *\n * Change it to match your document structure.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {Handlers | null | undefined} [handlers]\n * Extra handlers for nodes (optional).\n * @property {Array | null | undefined} [passThrough]\n * List of custom mdast node types to pass through (keep) in hast (note that\n * the node itself is passed, but eventual children are transformed)\n * (optional).\n * @property {Handler | null | undefined} [unknownHandler]\n * Handler for all unknown nodes (optional).\n *\n * @typedef State\n * Info passed around.\n * @property {(node: MdastNodes) => Array} all\n * Transform the children of an mdast parent to hast.\n * @property {(from: MdastNodes, to: Type) => HastElement | Type} applyData\n * Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {Map} definitionById\n * Definitions by their identifier.\n * @property {Map} footnoteById\n * Footnote definitions by their identifier.\n * @property {Map} footnoteCounts\n * Counts for how often the same footnote was called.\n * @property {Array} footnoteOrder\n * Identifiers of order when footnote calls first appear in tree order.\n * @property {Handlers} handlers\n * Applied handlers.\n * @property {(node: MdastNodes, parent: MdastParents | undefined) => Array | HastElementContent | undefined} one\n * Transform an mdast node to hast.\n * @property {Options} options\n * Configuration.\n * @property {(from: MdastNodes, node: HastNodes) => undefined} patch\n * Copy a node’s positional info.\n * @property {(nodes: Array, loose?: boolean | undefined) => Array} wrap\n * Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {visit} from 'unist-util-visit'\nimport {position} from 'unist-util-position'\nimport {handlers as defaultHandlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Create `state` from an mdast tree.\n *\n * @param {MdastNodes} tree\n * mdast node to transform.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {State}\n * `state` function.\n */\nexport function createState(tree, options) {\n const settings = options || emptyOptions\n /** @type {Map} */\n const definitionById = new Map()\n /** @type {Map} */\n const footnoteById = new Map()\n /** @type {Map} */\n const footnoteCounts = new Map()\n /** @type {Handlers} */\n // @ts-expect-error: the root handler returns a root.\n // Hard to type.\n const handlers = {...defaultHandlers, ...settings.handlers}\n\n /** @type {State} */\n const state = {\n all,\n applyData,\n definitionById,\n footnoteById,\n footnoteCounts,\n footnoteOrder: [],\n handlers,\n one,\n options: settings,\n patch,\n wrap\n }\n\n visit(tree, function (node) {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n const map = node.type === 'definition' ? definitionById : footnoteById\n const id = String(node.identifier).toUpperCase()\n\n // Mimick CM behavior of link definitions.\n // See: .\n if (!map.has(id)) {\n // @ts-expect-error: node type matches map.\n map.set(id, node)\n }\n }\n })\n\n return state\n\n /**\n * Transform an mdast node into a hast node.\n *\n * @param {MdastNodes} node\n * mdast node.\n * @param {MdastParents | undefined} [parent]\n * Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n * Resulting hast node.\n */\n function one(node, parent) {\n const type = node.type\n const handle = state.handlers[type]\n\n if (own.call(state.handlers, type) && handle) {\n return handle(state, node, parent)\n }\n\n if (state.options.passThrough && state.options.passThrough.includes(type)) {\n if ('children' in node) {\n const {children, ...shallow} = node\n const result = structuredClone(shallow)\n // @ts-expect-error: TS doesn’t understand…\n result.children = state.all(node)\n // @ts-expect-error: TS doesn’t understand…\n return result\n }\n\n // @ts-expect-error: it’s custom.\n return structuredClone(node)\n }\n\n const unknown = state.options.unknownHandler || defaultUnknownHandler\n\n return unknown(state, node, parent)\n }\n\n /**\n * Transform the children of an mdast node into hast nodes.\n *\n * @param {MdastNodes} parent\n * mdast node to compile\n * @returns {Array}\n * Resulting hast nodes.\n */\n function all(parent) {\n /** @type {Array} */\n const values = []\n\n if ('children' in parent) {\n const nodes = parent.children\n let index = -1\n while (++index < nodes.length) {\n const result = state.one(nodes[index], parent)\n\n // To do: see if we van clean this? Can we merge texts?\n if (result) {\n if (index && nodes[index - 1].type === 'break') {\n if (!Array.isArray(result) && result.type === 'text') {\n result.value = trimMarkdownSpaceStart(result.value)\n }\n\n if (!Array.isArray(result) && result.type === 'element') {\n const head = result.children[0]\n\n if (head && head.type === 'text') {\n head.value = trimMarkdownSpaceStart(head.value)\n }\n }\n }\n\n if (Array.isArray(result)) {\n values.push(...result)\n } else {\n values.push(result)\n }\n }\n }\n }\n\n return values\n }\n}\n\n/**\n * Copy a node’s positional info.\n *\n * @param {MdastNodes} from\n * mdast node to copy from.\n * @param {HastNodes} to\n * hast node to copy into.\n * @returns {undefined}\n * Nothing.\n */\nfunction patch(from, to) {\n if (from.position) to.position = position(from)\n}\n\n/**\n * Honor the `data` of `from` and maybe generate an element instead of `to`.\n *\n * @template {HastNodes} Type\n * Node type.\n * @param {MdastNodes} from\n * mdast node to use data from.\n * @param {Type} to\n * hast node to change.\n * @returns {HastElement | Type}\n * Nothing.\n */\nfunction applyData(from, to) {\n /** @type {HastElement | Type} */\n let result = to\n\n // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n if (from && from.data) {\n const hName = from.data.hName\n const hChildren = from.data.hChildren\n const hProperties = from.data.hProperties\n\n if (typeof hName === 'string') {\n // Transforming the node resulted in an element with a different name\n // than wanted:\n if (result.type === 'element') {\n result.tagName = hName\n }\n // Transforming the node resulted in a non-element, which happens for\n // raw, text, and root nodes (unless custom handlers are passed).\n // The intent of `hName` is to create an element, but likely also to keep\n // the content around (otherwise: pass `hChildren`).\n else {\n /** @type {Array} */\n // @ts-expect-error: assume no doctypes in `root`.\n const children = 'children' in result ? result.children : [result]\n result = {type: 'element', tagName: hName, properties: {}, children}\n }\n }\n\n if (result.type === 'element' && hProperties) {\n Object.assign(result.properties, structuredClone(hProperties))\n }\n\n if (\n 'children' in result &&\n result.children &&\n hChildren !== null &&\n hChildren !== undefined\n ) {\n result.children = hChildren\n }\n }\n\n return result\n}\n\n/**\n * Transform an unknown node.\n *\n * @param {State} state\n * Info passed around.\n * @param {MdastNodes} node\n * Unknown mdast node.\n * @returns {HastElement | HastText}\n * Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n const data = node.data || {}\n /** @type {HastElement | HastText} */\n const result =\n 'value' in node &&\n !(own.call(data, 'hProperties') || own.call(data, 'hChildren'))\n ? {type: 'text', value: node.value}\n : {\n type: 'element',\n tagName: 'div',\n properties: {},\n children: state.all(node)\n }\n\n state.patch(node, result)\n return state.applyData(node, result)\n}\n\n/**\n * Wrap `nodes` with line endings between each node.\n *\n * @template {HastRootContent} Type\n * Node type.\n * @param {Array} nodes\n * List of nodes to wrap.\n * @param {boolean | undefined} [loose=false]\n * Whether to add line endings at start and end (default: `false`).\n * @returns {Array}\n * Wrapped nodes.\n */\nexport function wrap(nodes, loose) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n if (loose) {\n result.push({type: 'text', value: '\\n'})\n }\n\n while (++index < nodes.length) {\n if (index) result.push({type: 'text', value: '\\n'})\n result.push(nodes[index])\n }\n\n if (loose && nodes.length > 0) {\n result.push({type: 'text', value: '\\n'})\n }\n\n return result\n}\n\n/**\n * Trim spaces and tabs at the start of `value`.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Result.\n */\nfunction trimMarkdownSpaceStart(value) {\n let index = 0\n let code = value.charCodeAt(index)\n\n while (code === 9 || code === 32) {\n index++\n code = value.charCodeAt(index)\n }\n\n return value.slice(index)\n}\n","/**\n * @import {Nodes as HastNodes} from 'hast'\n * @import {Nodes as MdastNodes} from 'mdast'\n * @import {Options} from './state.js'\n */\n\nimport {ok as assert} from 'devlop'\nimport {footer} from './footer.js'\nimport {createState} from './state.js'\n\n/**\n * Transform mdast to hast.\n *\n * ##### Notes\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most utilities ignore `raw` nodes but two notable ones don’t:\n *\n * * `hast-util-to-html` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful\n * if you completely trust authors\n * * `hast-util-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc).\n * This is a heavy task as it needs a full HTML parser, but it is the only\n * way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark, which we follow by default.\n * They are supported by GitHub, so footnotes can be enabled in markdown with\n * `mdast-util-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes, which is hidden for sighted users but shown to\n * assistive technology.\n * When your page is not in English, you must define translated values.\n *\n * Back references use ARIA attributes, but the section label itself uses a\n * heading that is hidden with an `sr-only` class.\n * To show it to sighted users, define different attributes in\n * `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem, as it links footnote calls to footnote\n * definitions on the page through `id` attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * Example: headings (DOM clobbering) in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value` (and doesn’t have `data.hName`,\n * `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n * node\n * * otherwise, create a `
` element (which could be changed with\n * `data.hName`), with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @param {MdastNodes} tree\n * mdast tree.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {HastNodes}\n * hast tree.\n */\nexport function toHast(tree, options) {\n const state = createState(tree, options)\n const node = state.one(tree, undefined)\n const foot = footer(state)\n /** @type {HastNodes} */\n const result = Array.isArray(node)\n ? {type: 'root', children: node}\n : node || {type: 'root', children: []}\n\n if (foot) {\n // If there’s a footer, there were definitions, meaning block\n // content.\n // So `result` is a parent node.\n assert('children' in result)\n result.children.push({type: 'text', value: '\\n'}, foot)\n }\n\n return result\n}\n","/**\n * @import {Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {Options as ToHastOptions} from 'mdast-util-to-hast'\n * @import {Processor} from 'unified'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @typedef {Omit} Options\n *\n * @callback TransformBridge\n * Bridge-mode.\n *\n * Runs the destination with the new hast tree.\n * Discards result.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {Promise}\n * Nothing.\n *\n * @callback TransformMutate\n * Mutate-mode.\n *\n * Further transformers run on the hast tree.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {HastRoot}\n * Tree (hast).\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n/**\n * Turn markdown into HTML.\n *\n * ##### Notes\n *\n * ###### Signature\n *\n * * if a processor is given,\n * runs the (rehype) plugins used on it with a hast tree,\n * then discards the result (*bridge mode*)\n * * otherwise,\n * returns a hast tree,\n * the plugins used after `remarkRehype` are rehype plugins (*mutate mode*)\n *\n * > 👉 **Note**:\n * > It’s highly unlikely that you want to pass a `processor`.\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most plugins ignore `raw` nodes but two notable ones don’t:\n *\n * * `rehype-stringify` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful if\n * you completely trust authors\n * * `rehype-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc);\n * this is a heavy task as it needs a full HTML parser,\n * but it is the only way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark,\n * which we follow by default.\n * They are supported by GitHub,\n * so footnotes can be enabled in markdown with `remark-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes,\n * which is hidden for sighted users but shown to assistive technology.\n * When your page is not in English,\n * you must define translated values.\n *\n * Back references use ARIA attributes,\n * but the section label itself uses a heading that is hidden with an\n * `sr-only` class.\n * To show it to sighted users,\n * define different attributes in `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem,\n * as it links footnote calls to footnote definitions on the page through `id`\n * attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * *Example: headings (DOM clobbering)* in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value`\n * (and doesn’t have `data.hName`, `data.hProperties`, or `data.hChildren`,\n * see later),\n * create a hast `text` node\n * * otherwise,\n * create a `
` element (which could be changed with `data.hName`),\n * with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @overload\n * @param {Processor} processor\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge}\n *\n * @overload\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformMutate}\n *\n * @overload\n * @param {Readonly | Processor | null | undefined} [destination]\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge | TransformMutate}\n *\n * @param {Readonly | Processor | null | undefined} [destination]\n * Processor or configuration (optional).\n * @param {Readonly | null | undefined} [options]\n * When a processor was given,\n * configuration (optional).\n * @returns {TransformBridge | TransformMutate}\n * Transform.\n */\nexport default function remarkRehype(destination, options) {\n if (destination && 'run' in destination) {\n /**\n * @type {TransformBridge}\n */\n return async function (tree, file) {\n // Cast because root in -> root out.\n const hastTree = /** @type {HastRoot} */ (\n toHast(tree, {file, ...options})\n )\n await destination.run(hastTree, file)\n }\n }\n\n /**\n * @type {TransformMutate}\n */\n return function (tree, file) {\n // Cast because root in -> root out.\n // To do: in the future, disallow ` || options` fallback.\n // With `unified-engine`, `destination` can be `undefined` but\n // `options` will be the file set.\n // We should not pass that as `options`.\n return /** @type {HastRoot} */ (\n toHast(tree, {file, ...(destination || options)})\n )\n }\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n */\n\nimport {visit} from 'unist-util-visit'\n\n/**\n * Remove empty paragraphs in `tree`.\n *\n * @param {Nodes} tree\n * Tree to change.\n * @returns {undefined}\n * Nothing.\n */\nexport function squeezeParagraphs(tree) {\n visit(tree, function (node, index, parent) {\n if (\n index !== undefined &&\n parent &&\n node.type === 'paragraph' &&\n node.children.every(function (child) {\n return child.type === 'text' && /^\\s*$/.test(child.value)\n })\n ) {\n parent.children.splice(index, 1)\n return index\n }\n })\n}\n","/**\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: MIT\n */\n\n/**\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n * @typedef {import('mdast').Root} Root\n */\n\nimport {squeezeParagraphs} from 'mdast-squeeze-paragraphs'\nimport {visit} from 'unist-util-visit'\n\n/**\n * Only keep links with the given protocols.\n *\n * @param {object} options Options\n * @param {string[]} options.except - Protocols to exclude. Defauls to `['http', 'https']`.\n * @returns\n * Transform.\n */\nexport default function remarkUnlinkProtocols(\n options = {except: ['http', 'https']}\n) {\n /**\n * Transform.\n *\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n return function (tree) {\n /** @type {Map} */\n const definitions = new Map()\n\n // Find definitions to look up linkReferences.\n visit(tree, 'definition', function (node, index, parent) {\n definitions.set(node.identifier, node.url)\n if (parent && typeof index === 'number') {\n const url = node.url\n if (\n url &&\n url.includes(':') &&\n !options.except.some((proto) => url.startsWith(`${proto}:`))\n ) {\n parent.children.splice(index, 1)\n return index\n }\n }\n })\n\n visit(tree, function (node, index, parent) {\n if (\n parent &&\n typeof index === 'number' &&\n (node.type === 'link' || node.type === 'linkReference')\n ) {\n const url =\n node.type === 'link' ? node.url : definitions.get(node.identifier)\n if (\n url &&\n url.includes(':') &&\n !options.except.some((proto) => url.startsWith(`${proto}:`))\n ) {\n parent.children.splice(index, 1, ...node.children)\n return index\n }\n }\n })\n\n squeezeParagraphs(tree)\n }\n}\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n","'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array) => void} Callback\n * Callback.\n *\n * @typedef {(...input: Array) => any} Middleware\n * Ware.\n *\n * @typedef Pipeline\n * Pipeline.\n * @property {Run} run\n * Run the pipeline.\n * @property {Use} use\n * Add middleware.\n *\n * @typedef {(...input: Array) => void} Run\n * Call all middleware.\n *\n * Calls `done` on completion with either an error or the output of the\n * last middleware.\n *\n * > 👉 **Note**: as the length of input defines whether async functions get a\n * > `next` function,\n * > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n * Pipeline.\n */\nexport function trough() {\n /** @type {Array} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error | null | undefined} error\n * @param {Array} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n * returns a promise that is rejected,\n * or calls the given `done` function with an error,\n * `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n * that value is the main output value\n * * if `middleware` calls `done`,\n * all non-nullish values except for the first one (the error) overwrite the\n * output values\n *\n * @param {Middleware} middleware\n * Function to wrap.\n * @param {Callback} callback\n * Callback called with the output of `middleware`.\n * @returns {Run}\n * Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result && result.then && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n *\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","// A derivative work based on:\n// .\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// .\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const minpath = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * Get the basename from a path.\n *\n * @param {string} path\n * File path.\n * @param {string | null | undefined} [extname]\n * Extension to strip.\n * @returns {string}\n * Stem or basename.\n */\nfunction basename(path, extname) {\n if (extname !== undefined && typeof extname !== 'string') {\n throw new TypeError('\"ext\" argument must be a string')\n }\n\n assertPath(path)\n let start = 0\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let seenNonSlash\n\n if (\n extname === undefined ||\n extname.length === 0 ||\n extname.length > path.length\n ) {\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // path component.\n seenNonSlash = true\n end = index + 1\n }\n }\n\n return end < 0 ? '' : path.slice(start, end)\n }\n\n if (extname === path) {\n return ''\n }\n\n let firstNonSlashEnd = -1\n let extnameIndex = extname.length - 1\n\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else {\n if (firstNonSlashEnd < 0) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching.\n seenNonSlash = true\n firstNonSlashEnd = index + 1\n }\n\n if (extnameIndex > -1) {\n // Try to match the explicit extension.\n if (path.codePointAt(index) === extname.codePointAt(extnameIndex--)) {\n if (extnameIndex < 0) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = index\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extnameIndex = -1\n end = firstNonSlashEnd\n }\n }\n }\n }\n\n if (start === end) {\n end = firstNonSlashEnd\n } else if (end < 0) {\n end = path.length\n }\n\n return path.slice(start, end)\n}\n\n/**\n * Get the dirname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\nfunction dirname(path) {\n assertPath(path)\n\n if (path.length === 0) {\n return '.'\n }\n\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n // Prefix `--` is important to not run on `0`.\n while (--index) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n if (unmatchedSlash) {\n end = index\n break\n }\n } else if (!unmatchedSlash) {\n // We saw the first non-path separator\n unmatchedSlash = true\n }\n }\n\n return end < 0\n ? path.codePointAt(0) === 47 /* `/` */\n ? '/'\n : '.'\n : end === 1 && path.codePointAt(0) === 47 /* `/` */\n ? '//'\n : path.slice(0, end)\n}\n\n/**\n * Get an extname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * Extname.\n */\nfunction extname(path) {\n assertPath(path)\n\n let index = path.length\n\n let end = -1\n let startPart = 0\n let startDot = -1\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find.\n let preDotState = 0\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n while (index--) {\n const code = path.codePointAt(index)\n\n if (code === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (unmatchedSlash) {\n startPart = index + 1\n break\n }\n\n continue\n }\n\n if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // extension.\n unmatchedSlash = true\n end = index + 1\n }\n\n if (code === 46 /* `.` */) {\n // If this is our first dot, mark it as the start of our extension.\n if (startDot < 0) {\n startDot = index\n } else if (preDotState !== 1) {\n preDotState = 1\n }\n } else if (startDot > -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension.\n preDotState = -1\n }\n }\n\n if (\n startDot < 0 ||\n end < 0 ||\n // We saw a non-dot character immediately before the dot.\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly `..`.\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n ) {\n return ''\n }\n\n return path.slice(startDot, end)\n}\n\n/**\n * Join segments from a path.\n *\n * @param {Array} segments\n * Path segments.\n * @returns {string}\n * File path.\n */\nfunction join(...segments) {\n let index = -1\n /** @type {string | undefined} */\n let joined\n\n while (++index < segments.length) {\n assertPath(segments[index])\n\n if (segments[index]) {\n joined =\n joined === undefined ? segments[index] : joined + '/' + segments[index]\n }\n }\n\n return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Normalize a basic file path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\n// Note: `normalize` is not exposed as `path.normalize`, so some code is\n// manually removed from it.\nfunction normalize(path) {\n assertPath(path)\n\n const absolute = path.codePointAt(0) === 47 /* `/` */\n\n // Normalize the path according to POSIX rules.\n let value = normalizeString(path, !absolute)\n\n if (value.length === 0 && !absolute) {\n value = '.'\n }\n\n if (value.length > 0 && path.codePointAt(path.length - 1) === 47 /* / */) {\n value += '/'\n }\n\n return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n * File path.\n * @param {boolean} allowAboveRoot\n * Whether `..` can move above root.\n * @returns {string}\n * File path.\n */\nfunction normalizeString(path, allowAboveRoot) {\n let result = ''\n let lastSegmentLength = 0\n let lastSlash = -1\n let dots = 0\n let index = -1\n /** @type {number | undefined} */\n let code\n /** @type {number} */\n let lastSlashIndex\n\n while (++index <= path.length) {\n if (index < path.length) {\n code = path.codePointAt(index)\n } else if (code === 47 /* `/` */) {\n break\n } else {\n code = 47 /* `/` */\n }\n\n if (code === 47 /* `/` */) {\n if (lastSlash === index - 1 || dots === 1) {\n // Empty.\n } else if (lastSlash !== index - 1 && dots === 2) {\n if (\n result.length < 2 ||\n lastSegmentLength !== 2 ||\n result.codePointAt(result.length - 1) !== 46 /* `.` */ ||\n result.codePointAt(result.length - 2) !== 46 /* `.` */\n ) {\n if (result.length > 2) {\n lastSlashIndex = result.lastIndexOf('/')\n\n if (lastSlashIndex !== result.length - 1) {\n if (lastSlashIndex < 0) {\n result = ''\n lastSegmentLength = 0\n } else {\n result = result.slice(0, lastSlashIndex)\n lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n }\n\n lastSlash = index\n dots = 0\n continue\n }\n } else if (result.length > 0) {\n result = ''\n lastSegmentLength = 0\n lastSlash = index\n dots = 0\n continue\n }\n }\n\n if (allowAboveRoot) {\n result = result.length > 0 ? result + '/..' : '..'\n lastSegmentLength = 2\n }\n } else {\n if (result.length > 0) {\n result += '/' + path.slice(lastSlash + 1, index)\n } else {\n result = path.slice(lastSlash + 1, index)\n }\n\n lastSegmentLength = index - lastSlash - 1\n }\n\n lastSlash = index\n dots = 0\n } else if (code === 46 /* `.` */ && dots > -1) {\n dots++\n } else {\n dots = -1\n }\n }\n\n return result\n}\n\n/**\n * Make sure `path` is a string.\n *\n * @param {string} path\n * File path.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n 'Path must be a string. Received ' + JSON.stringify(path)\n )\n }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// .\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const minproc = {cwd}\n\nfunction cwd() {\n return '/'\n}\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n * File path or URL.\n * @returns {fileUrlOrPath is URL}\n * Whether it’s a URL.\n */\n// From: \nexport function isUrl(fileUrlOrPath) {\n return Boolean(\n fileUrlOrPath !== null &&\n typeof fileUrlOrPath === 'object' &&\n 'href' in fileUrlOrPath &&\n fileUrlOrPath.href &&\n 'protocol' in fileUrlOrPath &&\n fileUrlOrPath.protocol &&\n // @ts-expect-error: indexing is fine.\n fileUrlOrPath.auth === undefined\n )\n}\n","import {isUrl} from './minurl.shared.js'\n\nexport {isUrl} from './minurl.shared.js'\n\n// See: \n\n/**\n * @param {URL | string} path\n * File URL.\n * @returns {string}\n * File URL.\n */\nexport function urlToPath(path) {\n if (typeof path === 'string') {\n path = new URL(path)\n } else if (!isUrl(path)) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'The \"path\" argument must be of type string or an instance of URL. Received `' +\n path +\n '`'\n )\n error.code = 'ERR_INVALID_ARG_TYPE'\n throw error\n }\n\n if (path.protocol !== 'file:') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError('The URL must be of scheme file')\n error.code = 'ERR_INVALID_URL_SCHEME'\n throw error\n }\n\n return getPathFromURLPosix(path)\n}\n\n/**\n * Get a path from a POSIX URL.\n *\n * @param {URL} url\n * URL.\n * @returns {string}\n * File path.\n */\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL host must be \"localhost\" or empty on darwin'\n )\n error.code = 'ERR_INVALID_FILE_URL_HOST'\n throw error\n }\n\n const pathname = url.pathname\n let index = -1\n\n while (++index < pathname.length) {\n if (\n pathname.codePointAt(index) === 37 /* `%` */ &&\n pathname.codePointAt(index + 1) === 50 /* `2` */\n ) {\n const third = pathname.codePointAt(index + 2)\n if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL path must not include encoded / characters'\n )\n error.code = 'ERR_INVALID_FILE_URL_PATH'\n throw error\n }\n }\n }\n\n return decodeURIComponent(pathname)\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n 'history',\n 'path',\n 'basename',\n 'stem',\n 'extname',\n 'dirname'\n])\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * `options` is treated as:\n *\n * * `string` or `Uint8Array` — `{value: options}`\n * * `URL` — `{path: options}`\n * * `VFile` — shallow copies its data over to the new file\n * * `object` — all fields are shallow copied over to the new file\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * You cannot set `dirname` or `extname` without setting either `history`,\n * `path`, `basename`, or `stem` too.\n *\n * @param {Compatible | null | undefined} [value]\n * File value.\n * @returns\n * New instance.\n */\n constructor(value) {\n /** @type {Options | VFile} */\n let options\n\n if (!value) {\n options = {}\n } else if (isUrl(value)) {\n options = {path: value}\n } else if (typeof value === 'string' || isUint8Array(value)) {\n options = {value}\n } else {\n options = value\n }\n\n /* eslint-disable no-unused-expressions */\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n *\n * @type {string}\n */\n // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n // the empty string will be overridden in the next block.\n this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n /**\n * Place to store custom info (default: `{}`).\n *\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n *\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of file paths the file moved between.\n *\n * The first is the original path and the last is the current path.\n *\n * @type {Array}\n */\n this.history = []\n\n /**\n * List of messages associated with the file.\n *\n * @type {Array}\n */\n this.messages = []\n\n /**\n * Raw value.\n *\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n /**\n * Source map.\n *\n * This type is equivalent to the `RawSourceMap` type from the `source-map`\n * module.\n *\n * @type {Map | null | undefined}\n */\n this.map\n\n /**\n * Custom, non-string, compiled, representation.\n *\n * This is used by unified to store non-string results.\n * One example is when turning markdown into React nodes.\n *\n * @type {unknown}\n */\n this.result\n\n /**\n * Whether a file was saved to disk.\n *\n * This is used by vfile reporters.\n *\n * @type {boolean}\n */\n this.stored\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const field = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (\n field in options &&\n options[field] !== undefined &&\n options[field] !== null\n ) {\n // @ts-expect-error: TS doesn’t understand basic reality.\n this[field] = field === 'history' ? [...options[field]] : options[field]\n }\n }\n\n /** @type {string} */\n let field\n\n // Set non-path related properties.\n for (field in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(field)) {\n // @ts-expect-error: fine to set other things.\n this[field] = options[field]\n }\n }\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n *\n * @returns {string | undefined}\n * Basename.\n */\n get basename() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path)\n : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} basename\n * Basename.\n * @returns {undefined}\n * Nothing.\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = minpath.join(this.dirname || '', basename)\n }\n\n /**\n * Get the parent path (example: `'~'`).\n *\n * @returns {string | undefined}\n * Dirname.\n */\n get dirname() {\n return typeof this.path === 'string'\n ? minpath.dirname(this.path)\n : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n *\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} dirname\n * Dirname.\n * @returns {undefined}\n * Nothing.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = minpath.join(dirname || '', this.basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n *\n * @returns {string | undefined}\n * Extname.\n */\n get extname() {\n return typeof this.path === 'string'\n ? minpath.extname(this.path)\n : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} extname\n * Extname.\n * @returns {undefined}\n * Nothing.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.codePointAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n *\n * @returns {string}\n * Path.\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n *\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n *\n * @param {URL | string} path\n * Path.\n * @returns {undefined}\n * Nothing.\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n *\n * @returns {string | undefined}\n * Stem.\n */\n get stem() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} stem\n * Stem.\n * @returns {undefined}\n * Nothing.\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n // Normal prototypal methods.\n /**\n * Create a fatal message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `true` (error; file not usable)\n * and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {never}\n * Never.\n * @throws {VFileMessage}\n * Message.\n */\n fail(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = true\n\n throw message\n }\n\n /**\n * Create an info message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `undefined` (info; change\n * likely not needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n info(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = undefined\n\n return message\n }\n\n /**\n * Create a message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `false` (warning; change may be\n * needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n message(causeOrReason, optionsOrParentOrPlace, origin) {\n const message = new VFileMessage(\n // @ts-expect-error: the overloads are fine.\n causeOrReason,\n optionsOrParentOrPlace,\n origin\n )\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Serialize the file.\n *\n * > **Note**: which encodings are supported depends on the engine.\n * > For info on Node.js, see:\n * > .\n *\n * @param {string | null | undefined} [encoding='utf8']\n * Character encoding to understand `value` as when it’s a `Uint8Array`\n * (default: `'utf-8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n if (this.value === undefined) {\n return ''\n }\n\n if (typeof this.value === 'string') {\n return this.value\n }\n\n const decoder = new TextDecoder(encoding || undefined)\n return decoder.decode(this.value)\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n * File path part.\n * @param {string} name\n * Part name.\n * @returns {undefined}\n * Nothing.\n */\nfunction assertPart(part, name) {\n if (part && part.includes(minpath.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n * Thing.\n * @param {string} name\n * Part name.\n * @returns {asserts part is string}\n * Nothing.\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n * Path.\n * @param {string} name\n * Dependency name.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","export const CallableInstance =\n /**\n * @type {new , Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n */\n (\n /** @type {unknown} */\n (\n /**\n * @this {Function}\n * @param {string | symbol} property\n * @returns {(...parameters: Array) => unknown}\n */\n function (property) {\n const self = this\n const constr = self.constructor\n const proto = /** @type {Record} */ (\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n constr.prototype\n )\n const value = proto[property]\n /** @type {(...parameters: Array) => unknown} */\n const apply = function () {\n return value.apply(apply, arguments)\n }\n\n Object.setPrototypeOf(apply, proto)\n\n // Not needed for us in `unified`: we only call this on the `copy`\n // function,\n // and we don't need to add its fields (`length`, `name`)\n // over.\n // See also: GH-246.\n // const names = Object.getOwnPropertyNames(value)\n //\n // for (const p of names) {\n // const descriptor = Object.getOwnPropertyDescriptor(value, p)\n // if (descriptor) Object.defineProperty(apply, p, descriptor)\n // }\n\n return apply\n }\n )\n )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n * Acceptable results from compilers.\n *\n * To register custom results, add them to\n * {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n * The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n * A **compiler** handles the compiling of a syntax tree to something else\n * (in most cases, text) (TypeScript type).\n *\n * It is used in the stringify phase and called with a {@linkcode Node}\n * and {@linkcode VFile} representation of the document to compile.\n * It should return the textual representation of the given tree (typically\n * `string`).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n * Tree to compile.\n * @param {VFile} file\n * File associated with `tree`.\n * @returns {Result}\n * New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n * something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the parser yields (default: `Node`)\n * @callback Parser\n * A **parser** handles the parsing of text to a syntax tree.\n *\n * It is used in the parse phase and is called with a `string` and\n * {@linkcode VFile} of the document to parse.\n * It must return the syntax tree representation of the given file\n * ({@linkcode Node}).\n * @param {string} document\n * Document to parse.\n * @param {VFile} file\n * File associated with `document`.\n * @returns {Tree}\n * Node representing the given file.\n */\n\n/**\n * @typedef {(\n * Plugin, any, any> |\n * PluginTuple, any, any> |\n * Preset\n * )} Pluggable\n * Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array} PluggableList\n * List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n// .\n/**\n * @template {Array} [PluginParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n * Value that is expected as input (default: `Node`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=Input]\n * Value that is yielded as output (default: `Input`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * (this: Processor, ...parameters: PluginParameters) =>\n * Input extends string ? // Parser.\n * Output extends Node | undefined ? undefined | void : never :\n * Output extends CompileResults ? // Compiler.\n * Input extends Node | undefined ? undefined | void : never :\n * Transformer<\n * Input extends Node ? Input : Node,\n * Output extends Node ? Output : Node\n * > | undefined | void\n * )} Plugin\n * Single plugin.\n *\n * Plugins configure the processors they are applied on in the following\n * ways:\n *\n * * they change the processor, such as the parser, the compiler, or by\n * configuring data\n * * they specify how to handle trees and files\n *\n * In practice, they are functions that can receive options and configure the\n * processor (`this`).\n *\n * > **Note**: plugins are called when the processor is *frozen*, not when\n * > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array} [TupleParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n * Value that is expected as input (optional).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=undefined] (optional).\n * Value that is yielded as output.\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * [\n * plugin: Plugin,\n * ...parameters: TupleParameters\n * ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n * Sharable configuration.\n *\n * They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n * List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n * Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n * The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n * Callback called when the process is done.\n *\n * Called with either an error or a result.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {File | undefined} [file]\n * Processed file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n * Callback called when transformers are done.\n *\n * Called with either an error or results.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {Tree | undefined} [tree]\n * Transformed tree (optional).\n * @param {VFile | undefined} [file]\n * File (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n * Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n * Callback passed to transforms.\n *\n * If the signature of a `transformer` accepts a third argument, the\n * transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n * Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n * New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n * New, changed, file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n * Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n * Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n * Transformers handle syntax trees and files.\n *\n * They are functions that are called each time a syntax tree and file are\n * passed through the run phase.\n * When an error occurs in them (either because it’s thrown, returned,\n * rejected, or passed to `next`), the process stops.\n *\n * The run phase is handled by [`trough`][trough], see its documentation for\n * the exact semantics of these functions.\n *\n * > **Note**: you should likely ignore `next`: don’t accept it.\n * > it supports callback-style async work.\n * > But promises are likely easier to reason about.\n *\n * [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n * Tree to handle.\n * @param {VFile} file\n * File to handle.\n * @param {TransformCallback} next\n * Callback.\n * @returns {(\n * Promise |\n * Promise | // For some reason this is needed separately.\n * Output |\n * Error |\n * undefined |\n * void\n * )}\n * If you accept `next`, nothing.\n * Otherwise:\n *\n * * `Error` — fatal error to stop the process\n * * `Promise` or `undefined` — the next transformer keeps using\n * same tree\n * * `Promise` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n * Output of `parse`.\n * @template {Node | undefined} HeadTree\n * Input for `run`.\n * @template {Node | undefined} TailTree\n * Output for `run`.\n * @template {Node | undefined} CompileTree\n * Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n * Output of `stringify`.\n * @template {Node | string | undefined} Input\n * Input of plugin.\n * @template Output\n * Output of plugin (optional).\n * @typedef {(\n * Input extends string\n * ? Output extends Node | undefined\n * ? // Parser.\n * Processor<\n * Output extends undefined ? ParseTree : Output,\n * HeadTree,\n * TailTree,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : Output extends CompileResults\n * ? Input extends Node | undefined\n * ? // Compiler.\n * Processor<\n * ParseTree,\n * HeadTree,\n * TailTree,\n * Input extends undefined ? CompileTree : Input,\n * Output extends undefined ? CompileResult : Output\n * >\n * : // Unknown.\n * Processor\n * : Input extends Node | undefined\n * ? Output extends Node | undefined\n * ? // Transform.\n * Processor<\n * ParseTree,\n * HeadTree extends undefined ? Input : HeadTree,\n * Output extends undefined ? TailTree : Output,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : // Unknown.\n * Processor\n * )} UsePlugin\n * Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n * Node type that the transformer yields.\n * @typedef {(\n * Result extends Value | undefined ?\n * VFile :\n * VFile & {result: Result}\n * )} VFileWithOutput\n * Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n * If a result that is not acceptable on a `VFile` is used, that will\n * be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n * Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n * Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n * Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n * Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n * Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor>}\n */\nexport class Processor extends CallableInstance {\n /**\n * Create a processor.\n */\n constructor() {\n // If `Processor()` is called (w/o new), `copy` is called instead.\n super('copy')\n\n /**\n * Compiler to use (deprecated).\n *\n * @deprecated\n * Use `compiler` instead.\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.Compiler = undefined\n\n /**\n * Parser to use (deprecated).\n *\n * @deprecated\n * Use `parser` instead.\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.Parser = undefined\n\n // Note: the following fields are considered private.\n // However, they are needed for tests, and TSC generates an untyped\n // `private freezeIndex` field for, which trips `type-coverage` up.\n // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n /**\n * Internal list of configured plugins.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Array>>}\n */\n this.attachers = []\n\n /**\n * Compiler to use.\n *\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.compiler = undefined\n\n /**\n * Internal state to track where we are while freezing.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {number}\n */\n this.freezeIndex = -1\n\n /**\n * Internal state to track whether we’re frozen.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {boolean | undefined}\n */\n this.frozen = undefined\n\n /**\n * Internal state.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Data}\n */\n this.namespace = {}\n\n /**\n * Parser to use.\n *\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.parser = undefined\n\n /**\n * Internal list of configured transformers.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Pipeline}\n */\n this.transformers = trough()\n }\n\n /**\n * Copy a processor.\n *\n * @deprecated\n * This is a private internal method and should not be used.\n * @returns {Processor}\n * New *unfrozen* processor ({@linkcode Processor}) that is\n * configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\n copy() {\n // Cast as the type parameters will be the same after attaching.\n const destination =\n /** @type {Processor} */ (\n new Processor()\n )\n let index = -1\n\n while (++index < this.attachers.length) {\n const attacher = this.attachers[index]\n destination.use(...attacher)\n }\n\n destination.data(extend(true, {}, this.namespace))\n\n return destination\n }\n\n /**\n * Configure the processor with info available to all plugins.\n * Information is stored in an object.\n *\n * Typically, options can be given to a specific plugin, but sometimes it\n * makes sense to have information shared with several plugins.\n * For example, a list of HTML elements that are self-closing, which is\n * needed during all phases.\n *\n * > **Note**: setting information cannot occur on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * > **Note**: to register custom data in TypeScript, augment the\n * > {@linkcode Data} interface.\n *\n * @example\n * This example show how to get and set info:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * const processor = unified().data('alpha', 'bravo')\n *\n * processor.data('alpha') // => 'bravo'\n *\n * processor.data() // => {alpha: 'bravo'}\n *\n * processor.data({charlie: 'delta'})\n *\n * processor.data() // => {charlie: 'delta'}\n * ```\n *\n * @template {keyof Data} Key\n *\n * @overload\n * @returns {Data}\n *\n * @overload\n * @param {Data} dataset\n * @returns {Processor}\n *\n * @overload\n * @param {Key} key\n * @returns {Data[Key]}\n *\n * @overload\n * @param {Key} key\n * @param {Data[Key]} value\n * @returns {Processor}\n *\n * @param {Data | Key} [key]\n * Key to get or set, or entire dataset to set, or nothing to get the\n * entire dataset (optional).\n * @param {Data[Key]} [value]\n * Value to set (optional).\n * @returns {unknown}\n * The current processor when setting, the value at `key` when getting, or\n * the entire dataset when getting without key.\n */\n data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', this.frozen)\n this.namespace[key] = value\n return this\n }\n\n // Get `key`.\n return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', this.frozen)\n this.namespace = key\n return this\n }\n\n // Get space.\n return this.namespace\n }\n\n /**\n * Freeze a processor.\n *\n * Frozen processors are meant to be extended and not to be configured\n * directly.\n *\n * When a processor is frozen it cannot be unfrozen.\n * New processors working the same way can be created by calling the\n * processor.\n *\n * It’s possible to freeze processors explicitly by calling `.freeze()`.\n * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n * `.stringify()`, `.process()`, or `.processSync()` are called.\n *\n * @returns {Processor}\n * The current processor.\n */\n freeze() {\n if (this.frozen) {\n return this\n }\n\n // Cast so that we can type plugins easier.\n // Plugins are supposed to be usable on different processors, not just on\n // this exact processor.\n const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n while (++this.freezeIndex < this.attachers.length) {\n const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n const transformer = attacher.call(self, ...options)\n\n if (typeof transformer === 'function') {\n this.transformers.use(transformer)\n }\n }\n\n this.frozen = true\n this.freezeIndex = Number.POSITIVE_INFINITY\n\n return this\n }\n\n /**\n * Parse text to a syntax tree.\n *\n * > **Note**: `parse` freezes the processor if not already *frozen*.\n *\n * > **Note**: `parse` performs the parse phase, not the run phase or other\n * > phases.\n *\n * @param {Compatible | undefined} [file]\n * file to parse (optional); typically `string` or `VFile`; any value\n * accepted as `x` in `new VFile(x)`.\n * @returns {ParseTree extends undefined ? Node : ParseTree}\n * Syntax tree representing `file`.\n */\n parse(file) {\n this.freeze()\n const realFile = vfile(file)\n const parser = this.parser || this.Parser\n assertParser('parse', parser)\n return parser(String(realFile), realFile)\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * > **Note**: `process` freezes the processor if not already *frozen*.\n *\n * > **Note**: `process` performs the parse, run, and stringify phases.\n *\n * @overload\n * @param {Compatible | undefined} file\n * @param {ProcessCallback>} done\n * @returns {undefined}\n *\n * @overload\n * @param {Compatible | undefined} [file]\n * @returns {Promise>}\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`]; any value accepted as\n * `x` in `new VFile(x)`.\n * @param {ProcessCallback> | undefined} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise a promise, rejected with a fatal error or resolved with the\n * processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n process(file, done) {\n const self = this\n\n this.freeze()\n assertParser('process', this.parser || this.Parser)\n assertCompiler('process', this.compiler || this.Compiler)\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {((file: VFileWithOutput) => undefined | void) | undefined} resolve\n * @param {(error: Error | undefined) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n const realFile = vfile(file)\n // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n // input of the first transform).\n const parseTree =\n /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n /** @type {unknown} */ (self.parse(realFile))\n )\n\n self.run(parseTree, realFile, function (error, tree, file) {\n if (error || !tree || !file) {\n return realDone(error)\n }\n\n // Assume `TailTree` (the output of the last transform) matches\n // `CompileTree` (the input of the compiler).\n const compileTree =\n /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n /** @type {unknown} */ (tree)\n )\n\n const compileResult = self.stringify(compileTree, file)\n\n if (looksLikeAValue(compileResult)) {\n file.value = compileResult\n } else {\n file.result = compileResult\n }\n\n realDone(error, /** @type {VFileWithOutput} */ (file))\n })\n\n /**\n * @param {Error | undefined} error\n * @param {VFileWithOutput | undefined} [file]\n * @returns {undefined}\n */\n function realDone(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, file)\n }\n }\n }\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `processSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `processSync` performs the parse, run, and stringify phases.\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`; any value accepted as\n * `x` in `new VFile(x)`.\n * @returns {VFileWithOutput}\n * The processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n processSync(file) {\n /** @type {boolean} */\n let complete = false\n /** @type {VFileWithOutput | undefined} */\n let result\n\n this.freeze()\n assertParser('processSync', this.parser || this.Parser)\n assertCompiler('processSync', this.compiler || this.Compiler)\n\n this.process(file, realDone)\n assertDone('processSync', 'process', complete)\n assert(result, 'we either bailed on an error or have a tree')\n\n return result\n\n /**\n * @type {ProcessCallback>}\n */\n function realDone(error, file) {\n complete = true\n bail(error)\n result = file\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * > **Note**: `run` freezes the processor if not already *frozen*.\n *\n * > **Note**: `run` performs the run phase, not other phases.\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} file\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} [file]\n * @returns {Promise}\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {(\n * RunCallback |\n * Compatible\n * )} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @param {RunCallback} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise, a promise rejected with a fatal error or resolved with the\n * transformed tree.\n */\n run(tree, file, done) {\n assertNode(tree)\n this.freeze()\n\n const transformers = this.transformers\n\n if (!done && typeof file === 'function') {\n done = file\n file = undefined\n }\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {(\n * ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n * undefined\n * )} resolve\n * @param {(error: Error) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n assert(\n typeof file !== 'function',\n '`file` can’t be a `done` anymore, we checked'\n )\n const realFile = vfile(file)\n transformers.run(tree, realFile, realDone)\n\n /**\n * @param {Error | undefined} error\n * @param {Node} outputTree\n * @param {VFile} file\n * @returns {undefined}\n */\n function realDone(error, outputTree, file) {\n const resultingTree =\n /** @type {TailTree extends undefined ? Node : TailTree} */ (\n outputTree || tree\n )\n\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(resultingTree)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, resultingTree, file)\n }\n }\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `runSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `runSync` performs the run phase, not other phases.\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {TailTree extends undefined ? Node : TailTree}\n * Transformed tree.\n */\n runSync(tree, file) {\n /** @type {boolean} */\n let complete = false\n /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n let result\n\n this.run(tree, file, realDone)\n\n assertDone('runSync', 'run', complete)\n assert(result, 'we either bailed on an error or have a tree')\n return result\n\n /**\n * @type {RunCallback}\n */\n function realDone(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * Compile a syntax tree.\n *\n * > **Note**: `stringify` freezes the processor if not already *frozen*.\n *\n * > **Note**: `stringify` performs the stringify phase, not the run phase\n * > or other phases.\n *\n * @param {CompileTree extends undefined ? Node : CompileTree} tree\n * Tree to compile.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {CompileResult extends undefined ? Value : CompileResult}\n * Textual representation of the tree (see note).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n stringify(tree, file) {\n this.freeze()\n const realFile = vfile(file)\n const compiler = this.compiler || this.Compiler\n assertCompiler('stringify', compiler)\n assertNode(tree)\n\n return compiler(tree, realFile)\n }\n\n /**\n * Configure the processor to use a plugin, a list of usable values, or a\n * preset.\n *\n * If the processor is already using a plugin, the previous plugin\n * configuration is changed based on the options that are passed in.\n * In other words, the plugin is not added a second time.\n *\n * > **Note**: `use` cannot be called on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * @example\n * There are many ways to pass plugins to `.use()`.\n * This example gives an overview:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * unified()\n * // Plugin with options:\n * .use(pluginA, {x: true, y: true})\n * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n * .use(pluginA, {y: false, z: true})\n * // Plugins:\n * .use([pluginB, pluginC])\n * // Two plugins, the second with options:\n * .use([pluginD, [pluginE, {}]])\n * // Preset with plugins and settings:\n * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n * // Settings only:\n * .use({settings: {position: false}})\n * ```\n *\n * @template {Array} [Parameters=[]]\n * @template {Node | string | undefined} [Input=undefined]\n * @template [Output=Input]\n *\n * @overload\n * @param {Preset | null | undefined} [preset]\n * @returns {Processor}\n *\n * @overload\n * @param {PluggableList} list\n * @returns {Processor}\n *\n * @overload\n * @param {Plugin} plugin\n * @param {...(Parameters | [boolean])} parameters\n * @returns {UsePlugin}\n *\n * @param {PluggableList | Plugin | Preset | null | undefined} value\n * Usable value.\n * @param {...unknown} parameters\n * Parameters, when a plugin is given as a usable value.\n * @returns {Processor}\n * Current processor.\n */\n use(value, ...parameters) {\n const attachers = this.attachers\n const namespace = this.namespace\n\n assertUnfrozen('use', this.frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, parameters)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n return this\n\n /**\n * @param {Pluggable} value\n * @returns {undefined}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value, [])\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...parameters] =\n /** @type {PluginTuple>} */ (value)\n addPlugin(plugin, parameters)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {undefined}\n */\n function addPreset(result) {\n if (!('plugins' in result) && !('settings' in result)) {\n throw new Error(\n 'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n )\n }\n\n addList(result.plugins)\n\n if (result.settings) {\n namespace.settings = extend(true, namespace.settings, result.settings)\n }\n }\n\n /**\n * @param {PluggableList | null | undefined} plugins\n * @returns {undefined}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {Array} parameters\n * @returns {undefined}\n */\n function addPlugin(plugin, parameters) {\n let index = -1\n let entryIndex = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entryIndex = index\n break\n }\n }\n\n if (entryIndex === -1) {\n attachers.push([plugin, ...parameters])\n }\n // Only set if there was at least a `primary` value, otherwise we’d change\n // `arguments.length`.\n else if (parameters.length > 0) {\n let [primary, ...rest] = parameters\n const currentPrimary = attachers[entryIndex][1]\n if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n primary = extend(true, currentPrimary, primary)\n }\n\n attachers[entryIndex] = [plugin, primary, ...rest]\n }\n }\n }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n * This example shows how a new processor can be created (from `remark`) and linked\n * to **stdin**(4) and **stdout**(4).\n *\n * ```js\n * import process from 'node:process'\n * import concatStream from 'concat-stream'\n * import {remark} from 'remark'\n *\n * process.stdin.pipe(\n * concatStream(function (buf) {\n * process.stdout.write(String(remark().processSync(buf)))\n * })\n * )\n * ```\n *\n * @returns\n * New *unfrozen* processor (`processor`).\n *\n * This processor is configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n/**\n * @module public\n */\nimport { loadState } from '@nextcloud/initial-state';\n/**\n * Check if the current page is on a public share\n */\nexport function isPublicShare() {\n // check both the new initial state version and fallback to legacy input\n return (loadState('files_sharing', 'isPublic', null)\n ?? document.querySelector('input#isPublic[type=\"hidden\"][name=\"isPublic\"][value=\"1\"]') !== null);\n}\n/**\n * Get the sharing token for the current public share\n */\nexport function getSharingToken() {\n return (loadState('files_sharing', 'sharingToken', null)\n ?? document.querySelector('input#sharingToken[type=\"hidden\"]')?.value\n ?? null);\n}\n","import { l as logger } from \"./logger.mjs\";\nwindow._vue_richtext_widgets ??= {};\nwindow._registerWidget ??= (id, callback, onDestroy, props) => {\n registerWidget(id, callback, onDestroy, props);\n};\nfunction registerWidget(id, callback, onDestroy = () => {\n}, props) {\n const propsWithDefaults = {\n hasInteractiveView: true,\n fullWidth: false,\n isResizable: false,\n ...props\n };\n if (window._vue_richtext_widgets[id]) {\n logger.error(`[ReferencePicker]: Widget for id ${id} already registered`);\n return;\n }\n window._vue_richtext_widgets[id] = {\n id,\n callback,\n onDestroy,\n ...propsWithDefaults\n };\n}\nfunction renderWidget(el, options) {\n const { richObjectType, richObject, accessible, interactive } = options;\n if (richObjectType === \"open-graph\") {\n return;\n }\n if (!window._vue_richtext_widgets[richObjectType]) {\n logger.error(\"Widget for rich object type \" + richObjectType + \" not registered\");\n return;\n }\n window._vue_richtext_widgets[richObjectType].callback(el, { richObjectType, richObject, accessible, interactive });\n}\nfunction destroyWidget(richObjectType, el) {\n if (richObjectType === \"open-graph\") {\n return;\n }\n if (!window._vue_richtext_widgets[richObjectType]) {\n return;\n }\n window._vue_richtext_widgets[richObjectType].onDestroy(el);\n}\nfunction isWidgetRegistered(id) {\n return !!window._vue_richtext_widgets[id];\n}\nfunction hasInteractiveView(id) {\n return !!window._vue_richtext_widgets[id]?.hasInteractiveView;\n}\nfunction hasFullWidth(id) {\n return !!window._vue_richtext_widgets[id]?.fullWidth;\n}\nfunction isResizable(id) {\n return !!window._vue_richtext_widgets[id]?.isResizable;\n}\nexport {\n renderWidget as a,\n hasFullWidth as b,\n isResizable as c,\n destroyWidget as d,\n hasInteractiveView as h,\n isWidgetRegistered as i,\n registerWidget as r\n};\n//# sourceMappingURL=widgets.mjs.map\n","/**\n * @typedef {import('unist').Node} Node\n */\n\n/**\n * @typedef {Array | string} ChildrenOrValue\n * List to use as `children` or value to use as `value`.\n *\n * @typedef {Record} Props\n * Other fields to add to the node.\n */\n\n/**\n * Build a node.\n *\n * @template {string} T\n * @template {Props} P\n * @template {Array} C\n *\n * @overload\n * @param {T} type\n * @returns {{type: T}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @returns {{type: T} & P}\n *\n * @overload\n * @param {T} type\n * @param {string} value\n * @returns {{type: T, value: string}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @param {string} value\n * @returns {{type: T, value: string} & P}\n *\n * @overload\n * @param {T} type\n * @param {C} children\n * @returns {{type: T, children: C}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @param {C} children\n * @returns {{type: T, children: C} & P}\n *\n * @param {string} type\n * Node type.\n * @param {ChildrenOrValue | Props | null | undefined} [props]\n * Fields assigned to node (default: `undefined`).\n * @param {ChildrenOrValue | null | undefined} [value]\n * Children of node or value of `node` (cast to string).\n * @returns {Node}\n * Built node.\n */\nexport function u(type, props, value) {\n /** @type {Node} */\n const node = {type: String(type)}\n\n if (\n (value === undefined || value === null) &&\n (typeof props === 'string' || Array.isArray(props))\n ) {\n value = props\n } else {\n Object.assign(node, props)\n }\n\n if (Array.isArray(value)) {\n // @ts-expect-error: create a parent.\n node.children = value\n } else if (value !== undefined && value !== null) {\n // @ts-expect-error: create a literal.\n node.value = String(value)\n }\n\n return node\n}\n","import '../assets/autolink.css';\nimport { getBaseUrl, getRootUrl } from \"@nextcloud/router\";\nimport { u } from \"unist-builder\";\nimport { visitParents, SKIP } from \"unist-util-visit-parents\";\nimport { defineComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString } from \"vue\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nconst _hoisted_1 = [\"href\"];\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcRichTextExternalLink\",\n props: {\n href: {},\n decorateExternal: { type: Boolean, default: false }\n },\n setup(__props) {\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"a\", {\n href: __props.href,\n rel: \"noopener noreferrer\",\n target: \"_blank\",\n class: normalizeClass([_ctx.$style.externalLink, {\n [_ctx.$style.externalLink_decorated]: __props.decorateExternal\n }])\n }, [\n renderSlot(_ctx.$slots, \"default\", {}, () => [\n createTextVNode(toDisplayString(__props.href), 1)\n ])\n ], 10, _hoisted_1);\n };\n }\n});\nconst externalLink = \"_externalLink_b-KZi\";\nconst externalLink_decorated = \"_externalLink_decorated_wcK-p\";\nconst style0 = {\n \"material-design-icon\": \"_material-design-icon_9-SDv\",\n externalLink,\n externalLink_decorated\n};\nconst cssModules = {\n \"$style\": style0\n};\nconst NcRichTextExternalLink = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__cssModules\", cssModules]]);\n/*!\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst URL_PATTERN = /(\\s|^)(https?:\\/\\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\\s|$)/ig;\nconst URL_PATTERN_AUTOLINK = /(\\s|\\(|^)((https?:\\/\\/)([-A-Z0-9+_.]+[-A-Z0-9]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*))(?=\\s|\\)|$)/ig;\nfunction remarkAutolink({ autolink, useMarkdown, useExtendedMarkdown }) {\n return function(tree) {\n if (useExtendedMarkdown || !useMarkdown || !autolink) {\n return;\n }\n visitParents(tree, (node) => node.type === \"text\", (node, ancestors) => {\n if (ancestors.some((ancestor) => ancestor.type === \"link\" || ancestor.type === \"linkReference\")) {\n return;\n }\n const parent = ancestors.at(-1);\n const index = parent.children.indexOf(node) ?? 0;\n const parsed = parseUrl(node.value);\n const parsedNodes = typeof parsed === \"string\" ? [u(\"text\", parsed)] : parsed.map((n) => {\n if (typeof n === \"string\") {\n return u(\"text\", n);\n }\n return u(\"link\", {\n url: n.props.href\n }, [u(\"text\", n.props.href)]);\n }).filter((x) => x).flat();\n parent.children.splice(index, 1, ...parsedNodes);\n return [SKIP, index + parsedNodes.length];\n });\n };\n}\nfunction parseUrl(text) {\n let match = URL_PATTERN_AUTOLINK.exec(text);\n const list = [];\n let start = 0;\n while (match !== null) {\n let href = match[2];\n let textAfter;\n let textBefore = text.substring(start, match.index + match[1].length);\n if (href[0] === \" \") {\n textBefore += href[0];\n href = href.substring(1).trim();\n }\n const lastChar = href[href.length - 1];\n if (lastChar === \".\" || lastChar === \",\" || lastChar === \";\" || match[0][0] === \"(\" && lastChar === \")\") {\n href = href.substring(0, href.length - 1);\n textAfter = lastChar;\n }\n list.push(textBefore);\n list.push({ component: NcRichTextExternalLink, props: { href: href.trim(), decorateExternal: true } });\n if (textAfter) {\n list.push(textAfter);\n }\n start = match.index + match[0].length;\n match = URL_PATTERN_AUTOLINK.exec(text);\n }\n list.push(text.substring(start));\n const joinedText = list.map((item) => typeof item === \"string\" ? item : item.props.href).join(\"\");\n if (text === joinedText) {\n return list;\n }\n logger.error(\"[NcRichText] Failed to reassemble the chunked text: \" + text);\n return text;\n}\nfunction getRoute(router, url) {\n const removePrefix = (str, prefix) => str.startsWith(prefix) ? str.slice(prefix.length) : str;\n const removePrefixes = (str, ...prefixes) => prefixes.reduce((acc, prefix) => removePrefix(acc, prefix), str);\n if (!router) {\n return null;\n }\n const isAbsoluteURL = /^https?:\\/\\//.test(url);\n const isNonHttpLink = /^[a-z][a-z0-9+.-]*:.+/.test(url);\n if (!isAbsoluteURL && isNonHttpLink) {\n return null;\n }\n if (isAbsoluteURL && !url.startsWith(getBaseUrl())) {\n return null;\n }\n if (!isAbsoluteURL && !url.startsWith(\"/\")) {\n return null;\n }\n const relativeUrl = isAbsoluteURL ? removePrefixes(url, getBaseUrl(), \"/index.php\") : url;\n const relativeRouterBase = removePrefixes(router.options.history.base, getRootUrl(), \"/index.php\");\n const potentialRouterPath = removePrefixes(relativeUrl, relativeRouterBase) || \"/\";\n const route = router.resolve(potentialRouterPath);\n if (!route.matched.length) {\n return null;\n }\n return route.fullPath;\n}\nexport {\n NcRichTextExternalLink as N,\n URL_PATTERN as U,\n getRoute as g,\n parseUrl as p,\n remarkAutolink as r\n};\n//# sourceMappingURL=autolink.mjs.map\n","import '../assets/NcReferenceWidget.css';\nimport { defineComponent, inject, ref, useTemplateRef, nextTick, computed, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, withKeys, withModifiers, unref, createCommentVNode, createBlock, resolveDynamicComponent, mergeProps, withCtx, toDisplayString, createTextVNode } from \"vue\";\nimport { useElementSize, useIntersectionObserver } from \"@vueuse/core\";\nimport { routerKey, RouterLink } from \"vue-router\";\nimport { N as NcButton } from \"./NcButton.mjs\";\nimport { r as register, m as t25, a as t } from \"./_l10n.mjs\";\nimport { c as createElementId } from \"./createElementId.mjs\";\nimport { b as hasFullWidth, c as isResizable, i as isWidgetRegistered, h as hasInteractiveView, a as renderWidget, d as destroyWidget } from \"./widgets.mjs\";\nimport { g as getRoute } from \"./autolink.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nregister(t25);\nconst _hoisted_1 = [\"aria-label\", \"aria-valuenow\", \"aria-valuemin\", \"aria-valuemax\"];\nconst _hoisted_2 = [\"src\"];\nconst _hoisted_3 = { class: \"widget-default--details\" };\nconst _hoisted_4 = { class: \"widget-default--name\" };\nconst _hoisted_5 = { class: \"widget-default--link\" };\nconst IDLE_TIMEOUT = 3 * 60 * 1e3;\nconst RESIZE_KEYBOARD_STEP = 10;\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcReferenceWidget\",\n props: {\n reference: {},\n interactive: { type: Boolean, default: true },\n interactiveOptIn: { type: Boolean, default: false }\n },\n setup(__props) {\n const props = __props;\n const router = inject(routerKey, null);\n const widgetId = `nc-reference-widget-${createElementId()}`;\n const isVisible = ref(false);\n const customWidget = useTemplateRef(\"customWidget\");\n const customWidgetContent = useTemplateRef(\"customWidgetContent\");\n const widgetRoot = useTemplateRef(\"widgetRoot\");\n const { width } = useElementSize(widgetRoot);\n const { height: customWidgetHeight } = useElementSize(customWidget);\n useIntersectionObserver(widgetRoot, ([entry]) => {\n nextTick(() => {\n isVisible.value = entry.isIntersecting;\n });\n });\n const showInteractive = ref(false);\n const rendered = ref(false);\n let idleTimeout = null;\n const isResizing = ref(false);\n const resizedHeight = ref(null);\n const resizeStartY = ref(0);\n const resizeStartHeight = ref(0);\n const resizeMinHeight = ref(100);\n const resizeMaxHeight = ref(window.innerHeight - 120);\n const isInteractive = computed(() => {\n return !props.interactiveOptIn && props.interactive || showInteractive.value;\n });\n const referenceHasFullWidth = computed(() => {\n return hasFullWidth(props.reference.richObjectType);\n });\n const isWidgetResizable = computed(() => {\n return isResizable(props.reference.richObjectType);\n });\n const hasCustomWidget = computed(() => {\n return isWidgetRegistered(props.reference.richObjectType);\n });\n const customWidgetStyle = computed(() => {\n if (!resizedHeight.value) {\n return null;\n }\n return { height: `${resizedHeight.value}px !important` };\n });\n const ariaValueNow = computed(() => {\n return Math.round(resizedHeight.value ?? customWidgetHeight.value);\n });\n const referenceHasInteractiveView = computed(() => {\n return hasCustomWidget.value && hasInteractiveView(props.reference.richObjectType);\n });\n const noAccess = computed(() => {\n return !props.reference.accessible;\n });\n const numberOfLines = computed(() => {\n const lineCountOffsets = [450, 550, 650, Infinity];\n return lineCountOffsets.findIndex((max) => width.value < max);\n });\n const descriptionStyle = computed(() => {\n if (numberOfLines.value === 0) {\n return {\n display: \"none\"\n };\n }\n const lineClamp = numberOfLines.value;\n return {\n lineClamp,\n webkitLineClamp: lineClamp\n };\n });\n const compactLink = computed(() => {\n const link = props.reference.openGraphObject.link;\n if (!link) {\n return \"\";\n }\n if (link.startsWith(\"https://\")) {\n return link.substring(8);\n }\n if (link.startsWith(\"http://\")) {\n return link.substring(7);\n }\n return link;\n });\n const route = computed(() => {\n return getRoute(router, props.reference.openGraphObject.link);\n });\n const referenceWidgetLinkComponent = computed(() => {\n return route.value ? RouterLink : \"a\";\n });\n const referenceWidgetLinkProps = computed(() => {\n return route.value ? { to: route.value } : { href: props.reference.openGraphObject.link, target: \"_blank\" };\n });\n watch(isVisible, (val) => {\n if (!val) {\n idleTimeout = setTimeout(() => {\n if (!isVisible.value) {\n destroyReferenceWidget();\n }\n }, IDLE_TIMEOUT);\n return;\n }\n if (idleTimeout) {\n clearTimeout(idleTimeout);\n idleTimeout = null;\n }\n if (!rendered.value) {\n renderReferenceWidget();\n }\n }, { immediate: true });\n onBeforeUnmount(() => {\n if (idleTimeout) {\n clearTimeout(idleTimeout);\n idleTimeout = null;\n }\n stopResize();\n destroyReferenceWidget();\n });\n function enableInteractive() {\n showInteractive.value = true;\n renderReferenceWidget();\n }\n function renderReferenceWidget() {\n if (!customWidgetContent.value) {\n return;\n }\n if (props.reference.richObjectType === \"open-graph\") {\n return;\n }\n customWidgetContent.value.innerHTML = \"\";\n const widget = document.createElement(\"div\");\n widget.style.width = \"100%\";\n customWidgetContent.value.appendChild(widget);\n nextTick(() => {\n renderWidget(widget, {\n ...props.reference,\n interactive: isInteractive.value\n });\n rendered.value = true;\n });\n }\n function destroyReferenceWidget() {\n if (rendered.value && widgetRoot.value) {\n destroyWidget(props.reference.richObjectType, widgetRoot.value);\n rendered.value = false;\n }\n }\n function initResizeLimits() {\n const widgetEl = customWidgetContent.value?.firstElementChild;\n if (widgetEl) {\n const computedStyle = window.getComputedStyle(widgetEl);\n const parsedMin = parseFloat(computedStyle.minHeight);\n const parsedMax = parseFloat(computedStyle.maxHeight);\n resizeMinHeight.value = parsedMin > 0 ? parsedMin : 100;\n resizeMaxHeight.value = Number.isFinite(parsedMax) && parsedMax > 0 ? parsedMax : window.innerHeight - 120;\n } else {\n resizeMinHeight.value = 100;\n resizeMaxHeight.value = window.innerHeight - 120;\n }\n }\n function startResize(event) {\n if (!isWidgetResizable.value || !customWidget.value) {\n return;\n }\n initResizeLimits();\n isResizing.value = true;\n resizeStartY.value = event.clientY;\n resizeStartHeight.value = customWidget.value.getBoundingClientRect().height;\n window.addEventListener(\"pointermove\", onResize);\n window.addEventListener(\"pointerup\", stopResize);\n }\n function onResizeKeydown(delta) {\n if (!isWidgetResizable.value || !customWidget.value) {\n return;\n }\n initResizeLimits();\n const currentHeight = resizedHeight.value ?? resizeStartHeight.value;\n const next = currentHeight + delta;\n resizedHeight.value = Math.min(resizeMaxHeight.value, Math.max(resizeMinHeight.value, next));\n }\n function onResize(event) {\n if (!isResizing.value || !customWidget.value) {\n return;\n }\n const deltaY = event.clientY - resizeStartY.value;\n resizedHeight.value = Math.min(resizeMaxHeight.value, Math.max(resizeMinHeight.value, resizeStartHeight.value + deltaY));\n }\n function stopResize() {\n if (!isResizing.value) {\n return;\n }\n isResizing.value = false;\n window.removeEventListener(\"pointermove\", onResize);\n window.removeEventListener(\"pointerup\", stopResize);\n }\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", {\n ref_key: \"widgetRoot\",\n ref: widgetRoot,\n class: normalizeClass({ \"toggle-interactive\": referenceHasInteractiveView.value && !isInteractive.value })\n }, [\n __props.reference && hasCustomWidget.value ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n id: widgetId,\n ref_key: \"customWidget\",\n ref: customWidget,\n class: normalizeClass([\"widget-custom\", { \"full-width\": referenceHasFullWidth.value }]),\n style: normalizeStyle(customWidgetStyle.value)\n }, [\n createElementVNode(\"div\", {\n ref_key: \"customWidgetContent\",\n ref: customWidgetContent,\n class: \"widget-custom__content\"\n }, null, 512),\n isWidgetResizable.value ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: \"widget-custom__resize-handle\",\n role: \"slider\",\n tabindex: \"0\",\n \"aria-orientation\": \"vertical\",\n \"aria-label\": unref(t)(\"Widget height\"),\n \"aria-valuenow\": ariaValueNow.value,\n \"aria-valuemin\": resizeMinHeight.value,\n \"aria-valuemax\": resizeMaxHeight.value,\n \"aria-controls\": widgetId,\n onPointerdown: withModifiers(startResize, [\"stop\", \"prevent\"]),\n onKeydown: [\n _cache[0] || (_cache[0] = withKeys(withModifiers(($event) => onResizeKeydown(-RESIZE_KEYBOARD_STEP), [\"stop\", \"prevent\"]), [\"up\"])),\n _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => onResizeKeydown(RESIZE_KEYBOARD_STEP), [\"stop\", \"prevent\"]), [\"down\"]))\n ]\n }, null, 40, _hoisted_1)) : createCommentVNode(\"\", true)\n ], 6)) : !noAccess.value && __props.reference && __props.reference.openGraphObject && !hasCustomWidget.value ? (openBlock(), createBlock(resolveDynamicComponent(referenceWidgetLinkComponent.value), mergeProps({ key: 1 }, referenceWidgetLinkProps.value, {\n rel: \"noopener noreferrer\",\n class: \"widget-default\"\n }), {\n default: withCtx(() => [\n __props.reference.openGraphObject.thumb ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"widget-default--image\",\n src: __props.reference.openGraphObject.thumb\n }, null, 8, _hoisted_2)) : createCommentVNode(\"\", true),\n createElementVNode(\"div\", _hoisted_3, [\n createElementVNode(\"p\", _hoisted_4, toDisplayString(__props.reference.openGraphObject.name), 1),\n createElementVNode(\"p\", {\n class: \"widget-default--description\",\n style: normalizeStyle(descriptionStyle.value)\n }, toDisplayString(__props.reference.openGraphObject.description), 5),\n createElementVNode(\"p\", _hoisted_5, toDisplayString(compactLink.value), 1)\n ])\n ]),\n _: 1\n }, 16)) : createCommentVNode(\"\", true),\n __props.interactiveOptIn && referenceHasInteractiveView.value && !isInteractive.value ? (openBlock(), createBlock(NcButton, {\n key: 2,\n class: \"toggle-interactive--button\",\n onClick: enableInteractive\n }, {\n default: withCtx(() => [\n createTextVNode(toDisplayString(unref(t)(\"Enable interactive view\")), 1)\n ]),\n _: 1\n })) : createCommentVNode(\"\", true)\n ], 2);\n };\n }\n});\nconst NcReferenceWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-4b144346\"]]);\nexport {\n NcReferenceWidget as N\n};\n//# sourceMappingURL=NcReferenceWidget.mjs.map\n","import { d as mdiCheck, e as mdiContentCopy } from \"./mdi.mjs\";\nimport { ref, computed, toValue } from \"vue\";\nimport { r as register, e as t23, a as t } from \"./_l10n.mjs\";\nregister(t23);\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst DELAY = 2e3;\nfunction useCopy(content) {\n const isCopied = ref(false);\n const icon = computed(() => isCopied.value ? mdiCheck : mdiContentCopy);\n const altText = computed(() => isCopied.value ? t(\"Copied\") : t(\"Copy to clipboard\"));\n async function copy() {\n if (isCopied.value) {\n return;\n }\n const value = toValue(content);\n try {\n await navigator.clipboard.writeText(value);\n } catch {\n prompt(\"\", value);\n }\n isCopied.value = true;\n setTimeout(() => {\n isCopied.value = false;\n }, DELAY);\n }\n return {\n isCopied,\n copy,\n icon,\n altText\n };\n}\nexport {\n useCopy as u\n};\n//# sourceMappingURL=useCopy.mjs.map\n","import '../assets/NcRichText.css';\nimport { toString } from \"mdast-util-to-string\";\nimport rehypeExternalLinks from \"rehype-external-links\";\nimport rehype2react from \"rehype-react\";\nimport breaks from \"remark-breaks\";\nimport remarkParse from \"remark-parse\";\nimport remark2rehype from \"remark-rehype\";\nimport remarkUnlinkProtocols from \"remark-unlink-protocols\";\nimport { unified } from \"unified\";\nimport { resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createBlock, createCommentVNode, defineComponent, unref, withCtx, createVNode, h, ref } from \"vue\";\nimport { RouterLink } from \"vue-router\";\nimport { N as NcCheckboxRadioSwitch } from \"./NcCheckboxRadioSwitch.mjs\";\nimport { getCurrentUser } from \"@nextcloud/auth\";\nimport axios from \"@nextcloud/axios\";\nimport { generateOcsUrl } from \"@nextcloud/router\";\nimport { getSharingToken } from \"@nextcloud/sharing/public\";\nimport { N as NcReferenceWidget } from \"./NcReferenceWidget.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nimport { U as URL_PATTERN, g as getRoute, N as NcRichTextExternalLink, p as parseUrl, r as remarkAutolink } from \"./autolink.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { N as NcButton } from \"./NcButton.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper.mjs\";\nimport { u as useCopy } from \"./useCopy.mjs\";\nimport { c as createElementId } from \"./createElementId.mjs\";\nimport { u } from \"unist-builder\";\nimport { visitParents, EXIT, SKIP } from \"unist-util-visit-parents\";\nconst _sfc_main$2 = {\n name: \"NcReferenceList\",\n components: {\n NcReferenceWidget\n },\n props: {\n /**\n * The text to extract references from\n */\n text: {\n type: String,\n default: \"\"\n },\n /**\n * The data of the references to display.\n */\n referenceData: {\n type: Array,\n default: null\n },\n /**\n * The maximum number of references to display\n */\n limit: {\n type: Number,\n default: 1\n },\n /**\n * Show the fallback reference if no references are found\n */\n displayFallback: {\n type: Boolean,\n default: false\n },\n /**\n * Whether to render the widgets in interactive mode (if available)\n */\n interactive: {\n type: Boolean,\n default: true\n },\n /**\n * Whether to show user an option to enable to interactive mode for widgets (if available)\n */\n interactiveOptIn: {\n type: Boolean,\n default: false\n }\n },\n emits: [\"loaded\"],\n data() {\n return {\n references: null,\n loading: true\n };\n },\n computed: {\n isVisible() {\n return this.loading || this.displayedReferences.length !== 0;\n },\n values() {\n if (this.referenceData) {\n return this.referenceData;\n }\n if (this.displayFallback && !this.loading && !this.references) {\n return [this.fallbackReference];\n }\n return this.references ? Object.values(this.references) : [];\n },\n firstReference() {\n return this.values[0] ?? null;\n },\n displayedReferences() {\n return this.values.filter(Boolean).slice(0, this.limit);\n },\n fallbackReference() {\n return {\n accessible: true,\n openGraphObject: {\n id: this.text,\n link: this.text,\n name: this.text\n },\n richObjectType: \"open-graph\"\n };\n }\n },\n watch: {\n text: \"fetch\"\n },\n mounted() {\n this.fetch();\n },\n methods: {\n fetch() {\n this.loading = true;\n if (this.referenceData) {\n this.references = null;\n this.loading = false;\n return;\n }\n if (!new RegExp(URL_PATTERN).exec(this.text)) {\n this.references = null;\n this.loading = false;\n return;\n }\n this.resolve().then((response) => {\n this.references = response.data.ocs.data.references;\n this.loading = false;\n this.$emit(\"loaded\");\n }).catch((error) => {\n logger.error(\"[NcReferenceList] Failed to extract references\", { error });\n this.loading = false;\n this.$emit(\"loaded\");\n });\n },\n resolve() {\n const match = new RegExp(URL_PATTERN).exec(this.text.trim());\n const isPublic = getCurrentUser() === null;\n if (this.limit === 1 && match) {\n return isPublic ? axios.get(generateOcsUrl(\"references/resolvePublic\") + `?reference=${encodeURIComponent(match[0])}&sharingToken=${getSharingToken()}`) : axios.get(generateOcsUrl(\"references/resolve\") + `?reference=${encodeURIComponent(match[0])}`);\n }\n return isPublic ? axios.post(generateOcsUrl(\"references/extractPublic\"), {\n text: this.text,\n resolve: true,\n limit: this.limit,\n sharingToken: getSharingToken()\n }) : axios.post(generateOcsUrl(\"references/extract\"), {\n text: this.text,\n resolve: true,\n limit: this.limit\n });\n }\n }\n};\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcReferenceWidget = resolveComponent(\"NcReferenceWidget\");\n return $options.isVisible ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass([\"widgets--list\", { \"icon-loading\": $data.loading }])\n }, [\n (openBlock(true), createElementBlock(Fragment, null, renderList($options.displayedReferences, (reference) => {\n return openBlock(), createBlock(_component_NcReferenceWidget, {\n key: reference.openGraphObject?.id,\n reference,\n interactive: $props.interactive,\n interactiveOptIn: $props.interactiveOptIn\n }, null, 8, [\"reference\", \"interactive\", \"interactiveOptIn\"]);\n }), 128))\n ], 2)) : createCommentVNode(\"\", true);\n}\nconst NcReferenceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render], [\"__scopeId\", \"data-v-22575c85\"]]);\nfunction ccount(value, character) {\n const source = String(value);\n if (typeof character !== \"string\") {\n throw new TypeError(\"Expected character\");\n }\n let count = 0;\n let index = source.indexOf(character);\n while (index !== -1) {\n count++;\n index = source.indexOf(character, index + character.length);\n }\n return count;\n}\nfunction ok$1() {\n}\nconst asciiAlpha = regexCheck(/[A-Za-z]/);\nconst asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\nfunction asciiControl(code2) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code2 !== null && (code2 < 32 || code2 === 127)\n );\n}\nfunction markdownLineEnding(code2) {\n return code2 !== null && code2 < -2;\n}\nfunction markdownLineEndingOrSpace(code2) {\n return code2 !== null && (code2 < 0 || code2 === 32);\n}\nfunction markdownSpace(code2) {\n return code2 === -2 || code2 === -1 || code2 === 32;\n}\nconst unicodePunctuation = regexCheck(new RegExp(\"\\\\p{P}|\\\\p{S}\", \"u\"));\nconst unicodeWhitespace = regexCheck(/\\s/);\nfunction regexCheck(regex) {\n return check;\n function check(code2) {\n return code2 !== null && code2 > -1 && regex.test(String.fromCharCode(code2));\n }\n}\nfunction escapeStringRegexp(string) {\n if (typeof string !== \"string\") {\n throw new TypeError(\"Expected a string\");\n }\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\").replace(/-/g, \"\\\\x2d\");\n}\nconst convert = (\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n (function(test) {\n if (test === null || test === void 0) {\n return ok;\n }\n if (typeof test === \"function\") {\n return castFactory(test);\n }\n if (typeof test === \"object\") {\n return Array.isArray(test) ? anyFactory(test) : (\n // Cast because `ReadonlyArray` goes into the above but `isArray`\n // narrows to `Array`.\n propertiesFactory(\n /** @type {Props} */\n test\n )\n );\n }\n if (typeof test === \"string\") {\n return typeFactory(test);\n }\n throw new Error(\"Expected function, string, or object as test\");\n })\n);\nfunction anyFactory(tests) {\n const checks = [];\n let index = -1;\n while (++index < tests.length) {\n checks[index] = convert(tests[index]);\n }\n return castFactory(any);\n function any(...parameters) {\n let index2 = -1;\n while (++index2 < checks.length) {\n if (checks[index2].apply(this, parameters)) return true;\n }\n return false;\n }\n}\nfunction propertiesFactory(check) {\n const checkAsRecord = (\n /** @type {Record} */\n check\n );\n return castFactory(all);\n function all(node) {\n const nodeAsRecord = (\n /** @type {Record} */\n /** @type {unknown} */\n node\n );\n let key;\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false;\n }\n return true;\n }\n}\nfunction typeFactory(check) {\n return castFactory(type);\n function type(node) {\n return node && node.type === check;\n }\n}\nfunction castFactory(testFunction) {\n return check;\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) && testFunction.call(\n this,\n value,\n typeof index === \"number\" ? index : void 0,\n parent || void 0\n )\n );\n }\n}\nfunction ok() {\n return true;\n}\nfunction looksLikeANode(value) {\n return value !== null && typeof value === \"object\" && \"type\" in value;\n}\nfunction findAndReplace(tree, list2, options) {\n const settings = options || {};\n const ignored = convert(settings.ignore || []);\n const pairs = toPairs(list2);\n let pairIndex = -1;\n while (++pairIndex < pairs.length) {\n visitParents(tree, \"text\", visitor);\n }\n function visitor(node, parents) {\n let index = -1;\n let grandparent;\n while (++index < parents.length) {\n const parent = parents[index];\n const siblings = grandparent ? grandparent.children : void 0;\n if (ignored(\n parent,\n siblings ? siblings.indexOf(parent) : void 0,\n grandparent\n )) {\n return;\n }\n grandparent = parent;\n }\n if (grandparent) {\n return handler(node, parents);\n }\n }\n function handler(node, parents) {\n const parent = parents[parents.length - 1];\n const find = pairs[pairIndex][0];\n const replace2 = pairs[pairIndex][1];\n let start = 0;\n const siblings = parent.children;\n const index = siblings.indexOf(node);\n let change = false;\n let nodes = [];\n find.lastIndex = 0;\n let match = find.exec(node.value);\n while (match) {\n const position = match.index;\n const matchObject = {\n index: match.index,\n input: match.input,\n stack: [...parents, node]\n };\n let value = replace2(...match, matchObject);\n if (typeof value === \"string\") {\n value = value.length > 0 ? { type: \"text\", value } : void 0;\n }\n if (value === false) {\n find.lastIndex = position + 1;\n } else {\n if (start !== position) {\n nodes.push({\n type: \"text\",\n value: node.value.slice(start, position)\n });\n }\n if (Array.isArray(value)) {\n nodes.push(...value);\n } else if (value) {\n nodes.push(value);\n }\n start = position + match[0].length;\n change = true;\n }\n if (!find.global) {\n break;\n }\n match = find.exec(node.value);\n }\n if (change) {\n if (start < node.value.length) {\n nodes.push({ type: \"text\", value: node.value.slice(start) });\n }\n parent.children.splice(index, 1, ...nodes);\n } else {\n nodes = [node];\n }\n return index + nodes.length;\n }\n}\nfunction toPairs(tupleOrList) {\n const result = [];\n if (!Array.isArray(tupleOrList)) {\n throw new TypeError(\"Expected find and replace tuple or list of tuples\");\n }\n const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];\n let index = -1;\n while (++index < list2.length) {\n const tuple = list2[index];\n result.push([toExpression(tuple[0]), toFunction(tuple[1])]);\n }\n return result;\n}\nfunction toExpression(find) {\n return typeof find === \"string\" ? new RegExp(escapeStringRegexp(find), \"g\") : find;\n}\nfunction toFunction(replace2) {\n return typeof replace2 === \"function\" ? replace2 : function() {\n return replace2;\n };\n}\nconst inConstruct = \"phrasing\";\nconst notInConstruct = [\"autolink\", \"link\", \"image\", \"label\"];\nfunction gfmAutolinkLiteralFromMarkdown() {\n return {\n transforms: [transformGfmAutolinkLiterals],\n enter: {\n literalAutolink: enterLiteralAutolink,\n literalAutolinkEmail: enterLiteralAutolinkValue,\n literalAutolinkHttp: enterLiteralAutolinkValue,\n literalAutolinkWww: enterLiteralAutolinkValue\n },\n exit: {\n literalAutolink: exitLiteralAutolink,\n literalAutolinkEmail: exitLiteralAutolinkEmail,\n literalAutolinkHttp: exitLiteralAutolinkHttp,\n literalAutolinkWww: exitLiteralAutolinkWww\n }\n };\n}\nfunction gfmAutolinkLiteralToMarkdown() {\n return {\n unsafe: [\n {\n character: \"@\",\n before: \"[+\\\\-.\\\\w]\",\n after: \"[\\\\-.\\\\w]\",\n inConstruct,\n notInConstruct\n },\n {\n character: \".\",\n before: \"[Ww]\",\n after: \"[\\\\-.\\\\w]\",\n inConstruct,\n notInConstruct\n },\n {\n character: \":\",\n before: \"[ps]\",\n after: \"\\\\/\",\n inConstruct,\n notInConstruct\n }\n ]\n };\n}\nfunction enterLiteralAutolink(token) {\n this.enter({ type: \"link\", title: null, url: \"\", children: [] }, token);\n}\nfunction enterLiteralAutolinkValue(token) {\n this.config.enter.autolinkProtocol.call(this, token);\n}\nfunction exitLiteralAutolinkHttp(token) {\n this.config.exit.autolinkProtocol.call(this, token);\n}\nfunction exitLiteralAutolinkWww(token) {\n this.config.exit.data.call(this, token);\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"link\");\n node.url = \"http://\" + this.sliceSerialize(token);\n}\nfunction exitLiteralAutolinkEmail(token) {\n this.config.exit.autolinkEmail.call(this, token);\n}\nfunction exitLiteralAutolink(token) {\n this.exit(token);\n}\nfunction transformGfmAutolinkLiterals(tree) {\n findAndReplace(\n tree,\n [\n [/(https?:\\/\\/|www(?=\\.))([-.\\w]+)([^ \\t\\r\\n]*)/gi, findUrl],\n [/([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)/g, findEmail]\n ],\n { ignore: [\"link\", \"linkReference\"] }\n );\n}\nfunction findUrl(_, protocol, domain2, path2, match) {\n let prefix = \"\";\n if (!previous(match)) {\n return false;\n }\n if (/^w/i.test(protocol)) {\n domain2 = protocol + domain2;\n protocol = \"\";\n prefix = \"http://\";\n }\n if (!isCorrectDomain(domain2)) {\n return false;\n }\n const parts = splitUrl(domain2 + path2);\n if (!parts[0]) return false;\n const result = {\n type: \"link\",\n title: null,\n url: prefix + protocol + parts[0],\n children: [{ type: \"text\", value: protocol + parts[0] }]\n };\n if (parts[1]) {\n return [result, { type: \"text\", value: parts[1] }];\n }\n return result;\n}\nfunction findEmail(_, atext, label, match) {\n if (\n // Not an expected previous character.\n !previous(match, true) || // Label ends in not allowed character.\n /[-\\d_]$/.test(label)\n ) {\n return false;\n }\n return {\n type: \"link\",\n title: null,\n url: \"mailto:\" + atext + \"@\" + label,\n children: [{ type: \"text\", value: atext + \"@\" + label }]\n };\n}\nfunction isCorrectDomain(domain2) {\n const parts = domain2.split(\".\");\n if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\\d]/.test(parts[parts.length - 2]))) {\n return false;\n }\n return true;\n}\nfunction splitUrl(url) {\n const trailExec = /[!\"&'),.:;<>?\\]}]+$/.exec(url);\n if (!trailExec) {\n return [url, void 0];\n }\n url = url.slice(0, trailExec.index);\n let trail2 = trailExec[0];\n let closingParenIndex = trail2.indexOf(\")\");\n const openingParens = ccount(url, \"(\");\n let closingParens = ccount(url, \")\");\n while (closingParenIndex !== -1 && openingParens > closingParens) {\n url += trail2.slice(0, closingParenIndex + 1);\n trail2 = trail2.slice(closingParenIndex + 1);\n closingParenIndex = trail2.indexOf(\")\");\n closingParens++;\n }\n return [url, trail2];\n}\nfunction previous(match, email) {\n const code2 = match.input.charCodeAt(match.index - 1);\n return (match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2)) && (!email || code2 !== 47);\n}\nfunction normalizeIdentifier(value) {\n return value.replace(/[\\t\\n\\r ]+/g, \" \").replace(/^ | $/g, \"\").toLowerCase().toUpperCase();\n}\nfootnoteReference.peek = footnoteReferencePeek;\nfunction enterFootnoteCallString() {\n this.buffer();\n}\nfunction enterFootnoteCall(token) {\n this.enter({ type: \"footnoteReference\", identifier: \"\", label: \"\" }, token);\n}\nfunction enterFootnoteDefinitionLabelString() {\n this.buffer();\n}\nfunction enterFootnoteDefinition(token) {\n this.enter(\n { type: \"footnoteDefinition\", identifier: \"\", label: \"\", children: [] },\n token\n );\n}\nfunction exitFootnoteCallString(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"footnoteReference\");\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase();\n node.label = label;\n}\nfunction exitFootnoteCall(token) {\n this.exit(token);\n}\nfunction exitFootnoteDefinitionLabelString(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"footnoteDefinition\");\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase();\n node.label = label;\n}\nfunction exitFootnoteDefinition(token) {\n this.exit(token);\n}\nfunction footnoteReferencePeek() {\n return \"[\";\n}\nfunction footnoteReference(node, _, state, info) {\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[^\");\n const exit2 = state.enter(\"footnoteReference\");\n const subexit = state.enter(\"reference\");\n value += tracker.move(\n state.safe(state.associationId(node), { after: \"]\", before: value })\n );\n subexit();\n exit2();\n value += tracker.move(\"]\");\n return value;\n}\nfunction gfmFootnoteFromMarkdown() {\n return {\n enter: {\n gfmFootnoteCallString: enterFootnoteCallString,\n gfmFootnoteCall: enterFootnoteCall,\n gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: enterFootnoteDefinition\n },\n exit: {\n gfmFootnoteCallString: exitFootnoteCallString,\n gfmFootnoteCall: exitFootnoteCall,\n gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: exitFootnoteDefinition\n }\n };\n}\nfunction gfmFootnoteToMarkdown(options) {\n let firstLineBlank = false;\n if (options && options.firstLineBlank) {\n firstLineBlank = true;\n }\n return {\n handlers: { footnoteDefinition, footnoteReference },\n // This is on by default already.\n unsafe: [{ character: \"[\", inConstruct: [\"label\", \"phrasing\", \"reference\"] }]\n };\n function footnoteDefinition(node, _, state, info) {\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[^\");\n const exit2 = state.enter(\"footnoteDefinition\");\n const subexit = state.enter(\"label\");\n value += tracker.move(\n state.safe(state.associationId(node), { before: value, after: \"]\" })\n );\n subexit();\n value += tracker.move(\"]:\");\n if (node.children && node.children.length > 0) {\n tracker.shift(4);\n value += tracker.move(\n (firstLineBlank ? \"\\n\" : \" \") + state.indentLines(\n state.containerFlow(node, tracker.current()),\n firstLineBlank ? mapAll : mapExceptFirst\n )\n );\n }\n exit2();\n return value;\n }\n}\nfunction mapExceptFirst(line, index, blank) {\n return index === 0 ? line : mapAll(line, index, blank);\n}\nfunction mapAll(line, index, blank) {\n return (blank ? \"\" : \" \") + line;\n}\nconst constructsWithoutStrikethrough = [\n \"autolink\",\n \"destinationLiteral\",\n \"destinationRaw\",\n \"reference\",\n \"titleQuote\",\n \"titleApostrophe\"\n];\nhandleDelete.peek = peekDelete;\nfunction gfmStrikethroughFromMarkdown() {\n return {\n canContainEols: [\"delete\"],\n enter: { strikethrough: enterStrikethrough },\n exit: { strikethrough: exitStrikethrough }\n };\n}\nfunction gfmStrikethroughToMarkdown() {\n return {\n unsafe: [\n {\n character: \"~\",\n inConstruct: \"phrasing\",\n notInConstruct: constructsWithoutStrikethrough\n }\n ],\n handlers: { delete: handleDelete }\n };\n}\nfunction enterStrikethrough(token) {\n this.enter({ type: \"delete\", children: [] }, token);\n}\nfunction exitStrikethrough(token) {\n this.exit(token);\n}\nfunction handleDelete(node, _, state, info) {\n const tracker = state.createTracker(info);\n const exit2 = state.enter(\"strikethrough\");\n let value = tracker.move(\"~~\");\n value += state.containerPhrasing(node, {\n ...tracker.current(),\n before: value,\n after: \"~\"\n });\n value += tracker.move(\"~~\");\n exit2();\n return value;\n}\nfunction peekDelete() {\n return \"~\";\n}\nfunction defaultStringLength(value) {\n return value.length;\n}\nfunction markdownTable(table, options) {\n const settings = options || {};\n const align = (settings.align || []).concat();\n const stringLength = settings.stringLength || defaultStringLength;\n const alignments = [];\n const cellMatrix = [];\n const sizeMatrix = [];\n const longestCellByColumn = [];\n let mostCellsPerRow = 0;\n let rowIndex = -1;\n while (++rowIndex < table.length) {\n const row2 = [];\n const sizes2 = [];\n let columnIndex2 = -1;\n if (table[rowIndex].length > mostCellsPerRow) {\n mostCellsPerRow = table[rowIndex].length;\n }\n while (++columnIndex2 < table[rowIndex].length) {\n const cell = serialize(table[rowIndex][columnIndex2]);\n if (settings.alignDelimiters !== false) {\n const size = stringLength(cell);\n sizes2[columnIndex2] = size;\n if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {\n longestCellByColumn[columnIndex2] = size;\n }\n }\n row2.push(cell);\n }\n cellMatrix[rowIndex] = row2;\n sizeMatrix[rowIndex] = sizes2;\n }\n let columnIndex = -1;\n if (typeof align === \"object\" && \"length\" in align) {\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = toAlignment(align[columnIndex]);\n }\n } else {\n const code2 = toAlignment(align);\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = code2;\n }\n }\n columnIndex = -1;\n const row = [];\n const sizes = [];\n while (++columnIndex < mostCellsPerRow) {\n const code2 = alignments[columnIndex];\n let before = \"\";\n let after = \"\";\n if (code2 === 99) {\n before = \":\";\n after = \":\";\n } else if (code2 === 108) {\n before = \":\";\n } else if (code2 === 114) {\n after = \":\";\n }\n let size = settings.alignDelimiters === false ? 1 : Math.max(\n 1,\n longestCellByColumn[columnIndex] - before.length - after.length\n );\n const cell = before + \"-\".repeat(size) + after;\n if (settings.alignDelimiters !== false) {\n size = before.length + size + after.length;\n if (size > longestCellByColumn[columnIndex]) {\n longestCellByColumn[columnIndex] = size;\n }\n sizes[columnIndex] = size;\n }\n row[columnIndex] = cell;\n }\n cellMatrix.splice(1, 0, row);\n sizeMatrix.splice(1, 0, sizes);\n rowIndex = -1;\n const lines = [];\n while (++rowIndex < cellMatrix.length) {\n const row2 = cellMatrix[rowIndex];\n const sizes2 = sizeMatrix[rowIndex];\n columnIndex = -1;\n const line = [];\n while (++columnIndex < mostCellsPerRow) {\n const cell = row2[columnIndex] || \"\";\n let before = \"\";\n let after = \"\";\n if (settings.alignDelimiters !== false) {\n const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);\n const code2 = alignments[columnIndex];\n if (code2 === 114) {\n before = \" \".repeat(size);\n } else if (code2 === 99) {\n if (size % 2) {\n before = \" \".repeat(size / 2 + 0.5);\n after = \" \".repeat(size / 2 - 0.5);\n } else {\n before = \" \".repeat(size / 2);\n after = before;\n }\n } else {\n after = \" \".repeat(size);\n }\n }\n if (settings.delimiterStart !== false && !columnIndex) {\n line.push(\"|\");\n }\n if (settings.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is\n // empty: there will be a closing space.\n !(settings.alignDelimiters === false && cell === \"\") && (settings.delimiterStart !== false || columnIndex)) {\n line.push(\" \");\n }\n if (settings.alignDelimiters !== false) {\n line.push(before);\n }\n line.push(cell);\n if (settings.alignDelimiters !== false) {\n line.push(after);\n }\n if (settings.padding !== false) {\n line.push(\" \");\n }\n if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {\n line.push(\"|\");\n }\n }\n lines.push(\n settings.delimiterEnd === false ? line.join(\"\").replace(/ +$/, \"\") : line.join(\"\")\n );\n }\n return lines.join(\"\\n\");\n}\nfunction serialize(value) {\n return value === null || value === void 0 ? \"\" : String(value);\n}\nfunction toAlignment(value) {\n const code2 = typeof value === \"string\" ? value.codePointAt(0) : 0;\n return code2 === 67 || code2 === 99 ? 99 : code2 === 76 || code2 === 108 ? 108 : code2 === 82 || code2 === 114 ? 114 : 0;\n}\nfunction blockquote(node, _, state, info) {\n const exit2 = state.enter(\"blockquote\");\n const tracker = state.createTracker(info);\n tracker.move(\"> \");\n tracker.shift(2);\n const value = state.indentLines(\n state.containerFlow(node, tracker.current()),\n map$1\n );\n exit2();\n return value;\n}\nfunction map$1(line, _, blank) {\n return \">\" + (blank ? \"\" : \" \") + line;\n}\nfunction patternInScope(stack, pattern) {\n return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);\n}\nfunction listInScope(stack, list2, none) {\n if (typeof list2 === \"string\") {\n list2 = [list2];\n }\n if (!list2 || list2.length === 0) {\n return none;\n }\n let index = -1;\n while (++index < list2.length) {\n if (stack.includes(list2[index])) {\n return true;\n }\n }\n return false;\n}\nfunction hardBreak(_, _1, state, info) {\n let index = -1;\n while (++index < state.unsafe.length) {\n if (state.unsafe[index].character === \"\\n\" && patternInScope(state.stack, state.unsafe[index])) {\n return /[ \\t]/.test(info.before) ? \"\" : \" \";\n }\n }\n return \"\\\\\\n\";\n}\nfunction longestStreak(value, substring) {\n const source = String(value);\n let index = source.indexOf(substring);\n let expected = index;\n let count = 0;\n let max = 0;\n if (typeof substring !== \"string\") {\n throw new TypeError(\"Expected substring\");\n }\n while (index !== -1) {\n if (index === expected) {\n if (++count > max) {\n max = count;\n }\n } else {\n count = 1;\n }\n expected = index + substring.length;\n index = source.indexOf(substring, expected);\n }\n return max;\n}\nfunction formatCodeAsIndented(node, state) {\n return Boolean(\n state.options.fences === false && node.value && // If there’s no info…\n !node.lang && // And there’s a non-whitespace character…\n /[^ \\r\\n]/.test(node.value) && // And the value doesn’t start or end in a blank…\n !/^[\\t ]*(?:[\\r\\n]|$)|(?:^|[\\r\\n])[\\t ]*$/.test(node.value)\n );\n}\nfunction checkFence(state) {\n const marker = state.options.fence || \"`\";\n if (marker !== \"`\" && marker !== \"~\") {\n throw new Error(\n \"Cannot serialize code with `\" + marker + \"` for `options.fence`, expected `` ` `` or `~`\"\n );\n }\n return marker;\n}\nfunction code$1(node, _, state, info) {\n const marker = checkFence(state);\n const raw = node.value || \"\";\n const suffix = marker === \"`\" ? \"GraveAccent\" : \"Tilde\";\n if (formatCodeAsIndented(node, state)) {\n const exit3 = state.enter(\"codeIndented\");\n const value2 = state.indentLines(raw, map);\n exit3();\n return value2;\n }\n const tracker = state.createTracker(info);\n const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));\n const exit2 = state.enter(\"codeFenced\");\n let value = tracker.move(sequence);\n if (node.lang) {\n const subexit = state.enter(`codeFencedLang${suffix}`);\n value += tracker.move(\n state.safe(node.lang, {\n before: value,\n after: \" \",\n encode: [\"`\"],\n ...tracker.current()\n })\n );\n subexit();\n }\n if (node.lang && node.meta) {\n const subexit = state.enter(`codeFencedMeta${suffix}`);\n value += tracker.move(\" \");\n value += tracker.move(\n state.safe(node.meta, {\n before: value,\n after: \"\\n\",\n encode: [\"`\"],\n ...tracker.current()\n })\n );\n subexit();\n }\n value += tracker.move(\"\\n\");\n if (raw) {\n value += tracker.move(raw + \"\\n\");\n }\n value += tracker.move(sequence);\n exit2();\n return value;\n}\nfunction map(line, _, blank) {\n return (blank ? \"\" : \" \") + line;\n}\nfunction checkQuote(state) {\n const marker = state.options.quote || '\"';\n if (marker !== '\"' && marker !== \"'\") {\n throw new Error(\n \"Cannot serialize title with `\" + marker + \"` for `options.quote`, expected `\\\"`, or `'`\"\n );\n }\n return marker;\n}\nfunction definition(node, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const exit2 = state.enter(\"definition\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[\");\n value += tracker.move(\n state.safe(state.associationId(node), {\n before: value,\n after: \"]\",\n ...tracker.current()\n })\n );\n value += tracker.move(\"]: \");\n subexit();\n if (\n // If there’s no url, or…\n !node.url || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? \" \" : \"\\n\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n exit2();\n return value;\n}\nfunction checkEmphasis(state) {\n const marker = state.options.emphasis || \"*\";\n if (marker !== \"*\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize emphasis with `\" + marker + \"` for `options.emphasis`, expected `*`, or `_`\"\n );\n }\n return marker;\n}\nfunction encodeCharacterReference(code2) {\n return \"&#x\" + code2.toString(16).toUpperCase() + \";\";\n}\nfunction classifyCharacter(code2) {\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return 1;\n }\n if (unicodePunctuation(code2)) {\n return 2;\n }\n}\nfunction encodeInfo(outside, inside, marker) {\n const outsideKind = classifyCharacter(outside);\n const insideKind = classifyCharacter(inside);\n if (outsideKind === void 0) {\n return insideKind === void 0 ? (\n // Letter inside:\n // we have to encode *both* letters for `_` as it is looser.\n // it already forms for `*` (and GFMs `~`).\n marker === \"_\" ? { inside: true, outside: true } : { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode both (letter, whitespace).\n { inside: true, outside: true }\n ) : (\n // Punctuation inside: encode outer (letter)\n { inside: false, outside: true }\n );\n }\n if (outsideKind === 1) {\n return insideKind === void 0 ? (\n // Letter inside: already forms.\n { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode both (whitespace).\n { inside: true, outside: true }\n ) : (\n // Punctuation inside: already forms.\n { inside: false, outside: false }\n );\n }\n return insideKind === void 0 ? (\n // Letter inside: already forms.\n { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode inner (whitespace).\n { inside: true, outside: false }\n ) : (\n // Punctuation inside: already forms.\n { inside: false, outside: false }\n );\n}\nemphasis.peek = emphasisPeek;\nfunction emphasis(node, _, state, info) {\n const marker = checkEmphasis(state);\n const exit2 = state.enter(\"emphasis\");\n const tracker = state.createTracker(info);\n const before = tracker.move(marker);\n let between = tracker.move(\n state.containerPhrasing(node, {\n after: marker,\n before,\n ...tracker.current()\n })\n );\n const betweenHead = between.charCodeAt(0);\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n );\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1);\n }\n const betweenTail = between.charCodeAt(between.length - 1);\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail);\n }\n const after = tracker.move(marker);\n exit2();\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n };\n return before + between + after;\n}\nfunction emphasisPeek(_, _1, state) {\n return state.options.emphasis || \"*\";\n}\nfunction visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n let reverse;\n let test;\n let visitor;\n if (typeof testOrVisitor === \"function\" && typeof visitorOrReverse !== \"function\") {\n test = void 0;\n visitor = testOrVisitor;\n reverse = visitorOrReverse;\n } else {\n test = testOrVisitor;\n visitor = visitorOrReverse;\n reverse = maybeReverse;\n }\n visitParents(tree, test, overload, reverse);\n function overload(node, parents) {\n const parent = parents[parents.length - 1];\n const index = parent ? parent.children.indexOf(node) : void 0;\n return visitor(node, index, parent);\n }\n}\nfunction formatHeadingAsSetext(node, state) {\n let literalWithBreak = false;\n visit(node, function(node2) {\n if (\"value\" in node2 && /\\r?\\n|\\r/.test(node2.value) || node2.type === \"break\") {\n literalWithBreak = true;\n return EXIT;\n }\n });\n return Boolean(\n (!node.depth || node.depth < 3) && toString(node) && (state.options.setext || literalWithBreak)\n );\n}\nfunction heading(node, _, state, info) {\n const rank = Math.max(Math.min(6, node.depth || 1), 1);\n const tracker = state.createTracker(info);\n if (formatHeadingAsSetext(node, state)) {\n const exit3 = state.enter(\"headingSetext\");\n const subexit2 = state.enter(\"phrasing\");\n const value2 = state.containerPhrasing(node, {\n ...tracker.current(),\n before: \"\\n\",\n after: \"\\n\"\n });\n subexit2();\n exit3();\n return value2 + \"\\n\" + (rank === 1 ? \"=\" : \"-\").repeat(\n // The whole size…\n value2.length - // Minus the position of the character after the last EOL (or\n // 0 if there is none)…\n (Math.max(value2.lastIndexOf(\"\\r\"), value2.lastIndexOf(\"\\n\")) + 1)\n );\n }\n const sequence = \"#\".repeat(rank);\n const exit2 = state.enter(\"headingAtx\");\n const subexit = state.enter(\"phrasing\");\n tracker.move(sequence + \" \");\n let value = state.containerPhrasing(node, {\n before: \"# \",\n after: \"\\n\",\n ...tracker.current()\n });\n if (/^[\\t ]/.test(value)) {\n value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);\n }\n value = value ? sequence + \" \" + value : sequence;\n if (state.options.closeAtx) {\n value += \" \" + sequence;\n }\n subexit();\n exit2();\n return value;\n}\nhtml.peek = htmlPeek;\nfunction html(node) {\n return node.value || \"\";\n}\nfunction htmlPeek() {\n return \"<\";\n}\nimage.peek = imagePeek;\nfunction image(node, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const exit2 = state.enter(\"image\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"![\");\n value += tracker.move(\n state.safe(node.alt, { before: value, after: \"]\", ...tracker.current() })\n );\n value += tracker.move(\"](\");\n subexit();\n if (\n // If there’s no url but there is a title…\n !node.url && node.title || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? \" \" : \")\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n value += tracker.move(\")\");\n exit2();\n return value;\n}\nfunction imagePeek() {\n return \"!\";\n}\nimageReference.peek = imageReferencePeek;\nfunction imageReference(node, _, state, info) {\n const type = node.referenceType;\n const exit2 = state.enter(\"imageReference\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"![\");\n const alt = state.safe(node.alt, {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n value += tracker.move(alt + \"][\");\n subexit();\n const stack = state.stack;\n state.stack = [];\n subexit = state.enter(\"reference\");\n const reference = state.safe(state.associationId(node), {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n subexit();\n state.stack = stack;\n exit2();\n if (type === \"full\" || !alt || alt !== reference) {\n value += tracker.move(reference + \"]\");\n } else if (type === \"shortcut\") {\n value = value.slice(0, -1);\n } else {\n value += tracker.move(\"]\");\n }\n return value;\n}\nfunction imageReferencePeek() {\n return \"!\";\n}\ninlineCode.peek = inlineCodePeek;\nfunction inlineCode(node, _, state) {\n let value = node.value || \"\";\n let sequence = \"`\";\n let index = -1;\n while (new RegExp(\"(^|[^`])\" + sequence + \"([^`]|$)\").test(value)) {\n sequence += \"`\";\n }\n if (/[^ \\r\\n]/.test(value) && (/^[ \\r\\n]/.test(value) && /[ \\r\\n]$/.test(value) || /^`|`$/.test(value))) {\n value = \" \" + value + \" \";\n }\n while (++index < state.unsafe.length) {\n const pattern = state.unsafe[index];\n const expression = state.compilePattern(pattern);\n let match;\n if (!pattern.atBreak) continue;\n while (match = expression.exec(value)) {\n let position = match.index;\n if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {\n position--;\n }\n value = value.slice(0, position) + \" \" + value.slice(match.index + 1);\n }\n }\n return sequence + value + sequence;\n}\nfunction inlineCodePeek() {\n return \"`\";\n}\nfunction formatLinkAsAutolink(node, state) {\n const raw = toString(node);\n return Boolean(\n !state.options.resourceLink && // If there’s a url…\n node.url && // And there’s a no title…\n !node.title && // And the content of `node` is a single text node…\n node.children && node.children.length === 1 && node.children[0].type === \"text\" && // And if the url is the same as the content…\n (raw === node.url || \"mailto:\" + raw === node.url) && // And that starts w/ a protocol…\n /^[a-z][a-z+.-]+:/i.test(node.url) && // And that doesn’t contain ASCII control codes (character escapes and\n // references don’t work), space, or angle brackets…\n !/[\\0- <>\\u007F]/.test(node.url)\n );\n}\nlink.peek = linkPeek;\nfunction link(node, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const tracker = state.createTracker(info);\n let exit2;\n let subexit;\n if (formatLinkAsAutolink(node, state)) {\n const stack = state.stack;\n state.stack = [];\n exit2 = state.enter(\"autolink\");\n let value2 = tracker.move(\"<\");\n value2 += tracker.move(\n state.containerPhrasing(node, {\n before: value2,\n after: \">\",\n ...tracker.current()\n })\n );\n value2 += tracker.move(\">\");\n exit2();\n state.stack = stack;\n return value2;\n }\n exit2 = state.enter(\"link\");\n subexit = state.enter(\"label\");\n let value = tracker.move(\"[\");\n value += tracker.move(\n state.containerPhrasing(node, {\n before: value,\n after: \"](\",\n ...tracker.current()\n })\n );\n value += tracker.move(\"](\");\n subexit();\n if (\n // If there’s no url but there is a title…\n !node.url && node.title || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? \" \" : \")\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n value += tracker.move(\")\");\n exit2();\n return value;\n}\nfunction linkPeek(node, _, state) {\n return formatLinkAsAutolink(node, state) ? \"<\" : \"[\";\n}\nlinkReference.peek = linkReferencePeek;\nfunction linkReference(node, _, state, info) {\n const type = node.referenceType;\n const exit2 = state.enter(\"linkReference\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[\");\n const text2 = state.containerPhrasing(node, {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n value += tracker.move(text2 + \"][\");\n subexit();\n const stack = state.stack;\n state.stack = [];\n subexit = state.enter(\"reference\");\n const reference = state.safe(state.associationId(node), {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n subexit();\n state.stack = stack;\n exit2();\n if (type === \"full\" || !text2 || text2 !== reference) {\n value += tracker.move(reference + \"]\");\n } else if (type === \"shortcut\") {\n value = value.slice(0, -1);\n } else {\n value += tracker.move(\"]\");\n }\n return value;\n}\nfunction linkReferencePeek() {\n return \"[\";\n}\nfunction checkBullet(state) {\n const marker = state.options.bullet || \"*\";\n if (marker !== \"*\" && marker !== \"+\" && marker !== \"-\") {\n throw new Error(\n \"Cannot serialize items with `\" + marker + \"` for `options.bullet`, expected `*`, `+`, or `-`\"\n );\n }\n return marker;\n}\nfunction checkBulletOther(state) {\n const bullet = checkBullet(state);\n const bulletOther = state.options.bulletOther;\n if (!bulletOther) {\n return bullet === \"*\" ? \"-\" : \"*\";\n }\n if (bulletOther !== \"*\" && bulletOther !== \"+\" && bulletOther !== \"-\") {\n throw new Error(\n \"Cannot serialize items with `\" + bulletOther + \"` for `options.bulletOther`, expected `*`, `+`, or `-`\"\n );\n }\n if (bulletOther === bullet) {\n throw new Error(\n \"Expected `bullet` (`\" + bullet + \"`) and `bulletOther` (`\" + bulletOther + \"`) to be different\"\n );\n }\n return bulletOther;\n}\nfunction checkBulletOrdered(state) {\n const marker = state.options.bulletOrdered || \".\";\n if (marker !== \".\" && marker !== \")\") {\n throw new Error(\n \"Cannot serialize items with `\" + marker + \"` for `options.bulletOrdered`, expected `.` or `)`\"\n );\n }\n return marker;\n}\nfunction checkRule(state) {\n const marker = state.options.rule || \"*\";\n if (marker !== \"*\" && marker !== \"-\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize rules with `\" + marker + \"` for `options.rule`, expected `*`, `-`, or `_`\"\n );\n }\n return marker;\n}\nfunction list(node, parent, state, info) {\n const exit2 = state.enter(\"list\");\n const bulletCurrent = state.bulletCurrent;\n let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state);\n const bulletOther = node.ordered ? bullet === \".\" ? \")\" : \".\" : checkBulletOther(state);\n let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;\n if (!node.ordered) {\n const firstListItem = node.children ? node.children[0] : void 0;\n if (\n // Bullet could be used as a thematic break marker:\n (bullet === \"*\" || bullet === \"-\") && // Empty first list item:\n firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:\n state.stack[state.stack.length - 1] === \"list\" && state.stack[state.stack.length - 2] === \"listItem\" && state.stack[state.stack.length - 3] === \"list\" && state.stack[state.stack.length - 4] === \"listItem\" && // That are each the first child.\n state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0\n ) {\n useDifferentMarker = true;\n }\n if (checkRule(state) === bullet && firstListItem) {\n let index = -1;\n while (++index < node.children.length) {\n const item = node.children[index];\n if (item && item.type === \"listItem\" && item.children && item.children[0] && item.children[0].type === \"thematicBreak\") {\n useDifferentMarker = true;\n break;\n }\n }\n }\n }\n if (useDifferentMarker) {\n bullet = bulletOther;\n }\n state.bulletCurrent = bullet;\n const value = state.containerFlow(node, info);\n state.bulletLastUsed = bullet;\n state.bulletCurrent = bulletCurrent;\n exit2();\n return value;\n}\nfunction checkListItemIndent(state) {\n const style = state.options.listItemIndent || \"one\";\n if (style !== \"tab\" && style !== \"one\" && style !== \"mixed\") {\n throw new Error(\n \"Cannot serialize items with `\" + style + \"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`\"\n );\n }\n return style;\n}\nfunction listItem(node, parent, state, info) {\n const listItemIndent = checkListItemIndent(state);\n let bullet = state.bulletCurrent || checkBullet(state);\n if (parent && parent.type === \"list\" && parent.ordered) {\n bullet = (typeof parent.start === \"number\" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node)) + bullet;\n }\n let size = bullet.length + 1;\n if (listItemIndent === \"tab\" || listItemIndent === \"mixed\" && (parent && parent.type === \"list\" && parent.spread || node.spread)) {\n size = Math.ceil(size / 4) * 4;\n }\n const tracker = state.createTracker(info);\n tracker.move(bullet + \" \".repeat(size - bullet.length));\n tracker.shift(size);\n const exit2 = state.enter(\"listItem\");\n const value = state.indentLines(\n state.containerFlow(node, tracker.current()),\n map2\n );\n exit2();\n return value;\n function map2(line, index, blank) {\n if (index) {\n return (blank ? \"\" : \" \".repeat(size)) + line;\n }\n return (blank ? bullet : bullet + \" \".repeat(size - bullet.length)) + line;\n }\n}\nfunction paragraph(node, _, state, info) {\n const exit2 = state.enter(\"paragraph\");\n const subexit = state.enter(\"phrasing\");\n const value = state.containerPhrasing(node, info);\n subexit();\n exit2();\n return value;\n}\nconst phrasing = (\n /** @type {(node?: unknown) => node is Exclude} */\n convert([\n \"break\",\n \"delete\",\n \"emphasis\",\n // To do: next major: removed since footnotes were added to GFM.\n \"footnote\",\n \"footnoteReference\",\n \"image\",\n \"imageReference\",\n \"inlineCode\",\n // Enabled by `mdast-util-math`:\n \"inlineMath\",\n \"link\",\n \"linkReference\",\n // Enabled by `mdast-util-mdx`:\n \"mdxJsxTextElement\",\n // Enabled by `mdast-util-mdx`:\n \"mdxTextExpression\",\n \"strong\",\n \"text\",\n // Enabled by `mdast-util-directive`:\n \"textDirective\"\n ])\n);\nfunction root(node, _, state, info) {\n const hasPhrasing = node.children.some(function(d) {\n return phrasing(d);\n });\n const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;\n return container.call(state, node, info);\n}\nfunction checkStrong(state) {\n const marker = state.options.strong || \"*\";\n if (marker !== \"*\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize strong with `\" + marker + \"` for `options.strong`, expected `*`, or `_`\"\n );\n }\n return marker;\n}\nstrong.peek = strongPeek;\nfunction strong(node, _, state, info) {\n const marker = checkStrong(state);\n const exit2 = state.enter(\"strong\");\n const tracker = state.createTracker(info);\n const before = tracker.move(marker + marker);\n let between = tracker.move(\n state.containerPhrasing(node, {\n after: marker,\n before,\n ...tracker.current()\n })\n );\n const betweenHead = between.charCodeAt(0);\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n );\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1);\n }\n const betweenTail = between.charCodeAt(between.length - 1);\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail);\n }\n const after = tracker.move(marker + marker);\n exit2();\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n };\n return before + between + after;\n}\nfunction strongPeek(_, _1, state) {\n return state.options.strong || \"*\";\n}\nfunction text$1(node, _, state, info) {\n return state.safe(node.value, info);\n}\nfunction checkRuleRepetition(state) {\n const repetition = state.options.ruleRepetition || 3;\n if (repetition < 3) {\n throw new Error(\n \"Cannot serialize rules with repetition `\" + repetition + \"` for `options.ruleRepetition`, expected `3` or more\"\n );\n }\n return repetition;\n}\nfunction thematicBreak(_, _1, state) {\n const value = (checkRule(state) + (state.options.ruleSpaces ? \" \" : \"\")).repeat(checkRuleRepetition(state));\n return state.options.ruleSpaces ? value.slice(0, -1) : value;\n}\nconst handle = {\n blockquote,\n break: hardBreak,\n code: code$1,\n definition,\n emphasis,\n hardBreak,\n heading,\n html,\n image,\n imageReference,\n inlineCode,\n link,\n linkReference,\n list,\n listItem,\n paragraph,\n root,\n strong,\n text: text$1,\n thematicBreak\n};\nfunction gfmTableFromMarkdown() {\n return {\n enter: {\n table: enterTable,\n tableData: enterCell,\n tableHeader: enterCell,\n tableRow: enterRow\n },\n exit: {\n codeText: exitCodeText,\n table: exitTable,\n tableData: exit,\n tableHeader: exit,\n tableRow: exit\n }\n };\n}\nfunction enterTable(token) {\n const align = token._align;\n this.enter(\n {\n type: \"table\",\n align: align.map(function(d) {\n return d === \"none\" ? null : d;\n }),\n children: []\n },\n token\n );\n this.data.inTable = true;\n}\nfunction exitTable(token) {\n this.exit(token);\n this.data.inTable = void 0;\n}\nfunction enterRow(token) {\n this.enter({ type: \"tableRow\", children: [] }, token);\n}\nfunction exit(token) {\n this.exit(token);\n}\nfunction enterCell(token) {\n this.enter({ type: \"tableCell\", children: [] }, token);\n}\nfunction exitCodeText(token) {\n let value = this.resume();\n if (this.data.inTable) {\n value = value.replace(/\\\\([\\\\|])/g, replace);\n }\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"inlineCode\");\n node.value = value;\n this.exit(token);\n}\nfunction replace($0, $1) {\n return $1 === \"|\" ? $1 : $0;\n}\nfunction gfmTableToMarkdown(options) {\n const settings = options || {};\n const padding = settings.tableCellPadding;\n const alignDelimiters = settings.tablePipeAlign;\n const stringLength = settings.stringLength;\n const around = padding ? \" \" : \"|\";\n return {\n unsafe: [\n { character: \"\\r\", inConstruct: \"tableCell\" },\n { character: \"\\n\", inConstruct: \"tableCell\" },\n // A pipe, when followed by a tab or space (padding), or a dash or colon\n // (unpadded delimiter row), could result in a table.\n { atBreak: true, character: \"|\", after: \"[\t :-]\" },\n // A pipe in a cell must be encoded.\n { character: \"|\", inConstruct: \"tableCell\" },\n // A colon must be followed by a dash, in which case it could start a\n // delimiter row.\n { atBreak: true, character: \":\", after: \"-\" },\n // A delimiter row can also start with a dash, when followed by more\n // dashes, a colon, or a pipe.\n // This is a stricter version than the built in check for lists, thematic\n // breaks, and setex heading underlines though:\n // \n { atBreak: true, character: \"-\", after: \"[:|-]\" }\n ],\n handlers: {\n inlineCode: inlineCodeWithTable,\n table: handleTable,\n tableCell: handleTableCell,\n tableRow: handleTableRow\n }\n };\n function handleTable(node, _, state, info) {\n return serializeData(handleTableAsData(node, state, info), node.align);\n }\n function handleTableRow(node, _, state, info) {\n const row = handleTableRowAsData(node, state, info);\n const value = serializeData([row]);\n return value.slice(0, value.indexOf(\"\\n\"));\n }\n function handleTableCell(node, _, state, info) {\n const exit2 = state.enter(\"tableCell\");\n const subexit = state.enter(\"phrasing\");\n const value = state.containerPhrasing(node, {\n ...info,\n before: around,\n after: around\n });\n subexit();\n exit2();\n return value;\n }\n function serializeData(matrix, align) {\n return markdownTable(matrix, {\n align,\n // @ts-expect-error: `markdown-table` types should support `null`.\n alignDelimiters,\n // @ts-expect-error: `markdown-table` types should support `null`.\n padding,\n // @ts-expect-error: `markdown-table` types should support `null`.\n stringLength\n });\n }\n function handleTableAsData(node, state, info) {\n const children = node.children;\n let index = -1;\n const result = [];\n const subexit = state.enter(\"table\");\n while (++index < children.length) {\n result[index] = handleTableRowAsData(children[index], state, info);\n }\n subexit();\n return result;\n }\n function handleTableRowAsData(node, state, info) {\n const children = node.children;\n let index = -1;\n const result = [];\n const subexit = state.enter(\"tableRow\");\n while (++index < children.length) {\n result[index] = handleTableCell(children[index], node, state, info);\n }\n subexit();\n return result;\n }\n function inlineCodeWithTable(node, parent, state) {\n let value = handle.inlineCode(node, parent, state);\n if (state.stack.includes(\"tableCell\")) {\n value = value.replace(/\\|/g, \"\\\\$&\");\n }\n return value;\n }\n}\nfunction gfmTaskListItemFromMarkdown() {\n return {\n exit: {\n taskListCheckValueChecked: exitCheck,\n taskListCheckValueUnchecked: exitCheck,\n paragraph: exitParagraphWithTaskListItem\n }\n };\n}\nfunction gfmTaskListItemToMarkdown() {\n return {\n unsafe: [{ atBreak: true, character: \"-\", after: \"[:|-]\" }],\n handlers: { listItem: listItemWithTaskListItem }\n };\n}\nfunction exitCheck(token) {\n const node = this.stack[this.stack.length - 2];\n ok$1(node.type === \"listItem\");\n node.checked = token.type === \"taskListCheckValueChecked\";\n}\nfunction exitParagraphWithTaskListItem(token) {\n const parent = this.stack[this.stack.length - 2];\n if (parent && parent.type === \"listItem\" && typeof parent.checked === \"boolean\") {\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"paragraph\");\n const head = node.children[0];\n if (head && head.type === \"text\") {\n const siblings = parent.children;\n let index = -1;\n let firstParaghraph;\n while (++index < siblings.length) {\n const sibling = siblings[index];\n if (sibling.type === \"paragraph\") {\n firstParaghraph = sibling;\n break;\n }\n }\n if (firstParaghraph === node) {\n head.value = head.value.slice(1);\n if (head.value.length === 0) {\n node.children.shift();\n } else if (node.position && head.position && typeof head.position.start.offset === \"number\") {\n head.position.start.column++;\n head.position.start.offset++;\n node.position.start = Object.assign({}, head.position.start);\n }\n }\n }\n }\n this.exit(token);\n}\nfunction listItemWithTaskListItem(node, parent, state, info) {\n const head = node.children[0];\n const checkable = typeof node.checked === \"boolean\" && head && head.type === \"paragraph\";\n const checkbox = \"[\" + (node.checked ? \"x\" : \" \") + \"] \";\n const tracker = state.createTracker(info);\n if (checkable) {\n tracker.move(checkbox);\n }\n let value = handle.listItem(node, parent, state, {\n ...info,\n ...tracker.current()\n });\n if (checkable) {\n value = value.replace(/^(?:[*+-]|\\d+\\.)([\\r\\n]| {1,3})/, check);\n }\n return value;\n function check($0) {\n return $0 + checkbox;\n }\n}\nfunction gfmFromMarkdown() {\n return [\n gfmAutolinkLiteralFromMarkdown(),\n gfmFootnoteFromMarkdown(),\n gfmStrikethroughFromMarkdown(),\n gfmTableFromMarkdown(),\n gfmTaskListItemFromMarkdown()\n ];\n}\nfunction gfmToMarkdown(options) {\n return {\n extensions: [\n gfmAutolinkLiteralToMarkdown(),\n gfmFootnoteToMarkdown(options),\n gfmStrikethroughToMarkdown(),\n gfmTableToMarkdown(options),\n gfmTaskListItemToMarkdown()\n ]\n };\n}\nfunction splice(list2, start, remove, items) {\n const end = list2.length;\n let chunkStart = 0;\n let parameters;\n if (start < 0) {\n start = -start > end ? 0 : end + start;\n } else {\n start = start > end ? end : start;\n }\n remove = remove > 0 ? remove : 0;\n if (items.length < 1e4) {\n parameters = Array.from(items);\n parameters.unshift(start, remove);\n list2.splice(...parameters);\n } else {\n if (remove) list2.splice(start, remove);\n while (chunkStart < items.length) {\n parameters = items.slice(chunkStart, chunkStart + 1e4);\n parameters.unshift(start, 0);\n list2.splice(...parameters);\n chunkStart += 1e4;\n start += 1e4;\n }\n }\n}\nconst hasOwnProperty = {}.hasOwnProperty;\nfunction combineExtensions(extensions) {\n const all = {};\n let index = -1;\n while (++index < extensions.length) {\n syntaxExtension(all, extensions[index]);\n }\n return all;\n}\nfunction syntaxExtension(all, extension) {\n let hook;\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : void 0;\n const left = maybe || (all[hook] = {});\n const right = extension[hook];\n let code2;\n if (right) {\n for (code2 in right) {\n if (!hasOwnProperty.call(left, code2)) left[code2] = [];\n const value = right[code2];\n constructs(\n // @ts-expect-error Looks like a list.\n left[code2],\n Array.isArray(value) ? value : value ? [value] : []\n );\n }\n }\n }\n}\nfunction constructs(existing, list2) {\n let index = -1;\n const before = [];\n while (++index < list2.length) {\n (list2[index].add === \"after\" ? existing : before).push(list2[index]);\n }\n splice(existing, 0, 0, before);\n}\nconst wwwPrefix = {\n tokenize: tokenizeWwwPrefix,\n partial: true\n};\nconst domain = {\n tokenize: tokenizeDomain,\n partial: true\n};\nconst path = {\n tokenize: tokenizePath,\n partial: true\n};\nconst trail = {\n tokenize: tokenizeTrail,\n partial: true\n};\nconst emailDomainDotTrail = {\n tokenize: tokenizeEmailDomainDotTrail,\n partial: true\n};\nconst wwwAutolink = {\n name: \"wwwAutolink\",\n tokenize: tokenizeWwwAutolink,\n previous: previousWww\n};\nconst protocolAutolink = {\n name: \"protocolAutolink\",\n tokenize: tokenizeProtocolAutolink,\n previous: previousProtocol\n};\nconst emailAutolink = {\n name: \"emailAutolink\",\n tokenize: tokenizeEmailAutolink,\n previous: previousEmail\n};\nconst text = {};\nfunction gfmAutolinkLiteral() {\n return {\n text\n };\n}\nlet code = 48;\nwhile (code < 123) {\n text[code] = emailAutolink;\n code++;\n if (code === 58) code = 65;\n else if (code === 91) code = 97;\n}\ntext[43] = emailAutolink;\ntext[45] = emailAutolink;\ntext[46] = emailAutolink;\ntext[95] = emailAutolink;\ntext[72] = [emailAutolink, protocolAutolink];\ntext[104] = [emailAutolink, protocolAutolink];\ntext[87] = [emailAutolink, wwwAutolink];\ntext[119] = [emailAutolink, wwwAutolink];\nfunction tokenizeEmailAutolink(effects, ok2, nok) {\n const self = this;\n let dot;\n let data;\n return start;\n function start(code2) {\n if (!gfmAtext(code2) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code2);\n }\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkEmail\");\n return atext(code2);\n }\n function atext(code2) {\n if (gfmAtext(code2)) {\n effects.consume(code2);\n return atext;\n }\n if (code2 === 64) {\n effects.consume(code2);\n return emailDomain;\n }\n return nok(code2);\n }\n function emailDomain(code2) {\n if (code2 === 46) {\n return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code2);\n }\n if (code2 === 45 || code2 === 95 || asciiAlphanumeric(code2)) {\n data = true;\n effects.consume(code2);\n return emailDomain;\n }\n return emailDomainAfter(code2);\n }\n function emailDomainDot(code2) {\n effects.consume(code2);\n dot = true;\n return emailDomain;\n }\n function emailDomainAfter(code2) {\n if (data && dot && asciiAlpha(self.previous)) {\n effects.exit(\"literalAutolinkEmail\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n return nok(code2);\n }\n}\nfunction tokenizeWwwAutolink(effects, ok2, nok) {\n const self = this;\n return wwwStart;\n function wwwStart(code2) {\n if (code2 !== 87 && code2 !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code2);\n }\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkWww\");\n return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code2);\n }\n function wwwAfter(code2) {\n effects.exit(\"literalAutolinkWww\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n}\nfunction tokenizeProtocolAutolink(effects, ok2, nok) {\n const self = this;\n let buffer = \"\";\n let seen = false;\n return protocolStart;\n function protocolStart(code2) {\n if ((code2 === 72 || code2 === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkHttp\");\n buffer += String.fromCodePoint(code2);\n effects.consume(code2);\n return protocolPrefixInside;\n }\n return nok(code2);\n }\n function protocolPrefixInside(code2) {\n if (asciiAlpha(code2) && buffer.length < 5) {\n buffer += String.fromCodePoint(code2);\n effects.consume(code2);\n return protocolPrefixInside;\n }\n if (code2 === 58) {\n const protocol = buffer.toLowerCase();\n if (protocol === \"http\" || protocol === \"https\") {\n effects.consume(code2);\n return protocolSlashesInside;\n }\n }\n return nok(code2);\n }\n function protocolSlashesInside(code2) {\n if (code2 === 47) {\n effects.consume(code2);\n if (seen) {\n return afterProtocol;\n }\n seen = true;\n return protocolSlashesInside;\n }\n return nok(code2);\n }\n function afterProtocol(code2) {\n return code2 === null || asciiControl(code2) || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || unicodePunctuation(code2) ? nok(code2) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code2);\n }\n function protocolAfter(code2) {\n effects.exit(\"literalAutolinkHttp\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n}\nfunction tokenizeWwwPrefix(effects, ok2, nok) {\n let size = 0;\n return wwwPrefixInside;\n function wwwPrefixInside(code2) {\n if ((code2 === 87 || code2 === 119) && size < 3) {\n size++;\n effects.consume(code2);\n return wwwPrefixInside;\n }\n if (code2 === 46 && size === 3) {\n effects.consume(code2);\n return wwwPrefixAfter;\n }\n return nok(code2);\n }\n function wwwPrefixAfter(code2) {\n return code2 === null ? nok(code2) : ok2(code2);\n }\n}\nfunction tokenizeDomain(effects, ok2, nok) {\n let underscoreInLastSegment;\n let underscoreInLastLastSegment;\n let seen;\n return domainInside;\n function domainInside(code2) {\n if (code2 === 46 || code2 === 95) {\n return effects.check(trail, domainAfter, domainAtPunctuation)(code2);\n }\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || code2 !== 45 && unicodePunctuation(code2)) {\n return domainAfter(code2);\n }\n seen = true;\n effects.consume(code2);\n return domainInside;\n }\n function domainAtPunctuation(code2) {\n if (code2 === 95) {\n underscoreInLastSegment = true;\n } else {\n underscoreInLastLastSegment = underscoreInLastSegment;\n underscoreInLastSegment = void 0;\n }\n effects.consume(code2);\n return domainInside;\n }\n function domainAfter(code2) {\n if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {\n return nok(code2);\n }\n return ok2(code2);\n }\n}\nfunction tokenizePath(effects, ok2) {\n let sizeOpen = 0;\n let sizeClose = 0;\n return pathInside;\n function pathInside(code2) {\n if (code2 === 40) {\n sizeOpen++;\n effects.consume(code2);\n return pathInside;\n }\n if (code2 === 41 && sizeClose < sizeOpen) {\n return pathAtPunctuation(code2);\n }\n if (code2 === 33 || code2 === 34 || code2 === 38 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 60 || code2 === 63 || code2 === 93 || code2 === 95 || code2 === 126) {\n return effects.check(trail, ok2, pathAtPunctuation)(code2);\n }\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return ok2(code2);\n }\n effects.consume(code2);\n return pathInside;\n }\n function pathAtPunctuation(code2) {\n if (code2 === 41) {\n sizeClose++;\n }\n effects.consume(code2);\n return pathInside;\n }\n}\nfunction tokenizeTrail(effects, ok2, nok) {\n return trail2;\n function trail2(code2) {\n if (code2 === 33 || code2 === 34 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 63 || code2 === 95 || code2 === 126) {\n effects.consume(code2);\n return trail2;\n }\n if (code2 === 38) {\n effects.consume(code2);\n return trailCharacterReferenceStart;\n }\n if (code2 === 93) {\n effects.consume(code2);\n return trailBracketAfter;\n }\n if (\n // `<` is an end.\n code2 === 60 || // So is whitespace.\n code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)\n ) {\n return ok2(code2);\n }\n return nok(code2);\n }\n function trailBracketAfter(code2) {\n if (code2 === null || code2 === 40 || code2 === 91 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return ok2(code2);\n }\n return trail2(code2);\n }\n function trailCharacterReferenceStart(code2) {\n return asciiAlpha(code2) ? trailCharacterReferenceInside(code2) : nok(code2);\n }\n function trailCharacterReferenceInside(code2) {\n if (code2 === 59) {\n effects.consume(code2);\n return trail2;\n }\n if (asciiAlpha(code2)) {\n effects.consume(code2);\n return trailCharacterReferenceInside;\n }\n return nok(code2);\n }\n}\nfunction tokenizeEmailDomainDotTrail(effects, ok2, nok) {\n return start;\n function start(code2) {\n effects.consume(code2);\n return after;\n }\n function after(code2) {\n return asciiAlphanumeric(code2) ? nok(code2) : ok2(code2);\n }\n}\nfunction previousWww(code2) {\n return code2 === null || code2 === 40 || code2 === 42 || code2 === 95 || code2 === 91 || code2 === 93 || code2 === 126 || markdownLineEndingOrSpace(code2);\n}\nfunction previousProtocol(code2) {\n return !asciiAlpha(code2);\n}\nfunction previousEmail(code2) {\n return !(code2 === 47 || gfmAtext(code2));\n}\nfunction gfmAtext(code2) {\n return code2 === 43 || code2 === 45 || code2 === 46 || code2 === 95 || asciiAlphanumeric(code2);\n}\nfunction previousUnbalanced(events) {\n let index = events.length;\n let result = false;\n while (index--) {\n const token = events[index][1];\n if ((token.type === \"labelLink\" || token.type === \"labelImage\") && !token._balanced) {\n result = true;\n break;\n }\n if (token._gfmAutolinkLiteralWalkedInto) {\n result = false;\n break;\n }\n }\n if (events.length > 0 && !result) {\n events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;\n }\n return result;\n}\nfunction resolveAll(constructs2, events, context) {\n const called = [];\n let index = -1;\n while (++index < constructs2.length) {\n const resolve = constructs2[index].resolveAll;\n if (resolve && !called.includes(resolve)) {\n events = resolve(events, context);\n called.push(resolve);\n }\n }\n return events;\n}\nfunction factorySpace(effects, ok2, type, max) {\n const limit = max ? max - 1 : Number.POSITIVE_INFINITY;\n let size = 0;\n return start;\n function start(code2) {\n if (markdownSpace(code2)) {\n effects.enter(type);\n return prefix(code2);\n }\n return ok2(code2);\n }\n function prefix(code2) {\n if (markdownSpace(code2) && size++ < limit) {\n effects.consume(code2);\n return prefix;\n }\n effects.exit(type);\n return ok2(code2);\n }\n}\nconst blankLine = {\n partial: true,\n tokenize: tokenizeBlankLine\n};\nfunction tokenizeBlankLine(effects, ok2, nok) {\n return start;\n function start(code2) {\n return markdownSpace(code2) ? factorySpace(effects, after, \"linePrefix\")(code2) : after(code2);\n }\n function after(code2) {\n return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);\n }\n}\nconst indent = {\n tokenize: tokenizeIndent,\n partial: true\n};\nfunction gfmFootnote() {\n return {\n document: {\n [91]: {\n name: \"gfmFootnoteDefinition\",\n tokenize: tokenizeDefinitionStart,\n continuation: {\n tokenize: tokenizeDefinitionContinuation\n },\n exit: gfmFootnoteDefinitionEnd\n }\n },\n text: {\n [91]: {\n name: \"gfmFootnoteCall\",\n tokenize: tokenizeGfmFootnoteCall\n },\n [93]: {\n name: \"gfmPotentialFootnoteCall\",\n add: \"after\",\n tokenize: tokenizePotentialGfmFootnoteCall,\n resolveTo: resolveToPotentialGfmFootnoteCall\n }\n }\n };\n}\nfunction tokenizePotentialGfmFootnoteCall(effects, ok2, nok) {\n const self = this;\n let index = self.events.length;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let labelStart;\n while (index--) {\n const token = self.events[index][1];\n if (token.type === \"labelImage\") {\n labelStart = token;\n break;\n }\n if (token.type === \"gfmFootnoteCall\" || token.type === \"labelLink\" || token.type === \"label\" || token.type === \"image\" || token.type === \"link\") {\n break;\n }\n }\n return start;\n function start(code2) {\n if (!labelStart || !labelStart._balanced) {\n return nok(code2);\n }\n const id = normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n }));\n if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {\n return nok(code2);\n }\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n return ok2(code2);\n }\n}\nfunction resolveToPotentialGfmFootnoteCall(events, context) {\n let index = events.length;\n while (index--) {\n if (events[index][1].type === \"labelImage\" && events[index][0] === \"enter\") {\n events[index][1];\n break;\n }\n }\n events[index + 1][1].type = \"data\";\n events[index + 3][1].type = \"gfmFootnoteCallLabelMarker\";\n const call = {\n type: \"gfmFootnoteCall\",\n start: Object.assign({}, events[index + 3][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n };\n const marker = {\n type: \"gfmFootnoteCallMarker\",\n start: Object.assign({}, events[index + 3][1].end),\n end: Object.assign({}, events[index + 3][1].end)\n };\n marker.end.column++;\n marker.end.offset++;\n marker.end._bufferIndex++;\n const string = {\n type: \"gfmFootnoteCallString\",\n start: Object.assign({}, marker.end),\n end: Object.assign({}, events[events.length - 1][1].start)\n };\n const chunk = {\n type: \"chunkString\",\n contentType: \"string\",\n start: Object.assign({}, string.start),\n end: Object.assign({}, string.end)\n };\n const replacement = [\n // Take the `labelImageMarker` (now `data`, the `!`)\n events[index + 1],\n events[index + 2],\n [\"enter\", call, context],\n // The `[`\n events[index + 3],\n events[index + 4],\n // The `^`.\n [\"enter\", marker, context],\n [\"exit\", marker, context],\n // Everything in between.\n [\"enter\", string, context],\n [\"enter\", chunk, context],\n [\"exit\", chunk, context],\n [\"exit\", string, context],\n // The ending (`]`, properly parsed and labelled).\n events[events.length - 2],\n events[events.length - 1],\n [\"exit\", call, context]\n ];\n events.splice(index, events.length - index + 1, ...replacement);\n return events;\n}\nfunction tokenizeGfmFootnoteCall(effects, ok2, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let size = 0;\n let data;\n return start;\n function start(code2) {\n effects.enter(\"gfmFootnoteCall\");\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n return callStart;\n }\n function callStart(code2) {\n if (code2 !== 94) return nok(code2);\n effects.enter(\"gfmFootnoteCallMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallMarker\");\n effects.enter(\"gfmFootnoteCallString\");\n effects.enter(\"chunkString\").contentType = \"string\";\n return callData;\n }\n function callData(code2) {\n if (\n // Too long.\n size > 999 || // Closing brace with nothing.\n code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)\n ) {\n return nok(code2);\n }\n if (code2 === 93) {\n effects.exit(\"chunkString\");\n const token = effects.exit(\"gfmFootnoteCallString\");\n if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {\n return nok(code2);\n }\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n effects.exit(\"gfmFootnoteCall\");\n return ok2;\n }\n if (!markdownLineEndingOrSpace(code2)) {\n data = true;\n }\n size++;\n effects.consume(code2);\n return code2 === 92 ? callEscape : callData;\n }\n function callEscape(code2) {\n if (code2 === 91 || code2 === 92 || code2 === 93) {\n effects.consume(code2);\n size++;\n return callData;\n }\n return callData(code2);\n }\n}\nfunction tokenizeDefinitionStart(effects, ok2, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let identifier;\n let size = 0;\n let data;\n return start;\n function start(code2) {\n effects.enter(\"gfmFootnoteDefinition\")._container = true;\n effects.enter(\"gfmFootnoteDefinitionLabel\");\n effects.enter(\"gfmFootnoteDefinitionLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionLabelMarker\");\n return labelAtMarker;\n }\n function labelAtMarker(code2) {\n if (code2 === 94) {\n effects.enter(\"gfmFootnoteDefinitionMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionMarker\");\n effects.enter(\"gfmFootnoteDefinitionLabelString\");\n effects.enter(\"chunkString\").contentType = \"string\";\n return labelInside;\n }\n return nok(code2);\n }\n function labelInside(code2) {\n if (\n // Too long.\n size > 999 || // Closing brace with nothing.\n code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)\n ) {\n return nok(code2);\n }\n if (code2 === 93) {\n effects.exit(\"chunkString\");\n const token = effects.exit(\"gfmFootnoteDefinitionLabelString\");\n identifier = normalizeIdentifier(self.sliceSerialize(token));\n effects.enter(\"gfmFootnoteDefinitionLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionLabelMarker\");\n effects.exit(\"gfmFootnoteDefinitionLabel\");\n return labelAfter;\n }\n if (!markdownLineEndingOrSpace(code2)) {\n data = true;\n }\n size++;\n effects.consume(code2);\n return code2 === 92 ? labelEscape : labelInside;\n }\n function labelEscape(code2) {\n if (code2 === 91 || code2 === 92 || code2 === 93) {\n effects.consume(code2);\n size++;\n return labelInside;\n }\n return labelInside(code2);\n }\n function labelAfter(code2) {\n if (code2 === 58) {\n effects.enter(\"definitionMarker\");\n effects.consume(code2);\n effects.exit(\"definitionMarker\");\n if (!defined.includes(identifier)) {\n defined.push(identifier);\n }\n return factorySpace(effects, whitespaceAfter, \"gfmFootnoteDefinitionWhitespace\");\n }\n return nok(code2);\n }\n function whitespaceAfter(code2) {\n return ok2(code2);\n }\n}\nfunction tokenizeDefinitionContinuation(effects, ok2, nok) {\n return effects.check(blankLine, ok2, effects.attempt(indent, ok2, nok));\n}\nfunction gfmFootnoteDefinitionEnd(effects) {\n effects.exit(\"gfmFootnoteDefinition\");\n}\nfunction tokenizeIndent(effects, ok2, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"gfmFootnoteDefinitionIndent\", 4 + 1);\n function afterPrefix(code2) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"gfmFootnoteDefinitionIndent\" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok2(code2) : nok(code2);\n }\n}\nfunction gfmStrikethrough(options) {\n const options_ = options || {};\n let single = options_.singleTilde;\n const tokenizer = {\n name: \"strikethrough\",\n tokenize: tokenizeStrikethrough,\n resolveAll: resolveAllStrikethrough\n };\n if (single === null || single === void 0) {\n single = true;\n }\n return {\n text: {\n [126]: tokenizer\n },\n insideSpan: {\n null: [tokenizer]\n },\n attentionMarkers: {\n null: [126]\n }\n };\n function resolveAllStrikethrough(events, context) {\n let index = -1;\n while (++index < events.length) {\n if (events[index][0] === \"enter\" && events[index][1].type === \"strikethroughSequenceTemporary\" && events[index][1]._close) {\n let open = index;\n while (open--) {\n if (events[open][0] === \"exit\" && events[open][1].type === \"strikethroughSequenceTemporary\" && events[open][1]._open && // If the sizes are the same:\n events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {\n events[index][1].type = \"strikethroughSequence\";\n events[open][1].type = \"strikethroughSequence\";\n const strikethrough = {\n type: \"strikethrough\",\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[index][1].end)\n };\n const text2 = {\n type: \"strikethroughText\",\n start: Object.assign({}, events[open][1].end),\n end: Object.assign({}, events[index][1].start)\n };\n const nextEvents = [[\"enter\", strikethrough, context], [\"enter\", events[open][1], context], [\"exit\", events[open][1], context], [\"enter\", text2, context]];\n const insideSpan = context.parser.constructs.insideSpan.null;\n if (insideSpan) {\n splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));\n }\n splice(nextEvents, nextEvents.length, 0, [[\"exit\", text2, context], [\"enter\", events[index][1], context], [\"exit\", events[index][1], context], [\"exit\", strikethrough, context]]);\n splice(events, open - 1, index - open + 3, nextEvents);\n index = open + nextEvents.length - 2;\n break;\n }\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n if (events[index][1].type === \"strikethroughSequenceTemporary\") {\n events[index][1].type = \"data\";\n }\n }\n return events;\n }\n function tokenizeStrikethrough(effects, ok2, nok) {\n const previous2 = this.previous;\n const events = this.events;\n let size = 0;\n return start;\n function start(code2) {\n if (previous2 === 126 && events[events.length - 1][1].type !== \"characterEscape\") {\n return nok(code2);\n }\n effects.enter(\"strikethroughSequenceTemporary\");\n return more(code2);\n }\n function more(code2) {\n const before = classifyCharacter(previous2);\n if (code2 === 126) {\n if (size > 1) return nok(code2);\n effects.consume(code2);\n size++;\n return more;\n }\n if (size < 2 && !single) return nok(code2);\n const token = effects.exit(\"strikethroughSequenceTemporary\");\n const after = classifyCharacter(code2);\n token._open = !after || after === 2 && Boolean(before);\n token._close = !before || before === 2 && Boolean(after);\n return ok2(code2);\n }\n }\n}\nclass EditMap {\n /**\n * Create a new edit map.\n */\n constructor() {\n this.map = [];\n }\n /**\n * Create an edit: a remove and/or add at a certain place.\n *\n * @param {number} index\n * @param {number} remove\n * @param {Array} add\n * @returns {undefined}\n */\n add(index, remove, add) {\n addImplementation(this, index, remove, add);\n }\n // To do: add this when moving to `micromark`.\n // /**\n // * Create an edit: but insert `add` before existing additions.\n // *\n // * @param {number} index\n // * @param {number} remove\n // * @param {Array} add\n // * @returns {undefined}\n // */\n // addBefore(index, remove, add) {\n // addImplementation(this, index, remove, add, true)\n // }\n /**\n * Done, change the events.\n *\n * @param {Array} events\n * @returns {undefined}\n */\n consume(events) {\n this.map.sort(function(a, b) {\n return a[0] - b[0];\n });\n if (this.map.length === 0) {\n return;\n }\n let index = this.map.length;\n const vecs = [];\n while (index > 0) {\n index -= 1;\n vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);\n events.length = this.map[index][0];\n }\n vecs.push(events.slice());\n events.length = 0;\n let slice = vecs.pop();\n while (slice) {\n for (const element of slice) {\n events.push(element);\n }\n slice = vecs.pop();\n }\n this.map.length = 0;\n }\n}\nfunction addImplementation(editMap, at, remove, add) {\n let index = 0;\n if (remove === 0 && add.length === 0) {\n return;\n }\n while (index < editMap.map.length) {\n if (editMap.map[index][0] === at) {\n editMap.map[index][1] += remove;\n editMap.map[index][2].push(...add);\n return;\n }\n index += 1;\n }\n editMap.map.push([at, remove, add]);\n}\nfunction gfmTableAlign(events, index) {\n let inDelimiterRow = false;\n const align = [];\n while (index < events.length) {\n const event = events[index];\n if (inDelimiterRow) {\n if (event[0] === \"enter\") {\n if (event[1].type === \"tableContent\") {\n align.push(events[index + 1][1].type === \"tableDelimiterMarker\" ? \"left\" : \"none\");\n }\n } else if (event[1].type === \"tableContent\") {\n if (events[index - 1][1].type === \"tableDelimiterMarker\") {\n const alignIndex = align.length - 1;\n align[alignIndex] = align[alignIndex] === \"left\" ? \"center\" : \"right\";\n }\n } else if (event[1].type === \"tableDelimiterRow\") {\n break;\n }\n } else if (event[0] === \"enter\" && event[1].type === \"tableDelimiterRow\") {\n inDelimiterRow = true;\n }\n index += 1;\n }\n return align;\n}\nfunction gfmTable() {\n return {\n flow: {\n null: {\n name: \"table\",\n tokenize: tokenizeTable,\n resolveAll: resolveTable\n }\n }\n };\n}\nfunction tokenizeTable(effects, ok2, nok) {\n const self = this;\n let size = 0;\n let sizeB = 0;\n let seen;\n return start;\n function start(code2) {\n let index = self.events.length - 1;\n while (index > -1) {\n const type = self.events[index][1].type;\n if (type === \"lineEnding\" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`\n type === \"linePrefix\") index--;\n else break;\n }\n const tail = index > -1 ? self.events[index][1].type : null;\n const next = tail === \"tableHead\" || tail === \"tableRow\" ? bodyRowStart : headRowBefore;\n if (next === bodyRowStart && self.parser.lazy[self.now().line]) {\n return nok(code2);\n }\n return next(code2);\n }\n function headRowBefore(code2) {\n effects.enter(\"tableHead\");\n effects.enter(\"tableRow\");\n return headRowStart(code2);\n }\n function headRowStart(code2) {\n if (code2 === 124) {\n return headRowBreak(code2);\n }\n seen = true;\n sizeB += 1;\n return headRowBreak(code2);\n }\n function headRowBreak(code2) {\n if (code2 === null) {\n return nok(code2);\n }\n if (markdownLineEnding(code2)) {\n if (sizeB > 1) {\n sizeB = 0;\n self.interrupt = true;\n effects.exit(\"tableRow\");\n effects.enter(\"lineEnding\");\n effects.consume(code2);\n effects.exit(\"lineEnding\");\n return headDelimiterStart;\n }\n return nok(code2);\n }\n if (markdownSpace(code2)) {\n return factorySpace(effects, headRowBreak, \"whitespace\")(code2);\n }\n sizeB += 1;\n if (seen) {\n seen = false;\n size += 1;\n }\n if (code2 === 124) {\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n seen = true;\n return headRowBreak;\n }\n effects.enter(\"data\");\n return headRowData(code2);\n }\n function headRowData(code2) {\n if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {\n effects.exit(\"data\");\n return headRowBreak(code2);\n }\n effects.consume(code2);\n return code2 === 92 ? headRowEscape : headRowData;\n }\n function headRowEscape(code2) {\n if (code2 === 92 || code2 === 124) {\n effects.consume(code2);\n return headRowData;\n }\n return headRowData(code2);\n }\n function headDelimiterStart(code2) {\n self.interrupt = false;\n if (self.parser.lazy[self.now().line]) {\n return nok(code2);\n }\n effects.enter(\"tableDelimiterRow\");\n seen = false;\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterBefore, \"linePrefix\", self.parser.constructs.disable.null.includes(\"codeIndented\") ? void 0 : 4)(code2);\n }\n return headDelimiterBefore(code2);\n }\n function headDelimiterBefore(code2) {\n if (code2 === 45 || code2 === 58) {\n return headDelimiterValueBefore(code2);\n }\n if (code2 === 124) {\n seen = true;\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n return headDelimiterCellBefore;\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterCellBefore(code2) {\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterValueBefore, \"whitespace\")(code2);\n }\n return headDelimiterValueBefore(code2);\n }\n function headDelimiterValueBefore(code2) {\n if (code2 === 58) {\n sizeB += 1;\n seen = true;\n effects.enter(\"tableDelimiterMarker\");\n effects.consume(code2);\n effects.exit(\"tableDelimiterMarker\");\n return headDelimiterLeftAlignmentAfter;\n }\n if (code2 === 45) {\n sizeB += 1;\n return headDelimiterLeftAlignmentAfter(code2);\n }\n if (code2 === null || markdownLineEnding(code2)) {\n return headDelimiterCellAfter(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterLeftAlignmentAfter(code2) {\n if (code2 === 45) {\n effects.enter(\"tableDelimiterFiller\");\n return headDelimiterFiller(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterFiller(code2) {\n if (code2 === 45) {\n effects.consume(code2);\n return headDelimiterFiller;\n }\n if (code2 === 58) {\n seen = true;\n effects.exit(\"tableDelimiterFiller\");\n effects.enter(\"tableDelimiterMarker\");\n effects.consume(code2);\n effects.exit(\"tableDelimiterMarker\");\n return headDelimiterRightAlignmentAfter;\n }\n effects.exit(\"tableDelimiterFiller\");\n return headDelimiterRightAlignmentAfter(code2);\n }\n function headDelimiterRightAlignmentAfter(code2) {\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterCellAfter, \"whitespace\")(code2);\n }\n return headDelimiterCellAfter(code2);\n }\n function headDelimiterCellAfter(code2) {\n if (code2 === 124) {\n return headDelimiterBefore(code2);\n }\n if (code2 === null || markdownLineEnding(code2)) {\n if (!seen || size !== sizeB) {\n return headDelimiterNok(code2);\n }\n effects.exit(\"tableDelimiterRow\");\n effects.exit(\"tableHead\");\n return ok2(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterNok(code2) {\n return nok(code2);\n }\n function bodyRowStart(code2) {\n effects.enter(\"tableRow\");\n return bodyRowBreak(code2);\n }\n function bodyRowBreak(code2) {\n if (code2 === 124) {\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n return bodyRowBreak;\n }\n if (code2 === null || markdownLineEnding(code2)) {\n effects.exit(\"tableRow\");\n return ok2(code2);\n }\n if (markdownSpace(code2)) {\n return factorySpace(effects, bodyRowBreak, \"whitespace\")(code2);\n }\n effects.enter(\"data\");\n return bodyRowData(code2);\n }\n function bodyRowData(code2) {\n if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {\n effects.exit(\"data\");\n return bodyRowBreak(code2);\n }\n effects.consume(code2);\n return code2 === 92 ? bodyRowEscape : bodyRowData;\n }\n function bodyRowEscape(code2) {\n if (code2 === 92 || code2 === 124) {\n effects.consume(code2);\n return bodyRowData;\n }\n return bodyRowData(code2);\n }\n}\nfunction resolveTable(events, context) {\n let index = -1;\n let inFirstCellAwaitingPipe = true;\n let rowKind = 0;\n let lastCell = [0, 0, 0, 0];\n let cell = [0, 0, 0, 0];\n let afterHeadAwaitingFirstBodyRow = false;\n let lastTableEnd = 0;\n let currentTable;\n let currentBody;\n let currentCell;\n const map2 = new EditMap();\n while (++index < events.length) {\n const event = events[index];\n const token = event[1];\n if (event[0] === \"enter\") {\n if (token.type === \"tableHead\") {\n afterHeadAwaitingFirstBodyRow = false;\n if (lastTableEnd !== 0) {\n flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);\n currentBody = void 0;\n lastTableEnd = 0;\n }\n currentTable = {\n type: \"table\",\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map2.add(index, 0, [[\"enter\", currentTable, context]]);\n } else if (token.type === \"tableRow\" || token.type === \"tableDelimiterRow\") {\n inFirstCellAwaitingPipe = true;\n currentCell = void 0;\n lastCell = [0, 0, 0, 0];\n cell = [0, index + 1, 0, 0];\n if (afterHeadAwaitingFirstBodyRow) {\n afterHeadAwaitingFirstBodyRow = false;\n currentBody = {\n type: \"tableBody\",\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map2.add(index, 0, [[\"enter\", currentBody, context]]);\n }\n rowKind = token.type === \"tableDelimiterRow\" ? 2 : currentBody ? 3 : 1;\n } else if (rowKind && (token.type === \"data\" || token.type === \"tableDelimiterMarker\" || token.type === \"tableDelimiterFiller\")) {\n inFirstCellAwaitingPipe = false;\n if (cell[2] === 0) {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);\n lastCell = [0, 0, 0, 0];\n }\n cell[2] = index;\n }\n } else if (token.type === \"tableCellDivider\") {\n if (inFirstCellAwaitingPipe) {\n inFirstCellAwaitingPipe = false;\n } else {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);\n }\n lastCell = cell;\n cell = [lastCell[1], index, 0, 0];\n }\n }\n } else if (token.type === \"tableHead\") {\n afterHeadAwaitingFirstBodyRow = true;\n lastTableEnd = index;\n } else if (token.type === \"tableRow\" || token.type === \"tableDelimiterRow\") {\n lastTableEnd = index;\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, index, currentCell);\n } else if (cell[1] !== 0) {\n currentCell = flushCell(map2, context, cell, rowKind, index, currentCell);\n }\n rowKind = 0;\n } else if (rowKind && (token.type === \"data\" || token.type === \"tableDelimiterMarker\" || token.type === \"tableDelimiterFiller\")) {\n cell[3] = index;\n }\n }\n if (lastTableEnd !== 0) {\n flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);\n }\n map2.consume(context.events);\n index = -1;\n while (++index < context.events.length) {\n const event = context.events[index];\n if (event[0] === \"enter\" && event[1].type === \"table\") {\n event[1]._align = gfmTableAlign(context.events, index);\n }\n }\n return events;\n}\nfunction flushCell(map2, context, range, rowKind, rowEnd, previousCell) {\n const groupName = rowKind === 1 ? \"tableHeader\" : rowKind === 2 ? \"tableDelimiter\" : \"tableData\";\n const valueName = \"tableContent\";\n if (range[0] !== 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, range[0]));\n map2.add(range[0], 0, [[\"exit\", previousCell, context]]);\n }\n const now = getPoint(context.events, range[1]);\n previousCell = {\n type: groupName,\n start: Object.assign({}, now),\n // Note: correct end is set later.\n end: Object.assign({}, now)\n };\n map2.add(range[1], 0, [[\"enter\", previousCell, context]]);\n if (range[2] !== 0) {\n const relatedStart = getPoint(context.events, range[2]);\n const relatedEnd = getPoint(context.events, range[3]);\n const valueToken = {\n type: valueName,\n start: Object.assign({}, relatedStart),\n end: Object.assign({}, relatedEnd)\n };\n map2.add(range[2], 0, [[\"enter\", valueToken, context]]);\n if (rowKind !== 2) {\n const start = context.events[range[2]];\n const end = context.events[range[3]];\n start[1].end = Object.assign({}, end[1].end);\n start[1].type = \"chunkText\";\n start[1].contentType = \"text\";\n if (range[3] > range[2] + 1) {\n const a = range[2] + 1;\n const b = range[3] - range[2] - 1;\n map2.add(a, b, []);\n }\n }\n map2.add(range[3] + 1, 0, [[\"exit\", valueToken, context]]);\n }\n if (rowEnd !== void 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));\n map2.add(rowEnd, 0, [[\"exit\", previousCell, context]]);\n previousCell = void 0;\n }\n return previousCell;\n}\nfunction flushTableEnd(map2, context, index, table, tableBody) {\n const exits = [];\n const related = getPoint(context.events, index);\n if (tableBody) {\n tableBody.end = Object.assign({}, related);\n exits.push([\"exit\", tableBody, context]);\n }\n table.end = Object.assign({}, related);\n exits.push([\"exit\", table, context]);\n map2.add(index + 1, 0, exits);\n}\nfunction getPoint(events, index) {\n const event = events[index];\n const side = event[0] === \"enter\" ? \"start\" : \"end\";\n return event[1][side];\n}\nconst tasklistCheck = {\n name: \"tasklistCheck\",\n tokenize: tokenizeTasklistCheck\n};\nfunction gfmTaskListItem() {\n return {\n text: {\n [91]: tasklistCheck\n }\n };\n}\nfunction tokenizeTasklistCheck(effects, ok2, nok) {\n const self = this;\n return open;\n function open(code2) {\n if (\n // Exit if there’s stuff before.\n self.previous !== null || // Exit if not in the first content that is the first child of a list\n // item.\n !self._gfmTasklistFirstContentOfListItem\n ) {\n return nok(code2);\n }\n effects.enter(\"taskListCheck\");\n effects.enter(\"taskListCheckMarker\");\n effects.consume(code2);\n effects.exit(\"taskListCheckMarker\");\n return inside;\n }\n function inside(code2) {\n if (markdownLineEndingOrSpace(code2)) {\n effects.enter(\"taskListCheckValueUnchecked\");\n effects.consume(code2);\n effects.exit(\"taskListCheckValueUnchecked\");\n return close;\n }\n if (code2 === 88 || code2 === 120) {\n effects.enter(\"taskListCheckValueChecked\");\n effects.consume(code2);\n effects.exit(\"taskListCheckValueChecked\");\n return close;\n }\n return nok(code2);\n }\n function close(code2) {\n if (code2 === 93) {\n effects.enter(\"taskListCheckMarker\");\n effects.consume(code2);\n effects.exit(\"taskListCheckMarker\");\n effects.exit(\"taskListCheck\");\n return after;\n }\n return nok(code2);\n }\n function after(code2) {\n if (markdownLineEnding(code2)) {\n return ok2(code2);\n }\n if (markdownSpace(code2)) {\n return effects.check({\n tokenize: spaceThenNonSpace\n }, ok2, nok)(code2);\n }\n return nok(code2);\n }\n}\nfunction spaceThenNonSpace(effects, ok2, nok) {\n return factorySpace(effects, after, \"whitespace\");\n function after(code2) {\n return code2 === null ? nok(code2) : ok2(code2);\n }\n}\nfunction gfm(options) {\n return combineExtensions([\n gfmAutolinkLiteral(),\n gfmFootnote(),\n gfmStrikethrough(options),\n gfmTable(),\n gfmTaskListItem()\n ]);\n}\nconst emptyOptions = {};\nfunction remarkGfm(options) {\n const self = (\n /** @type {Processor} */\n this\n );\n const settings = options || emptyOptions;\n const data = self.data();\n const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);\n const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);\n const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);\n micromarkExtensions.push(gfm(settings));\n fromMarkdownExtensions.push(gfmFromMarkdown());\n toMarkdownExtensions.push(gfmToMarkdown(settings));\n}\nconst _sfc_main$1 = /* @__PURE__ */ defineComponent({\n __name: \"NcRichTextCopyButton\",\n props: {\n contentId: {}\n },\n setup(__props) {\n const { copy, icon, altText } = useCopy(() => document.getElementById(__props.contentId).textContent);\n return (_ctx, _cache) => {\n return openBlock(), createBlock(NcButton, {\n variant: \"tertiary\",\n size: \"small\",\n \"aria-label\": unref(altText),\n title: unref(altText),\n onClick: unref(copy)\n }, {\n icon: withCtx(() => [\n createVNode(NcIconSvgWrapper, {\n path: unref(icon),\n inline: \"\"\n }, null, 8, [\"path\"])\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"]);\n };\n }\n});\n/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isTextNode$1(node) {\n return node.type === \"text\";\n}\nconst transformPlaceholders = function(ast) {\n visitParents(ast, isTextNode$1, (node, ancestors) => {\n const parent = ancestors.at(-1);\n const index = parent.children.indexOf(node);\n const placeholders = node.value.split(/(\\{[a-z\\-_.0-9]+\\})/ig).map((entry) => {\n const matches = entry.match(/^\\{([a-z\\-_.0-9]+)\\}$/i);\n if (!matches) {\n return u(\"text\", entry);\n }\n const [, component] = matches;\n return u(\"element\", {\n tagName: `#${component}`,\n children: []\n });\n });\n parent.children.splice(index, 1, ...placeholders);\n });\n};\nconst remarkPlaceholder = () => transformPlaceholders;\n/*!\n * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isCodeNode(node) {\n return [\"code\", \"inlineCode\"].includes(node.type);\n}\nconst remarkStripCode = function() {\n return function(tree) {\n visitParents(tree, isCodeNode, (node, ancestors) => {\n const parent = ancestors.at(-1);\n const index = parent.children.indexOf(node);\n parent.children.splice(index, 1, {\n ...node,\n value: \"\"\n });\n return [SKIP, index + 1];\n });\n };\n};\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isTextNode(node) {\n return [\"text\", \"code\", \"inlineCode\"].includes(node.type);\n}\nconst remarkUnescape = function() {\n return function(tree) {\n visitParents(tree, isTextNode, (node, ancestors) => {\n const parent = ancestors.at(-1);\n const index = parent.children.indexOf(node);\n parent.children.splice(index, 1, {\n ...node,\n value: node.value.replace(/</gmi, \"<\").replace(/>/gmi, \">\")\n });\n return [SKIP, index + 1];\n });\n };\n};\nconst LINK_PROTOCOLS = [\"http\", \"https\", \"mailto\", \"tel\"];\nconst rehypeHighlight = ref(null);\nasync function importRehypeHighlightLibrary() {\n const module = await import(\"rehype-highlight\");\n rehypeHighlight.value = module.default;\n}\nconst _sfc_main = {\n name: \"NcRichText\",\n components: {\n NcReferenceList\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n /**\n * The main text\n */\n text: {\n type: String,\n default: \"\"\n },\n /**\n * Arguments for the richobjects\n */\n arguments: {\n type: Object,\n default: () => {\n return {};\n }\n },\n /**\n * Limit the number of reference widgets to render\n */\n referenceLimit: {\n type: Number,\n default: 0\n },\n /**\n * Whether to render the widgets in interactive mode (if available)\n */\n referenceInteractive: {\n type: Boolean,\n default: true\n },\n /**\n * Whether to show user an option to enable to interactive mode for widgets (if available)\n */\n referenceInteractiveOptIn: {\n type: Boolean,\n default: false\n },\n /** Provide data upfront to avoid extra http request */\n references: {\n type: Array,\n default: null\n },\n /** Provide basic Markdown syntax */\n useMarkdown: {\n type: Boolean,\n default: false\n },\n /** Provide GitHub Flavored Markdown syntax */\n useExtendedMarkdown: {\n type: Boolean,\n default: false\n },\n /** Provide event from rendered markdown inputs */\n interactive: {\n type: Boolean,\n default: false\n },\n /**\n * Automatically convert link-like text to markdown links\n */\n autolink: {\n type: Boolean,\n default: true\n }\n },\n emits: [\n \"interactTodo\"\n ],\n data() {\n return {\n parentId: createElementId()\n };\n },\n methods: {\n renderPlaintext() {\n const placeholders = this.text.split(/(\\{[a-z\\-_.0-9]+\\})/ig).map((entry) => {\n const matches = entry.match(/^\\{([a-z\\-_.0-9]+)\\}$/i);\n if (!matches) {\n return this.prepareTextNode(entry);\n }\n const argumentId = matches[1];\n const argument = this.arguments[argumentId];\n if (typeof argument === \"object\") {\n const { component, props } = argument;\n return h(typeof component === \"string\" ? resolveComponent(component) : component, {\n ...props,\n class: \"rich-text--component\"\n });\n }\n if (argument) {\n return h(\"span\", { class: \"rich-text--fallback\" }, argument);\n }\n return entry;\n });\n return h(\"div\", { class: \"rich-text--wrapper\" }, [\n h(\"div\", {}, placeholders.flat()),\n this.referenceLimit > 0 ? h(\"div\", { class: \"rich-text--reference-widget\" }, [\n h(NcReferenceList, {\n text: this.text,\n referenceData: this.references,\n interactive: this.referenceInteractive,\n interactiveOptIn: this.referenceInteractiveOptIn\n })\n ]) : null\n ]);\n },\n renderMarkdown() {\n const renderedMarkdown = unified().use(remarkParse).use(remarkAutolink, {\n autolink: this.autolink,\n useMarkdown: this.useMarkdown,\n useExtendedMarkdown: this.useExtendedMarkdown\n }).use(remarkUnescape).use(this.useExtendedMarkdown ? remarkGfm : void 0).use(breaks).use(remarkUnlinkProtocols, { except: LINK_PROTOCOLS }).use(remark2rehype, {\n handlers: {\n component(toHast, node) {\n return toHast(node, node.component, { value: node.value });\n }\n }\n }).use(this.useExtendedMarkdown ? rehypeHighlight.value : void 0).use(remarkPlaceholder).use(rehypeExternalLinks, {\n target: \"_blank\",\n rel: [\"noopener noreferrer\"]\n }).use(rehype2react, {\n Fragment,\n jsx: this.createElement,\n jsxs: this.createElement,\n elementAttributeNameCase: \"html\",\n prefix: false\n }).processSync(this.text.replace(/<[^>]+>/g, (match) => match.replace(/\")).result;\n return h(\"div\", { class: \"rich-text--wrapper rich-text--wrapper-markdown\" }, [\n renderedMarkdown,\n this.referenceLimit > 0 ? h(\"div\", { class: \"rich-text--reference-widget\" }, [\n h(NcReferenceList, {\n text: this.prepareReferenceSource(this.text),\n referenceData: this.references,\n interactive: this.referenceInteractive,\n interactiveOptIn: this.referenceInteractiveOptIn\n })\n ]) : null\n ]);\n },\n /**\n * Render plain text nodes\n *\n * @param {string} text - Content of the node\n */\n prepareTextNode(text2) {\n if (this.autolink) {\n text2 = parseUrl(text2);\n }\n if (Array.isArray(text2)) {\n return text2.map((entry) => {\n if (typeof entry === \"string\") {\n return entry;\n }\n const { component, props } = entry;\n return h(component, {\n ...props,\n class: \"rich-text--component\"\n });\n });\n }\n return text2;\n },\n /**\n * Strip content of inline code and code blocks for reference widgets\n * (e.g. ignore fenced links from being added as reference)\n *\n * @param {string} text - Content of the node\n */\n prepareReferenceSource(text2) {\n if (!this.useMarkdown && !this.useExtendedMarkdown) {\n return text2;\n }\n const processor = unified();\n processor.compiler = (tree) => toString(tree);\n return processor.use(remarkParse).use(remarkStripCode).processSync(text2.replace(/\\s/g, \" \")).value;\n },\n createElement(type, props, key) {\n if (key) {\n props.key = key;\n }\n const children = props.children ?? [];\n delete props.children;\n if (!String(type).startsWith(\"#\")) {\n if ([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"].includes(String(type))) {\n type = `h${Math.min(+String(type)[1] + 3, 6)}`;\n }\n let nestedNode = null;\n if (this.useExtendedMarkdown) {\n if (String(type) === \"code\" && !rehypeHighlight.value && props?.class?.includes(\"language\")) {\n importRehypeHighlightLibrary();\n }\n if (String(type) === \"pre\" && children && String(children.type) === \"code\") {\n const id = this.parentId + \"-code-block-\" + createElementId();\n return h(\"p\", { class: \"rich-text__code-block\" }, [\n h(type, { ...props, id }, children),\n h(_sfc_main$1, { class: \"rich-text__code-block-button\", contentId: id })\n ]);\n }\n if (String(type) === \"li\" && Array.isArray(children) && children.length !== 0 && children[0].type === \"input\" && children[0].props.type === \"checkbox\") {\n const [inputNode, , ...labelParts] = children;\n const nestedNodeIndex = labelParts.findIndex((child) => [\"ul\", \"ol\", \"li\", \"blockquote\", \"pre\"].includes(child.type));\n if (nestedNodeIndex !== -1) {\n nestedNode = labelParts[nestedNodeIndex];\n labelParts.splice(nestedNodeIndex);\n }\n const id = this.parentId + \"-markdown-input-\" + createElementId();\n const propsToForward = { ...inputNode.props };\n delete propsToForward.checked;\n const inputComponent = h(NcCheckboxRadioSwitch, {\n ...propsToForward,\n modelValue: inputNode.props.checked,\n id,\n disabled: !this.interactive,\n \"onUpdate:modelValue\": () => {\n this.$emit(\"interactTodo\", id);\n }\n }, { default: () => labelParts });\n return h(type, props, [inputComponent, nestedNode]);\n }\n }\n if (String(type) === \"a\") {\n const route = getRoute(this.$router, props.href);\n if (route) {\n delete props.href;\n delete props.target;\n return h(RouterLink, {\n ...props,\n to: route\n }, { default: () => children });\n }\n const isAllowedScheme = /^(https?:\\/\\/|tel:|mailto:)/.test(props.href);\n if (isAllowedScheme) {\n props.href = props.href.trim();\n return h(NcRichTextExternalLink, props, children);\n } else {\n delete props.href;\n delete props.target;\n return h(\"span\", props, children);\n }\n }\n return h(type, props, children);\n }\n const placeholder = this.arguments[type.slice(1)];\n if (!placeholder) {\n return h(\"span\", { ...props, class: \"rich-text--fallback\" }, [`{${type.slice(1)}}`]);\n }\n if (!placeholder.component) {\n return h(\"span\", { ...props }, [placeholder]);\n }\n return h(\n typeof placeholder.component === \"string\" ? resolveComponent(placeholder.component) : placeholder.component,\n {\n ...props,\n ...placeholder.props,\n class: \"rich-text--component\"\n },\n { default: () => children }\n );\n }\n },\n render() {\n return this.useMarkdown || this.useExtendedMarkdown ? this.renderMarkdown() : this.renderPlaintext();\n }\n};\nconst NcRichText = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-80e57a29\"]]);\nexport {\n NcRichText as N,\n NcReferenceList as a\n};\n//# sourceMappingURL=NcRichText.mjs.map\n","import { l as logger } from \"./logger.mjs\";\nwindow._vue_richtext_custom_picker_elements ??= {};\nwindow._registerCustomPickerElement ??= registerCustomPickerElement;\nclass NcCustomPickerRenderResult {\n element;\n object;\n /**\n * @param element - The HTML element\n * @param object - The object\n */\n constructor(element, object) {\n this.element = element;\n this.object = object;\n }\n}\nfunction isCustomPickerElementRegistered(id) {\n return !!window._vue_richtext_custom_picker_elements[id];\n}\nfunction getCustomPickerElementSize(id) {\n const size = window._vue_richtext_custom_picker_elements[id]?.size;\n if (size && [\"small\", \"normal\", \"large\", \"full\"].includes(size)) {\n return size;\n }\n return null;\n}\nfunction registerCustomPickerElement(id, callback, onDestroy = () => {\n}, size = \"large\") {\n if (window._vue_richtext_custom_picker_elements[id]) {\n logger.error(`Custom reference picker element for id ${id} already registered`);\n return;\n }\n window._vue_richtext_custom_picker_elements[id] = {\n id,\n callback,\n onDestroy,\n size\n };\n}\nfunction renderCustomPickerElement(el, options) {\n const { providerId, accessible } = options;\n if (!window._vue_richtext_custom_picker_elements[providerId]) {\n logger.error(`Custom reference picker element for reference provider ID ${providerId} not registered`);\n return;\n }\n return window._vue_richtext_custom_picker_elements[providerId].callback(el, { providerId, accessible });\n}\nfunction destroyCustomPickerElement(providerId, el, renderResult) {\n if (!window._vue_richtext_custom_picker_elements[providerId]) {\n return;\n }\n window._vue_richtext_custom_picker_elements[providerId].onDestroy(el, renderResult);\n}\nexport {\n NcCustomPickerRenderResult as N,\n renderCustomPickerElement as a,\n destroyCustomPickerElement as d,\n getCustomPickerElementSize as g,\n isCustomPickerElementRegistered as i,\n registerCustomPickerElement as r\n};\n//# sourceMappingURL=customPickerElements.mjs.map\n","export default function debounce(function_, wait = 100, options = {}) {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError(`Expected the first parameter to be a function, got \\`${typeof function_}\\`.`);\n\t}\n\n\tif (wait < 0) {\n\t\tthrow new RangeError('`wait` must not be negative.');\n\t}\n\n\tif (typeof options === 'boolean') {\n\t\tthrow new TypeError('The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.');\n\t}\n\n\tconst {immediate} = options;\n\n\tlet storedContext;\n\tlet storedArguments;\n\tlet timeoutId;\n\tlet timestamp;\n\tlet result;\n\n\tfunction run() {\n\t\tconst callContext = storedContext;\n\t\tconst callArguments = storedArguments;\n\t\tstoredContext = undefined;\n\t\tstoredArguments = undefined;\n\t\tresult = function_.apply(callContext, callArguments);\n\t\treturn result;\n\t}\n\n\tfunction later() {\n\t\tconst last = Date.now() - timestamp;\n\n\t\tif (last < wait && last >= 0) {\n\t\t\ttimeoutId = setTimeout(later, wait - last);\n\t\t} else {\n\t\t\ttimeoutId = undefined;\n\n\t\t\tif (!immediate) {\n\t\t\t\tresult = run();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst debounced = function (...arguments_) {\n\t\tif (\n\t\t\tstoredContext\n\t\t\t&& this !== storedContext\n\t\t\t&& Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)\n\t\t) {\n\t\t\tthrow new Error('Debounced method called with different contexts of the same prototype.');\n\t\t}\n\n\t\tstoredContext = this; // eslint-disable-line unicorn/no-this-assignment\n\t\tstoredArguments = arguments_;\n\t\ttimestamp = Date.now();\n\n\t\tconst callNow = immediate && !timeoutId;\n\n\t\tif (!timeoutId) {\n\t\t\ttimeoutId = setTimeout(later, wait);\n\t\t}\n\n\t\tif (callNow) {\n\t\t\tresult = run();\n\t\t\treturn result;\n\t\t}\n\n\t\treturn undefined;\n\t};\n\n\tObject.defineProperty(debounced, 'isPending', {\n\t\tget() {\n\t\t\treturn timeoutId !== undefined;\n\t\t},\n\t});\n\n\tdebounced.clear = () => {\n\t\tif (!timeoutId) {\n\t\t\treturn;\n\t\t}\n\n\t\tclearTimeout(timeoutId);\n\t\ttimeoutId = undefined;\n\t\tstoredContext = undefined;\n\t\tstoredArguments = undefined;\n\t};\n\n\tdebounced.flush = () => {\n\t\tif (!timeoutId) {\n\t\t\treturn;\n\t\t}\n\n\t\tdebounced.trigger();\n\t};\n\n\tdebounced.trigger = () => {\n\t\tresult = run();\n\n\t\tdebounced.clear();\n\t};\n\n\treturn debounced;\n}\n","import '../assets/referencePickerModal.css';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode, toDisplayString, createCommentVNode, resolveComponent, createVNode, withCtx, withKeys, createBlock, normalizeClass, createTextVNode, withModifiers, normalizeStyle, createApp } from \"vue\";\nimport { emit } from \"@nextcloud/event-bus\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { I as IconClose } from \"./Close.mjs\";\nimport { a as renderCustomPickerElement, d as destroyCustomPickerElement, i as isCustomPickerElementRegistered, g as getCustomPickerElementSize } from \"./customPickerElements.mjs\";\nimport axios from \"@nextcloud/axios\";\nimport { loadState } from \"@nextcloud/initial-state\";\nimport { imagePath, generateOcsUrl } from \"@nextcloud/router\";\nimport { r as register, X as t9, a as t, Y as t47, Z as t42, _ as t26, s as t44, $ as t33, A as t20, a0 as t13 } from \"./_l10n.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nimport { N as NcEmptyContent } from \"./NcEmptyContent.mjs\";\nimport { _ as _sfc_main$9 } from \"./NcHighlight.vue_vue_type_script_lang.mjs\";\nimport { N as NcSelect } from \"./NcSelect.mjs\";\nimport debounce from \"debounce\";\nimport { N as NcReferenceWidget } from \"./NcReferenceWidget.mjs\";\nimport { N as NcLoadingIcon } from \"./NcLoadingIcon.mjs\";\nimport { _ as _sfc_main$a } from \"./NcTextField.vue_vue_type_script_setup_true_lang.mjs\";\nimport { I as IconDotsHorizontal } from \"./NcActions.mjs\";\nimport { N as NcButton } from \"./NcButton.mjs\";\nimport { N as NcModal } from \"./NcModal.mjs\";\nconst _sfc_main$8 = {\n name: \"ArrowLeftIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$8 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$6 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$5 = { d: \"M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z\" };\nconst _hoisted_4$4 = { key: 0 };\nfunction _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon arrow-left-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$5, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$4, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$6))\n ], 16, _hoisted_1$8);\n}\nconst ArrowLeftIcon = /* @__PURE__ */ _export_sfc(_sfc_main$8, [[\"render\", _sfc_render$8]]);\nconst _sfc_main$7 = {\n name: \"NcCustomPickerElement\",\n props: {\n /**\n * The reference provider\n */\n provider: {\n type: Object,\n required: true\n }\n },\n emits: [\n \"cancel\",\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n isRegistered: isCustomPickerElementRegistered(this.provider.id),\n renderResult: null\n };\n },\n mounted() {\n if (this.isRegistered) {\n this.renderElement();\n }\n },\n beforeUnmount() {\n if (this.isRegistered) {\n destroyCustomPickerElement(this.provider.id, this.$el, this.renderResult);\n }\n },\n methods: {\n renderElement() {\n if (this.$refs.domElement) {\n this.$refs.domElement.innerHTML = \"\";\n }\n const renderFunctionResult = renderCustomPickerElement(this.$refs.domElement, { providerId: this.provider.id, accessible: false });\n Promise.resolve(renderFunctionResult).then((result) => {\n this.renderResult = result;\n if (this.renderResult.object?._isVue && this.renderResult.object?.$on) {\n this.renderResult.object.$on(\"submit\", this.onSubmit);\n this.renderResult.object.$on(\"pick\", this.onPick);\n this.renderResult.object.$on(\"cancel\", this.onCancel);\n }\n this.renderResult.element.addEventListener(\"submit\", (e) => {\n this.onSubmit(e.detail);\n });\n this.renderResult.element.addEventListener(\"pick\", (e) => {\n this.onPick(e.detail);\n });\n this.renderResult.element.addEventListener(\"cancel\", this.onCancel);\n });\n },\n onSubmit(value) {\n this.$emit(\"submit\", value);\n },\n onPick(value) {\n this.$emit(\"pick\", value);\n },\n onCancel() {\n this.$emit(\"cancel\");\n }\n }\n};\nconst _hoisted_1$7 = { ref: \"domElement\" };\nfunction _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", _hoisted_1$7, null, 512);\n}\nconst NcCustomPickerElement = /* @__PURE__ */ _export_sfc(_sfc_main$7, [[\"render\", _sfc_render$7], [\"__scopeId\", \"data-v-df9d8f84\"]]);\nconst _sfc_main$6 = {\n name: \"LinkVariantIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$6 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$5 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$4 = { d: \"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z\" };\nconst _hoisted_4$3 = { key: 0 };\nfunction _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon link-variant-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$4, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$3, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$5))\n ], 16, _hoisted_1$6);\n}\nconst LinkVariantIcon = /* @__PURE__ */ _export_sfc(_sfc_main$6, [[\"render\", _sfc_render$6]]);\nregister(t9);\nconst anyLinkProviderId = \"any-link\";\nconst anyLinkProvider = {\n id: anyLinkProviderId,\n title: t(\"Any link\"),\n order: 0,\n icon_url: imagePath(\"core\", \"filetypes/link.svg\")\n};\nwindow._vue_richtext_reference_providers ??= loadState(\"core\", \"reference-provider-list\", []);\nwindow._vue_richtext_reference_provider_timestamps ??= loadState(\"core\", \"reference-provider-timestamps\", {});\nfunction getProvider(providerId) {\n if (providerId === anyLinkProviderId) {\n return anyLinkProvider;\n }\n return getProviders().find((p) => p.id === providerId);\n}\nfunction getProviders() {\n return window._vue_richtext_reference_providers.filter((p) => {\n const keep = !!p.search_providers_ids && p.search_providers_ids.length > 0 || isCustomPickerElementRegistered(p.id);\n if (!keep) {\n logger.debug(`[smart picker] ${p.id} reference provider is discoverable but does not have any related search provider or custom picker component registered`);\n }\n return keep;\n });\n}\nfunction sortProviders(providerList) {\n const timestamps = window._vue_richtext_reference_provider_timestamps;\n return providerList.sort((a, b) => {\n return a.order === b.order ? 0 : a.order > b.order ? 1 : -1;\n }).sort((a, b) => {\n const ta = timestamps[a.id];\n const tb = timestamps[b.id];\n return ta === tb ? 0 : tb === void 0 ? -1 : ta === void 0 ? 1 : ta > tb ? -1 : 1;\n });\n}\nfunction searchProvider(query, limit) {\n const providers = getProviders();\n const escapedQuery = query.replace(/[/\\-\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n const regexp = new RegExp(escapedQuery, \"i\");\n const sortedProviders = sortProviders(providers);\n const filteredSortedProviders = sortedProviders.filter((p) => {\n return p.title.match(regexp);\n });\n const searchResult = limit ? filteredSortedProviders.slice(0, limit) : filteredSortedProviders;\n if (query === \"\" || searchResult.length === 0) {\n searchResult.push(anyLinkProvider);\n }\n return searchResult;\n}\nasync function touchProvider(providerId) {\n const timestamp = Math.floor(Date.now() / 1e3);\n const url = generateOcsUrl(\"references/provider/{providerId}\", { providerId });\n await axios.put(url, { timestamp });\n window._vue_richtext_reference_provider_timestamps[providerId] = timestamp;\n}\nregister(t42, t47);\n/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isUrl(str) {\n try {\n return Boolean(new URL(str));\n } catch {\n return false;\n }\n}\nconst _sfc_main$5 = {\n name: \"NcProviderList\",\n components: {\n NcSelect,\n NcHighlight: _sfc_main$9,\n NcEmptyContent,\n LinkVariantIcon\n },\n emits: [\n \"selectProvider\",\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n selectedProvider: null,\n query: \"\",\n multiselectPlaceholder: t(\"Select provider\"),\n providerIconAlt: t(\"Provider icon\")\n };\n },\n computed: {\n options() {\n const result = [];\n if (this.query !== \"\" && isUrl(this.query)) {\n result.push({\n id: this.query,\n title: this.query,\n isLink: true\n });\n }\n result.push(...searchProvider(this.query));\n return result;\n }\n },\n methods: {\n focus() {\n setTimeout(() => {\n this.$refs[\"provider-select\"]?.$el?.querySelector(\"#provider-select-input\")?.focus();\n }, 300);\n },\n onProviderSelected(p) {\n if (p !== null) {\n if (p.isLink) {\n this.$emit(\"submit\", p.title);\n this.$emit(\"pick\", { link: p.title });\n } else {\n this.$emit(\"selectProvider\", p);\n }\n this.selectedProvider = null;\n }\n },\n onSearch(query) {\n this.query = query;\n }\n }\n};\nconst _hoisted_1$5 = { class: \"provider-list\" };\nconst _hoisted_2$4 = {\n key: 0,\n class: \"provider\"\n};\nconst _hoisted_3$3 = {\n key: 1,\n class: \"provider\"\n};\nconst _hoisted_4$2 = [\"src\", \"alt\"];\nfunction _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcHighlight = resolveComponent(\"NcHighlight\");\n const _component_NcSelect = resolveComponent(\"NcSelect\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$5, [\n createVNode(_component_NcSelect, {\n ref: \"provider-select\",\n modelValue: $data.selectedProvider,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.selectedProvider = $event),\n $options.onProviderSelected\n ],\n class: \"provider-list--select\",\n inputId: \"provider-select-input\",\n label: \"title\",\n placeholder: $data.multiselectPlaceholder,\n options: $options.options,\n appendToBody: false,\n clearSearchOnSelect: true,\n clearSearchOnBlur: () => false,\n filterable: false,\n onSearch: $options.onSearch\n }, {\n option: withCtx((option) => [\n option.isLink ? (openBlock(), createElementBlock(\"div\", _hoisted_2$4, [\n createVNode(_component_LinkVariantIcon, {\n class: \"link-icon\",\n size: 20\n }),\n createElementVNode(\"span\", null, toDisplayString(option.title), 1)\n ])) : (openBlock(), createElementBlock(\"div\", _hoisted_3$3, [\n createElementVNode(\"img\", {\n class: \"provider-icon\",\n src: option.icon_url,\n alt: $data.providerIconAlt\n }, null, 8, _hoisted_4$2),\n createVNode(_component_NcHighlight, {\n class: \"option-text\",\n search: $data.query,\n text: option.title\n }, null, 8, [\"search\", \"text\"])\n ]))\n ]),\n _: 1\n }, 8, [\"modelValue\", \"placeholder\", \"options\", \"onSearch\", \"onUpdate:modelValue\"]),\n createVNode(_component_NcEmptyContent, { class: \"provider-list--empty-content\" }, {\n icon: withCtx(() => [\n createVNode(_component_LinkVariantIcon)\n ]),\n _: 1\n })\n ]);\n}\nconst NcProviderList = /* @__PURE__ */ _export_sfc(_sfc_main$5, [[\"render\", _sfc_render$5], [\"__scopeId\", \"data-v-c9740c42\"]]);\nregister(t26);\nconst _sfc_main$4 = {\n name: \"NcRawLinkInput\",\n components: {\n LinkVariantIcon,\n NcEmptyContent,\n NcLoadingIcon,\n NcReferenceWidget,\n NcTextField: _sfc_main$a\n },\n props: {\n /**\n * The reference provider\n */\n provider: {\n type: Object,\n required: true\n }\n },\n emits: [\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n inputValue: \"\",\n loading: false,\n reference: null,\n abortController: null,\n inputPlaceholder: t(\"Enter link\")\n };\n },\n computed: {\n isLinkValid() {\n return isUrl(this.inputValue);\n },\n debouncedUpdateReference() {\n return debounce(this.updateReference, 500);\n }\n },\n methods: {\n focus() {\n this.$refs[\"url-input\"].$el.getElementsByTagName(\"input\")[0]?.focus();\n },\n onSubmit(e) {\n const value = e.target.value;\n if (this.isLinkValid) {\n this.$emit(\"submit\", value);\n this.$emit(\"pick\", { link: value });\n }\n },\n onClear() {\n this.inputValue = \"\";\n this.reference = null;\n },\n onInput() {\n this.reference = null;\n if (this.abortController) {\n this.abortController.abort();\n }\n if (this.isLinkValid) {\n this.debouncedUpdateReference();\n }\n },\n updateReference() {\n this.loading = true;\n this.abortController = new AbortController();\n axios.get(generateOcsUrl(\"references/resolve\", 2) + \"?reference=\" + encodeURIComponent(this.inputValue), {\n signal: this.abortController.signal\n }).then((response) => {\n this.reference = response.data.ocs.data.references[this.inputValue];\n }).catch((error) => {\n logger.error(\"[NcRawLinkInput] Failed to update reference\", { error });\n }).then(() => {\n this.loading = false;\n });\n }\n }\n};\nconst _hoisted_1$4 = { class: \"raw-link\" };\nconst _hoisted_2$3 = { class: \"input-wrapper\" };\nconst _hoisted_3$2 = [\"src\"];\nfunction _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcLoadingIcon = resolveComponent(\"NcLoadingIcon\");\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcTextField = resolveComponent(\"NcTextField\");\n const _component_NcReferenceWidget = resolveComponent(\"NcReferenceWidget\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$4, [\n createElementVNode(\"div\", _hoisted_2$3, [\n createVNode(_component_NcTextField, {\n ref: \"url-input\",\n modelValue: $data.inputValue,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.inputValue = $event),\n $options.onInput\n ],\n showTrailingButton: $data.inputValue !== \"\",\n label: $data.inputPlaceholder,\n onTrailingButtonClick: $options.onClear,\n onKeyup: withKeys($options.onSubmit, [\"enter\"])\n }, {\n default: withCtx(() => [\n $data.loading ? (openBlock(), createBlock(_component_NcLoadingIcon, {\n key: 0,\n size: 16\n })) : (openBlock(), createBlock(_component_LinkVariantIcon, {\n key: 1,\n size: 16\n }))\n ]),\n _: 1\n }, 8, [\"modelValue\", \"showTrailingButton\", \"label\", \"onTrailingButtonClick\", \"onUpdate:modelValue\", \"onKeyup\"])\n ]),\n $data.reference !== null ? (openBlock(), createBlock(_component_NcReferenceWidget, {\n key: 0,\n class: \"reference-widget\",\n reference: $data.reference\n }, null, 8, [\"reference\"])) : (openBlock(), createBlock(_component_NcEmptyContent, {\n key: 1,\n class: \"raw-link--empty-content\"\n }, {\n icon: withCtx(() => [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon\",\n src: $props.provider.icon_url\n }, null, 8, _hoisted_3$2)) : (openBlock(), createBlock(_component_LinkVariantIcon, { key: 1 }))\n ]),\n _: 1\n }))\n ]);\n}\nconst NcRawLinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$4, [[\"render\", _sfc_render$4], [\"__scopeId\", \"data-v-fb24b594\"]]);\nconst _sfc_main$3 = {\n name: \"NcSearchResult\",\n components: {\n NcHighlight: _sfc_main$9\n },\n props: {\n /**\n * Unified search result entry\n */\n entry: {\n type: Object,\n required: true\n },\n /**\n * The query that led to getting this result\n * Used to highlight the entry text\n */\n query: {\n type: String,\n required: true\n }\n }\n};\nconst _hoisted_1$3 = { class: \"result\" };\nconst _hoisted_2$2 = [\"src\"];\nconst _hoisted_3$1 = { class: \"result--content\" };\nconst _hoisted_4$1 = { class: \"result--content--name\" };\nconst _hoisted_5$1 = { class: \"result--content--subline\" };\nfunction _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcHighlight = resolveComponent(\"NcHighlight\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$3, [\n $props.entry.icon ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass([{ [$props.entry.icon]: true, rounded: $props.entry.rounded }, \"result--icon-class\"])\n }, null, 2)) : (openBlock(), createElementBlock(\"img\", {\n key: 1,\n class: normalizeClass([\"result--image\", { rounded: $props.entry.rounded }]),\n src: $props.entry.thumbnailUrl\n }, null, 10, _hoisted_2$2)),\n createElementVNode(\"div\", _hoisted_3$1, [\n createElementVNode(\"span\", _hoisted_4$1, [\n createVNode(_component_NcHighlight, {\n search: $props.query,\n text: $props.entry.title\n }, null, 8, [\"search\", \"text\"])\n ]),\n createElementVNode(\"span\", _hoisted_5$1, [\n createVNode(_component_NcHighlight, {\n search: $props.query,\n text: $props.entry.subline\n }, null, 8, [\"search\", \"text\"])\n ])\n ])\n ]);\n}\nconst NcSearchResult = /* @__PURE__ */ _export_sfc(_sfc_main$3, [[\"render\", _sfc_render$3], [\"__scopeId\", \"data-v-059edcfb\"]]);\nregister(t33, t42, t44);\nconst LIMIT = 5;\nconst _sfc_main$2 = {\n name: \"NcSearch\",\n components: {\n LinkVariantIcon,\n DotsHorizontalIcon: IconDotsHorizontal,\n NcEmptyContent,\n NcSelect,\n NcSearchResult\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n /**\n * The selected reference provider\n */\n provider: {\n type: Object,\n required: true\n },\n /**\n * Whether to show the empty content when there are no search results\n */\n showEmptyContent: {\n type: Boolean,\n default: true\n },\n /**\n * Placeholder of the search\n */\n searchPlaceholder: {\n type: String,\n default: null\n }\n },\n emits: [\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n searchQuery: \"\",\n selectedResult: null,\n resultsBySearchProvider: {},\n searching: false,\n searchingMoreOf: null,\n abortController: null,\n noOptionsText: t(\"Start typing to search\"),\n providerIconAlt: t(\"Provider icon\")\n };\n },\n computed: {\n mySearchPlaceholder() {\n return this.searchPlaceholder || t(\"Search\");\n },\n searchProviderIds() {\n return this.provider.search_providers_ids;\n },\n options() {\n if (this.searchQuery === \"\") {\n return [];\n }\n const options = [];\n if (isUrl(this.searchQuery)) {\n options.push(this.rawLinkEntry);\n }\n options.push(...this.formattedSearchResults);\n return options;\n },\n rawLinkEntry() {\n return {\n id: \"rawLinkEntry\",\n resourceUrl: this.searchQuery,\n isRawLink: true\n };\n },\n formattedSearchResults() {\n const results = [];\n this.searchProviderIds.forEach((pid) => {\n if (this.resultsBySearchProvider[pid].entries.length > 0) {\n if (this.searchProviderIds.length > 1 || this.resultsBySearchProvider[pid].entries.length > 1) {\n results.push({\n id: \"groupTitle-\" + pid,\n name: this.resultsBySearchProvider[pid].name,\n isCustomGroupTitle: true,\n providerId: pid\n });\n }\n const providerEntriesWithId = this.resultsBySearchProvider[pid].entries.map((entry, index) => {\n return {\n id: \"provider-\" + pid + \"-entry-\" + index,\n ...entry\n };\n });\n results.push(...providerEntriesWithId);\n if (this.resultsBySearchProvider[pid].isPaginated) {\n results.push({\n id: \"moreOf-\" + pid,\n name: this.resultsBySearchProvider[pid].name,\n isMore: true,\n providerId: pid,\n isLoading: this.searchingMoreOf === pid\n });\n }\n }\n });\n return results;\n },\n debouncedUpdateSearch() {\n return debounce(this.updateSearch, 500);\n }\n },\n mounted() {\n this.resetResults();\n },\n beforeUnmount() {\n this.cancelSearchRequests();\n },\n methods: {\n t,\n resetResults() {\n const resultsBySearchProvider = {};\n this.searchProviderIds.forEach((pid) => {\n resultsBySearchProvider[pid] = {\n entries: []\n };\n });\n this.resultsBySearchProvider = resultsBySearchProvider;\n },\n focus() {\n setTimeout(() => {\n this.$refs[\"search-select\"]?.$el?.querySelector(\"#search-select-input\")?.focus();\n }, 300);\n },\n cancelSearchRequests() {\n if (this.abortController) {\n this.abortController.abort();\n }\n },\n onSearchInput(query) {\n this.searchQuery = query;\n this.debouncedUpdateSearch();\n },\n onSelectResultSelected(item) {\n if (item !== null) {\n if (item.resourceUrl) {\n this.cancelSearchRequests();\n this.$emit(\"submit\", item.resourceUrl);\n const reference = { link: item.resourceUrl };\n if (item.title) {\n reference.title = item.title;\n }\n this.$emit(\"pick\", reference);\n } else if (item.isMore) {\n this.searchMoreOf(item.providerId).then(() => {\n this.selectedResult = null;\n });\n }\n }\n },\n searchMoreOf(searchProviderId) {\n this.searchingMoreOf = searchProviderId;\n this.cancelSearchRequests();\n return this.searchProviders(searchProviderId);\n },\n updateSearch() {\n this.cancelSearchRequests();\n this.resetResults();\n if (this.searchQuery === \"\") {\n this.searching = false;\n return;\n }\n return this.searchProviders();\n },\n searchProviders(searchProviderId = null) {\n this.abortController = new AbortController();\n this.searching = true;\n const searchPromises = searchProviderId === null ? [...this.searchProviderIds].map((pid) => {\n return this.searchOneProvider(pid);\n }) : [this.searchOneProvider(searchProviderId, this.resultsBySearchProvider[searchProviderId]?.cursor ?? null)];\n return Promise.allSettled(searchPromises).then((promises) => {\n const isOneCanceled = !!promises.find((p) => {\n return p.status === \"rejected\" && (p.reason.name === \"CanceledError\" || p.reason.code === \"ERR_CANCELED\");\n });\n if (!isOneCanceled) {\n this.searching = false;\n this.searchingMoreOf = null;\n }\n });\n },\n searchOneProvider(providerId, cursor = null) {\n const url = cursor === null ? generateOcsUrl(\"search/providers/{providerId}/search?term={term}&limit={limit}\", { providerId, term: this.searchQuery, limit: LIMIT }) : generateOcsUrl(\"search/providers/{providerId}/search?term={term}&limit={limit}&cursor={cursor}\", { providerId, term: this.searchQuery, limit: LIMIT, cursor });\n return axios.get(url, {\n signal: this.abortController.signal\n }).then((response) => {\n const data = response.data.ocs.data;\n this.resultsBySearchProvider[providerId].name = data.name;\n this.resultsBySearchProvider[providerId].cursor = data.cursor;\n this.resultsBySearchProvider[providerId].isPaginated = data.isPaginated;\n this.resultsBySearchProvider[providerId].entries.push(...data.entries);\n });\n }\n }\n};\nconst _hoisted_1$2 = {\n key: 0,\n class: \"custom-option\"\n};\nconst _hoisted_2$1 = { class: \"option-text\" };\nconst _hoisted_3 = {\n key: 2,\n class: \"custom-option group-name\"\n};\nconst _hoisted_4 = [\"src\"];\nconst _hoisted_5 = { class: \"option-text\" };\nconst _hoisted_6 = {\n key: 3,\n class: \"custom-option\"\n};\nconst _hoisted_7 = {\n key: 0,\n class: \"option-simple-icon icon-loading-small\"\n};\nconst _hoisted_8 = { class: \"option-text\" };\nconst _hoisted_9 = [\"alt\", \"src\"];\nfunction _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcSearchResult = resolveComponent(\"NcSearchResult\");\n const _component_DotsHorizontalIcon = resolveComponent(\"DotsHorizontalIcon\");\n const _component_NcSelect = resolveComponent(\"NcSelect\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", {\n class: normalizeClass([\"smart-picker-search\", { \"with-empty-content\": $props.showEmptyContent }])\n }, [\n createVNode(_component_NcSelect, {\n ref: \"search-select\",\n modelValue: $data.selectedResult,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.selectedResult = $event),\n $options.onSelectResultSelected\n ],\n class: \"smart-picker-search--select\",\n inputId: \"search-select-input\",\n label: \"name\",\n placeholder: $options.mySearchPlaceholder,\n options: $options.options,\n appendToBody: false,\n closeOnSelect: false,\n clearSearchOnSelect: false,\n clearSearchOnBlur: () => false,\n resetFocusOnOptionsChange: false,\n filterable: false,\n autoscroll: true,\n resetOnOptionsChange: false,\n loading: $data.searching,\n onSearch: $options.onSearchInput\n }, {\n option: withCtx((option) => [\n option.isRawLink ? (openBlock(), createElementBlock(\"div\", _hoisted_1$2, [\n createVNode(_component_LinkVariantIcon, {\n class: \"option-simple-icon\",\n size: 20\n }),\n createElementVNode(\"span\", _hoisted_2$1, toDisplayString($options.t(\"Raw link {options}\", { options: option.resourceUrl })), 1)\n ])) : option.resourceUrl ? (openBlock(), createBlock(_component_NcSearchResult, {\n key: 1,\n class: \"search-result\",\n entry: option,\n query: $data.searchQuery\n }, null, 8, [\"entry\", \"query\"])) : option.isCustomGroupTitle ? (openBlock(), createElementBlock(\"span\", _hoisted_3, [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon group-name-icon\",\n src: $props.provider.icon_url\n }, null, 8, _hoisted_4)) : createCommentVNode(\"\", true),\n createElementVNode(\"span\", _hoisted_5, [\n createElementVNode(\"strong\", null, toDisplayString(option.name), 1)\n ])\n ])) : option.isMore ? (openBlock(), createElementBlock(\"span\", _hoisted_6, [\n option.isLoading ? (openBlock(), createElementBlock(\"span\", _hoisted_7)) : (openBlock(), createBlock(_component_DotsHorizontalIcon, {\n key: 1,\n class: \"option-simple-icon\",\n size: 20\n })),\n createElementVNode(\"span\", _hoisted_8, toDisplayString($options.t('Load more \"{options}\"', { options: option.name })), 1)\n ])) : createCommentVNode(\"\", true)\n ]),\n \"no-options\": withCtx(() => [\n createTextVNode(toDisplayString($data.noOptionsText), 1)\n ]),\n _: 1\n }, 8, [\"modelValue\", \"placeholder\", \"options\", \"loading\", \"onSearch\", \"onUpdate:modelValue\"]),\n $props.showEmptyContent ? (openBlock(), createBlock(_component_NcEmptyContent, {\n key: 0,\n class: \"smart-picker-search--empty-content\"\n }, {\n icon: withCtx(() => [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon\",\n alt: $data.providerIconAlt,\n src: $props.provider.icon_url\n }, null, 8, _hoisted_9)) : (openBlock(), createBlock(_component_LinkVariantIcon, { key: 1 }))\n ]),\n _: 1\n })) : createCommentVNode(\"\", true)\n ], 2);\n}\nconst NcSearch = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render$2], [\"__scopeId\", \"data-v-d965b4c7\"]]);\nconst MODES = {\n providerList: 1,\n standardLinkInput: 2,\n searchInput: 3,\n customElement: 4\n};\nconst _sfc_main$1 = {\n name: \"NcReferencePicker\",\n components: {\n NcCustomPickerElement,\n NcProviderList,\n NcRawLinkInput,\n NcSearch\n },\n props: {\n /**\n * Provider to select on creation\n * Default: null. Show the provider list\n */\n initialProvider: {\n type: Object,\n default: () => null\n },\n /**\n * Optional width in pixels\n * Default: 100%\n */\n width: {\n type: Number,\n default: null\n },\n /**\n * Focus on the provider list select input on creation\n * Default: true\n */\n focusOnCreate: {\n type: Boolean,\n default: true\n }\n },\n emits: [\n \"cancel\",\n \"cancelRawLink\",\n \"cancelSearch\",\n \"providerSelected\",\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n MODES,\n selectedProvider: this.initialProvider\n };\n },\n computed: {\n mode() {\n return this.selectedProvider === null ? MODES.providerList : isCustomPickerElementRegistered(this.selectedProvider.id) ? MODES.customElement : this.selectedProvider.search_providers_ids ? MODES.searchInput : MODES.standardLinkInput;\n },\n pickerWrapperStyle() {\n return {\n width: this.width ? this.width + \"px\" : void 0\n };\n }\n },\n mounted() {\n if (this.focusOnCreate) {\n if (this.initialProvider) {\n setTimeout(() => {\n this.$refs[\"url-input\"]?.focus();\n }, 300);\n } else {\n this.$nextTick(() => {\n this.$refs[\"provider-list\"]?.focus();\n });\n }\n }\n },\n methods: {\n onEscapePressed() {\n if (this.selectedProvider !== null) {\n this.deselectProvider();\n } else {\n this.cancelProviderSelection();\n }\n },\n onProviderSelected(provider) {\n this.selectedProvider = provider;\n this.$emit(\"providerSelected\", provider);\n this.$nextTick(() => {\n this.$refs[\"url-input\"]?.focus();\n });\n },\n cancelCustomElement() {\n this.deselectProvider();\n },\n cancelSearch() {\n this.$emit(\"cancelSearch\", this.selectedProvider?.title);\n this.deselectProvider();\n },\n cancelRawLinkInput() {\n this.$emit(\"cancelRawLink\", this.selectedProvider?.title);\n this.deselectProvider();\n },\n cancelProviderSelection() {\n this.$emit(\"cancel\");\n },\n submitLink(link) {\n if (this.selectedProvider !== null) {\n touchProvider(this.selectedProvider.id);\n }\n this.$emit(\"submit\", link);\n this.deselectProvider();\n },\n pickLink(reference) {\n if (this.selectedProvider !== null) {\n touchProvider(this.selectedProvider.id);\n }\n this.$emit(\"pick\", reference);\n this.deselectProvider();\n },\n deselectProvider() {\n this.selectedProvider = null;\n this.$emit(\"providerSelected\", null);\n setTimeout(() => {\n this.$refs[\"provider-list\"]?.focus();\n }, 300);\n }\n }\n};\nconst _hoisted_1$1 = {\n key: 3,\n class: \"custom-element-wrapper\"\n};\nfunction _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcProviderList = resolveComponent(\"NcProviderList\");\n const _component_NcRawLinkInput = resolveComponent(\"NcRawLinkInput\");\n const _component_NcSearch = resolveComponent(\"NcSearch\");\n const _component_NcCustomPickerElement = resolveComponent(\"NcCustomPickerElement\");\n return openBlock(), createElementBlock(\"div\", {\n class: \"reference-picker\",\n style: normalizeStyle($options.pickerWrapperStyle),\n tabindex: \"-1\",\n onKeydown: _cache[0] || (_cache[0] = withKeys(withModifiers((...args) => $options.onEscapePressed && $options.onEscapePressed(...args), [\"stop\", \"prevent\"]), [\"esc\"]))\n }, [\n $options.mode === $data.MODES.providerList ? (openBlock(), createBlock(_component_NcProviderList, {\n key: 0,\n ref: \"provider-list\",\n onSelectProvider: $options.onProviderSelected,\n onSubmit: $options.submitLink,\n onPick: $options.pickLink,\n onCancel: $options.cancelProviderSelection\n }, null, 8, [\"onSelectProvider\", \"onSubmit\", \"onPick\", \"onCancel\"])) : $options.mode === $data.MODES.standardLinkInput ? (openBlock(), createBlock(_component_NcRawLinkInput, {\n key: 1,\n ref: \"url-input\",\n provider: $data.selectedProvider,\n onSubmit: $options.submitLink,\n onPick: $options.pickLink,\n onCancel: $options.cancelRawLinkInput\n }, null, 8, [\"provider\", \"onSubmit\", \"onPick\", \"onCancel\"])) : $options.mode === $data.MODES.searchInput ? (openBlock(), createBlock(_component_NcSearch, {\n key: 2,\n ref: \"url-input\",\n provider: $data.selectedProvider,\n onSubmit: $options.submitLink,\n onPick: $options.pickLink,\n onCancel: $options.cancelSearch\n }, null, 8, [\"provider\", \"onSubmit\", \"onPick\", \"onCancel\"])) : $options.mode === $data.MODES.customElement ? (openBlock(), createElementBlock(\"div\", _hoisted_1$1, [\n createVNode(_component_NcCustomPickerElement, {\n provider: $data.selectedProvider,\n class: \"custom-element\",\n onSubmit: $options.submitLink,\n onPick: $options.pickLink,\n onCancel: $options.cancelCustomElement\n }, null, 8, [\"provider\", \"onSubmit\", \"onPick\", \"onCancel\"])\n ])) : createCommentVNode(\"\", true)\n ], 36);\n}\nconst NcReferencePicker = /* @__PURE__ */ _export_sfc(_sfc_main$1, [[\"render\", _sfc_render$1], [\"__scopeId\", \"data-v-40667c6c\"]]);\nregister(t13, t20);\nconst _sfc_main = {\n name: \"NcReferencePickerModal\",\n components: {\n NcReferencePicker,\n NcModal,\n NcButton,\n ArrowLeftIcon,\n CloseIcon: IconClose\n },\n props: {\n /**\n * Provider to select on creation\n * Show the provider list if no initial one is provided\n */\n initialProvider: {\n type: Object,\n default: () => null\n },\n /**\n * Focus on the input item on create\n */\n focusOnCreate: {\n type: Boolean,\n default: true\n },\n /**\n * If true, add the modal content to the Viewer trap elements via the event-bus\n */\n isInsideViewer: {\n type: Boolean,\n default: false\n }\n },\n emits: [\n \"cancel\",\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n show: true,\n selectedProvider: this.initialProvider,\n backButtonTitle: t(\"Back to provider selection\"),\n closeButtonTitle: t(\"Close\"),\n closeButtonLabel: t(\"Close Smart Picker\")\n };\n },\n computed: {\n isProviderSelected() {\n return this.selectedProvider !== null;\n },\n showBackButton() {\n return this.initialProvider === null && this.isProviderSelected;\n },\n modalSize() {\n return this.isProviderSelected && isCustomPickerElementRegistered(this.selectedProvider.id) ? getCustomPickerElementSize(this.selectedProvider.id) ?? \"large\" : \"normal\";\n },\n showModalName() {\n return !this.isProviderSelected || !isCustomPickerElementRegistered(this.selectedProvider.id);\n },\n modalName() {\n return this.isProviderSelected ? this.selectedProvider.title : t(\"Smart Picker\");\n }\n },\n mounted() {\n if (this.isInsideViewer) {\n const elem = this.$refs.modal_content;\n emit(\"viewer:trapElements:changed\", elem);\n }\n },\n methods: {\n onCancel() {\n this.show = false;\n this.$emit(\"cancel\");\n },\n onSubmit(value) {\n this.show = false;\n this.$emit(\"submit\", value);\n },\n onPick(value) {\n this.show = false;\n this.$emit(\"pick\", value);\n },\n onProviderSelect(provider) {\n this.selectedProvider = provider;\n if (provider === null && this.initialProvider !== null) {\n this.onCancel();\n }\n },\n onBackClicked() {\n this.$refs.referencePicker.deselectProvider();\n }\n }\n};\nconst _hoisted_1 = {\n ref: \"modal_content\",\n class: \"reference-picker-modal--content\"\n};\nconst _hoisted_2 = { key: 1 };\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_ArrowLeftIcon = resolveComponent(\"ArrowLeftIcon\");\n const _component_NcButton = resolveComponent(\"NcButton\");\n const _component_CloseIcon = resolveComponent(\"CloseIcon\");\n const _component_NcReferencePicker = resolveComponent(\"NcReferencePicker\");\n const _component_NcModal = resolveComponent(\"NcModal\");\n return $data.show ? (openBlock(), createBlock(_component_NcModal, {\n key: 0,\n size: $options.modalSize,\n class: \"reference-picker-modal\",\n onClose: $options.onCancel\n }, {\n default: withCtx(() => [\n createElementVNode(\"div\", _hoisted_1, [\n $options.showBackButton ? (openBlock(), createBlock(_component_NcButton, {\n key: 0,\n \"aria-label\": $data.backButtonTitle,\n title: $data.backButtonTitle,\n class: \"back-button\",\n onClick: $options.onBackClicked\n }, {\n icon: withCtx(() => [\n createVNode(_component_ArrowLeftIcon)\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"])) : createCommentVNode(\"\", true),\n createVNode(_component_NcButton, {\n class: \"close-button\",\n \"aria-label\": $data.closeButtonLabel,\n title: $data.closeButtonTitle,\n variant: \"tertiary\",\n onClick: $options.onCancel\n }, {\n icon: withCtx(() => [\n createVNode(_component_CloseIcon)\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"]),\n $options.showModalName ? (openBlock(), createElementBlock(\"h2\", _hoisted_2, toDisplayString($options.modalName), 1)) : createCommentVNode(\"\", true),\n createVNode(_component_NcReferencePicker, {\n ref: \"referencePicker\",\n initialProvider: $props.initialProvider,\n focusOnCreate: $props.focusOnCreate,\n onProviderSelected: $options.onProviderSelect,\n onSubmit: $options.onSubmit,\n onPick: $options.onPick,\n onCancel: $options.onCancel\n }, null, 8, [\"initialProvider\", \"focusOnCreate\", \"onProviderSelected\", \"onSubmit\", \"onPick\", \"onCancel\"])\n ], 512)\n ]),\n _: 1\n }, 8, [\"size\", \"onClose\"])) : createCommentVNode(\"\", true);\n}\nconst NcReferencePickerModal = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"render\", _sfc_render], [\"__scopeId\", \"data-v-58d45f81\"]]);\nasync function getLinkWithPicker(providerId, isInsideViewer) {\n const modalId = \"referencePickerModal\";\n const modalElement = document.createElement(\"div\");\n modalElement.id = modalId;\n document.body.append(modalElement);\n const { promise, reject, resolve } = Promise.withResolvers();\n const initialProvider = providerId && getProvider(providerId) || null;\n const view = createApp(NcReferencePickerModal, {\n initialProvider,\n isInsideViewer,\n onCancel() {\n view.unmount();\n reject(new Error(\"User cancellation\"));\n },\n onSubmit(link) {\n view.unmount();\n resolve(link);\n }\n });\n view.mount(modalElement);\n return promise;\n}\nasync function getReferenceWithPicker(providerId, isInsideViewer) {\n const modalId = \"referencePickerModal\";\n const modalElement = document.createElement(\"div\");\n modalElement.id = modalId;\n document.body.append(modalElement);\n const { promise, reject, resolve } = Promise.withResolvers();\n const initialProvider = providerId && getProvider(providerId) || null;\n const view = createApp(NcReferencePickerModal, {\n initialProvider,\n isInsideViewer,\n onCancel() {\n view.unmount();\n reject(new Error(\"User cancellation\"));\n },\n onPick(reference) {\n view.unmount();\n resolve(reference);\n }\n });\n view.mount(modalElement);\n return promise;\n}\nexport {\n NcReferencePicker as N,\n anyLinkProviderId as a,\n getProvider as b,\n getProviders as c,\n getReferenceWithPicker as d,\n sortProviders as e,\n NcReferencePickerModal as f,\n getLinkWithPicker as g,\n NcSearch as h,\n searchProvider as s\n};\n//# sourceMappingURL=referencePickerModal.mjs.map\n","\n\n\n\n\n","\n\n\n\n\n\n\n","\n\n\n\n\n","import { defaultWindow, isClient, onClickOutside, onKeyStroke, onLongPress, useActiveElement, useBattery, useBrowserLocation, useClipboard, useColorMode, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useDraggable, useElementBounding, useElementHover, useElementOverflow, useElementSize, useElementVisibility, useEyeDropper, useFullscreen, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePreferredReducedTransparency, useResizeObserver, useScreenSafeArea, useScroll, useScrollLock, useStorage, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from \"@vueuse/core\";\nimport { computed, defineComponent, getCurrentInstance, h, onMounted, reactive, shallowReadonly, shallowRef, toRefs, toValue, watch } from \"vue\";\nimport { createDisposableDirective, isClient as isClient$1, notNullish, reactiveOmit, toArray, toRefs as toRefs$1, tryOnScopeDispose, useToggle } from \"@vueuse/shared\";\n//#region ../core/onClickOutside/component.ts\nconst OnClickOutside = /* #__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst target = shallowRef();\n\tonClickOutside(target, (e) => {\n\t\temit(\"trigger\", e);\n\t}, props.options);\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default());\n\t};\n}, {\n\tname: \"OnClickOutside\",\n\tprops: [\"as\", \"options\"],\n\temits: [\"trigger\"]\n});\n//#endregion\n//#region ../core/onClickOutside/directive.ts\nconst stopClickOutsideMap = /* @__PURE__ */ new WeakMap();\nconst vOnClickOutside = {\n\tmounted(el, binding) {\n\t\tconst capture = !binding.modifiers.bubble;\n\t\tlet stop;\n\t\tif (typeof binding.value === \"function\") stop = onClickOutside(el, binding.value, { capture });\n\t\telse {\n\t\t\tconst [handler, options] = binding.value;\n\t\t\tstop = onClickOutside(el, handler, Object.assign({ capture }, options));\n\t\t}\n\t\tstopClickOutsideMap.set(el, stop);\n\t},\n\tunmounted(el) {\n\t\tconst stop = stopClickOutsideMap.get(el);\n\t\tif (stop && typeof stop === \"function\") stop();\n\t\telse stop === null || stop === void 0 || stop.stop();\n\t\tstopClickOutsideMap.delete(el);\n\t}\n};\n/** @deprecated use `vOnClickOutside` instead */\nconst VOnClickOutside = vOnClickOutside;\n//#endregion\n//#region ../core/onKeyStroke/directive.ts\nconst vOnKeyStroke = createDisposableDirective({ mounted(el, binding) {\n\tvar _binding$arg$split, _binding$arg;\n\tconst keys = (_binding$arg$split = (_binding$arg = binding.arg) === null || _binding$arg === void 0 ? void 0 : _binding$arg.split(\",\")) !== null && _binding$arg$split !== void 0 ? _binding$arg$split : true;\n\tif (typeof binding.value === \"function\") onKeyStroke(keys, binding.value, { target: el });\n\telse {\n\t\tconst [handler, options] = binding.value;\n\t\tonKeyStroke(keys, handler, {\n\t\t\ttarget: el,\n\t\t\t...options\n\t\t});\n\t}\n} });\n//#endregion\n//#region ../core/onLongPress/component.ts\nconst OnLongPress = /* #__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst target = shallowRef();\n\tconst data = onLongPress(target, (e) => {\n\t\temit(\"trigger\", e);\n\t}, props.options);\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"OnLongPress\",\n\tprops: [\"as\", \"options\"],\n\temits: [\"trigger\"]\n});\n//#endregion\n//#region ../core/onLongPress/directive.ts\nconst vOnLongPress = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") onLongPress(el, binding.value, { modifiers: binding.modifiers });\n\telse onLongPress(el, ...binding.value);\n} });\n/** @deprecated use `vOnLongPress` instead */\nconst VOnLongPress = vOnLongPress;\n//#endregion\n//#region ../core/useActiveElement/component.ts\nconst UseActiveElement = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ element: useActiveElement(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseActiveElement\",\n\tprops: [\n\t\t\"deep\",\n\t\t\"triggerOnRemoval\",\n\t\t\"window\",\n\t\t\"document\"\n\t]\n});\n//#endregion\n//#region ../core/useBattery/component.ts\nconst UseBattery = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useBattery(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseBattery\",\n\tprops: [\"navigator\"]\n});\n//#endregion\n//#region ../core/useBrowserLocation/component.ts\nconst UseBrowserLocation = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useBrowserLocation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseBrowserLocation\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useClipboard/component.ts\nconst UseClipboard = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useClipboard(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseClipboard\",\n\tprops: [\n\t\t\"source\",\n\t\t\"read\",\n\t\t\"navigator\",\n\t\t\"copiedDuring\",\n\t\t\"legacy\"\n\t]\n});\n//#endregion\n//#region ../core/useColorMode/component.ts\nconst UseColorMode = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst mode = useColorMode(props);\n\tconst data = reactive({\n\t\tmode,\n\t\tsystem: mode.system,\n\t\tstore: mode.store\n\t});\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseColorMode\",\n\tprops: [\n\t\t\"attribute\",\n\t\t\"deep\",\n\t\t\"disableTransition\",\n\t\t\"emitAuto\",\n\t\t\"eventFilter\",\n\t\t\"flush\",\n\t\t\"initOnMounted\",\n\t\t\"initialValue\",\n\t\t\"listenToStorageChanges\",\n\t\t\"mergeDefaults\",\n\t\t\"modes\",\n\t\t\"onChanged\",\n\t\t\"onError\",\n\t\t\"selector\",\n\t\t\"serializer\",\n\t\t\"shallow\",\n\t\t\"storage\",\n\t\t\"storageKey\",\n\t\t\"storageRef\",\n\t\t\"window\",\n\t\t\"writeDefaults\"\n\t]\n});\n//#endregion\n//#region ../core/useDark/component.ts\nconst UseDark = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst isDark = useDark(props);\n\tconst data = reactive({\n\t\tisDark,\n\t\ttoggleDark: useToggle(isDark)\n\t});\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDark\",\n\tprops: [\n\t\t\"attribute\",\n\t\t\"deep\",\n\t\t\"disableTransition\",\n\t\t\"emitAuto\",\n\t\t\"eventFilter\",\n\t\t\"flush\",\n\t\t\"initOnMounted\",\n\t\t\"initialValue\",\n\t\t\"listenToStorageChanges\",\n\t\t\"mergeDefaults\",\n\t\t\"onChanged\",\n\t\t\"onError\",\n\t\t\"selector\",\n\t\t\"serializer\",\n\t\t\"shallow\",\n\t\t\"storage\",\n\t\t\"storageKey\",\n\t\t\"storageRef\",\n\t\t\"valueDark\",\n\t\t\"valueLight\",\n\t\t\"window\",\n\t\t\"writeDefaults\"\n\t]\n});\n//#endregion\n//#region ../core/useDeviceMotion/component.ts\nconst UseDeviceMotion = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = useDeviceMotion(props);\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDeviceMotion\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"requestPermissions\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useDeviceOrientation/component.ts\nconst UseDeviceOrientation = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDeviceOrientation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDeviceOrientation\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useDevicePixelRatio/component.ts\nconst UseDevicePixelRatio = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDevicePixelRatio(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDevicePixelRatio\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useDevicesList/component.ts\nconst UseDevicesList = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDevicesList(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDevicesList\",\n\tprops: [\n\t\t\"constraints\",\n\t\t\"navigator\",\n\t\t\"onUpdated\",\n\t\t\"requestPermissions\"\n\t]\n});\n//#endregion\n//#region ../core/useDocumentVisibility/component.ts\nconst UseDocumentVisibility = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ visibility: useDocumentVisibility(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDocumentVisibility\",\n\tprops: [\"document\"]\n});\n//#endregion\n//#region ../core/useDraggable/component.ts\nconst UseDraggable = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst handle = computed(() => {\n\t\tvar _toValue;\n\t\treturn (_toValue = toValue(props.handle)) !== null && _toValue !== void 0 ? _toValue : target.value;\n\t});\n\tconst containerElement = computed(() => {\n\t\tvar _ref;\n\t\treturn (_ref = props.containerElement) !== null && _ref !== void 0 ? _ref : void 0;\n\t});\n\tconst disabled = computed(() => !!props.disabled);\n\tconst storageValue = props.storageKey && useStorage(props.storageKey, toValue(props.initialValue) || {\n\t\tx: 0,\n\t\ty: 0\n\t}, isClient ? props.storageType === \"session\" ? sessionStorage : localStorage : void 0);\n\tconst initialValue = storageValue || props.initialValue || {\n\t\tx: 0,\n\t\ty: 0\n\t};\n\tconst onEnd = (position, event) => {\n\t\tvar _props$onEnd;\n\t\t(_props$onEnd = props.onEnd) === null || _props$onEnd === void 0 || _props$onEnd.call(props, position, event);\n\t\tif (!storageValue) return;\n\t\tstorageValue.value.x = position.x;\n\t\tstorageValue.value.y = position.y;\n\t};\n\tconst data = reactive(useDraggable(target, {\n\t\t...props,\n\t\thandle,\n\t\tinitialValue,\n\t\tonEnd,\n\t\tdisabled,\n\t\tcontainerElement\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", {\n\t\t\tref: target,\n\t\t\tstyle: `touch-action:none;${data.style}`\n\t\t}, slots.default(data));\n\t};\n}, {\n\tname: \"UseDraggable\",\n\tprops: [\n\t\t\"storageKey\",\n\t\t\"storageType\",\n\t\t\"initialValue\",\n\t\t\"exact\",\n\t\t\"preventDefault\",\n\t\t\"stopPropagation\",\n\t\t\"pointerTypes\",\n\t\t\"as\",\n\t\t\"handle\",\n\t\t\"axis\",\n\t\t\"onStart\",\n\t\t\"onMove\",\n\t\t\"onEnd\",\n\t\t\"disabled\",\n\t\t\"buttons\",\n\t\t\"containerElement\",\n\t\t\"capture\",\n\t\t\"draggingElement\"\n\t]\n});\n//#endregion\n//#region ../core/useElementBounding/component.ts\nconst UseElementBounding = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useElementBounding(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementBounding\",\n\tprops: [\n\t\t\"as\",\n\t\t\"immediate\",\n\t\t\"reset\",\n\t\t\"updateTiming\",\n\t\t\"windowResize\",\n\t\t\"windowScroll\"\n\t]\n});\n//#endregion\n//#region ../core/useElementBounding/directive.ts\nconst vElementBounding = createDisposableDirective({ mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value, {}] : binding.value;\n\tconst { height, bottom, left, right, top, width, x, y } = useElementBounding(el, options);\n\twatch([\n\t\theight,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\twidth,\n\t\tx,\n\t\ty\n\t], () => handler({\n\t\theight,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\twidth,\n\t\tx,\n\t\ty\n\t}));\n} });\n//#endregion\n//#region ../core/useElementHover/directive.ts\nconst vElementHover = createDisposableDirective({ mounted(el, binding) {\n\tconst value = binding.value;\n\tif (typeof value === \"function\") watch(useElementHover(el), (v) => value(v));\n\telse {\n\t\tconst [handler, options] = value;\n\t\twatch(useElementHover(el, options), (v) => handler(v));\n\t}\n} });\n//#endregion\n//#region ../core/useElementOverflow/component.ts\nconst UseElementOverflow = /* #__PURE__ */ defineComponent({\n\tname: \"UseElementOverflow\",\n\tprops: [\"observeMutation\", \"as\"],\n\temits: [\"update\"],\n\tsetup(props, { slots, attrs, emit }) {\n\t\tconst target = shallowRef();\n\t\tconst info = reactive(useElementOverflow(target, {\n\t\t\tobserveMutation: props.observeMutation,\n\t\t\tonUpdated: (...args) => {\n\t\t\t\temit(\"update\", ...args);\n\t\t\t}\n\t\t}));\n\t\treturn () => {\n\t\t\tif (slots.default) return h(props.as || \"div\", {\n\t\t\t\tref: target,\n\t\t\t\t...attrs\n\t\t\t}, slots.default(info));\n\t\t};\n\t}\n});\n//#endregion\n//#region ../core/_configurable.ts\nconst defaultWindow$1 = isClient$1 ? window : void 0;\nisClient$1 && window.document;\nisClient$1 && window.navigator;\nisClient$1 && window.location;\n//#endregion\n//#region ../core/unrefElement/index.ts\n/**\n* Get the dom element of a ref of element or Vue component instance\n*\n* @param elRef\n*/\nfunction unrefElement(elRef) {\n\tvar _$el;\n\tconst plain = toValue(elRef);\n\treturn (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain;\n}\n//#endregion\n//#region ../core/useMounted/index.ts\n/**\n* Mounted state in ref.\n*\n* @see https://vueuse.org/useMounted\n*\n* @__NO_SIDE_EFFECTS__\n*/\nfunction useMounted() {\n\tconst isMounted = shallowRef(false);\n\tconst instance = getCurrentInstance();\n\tif (instance) onMounted(() => {\n\t\tisMounted.value = true;\n\t}, instance);\n\treturn isMounted;\n}\n//#endregion\n//#region ../core/useSupported/index.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction useSupported(callback) {\n\tconst isMounted = useMounted();\n\treturn computed(() => {\n\t\tisMounted.value;\n\t\treturn Boolean(callback());\n\t});\n}\n//#endregion\n//#region ../core/useMutationObserver/index.ts\n/**\n* Watch for changes being made to the DOM tree.\n*\n* @see https://vueuse.org/useMutationObserver\n* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver MutationObserver MDN\n* @param target\n* @param callback\n* @param options\n*/\nfunction useMutationObserver(target, callback, options = {}) {\n\tconst { window = defaultWindow$1, ...mutationOptions } = options;\n\tlet observer;\n\tconst isSupported = /* @__PURE__ */ useSupported(() => window && \"MutationObserver\" in window);\n\tconst cleanup = () => {\n\t\tif (observer) {\n\t\t\tobserver.disconnect();\n\t\t\tobserver = void 0;\n\t\t}\n\t};\n\tconst stopWatch = watch(computed(() => {\n\t\tconst items = toArray(toValue(target)).map(unrefElement).filter(notNullish);\n\t\treturn new Set(items);\n\t}), (newTargets) => {\n\t\tcleanup();\n\t\tif (isSupported.value && newTargets.size) {\n\t\t\tobserver = new MutationObserver(callback);\n\t\t\tnewTargets.forEach((el) => observer.observe(el, mutationOptions));\n\t\t}\n\t}, {\n\t\timmediate: true,\n\t\tflush: \"post\"\n\t});\n\tconst takeRecords = () => {\n\t\treturn observer === null || observer === void 0 ? void 0 : observer.takeRecords();\n\t};\n\tconst stop = () => {\n\t\tstopWatch();\n\t\tcleanup();\n\t};\n\ttryOnScopeDispose(stop);\n\treturn {\n\t\tisSupported,\n\t\tstop,\n\t\ttakeRecords\n\t};\n}\n//#endregion\n//#region ../core/useResizeObserver/index.ts\n/**\n* Reports changes to the dimensions of an Element's content or the border-box\n*\n* @see https://vueuse.org/useResizeObserver\n* @param target\n* @param callback\n* @param options\n*/\nfunction useResizeObserver$1(target, callback, options = {}) {\n\tconst { window = defaultWindow$1, ...observerOptions } = options;\n\tlet observer;\n\tconst isSupported = /* @__PURE__ */ useSupported(() => window && \"ResizeObserver\" in window);\n\tconst cleanup = () => {\n\t\tif (observer) {\n\t\t\tobserver.disconnect();\n\t\t\tobserver = void 0;\n\t\t}\n\t};\n\tconst stopWatch = watch(computed(() => {\n\t\tconst _targets = toValue(target);\n\t\treturn Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];\n\t}), (els) => {\n\t\tcleanup();\n\t\tif (isSupported.value && window) {\n\t\t\tobserver = new ResizeObserver(callback);\n\t\t\tfor (const _el of els) if (_el) observer.observe(_el, observerOptions);\n\t\t}\n\t}, {\n\t\timmediate: true,\n\t\tflush: \"post\"\n\t});\n\tconst stop = () => {\n\t\tcleanup();\n\t\tstopWatch();\n\t};\n\ttryOnScopeDispose(stop);\n\treturn {\n\t\tisSupported,\n\t\tstop\n\t};\n}\n//#endregion\n//#region ../core/useElementOverflow/index.ts\n/**\n* react a dom's overflow state\n* @see https://vueuse.org/useElementOverflow\n* @param target\n* @param option\n*/\nfunction useElementOverflow$1(target, option = {}) {\n\tconst { observeMutation = false, onUpdated, window = defaultWindow$1 } = option;\n\tconst isXOverflowed = shallowRef(false);\n\tconst isYOverflowed = shallowRef(false);\n\tfunction update(htmlEl) {\n\t\tisXOverflowed.value = htmlEl.scrollWidth > htmlEl.offsetWidth;\n\t\tisYOverflowed.value = htmlEl.scrollHeight > htmlEl.offsetHeight;\n\t}\n\tconst onResizeUpdated = onUpdated;\n\tconst targetEl = computed(() => {\n\t\tconst el = unrefElement(target);\n\t\tif (!el || el instanceof SVGElement) return void 0;\n\t\treturn el;\n\t});\n\tconst targets = () => {\n\t\tconst el = targetEl.value;\n\t\tif (!el || el instanceof SVGElement) return [];\n\t\treturn [el, ...Array.from(el.children).filter((i) => i instanceof HTMLElement)];\n\t};\n\tuseResizeObserver$1(targets, (entries, observer) => {\n\t\tconst el = targetEl.value;\n\t\tif (el) update(el);\n\t\tonResizeUpdated === null || onResizeUpdated === void 0 || onResizeUpdated(entries, observer);\n\t}, { window });\n\tif (observeMutation) {\n\t\tconst onMutationUpdated = onUpdated;\n\t\tuseMutationObserver(targets, (entries, observer) => {\n\t\t\tconst el = targetEl.value;\n\t\t\tif (el) update(el);\n\t\t\tonMutationUpdated === null || onMutationUpdated === void 0 || onMutationUpdated(entries, observer);\n\t\t}, {\n\t\t\twindow,\n\t\t\t...typeof observeMutation === \"object\" ? observeMutation : {\n\t\t\t\tchildList: true,\n\t\t\t\tsubtree: true,\n\t\t\t\tcharacterData: true\n\t\t\t}\n\t\t});\n\t}\n\treturn {\n\t\tisXOverflowed: shallowReadonly(isXOverflowed),\n\t\tisYOverflowed: shallowReadonly(isYOverflowed),\n\t\tstop,\n\t\tupdate: () => {\n\t\t\tconst el = targetEl.value;\n\t\t\tif (el && window) update(el);\n\t\t}\n\t};\n}\n//#endregion\n//#region ../core/useElementOverflow/directive.ts\nconst vElementOverflow = createDisposableDirective({ mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value] : binding.value;\n\tconst info = useElementOverflow$1(el, options);\n\tconst { isXOverflowed, isYOverflowed } = info;\n\twatch([isXOverflowed, isYOverflowed], () => handler(info), { immediate: true });\n} });\n//#endregion\n//#region ../core/useElementSize/component.ts\nconst UseElementSize = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tvar _toValue, _toValue2;\n\tconst target = shallowRef();\n\tconst { width, height } = toRefs(props);\n\tconst data = reactive(useElementSize(target, {\n\t\twidth: (_toValue = toValue(width)) !== null && _toValue !== void 0 ? _toValue : 0,\n\t\theight: (_toValue2 = toValue(height)) !== null && _toValue2 !== void 0 ? _toValue2 : 0\n\t}, {\n\t\tbox: props.box,\n\t\twindow: props.window\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementSize\",\n\tprops: [\n\t\t\"as\",\n\t\t\"box\",\n\t\t\"height\",\n\t\t\"width\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useElementSize/directive.ts\nconst vElementSize = createDisposableDirective({ mounted(el, binding) {\n\tvar _binding$value;\n\tconst handler = typeof binding.value === \"function\" ? binding.value : (_binding$value = binding.value) === null || _binding$value === void 0 ? void 0 : _binding$value[0];\n\tconst { width, height } = useElementSize(el, ...typeof binding.value === \"function\" ? [] : binding.value.slice(1));\n\twatch([width, height], ([width, height]) => handler({\n\t\twidth,\n\t\theight\n\t}), { immediate: true });\n} });\n//#endregion\n//#region ../core/useElementVisibility/component.ts\nconst UseElementVisibility = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useElementVisibility(target, {\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementVisibility\",\n\tprops: [\n\t\t\"as\",\n\t\t\"once\",\n\t\t\"rootMargin\",\n\t\t\"scrollTarget\",\n\t\t\"threshold\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useElementVisibility/directive.ts\nconst vElementVisibility = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") {\n\t\tconst handler = binding.value;\n\t\twatch(useElementVisibility(el), (v) => handler(v), { immediate: true });\n\t} else {\n\t\tconst [handler, options] = binding.value;\n\t\tif (options === null || options === void 0 ? void 0 : options.controls) {\n\t\t\tconst state = useElementVisibility(el, options);\n\t\t\twatch(state.isVisible, () => handler(state), { immediate: true });\n\t\t} else watch(useElementVisibility(el, options), (v) => handler(v), { immediate: true });\n\t}\n} });\n//#endregion\n//#region ../core/useEyeDropper/component.ts\nconst UseEyeDropper = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useEyeDropper(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseEyeDropper\",\n\tprops: [\"initialValue\"]\n});\n//#endregion\n//#region ../core/useFullscreen/component.ts\nconst UseFullscreen = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useFullscreen(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseFullscreen\",\n\tprops: [\n\t\t\"as\",\n\t\t\"autoExit\",\n\t\t\"document\"\n\t]\n});\n//#endregion\n//#region ../core/useGeolocation/component.ts\nconst UseGeolocation = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useGeolocation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseGeolocation\",\n\tprops: [\n\t\t\"enableHighAccuracy\",\n\t\t\"immediate\",\n\t\t\"maximumAge\",\n\t\t\"navigator\",\n\t\t\"timeout\"\n\t]\n});\n//#endregion\n//#region ../core/useIdle/component.ts\nconst UseIdle = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useIdle(props.timeout, props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseIdle\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"events\",\n\t\t\"initialState\",\n\t\t\"listenForVisibilityChange\",\n\t\t\"timeout\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useImage/component.ts\nconst UseImage = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useImage(props));\n\treturn () => {\n\t\tif (data.isLoading && slots.loading) return slots.loading(data);\n\t\telse if (data.error && slots.error) return slots.error(data.error);\n\t\tif (slots.default) return slots.default(data);\n\t\treturn h(props.as || \"img\", props);\n\t};\n}, {\n\tname: \"UseImage\",\n\tprops: [\n\t\t\"alt\",\n\t\t\"as\",\n\t\t\"class\",\n\t\t\"crossorigin\",\n\t\t\"decoding\",\n\t\t\"fetchPriority\",\n\t\t\"height\",\n\t\t\"ismap\",\n\t\t\"loading\",\n\t\t\"referrerPolicy\",\n\t\t\"sizes\",\n\t\t\"src\",\n\t\t\"srcset\",\n\t\t\"usemap\",\n\t\t\"width\"\n\t]\n});\n//#endregion\n//#region ../core/useInfiniteScroll/directive.ts\nconst vInfiniteScroll = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useInfiniteScroll(el, binding.value);\n\telse useInfiniteScroll(el, ...binding.value);\n} });\n//#endregion\n//#region ../core/useIntersectionObserver/directive.ts\nconst vIntersectionObserver = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useIntersectionObserver(el, binding.value);\n\telse useIntersectionObserver(el, ...binding.value);\n} });\n//#endregion\n//#region ../core/useMouse/component.ts\nconst UseMouse = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useMouse(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseMouse\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"initialValue\",\n\t\t\"resetOnTouchEnds\",\n\t\t\"scroll\",\n\t\t\"target\",\n\t\t\"touch\",\n\t\t\"type\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useMouseInElement/component.ts\nconst UseMouseInElement = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useMouseInElement(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseMouseInElement\",\n\tprops: [\n\t\t\"as\",\n\t\t\"eventFilter\",\n\t\t\"handleOutside\",\n\t\t\"initialValue\",\n\t\t\"resetOnTouchEnds\",\n\t\t\"scroll\",\n\t\t\"target\",\n\t\t\"touch\",\n\t\t\"type\",\n\t\t\"window\",\n\t\t\"windowResize\",\n\t\t\"windowScroll\"\n\t]\n});\n//#endregion\n//#region ../core/useMouseInElement/directive.ts\nconst vMouseInElement = createDisposableDirective({ mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value, {}] : binding.value;\n\twatch(reactiveOmit(reactive(useMouseInElement(el, options)), \"stop\"), (val) => handler(val));\n} });\n//#endregion\n//#region ../core/useMousePressed/component.ts\nconst UseMousePressed = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useMousePressed({\n\t\t...props,\n\t\ttarget\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseMousePressed\",\n\tprops: [\n\t\t\"as\",\n\t\t\"capture\",\n\t\t\"drag\",\n\t\t\"initialValue\",\n\t\t\"onPressed\",\n\t\t\"onReleased\",\n\t\t\"touch\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useNetwork/component.ts\nconst UseNetwork = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useNetwork(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseNetwork\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useNow/component.ts\nconst UseNow = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useNow({\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseNow\",\n\tprops: [\n\t\t\"scheduler\",\n\t\t\"immediate\",\n\t\t\"interval\"\n\t]\n});\n//#endregion\n//#region ../core/useObjectUrl/component.ts\nconst UseObjectUrl = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst { object } = toRefs$1(props);\n\tconst url = useObjectUrl(object);\n\treturn () => {\n\t\tif (slots.default && url.value) return slots.default(url.value);\n\t};\n}, {\n\tname: \"UseObjectUrl\",\n\tprops: [\"object\"]\n});\n//#endregion\n//#region ../core/useOffsetPagination/component.ts\nconst UseOffsetPagination = /* #__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst data = reactive(useOffsetPagination({\n\t\t...props,\n\t\ttotal: toValue(props.total) || void 0,\n\t\tonPageChange(...args) {\n\t\t\tvar _props$onPageChange;\n\t\t\t(_props$onPageChange = props.onPageChange) === null || _props$onPageChange === void 0 || _props$onPageChange.call(props, ...args);\n\t\t\temit(\"page-change\", ...args);\n\t\t},\n\t\tonPageSizeChange(...args) {\n\t\t\tvar _props$onPageSizeChan;\n\t\t\t(_props$onPageSizeChan = props.onPageSizeChange) === null || _props$onPageSizeChan === void 0 || _props$onPageSizeChan.call(props, ...args);\n\t\t\temit(\"page-size-change\", ...args);\n\t\t},\n\t\tonPageCountChange(...args) {\n\t\t\tvar _props$onPageCountCha;\n\t\t\t(_props$onPageCountCha = props.onPageCountChange) === null || _props$onPageCountCha === void 0 || _props$onPageCountCha.call(props, ...args);\n\t\t\temit(\"page-count-change\", ...args);\n\t\t}\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseOffsetPagination\",\n\tprops: [\n\t\t\"onPageChange\",\n\t\t\"onPageCountChange\",\n\t\t\"onPageSizeChange\",\n\t\t\"page\",\n\t\t\"pageSize\",\n\t\t\"total\"\n\t]\n});\n//#endregion\n//#region ../core/useOnline/component.ts\nconst UseOnline = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ isOnline: useOnline(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseOnline\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePageLeave/component.ts\nconst UsePageLeave = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ isLeft: usePageLeave(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePageLeave\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePointer/component.ts\nconst UsePointer = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst el = shallowRef(null);\n\tconst data = reactive(usePointer({\n\t\t...props,\n\t\ttarget: props.target === \"self\" ? el : defaultWindow\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePointer\",\n\tprops: [\n\t\t\"initialValue\",\n\t\t\"pointerTypes\",\n\t\t\"target\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/usePointerLock/component.ts\nconst UsePointerLock = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(usePointerLock(target));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UsePointerLock\",\n\tprops: [\"as\", \"document\"]\n});\n//#endregion\n//#region ../core/usePreferredColorScheme/component.ts\nconst UsePreferredColorScheme = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ colorScheme: usePreferredColorScheme(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredColorScheme\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredContrast/component.ts\nconst UsePreferredContrast = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ contrast: usePreferredContrast(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredContrast\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredDark/component.ts\nconst UsePreferredDark = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ prefersDark: usePreferredDark(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredDark\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredLanguages/component.ts\nconst UsePreferredLanguages = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ languages: usePreferredLanguages(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredLanguages\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredReducedMotion/component.ts\nconst UsePreferredReducedMotion = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ motion: usePreferredReducedMotion(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredReducedMotion\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredReducedTransparency/component.ts\nconst UsePreferredReducedTransparency = /* #__PURE__ */ defineComponent({\n\tname: \"UsePreferredReducedTransparency\",\n\tsetup(props, { slots }) {\n\t\tconst data = reactive({ transparency: usePreferredReducedTransparency() });\n\t\treturn () => {\n\t\t\tif (slots.default) return slots.default(data);\n\t\t};\n\t}\n});\n//#endregion\n//#region ../core/useResizeObserver/directive.ts\nconst vResizeObserver = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useResizeObserver(el, binding.value);\n\telse useResizeObserver(el, ...binding.value);\n} });\n//#endregion\n//#region ../core/useScreenSafeArea/component.ts\nconst UseScreenSafeArea = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useScreenSafeArea());\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { style: {\n\t\t\tpaddingTop: props.top ? data.top : \"\",\n\t\t\tpaddingRight: props.right ? data.right : \"\",\n\t\t\tpaddingBottom: props.bottom ? data.bottom : \"\",\n\t\t\tpaddingLeft: props.left ? data.left : \"\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tmaxHeight: \"100vh\",\n\t\t\tmaxWidth: \"100vw\",\n\t\t\toverflow: \"auto\"\n\t\t} }, slots.default(data));\n\t};\n}, {\n\tname: \"UseScreenSafeArea\",\n\tprops: [\n\t\t\"top\",\n\t\t\"right\",\n\t\t\"bottom\",\n\t\t\"left\"\n\t]\n});\n//#endregion\n//#region ../core/useScroll/directive.ts\nconst vScroll = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") {\n\t\tconst handler = binding.value;\n\t\tconst state = useScroll(el, {\n\t\t\tonScroll() {\n\t\t\t\thandler(state);\n\t\t\t},\n\t\t\tonStop() {\n\t\t\t\thandler(state);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tconst [handler, options] = binding.value;\n\t\tconst state = useScroll(el, {\n\t\t\t...options,\n\t\t\tonScroll(e) {\n\t\t\t\tvar _options$onScroll;\n\t\t\t\t(_options$onScroll = options.onScroll) === null || _options$onScroll === void 0 || _options$onScroll.call(options, e);\n\t\t\t\thandler(state);\n\t\t\t},\n\t\t\tonStop(e) {\n\t\t\t\tvar _options$onStop;\n\t\t\t\t(_options$onStop = options.onStop) === null || _options$onStop === void 0 || _options$onStop.call(options, e);\n\t\t\t\thandler(state);\n\t\t\t}\n\t\t});\n\t}\n} });\n//#endregion\n//#region ../core/useScrollLock/directive.ts\nfunction onScrollLock() {\n\tlet isMounted = false;\n\tconst state = shallowRef(false);\n\treturn createDisposableDirective((el, binding) => {\n\t\tstate.value = binding.value;\n\t\tif (isMounted) return;\n\t\tisMounted = true;\n\t\tconst isLocked = useScrollLock(el, binding.value);\n\t\twatch(state, (v) => isLocked.value = v);\n\t});\n}\nconst vScrollLock = onScrollLock();\n//#endregion\n//#region ../core/useTimeAgo/component.ts\nconst UseTimeAgo = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useTimeAgo(() => props.time, {\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseTimeAgo\",\n\tprops: [\n\t\t\"fullDateFormatter\",\n\t\t\"max\",\n\t\t\"messages\",\n\t\t\"rounding\",\n\t\t\"showSecond\",\n\t\t\"time\",\n\t\t\"units\",\n\t\t\"updateInterval\"\n\t]\n});\n//#endregion\n//#region ../core/useTimestamp/component.ts\nconst UseTimestamp = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useTimestamp({\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseTimestamp\",\n\tprops: [\n\t\t\"scheduler\",\n\t\t\"callback\",\n\t\t\"immediate\",\n\t\t\"interval\",\n\t\t\"offset\"\n\t]\n});\n//#endregion\n//#region ../core/useVirtualList/component.ts\nconst UseVirtualList = /* #__PURE__ */ defineComponent((props, { slots, expose }) => {\n\tconst { list: listRef } = toRefs(props);\n\tconst { list, containerProps, wrapperProps, scrollTo } = useVirtualList(listRef, props.options);\n\texpose({ scrollTo });\n\tif (containerProps.style && typeof containerProps.style === \"object\" && !Array.isArray(containerProps.style)) containerProps.style.height = props.height || \"300px\";\n\treturn () => h(\"div\", { ...containerProps }, [h(\"div\", { ...wrapperProps.value }, list.value.map((item) => h(\"div\", { style: {\n\t\toverflow: \"hidden\",\n\t\theight: item.height\n\t} }, slots.default ? slots.default(item) : \"Please set content!\")))]);\n}, {\n\tname: \"UseVirtualList\",\n\tprops: [\n\t\t\"height\",\n\t\t\"list\",\n\t\t\"options\"\n\t]\n});\n//#endregion\n//#region ../core/useWindowFocus/component.ts\nconst UseWindowFocus = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ focused: useWindowFocus(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseWindowFocus\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useWindowSize/component.ts\nconst UseWindowSize = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useWindowSize(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseWindowSize\",\n\tprops: [\n\t\t\"includeScrollbar\",\n\t\t\"initialHeight\",\n\t\t\"initialWidth\",\n\t\t\"listenOrientation\",\n\t\t\"type\",\n\t\t\"window\"\n\t]\n});\n//#endregion\nexport { OnClickOutside, OnLongPress, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseElementBounding, UseElementOverflow, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseWindowFocus, UseWindowSize, VOnClickOutside, VOnLongPress, vElementBounding, vElementHover, vElementOverflow, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vMouseInElement, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };\n","import { l as logger } from \"../../chunks/logger.mjs\";\nfunction registerContactsMenuAction(action) {\n window._nc_contacts_menu_hooks ??= {};\n if (window._nc_contacts_menu_hooks[action.id]) {\n logger.error(`ContactsMenu action for id ${action.id} has already been registered`, {\n action\n });\n return;\n }\n window._nc_contacts_menu_hooks[action.id] = action;\n}\nfunction getEnabledContactsMenuActions(entry) {\n if (!window._nc_contacts_menu_hooks) {\n return [];\n }\n return Object.values(window._nc_contacts_menu_hooks).filter((action) => action.enabled(entry));\n}\nexport {\n getEnabledContactsMenuActions,\n registerContactsMenuAction\n};\n//# sourceMappingURL=index.mjs.map\n","const c = new Int32Array(4);\nclass h {\n static hashStr(i, a = !1) {\n return this.onePassHasher.start().appendStr(i).end(a);\n }\n static hashAsciiStr(i, a = !1) {\n return this.onePassHasher.start().appendAsciiStr(i).end(a);\n }\n // Private Static Variables\n static stateIdentity = new Int32Array([\n 1732584193,\n -271733879,\n -1732584194,\n 271733878\n ]);\n static buffer32Identity = new Int32Array([\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ]);\n static hexChars = \"0123456789abcdef\";\n static hexOut = [];\n // Permanent instance is to use for one-call hashing\n static onePassHasher = new h();\n static _hex(i) {\n const a = h.hexChars, t = h.hexOut;\n let e, s, r, n;\n for (n = 0; n < 4; n += 1)\n for (s = n * 8, e = i[n], r = 0; r < 8; r += 2)\n t[s + 1 + r] = a.charAt(e & 15), e >>>= 4, t[s + 0 + r] = a.charAt(e & 15), e >>>= 4;\n return t.join(\"\");\n }\n static _md5cycle(i, a) {\n let t = i[0], e = i[1], s = i[2], r = i[3];\n t += (e & s | ~e & r) + a[0] - 680876936 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[1] - 389564586 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[2] + 606105819 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[3] - 1044525330 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[4] - 176418897 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[5] + 1200080426 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[6] - 1473231341 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[7] - 45705983 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[8] + 1770035416 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[9] - 1958414417 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[10] - 42063 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[11] - 1990404162 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[12] + 1804603682 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[13] - 40341101 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[14] - 1502002290 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[15] + 1236535329 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & r | s & ~r) + a[1] - 165796510 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[6] - 1069501632 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[11] + 643717713 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[0] - 373897302 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[5] - 701558691 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[10] + 38016083 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[15] - 660478335 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[4] - 405537848 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[9] + 568446438 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[14] - 1019803690 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[3] - 187363961 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[8] + 1163531501 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[13] - 1444681467 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[2] - 51403784 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[7] + 1735328473 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[12] - 1926607734 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e ^ s ^ r) + a[5] - 378558 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[8] - 2022574463 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[11] + 1839030562 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[14] - 35309556 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[1] - 1530992060 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[4] + 1272893353 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[7] - 155497632 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[10] - 1094730640 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[13] + 681279174 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[0] - 358537222 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[3] - 722521979 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[6] + 76029189 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[9] - 640364487 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[12] - 421815835 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[15] + 530742520 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[2] - 995338651 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (s ^ (e | ~r)) + a[0] - 198630844 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[7] + 1126891415 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[14] - 1416354905 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[5] - 57434055 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[12] + 1700485571 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[3] - 1894986606 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[10] - 1051523 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[1] - 2054922799 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[8] + 1873313359 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[15] - 30611744 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[6] - 1560198380 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[13] + 1309151649 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[4] - 145523070 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[11] - 1120210379 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[2] + 718787259 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[9] - 343485551 | 0, e = (e << 21 | e >>> 11) + s | 0, i[0] = t + i[0] | 0, i[1] = e + i[1] | 0, i[2] = s + i[2] | 0, i[3] = r + i[3] | 0;\n }\n _dataLength = 0;\n _bufferLength = 0;\n _state = new Int32Array(4);\n _buffer = new ArrayBuffer(68);\n _buffer8;\n _buffer32;\n constructor() {\n this._buffer8 = new Uint8Array(this._buffer, 0, 68), this._buffer32 = new Uint32Array(this._buffer, 0, 17), this.start();\n }\n /**\n * Initialise buffer to be hashed\n */\n start() {\n return this._dataLength = 0, this._bufferLength = 0, this._state.set(h.stateIdentity), this;\n }\n // Char to code point to to array conversion:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt\n // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown\n /**\n * Append a UTF-8 string to the hash buffer\n * @param str String to append\n */\n appendStr(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r;\n for (r = 0; r < i.length; r += 1) {\n if (s = i.charCodeAt(r), s < 128)\n a[e++] = s;\n else if (s < 2048)\n a[e++] = (s >>> 6) + 192, a[e++] = s & 63 | 128;\n else if (s < 55296 || s > 56319)\n a[e++] = (s >>> 12) + 224, a[e++] = s >>> 6 & 63 | 128, a[e++] = s & 63 | 128;\n else {\n if (s = (s - 55296) * 1024 + (i.charCodeAt(++r) - 56320) + 65536, s > 1114111)\n throw new Error(\n \"Unicode standard supports code points up to U+10FFFF\"\n );\n a[e++] = (s >>> 18) + 240, a[e++] = s >>> 12 & 63 | 128, a[e++] = s >>> 6 & 63 | 128, a[e++] = s & 63 | 128;\n }\n e >= 64 && (this._dataLength += 64, h._md5cycle(this._state, t), e -= 64, t[0] = t[16]);\n }\n return this._bufferLength = e, this;\n }\n /**\n * Append an ASCII string to the hash buffer\n * @param str String to append\n */\n appendAsciiStr(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r = 0;\n for (; ; ) {\n for (s = Math.min(i.length - r, 64 - e); s--; )\n a[e++] = i.charCodeAt(r++);\n if (e < 64)\n break;\n this._dataLength += 64, h._md5cycle(this._state, t), e = 0;\n }\n return this._bufferLength = e, this;\n }\n /**\n * Append a byte array to the hash buffer\n * @param input array to append\n */\n appendByteArray(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r = 0;\n for (; ; ) {\n for (s = Math.min(i.length - r, 64 - e); s--; )\n a[e++] = i[r++];\n if (e < 64)\n break;\n this._dataLength += 64, h._md5cycle(this._state, t), e = 0;\n }\n return this._bufferLength = e, this;\n }\n /**\n * Get the state of the hash buffer\n */\n getState() {\n const i = this._state;\n return {\n buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)),\n buflen: this._bufferLength,\n length: this._dataLength,\n state: [i[0], i[1], i[2], i[3]]\n };\n }\n /**\n * Override the current state of the hash buffer\n * @param state New hash buffer state\n */\n setState(i) {\n const a = i.buffer, t = i.state, e = this._state;\n let s;\n for (this._dataLength = i.length, this._bufferLength = i.buflen, e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], s = 0; s < a.length; s += 1)\n this._buffer8[s] = a.charCodeAt(s);\n }\n /**\n * Hash the current state of the hash buffer and return the result\n * @param raw Whether to return the value as an `Int32Array`\n */\n end(i = !1) {\n const a = this._bufferLength, t = this._buffer8, e = this._buffer32, s = (a >> 2) + 1;\n this._dataLength += a;\n const r = this._dataLength * 8;\n if (t[a] = 128, t[a + 1] = t[a + 2] = t[a + 3] = 0, e.set(h.buffer32Identity.subarray(s), s), a > 55 && (h._md5cycle(this._state, e), e.set(h.buffer32Identity)), r <= 4294967295)\n e[14] = r;\n else {\n const n = r.toString(16).match(/(.*?)(.{0,8})$/);\n if (n === null) return i ? c : \"\";\n const o = parseInt(n[2], 16), _ = parseInt(n[1], 16) || 0;\n e[14] = o, e[15] = _;\n }\n return h._md5cycle(this._state, e), i ? this._state : h._hex(this._state);\n }\n}\nif (h.hashStr(\"hello\") !== \"5d41402abc4b2a76b9719d911017c592\")\n throw new Error(\"Md5 self test failed.\");\nclass l {\n constructor(i, a = !0, t = 1048576) {\n this._callback = i, this._async = a, this._partSize = t, this._configureReader();\n }\n _reader;\n _md5;\n _part;\n // private _length!: number;\n _blob;\n /**\n * Hash a blob of data in the worker\n * @param blob Data to hash\n */\n hash(i) {\n const a = this;\n a._blob = i, a._part = 0, a._md5 = new h(), a._processPart();\n }\n _fail() {\n this._callback({\n success: !1,\n result: \"data read failed\"\n });\n }\n _hashData(i) {\n let a = this;\n a._md5.appendByteArray(new Uint8Array(i.target.result)), a._part * a._partSize >= a._blob.size ? a._callback({\n success: !0,\n result: a._md5.end()\n }) : a._processPart();\n }\n _processPart() {\n const i = this;\n let a = 0, t;\n i._part += 1, i._blob.size > i._partSize ? (a = i._part * i._partSize, a > i._blob.size && (a = i._blob.size), t = i._blob.slice(\n (i._part - 1) * i._partSize,\n a\n )) : t = i._blob, i._async ? i._reader.readAsArrayBuffer(t) : setTimeout(() => {\n try {\n i._hashData({\n target: {\n result: i._reader.readAsArrayBuffer(\n t\n )\n }\n });\n } catch {\n i._fail();\n }\n }, 0);\n }\n _configureReader() {\n const i = this;\n i._async ? (i._reader = new FileReader(), i._reader.onload = i._hashData.bind(i), i._reader.onerror = i._fail.bind(i), i._reader.onabort = i._fail.bind(i)) : i._reader = new FileReaderSync();\n }\n}\nclass u {\n _queue = [];\n _hashWorker;\n _processing;\n _ready = !0;\n constructor(i, a) {\n const t = this;\n Worker ? (t._hashWorker = new Worker(i, a), t._hashWorker.onmessage = t._recievedMessage.bind(t), t._hashWorker.onerror = (e) => {\n t._ready = !1, console.error(\"Hash worker failure\", e);\n }) : (t._ready = !1, console.error(\"Web Workers are not supported in this browser\"));\n }\n /**\n * Hash a blob of data in the worker\n * @param blob Data to hash\n * @returns Promise of the Hashed result\n */\n hash(i) {\n const a = this;\n let t;\n return t = new Promise((e, s) => {\n a._queue.push({\n blob: i,\n resolve: e,\n reject: s\n }), a._processNext();\n }), t;\n }\n /** Terminate any existing hash requests */\n terminate() {\n this._ready = !1, this._hashWorker.terminate();\n }\n // Processes the next item in the queue\n _processNext() {\n this._ready && !this._processing && this._queue.length > 0 && (this._processing = this._queue.pop(), this._hashWorker.postMessage(this._processing.blob));\n }\n // Hash result is returned from the worker\n _recievedMessage(i) {\n const a = i.data;\n a.success ? this._processing?.resolve(a.result) : this._processing?.reject(a.result), this._processing = void 0, this._processNext();\n }\n}\nexport {\n h as Md5,\n l as Md5FileHasher,\n u as ParallelHasher\n};\n//# sourceMappingURL=index.es.js.map\n","import { r as register, t as t4, a as t } from \"./_l10n.mjs\";\nregister(t4);\nclass Color {\n /**\n * @param r - The red value\n * @param g - The green value\n * @param b - The blue value\n * @param name - The name of the color\n */\n constructor(r, g, b, name) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.name = name;\n this.r = Math.min(r, 255);\n this.g = Math.min(g, 255);\n this.b = Math.min(b, 255);\n this.name = name;\n }\n r;\n g;\n b;\n name;\n /**\n * The hexadecimal color string.\n */\n get color() {\n const toHex = (int) => `00${int.toString(16)}`.slice(-2);\n return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}`;\n }\n}\nfunction calculateStepIncrement(steps, color1, color2) {\n return {\n r: (color2.r - color1.r) / steps,\n g: (color2.g - color1.g) / steps,\n b: (color2.b - color1.b) / steps\n };\n}\nfunction mixPalette(steps, color1, color2) {\n const palette = [];\n palette.push(color1);\n const increment = calculateStepIncrement(steps, color1, color2);\n for (let i = 1; i < steps; i++) {\n const r = Math.floor(color1.r + increment.r * i);\n const g = Math.floor(color1.g + increment.g * i);\n const b = Math.floor(color1.b + increment.b * i);\n palette.push(new Color(r, g, b));\n }\n return palette;\n}\nconst COLOR_RED = new Color(182, 70, 157, t(\"Purple\"));\nconst COLOR_YELLOW = new Color(221, 203, 85, t(\"Gold\"));\nconst COLOR_BLUE = new Color(0, 130, 201, t(\"Nextcloud blue\"));\nconst COLOR_BLACK = new Color(0, 0, 0, t(\"Black\"));\nconst COLOR_WHITE = new Color(255, 255, 255, t(\"White\"));\nconst defaultPalette = [\n COLOR_RED,\n new Color(\n ...[191, 103, 139],\n t(\"Rosy brown\")\n // TRANSLATORS: A color name for RGB(191, 103, 139)\n ),\n new Color(\n ...[201, 136, 121],\n t(\"Feldspar\")\n // TRANSLATORS: A color name for RGB(201, 136, 121)\n ),\n new Color(\n ...[211, 169, 103],\n t(\"Whiskey\")\n // TRANSLATORS: A color name for RGB(211, 169, 103)\n ),\n COLOR_YELLOW,\n new Color(\n ...[165, 184, 114],\n t(\"Olivine\")\n // TRANSLATORS: A color name for RGB(165, 184, 114)\n ),\n new Color(\n ...[110, 166, 143],\n t(\"Acapulco\")\n // TRANSLATORS: A color name for RGB(110, 166, 143)\n ),\n new Color(\n ...[55, 148, 172],\n t(\"Boston Blue\")\n // TRANSLATORS: A color name for RGB(55, 148, 172)\n ),\n COLOR_BLUE,\n new Color(\n ...[45, 115, 190],\n t(\"Mariner\")\n // TRANSLATORS: A color name for RGB(45, 115, 190)\n ),\n new Color(\n ...[91, 100, 179],\n t(\"Blue Violet\")\n // TRANSLATORS: A color name for RGB(91, 100, 179)\n ),\n new Color(\n ...[136, 85, 168],\n t(\"Deluge\")\n // TRANSLATORS: A color name for RGB(136, 85, 168)\n )\n];\nfunction generatePalette(steps) {\n const palette1 = mixPalette(steps, COLOR_RED, COLOR_YELLOW);\n const palette2 = mixPalette(steps, COLOR_YELLOW, COLOR_BLUE);\n const palette3 = mixPalette(steps, COLOR_BLUE, COLOR_RED);\n return palette1.concat(palette2).concat(palette3);\n}\nexport {\n Color as C,\n COLOR_BLACK as a,\n COLOR_WHITE as b,\n defaultPalette as d,\n generatePalette as g\n};\n//# sourceMappingURL=colors.mjs.map\n","import { Md5 } from \"ts-md5\";\nimport { g as generatePalette } from \"../../chunks/colors.mjs\";\nfunction hashCode(str) {\n let hash = str;\n if (str.match(/^([0-9a-f]{4}-?){8}$/) === null) {\n hash = Md5.hashStr(str);\n }\n hash = hash.replace(/[^0-9a-f]/g, \"\");\n let finalInt = 0;\n for (let i = 0; i < hash.length; i++) {\n finalInt += parseInt(hash.charAt(i), 16);\n }\n return finalInt;\n}\nfunction usernameToColor(username) {\n const steps = 6;\n const finalPalette = generatePalette(steps);\n const hash = hashCode(username.toLocaleLowerCase());\n return finalPalette[hash % finalPalette.length];\n}\nexport {\n usernameToColor\n};\n//# sourceMappingURL=index.mjs.map\n","'use strict';\n\n(function (global) {\n\n // minimal symbol polyfill for IE11 and others\n if (typeof Symbol !== 'function') {\n var Symbol = function(name) {\n return name;\n }\n\n Symbol.nonNative = true;\n }\n\n const STATE_PLAINTEXT = Symbol('plaintext');\n const STATE_HTML = Symbol('html');\n const STATE_COMMENT = Symbol('comment');\n\n const ALLOWED_TAGS_REGEX = /<(\\w*)>/g;\n const NORMALIZE_TAG_REGEX = /<\\/?([^\\s\\/>]+)/;\n\n function striptags(html, allowable_tags, tag_replacement) {\n html = html || '';\n allowable_tags = allowable_tags || [];\n tag_replacement = tag_replacement || '';\n\n let context = init_context(allowable_tags, tag_replacement);\n\n return striptags_internal(html, context);\n }\n\n function init_striptags_stream(allowable_tags, tag_replacement) {\n allowable_tags = allowable_tags || [];\n tag_replacement = tag_replacement || '';\n\n let context = init_context(allowable_tags, tag_replacement);\n\n return function striptags_stream(html) {\n return striptags_internal(html || '', context);\n };\n }\n\n striptags.init_streaming_mode = init_striptags_stream;\n\n function init_context(allowable_tags, tag_replacement) {\n allowable_tags = parse_allowable_tags(allowable_tags);\n\n return {\n allowable_tags : allowable_tags,\n tag_replacement: tag_replacement,\n\n state : STATE_PLAINTEXT,\n tag_buffer : '',\n depth : 0,\n in_quote_char : ''\n };\n }\n\n function striptags_internal(html, context) {\n if (typeof html != \"string\") {\n throw new TypeError(\"'html' parameter must be a string\");\n }\n\n let allowable_tags = context.allowable_tags;\n let tag_replacement = context.tag_replacement;\n\n let state = context.state;\n let tag_buffer = context.tag_buffer;\n let depth = context.depth;\n let in_quote_char = context.in_quote_char;\n let output = '';\n\n for (let idx = 0, length = html.length; idx < length; idx++) {\n let char = html[idx];\n\n if (state === STATE_PLAINTEXT) {\n switch (char) {\n case '<':\n state = STATE_HTML;\n tag_buffer += char;\n break;\n\n default:\n output += char;\n break;\n }\n }\n\n else if (state === STATE_HTML) {\n switch (char) {\n case '<':\n // ignore '<' if inside a quote\n if (in_quote_char) {\n break;\n }\n\n // we're seeing a nested '<'\n depth++;\n break;\n\n case '>':\n // ignore '>' if inside a quote\n if (in_quote_char) {\n break;\n }\n\n // something like this is happening: '<<>>'\n if (depth) {\n depth--;\n\n break;\n }\n\n // this is closing the tag in tag_buffer\n in_quote_char = '';\n state = STATE_PLAINTEXT;\n tag_buffer += '>';\n\n if (allowable_tags.has(normalize_tag(tag_buffer))) {\n output += tag_buffer;\n } else {\n output += tag_replacement;\n }\n\n tag_buffer = '';\n break;\n\n case '\"':\n case '\\'':\n // catch both single and double quotes\n\n if (char === in_quote_char) {\n in_quote_char = '';\n } else {\n in_quote_char = in_quote_char || char;\n }\n\n tag_buffer += char;\n break;\n\n case '-':\n if (tag_buffer === '':\n if (tag_buffer.slice(-2) == '--') {\n // close the comment\n state = STATE_PLAINTEXT;\n }\n\n tag_buffer = '';\n break;\n\n default:\n tag_buffer += char;\n break;\n }\n }\n }\n\n // save the context for future iterations\n context.state = state;\n context.tag_buffer = tag_buffer;\n context.depth = depth;\n context.in_quote_char = in_quote_char;\n\n return output;\n }\n\n function parse_allowable_tags(allowable_tags) {\n let tag_set = new Set();\n\n if (typeof allowable_tags === 'string') {\n let match;\n\n while ((match = ALLOWED_TAGS_REGEX.exec(allowable_tags))) {\n tag_set.add(match[1]);\n }\n }\n\n else if (!Symbol.nonNative &&\n typeof allowable_tags[Symbol.iterator] === 'function') {\n\n tag_set = new Set(allowable_tags);\n }\n\n else if (typeof allowable_tags.forEach === 'function') {\n // IE11 compatible\n allowable_tags.forEach(tag_set.add, tag_set);\n }\n\n return tag_set;\n }\n\n function normalize_tag(tag_buffer) {\n let match = NORMALIZE_TAG_REGEX.exec(tag_buffer);\n\n return match ? match[1].toLowerCase() : null;\n }\n\n if (typeof define === 'function' && define.amd) {\n // AMD\n define(function module_factory() { return striptags; });\n }\n\n else if (typeof module === 'object' && module.exports) {\n // Node\n module.exports = striptags;\n }\n\n else {\n // Browser\n global.striptags = striptags;\n }\n}(this));\n","import '../assets/NcMentionBubble.css';\nimport { generateUrl } from \"@nextcloud/router\";\nimport { checkIfDarkTheme } from \"../functions/isDarkTheme/index.mjs\";\nfunction getAvatarUrl(user, options) {\n const size = (options?.size || 64) <= 64 ? 64 : 512;\n const guestUrl = options?.isGuest ? \"/guest\" : \"\";\n const themeUrl = options?.isDarkTheme ?? checkIfDarkTheme(document.body) ? \"/dark\" : \"\";\n return generateUrl(`/avatar${guestUrl}/{user}/{size}${themeUrl}?guestFallback=true`, {\n user,\n size\n });\n}\nexport {\n getAvatarUrl as g\n};\n//# sourceMappingURL=NcMentionBubble.vue_vue_type_style_index_0_scoped_3c4a673d_lang.mjs.map\n","import '../assets/NcUserStatusIcon.css';\nimport { defineComponent, useModel, computed, watch, openBlock, createElementBlock, normalizeClass, createCommentVNode, mergeModels } from \"vue\";\nimport axios from \"@nextcloud/axios\";\nimport { getCapabilities } from \"@nextcloud/capabilities\";\nimport { generateOcsUrl } from \"@nextcloud/router\";\nimport { r as register, R as t53, S as t12, a as t } from \"./_l10n.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nconst awaySvg = '\\n\\n\t\\n\\n';\nconst busySvg = '\\n\\n\t\\n\\n';\nconst dndSvg = '\\n\\n\t\\n\\n';\nconst invisibleSvg = '\\n\\n\t\\n\\n';\nconst onlineSvg = '\\n\\n\t\\n\\n';\nregister(t53);\nregister(t12);\nfunction getUserStatusText(status) {\n switch (status) {\n case \"away\":\n return t(\"away\");\n // TRANSLATORS: User status if the user is currently away from keyboard\n case \"busy\":\n return t(\"busy\");\n case \"dnd\":\n return t(\"do not disturb\");\n case \"online\":\n return t(\"online\");\n case \"invisible\":\n return t(\"invisible\");\n case \"offline\":\n return t(\"offline\");\n default:\n return status;\n }\n}\nconst _hoisted_1 = [\"aria-hidden\", \"aria-label\", \"innerHTML\"];\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcUserStatusIcon\",\n props: /* @__PURE__ */ mergeModels({\n user: { default: void 0 },\n ariaHidden: { type: [Boolean, String], default: false }\n }, {\n \"status\": {},\n \"statusModifiers\": {}\n }),\n emits: [\"update:status\"],\n setup(__props) {\n const status = useModel(__props, \"status\");\n const props = __props;\n const isInvisible = computed(() => status.value && [\"invisible\", \"offline\"].includes(status.value));\n const ariaLabel = computed(() => status.value && (!props.ariaHidden || props.ariaHidden === \"false\") ? t(\"User status: {status}\", { status: getUserStatusText(status.value) }) : void 0);\n watch(() => props.user, async (user) => {\n if (!status.value && user && getCapabilities()?.user_status?.enabled) {\n try {\n const { data } = await axios.get(generateOcsUrl(\"/apps/user_status/api/v1/statuses/{user}\", { user }));\n status.value = data.ocs?.data?.status;\n } catch (error) {\n logger.debug(\"Error while fetching user status\", { error });\n }\n }\n }, { immediate: true });\n const matchSvg = {\n online: onlineSvg,\n away: awaySvg,\n busy: busySvg,\n dnd: dndSvg,\n invisible: invisibleSvg,\n offline: invisibleSvg\n };\n const activeSvg = computed(() => status.value && matchSvg[status.value]);\n return (_ctx, _cache) => {\n return status.value ? (openBlock(), createElementBlock(\"span\", {\n key: 0,\n class: normalizeClass([\"user-status-icon\", {\n \"user-status-icon--invisible\": isInvisible.value\n }]),\n \"aria-hidden\": !ariaLabel.value || void 0,\n \"aria-label\": ariaLabel.value,\n role: \"img\",\n innerHTML: activeSvg.value\n }, null, 10, _hoisted_1)) : createCommentVNode(\"\", true);\n };\n }\n});\nconst NcUserStatusIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-881a79fb\"]]);\nexport {\n NcUserStatusIcon as N,\n getUserStatusText as g\n};\n//# sourceMappingURL=NcUserStatusIcon.mjs.map\n","const ActionGlobalMixin = {\n beforeUpdate() {\n this.text = this.getText();\n },\n data() {\n return {\n // $slots are not reactive.\n // We need to update the content manually\n text: this.getText()\n };\n },\n computed: {\n isLongText() {\n return this.text && this.text.trim().length > 20;\n }\n },\n methods: {\n getText() {\n return this.$slots.default?.()[0].children?.trim?.() || \"\";\n }\n }\n};\nexport {\n ActionGlobalMixin as A\n};\n//# sourceMappingURL=actionGlobal.mjs.map\n","import { warn } from \"vue\";\nimport { N as NC_ACTIONS_CLOSE_MENU } from \"./useNcActions.mjs\";\nimport { A as ActionGlobalMixin } from \"./actionGlobal.mjs\";\nconst ActionTextMixin = {\n mixins: [ActionGlobalMixin],\n props: {\n /**\n * Icon to show with the action, can be either a CSS class or an URL\n */\n icon: {\n type: String,\n default: \"\"\n },\n /**\n * The main text content of the entry.\n */\n name: {\n type: String,\n default: \"\"\n },\n /**\n * The title attribute of the element.\n */\n title: {\n type: String,\n default: \"\"\n },\n /**\n * Whether we close the Actions menu after the click\n */\n closeAfterClick: {\n type: Boolean,\n default: false\n },\n /**\n * Aria label for the button. Not needed if the button has text.\n */\n ariaLabel: {\n type: String,\n default: null\n }\n },\n inject: {\n closeMenu: {\n from: NC_ACTIONS_CLOSE_MENU\n }\n },\n emits: [\n \"click\"\n ],\n created() {\n if (\"ariaHidden\" in this.$attrs) {\n warn(\"[NcAction*]: Do not set the ariaHidden attribute as the root element will inherit the incorrect aria-hidden.\");\n }\n },\n computed: {\n /**\n * Check if icon prop is an URL\n *\n * @return {boolean} Whether the icon prop is an URL\n */\n isIconUrl() {\n try {\n return !!new URL(this.icon, this.icon.startsWith(\"/\") ? window.location.origin : void 0);\n } catch {\n return false;\n }\n }\n },\n methods: {\n onClick(event) {\n this.$emit(\"click\", event);\n if (this.closeAfterClick) {\n this.closeMenu(false);\n }\n }\n }\n};\nexport {\n ActionTextMixin as A\n};\n//# sourceMappingURL=actionText.mjs.map\n","import '../assets/NcActionButton.css';\nimport { c as mdiChevronRight, d as mdiCheck } from \"./mdi.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper.mjs\";\nimport { A as ActionTextMixin } from \"./actionText.mjs\";\nimport { a as NC_ACTIONS_IS_SEMANTIC_MENU } from \"./useNcActions.mjs\";\nimport { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, mergeProps, renderSlot, normalizeStyle, toDisplayString, createCommentVNode, createBlock } from \"vue\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nconst _sfc_main = {\n name: \"NcActionButton\",\n components: {\n NcIconSvgWrapper\n },\n mixins: [ActionTextMixin],\n inject: {\n isInSemanticMenu: {\n from: NC_ACTIONS_IS_SEMANTIC_MENU,\n default: false\n }\n },\n props: {\n /**\n * disabled state of the action button\n */\n disabled: {\n type: Boolean,\n default: false\n },\n /**\n * If this is a menu, a chevron icon will\n * be added at the end of the line\n */\n isMenu: {\n type: Boolean,\n default: false\n },\n /**\n * The button's behavior, by default the button acts like a normal button with optional toggle button behavior if `modelValue` is `true` or `false`.\n * But you can also set to checkbox button behavior with tri-state or radio button like behavior.\n * This extends the native HTML button type attribute.\n */\n type: {\n type: String,\n default: \"button\",\n validator: (behavior) => [\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\"].includes(behavior)\n },\n /**\n * The buttons state if `type` is 'checkbox' or 'radio' (meaning if it is pressed / selected).\n * For checkbox and toggle button behavior - boolean value.\n * For radio button behavior - could be a boolean checked or a string with the value of the button.\n * Note: Unlike native radio buttons, NcActionButton are not grouped by name, so you need to connect them by bind correct modelValue.\n *\n * **This is not availabe for `type='submit'` or `type='reset'`**\n *\n * If using `type='checkbox'` a `model-value` of `true` means checked, `false` means unchecked and `null` means indeterminate (tri-state)\n * For `type='radio'` `null` is equal to `false`\n */\n modelValue: {\n type: [Boolean, String],\n default: null\n },\n /**\n * The value used for the `modelValue` when this component is used with radio behavior\n * Similar to the `value` attribute of ``\n */\n value: {\n type: String,\n default: null\n },\n /**\n * Small underlying text content of the entry\n */\n description: {\n type: String,\n default: \"\"\n }\n },\n emits: [\"update:modelValue\"],\n setup() {\n return {\n mdiCheck,\n mdiChevronRight\n };\n },\n computed: {\n /**\n * determines if the action is focusable\n *\n * @return {boolean} is the action focusable ?\n */\n isFocusable() {\n return !this.disabled;\n },\n /**\n * The current \"checked\" or \"pressed\" state for the model behavior\n */\n isChecked() {\n if (this.type === \"radio\" && typeof this.modelValue !== \"boolean\") {\n return this.modelValue === this.value;\n }\n return this.modelValue;\n },\n /**\n * The native HTML type to set on the button\n */\n nativeType() {\n if (this.type === \"submit\" || this.type === \"reset\") {\n return this.type;\n }\n return \"button\";\n },\n /**\n * HTML attributes to bind to the
` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: boolean, // Lists. Use CSS to reduce space between items instead\n declare: boolean, // ``\n event: null, // `\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationRawTagOpen(code) {\n if (code === 47) {\n effects.consume(code);\n buffer = '';\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In raw continuation, after ` | \n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function continuationRawEndTag(code) {\n if (code === 62) {\n const name = buffer.toLowerCase();\n if (htmlRawNames.includes(name)) {\n effects.consume(code);\n return continuationClose;\n }\n return continuation(code);\n }\n if (asciiAlpha(code) && buffer.length < 8) {\n // Always the case.\n effects.consume(code);\n buffer += String.fromCharCode(code);\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In cdata continuation, after `]`, expecting `]>`.\n *\n * ```markdown\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationCdataInside(code) {\n if (code === 93) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In declaration or instruction continuation, at `>`.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationDeclarationInside(code) {\n if (code === 62) {\n effects.consume(code);\n return continuationClose;\n }\n\n // More dashes.\n if (code === 45 && marker === 2) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In closed continuation: everything we get until the eol/eof is part of it.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationClose(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"htmlFlowData\");\n return continuationAfter(code);\n }\n effects.consume(code);\n return continuationClose;\n }\n\n /**\n * Done.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationAfter(code) {\n effects.exit(\"htmlFlow\");\n // // Feel free to interrupt.\n // tokenizer.interrupt = false\n // // No longer concrete.\n // tokenizer.concrete = false\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuationStart(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * At eol, before continuation.\n *\n * ```markdown\n * > | * ```js\n * ^\n * | b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (markdownLineEnding(code)) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * A continuation.\n *\n * ```markdown\n * | * ```js\n * > | b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLineBefore(effects, ok, nok) {\n return start;\n\n /**\n * Before eol, expecting blank line.\n *\n * ```markdown\n * > |
\n * ^\n * |\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return effects.attempt(blankLine, ok, nok);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlText(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable | undefined} */\n let marker;\n /** @type {number} */\n let index;\n /** @type {State} */\n let returnState;\n return start;\n\n /**\n * Start of HTML (text).\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"htmlText\");\n effects.enter(\"htmlTextData\");\n effects.consume(code);\n return open;\n }\n\n /**\n * After `<`, at tag name or other stuff.\n *\n * ```markdown\n * > | a c\n * ^\n * > | a c\n * ^\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 33) {\n effects.consume(code);\n return declarationOpen;\n }\n if (code === 47) {\n effects.consume(code);\n return tagCloseStart;\n }\n if (code === 63) {\n effects.consume(code);\n return instruction;\n }\n\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagOpen;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * > | a c\n * ^\n * > | a &<]]> c\n * ^\n * ```\n *\n * @type {State}\n */\n function declarationOpen(code) {\n if (code === 45) {\n effects.consume(code);\n return commentOpenInside;\n }\n if (code === 91) {\n effects.consume(code);\n index = 0;\n return cdataOpenInside;\n }\n if (asciiAlpha(code)) {\n effects.consume(code);\n return declaration;\n }\n return nok(code);\n }\n\n /**\n * In a comment, after ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentOpenInside(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return nok(code);\n }\n\n /**\n * In comment.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function comment(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 45) {\n effects.consume(code);\n return commentClose;\n }\n if (markdownLineEnding(code)) {\n returnState = comment;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return comment;\n }\n\n /**\n * In comment, after `-`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentClose(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return comment(code);\n }\n\n /**\n * In comment, after `--`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentEnd(code) {\n return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code);\n }\n\n /**\n * After ` | a &<]]> b\n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function cdataOpenInside(code) {\n const value = \"CDATA[\";\n if (code === value.charCodeAt(index++)) {\n effects.consume(code);\n return index === value.length ? cdata : cdataOpenInside;\n }\n return nok(code);\n }\n\n /**\n * In CDATA.\n *\n * ```markdown\n * > | a &<]]> b\n * ^^^\n * ```\n *\n * @type {State}\n */\n function cdata(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataClose;\n }\n if (markdownLineEnding(code)) {\n returnState = cdata;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return cdata;\n }\n\n /**\n * In CDATA, after `]`, at another `]`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataClose(code) {\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In CDATA, after `]]`, at `>`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataEnd(code) {\n if (code === 62) {\n return end(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In declaration.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function declaration(code) {\n if (code === null || code === 62) {\n return end(code);\n }\n if (markdownLineEnding(code)) {\n returnState = declaration;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return declaration;\n }\n\n /**\n * In instruction.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instruction(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 63) {\n effects.consume(code);\n return instructionClose;\n }\n if (markdownLineEnding(code)) {\n returnState = instruction;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return instruction;\n }\n\n /**\n * In instruction, after `?`, at `>`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instructionClose(code) {\n return code === 62 ? end(code) : instruction(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseStart(code) {\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagClose;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagClose(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagClose;\n }\n return tagCloseBetween(code);\n }\n\n /**\n * In closing tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseBetween(code) {\n if (markdownLineEnding(code)) {\n returnState = tagCloseBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagCloseBetween;\n }\n return end(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpen(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpen;\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In opening tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenBetween(code) {\n if (code === 47) {\n effects.consume(code);\n return end;\n }\n\n // ASCII alphabetical and `:` and `_`.\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenBetween;\n }\n return end(code);\n }\n\n /**\n * In attribute name.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeName(code) {\n // ASCII alphabetical and `-`, `.`, `:`, and `_`.\n if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n return tagOpenAttributeNameAfter(code);\n }\n\n /**\n * After attribute name, before initializer, the end of the tag, or\n * whitespace.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeNameAfter;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeNameAfter;\n }\n return tagOpenBetween(code);\n }\n\n /**\n * Before unquoted, double quoted, or single quoted attribute value, allowing\n * whitespace.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueBefore(code) {\n if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n return nok(code);\n }\n if (code === 34 || code === 39) {\n effects.consume(code);\n marker = code;\n return tagOpenAttributeValueQuoted;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueBefore;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * In double or single quoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuoted(code) {\n if (code === marker) {\n effects.consume(code);\n marker = undefined;\n return tagOpenAttributeValueQuotedAfter;\n }\n if (code === null) {\n return nok(code);\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueQuoted;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueQuoted;\n }\n\n /**\n * In unquoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueUnquoted(code) {\n if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) {\n return nok(code);\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * After double or single quoted attribute value, before whitespace or the end\n * of the tag.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuotedAfter(code) {\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In certain circumstances of a tag where only an `>` is allowed.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function end(code) {\n if (code === 62) {\n effects.consume(code);\n effects.exit(\"htmlTextData\");\n effects.exit(\"htmlText\");\n return ok;\n }\n return nok(code);\n }\n\n /**\n * At eol.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * > | a \n * ```\n *\n * @type {State}\n */\n function lineEndingBefore(code) {\n effects.exit(\"htmlTextData\");\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return lineEndingAfter;\n }\n\n /**\n * After eol, at optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfter(code) {\n // Always populated by defaults.\n\n return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code);\n }\n\n /**\n * After eol, after optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfterPrefix(code) {\n effects.enter(\"htmlTextData\");\n return returnState(code);\n }\n}","/**\n * @import {\n * Construct,\n * Event,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer,\n * Token\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const labelEnd = {\n name: 'labelEnd',\n resolveAll: resolveAllLabelEnd,\n resolveTo: resolveToLabelEnd,\n tokenize: tokenizeLabelEnd\n};\n\n/** @type {Construct} */\nconst resourceConstruct = {\n tokenize: tokenizeResource\n};\n/** @type {Construct} */\nconst referenceFullConstruct = {\n tokenize: tokenizeReferenceFull\n};\n/** @type {Construct} */\nconst referenceCollapsedConstruct = {\n tokenize: tokenizeReferenceCollapsed\n};\n\n/** @type {Resolver} */\nfunction resolveAllLabelEnd(events) {\n let index = -1;\n /** @type {Array} */\n const newEvents = [];\n while (++index < events.length) {\n const token = events[index][1];\n newEvents.push(events[index]);\n if (token.type === \"labelImage\" || token.type === \"labelLink\" || token.type === \"labelEnd\") {\n // Remove the marker.\n const offset = token.type === \"labelImage\" ? 4 : 2;\n token.type = \"data\";\n index += offset;\n }\n }\n\n // If the events are equal, we don't have to copy newEvents to events\n if (events.length !== newEvents.length) {\n splice(events, 0, events.length, newEvents);\n }\n return events;\n}\n\n/** @type {Resolver} */\nfunction resolveToLabelEnd(events, context) {\n let index = events.length;\n let offset = 0;\n /** @type {Token} */\n let token;\n /** @type {number | undefined} */\n let open;\n /** @type {number | undefined} */\n let close;\n /** @type {Array} */\n let media;\n\n // Find an opening.\n while (index--) {\n token = events[index][1];\n if (open) {\n // If we see another link, or inactive link label, we’ve been here before.\n if (token.type === \"link\" || token.type === \"labelLink\" && token._inactive) {\n break;\n }\n\n // Mark other link openings as inactive, as we can’t have links in\n // links.\n if (events[index][0] === 'enter' && token.type === \"labelLink\") {\n token._inactive = true;\n }\n } else if (close) {\n if (events[index][0] === 'enter' && (token.type === \"labelImage\" || token.type === \"labelLink\") && !token._balanced) {\n open = index;\n if (token.type !== \"labelLink\") {\n offset = 2;\n break;\n }\n }\n } else if (token.type === \"labelEnd\") {\n close = index;\n }\n }\n const group = {\n type: events[open][1].type === \"labelLink\" ? \"link\" : \"image\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n const label = {\n type: \"label\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[close][1].end\n }\n };\n const text = {\n type: \"labelText\",\n start: {\n ...events[open + offset + 2][1].end\n },\n end: {\n ...events[close - 2][1].start\n }\n };\n media = [['enter', group, context], ['enter', label, context]];\n\n // Opening marker.\n media = push(media, events.slice(open + 1, open + offset + 3));\n\n // Text open.\n media = push(media, [['enter', text, context]]);\n\n // Always populated by defaults.\n\n // Between.\n media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));\n\n // Text close, marker close, label close.\n media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]);\n\n // Reference, resource, or so.\n media = push(media, events.slice(close + 1));\n\n // Media close.\n media = push(media, [['exit', group, context]]);\n splice(events, open, events.length, media);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelEnd(effects, ok, nok) {\n const self = this;\n let index = self.events.length;\n /** @type {Token} */\n let labelStart;\n /** @type {boolean} */\n let defined;\n\n // Find an opening.\n while (index--) {\n if ((self.events[index][1].type === \"labelImage\" || self.events[index][1].type === \"labelLink\") && !self.events[index][1]._balanced) {\n labelStart = self.events[index][1];\n break;\n }\n }\n return start;\n\n /**\n * Start of label end.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // If there is not an okay opening.\n if (!labelStart) {\n return nok(code);\n }\n\n // If the corresponding label (link) start is marked as inactive,\n // it means we’d be wrapping a link, like this:\n //\n // ```markdown\n // > | a [b [c](d) e](f) g.\n // ^\n // ```\n //\n // We can’t have that, so it’s just balanced brackets.\n if (labelStart._inactive) {\n return labelEndNok(code);\n }\n defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })));\n effects.enter(\"labelEnd\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelEnd\");\n return after;\n }\n\n /**\n * After `]`.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // Note: `markdown-rs` also parses GFM footnotes here, which for us is in\n // an extension.\n\n // Resource (`[asd](fgh)`)?\n if (code === 40) {\n return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code);\n }\n\n // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n if (code === 91) {\n return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code);\n }\n\n // Shortcut (`[asd]`) reference?\n return defined ? labelEndOk(code) : labelEndNok(code);\n }\n\n /**\n * After `]`, at `[`, but not at a full reference.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceNotFull(code) {\n return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);\n }\n\n /**\n * Done, we found something.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndOk(code) {\n // Note: `markdown-rs` does a bunch of stuff here.\n return ok(code);\n }\n\n /**\n * Done, it’s nothing.\n *\n * There was an okay opening, but we didn’t match anything.\n *\n * ```markdown\n * > | [a](b c\n * ^\n * > | [a][b c\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndNok(code) {\n labelStart._balanced = true;\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeResource(effects, ok, nok) {\n return resourceStart;\n\n /**\n * At a resource.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceStart(code) {\n effects.enter(\"resource\");\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n return resourceBefore;\n }\n\n /**\n * In resource, after `(`, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBefore(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code);\n }\n\n /**\n * In resource, after optional whitespace, at `)` or a destination.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceOpen(code) {\n if (code === 41) {\n return resourceEnd(code);\n }\n return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, \"resourceDestination\", \"resourceDestinationLiteral\", \"resourceDestinationLiteralMarker\", \"resourceDestinationRaw\", \"resourceDestinationString\", 32)(code);\n }\n\n /**\n * In resource, after destination, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code);\n }\n\n /**\n * At invalid destination.\n *\n * ```markdown\n * > | [a](<<) b\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationMissing(code) {\n return nok(code);\n }\n\n /**\n * In resource, after destination and whitespace, at `(` or title.\n *\n * ```markdown\n * > | [a](b ) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBetween(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(effects, resourceTitleAfter, nok, \"resourceTitle\", \"resourceTitleMarker\", \"resourceTitleString\")(code);\n }\n return resourceEnd(code);\n }\n\n /**\n * In resource, after title, at optional whitespace.\n *\n * ```markdown\n * > | [a](b \"c\") d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceTitleAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code);\n }\n\n /**\n * In resource, at `)`.\n *\n * ```markdown\n * > | [a](b) d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceEnd(code) {\n if (code === 41) {\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n effects.exit(\"resource\");\n return ok;\n }\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceFull(effects, ok, nok) {\n const self = this;\n return referenceFull;\n\n /**\n * In a reference (full), at the `[`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFull(code) {\n return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, \"reference\", \"referenceMarker\", \"referenceString\")(code);\n }\n\n /**\n * In a reference (full), after `]`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullAfter(code) {\n return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code);\n }\n\n /**\n * In reference (full) that was missing.\n *\n * ```markdown\n * > | [a][b d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullMissing(code) {\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceCollapsed(effects, ok, nok) {\n return referenceCollapsedStart;\n\n /**\n * In reference (collapsed), at `[`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedStart(code) {\n // We only attempt a collapsed label if there’s a `[`.\n\n effects.enter(\"reference\");\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n return referenceCollapsedOpen;\n }\n\n /**\n * In reference (collapsed), at `]`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedOpen(code) {\n if (code === 93) {\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n effects.exit(\"reference\");\n return ok;\n }\n return nok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartImage = {\n name: 'labelStartImage',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartImage\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (image) start.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelImage\");\n effects.enter(\"labelImageMarker\");\n effects.consume(code);\n effects.exit(\"labelImageMarker\");\n return open;\n }\n\n /**\n * After `!`, at `[`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 91) {\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelImage\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * After `![`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * This is needed in because, when GFM footnotes are enabled, images never\n * form when started with a `^`.\n * Instead, links form:\n *\n * ```markdown\n * ![^a](b)\n *\n * ![^a][b]\n *\n * [b]: c\n * ```\n *\n * ```html\n *

!^a

\n *

!^a

\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // To do: use a new field to do this, this is still needed for\n // `micromark-extension-gfm-footnote`, but the `label-start-link`\n // behavior isn’t.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartLink = {\n name: 'labelStartLink',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartLink\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (link) start.\n *\n * ```markdown\n * > | a [b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelLink\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelLink\");\n return after;\n }\n\n /** @type {State} */\n function after(code) {\n // To do: this isn’t needed in `micromark-extension-gfm-footnote`,\n // remove.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const lineEnding = {\n name: 'lineEnding',\n tokenize: tokenizeLineEnding\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLineEnding(effects, ok) {\n return start;\n\n /** @type {State} */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return factorySpace(effects, ok, \"linePrefix\");\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const thematicBreak = {\n name: 'thematicBreak',\n tokenize: tokenizeThematicBreak\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeThematicBreak(effects, ok, nok) {\n let size = 0;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * Start of thematic break.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"thematicBreak\");\n // To do: parse indent like `markdown-rs`.\n return before(code);\n }\n\n /**\n * After optional whitespace, at marker.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n marker = code;\n return atBreak(code);\n }\n\n /**\n * After something, before something else.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === marker) {\n effects.enter(\"thematicBreakSequence\");\n return sequence(code);\n }\n if (size >= 3 && (code === null || markdownLineEnding(code))) {\n effects.exit(\"thematicBreak\");\n return ok(code);\n }\n return nok(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function sequence(code) {\n if (code === marker) {\n effects.consume(code);\n size++;\n return sequence;\n }\n effects.exit(\"thematicBreakSequence\");\n return markdownSpace(code) ? factorySpace(effects, atBreak, \"whitespace\")(code) : atBreak(code);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * Exiter,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiDigit, markdownSpace } from 'micromark-util-character';\nimport { blankLine } from './blank-line.js';\nimport { thematicBreak } from './thematic-break.js';\n\n/** @type {Construct} */\nexport const list = {\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd,\n name: 'list',\n tokenize: tokenizeListStart\n};\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n partial: true,\n tokenize: tokenizeListItemPrefixWhitespace\n};\n\n/** @type {Construct} */\nconst indentConstruct = {\n partial: true,\n tokenize: tokenizeIndent\n};\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this;\n const tail = self.events[self.events.length - 1];\n let initialSize = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n let size = 0;\n return start;\n\n /** @type {State} */\n function start(code) {\n const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? \"listUnordered\" : \"listOrdered\");\n if (kind === \"listUnordered\" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {\n if (!self.containerState.type) {\n self.containerState.type = kind;\n effects.enter(kind, {\n _container: true\n });\n }\n if (kind === \"listUnordered\") {\n effects.enter(\"listItemPrefix\");\n return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code);\n }\n if (!self.interrupt || code === 49) {\n effects.enter(\"listItemPrefix\");\n effects.enter(\"listItemValue\");\n return inside(code);\n }\n }\n return nok(code);\n }\n\n /** @type {State} */\n function inside(code) {\n if (asciiDigit(code) && ++size < 10) {\n effects.consume(code);\n return inside;\n }\n if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {\n effects.exit(\"listItemValue\");\n return atMarker(code);\n }\n return nok(code);\n }\n\n /**\n * @type {State}\n **/\n function atMarker(code) {\n effects.enter(\"listItemMarker\");\n effects.consume(code);\n effects.exit(\"listItemMarker\");\n self.containerState.marker = self.containerState.marker || code;\n return effects.check(blankLine,\n // Can’t be empty when interrupting.\n self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));\n }\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.initialBlankLine = true;\n initialSize++;\n return endOfPrefix(code);\n }\n\n /** @type {State} */\n function otherPrefix(code) {\n if (markdownSpace(code)) {\n effects.enter(\"listItemPrefixWhitespace\");\n effects.consume(code);\n effects.exit(\"listItemPrefixWhitespace\");\n return endOfPrefix;\n }\n return nok(code);\n }\n\n /** @type {State} */\n function endOfPrefix(code) {\n self.containerState.size = initialSize + self.sliceSerialize(effects.exit(\"listItemPrefix\"), true).length;\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListContinuation(effects, ok, nok) {\n const self = this;\n self.containerState._closeFlow = undefined;\n return effects.check(blankLine, onBlank, notBlank);\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;\n\n // We have a blank line.\n // Still, try to consume at most the items size.\n return factorySpace(effects, ok, \"listItemIndent\", self.containerState.size + 1)(code);\n }\n\n /** @type {State} */\n function notBlank(code) {\n if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return notInCurrentItem(code);\n }\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);\n }\n\n /** @type {State} */\n function notInCurrentItem(code) {\n // While we do continue, we signal that the flow should be closed.\n self.containerState._closeFlow = true;\n // As we’re closing flow, we’re no longer interrupting.\n self.interrupt = undefined;\n // Always populated by defaults.\n\n return factorySpace(effects, effects.attempt(list, ok, nok), \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"listItemIndent\", self.containerState.size + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"listItemIndent\" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Exiter}\n */\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type);\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this;\n\n // Always populated by defaults.\n\n return factorySpace(effects, afterPrefix, \"listItemPrefixWhitespace\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return !markdownSpace(code) && tail && tail[1].type === \"listItemPrefixWhitespace\" ? ok(code) : nok(code);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const setextUnderline = {\n name: 'setextUnderline',\n resolveTo: resolveToSetextUnderline,\n tokenize: tokenizeSetextUnderline\n};\n\n/** @type {Resolver} */\nfunction resolveToSetextUnderline(events, context) {\n // To do: resolve like `markdown-rs`.\n let index = events.length;\n /** @type {number | undefined} */\n let content;\n /** @type {number | undefined} */\n let text;\n /** @type {number | undefined} */\n let definition;\n\n // Find the opening of the content.\n // It’ll always exist: we don’t tokenize if it isn’t there.\n while (index--) {\n if (events[index][0] === 'enter') {\n if (events[index][1].type === \"content\") {\n content = index;\n break;\n }\n if (events[index][1].type === \"paragraph\") {\n text = index;\n }\n }\n // Exit\n else {\n if (events[index][1].type === \"content\") {\n // Remove the content end (if needed we’ll add it later)\n events.splice(index, 1);\n }\n if (!definition && events[index][1].type === \"definition\") {\n definition = index;\n }\n }\n }\n const heading = {\n type: \"setextHeading\",\n start: {\n ...events[content][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n\n // Change the paragraph to setext heading text.\n events[text][1].type = \"setextHeadingText\";\n\n // If we have definitions in the content, we’ll keep on having content,\n // but we need move it.\n if (definition) {\n events.splice(text, 0, ['enter', heading, context]);\n events.splice(definition + 1, 0, ['exit', events[content][1], context]);\n events[content][1].end = {\n ...events[definition][1].end\n };\n } else {\n events[content][1] = heading;\n }\n\n // Add the heading exit at the end.\n events.push(['exit', heading, context]);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * At start of heading (setext) underline.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n let index = self.events.length;\n /** @type {boolean | undefined} */\n let paragraph;\n // Find an opening.\n while (index--) {\n // Skip enter/exit of line ending, line prefix, and content.\n // We can now either have a definition or a paragraph.\n if (self.events[index][1].type !== \"lineEnding\" && self.events[index][1].type !== \"linePrefix\" && self.events[index][1].type !== \"content\") {\n paragraph = self.events[index][1].type === \"paragraph\";\n break;\n }\n }\n\n // To do: handle lazy/pierce like `markdown-rs`.\n // To do: parse indent like `markdown-rs`.\n if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n effects.enter(\"setextHeadingLine\");\n marker = code;\n return before(code);\n }\n return nok(code);\n }\n\n /**\n * After optional whitespace, at `-` or `=`.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n effects.enter(\"setextHeadingLineSequence\");\n return inside(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n if (code === marker) {\n effects.consume(code);\n return inside;\n }\n effects.exit(\"setextHeadingLineSequence\");\n return markdownSpace(code) ? factorySpace(effects, after, \"lineSuffix\")(code) : after(code);\n }\n\n /**\n * After sequence, after optional whitespace.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"setextHeadingLine\");\n return ok(code);\n }\n return nok(code);\n }\n}","/**\n * @import {\n * InitialConstruct,\n * Initializer,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nimport { blankLine, content } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const flow = {\n tokenize: initializeFlow\n};\n\n/**\n * @this {TokenizeContext}\n * Self.\n * @type {Initializer}\n * Initializer.\n */\nfunction initializeFlow(effects) {\n const self = this;\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine, atBlankEnding,\n // Try to parse initial flow (essentially, only code).\n effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), \"linePrefix\")));\n return initial;\n\n /** @type {State} */\n function atBlankEnding(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEndingBlank\");\n effects.consume(code);\n effects.exit(\"lineEndingBlank\");\n self.currentConstruct = undefined;\n return initial;\n }\n\n /** @type {State} */\n function afterConstruct(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n self.currentConstruct = undefined;\n return initial;\n }\n}","/**\n * @import {\n * Code,\n * InitialConstruct,\n * Initializer,\n * Resolver,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nexport const resolver = {\n resolveAll: createResolver()\n};\nexport const string = initializeFactory('string');\nexport const text = initializeFactory('text');\n\n/**\n * @param {'string' | 'text'} field\n * Field.\n * @returns {InitialConstruct}\n * Construct.\n */\nfunction initializeFactory(field) {\n return {\n resolveAll: createResolver(field === 'text' ? resolveAllLineSuffixes : undefined),\n tokenize: initializeText\n };\n\n /**\n * @this {TokenizeContext}\n * Context.\n * @type {Initializer}\n */\n function initializeText(effects) {\n const self = this;\n const constructs = this.parser.constructs[field];\n const text = effects.attempt(constructs, start, notText);\n return start;\n\n /** @type {State} */\n function start(code) {\n return atBreak(code) ? text(code) : notText(code);\n }\n\n /** @type {State} */\n function notText(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"data\");\n effects.consume(code);\n return data;\n }\n\n /** @type {State} */\n function data(code) {\n if (atBreak(code)) {\n effects.exit(\"data\");\n return text(code);\n }\n\n // Data.\n effects.consume(code);\n return data;\n }\n\n /**\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether the code is a break.\n */\n function atBreak(code) {\n if (code === null) {\n return true;\n }\n const list = constructs[code];\n let index = -1;\n if (list) {\n // Always populated by defaults.\n\n while (++index < list.length) {\n const item = list[index];\n if (!item.previous || item.previous.call(self, self.previous)) {\n return true;\n }\n }\n }\n return false;\n }\n }\n}\n\n/**\n * @param {Resolver | undefined} [extraResolver]\n * Resolver.\n * @returns {Resolver}\n * Resolver.\n */\nfunction createResolver(extraResolver) {\n return resolveAllText;\n\n /** @type {Resolver} */\n function resolveAllText(events, context) {\n let index = -1;\n /** @type {number | undefined} */\n let enter;\n\n // A rather boring computation (to merge adjacent `data` events) which\n // improves mm performance by 29%.\n while (++index <= events.length) {\n if (enter === undefined) {\n if (events[index] && events[index][1].type === \"data\") {\n enter = index;\n index++;\n }\n } else if (!events[index] || events[index][1].type !== \"data\") {\n // Don’t do anything if there is one data token.\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end;\n events.splice(enter + 2, index - enter - 2);\n index = enter + 2;\n }\n enter = undefined;\n }\n }\n return extraResolver ? extraResolver(events, context) : events;\n }\n}\n\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\nfunction resolveAllLineSuffixes(events, context) {\n let eventIndex = 0; // Skip first.\n\n while (++eventIndex <= events.length) {\n if ((eventIndex === events.length || events[eventIndex][1].type === \"lineEnding\") && events[eventIndex - 1][1].type === \"data\") {\n const data = events[eventIndex - 1][1];\n const chunks = context.sliceStream(data);\n let index = chunks.length;\n let bufferIndex = -1;\n let size = 0;\n /** @type {boolean | undefined} */\n let tabs;\n while (index--) {\n const chunk = chunks[index];\n if (typeof chunk === 'string') {\n bufferIndex = chunk.length;\n while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n size++;\n bufferIndex--;\n }\n if (bufferIndex) break;\n bufferIndex = -1;\n }\n // Number\n else if (chunk === -2) {\n tabs = true;\n size++;\n } else if (chunk === -1) {\n // Empty\n } else {\n // Replacement character, exit.\n index++;\n break;\n }\n }\n\n // Allow final trailing whitespace.\n if (context._contentTypeTextTrailing && eventIndex === events.length) {\n size = 0;\n }\n if (size) {\n const token = {\n type: eventIndex === events.length || tabs || size < 2 ? \"lineSuffix\" : \"hardBreakTrailing\",\n start: {\n _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex,\n _index: data.start._index + index,\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size\n },\n end: {\n ...data.end\n }\n };\n data.end = {\n ...token.start\n };\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token);\n } else {\n events.splice(eventIndex, 0, ['enter', token, context], ['exit', token, context]);\n eventIndex += 2;\n }\n }\n eventIndex++;\n }\n }\n return events;\n}","/**\n * @import {Extension} from 'micromark-util-types'\n */\n\nimport { attention, autolink, blockQuote, characterEscape, characterReference, codeFenced, codeIndented, codeText, definition, hardBreakEscape, headingAtx, htmlFlow, htmlText, labelEnd, labelStartImage, labelStartLink, lineEnding, list, setextUnderline, thematicBreak } from 'micromark-core-commonmark';\nimport { resolver as resolveText } from './initialize/text.js';\n\n/** @satisfies {Extension['document']} */\nexport const document = {\n [42]: list,\n [43]: list,\n [45]: list,\n [48]: list,\n [49]: list,\n [50]: list,\n [51]: list,\n [52]: list,\n [53]: list,\n [54]: list,\n [55]: list,\n [56]: list,\n [57]: list,\n [62]: blockQuote\n};\n\n/** @satisfies {Extension['contentInitial']} */\nexport const contentInitial = {\n [91]: definition\n};\n\n/** @satisfies {Extension['flowInitial']} */\nexport const flowInitial = {\n [-2]: codeIndented,\n [-1]: codeIndented,\n [32]: codeIndented\n};\n\n/** @satisfies {Extension['flow']} */\nexport const flow = {\n [35]: headingAtx,\n [42]: thematicBreak,\n [45]: [setextUnderline, thematicBreak],\n [60]: htmlFlow,\n [61]: setextUnderline,\n [95]: thematicBreak,\n [96]: codeFenced,\n [126]: codeFenced\n};\n\n/** @satisfies {Extension['string']} */\nexport const string = {\n [38]: characterReference,\n [92]: characterEscape\n};\n\n/** @satisfies {Extension['text']} */\nexport const text = {\n [-5]: lineEnding,\n [-4]: lineEnding,\n [-3]: lineEnding,\n [33]: labelStartImage,\n [38]: characterReference,\n [42]: attention,\n [60]: [autolink, htmlText],\n [91]: labelStartLink,\n [92]: [hardBreakEscape, characterEscape],\n [93]: labelEnd,\n [95]: attention,\n [96]: codeText\n};\n\n/** @satisfies {Extension['insideSpan']} */\nexport const insideSpan = {\n null: [attention, resolveText]\n};\n\n/** @satisfies {Extension['attentionMarkers']} */\nexport const attentionMarkers = {\n null: [42, 95]\n};\n\n/** @satisfies {Extension['disable']} */\nexport const disable = {\n null: []\n};","/**\n * @import {\n * Chunk,\n * Code,\n * ConstructRecord,\n * Construct,\n * Effects,\n * InitialConstruct,\n * ParseContext,\n * Point,\n * State,\n * TokenizeContext,\n * Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @callback Restore\n * Restore the state.\n * @returns {undefined}\n * Nothing.\n *\n * @typedef Info\n * Info.\n * @property {Restore} restore\n * Restore.\n * @property {number} from\n * From.\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * Construct.\n * @param {Info} info\n * Info.\n * @returns {undefined}\n * Nothing.\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n * Parser.\n * @param {InitialConstruct} initialize\n * Construct.\n * @param {Omit | undefined} [from]\n * Point (optional).\n * @returns {TokenizeContext}\n * Context.\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = {\n _bufferIndex: -1,\n _index: 0,\n line: from && from.line || 1,\n column: from && from.column || 1,\n offset: from && from.offset || 0\n };\n /** @type {Record} */\n const columnStart = {};\n /** @type {Array} */\n const resolveAllConstructs = [];\n /** @type {Array} */\n let chunks = [];\n /** @type {Array} */\n let stack = [];\n /** @type {boolean | undefined} */\n let consumed = true;\n\n /**\n * Tools used for tokenizing.\n *\n * @type {Effects}\n */\n const effects = {\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\n consume,\n enter,\n exit,\n interrupt: constructFactory(onsuccessfulcheck, {\n interrupt: true\n })\n };\n\n /**\n * State and tools for resolving and serializing.\n *\n * @type {TokenizeContext}\n */\n const context = {\n code: null,\n containerState: {},\n defineSkip,\n events: [],\n now,\n parser,\n previous: null,\n sliceSerialize,\n sliceStream,\n write\n };\n\n /**\n * The state function.\n *\n * @type {State | undefined}\n */\n let state = initialize.tokenize.call(context, effects);\n\n /**\n * Track which character we expect to be consumed, to catch bugs.\n *\n * @type {Code}\n */\n let expectedCode;\n if (initialize.resolveAll) {\n resolveAllConstructs.push(initialize);\n }\n return context;\n\n /** @type {TokenizeContext['write']} */\n function write(slice) {\n chunks = push(chunks, slice);\n main();\n\n // Exit if we’re not done, resolve might change stuff.\n if (chunks[chunks.length - 1] !== null) {\n return [];\n }\n addResult(initialize, 0);\n\n // Otherwise, resolve, and exit.\n context.events = resolveAll(resolveAllConstructs, context.events, context);\n return context.events;\n }\n\n //\n // Tools.\n //\n\n /** @type {TokenizeContext['sliceSerialize']} */\n function sliceSerialize(token, expandTabs) {\n return serializeChunks(sliceStream(token), expandTabs);\n }\n\n /** @type {TokenizeContext['sliceStream']} */\n function sliceStream(token) {\n return sliceChunks(chunks, token);\n }\n\n /** @type {TokenizeContext['now']} */\n function now() {\n // This is a hot path, so we clone manually instead of `Object.assign({}, point)`\n const {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n } = point;\n return {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n };\n }\n\n /** @type {TokenizeContext['defineSkip']} */\n function defineSkip(value) {\n columnStart[value.line] = value.column;\n accountForPotentialSkip();\n }\n\n //\n // State management.\n //\n\n /**\n * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n * `consume`).\n * Here is where we walk through the chunks, which either include strings of\n * several characters, or numerical character codes.\n * The reason to do this in a loop instead of a call is so the stack can\n * drain.\n *\n * @returns {undefined}\n * Nothing.\n */\n function main() {\n /** @type {number} */\n let chunkIndex;\n while (point._index < chunks.length) {\n const chunk = chunks[point._index];\n\n // If we’re in a buffer chunk, loop through it.\n if (typeof chunk === 'string') {\n chunkIndex = point._index;\n if (point._bufferIndex < 0) {\n point._bufferIndex = 0;\n }\n while (point._index === chunkIndex && point._bufferIndex < chunk.length) {\n go(chunk.charCodeAt(point._bufferIndex));\n }\n } else {\n go(chunk);\n }\n }\n }\n\n /**\n * Deal with one code.\n *\n * @param {Code} code\n * Code.\n * @returns {undefined}\n * Nothing.\n */\n function go(code) {\n consumed = undefined;\n expectedCode = code;\n state = state(code);\n }\n\n /** @type {Effects['consume']} */\n function consume(code) {\n if (markdownLineEnding(code)) {\n point.line++;\n point.column = 1;\n point.offset += code === -3 ? 2 : 1;\n accountForPotentialSkip();\n } else if (code !== -1) {\n point.column++;\n point.offset++;\n }\n\n // Not in a string chunk.\n if (point._bufferIndex < 0) {\n point._index++;\n } else {\n point._bufferIndex++;\n\n // At end of string chunk.\n if (point._bufferIndex ===\n // Points w/ non-negative `_bufferIndex` reference\n // strings.\n /** @type {string} */\n chunks[point._index].length) {\n point._bufferIndex = -1;\n point._index++;\n }\n }\n\n // Expose the previous character.\n context.previous = code;\n\n // Mark as consumed.\n consumed = true;\n }\n\n /** @type {Effects['enter']} */\n function enter(type, fields) {\n /** @type {Token} */\n // @ts-expect-error Patch instead of assign required fields to help GC.\n const token = fields || {};\n token.type = type;\n token.start = now();\n context.events.push(['enter', token, context]);\n stack.push(token);\n return token;\n }\n\n /** @type {Effects['exit']} */\n function exit(type) {\n const token = stack.pop();\n token.end = now();\n context.events.push(['exit', token, context]);\n return token;\n }\n\n /**\n * Use results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulconstruct(construct, info) {\n addResult(construct, info.from);\n }\n\n /**\n * Discard results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulcheck(_, info) {\n info.restore();\n }\n\n /**\n * Factory to attempt/check/interrupt.\n *\n * @param {ReturnHandle} onreturn\n * Callback.\n * @param {{interrupt?: boolean | undefined} | undefined} [fields]\n * Fields.\n */\n function constructFactory(onreturn, fields) {\n return hook;\n\n /**\n * Handle either an object mapping codes to constructs, a list of\n * constructs, or a single construct.\n *\n * @param {Array | ConstructRecord | Construct} constructs\n * Constructs.\n * @param {State} returnState\n * State.\n * @param {State | undefined} [bogusState]\n * State.\n * @returns {State}\n * State.\n */\n function hook(constructs, returnState, bogusState) {\n /** @type {ReadonlyArray} */\n let listOfConstructs;\n /** @type {number} */\n let constructIndex;\n /** @type {Construct} */\n let currentConstruct;\n /** @type {Info} */\n let info;\n return Array.isArray(constructs) ? /* c8 ignore next 1 */\n handleListOfConstructs(constructs) : 'tokenize' in constructs ?\n // Looks like a construct.\n handleListOfConstructs([(/** @type {Construct} */constructs)]) : handleMapOfConstructs(constructs);\n\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleMapOfConstructs(map) {\n return start;\n\n /** @type {State} */\n function start(code) {\n const left = code !== null && map[code];\n const all = code !== null && map.null;\n const list = [\n // To do: add more extension tests.\n /* c8 ignore next 2 */\n ...(Array.isArray(left) ? left : left ? [left] : []), ...(Array.isArray(all) ? all : all ? [all] : [])];\n return handleListOfConstructs(list)(code);\n }\n }\n\n /**\n * Handle a list of construct.\n *\n * @param {ReadonlyArray} list\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleListOfConstructs(list) {\n listOfConstructs = list;\n constructIndex = 0;\n if (list.length === 0) {\n return bogusState;\n }\n return handleConstruct(list[constructIndex]);\n }\n\n /**\n * Handle a single construct.\n *\n * @param {Construct} construct\n * Construct.\n * @returns {State}\n * State.\n */\n function handleConstruct(construct) {\n return start;\n\n /** @type {State} */\n function start(code) {\n // To do: not needed to store if there is no bogus state, probably?\n // Currently doesn’t work because `inspect` in document does a check\n // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n // by not storing.\n info = store();\n currentConstruct = construct;\n if (!construct.partial) {\n context.currentConstruct = construct;\n }\n\n // Always populated by defaults.\n\n if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {\n return nok(code);\n }\n return construct.tokenize.call(\n // If we do have fields, create an object w/ `context` as its\n // prototype.\n // This allows a “live binding”, which is needed for `interrupt`.\n fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code);\n }\n }\n\n /** @type {State} */\n function ok(code) {\n consumed = true;\n onreturn(currentConstruct, info);\n return returnState;\n }\n\n /** @type {State} */\n function nok(code) {\n consumed = true;\n info.restore();\n if (++constructIndex < listOfConstructs.length) {\n return handleConstruct(listOfConstructs[constructIndex]);\n }\n return bogusState;\n }\n }\n }\n\n /**\n * @param {Construct} construct\n * Construct.\n * @param {number} from\n * From.\n * @returns {undefined}\n * Nothing.\n */\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct);\n }\n if (construct.resolve) {\n splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));\n }\n if (construct.resolveTo) {\n context.events = construct.resolveTo(context.events, context);\n }\n }\n\n /**\n * Store state.\n *\n * @returns {Info}\n * Info.\n */\n function store() {\n const startPoint = now();\n const startPrevious = context.previous;\n const startCurrentConstruct = context.currentConstruct;\n const startEventsIndex = context.events.length;\n const startStack = Array.from(stack);\n return {\n from: startEventsIndex,\n restore\n };\n\n /**\n * Restore state.\n *\n * @returns {undefined}\n * Nothing.\n */\n function restore() {\n point = startPoint;\n context.previous = startPrevious;\n context.currentConstruct = startCurrentConstruct;\n context.events.length = startEventsIndex;\n stack = startStack;\n accountForPotentialSkip();\n }\n }\n\n /**\n * Move the current point a bit forward in the line when it’s on a column\n * skip.\n *\n * @returns {undefined}\n * Nothing.\n */\n function accountForPotentialSkip() {\n if (point.line in columnStart && point.column < 2) {\n point.column = columnStart[point.line];\n point.offset += columnStart[point.line] - 1;\n }\n }\n}\n\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {Pick} token\n * Token.\n * @returns {Array}\n * Chunks.\n */\nfunction sliceChunks(chunks, token) {\n const startIndex = token.start._index;\n const startBufferIndex = token.start._bufferIndex;\n const endIndex = token.end._index;\n const endBufferIndex = token.end._bufferIndex;\n /** @type {Array} */\n let view;\n if (startIndex === endIndex) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];\n } else {\n view = chunks.slice(startIndex, endIndex);\n if (startBufferIndex > -1) {\n const head = view[0];\n if (typeof head === 'string') {\n view[0] = head.slice(startBufferIndex);\n /* c8 ignore next 4 -- used to be used, no longer */\n } else {\n view.shift();\n }\n }\n if (endBufferIndex > 0) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view.push(chunks[endIndex].slice(0, endBufferIndex));\n }\n }\n return view;\n}\n\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {boolean | undefined} [expandTabs=false]\n * Whether to expand tabs (default: `false`).\n * @returns {string}\n * Result.\n */\nfunction serializeChunks(chunks, expandTabs) {\n let index = -1;\n /** @type {Array} */\n const result = [];\n /** @type {boolean | undefined} */\n let atTab;\n while (++index < chunks.length) {\n const chunk = chunks[index];\n /** @type {string} */\n let value;\n if (typeof chunk === 'string') {\n value = chunk;\n } else switch (chunk) {\n case -5:\n {\n value = \"\\r\";\n break;\n }\n case -4:\n {\n value = \"\\n\";\n break;\n }\n case -3:\n {\n value = \"\\r\" + \"\\n\";\n break;\n }\n case -2:\n {\n value = expandTabs ? \" \" : \"\\t\";\n break;\n }\n case -1:\n {\n if (!expandTabs && atTab) continue;\n value = \" \";\n break;\n }\n default:\n {\n // Currently only replacement character.\n value = String.fromCharCode(chunk);\n }\n }\n atTab = chunk === -2;\n result.push(value);\n }\n return result.join('');\n}","/**\n * @import {\n * Create,\n * FullNormalizedExtension,\n * InitialConstruct,\n * ParseContext,\n * ParseOptions\n * } from 'micromark-util-types'\n */\n\nimport { combineExtensions } from 'micromark-util-combine-extensions';\nimport { content } from './initialize/content.js';\nimport { document } from './initialize/document.js';\nimport { flow } from './initialize/flow.js';\nimport { string, text } from './initialize/text.js';\nimport * as defaultConstructs from './constructs.js';\nimport { createTokenizer } from './create-tokenizer.js';\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n * Configuration (optional).\n * @returns {ParseContext}\n * Parser.\n */\nexport function parse(options) {\n const settings = options || {};\n const constructs = /** @type {FullNormalizedExtension} */\n combineExtensions([defaultConstructs, ...(settings.extensions || [])]);\n\n /** @type {ParseContext} */\n const parser = {\n constructs,\n content: create(content),\n defined: [],\n document: create(document),\n flow: create(flow),\n lazy: {},\n string: create(string),\n text: create(text)\n };\n return parser;\n\n /**\n * @param {InitialConstruct} initial\n * Construct to start with.\n * @returns {Create}\n * Create a tokenizer.\n */\n function create(initial) {\n return creator;\n /** @type {Create} */\n function creator(from) {\n return createTokenizer(parser, initial, from);\n }\n }\n}","/**\n * @import {Event} from 'micromark-util-types'\n */\n\nimport { subtokenize } from 'micromark-util-subtokenize';\n\n/**\n * @param {Array} events\n * Events.\n * @returns {Array}\n * Events.\n */\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n return events;\n}","/**\n * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'\n */\n\n/**\n * @callback Preprocessor\n * Preprocess a value.\n * @param {Value} value\n * Value.\n * @param {Encoding | null | undefined} [encoding]\n * Encoding when `value` is a typed array (optional).\n * @param {boolean | null | undefined} [end=false]\n * Whether this is the last chunk (default: `false`).\n * @returns {Array}\n * Chunks.\n */\n\nconst search = /[\\0\\t\\n\\r]/g;\n\n/**\n * @returns {Preprocessor}\n * Preprocess a value.\n */\nexport function preprocess() {\n let column = 1;\n let buffer = '';\n /** @type {boolean | undefined} */\n let start = true;\n /** @type {boolean | undefined} */\n let atCarriageReturn;\n return preprocessor;\n\n /** @type {Preprocessor} */\n // eslint-disable-next-line complexity\n function preprocessor(value, encoding, end) {\n /** @type {Array} */\n const chunks = [];\n /** @type {RegExpMatchArray | null} */\n let match;\n /** @type {number} */\n let next;\n /** @type {number} */\n let startPosition;\n /** @type {number} */\n let endPosition;\n /** @type {Code} */\n let code;\n value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));\n startPosition = 0;\n buffer = '';\n if (start) {\n // To do: `markdown-rs` actually parses BOMs (byte order mark).\n if (value.charCodeAt(0) === 65279) {\n startPosition++;\n }\n start = undefined;\n }\n while (startPosition < value.length) {\n search.lastIndex = startPosition;\n match = search.exec(value);\n endPosition = match && match.index !== undefined ? match.index : value.length;\n code = value.charCodeAt(endPosition);\n if (!match) {\n buffer = value.slice(startPosition);\n break;\n }\n if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n chunks.push(-3);\n atCarriageReturn = undefined;\n } else {\n if (atCarriageReturn) {\n chunks.push(-5);\n atCarriageReturn = undefined;\n }\n if (startPosition < endPosition) {\n chunks.push(value.slice(startPosition, endPosition));\n column += endPosition - startPosition;\n }\n switch (code) {\n case 0:\n {\n chunks.push(65533);\n column++;\n break;\n }\n case 9:\n {\n next = Math.ceil(column / 4) * 4;\n chunks.push(-2);\n while (column++ < next) chunks.push(-1);\n break;\n }\n case 10:\n {\n chunks.push(-4);\n column = 1;\n break;\n }\n default:\n {\n atCarriageReturn = true;\n column = 1;\n }\n }\n }\n startPosition = endPosition + 1;\n }\n if (end) {\n if (atCarriageReturn) chunks.push(-5);\n if (buffer) chunks.push(buffer);\n chunks.push(null);\n }\n return chunks;\n }\n}","import { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nconst characterEscapeOrReference = /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi;\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * Value to decode.\n * @returns {string}\n * Decoded value.\n */\nexport function decodeString(value) {\n return value.replace(characterEscapeOrReference, decode);\n}\n\n/**\n * @param {string} $0\n * Match.\n * @param {string} $1\n * Character escape.\n * @param {string} $2\n * Character reference.\n * @returns {string}\n * Decoded value\n */\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1;\n }\n\n // Reference.\n const head = $2.charCodeAt(0);\n if (head === 35) {\n const head = $2.charCodeAt(1);\n const hex = head === 120 || head === 88;\n return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);\n }\n return decodeNamedCharacterReference($2) || $0;\n}","/**\n * @import {\n * Break,\n * Blockquote,\n * Code,\n * Definition,\n * Emphasis,\n * Heading,\n * Html,\n * Image,\n * InlineCode,\n * Link,\n * ListItem,\n * List,\n * Nodes,\n * Paragraph,\n * PhrasingContent,\n * ReferenceType,\n * Root,\n * Strong,\n * Text,\n * ThematicBreak\n * } from 'mdast'\n * @import {\n * Encoding,\n * Event,\n * Token,\n * Value\n * } from 'micromark-util-types'\n * @import {Point} from 'unist'\n * @import {\n * CompileContext,\n * CompileData,\n * Config,\n * Extension,\n * Handle,\n * OnEnterError,\n * Options\n * } from './types.js'\n */\n\nimport { toString } from 'mdast-util-to-string';\nimport { parse, postprocess, preprocess } from 'micromark';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nimport { decodeString } from 'micromark-util-decode-string';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { stringifyPosition } from 'unist-util-stringify-position';\nconst own = {}.hasOwnProperty;\n\n/**\n * Turn markdown into a syntax tree.\n *\n * @overload\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @overload\n * @param {Value} value\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @param {Value} value\n * Markdown to parse.\n * @param {Encoding | Options | null | undefined} [encoding]\n * Character encoding for when `value` is `Buffer`.\n * @param {Options | null | undefined} [options]\n * Configuration.\n * @returns {Root}\n * mdast tree.\n */\nexport function fromMarkdown(value, encoding, options) {\n if (typeof encoding !== 'string') {\n options = encoding;\n encoding = undefined;\n }\n return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));\n}\n\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options | null | undefined} [options]\n */\nfunction compiler(options) {\n /** @type {Config} */\n const config = {\n transforms: [],\n canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],\n enter: {\n autolink: opener(link),\n autolinkProtocol: onenterdata,\n autolinkEmail: onenterdata,\n atxHeading: opener(heading),\n blockQuote: opener(blockQuote),\n characterEscape: onenterdata,\n characterReference: onenterdata,\n codeFenced: opener(codeFlow),\n codeFencedFenceInfo: buffer,\n codeFencedFenceMeta: buffer,\n codeIndented: opener(codeFlow, buffer),\n codeText: opener(codeText, buffer),\n codeTextData: onenterdata,\n data: onenterdata,\n codeFlowValue: onenterdata,\n definition: opener(definition),\n definitionDestinationString: buffer,\n definitionLabelString: buffer,\n definitionTitleString: buffer,\n emphasis: opener(emphasis),\n hardBreakEscape: opener(hardBreak),\n hardBreakTrailing: opener(hardBreak),\n htmlFlow: opener(html, buffer),\n htmlFlowData: onenterdata,\n htmlText: opener(html, buffer),\n htmlTextData: onenterdata,\n image: opener(image),\n label: buffer,\n link: opener(link),\n listItem: opener(listItem),\n listItemValue: onenterlistitemvalue,\n listOrdered: opener(list, onenterlistordered),\n listUnordered: opener(list),\n paragraph: opener(paragraph),\n reference: onenterreference,\n referenceString: buffer,\n resourceDestinationString: buffer,\n resourceTitleString: buffer,\n setextHeading: opener(heading),\n strong: opener(strong),\n thematicBreak: opener(thematicBreak)\n },\n exit: {\n atxHeading: closer(),\n atxHeadingSequence: onexitatxheadingsequence,\n autolink: closer(),\n autolinkEmail: onexitautolinkemail,\n autolinkProtocol: onexitautolinkprotocol,\n blockQuote: closer(),\n characterEscapeValue: onexitdata,\n characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n characterReferenceValue: onexitcharacterreferencevalue,\n characterReference: onexitcharacterreference,\n codeFenced: closer(onexitcodefenced),\n codeFencedFence: onexitcodefencedfence,\n codeFencedFenceInfo: onexitcodefencedfenceinfo,\n codeFencedFenceMeta: onexitcodefencedfencemeta,\n codeFlowValue: onexitdata,\n codeIndented: closer(onexitcodeindented),\n codeText: closer(onexitcodetext),\n codeTextData: onexitdata,\n data: onexitdata,\n definition: closer(),\n definitionDestinationString: onexitdefinitiondestinationstring,\n definitionLabelString: onexitdefinitionlabelstring,\n definitionTitleString: onexitdefinitiontitlestring,\n emphasis: closer(),\n hardBreakEscape: closer(onexithardbreak),\n hardBreakTrailing: closer(onexithardbreak),\n htmlFlow: closer(onexithtmlflow),\n htmlFlowData: onexitdata,\n htmlText: closer(onexithtmltext),\n htmlTextData: onexitdata,\n image: closer(onexitimage),\n label: onexitlabel,\n labelText: onexitlabeltext,\n lineEnding: onexitlineending,\n link: closer(onexitlink),\n listItem: closer(),\n listOrdered: closer(),\n listUnordered: closer(),\n paragraph: closer(),\n referenceString: onexitreferencestring,\n resourceDestinationString: onexitresourcedestinationstring,\n resourceTitleString: onexitresourcetitlestring,\n resource: onexitresource,\n setextHeading: closer(onexitsetextheading),\n setextHeadingLineSequence: onexitsetextheadinglinesequence,\n setextHeadingText: onexitsetextheadingtext,\n strong: closer(),\n thematicBreak: closer()\n }\n };\n configure(config, (options || {}).mdastExtensions || []);\n\n /** @type {CompileData} */\n const data = {};\n return compile;\n\n /**\n * Turn micromark events into an mdast tree.\n *\n * @param {Array} events\n * Events.\n * @returns {Root}\n * mdast tree.\n */\n function compile(events) {\n /** @type {Root} */\n let tree = {\n type: 'root',\n children: []\n };\n /** @type {Omit} */\n const context = {\n stack: [tree],\n tokenStack: [],\n config,\n enter,\n exit,\n buffer,\n resume,\n data\n };\n /** @type {Array} */\n const listStack = [];\n let index = -1;\n while (++index < events.length) {\n // We preprocess lists to add `listItem` tokens, and to infer whether\n // items the list itself are spread out.\n if (events[index][1].type === \"listOrdered\" || events[index][1].type === \"listUnordered\") {\n if (events[index][0] === 'enter') {\n listStack.push(index);\n } else {\n const tail = listStack.pop();\n index = prepareList(events, tail, index);\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n const handler = config[events[index][0]];\n if (own.call(handler, events[index][1].type)) {\n handler[events[index][1].type].call(Object.assign({\n sliceSerialize: events[index][2].sliceSerialize\n }, context), events[index][1]);\n }\n }\n\n // Handle tokens still being open.\n if (context.tokenStack.length > 0) {\n const tail = context.tokenStack[context.tokenStack.length - 1];\n const handler = tail[1] || defaultOnError;\n handler.call(context, undefined, tail[0]);\n }\n\n // Figure out `root` position.\n tree.position = {\n start: point(events.length > 0 ? events[0][1].start : {\n line: 1,\n column: 1,\n offset: 0\n }),\n end: point(events.length > 0 ? events[events.length - 2][1].end : {\n line: 1,\n column: 1,\n offset: 0\n })\n };\n\n // Call transforms.\n index = -1;\n while (++index < config.transforms.length) {\n tree = config.transforms[index](tree) || tree;\n }\n return tree;\n }\n\n /**\n * @param {Array} events\n * @param {number} start\n * @param {number} length\n * @returns {number}\n */\n function prepareList(events, start, length) {\n let index = start - 1;\n let containerBalance = -1;\n let listSpread = false;\n /** @type {Token | undefined} */\n let listItem;\n /** @type {number | undefined} */\n let lineIndex;\n /** @type {number | undefined} */\n let firstBlankLineIndex;\n /** @type {boolean | undefined} */\n let atMarker;\n while (++index <= length) {\n const event = events[index];\n switch (event[1].type) {\n case \"listUnordered\":\n case \"listOrdered\":\n case \"blockQuote\":\n {\n if (event[0] === 'enter') {\n containerBalance++;\n } else {\n containerBalance--;\n }\n atMarker = undefined;\n break;\n }\n case \"lineEndingBlank\":\n {\n if (event[0] === 'enter') {\n if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) {\n firstBlankLineIndex = index;\n }\n atMarker = undefined;\n }\n break;\n }\n case \"linePrefix\":\n case \"listItemValue\":\n case \"listItemMarker\":\n case \"listItemPrefix\":\n case \"listItemPrefixWhitespace\":\n {\n // Empty.\n\n break;\n }\n default:\n {\n atMarker = undefined;\n }\n }\n if (!containerBalance && event[0] === 'enter' && event[1].type === \"listItemPrefix\" || containerBalance === -1 && event[0] === 'exit' && (event[1].type === \"listUnordered\" || event[1].type === \"listOrdered\")) {\n if (listItem) {\n let tailIndex = index;\n lineIndex = undefined;\n while (tailIndex--) {\n const tailEvent = events[tailIndex];\n if (tailEvent[1].type === \"lineEnding\" || tailEvent[1].type === \"lineEndingBlank\") {\n if (tailEvent[0] === 'exit') continue;\n if (lineIndex) {\n events[lineIndex][1].type = \"lineEndingBlank\";\n listSpread = true;\n }\n tailEvent[1].type = \"lineEnding\";\n lineIndex = tailIndex;\n } else if (tailEvent[1].type === \"linePrefix\" || tailEvent[1].type === \"blockQuotePrefix\" || tailEvent[1].type === \"blockQuotePrefixWhitespace\" || tailEvent[1].type === \"blockQuoteMarker\" || tailEvent[1].type === \"listItemIndent\") {\n // Empty\n } else {\n break;\n }\n }\n if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {\n listItem._spread = true;\n }\n\n // Fix position.\n listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);\n events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);\n index++;\n length++;\n }\n\n // Create a new list item.\n if (event[1].type === \"listItemPrefix\") {\n /** @type {Token} */\n const item = {\n type: 'listItem',\n _spread: false,\n start: Object.assign({}, event[1].start),\n // @ts-expect-error: we’ll add `end` in a second.\n end: undefined\n };\n listItem = item;\n events.splice(index, 0, ['enter', item, event[2]]);\n index++;\n length++;\n firstBlankLineIndex = undefined;\n atMarker = true;\n }\n }\n }\n events[start][1]._spread = listSpread;\n return length;\n }\n\n /**\n * Create an opener handle.\n *\n * @param {(token: Token) => Nodes} create\n * Create a node.\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function opener(create, and) {\n return open;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function open(token) {\n enter.call(this, create(token), token);\n if (and) and.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['buffer']}\n */\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n });\n }\n\n /**\n * @type {CompileContext['enter']}\n */\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = parent.children;\n siblings.push(node);\n this.stack.push(node);\n this.tokenStack.push([token, errorHandler || undefined]);\n node.position = {\n start: point(token.start),\n // @ts-expect-error: `end` will be patched later.\n end: undefined\n };\n }\n\n /**\n * Create a closer handle.\n *\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function closer(and) {\n return close;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function close(token) {\n if (and) and.call(this, token);\n exit.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['exit']}\n */\n function exit(token, onExitError) {\n const node = this.stack.pop();\n const open = this.tokenStack.pop();\n if (!open) {\n throw new Error('Cannot close `' + token.type + '` (' + stringifyPosition({\n start: token.start,\n end: token.end\n }) + '): it’s not open');\n } else if (open[0].type !== token.type) {\n if (onExitError) {\n onExitError.call(this, token, open[0]);\n } else {\n const handler = open[1] || defaultOnError;\n handler.call(this, token, open[0]);\n }\n }\n node.position.end = point(token.end);\n }\n\n /**\n * @type {CompileContext['resume']}\n */\n function resume() {\n return toString(this.stack.pop());\n }\n\n //\n // Handlers.\n //\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistordered() {\n this.data.expectingFirstListItemValue = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistitemvalue(token) {\n if (this.data.expectingFirstListItemValue) {\n const ancestor = this.stack[this.stack.length - 2];\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);\n this.data.expectingFirstListItemValue = undefined;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfenceinfo() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.lang = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfencemeta() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.meta = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfence() {\n // Exit if this is the closing fence.\n if (this.data.flowCodeInside) return;\n this.buffer();\n this.data.flowCodeInside = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefenced() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '');\n this.data.flowCodeInside = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodeindented() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/(\\r?\\n|\\r)$/g, '');\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitionlabelstring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.label = label;\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiontitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiondestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitatxheadingsequence(token) {\n const node = this.stack[this.stack.length - 1];\n if (!node.depth) {\n const depth = this.sliceSerialize(token).length;\n node.depth = depth;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadingtext() {\n this.data.setextHeadingSlurpLineEnding = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadinglinesequence(token) {\n const node = this.stack[this.stack.length - 1];\n node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheading() {\n this.data.setextHeadingSlurpLineEnding = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterdata(token) {\n const node = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = node.children;\n let tail = siblings[siblings.length - 1];\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text();\n tail.position = {\n start: point(token.start),\n // @ts-expect-error: we’ll add `end` later.\n end: undefined\n };\n siblings.push(tail);\n }\n this.stack.push(tail);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitdata(token) {\n const tail = this.stack.pop();\n tail.value += this.sliceSerialize(token);\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlineending(token) {\n const context = this.stack[this.stack.length - 1];\n // If we’re at a hard break, include the line ending in there.\n if (this.data.atHardBreak) {\n const tail = context.children[context.children.length - 1];\n tail.position.end = point(token.end);\n this.data.atHardBreak = undefined;\n return;\n }\n if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {\n onenterdata.call(this, token);\n onexitdata.call(this, token);\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithardbreak() {\n this.data.atHardBreak = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmlflow() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmltext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcodetext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlink() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitimage() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabeltext(token) {\n const string = this.sliceSerialize(token);\n const ancestor = this.stack[this.stack.length - 2];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n ancestor.label = decodeString(string);\n // @ts-expect-error: same as above.\n ancestor.identifier = normalizeIdentifier(string).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabel() {\n const fragment = this.stack[this.stack.length - 1];\n const value = this.resume();\n const node = this.stack[this.stack.length - 1];\n // Assume a reference.\n this.data.inReference = true;\n if (node.type === 'link') {\n /** @type {Array} */\n const children = fragment.children;\n node.children = children;\n } else {\n node.alt = value;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcedestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcetitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresource() {\n this.data.inReference = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterreference() {\n this.data.referenceType = 'collapsed';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitreferencestring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n node.label = label;\n // @ts-expect-error: same as above.\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n this.data.referenceType = 'full';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcharacterreferencemarker(token) {\n this.data.characterReferenceType = token.type;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreferencevalue(token) {\n const data = this.sliceSerialize(token);\n const type = this.data.characterReferenceType;\n /** @type {string} */\n let value;\n if (type) {\n value = decodeNumericCharacterReference(data, type === \"characterReferenceMarkerNumeric\" ? 10 : 16);\n this.data.characterReferenceType = undefined;\n } else {\n const result = decodeNamedCharacterReference(data);\n value = result;\n }\n const tail = this.stack[this.stack.length - 1];\n tail.value += value;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreference(token) {\n const tail = this.stack.pop();\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkprotocol(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = this.sliceSerialize(token);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkemail(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = 'mailto:' + this.sliceSerialize(token);\n }\n\n //\n // Creaters.\n //\n\n /** @returns {Blockquote} */\n function blockQuote() {\n return {\n type: 'blockquote',\n children: []\n };\n }\n\n /** @returns {Code} */\n function codeFlow() {\n return {\n type: 'code',\n lang: null,\n meta: null,\n value: ''\n };\n }\n\n /** @returns {InlineCode} */\n function codeText() {\n return {\n type: 'inlineCode',\n value: ''\n };\n }\n\n /** @returns {Definition} */\n function definition() {\n return {\n type: 'definition',\n identifier: '',\n label: null,\n title: null,\n url: ''\n };\n }\n\n /** @returns {Emphasis} */\n function emphasis() {\n return {\n type: 'emphasis',\n children: []\n };\n }\n\n /** @returns {Heading} */\n function heading() {\n return {\n type: 'heading',\n // @ts-expect-error `depth` will be set later.\n depth: 0,\n children: []\n };\n }\n\n /** @returns {Break} */\n function hardBreak() {\n return {\n type: 'break'\n };\n }\n\n /** @returns {Html} */\n function html() {\n return {\n type: 'html',\n value: ''\n };\n }\n\n /** @returns {Image} */\n function image() {\n return {\n type: 'image',\n title: null,\n url: '',\n alt: null\n };\n }\n\n /** @returns {Link} */\n function link() {\n return {\n type: 'link',\n title: null,\n url: '',\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {List}\n */\n function list(token) {\n return {\n type: 'list',\n ordered: token.type === 'listOrdered',\n start: null,\n spread: token._spread,\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {ListItem}\n */\n function listItem(token) {\n return {\n type: 'listItem',\n spread: token._spread,\n checked: null,\n children: []\n };\n }\n\n /** @returns {Paragraph} */\n function paragraph() {\n return {\n type: 'paragraph',\n children: []\n };\n }\n\n /** @returns {Strong} */\n function strong() {\n return {\n type: 'strong',\n children: []\n };\n }\n\n /** @returns {Text} */\n function text() {\n return {\n type: 'text',\n value: ''\n };\n }\n\n /** @returns {ThematicBreak} */\n function thematicBreak() {\n return {\n type: 'thematicBreak'\n };\n }\n}\n\n/**\n * Copy a point-like value.\n *\n * @param {Point} d\n * Point-like value.\n * @returns {Point}\n * unist point.\n */\nfunction point(d) {\n return {\n line: d.line,\n column: d.column,\n offset: d.offset\n };\n}\n\n/**\n * @param {Config} combined\n * @param {Array | Extension>} extensions\n * @returns {undefined}\n */\nfunction configure(combined, extensions) {\n let index = -1;\n while (++index < extensions.length) {\n const value = extensions[index];\n if (Array.isArray(value)) {\n configure(combined, value);\n } else {\n extension(combined, value);\n }\n }\n}\n\n/**\n * @param {Config} combined\n * @param {Extension} extension\n * @returns {undefined}\n */\nfunction extension(combined, extension) {\n /** @type {keyof Extension} */\n let key;\n for (key in extension) {\n if (own.call(extension, key)) {\n switch (key) {\n case 'canContainEols':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'transforms':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'enter':\n case 'exit':\n {\n const right = extension[key];\n if (right) {\n Object.assign(combined[key], right);\n }\n break;\n }\n // No default\n }\n }\n }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error('Cannot close `' + left.type + '` (' + stringifyPosition({\n start: left.start,\n end: left.end\n }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is open');\n } else {\n throw new Error('Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is still open');\n }\n}","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} FromMarkdownOptions\n * @typedef {import('unified').Parser} Parser\n * @typedef {import('unified').Processor} Processor\n */\n\n/**\n * @typedef {Omit} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * Aadd support for parsing from markdown.\n *\n * @param {Readonly | null | undefined} [options]\n * Configuration (optional).\n * @returns {undefined}\n * Nothing.\n */\nexport default function remarkParse(options) {\n /** @type {Processor} */\n // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n const self = this\n\n self.parser = parser\n\n /**\n * @type {Parser}\n */\n function parser(doc) {\n return fromMarkdown(doc, {\n ...self.data('settings'),\n ...options,\n // Note: these options are not in the readme.\n // The goal is for them to be set by plugins on `data` instead of being\n // passed by users.\n extensions: self.data('micromarkExtensions') || [],\n mdastExtensions: self.data('fromMarkdownExtensions') || []\n })\n }\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Blockquote} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `blockquote` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Blockquote} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function blockquote(state, node) {\n /** @type {Element} */\n const result = {\n type: 'element',\n tagName: 'blockquote',\n properties: {},\n children: state.wrap(state.all(node), true)\n }\n state.patch(node, result)\n return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {Break} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `break` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Break} node\n * mdast node.\n * @returns {Array}\n * hast element content.\n */\nexport function hardBreak(state, node) {\n /** @type {Element} */\n const result = {type: 'element', tagName: 'br', properties: {}, children: []}\n state.patch(node, result)\n return [state.applyData(node, result), {type: 'text', value: '\\n'}]\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Code} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `code` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Code} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function code(state, node) {\n const value = node.value ? node.value + '\\n' : ''\n /** @type {Properties} */\n const properties = {}\n // Someone can write `js python ruby`.\n const language = node.lang ? node.lang.split(/\\s+/) : []\n\n // GH/CM still drop the non-first languages.\n if (language.length > 0) {\n properties.className = ['language-' + language[0]]\n }\n\n // Create ``.\n /** @type {Element} */\n let result = {\n type: 'element',\n tagName: 'code',\n properties,\n children: [{type: 'text', value}]\n }\n\n if (node.meta) {\n result.data = {meta: node.meta}\n }\n\n state.patch(node, result)\n result = state.applyData(node, result)\n\n // Create `
`.\n  result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Delete} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `delete` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Delete} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strikethrough(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'del',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Emphasis} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `emphasis` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Emphasis} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function emphasis(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'em',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {FootnoteReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `footnoteReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {FootnoteReference} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function footnoteReference(state, node) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const id = String(node.identifier).toUpperCase()\n  const safeId = normalizeUri(id.toLowerCase())\n  const index = state.footnoteOrder.indexOf(id)\n  /** @type {number} */\n  let counter\n\n  let reuseCounter = state.footnoteCounts.get(id)\n\n  if (reuseCounter === undefined) {\n    reuseCounter = 0\n    state.footnoteOrder.push(id)\n    counter = state.footnoteOrder.length\n  } else {\n    counter = index + 1\n  }\n\n  reuseCounter += 1\n  state.footnoteCounts.set(id, reuseCounter)\n\n  /** @type {Element} */\n  const link = {\n    type: 'element',\n    tagName: 'a',\n    properties: {\n      href: '#' + clobberPrefix + 'fn-' + safeId,\n      id:\n        clobberPrefix +\n        'fnref-' +\n        safeId +\n        (reuseCounter > 1 ? '-' + reuseCounter : ''),\n      dataFootnoteRef: true,\n      ariaDescribedBy: ['footnote-label']\n    },\n    children: [{type: 'text', value: String(counter)}]\n  }\n  state.patch(node, link)\n\n  /** @type {Element} */\n  const sup = {\n    type: 'element',\n    tagName: 'sup',\n    properties: {},\n    children: [link]\n  }\n  state.patch(node, sup)\n  return state.applyData(node, sup)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Heading} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `heading` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Heading} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function heading(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'h' + node.depth,\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Html} from 'mdast'\n * @import {State} from '../state.js'\n * @import {Raw} from '../../index.js'\n */\n\n/**\n * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise\n * nothing).\n *\n * @param {State} state\n *   Info passed around.\n * @param {Html} node\n *   mdast node.\n * @returns {Element | Raw | undefined}\n *   hast node.\n */\nexport function html(state, node) {\n  if (state.options.allowDangerousHtml) {\n    /** @type {Raw} */\n    const result = {type: 'raw', value: node.value}\n    state.patch(node, result)\n    return state.applyData(node, result)\n  }\n\n  return undefined\n}\n","/**\n * @import {ElementContent} from 'hast'\n * @import {Reference, Nodes} from 'mdast'\n * @import {State} from './state.js'\n */\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Extract} node\n *   Reference node (image, link).\n * @returns {Array}\n *   hast content.\n */\nexport function revert(state, node) {\n  const subtype = node.referenceType\n  let suffix = ']'\n\n  if (subtype === 'collapsed') {\n    suffix += '[]'\n  } else if (subtype === 'full') {\n    suffix += '[' + (node.label || node.identifier) + ']'\n  }\n\n  if (node.type === 'imageReference') {\n    return [{type: 'text', value: '![' + node.alt + suffix}]\n  }\n\n  const contents = state.all(node)\n  const head = contents[0]\n\n  if (head && head.type === 'text') {\n    head.value = '[' + head.value\n  } else {\n    contents.unshift({type: 'text', value: '['})\n  }\n\n  const tail = contents[contents.length - 1]\n\n  if (tail && tail.type === 'text') {\n    tail.value += suffix\n  } else {\n    contents.push({type: 'text', value: suffix})\n  }\n\n  return contents\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ImageReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `imageReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ImageReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function imageReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(definition.url || ''), alt: node.alt}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Image} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `image` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Image} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function image(state, node) {\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(node.url)}\n\n  if (node.alt !== null && node.alt !== undefined) {\n    properties.alt = node.alt\n  }\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {InlineCode} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `inlineCode` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {InlineCode} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function inlineCode(state, node) {\n  /** @type {Text} */\n  const text = {type: 'text', value: node.value.replace(/\\r?\\n|\\r/g, ' ')}\n  state.patch(node, text)\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'code',\n    properties: {},\n    children: [text]\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {LinkReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `linkReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {LinkReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function linkReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(definition.url || '')}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Link} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `link` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Link} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function link(state, node) {\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(node.url)}\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ListItem, Parents} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `listItem` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ListItem} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function listItem(state, node, parent) {\n  const results = state.all(node)\n  const loose = parent ? listLoose(parent) : listItemLoose(node)\n  /** @type {Properties} */\n  const properties = {}\n  /** @type {Array} */\n  const children = []\n\n  if (typeof node.checked === 'boolean') {\n    const head = results[0]\n    /** @type {Element} */\n    let paragraph\n\n    if (head && head.type === 'element' && head.tagName === 'p') {\n      paragraph = head\n    } else {\n      paragraph = {type: 'element', tagName: 'p', properties: {}, children: []}\n      results.unshift(paragraph)\n    }\n\n    if (paragraph.children.length > 0) {\n      paragraph.children.unshift({type: 'text', value: ' '})\n    }\n\n    paragraph.children.unshift({\n      type: 'element',\n      tagName: 'input',\n      properties: {type: 'checkbox', checked: node.checked, disabled: true},\n      children: []\n    })\n\n    // According to github-markdown-css, this class hides bullet.\n    // See: .\n    properties.className = ['task-list-item']\n  }\n\n  let index = -1\n\n  while (++index < results.length) {\n    const child = results[index]\n\n    // Add eols before nodes, except if this is a loose, first paragraph.\n    if (\n      loose ||\n      index !== 0 ||\n      child.type !== 'element' ||\n      child.tagName !== 'p'\n    ) {\n      children.push({type: 'text', value: '\\n'})\n    }\n\n    if (child.type === 'element' && child.tagName === 'p' && !loose) {\n      children.push(...child.children)\n    } else {\n      children.push(child)\n    }\n  }\n\n  const tail = results[results.length - 1]\n\n  // Add a final eol.\n  if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {\n    children.push({type: 'text', value: '\\n'})\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'li', properties, children}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n\n/**\n * @param {Parents} node\n * @return {Boolean}\n */\nfunction listLoose(node) {\n  let loose = false\n  if (node.type === 'list') {\n    loose = node.spread || false\n    const children = node.children\n    let index = -1\n\n    while (!loose && ++index < children.length) {\n      loose = listItemLoose(children[index])\n    }\n  }\n\n  return loose\n}\n\n/**\n * @param {ListItem} node\n * @return {Boolean}\n */\nfunction listItemLoose(node) {\n  const spread = node.spread\n\n  return spread === null || spread === undefined\n    ? node.children.length > 1\n    : spread\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {List} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `list` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {List} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function list(state, node) {\n  /** @type {Properties} */\n  const properties = {}\n  const results = state.all(node)\n  let index = -1\n\n  if (typeof node.start === 'number' && node.start !== 1) {\n    properties.start = node.start\n  }\n\n  // Like GitHub, add a class for custom styling.\n  while (++index < results.length) {\n    const child = results[index]\n\n    if (\n      child.type === 'element' &&\n      child.tagName === 'li' &&\n      child.properties &&\n      Array.isArray(child.properties.className) &&\n      child.properties.className.includes('task-list-item')\n    ) {\n      properties.className = ['contains-task-list']\n      break\n    }\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: node.ordered ? 'ol' : 'ul',\n    properties,\n    children: state.wrap(results, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Paragraph} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `paragraph` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Paragraph} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function paragraph(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'p',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Parents as HastParents, Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `root` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastRoot} node\n *   mdast node.\n * @returns {HastParents}\n *   hast node.\n */\nexport function root(state, node) {\n  /** @type {HastRoot} */\n  const result = {type: 'root', children: state.wrap(state.all(node))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Strong} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `strong` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Strong} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strong(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'strong',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Table} from 'mdast'\n * @import {Element} from 'hast'\n * @import {State} from '../state.js'\n */\n\nimport {pointEnd, pointStart} from 'unist-util-position'\n\n/**\n * Turn an mdast `table` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Table} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function table(state, node) {\n  const rows = state.all(node)\n  const firstRow = rows.shift()\n  /** @type {Array} */\n  const tableContent = []\n\n  if (firstRow) {\n    /** @type {Element} */\n    const head = {\n      type: 'element',\n      tagName: 'thead',\n      properties: {},\n      children: state.wrap([firstRow], true)\n    }\n    state.patch(node.children[0], head)\n    tableContent.push(head)\n  }\n\n  if (rows.length > 0) {\n    /** @type {Element} */\n    const body = {\n      type: 'element',\n      tagName: 'tbody',\n      properties: {},\n      children: state.wrap(rows, true)\n    }\n\n    const start = pointStart(node.children[1])\n    const end = pointEnd(node.children[node.children.length - 1])\n    if (start && end) body.position = {start, end}\n    tableContent.push(body)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'table',\n    properties: {},\n    children: state.wrap(tableContent, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, ElementContent, Properties} from 'hast'\n * @import {Parents, TableRow} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableRow` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableRow} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function tableRow(state, node, parent) {\n  const siblings = parent ? parent.children : undefined\n  // Generate a body row when without parent.\n  const rowIndex = siblings ? siblings.indexOf(node) : 1\n  const tagName = rowIndex === 0 ? 'th' : 'td'\n  // To do: option to use `style`?\n  const align = parent && parent.type === 'table' ? parent.align : undefined\n  const length = align ? align.length : node.children.length\n  let cellIndex = -1\n  /** @type {Array} */\n  const cells = []\n\n  while (++cellIndex < length) {\n    // Note: can also be undefined.\n    const cell = node.children[cellIndex]\n    /** @type {Properties} */\n    const properties = {}\n    const alignValue = align ? align[cellIndex] : undefined\n\n    if (alignValue) {\n      properties.align = alignValue\n    }\n\n    /** @type {Element} */\n    let result = {type: 'element', tagName, properties, children: []}\n\n    if (cell) {\n      result.children = state.all(cell)\n      state.patch(cell, result)\n      result = state.applyData(cell, result)\n    }\n\n    cells.push(result)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'tr',\n    properties: {},\n    children: state.wrap(cells, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {TableCell} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableCell` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableCell} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function tableCell(state, node) {\n  // Note: this function is normally not called: see `table-row` for how rows\n  // and their cells are compiled.\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'td', // Assume body cell.\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n *   Value to trim.\n * @returns {string}\n *   Trimmed value.\n */\nexport function trimLines(value) {\n  const source = String(value)\n  const search = /\\r?\\n|\\r/g\n  let match = search.exec(source)\n  let last = 0\n  /** @type {Array} */\n  const lines = []\n\n  while (match) {\n    lines.push(\n      trimLine(source.slice(last, match.index), last > 0, true),\n      match[0]\n    )\n\n    last = match.index + match[0].length\n    match = search.exec(source)\n  }\n\n  lines.push(trimLine(source.slice(last), last > 0, false))\n\n  return lines.join('')\n}\n\n/**\n * @param {string} value\n *   Line to trim.\n * @param {boolean} start\n *   Whether to trim the start of the line.\n * @param {boolean} end\n *   Whether to trim the end of the line.\n * @returns {string}\n *   Trimmed line.\n */\nfunction trimLine(value, start, end) {\n  let startIndex = 0\n  let endIndex = value.length\n\n  if (start) {\n    let code = value.codePointAt(startIndex)\n\n    while (code === tab || code === space) {\n      startIndex++\n      code = value.codePointAt(startIndex)\n    }\n  }\n\n  if (end) {\n    let code = value.codePointAt(endIndex - 1)\n\n    while (code === tab || code === space) {\n      endIndex--\n      code = value.codePointAt(endIndex - 1)\n    }\n  }\n\n  return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n","/**\n * @import {Element as HastElement, Text as HastText} from 'hast'\n * @import {Text as MdastText} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {trimLines} from 'trim-lines'\n\n/**\n * Turn an mdast `text` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastText} node\n *   mdast node.\n * @returns {HastElement | HastText}\n *   hast node.\n */\nexport function text(state, node) {\n  /** @type {HastText} */\n  const result = {type: 'text', value: trimLines(String(node.value))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {ThematicBreak} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `thematicBreak` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ThematicBreak} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function thematicBreak(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'hr',\n    properties: {},\n    children: []\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Handlers} from '../state.js'\n */\n\nimport {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {strikethrough} from './delete.js'\nimport {emphasis} from './emphasis.js'\nimport {footnoteReference} from './footnote-reference.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {imageReference} from './image-reference.js'\nimport {image} from './image.js'\nimport {inlineCode} from './inline-code.js'\nimport {linkReference} from './link-reference.js'\nimport {link} from './link.js'\nimport {listItem} from './list-item.js'\nimport {list} from './list.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {table} from './table.js'\nimport {tableRow} from './table-row.js'\nimport {tableCell} from './table-cell.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default handlers for nodes.\n *\n * @satisfies {Handlers}\n */\nexport const handlers = {\n  blockquote,\n  break: hardBreak,\n  code,\n  delete: strikethrough,\n  emphasis,\n  footnoteReference,\n  heading,\n  html,\n  imageReference,\n  image,\n  inlineCode,\n  linkReference,\n  link,\n  listItem,\n  list,\n  paragraph,\n  // @ts-expect-error: root is different, but hard to type.\n  root,\n  strong,\n  table,\n  tableCell,\n  tableRow,\n  text,\n  thematicBreak,\n  toml: ignore,\n  yaml: ignore,\n  definition: ignore,\n  footnoteDefinition: ignore\n}\n\n// Return nothing for nodes that are ignored.\nfunction ignore() {\n  return undefined\n}\n","/**\n * @import {ElementContent, Element} from 'hast'\n * @import {State} from './state.js'\n */\n\n/**\n * @callback FootnoteBackContentTemplate\n *   Generate content for the backreference dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array | ElementContent | string}\n *   Content for the backreference when linking back from definitions to their\n *   reference.\n *\n * @callback FootnoteBackLabelTemplate\n *   Generate a back label dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Back label to use when linking back from definitions to their reference.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Generate the default content that GitHub uses on backreferences.\n *\n * @param {number} _\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array}\n *   Content.\n */\nexport function defaultFootnoteBackContent(_, rereferenceIndex) {\n  /** @type {Array} */\n  const result = [{type: 'text', value: '↩'}]\n\n  if (rereferenceIndex > 1) {\n    result.push({\n      type: 'element',\n      tagName: 'sup',\n      properties: {},\n      children: [{type: 'text', value: String(rereferenceIndex)}]\n    })\n  }\n\n  return result\n}\n\n/**\n * Generate the default label that GitHub uses on backreferences.\n *\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Label.\n */\nexport function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n  return (\n    'Back to reference ' +\n    (referenceIndex + 1) +\n    (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n  )\n}\n\n/**\n * Generate a hast footer for called footnote definitions.\n *\n * @param {State} state\n *   Info passed around.\n * @returns {Element | undefined}\n *   `section` element or `undefined`.\n */\n// eslint-disable-next-line complexity\nexport function footer(state) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const footnoteBackContent =\n    state.options.footnoteBackContent || defaultFootnoteBackContent\n  const footnoteBackLabel =\n    state.options.footnoteBackLabel || defaultFootnoteBackLabel\n  const footnoteLabel = state.options.footnoteLabel || 'Footnotes'\n  const footnoteLabelTagName = state.options.footnoteLabelTagName || 'h2'\n  const footnoteLabelProperties = state.options.footnoteLabelProperties || {\n    className: ['sr-only']\n  }\n  /** @type {Array} */\n  const listItems = []\n  let referenceIndex = -1\n\n  while (++referenceIndex < state.footnoteOrder.length) {\n    const definition = state.footnoteById.get(\n      state.footnoteOrder[referenceIndex]\n    )\n\n    if (!definition) {\n      continue\n    }\n\n    const content = state.all(definition)\n    const id = String(definition.identifier).toUpperCase()\n    const safeId = normalizeUri(id.toLowerCase())\n    let rereferenceIndex = 0\n    /** @type {Array} */\n    const backReferences = []\n    const counts = state.footnoteCounts.get(id)\n\n    // eslint-disable-next-line no-unmodified-loop-condition\n    while (counts !== undefined && ++rereferenceIndex <= counts) {\n      if (backReferences.length > 0) {\n        backReferences.push({type: 'text', value: ' '})\n      }\n\n      let children =\n        typeof footnoteBackContent === 'string'\n          ? footnoteBackContent\n          : footnoteBackContent(referenceIndex, rereferenceIndex)\n\n      if (typeof children === 'string') {\n        children = {type: 'text', value: children}\n      }\n\n      backReferences.push({\n        type: 'element',\n        tagName: 'a',\n        properties: {\n          href:\n            '#' +\n            clobberPrefix +\n            'fnref-' +\n            safeId +\n            (rereferenceIndex > 1 ? '-' + rereferenceIndex : ''),\n          dataFootnoteBackref: '',\n          ariaLabel:\n            typeof footnoteBackLabel === 'string'\n              ? footnoteBackLabel\n              : footnoteBackLabel(referenceIndex, rereferenceIndex),\n          className: ['data-footnote-backref']\n        },\n        children: Array.isArray(children) ? children : [children]\n      })\n    }\n\n    const tail = content[content.length - 1]\n\n    if (tail && tail.type === 'element' && tail.tagName === 'p') {\n      const tailTail = tail.children[tail.children.length - 1]\n      if (tailTail && tailTail.type === 'text') {\n        tailTail.value += ' '\n      } else {\n        tail.children.push({type: 'text', value: ' '})\n      }\n\n      tail.children.push(...backReferences)\n    } else {\n      content.push(...backReferences)\n    }\n\n    /** @type {Element} */\n    const listItem = {\n      type: 'element',\n      tagName: 'li',\n      properties: {id: clobberPrefix + 'fn-' + safeId},\n      children: state.wrap(content, true)\n    }\n\n    state.patch(definition, listItem)\n\n    listItems.push(listItem)\n  }\n\n  if (listItems.length === 0) {\n    return\n  }\n\n  return {\n    type: 'element',\n    tagName: 'section',\n    properties: {dataFootnotes: true, className: ['footnotes']},\n    children: [\n      {\n        type: 'element',\n        tagName: footnoteLabelTagName,\n        properties: {\n          ...structuredClone(footnoteLabelProperties),\n          id: 'footnote-label'\n        },\n        children: [{type: 'text', value: footnoteLabel}]\n      },\n      {type: 'text', value: '\\n'},\n      {\n        type: 'element',\n        tagName: 'ol',\n        properties: {},\n        children: state.wrap(listItems, true)\n      },\n      {type: 'text', value: '\\n'}\n    ]\n  }\n}\n","/**\n * @import {\n *   ElementContent as HastElementContent,\n *   Element as HastElement,\n *   Nodes as HastNodes,\n *   Properties as HastProperties,\n *   RootContent as HastRootContent,\n *   Text as HastText\n * } from 'hast'\n * @import {\n *   Definition as MdastDefinition,\n *   FootnoteDefinition as MdastFootnoteDefinition,\n *   Nodes as MdastNodes,\n *   Parents as MdastParents\n * } from 'mdast'\n * @import {VFile} from 'vfile'\n * @import {\n *   FootnoteBackContentTemplate,\n *   FootnoteBackLabelTemplate\n * } from './footer.js'\n */\n\n/**\n * @callback Handler\n *   Handle a node.\n * @param {State} state\n *   Info passed around.\n * @param {any} node\n *   mdast node to handle.\n * @param {MdastParents | undefined} parent\n *   Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n *   hast node.\n *\n * @typedef {Partial>} Handlers\n *   Handle nodes.\n *\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n *   Whether to persist raw HTML in markdown in the hast tree (default:\n *   `false`).\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n *   Prefix to use before the `id` property on footnotes to prevent them from\n *   *clobbering* (default: `'user-content-'`).\n *\n *   Pass `''` for trusted markdown and when you are careful with\n *   polyfilling.\n *   You could pass a different prefix.\n *\n *   DOM clobbering is this:\n *\n *   ```html\n *   

\n * \n * ```\n *\n * The above example shows that elements are made available by browsers, by\n * their ID, on the `window` object.\n * This is a security risk because you might be expecting some other variable\n * at that place.\n * It can also break polyfills.\n * Using a prefix solves these problems.\n * @property {VFile | null | undefined} [file]\n * Corresponding virtual file representing the input document (optional).\n * @property {FootnoteBackContentTemplate | string | null | undefined} [footnoteBackContent]\n * Content of the backreference back to references (default: `defaultFootnoteBackContent`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackContent(_, rereferenceIndex) {\n * const result = [{type: 'text', value: '↩'}]\n *\n * if (rereferenceIndex > 1) {\n * result.push({\n * type: 'element',\n * tagName: 'sup',\n * properties: {},\n * children: [{type: 'text', value: String(rereferenceIndex)}]\n * })\n * }\n *\n * return result\n * }\n * ```\n *\n * This content is used in the `a` element of each backreference (the `↩`\n * links).\n * @property {FootnoteBackLabelTemplate | string | null | undefined} [footnoteBackLabel]\n * Label to describe the backreference back to references (default:\n * `defaultFootnoteBackLabel`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n * return (\n * 'Back to reference ' +\n * (referenceIndex + 1) +\n * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n * )\n * }\n * ```\n *\n * Change it when the markdown is not in English.\n *\n * This label is used in the `ariaLabel` property on each backreference\n * (the `↩` links).\n * It affects users of assistive technology.\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n * Textual label to use for the footnotes section (default: `'Footnotes'`).\n *\n * Change it when the markdown is not in English.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n * Properties to use on the footnote label (default: `{className:\n * ['sr-only']}`).\n *\n * Change it to show the label and add other properties.\n *\n * This label is typically hidden visually (assuming an `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass an empty string.\n * You can also add different properties.\n *\n * > **Note**: `id: 'footnote-label'` is always added, because footnote\n * > calls use it with `aria-describedby` to provide an accessible label.\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n * HTML tag name to use for the footnote label element (default: `'h2'`).\n *\n * Change it to match your document structure.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {Handlers | null | undefined} [handlers]\n * Extra handlers for nodes (optional).\n * @property {Array | null | undefined} [passThrough]\n * List of custom mdast node types to pass through (keep) in hast (note that\n * the node itself is passed, but eventual children are transformed)\n * (optional).\n * @property {Handler | null | undefined} [unknownHandler]\n * Handler for all unknown nodes (optional).\n *\n * @typedef State\n * Info passed around.\n * @property {(node: MdastNodes) => Array} all\n * Transform the children of an mdast parent to hast.\n * @property {(from: MdastNodes, to: Type) => HastElement | Type} applyData\n * Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {Map} definitionById\n * Definitions by their identifier.\n * @property {Map} footnoteById\n * Footnote definitions by their identifier.\n * @property {Map} footnoteCounts\n * Counts for how often the same footnote was called.\n * @property {Array} footnoteOrder\n * Identifiers of order when footnote calls first appear in tree order.\n * @property {Handlers} handlers\n * Applied handlers.\n * @property {(node: MdastNodes, parent: MdastParents | undefined) => Array | HastElementContent | undefined} one\n * Transform an mdast node to hast.\n * @property {Options} options\n * Configuration.\n * @property {(from: MdastNodes, node: HastNodes) => undefined} patch\n * Copy a node’s positional info.\n * @property {(nodes: Array, loose?: boolean | undefined) => Array} wrap\n * Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {visit} from 'unist-util-visit'\nimport {position} from 'unist-util-position'\nimport {handlers as defaultHandlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Create `state` from an mdast tree.\n *\n * @param {MdastNodes} tree\n * mdast node to transform.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {State}\n * `state` function.\n */\nexport function createState(tree, options) {\n const settings = options || emptyOptions\n /** @type {Map} */\n const definitionById = new Map()\n /** @type {Map} */\n const footnoteById = new Map()\n /** @type {Map} */\n const footnoteCounts = new Map()\n /** @type {Handlers} */\n // @ts-expect-error: the root handler returns a root.\n // Hard to type.\n const handlers = {...defaultHandlers, ...settings.handlers}\n\n /** @type {State} */\n const state = {\n all,\n applyData,\n definitionById,\n footnoteById,\n footnoteCounts,\n footnoteOrder: [],\n handlers,\n one,\n options: settings,\n patch,\n wrap\n }\n\n visit(tree, function (node) {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n const map = node.type === 'definition' ? definitionById : footnoteById\n const id = String(node.identifier).toUpperCase()\n\n // Mimick CM behavior of link definitions.\n // See: .\n if (!map.has(id)) {\n // @ts-expect-error: node type matches map.\n map.set(id, node)\n }\n }\n })\n\n return state\n\n /**\n * Transform an mdast node into a hast node.\n *\n * @param {MdastNodes} node\n * mdast node.\n * @param {MdastParents | undefined} [parent]\n * Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n * Resulting hast node.\n */\n function one(node, parent) {\n const type = node.type\n const handle = state.handlers[type]\n\n if (own.call(state.handlers, type) && handle) {\n return handle(state, node, parent)\n }\n\n if (state.options.passThrough && state.options.passThrough.includes(type)) {\n if ('children' in node) {\n const {children, ...shallow} = node\n const result = structuredClone(shallow)\n // @ts-expect-error: TS doesn’t understand…\n result.children = state.all(node)\n // @ts-expect-error: TS doesn’t understand…\n return result\n }\n\n // @ts-expect-error: it’s custom.\n return structuredClone(node)\n }\n\n const unknown = state.options.unknownHandler || defaultUnknownHandler\n\n return unknown(state, node, parent)\n }\n\n /**\n * Transform the children of an mdast node into hast nodes.\n *\n * @param {MdastNodes} parent\n * mdast node to compile\n * @returns {Array}\n * Resulting hast nodes.\n */\n function all(parent) {\n /** @type {Array} */\n const values = []\n\n if ('children' in parent) {\n const nodes = parent.children\n let index = -1\n while (++index < nodes.length) {\n const result = state.one(nodes[index], parent)\n\n // To do: see if we van clean this? Can we merge texts?\n if (result) {\n if (index && nodes[index - 1].type === 'break') {\n if (!Array.isArray(result) && result.type === 'text') {\n result.value = trimMarkdownSpaceStart(result.value)\n }\n\n if (!Array.isArray(result) && result.type === 'element') {\n const head = result.children[0]\n\n if (head && head.type === 'text') {\n head.value = trimMarkdownSpaceStart(head.value)\n }\n }\n }\n\n if (Array.isArray(result)) {\n values.push(...result)\n } else {\n values.push(result)\n }\n }\n }\n }\n\n return values\n }\n}\n\n/**\n * Copy a node’s positional info.\n *\n * @param {MdastNodes} from\n * mdast node to copy from.\n * @param {HastNodes} to\n * hast node to copy into.\n * @returns {undefined}\n * Nothing.\n */\nfunction patch(from, to) {\n if (from.position) to.position = position(from)\n}\n\n/**\n * Honor the `data` of `from` and maybe generate an element instead of `to`.\n *\n * @template {HastNodes} Type\n * Node type.\n * @param {MdastNodes} from\n * mdast node to use data from.\n * @param {Type} to\n * hast node to change.\n * @returns {HastElement | Type}\n * Nothing.\n */\nfunction applyData(from, to) {\n /** @type {HastElement | Type} */\n let result = to\n\n // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n if (from && from.data) {\n const hName = from.data.hName\n const hChildren = from.data.hChildren\n const hProperties = from.data.hProperties\n\n if (typeof hName === 'string') {\n // Transforming the node resulted in an element with a different name\n // than wanted:\n if (result.type === 'element') {\n result.tagName = hName\n }\n // Transforming the node resulted in a non-element, which happens for\n // raw, text, and root nodes (unless custom handlers are passed).\n // The intent of `hName` is to create an element, but likely also to keep\n // the content around (otherwise: pass `hChildren`).\n else {\n /** @type {Array} */\n // @ts-expect-error: assume no doctypes in `root`.\n const children = 'children' in result ? result.children : [result]\n result = {type: 'element', tagName: hName, properties: {}, children}\n }\n }\n\n if (result.type === 'element' && hProperties) {\n Object.assign(result.properties, structuredClone(hProperties))\n }\n\n if (\n 'children' in result &&\n result.children &&\n hChildren !== null &&\n hChildren !== undefined\n ) {\n result.children = hChildren\n }\n }\n\n return result\n}\n\n/**\n * Transform an unknown node.\n *\n * @param {State} state\n * Info passed around.\n * @param {MdastNodes} node\n * Unknown mdast node.\n * @returns {HastElement | HastText}\n * Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n const data = node.data || {}\n /** @type {HastElement | HastText} */\n const result =\n 'value' in node &&\n !(own.call(data, 'hProperties') || own.call(data, 'hChildren'))\n ? {type: 'text', value: node.value}\n : {\n type: 'element',\n tagName: 'div',\n properties: {},\n children: state.all(node)\n }\n\n state.patch(node, result)\n return state.applyData(node, result)\n}\n\n/**\n * Wrap `nodes` with line endings between each node.\n *\n * @template {HastRootContent} Type\n * Node type.\n * @param {Array} nodes\n * List of nodes to wrap.\n * @param {boolean | undefined} [loose=false]\n * Whether to add line endings at start and end (default: `false`).\n * @returns {Array}\n * Wrapped nodes.\n */\nexport function wrap(nodes, loose) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n if (loose) {\n result.push({type: 'text', value: '\\n'})\n }\n\n while (++index < nodes.length) {\n if (index) result.push({type: 'text', value: '\\n'})\n result.push(nodes[index])\n }\n\n if (loose && nodes.length > 0) {\n result.push({type: 'text', value: '\\n'})\n }\n\n return result\n}\n\n/**\n * Trim spaces and tabs at the start of `value`.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Result.\n */\nfunction trimMarkdownSpaceStart(value) {\n let index = 0\n let code = value.charCodeAt(index)\n\n while (code === 9 || code === 32) {\n index++\n code = value.charCodeAt(index)\n }\n\n return value.slice(index)\n}\n","/**\n * @import {Nodes as HastNodes} from 'hast'\n * @import {Nodes as MdastNodes} from 'mdast'\n * @import {Options} from './state.js'\n */\n\nimport {ok as assert} from 'devlop'\nimport {footer} from './footer.js'\nimport {createState} from './state.js'\n\n/**\n * Transform mdast to hast.\n *\n * ##### Notes\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most utilities ignore `raw` nodes but two notable ones don’t:\n *\n * * `hast-util-to-html` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful\n * if you completely trust authors\n * * `hast-util-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc).\n * This is a heavy task as it needs a full HTML parser, but it is the only\n * way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark, which we follow by default.\n * They are supported by GitHub, so footnotes can be enabled in markdown with\n * `mdast-util-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes, which is hidden for sighted users but shown to\n * assistive technology.\n * When your page is not in English, you must define translated values.\n *\n * Back references use ARIA attributes, but the section label itself uses a\n * heading that is hidden with an `sr-only` class.\n * To show it to sighted users, define different attributes in\n * `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem, as it links footnote calls to footnote\n * definitions on the page through `id` attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * Example: headings (DOM clobbering) in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value` (and doesn’t have `data.hName`,\n * `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n * node\n * * otherwise, create a `
` element (which could be changed with\n * `data.hName`), with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @param {MdastNodes} tree\n * mdast tree.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {HastNodes}\n * hast tree.\n */\nexport function toHast(tree, options) {\n const state = createState(tree, options)\n const node = state.one(tree, undefined)\n const foot = footer(state)\n /** @type {HastNodes} */\n const result = Array.isArray(node)\n ? {type: 'root', children: node}\n : node || {type: 'root', children: []}\n\n if (foot) {\n // If there’s a footer, there were definitions, meaning block\n // content.\n // So `result` is a parent node.\n assert('children' in result)\n result.children.push({type: 'text', value: '\\n'}, foot)\n }\n\n return result\n}\n","/**\n * @import {Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {Options as ToHastOptions} from 'mdast-util-to-hast'\n * @import {Processor} from 'unified'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @typedef {Omit} Options\n *\n * @callback TransformBridge\n * Bridge-mode.\n *\n * Runs the destination with the new hast tree.\n * Discards result.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {Promise}\n * Nothing.\n *\n * @callback TransformMutate\n * Mutate-mode.\n *\n * Further transformers run on the hast tree.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {HastRoot}\n * Tree (hast).\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n/**\n * Turn markdown into HTML.\n *\n * ##### Notes\n *\n * ###### Signature\n *\n * * if a processor is given,\n * runs the (rehype) plugins used on it with a hast tree,\n * then discards the result (*bridge mode*)\n * * otherwise,\n * returns a hast tree,\n * the plugins used after `remarkRehype` are rehype plugins (*mutate mode*)\n *\n * > 👉 **Note**:\n * > It’s highly unlikely that you want to pass a `processor`.\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most plugins ignore `raw` nodes but two notable ones don’t:\n *\n * * `rehype-stringify` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful if\n * you completely trust authors\n * * `rehype-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc);\n * this is a heavy task as it needs a full HTML parser,\n * but it is the only way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark,\n * which we follow by default.\n * They are supported by GitHub,\n * so footnotes can be enabled in markdown with `remark-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes,\n * which is hidden for sighted users but shown to assistive technology.\n * When your page is not in English,\n * you must define translated values.\n *\n * Back references use ARIA attributes,\n * but the section label itself uses a heading that is hidden with an\n * `sr-only` class.\n * To show it to sighted users,\n * define different attributes in `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem,\n * as it links footnote calls to footnote definitions on the page through `id`\n * attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * *Example: headings (DOM clobbering)* in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value`\n * (and doesn’t have `data.hName`, `data.hProperties`, or `data.hChildren`,\n * see later),\n * create a hast `text` node\n * * otherwise,\n * create a `
` element (which could be changed with `data.hName`),\n * with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @overload\n * @param {Processor} processor\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge}\n *\n * @overload\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformMutate}\n *\n * @overload\n * @param {Readonly | Processor | null | undefined} [destination]\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge | TransformMutate}\n *\n * @param {Readonly | Processor | null | undefined} [destination]\n * Processor or configuration (optional).\n * @param {Readonly | null | undefined} [options]\n * When a processor was given,\n * configuration (optional).\n * @returns {TransformBridge | TransformMutate}\n * Transform.\n */\nexport default function remarkRehype(destination, options) {\n if (destination && 'run' in destination) {\n /**\n * @type {TransformBridge}\n */\n return async function (tree, file) {\n // Cast because root in -> root out.\n const hastTree = /** @type {HastRoot} */ (\n toHast(tree, {file, ...options})\n )\n await destination.run(hastTree, file)\n }\n }\n\n /**\n * @type {TransformMutate}\n */\n return function (tree, file) {\n // Cast because root in -> root out.\n // To do: in the future, disallow ` || options` fallback.\n // With `unified-engine`, `destination` can be `undefined` but\n // `options` will be the file set.\n // We should not pass that as `options`.\n return /** @type {HastRoot} */ (\n toHast(tree, {file, ...(destination || options)})\n )\n }\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n */\n\nimport {visit} from 'unist-util-visit'\n\n/**\n * Remove empty paragraphs in `tree`.\n *\n * @param {Nodes} tree\n * Tree to change.\n * @returns {undefined}\n * Nothing.\n */\nexport function squeezeParagraphs(tree) {\n visit(tree, function (node, index, parent) {\n if (\n index !== undefined &&\n parent &&\n node.type === 'paragraph' &&\n node.children.every(function (child) {\n return child.type === 'text' && /^\\s*$/.test(child.value)\n })\n ) {\n parent.children.splice(index, 1)\n return index\n }\n })\n}\n","/**\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: MIT\n */\n\n/**\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n * @typedef {import('mdast').Root} Root\n */\n\nimport {squeezeParagraphs} from 'mdast-squeeze-paragraphs'\nimport {visit} from 'unist-util-visit'\n\n/**\n * Only keep links with the given protocols.\n *\n * @param {object} options Options\n * @param {string[]} options.except - Protocols to exclude. Defauls to `['http', 'https']`.\n * @returns\n * Transform.\n */\nexport default function remarkUnlinkProtocols(\n options = {except: ['http', 'https']}\n) {\n /**\n * Transform.\n *\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n return function (tree) {\n /** @type {Map} */\n const definitions = new Map()\n\n // Find definitions to look up linkReferences.\n visit(tree, 'definition', function (node, index, parent) {\n definitions.set(node.identifier, node.url)\n if (parent && typeof index === 'number') {\n const url = node.url\n if (\n url &&\n url.includes(':') &&\n !options.except.some((proto) => url.startsWith(`${proto}:`))\n ) {\n parent.children.splice(index, 1)\n return index\n }\n }\n })\n\n visit(tree, function (node, index, parent) {\n if (\n parent &&\n typeof index === 'number' &&\n (node.type === 'link' || node.type === 'linkReference')\n ) {\n const url =\n node.type === 'link' ? node.url : definitions.get(node.identifier)\n if (\n url &&\n url.includes(':') &&\n !options.except.some((proto) => url.startsWith(`${proto}:`))\n ) {\n parent.children.splice(index, 1, ...node.children)\n return index\n }\n }\n })\n\n squeezeParagraphs(tree)\n }\n}\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n","'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array) => void} Callback\n * Callback.\n *\n * @typedef {(...input: Array) => any} Middleware\n * Ware.\n *\n * @typedef Pipeline\n * Pipeline.\n * @property {Run} run\n * Run the pipeline.\n * @property {Use} use\n * Add middleware.\n *\n * @typedef {(...input: Array) => void} Run\n * Call all middleware.\n *\n * Calls `done` on completion with either an error or the output of the\n * last middleware.\n *\n * > 👉 **Note**: as the length of input defines whether async functions get a\n * > `next` function,\n * > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n * Pipeline.\n */\nexport function trough() {\n /** @type {Array} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error | null | undefined} error\n * @param {Array} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n * returns a promise that is rejected,\n * or calls the given `done` function with an error,\n * `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n * that value is the main output value\n * * if `middleware` calls `done`,\n * all non-nullish values except for the first one (the error) overwrite the\n * output values\n *\n * @param {Middleware} middleware\n * Function to wrap.\n * @param {Callback} callback\n * Callback called with the output of `middleware`.\n * @returns {Run}\n * Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result && result.then && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n *\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","// A derivative work based on:\n// .\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// .\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const minpath = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * Get the basename from a path.\n *\n * @param {string} path\n * File path.\n * @param {string | null | undefined} [extname]\n * Extension to strip.\n * @returns {string}\n * Stem or basename.\n */\nfunction basename(path, extname) {\n if (extname !== undefined && typeof extname !== 'string') {\n throw new TypeError('\"ext\" argument must be a string')\n }\n\n assertPath(path)\n let start = 0\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let seenNonSlash\n\n if (\n extname === undefined ||\n extname.length === 0 ||\n extname.length > path.length\n ) {\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // path component.\n seenNonSlash = true\n end = index + 1\n }\n }\n\n return end < 0 ? '' : path.slice(start, end)\n }\n\n if (extname === path) {\n return ''\n }\n\n let firstNonSlashEnd = -1\n let extnameIndex = extname.length - 1\n\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else {\n if (firstNonSlashEnd < 0) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching.\n seenNonSlash = true\n firstNonSlashEnd = index + 1\n }\n\n if (extnameIndex > -1) {\n // Try to match the explicit extension.\n if (path.codePointAt(index) === extname.codePointAt(extnameIndex--)) {\n if (extnameIndex < 0) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = index\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extnameIndex = -1\n end = firstNonSlashEnd\n }\n }\n }\n }\n\n if (start === end) {\n end = firstNonSlashEnd\n } else if (end < 0) {\n end = path.length\n }\n\n return path.slice(start, end)\n}\n\n/**\n * Get the dirname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\nfunction dirname(path) {\n assertPath(path)\n\n if (path.length === 0) {\n return '.'\n }\n\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n // Prefix `--` is important to not run on `0`.\n while (--index) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n if (unmatchedSlash) {\n end = index\n break\n }\n } else if (!unmatchedSlash) {\n // We saw the first non-path separator\n unmatchedSlash = true\n }\n }\n\n return end < 0\n ? path.codePointAt(0) === 47 /* `/` */\n ? '/'\n : '.'\n : end === 1 && path.codePointAt(0) === 47 /* `/` */\n ? '//'\n : path.slice(0, end)\n}\n\n/**\n * Get an extname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * Extname.\n */\nfunction extname(path) {\n assertPath(path)\n\n let index = path.length\n\n let end = -1\n let startPart = 0\n let startDot = -1\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find.\n let preDotState = 0\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n while (index--) {\n const code = path.codePointAt(index)\n\n if (code === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (unmatchedSlash) {\n startPart = index + 1\n break\n }\n\n continue\n }\n\n if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // extension.\n unmatchedSlash = true\n end = index + 1\n }\n\n if (code === 46 /* `.` */) {\n // If this is our first dot, mark it as the start of our extension.\n if (startDot < 0) {\n startDot = index\n } else if (preDotState !== 1) {\n preDotState = 1\n }\n } else if (startDot > -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension.\n preDotState = -1\n }\n }\n\n if (\n startDot < 0 ||\n end < 0 ||\n // We saw a non-dot character immediately before the dot.\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly `..`.\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n ) {\n return ''\n }\n\n return path.slice(startDot, end)\n}\n\n/**\n * Join segments from a path.\n *\n * @param {Array} segments\n * Path segments.\n * @returns {string}\n * File path.\n */\nfunction join(...segments) {\n let index = -1\n /** @type {string | undefined} */\n let joined\n\n while (++index < segments.length) {\n assertPath(segments[index])\n\n if (segments[index]) {\n joined =\n joined === undefined ? segments[index] : joined + '/' + segments[index]\n }\n }\n\n return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Normalize a basic file path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\n// Note: `normalize` is not exposed as `path.normalize`, so some code is\n// manually removed from it.\nfunction normalize(path) {\n assertPath(path)\n\n const absolute = path.codePointAt(0) === 47 /* `/` */\n\n // Normalize the path according to POSIX rules.\n let value = normalizeString(path, !absolute)\n\n if (value.length === 0 && !absolute) {\n value = '.'\n }\n\n if (value.length > 0 && path.codePointAt(path.length - 1) === 47 /* / */) {\n value += '/'\n }\n\n return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n * File path.\n * @param {boolean} allowAboveRoot\n * Whether `..` can move above root.\n * @returns {string}\n * File path.\n */\nfunction normalizeString(path, allowAboveRoot) {\n let result = ''\n let lastSegmentLength = 0\n let lastSlash = -1\n let dots = 0\n let index = -1\n /** @type {number | undefined} */\n let code\n /** @type {number} */\n let lastSlashIndex\n\n while (++index <= path.length) {\n if (index < path.length) {\n code = path.codePointAt(index)\n } else if (code === 47 /* `/` */) {\n break\n } else {\n code = 47 /* `/` */\n }\n\n if (code === 47 /* `/` */) {\n if (lastSlash === index - 1 || dots === 1) {\n // Empty.\n } else if (lastSlash !== index - 1 && dots === 2) {\n if (\n result.length < 2 ||\n lastSegmentLength !== 2 ||\n result.codePointAt(result.length - 1) !== 46 /* `.` */ ||\n result.codePointAt(result.length - 2) !== 46 /* `.` */\n ) {\n if (result.length > 2) {\n lastSlashIndex = result.lastIndexOf('/')\n\n if (lastSlashIndex !== result.length - 1) {\n if (lastSlashIndex < 0) {\n result = ''\n lastSegmentLength = 0\n } else {\n result = result.slice(0, lastSlashIndex)\n lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n }\n\n lastSlash = index\n dots = 0\n continue\n }\n } else if (result.length > 0) {\n result = ''\n lastSegmentLength = 0\n lastSlash = index\n dots = 0\n continue\n }\n }\n\n if (allowAboveRoot) {\n result = result.length > 0 ? result + '/..' : '..'\n lastSegmentLength = 2\n }\n } else {\n if (result.length > 0) {\n result += '/' + path.slice(lastSlash + 1, index)\n } else {\n result = path.slice(lastSlash + 1, index)\n }\n\n lastSegmentLength = index - lastSlash - 1\n }\n\n lastSlash = index\n dots = 0\n } else if (code === 46 /* `.` */ && dots > -1) {\n dots++\n } else {\n dots = -1\n }\n }\n\n return result\n}\n\n/**\n * Make sure `path` is a string.\n *\n * @param {string} path\n * File path.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n 'Path must be a string. Received ' + JSON.stringify(path)\n )\n }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// .\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const minproc = {cwd}\n\nfunction cwd() {\n return '/'\n}\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n * File path or URL.\n * @returns {fileUrlOrPath is URL}\n * Whether it’s a URL.\n */\n// From: \nexport function isUrl(fileUrlOrPath) {\n return Boolean(\n fileUrlOrPath !== null &&\n typeof fileUrlOrPath === 'object' &&\n 'href' in fileUrlOrPath &&\n fileUrlOrPath.href &&\n 'protocol' in fileUrlOrPath &&\n fileUrlOrPath.protocol &&\n // @ts-expect-error: indexing is fine.\n fileUrlOrPath.auth === undefined\n )\n}\n","import {isUrl} from './minurl.shared.js'\n\nexport {isUrl} from './minurl.shared.js'\n\n// See: \n\n/**\n * @param {URL | string} path\n * File URL.\n * @returns {string}\n * File URL.\n */\nexport function urlToPath(path) {\n if (typeof path === 'string') {\n path = new URL(path)\n } else if (!isUrl(path)) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'The \"path\" argument must be of type string or an instance of URL. Received `' +\n path +\n '`'\n )\n error.code = 'ERR_INVALID_ARG_TYPE'\n throw error\n }\n\n if (path.protocol !== 'file:') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError('The URL must be of scheme file')\n error.code = 'ERR_INVALID_URL_SCHEME'\n throw error\n }\n\n return getPathFromURLPosix(path)\n}\n\n/**\n * Get a path from a POSIX URL.\n *\n * @param {URL} url\n * URL.\n * @returns {string}\n * File path.\n */\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL host must be \"localhost\" or empty on darwin'\n )\n error.code = 'ERR_INVALID_FILE_URL_HOST'\n throw error\n }\n\n const pathname = url.pathname\n let index = -1\n\n while (++index < pathname.length) {\n if (\n pathname.codePointAt(index) === 37 /* `%` */ &&\n pathname.codePointAt(index + 1) === 50 /* `2` */\n ) {\n const third = pathname.codePointAt(index + 2)\n if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL path must not include encoded / characters'\n )\n error.code = 'ERR_INVALID_FILE_URL_PATH'\n throw error\n }\n }\n }\n\n return decodeURIComponent(pathname)\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n 'history',\n 'path',\n 'basename',\n 'stem',\n 'extname',\n 'dirname'\n])\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * `options` is treated as:\n *\n * * `string` or `Uint8Array` — `{value: options}`\n * * `URL` — `{path: options}`\n * * `VFile` — shallow copies its data over to the new file\n * * `object` — all fields are shallow copied over to the new file\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * You cannot set `dirname` or `extname` without setting either `history`,\n * `path`, `basename`, or `stem` too.\n *\n * @param {Compatible | null | undefined} [value]\n * File value.\n * @returns\n * New instance.\n */\n constructor(value) {\n /** @type {Options | VFile} */\n let options\n\n if (!value) {\n options = {}\n } else if (isUrl(value)) {\n options = {path: value}\n } else if (typeof value === 'string' || isUint8Array(value)) {\n options = {value}\n } else {\n options = value\n }\n\n /* eslint-disable no-unused-expressions */\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n *\n * @type {string}\n */\n // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n // the empty string will be overridden in the next block.\n this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n /**\n * Place to store custom info (default: `{}`).\n *\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n *\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of file paths the file moved between.\n *\n * The first is the original path and the last is the current path.\n *\n * @type {Array}\n */\n this.history = []\n\n /**\n * List of messages associated with the file.\n *\n * @type {Array}\n */\n this.messages = []\n\n /**\n * Raw value.\n *\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n /**\n * Source map.\n *\n * This type is equivalent to the `RawSourceMap` type from the `source-map`\n * module.\n *\n * @type {Map | null | undefined}\n */\n this.map\n\n /**\n * Custom, non-string, compiled, representation.\n *\n * This is used by unified to store non-string results.\n * One example is when turning markdown into React nodes.\n *\n * @type {unknown}\n */\n this.result\n\n /**\n * Whether a file was saved to disk.\n *\n * This is used by vfile reporters.\n *\n * @type {boolean}\n */\n this.stored\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const field = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (\n field in options &&\n options[field] !== undefined &&\n options[field] !== null\n ) {\n // @ts-expect-error: TS doesn’t understand basic reality.\n this[field] = field === 'history' ? [...options[field]] : options[field]\n }\n }\n\n /** @type {string} */\n let field\n\n // Set non-path related properties.\n for (field in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(field)) {\n // @ts-expect-error: fine to set other things.\n this[field] = options[field]\n }\n }\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n *\n * @returns {string | undefined}\n * Basename.\n */\n get basename() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path)\n : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} basename\n * Basename.\n * @returns {undefined}\n * Nothing.\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = minpath.join(this.dirname || '', basename)\n }\n\n /**\n * Get the parent path (example: `'~'`).\n *\n * @returns {string | undefined}\n * Dirname.\n */\n get dirname() {\n return typeof this.path === 'string'\n ? minpath.dirname(this.path)\n : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n *\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} dirname\n * Dirname.\n * @returns {undefined}\n * Nothing.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = minpath.join(dirname || '', this.basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n *\n * @returns {string | undefined}\n * Extname.\n */\n get extname() {\n return typeof this.path === 'string'\n ? minpath.extname(this.path)\n : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} extname\n * Extname.\n * @returns {undefined}\n * Nothing.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.codePointAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n *\n * @returns {string}\n * Path.\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n *\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n *\n * @param {URL | string} path\n * Path.\n * @returns {undefined}\n * Nothing.\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n *\n * @returns {string | undefined}\n * Stem.\n */\n get stem() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} stem\n * Stem.\n * @returns {undefined}\n * Nothing.\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n // Normal prototypal methods.\n /**\n * Create a fatal message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `true` (error; file not usable)\n * and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {never}\n * Never.\n * @throws {VFileMessage}\n * Message.\n */\n fail(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = true\n\n throw message\n }\n\n /**\n * Create an info message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `undefined` (info; change\n * likely not needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n info(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = undefined\n\n return message\n }\n\n /**\n * Create a message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `false` (warning; change may be\n * needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n message(causeOrReason, optionsOrParentOrPlace, origin) {\n const message = new VFileMessage(\n // @ts-expect-error: the overloads are fine.\n causeOrReason,\n optionsOrParentOrPlace,\n origin\n )\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Serialize the file.\n *\n * > **Note**: which encodings are supported depends on the engine.\n * > For info on Node.js, see:\n * > .\n *\n * @param {string | null | undefined} [encoding='utf8']\n * Character encoding to understand `value` as when it’s a `Uint8Array`\n * (default: `'utf-8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n if (this.value === undefined) {\n return ''\n }\n\n if (typeof this.value === 'string') {\n return this.value\n }\n\n const decoder = new TextDecoder(encoding || undefined)\n return decoder.decode(this.value)\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n * File path part.\n * @param {string} name\n * Part name.\n * @returns {undefined}\n * Nothing.\n */\nfunction assertPart(part, name) {\n if (part && part.includes(minpath.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n * Thing.\n * @param {string} name\n * Part name.\n * @returns {asserts part is string}\n * Nothing.\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n * Path.\n * @param {string} name\n * Dependency name.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","export const CallableInstance =\n /**\n * @type {new , Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n */\n (\n /** @type {unknown} */\n (\n /**\n * @this {Function}\n * @param {string | symbol} property\n * @returns {(...parameters: Array) => unknown}\n */\n function (property) {\n const self = this\n const constr = self.constructor\n const proto = /** @type {Record} */ (\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n constr.prototype\n )\n const value = proto[property]\n /** @type {(...parameters: Array) => unknown} */\n const apply = function () {\n return value.apply(apply, arguments)\n }\n\n Object.setPrototypeOf(apply, proto)\n\n // Not needed for us in `unified`: we only call this on the `copy`\n // function,\n // and we don't need to add its fields (`length`, `name`)\n // over.\n // See also: GH-246.\n // const names = Object.getOwnPropertyNames(value)\n //\n // for (const p of names) {\n // const descriptor = Object.getOwnPropertyDescriptor(value, p)\n // if (descriptor) Object.defineProperty(apply, p, descriptor)\n // }\n\n return apply\n }\n )\n )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n * Acceptable results from compilers.\n *\n * To register custom results, add them to\n * {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n * The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n * A **compiler** handles the compiling of a syntax tree to something else\n * (in most cases, text) (TypeScript type).\n *\n * It is used in the stringify phase and called with a {@linkcode Node}\n * and {@linkcode VFile} representation of the document to compile.\n * It should return the textual representation of the given tree (typically\n * `string`).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n * Tree to compile.\n * @param {VFile} file\n * File associated with `tree`.\n * @returns {Result}\n * New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n * something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the parser yields (default: `Node`)\n * @callback Parser\n * A **parser** handles the parsing of text to a syntax tree.\n *\n * It is used in the parse phase and is called with a `string` and\n * {@linkcode VFile} of the document to parse.\n * It must return the syntax tree representation of the given file\n * ({@linkcode Node}).\n * @param {string} document\n * Document to parse.\n * @param {VFile} file\n * File associated with `document`.\n * @returns {Tree}\n * Node representing the given file.\n */\n\n/**\n * @typedef {(\n * Plugin, any, any> |\n * PluginTuple, any, any> |\n * Preset\n * )} Pluggable\n * Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array} PluggableList\n * List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n// .\n/**\n * @template {Array} [PluginParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n * Value that is expected as input (default: `Node`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=Input]\n * Value that is yielded as output (default: `Input`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * (this: Processor, ...parameters: PluginParameters) =>\n * Input extends string ? // Parser.\n * Output extends Node | undefined ? undefined | void : never :\n * Output extends CompileResults ? // Compiler.\n * Input extends Node | undefined ? undefined | void : never :\n * Transformer<\n * Input extends Node ? Input : Node,\n * Output extends Node ? Output : Node\n * > | undefined | void\n * )} Plugin\n * Single plugin.\n *\n * Plugins configure the processors they are applied on in the following\n * ways:\n *\n * * they change the processor, such as the parser, the compiler, or by\n * configuring data\n * * they specify how to handle trees and files\n *\n * In practice, they are functions that can receive options and configure the\n * processor (`this`).\n *\n * > **Note**: plugins are called when the processor is *frozen*, not when\n * > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array} [TupleParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n * Value that is expected as input (optional).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=undefined] (optional).\n * Value that is yielded as output.\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * [\n * plugin: Plugin,\n * ...parameters: TupleParameters\n * ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n * Sharable configuration.\n *\n * They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n * List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n * Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n * The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n * Callback called when the process is done.\n *\n * Called with either an error or a result.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {File | undefined} [file]\n * Processed file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n * Callback called when transformers are done.\n *\n * Called with either an error or results.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {Tree | undefined} [tree]\n * Transformed tree (optional).\n * @param {VFile | undefined} [file]\n * File (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n * Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n * Callback passed to transforms.\n *\n * If the signature of a `transformer` accepts a third argument, the\n * transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n * Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n * New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n * New, changed, file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n * Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n * Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n * Transformers handle syntax trees and files.\n *\n * They are functions that are called each time a syntax tree and file are\n * passed through the run phase.\n * When an error occurs in them (either because it’s thrown, returned,\n * rejected, or passed to `next`), the process stops.\n *\n * The run phase is handled by [`trough`][trough], see its documentation for\n * the exact semantics of these functions.\n *\n * > **Note**: you should likely ignore `next`: don’t accept it.\n * > it supports callback-style async work.\n * > But promises are likely easier to reason about.\n *\n * [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n * Tree to handle.\n * @param {VFile} file\n * File to handle.\n * @param {TransformCallback} next\n * Callback.\n * @returns {(\n * Promise |\n * Promise | // For some reason this is needed separately.\n * Output |\n * Error |\n * undefined |\n * void\n * )}\n * If you accept `next`, nothing.\n * Otherwise:\n *\n * * `Error` — fatal error to stop the process\n * * `Promise` or `undefined` — the next transformer keeps using\n * same tree\n * * `Promise` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n * Output of `parse`.\n * @template {Node | undefined} HeadTree\n * Input for `run`.\n * @template {Node | undefined} TailTree\n * Output for `run`.\n * @template {Node | undefined} CompileTree\n * Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n * Output of `stringify`.\n * @template {Node | string | undefined} Input\n * Input of plugin.\n * @template Output\n * Output of plugin (optional).\n * @typedef {(\n * Input extends string\n * ? Output extends Node | undefined\n * ? // Parser.\n * Processor<\n * Output extends undefined ? ParseTree : Output,\n * HeadTree,\n * TailTree,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : Output extends CompileResults\n * ? Input extends Node | undefined\n * ? // Compiler.\n * Processor<\n * ParseTree,\n * HeadTree,\n * TailTree,\n * Input extends undefined ? CompileTree : Input,\n * Output extends undefined ? CompileResult : Output\n * >\n * : // Unknown.\n * Processor\n * : Input extends Node | undefined\n * ? Output extends Node | undefined\n * ? // Transform.\n * Processor<\n * ParseTree,\n * HeadTree extends undefined ? Input : HeadTree,\n * Output extends undefined ? TailTree : Output,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : // Unknown.\n * Processor\n * )} UsePlugin\n * Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n * Node type that the transformer yields.\n * @typedef {(\n * Result extends Value | undefined ?\n * VFile :\n * VFile & {result: Result}\n * )} VFileWithOutput\n * Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n * If a result that is not acceptable on a `VFile` is used, that will\n * be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n * Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n * Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n * Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n * Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n * Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor>}\n */\nexport class Processor extends CallableInstance {\n /**\n * Create a processor.\n */\n constructor() {\n // If `Processor()` is called (w/o new), `copy` is called instead.\n super('copy')\n\n /**\n * Compiler to use (deprecated).\n *\n * @deprecated\n * Use `compiler` instead.\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.Compiler = undefined\n\n /**\n * Parser to use (deprecated).\n *\n * @deprecated\n * Use `parser` instead.\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.Parser = undefined\n\n // Note: the following fields are considered private.\n // However, they are needed for tests, and TSC generates an untyped\n // `private freezeIndex` field for, which trips `type-coverage` up.\n // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n /**\n * Internal list of configured plugins.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Array>>}\n */\n this.attachers = []\n\n /**\n * Compiler to use.\n *\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.compiler = undefined\n\n /**\n * Internal state to track where we are while freezing.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {number}\n */\n this.freezeIndex = -1\n\n /**\n * Internal state to track whether we’re frozen.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {boolean | undefined}\n */\n this.frozen = undefined\n\n /**\n * Internal state.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Data}\n */\n this.namespace = {}\n\n /**\n * Parser to use.\n *\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.parser = undefined\n\n /**\n * Internal list of configured transformers.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Pipeline}\n */\n this.transformers = trough()\n }\n\n /**\n * Copy a processor.\n *\n * @deprecated\n * This is a private internal method and should not be used.\n * @returns {Processor}\n * New *unfrozen* processor ({@linkcode Processor}) that is\n * configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\n copy() {\n // Cast as the type parameters will be the same after attaching.\n const destination =\n /** @type {Processor} */ (\n new Processor()\n )\n let index = -1\n\n while (++index < this.attachers.length) {\n const attacher = this.attachers[index]\n destination.use(...attacher)\n }\n\n destination.data(extend(true, {}, this.namespace))\n\n return destination\n }\n\n /**\n * Configure the processor with info available to all plugins.\n * Information is stored in an object.\n *\n * Typically, options can be given to a specific plugin, but sometimes it\n * makes sense to have information shared with several plugins.\n * For example, a list of HTML elements that are self-closing, which is\n * needed during all phases.\n *\n * > **Note**: setting information cannot occur on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * > **Note**: to register custom data in TypeScript, augment the\n * > {@linkcode Data} interface.\n *\n * @example\n * This example show how to get and set info:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * const processor = unified().data('alpha', 'bravo')\n *\n * processor.data('alpha') // => 'bravo'\n *\n * processor.data() // => {alpha: 'bravo'}\n *\n * processor.data({charlie: 'delta'})\n *\n * processor.data() // => {charlie: 'delta'}\n * ```\n *\n * @template {keyof Data} Key\n *\n * @overload\n * @returns {Data}\n *\n * @overload\n * @param {Data} dataset\n * @returns {Processor}\n *\n * @overload\n * @param {Key} key\n * @returns {Data[Key]}\n *\n * @overload\n * @param {Key} key\n * @param {Data[Key]} value\n * @returns {Processor}\n *\n * @param {Data | Key} [key]\n * Key to get or set, or entire dataset to set, or nothing to get the\n * entire dataset (optional).\n * @param {Data[Key]} [value]\n * Value to set (optional).\n * @returns {unknown}\n * The current processor when setting, the value at `key` when getting, or\n * the entire dataset when getting without key.\n */\n data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', this.frozen)\n this.namespace[key] = value\n return this\n }\n\n // Get `key`.\n return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', this.frozen)\n this.namespace = key\n return this\n }\n\n // Get space.\n return this.namespace\n }\n\n /**\n * Freeze a processor.\n *\n * Frozen processors are meant to be extended and not to be configured\n * directly.\n *\n * When a processor is frozen it cannot be unfrozen.\n * New processors working the same way can be created by calling the\n * processor.\n *\n * It’s possible to freeze processors explicitly by calling `.freeze()`.\n * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n * `.stringify()`, `.process()`, or `.processSync()` are called.\n *\n * @returns {Processor}\n * The current processor.\n */\n freeze() {\n if (this.frozen) {\n return this\n }\n\n // Cast so that we can type plugins easier.\n // Plugins are supposed to be usable on different processors, not just on\n // this exact processor.\n const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n while (++this.freezeIndex < this.attachers.length) {\n const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n const transformer = attacher.call(self, ...options)\n\n if (typeof transformer === 'function') {\n this.transformers.use(transformer)\n }\n }\n\n this.frozen = true\n this.freezeIndex = Number.POSITIVE_INFINITY\n\n return this\n }\n\n /**\n * Parse text to a syntax tree.\n *\n * > **Note**: `parse` freezes the processor if not already *frozen*.\n *\n * > **Note**: `parse` performs the parse phase, not the run phase or other\n * > phases.\n *\n * @param {Compatible | undefined} [file]\n * file to parse (optional); typically `string` or `VFile`; any value\n * accepted as `x` in `new VFile(x)`.\n * @returns {ParseTree extends undefined ? Node : ParseTree}\n * Syntax tree representing `file`.\n */\n parse(file) {\n this.freeze()\n const realFile = vfile(file)\n const parser = this.parser || this.Parser\n assertParser('parse', parser)\n return parser(String(realFile), realFile)\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * > **Note**: `process` freezes the processor if not already *frozen*.\n *\n * > **Note**: `process` performs the parse, run, and stringify phases.\n *\n * @overload\n * @param {Compatible | undefined} file\n * @param {ProcessCallback>} done\n * @returns {undefined}\n *\n * @overload\n * @param {Compatible | undefined} [file]\n * @returns {Promise>}\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`]; any value accepted as\n * `x` in `new VFile(x)`.\n * @param {ProcessCallback> | undefined} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise a promise, rejected with a fatal error or resolved with the\n * processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n process(file, done) {\n const self = this\n\n this.freeze()\n assertParser('process', this.parser || this.Parser)\n assertCompiler('process', this.compiler || this.Compiler)\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {((file: VFileWithOutput) => undefined | void) | undefined} resolve\n * @param {(error: Error | undefined) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n const realFile = vfile(file)\n // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n // input of the first transform).\n const parseTree =\n /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n /** @type {unknown} */ (self.parse(realFile))\n )\n\n self.run(parseTree, realFile, function (error, tree, file) {\n if (error || !tree || !file) {\n return realDone(error)\n }\n\n // Assume `TailTree` (the output of the last transform) matches\n // `CompileTree` (the input of the compiler).\n const compileTree =\n /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n /** @type {unknown} */ (tree)\n )\n\n const compileResult = self.stringify(compileTree, file)\n\n if (looksLikeAValue(compileResult)) {\n file.value = compileResult\n } else {\n file.result = compileResult\n }\n\n realDone(error, /** @type {VFileWithOutput} */ (file))\n })\n\n /**\n * @param {Error | undefined} error\n * @param {VFileWithOutput | undefined} [file]\n * @returns {undefined}\n */\n function realDone(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, file)\n }\n }\n }\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `processSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `processSync` performs the parse, run, and stringify phases.\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`; any value accepted as\n * `x` in `new VFile(x)`.\n * @returns {VFileWithOutput}\n * The processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n processSync(file) {\n /** @type {boolean} */\n let complete = false\n /** @type {VFileWithOutput | undefined} */\n let result\n\n this.freeze()\n assertParser('processSync', this.parser || this.Parser)\n assertCompiler('processSync', this.compiler || this.Compiler)\n\n this.process(file, realDone)\n assertDone('processSync', 'process', complete)\n assert(result, 'we either bailed on an error or have a tree')\n\n return result\n\n /**\n * @type {ProcessCallback>}\n */\n function realDone(error, file) {\n complete = true\n bail(error)\n result = file\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * > **Note**: `run` freezes the processor if not already *frozen*.\n *\n * > **Note**: `run` performs the run phase, not other phases.\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} file\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} [file]\n * @returns {Promise}\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {(\n * RunCallback |\n * Compatible\n * )} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @param {RunCallback} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise, a promise rejected with a fatal error or resolved with the\n * transformed tree.\n */\n run(tree, file, done) {\n assertNode(tree)\n this.freeze()\n\n const transformers = this.transformers\n\n if (!done && typeof file === 'function') {\n done = file\n file = undefined\n }\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {(\n * ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n * undefined\n * )} resolve\n * @param {(error: Error) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n assert(\n typeof file !== 'function',\n '`file` can’t be a `done` anymore, we checked'\n )\n const realFile = vfile(file)\n transformers.run(tree, realFile, realDone)\n\n /**\n * @param {Error | undefined} error\n * @param {Node} outputTree\n * @param {VFile} file\n * @returns {undefined}\n */\n function realDone(error, outputTree, file) {\n const resultingTree =\n /** @type {TailTree extends undefined ? Node : TailTree} */ (\n outputTree || tree\n )\n\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(resultingTree)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, resultingTree, file)\n }\n }\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `runSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `runSync` performs the run phase, not other phases.\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {TailTree extends undefined ? Node : TailTree}\n * Transformed tree.\n */\n runSync(tree, file) {\n /** @type {boolean} */\n let complete = false\n /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n let result\n\n this.run(tree, file, realDone)\n\n assertDone('runSync', 'run', complete)\n assert(result, 'we either bailed on an error or have a tree')\n return result\n\n /**\n * @type {RunCallback}\n */\n function realDone(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * Compile a syntax tree.\n *\n * > **Note**: `stringify` freezes the processor if not already *frozen*.\n *\n * > **Note**: `stringify` performs the stringify phase, not the run phase\n * > or other phases.\n *\n * @param {CompileTree extends undefined ? Node : CompileTree} tree\n * Tree to compile.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {CompileResult extends undefined ? Value : CompileResult}\n * Textual representation of the tree (see note).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n stringify(tree, file) {\n this.freeze()\n const realFile = vfile(file)\n const compiler = this.compiler || this.Compiler\n assertCompiler('stringify', compiler)\n assertNode(tree)\n\n return compiler(tree, realFile)\n }\n\n /**\n * Configure the processor to use a plugin, a list of usable values, or a\n * preset.\n *\n * If the processor is already using a plugin, the previous plugin\n * configuration is changed based on the options that are passed in.\n * In other words, the plugin is not added a second time.\n *\n * > **Note**: `use` cannot be called on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * @example\n * There are many ways to pass plugins to `.use()`.\n * This example gives an overview:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * unified()\n * // Plugin with options:\n * .use(pluginA, {x: true, y: true})\n * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n * .use(pluginA, {y: false, z: true})\n * // Plugins:\n * .use([pluginB, pluginC])\n * // Two plugins, the second with options:\n * .use([pluginD, [pluginE, {}]])\n * // Preset with plugins and settings:\n * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n * // Settings only:\n * .use({settings: {position: false}})\n * ```\n *\n * @template {Array} [Parameters=[]]\n * @template {Node | string | undefined} [Input=undefined]\n * @template [Output=Input]\n *\n * @overload\n * @param {Preset | null | undefined} [preset]\n * @returns {Processor}\n *\n * @overload\n * @param {PluggableList} list\n * @returns {Processor}\n *\n * @overload\n * @param {Plugin} plugin\n * @param {...(Parameters | [boolean])} parameters\n * @returns {UsePlugin}\n *\n * @param {PluggableList | Plugin | Preset | null | undefined} value\n * Usable value.\n * @param {...unknown} parameters\n * Parameters, when a plugin is given as a usable value.\n * @returns {Processor}\n * Current processor.\n */\n use(value, ...parameters) {\n const attachers = this.attachers\n const namespace = this.namespace\n\n assertUnfrozen('use', this.frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, parameters)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n return this\n\n /**\n * @param {Pluggable} value\n * @returns {undefined}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value, [])\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...parameters] =\n /** @type {PluginTuple>} */ (value)\n addPlugin(plugin, parameters)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {undefined}\n */\n function addPreset(result) {\n if (!('plugins' in result) && !('settings' in result)) {\n throw new Error(\n 'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n )\n }\n\n addList(result.plugins)\n\n if (result.settings) {\n namespace.settings = extend(true, namespace.settings, result.settings)\n }\n }\n\n /**\n * @param {PluggableList | null | undefined} plugins\n * @returns {undefined}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {Array} parameters\n * @returns {undefined}\n */\n function addPlugin(plugin, parameters) {\n let index = -1\n let entryIndex = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entryIndex = index\n break\n }\n }\n\n if (entryIndex === -1) {\n attachers.push([plugin, ...parameters])\n }\n // Only set if there was at least a `primary` value, otherwise we’d change\n // `arguments.length`.\n else if (parameters.length > 0) {\n let [primary, ...rest] = parameters\n const currentPrimary = attachers[entryIndex][1]\n if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n primary = extend(true, currentPrimary, primary)\n }\n\n attachers[entryIndex] = [plugin, primary, ...rest]\n }\n }\n }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n * This example shows how a new processor can be created (from `remark`) and linked\n * to **stdin**(4) and **stdout**(4).\n *\n * ```js\n * import process from 'node:process'\n * import concatStream from 'concat-stream'\n * import {remark} from 'remark'\n *\n * process.stdin.pipe(\n * concatStream(function (buf) {\n * process.stdout.write(String(remark().processSync(buf)))\n * })\n * )\n * ```\n *\n * @returns\n * New *unfrozen* processor (`processor`).\n *\n * This processor is configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n/**\n * @module public\n */\nimport { loadState } from '@nextcloud/initial-state';\n/**\n * Check if the current page is on a public share\n */\nexport function isPublicShare() {\n // check both the new initial state version and fallback to legacy input\n return (loadState('files_sharing', 'isPublic', null)\n ?? document.querySelector('input#isPublic[type=\"hidden\"][name=\"isPublic\"][value=\"1\"]') !== null);\n}\n/**\n * Get the sharing token for the current public share\n */\nexport function getSharingToken() {\n return (loadState('files_sharing', 'sharingToken', null)\n ?? document.querySelector('input#sharingToken[type=\"hidden\"]')?.value\n ?? null);\n}\n","import { l as logger } from \"./logger.mjs\";\nwindow._vue_richtext_widgets ??= {};\nwindow._registerWidget ??= (id, callback, onDestroy, props) => {\n registerWidget(id, callback, onDestroy, props);\n};\nfunction registerWidget(id, callback, onDestroy = () => {\n}, props) {\n const propsWithDefaults = {\n hasInteractiveView: true,\n fullWidth: false,\n isResizable: false,\n ...props\n };\n if (window._vue_richtext_widgets[id]) {\n logger.error(`[ReferencePicker]: Widget for id ${id} already registered`);\n return;\n }\n window._vue_richtext_widgets[id] = {\n id,\n callback,\n onDestroy,\n ...propsWithDefaults\n };\n}\nfunction renderWidget(el, options) {\n const { richObjectType, richObject, accessible, interactive } = options;\n if (richObjectType === \"open-graph\") {\n return;\n }\n if (!window._vue_richtext_widgets[richObjectType]) {\n logger.error(\"Widget for rich object type \" + richObjectType + \" not registered\");\n return;\n }\n window._vue_richtext_widgets[richObjectType].callback(el, { richObjectType, richObject, accessible, interactive });\n}\nfunction destroyWidget(richObjectType, el) {\n if (richObjectType === \"open-graph\") {\n return;\n }\n if (!window._vue_richtext_widgets[richObjectType]) {\n return;\n }\n window._vue_richtext_widgets[richObjectType].onDestroy(el);\n}\nfunction isWidgetRegistered(id) {\n return !!window._vue_richtext_widgets[id];\n}\nfunction hasInteractiveView(id) {\n return !!window._vue_richtext_widgets[id]?.hasInteractiveView;\n}\nfunction hasFullWidth(id) {\n return !!window._vue_richtext_widgets[id]?.fullWidth;\n}\nfunction isResizable(id) {\n return !!window._vue_richtext_widgets[id]?.isResizable;\n}\nexport {\n renderWidget as a,\n hasFullWidth as b,\n isResizable as c,\n destroyWidget as d,\n hasInteractiveView as h,\n isWidgetRegistered as i,\n registerWidget as r\n};\n//# sourceMappingURL=widgets.mjs.map\n","/**\n * @typedef {import('unist').Node} Node\n */\n\n/**\n * @typedef {Array | string} ChildrenOrValue\n * List to use as `children` or value to use as `value`.\n *\n * @typedef {Record} Props\n * Other fields to add to the node.\n */\n\n/**\n * Build a node.\n *\n * @template {string} T\n * @template {Props} P\n * @template {Array} C\n *\n * @overload\n * @param {T} type\n * @returns {{type: T}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @returns {{type: T} & P}\n *\n * @overload\n * @param {T} type\n * @param {string} value\n * @returns {{type: T, value: string}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @param {string} value\n * @returns {{type: T, value: string} & P}\n *\n * @overload\n * @param {T} type\n * @param {C} children\n * @returns {{type: T, children: C}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @param {C} children\n * @returns {{type: T, children: C} & P}\n *\n * @param {string} type\n * Node type.\n * @param {ChildrenOrValue | Props | null | undefined} [props]\n * Fields assigned to node (default: `undefined`).\n * @param {ChildrenOrValue | null | undefined} [value]\n * Children of node or value of `node` (cast to string).\n * @returns {Node}\n * Built node.\n */\nexport function u(type, props, value) {\n /** @type {Node} */\n const node = {type: String(type)}\n\n if (\n (value === undefined || value === null) &&\n (typeof props === 'string' || Array.isArray(props))\n ) {\n value = props\n } else {\n Object.assign(node, props)\n }\n\n if (Array.isArray(value)) {\n // @ts-expect-error: create a parent.\n node.children = value\n } else if (value !== undefined && value !== null) {\n // @ts-expect-error: create a literal.\n node.value = String(value)\n }\n\n return node\n}\n","import '../assets/autolink.css';\nimport { getBaseUrl, getRootUrl } from \"@nextcloud/router\";\nimport { u } from \"unist-builder\";\nimport { visitParents, SKIP } from \"unist-util-visit-parents\";\nimport { defineComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString } from \"vue\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nconst _hoisted_1 = [\"href\"];\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcRichTextExternalLink\",\n props: {\n href: {},\n decorateExternal: { type: Boolean, default: false }\n },\n setup(__props) {\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"a\", {\n href: __props.href,\n rel: \"noopener noreferrer\",\n target: \"_blank\",\n class: normalizeClass([_ctx.$style.externalLink, {\n [_ctx.$style.externalLink_decorated]: __props.decorateExternal\n }])\n }, [\n renderSlot(_ctx.$slots, \"default\", {}, () => [\n createTextVNode(toDisplayString(__props.href), 1)\n ])\n ], 10, _hoisted_1);\n };\n }\n});\nconst externalLink = \"_externalLink_b-KZi\";\nconst externalLink_decorated = \"_externalLink_decorated_wcK-p\";\nconst style0 = {\n \"material-design-icon\": \"_material-design-icon_9-SDv\",\n externalLink,\n externalLink_decorated\n};\nconst cssModules = {\n \"$style\": style0\n};\nconst NcRichTextExternalLink = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__cssModules\", cssModules]]);\n/*!\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst URL_PATTERN = /(\\s|^)(https?:\\/\\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\\s|$)/ig;\nconst URL_PATTERN_AUTOLINK = /(\\s|\\(|^)((https?:\\/\\/)([-A-Z0-9+_.]+[-A-Z0-9]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*))(?=\\s|\\)|$)/ig;\nfunction remarkAutolink({ autolink, useMarkdown, useExtendedMarkdown }) {\n return function(tree) {\n if (useExtendedMarkdown || !useMarkdown || !autolink) {\n return;\n }\n visitParents(tree, (node) => node.type === \"text\", (node, ancestors) => {\n if (ancestors.some((ancestor) => ancestor.type === \"link\" || ancestor.type === \"linkReference\")) {\n return;\n }\n const parent = ancestors.at(-1);\n const index = parent.children.indexOf(node) ?? 0;\n const parsed = parseUrl(node.value);\n const parsedNodes = typeof parsed === \"string\" ? [u(\"text\", parsed)] : parsed.map((n) => {\n if (typeof n === \"string\") {\n return u(\"text\", n);\n }\n return u(\"link\", {\n url: n.props.href\n }, [u(\"text\", n.props.href)]);\n }).filter((x) => x).flat();\n parent.children.splice(index, 1, ...parsedNodes);\n return [SKIP, index + parsedNodes.length];\n });\n };\n}\nfunction parseUrl(text) {\n let match = URL_PATTERN_AUTOLINK.exec(text);\n const list = [];\n let start = 0;\n while (match !== null) {\n let href = match[2];\n let textAfter;\n let textBefore = text.substring(start, match.index + match[1].length);\n if (href[0] === \" \") {\n textBefore += href[0];\n href = href.substring(1).trim();\n }\n const lastChar = href[href.length - 1];\n if (lastChar === \".\" || lastChar === \",\" || lastChar === \";\" || match[0][0] === \"(\" && lastChar === \")\") {\n href = href.substring(0, href.length - 1);\n textAfter = lastChar;\n }\n list.push(textBefore);\n list.push({ component: NcRichTextExternalLink, props: { href: href.trim(), decorateExternal: true } });\n if (textAfter) {\n list.push(textAfter);\n }\n start = match.index + match[0].length;\n match = URL_PATTERN_AUTOLINK.exec(text);\n }\n list.push(text.substring(start));\n const joinedText = list.map((item) => typeof item === \"string\" ? item : item.props.href).join(\"\");\n if (text === joinedText) {\n return list;\n }\n logger.error(\"[NcRichText] Failed to reassemble the chunked text: \" + text);\n return text;\n}\nfunction getRoute(router, url) {\n const removePrefix = (str, prefix) => str.startsWith(prefix) ? str.slice(prefix.length) : str;\n const removePrefixes = (str, ...prefixes) => prefixes.reduce((acc, prefix) => removePrefix(acc, prefix), str);\n if (!router) {\n return null;\n }\n const isAbsoluteURL = /^https?:\\/\\//.test(url);\n const isNonHttpLink = /^[a-z][a-z0-9+.-]*:.+/.test(url);\n if (!isAbsoluteURL && isNonHttpLink) {\n return null;\n }\n if (isAbsoluteURL && !url.startsWith(getBaseUrl())) {\n return null;\n }\n if (!isAbsoluteURL && !url.startsWith(\"/\")) {\n return null;\n }\n const relativeUrl = isAbsoluteURL ? removePrefixes(url, getBaseUrl(), \"/index.php\") : url;\n const relativeRouterBase = removePrefixes(router.options.history.base, getRootUrl(), \"/index.php\");\n const potentialRouterPath = removePrefixes(relativeUrl, relativeRouterBase) || \"/\";\n const route = router.resolve(potentialRouterPath);\n if (!route.matched.length) {\n return null;\n }\n return route.fullPath;\n}\nexport {\n NcRichTextExternalLink as N,\n URL_PATTERN as U,\n getRoute as g,\n parseUrl as p,\n remarkAutolink as r\n};\n//# sourceMappingURL=autolink.mjs.map\n","import '../assets/NcReferenceWidget.css';\nimport { defineComponent, inject, ref, useTemplateRef, nextTick, computed, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, withKeys, withModifiers, unref, createCommentVNode, createBlock, resolveDynamicComponent, mergeProps, withCtx, toDisplayString, createTextVNode } from \"vue\";\nimport { useElementSize, useIntersectionObserver } from \"@vueuse/core\";\nimport { routerKey, RouterLink } from \"vue-router\";\nimport { N as NcButton } from \"./NcButton.mjs\";\nimport { r as register, m as t25, a as t } from \"./_l10n.mjs\";\nimport { c as createElementId } from \"./createElementId.mjs\";\nimport { b as hasFullWidth, c as isResizable, i as isWidgetRegistered, h as hasInteractiveView, a as renderWidget, d as destroyWidget } from \"./widgets.mjs\";\nimport { g as getRoute } from \"./autolink.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nregister(t25);\nconst _hoisted_1 = [\"aria-label\", \"aria-valuenow\", \"aria-valuemin\", \"aria-valuemax\"];\nconst _hoisted_2 = [\"src\"];\nconst _hoisted_3 = { class: \"widget-default--details\" };\nconst _hoisted_4 = { class: \"widget-default--name\" };\nconst _hoisted_5 = { class: \"widget-default--link\" };\nconst IDLE_TIMEOUT = 3 * 60 * 1e3;\nconst RESIZE_KEYBOARD_STEP = 10;\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcReferenceWidget\",\n props: {\n reference: {},\n interactive: { type: Boolean, default: true },\n interactiveOptIn: { type: Boolean, default: false }\n },\n setup(__props) {\n const props = __props;\n const router = inject(routerKey, null);\n const widgetId = `nc-reference-widget-${createElementId()}`;\n const isVisible = ref(false);\n const customWidget = useTemplateRef(\"customWidget\");\n const customWidgetContent = useTemplateRef(\"customWidgetContent\");\n const widgetRoot = useTemplateRef(\"widgetRoot\");\n const { width } = useElementSize(widgetRoot);\n const { height: customWidgetHeight } = useElementSize(customWidget);\n useIntersectionObserver(widgetRoot, ([entry]) => {\n nextTick(() => {\n isVisible.value = entry.isIntersecting;\n });\n });\n const showInteractive = ref(false);\n const rendered = ref(false);\n let idleTimeout = null;\n const isResizing = ref(false);\n const resizedHeight = ref(null);\n const resizeStartY = ref(0);\n const resizeStartHeight = ref(0);\n const resizeMinHeight = ref(100);\n const resizeMaxHeight = ref(window.innerHeight - 120);\n const isInteractive = computed(() => {\n return !props.interactiveOptIn && props.interactive || showInteractive.value;\n });\n const referenceHasFullWidth = computed(() => {\n return hasFullWidth(props.reference.richObjectType);\n });\n const isWidgetResizable = computed(() => {\n return isResizable(props.reference.richObjectType);\n });\n const hasCustomWidget = computed(() => {\n return isWidgetRegistered(props.reference.richObjectType);\n });\n const customWidgetStyle = computed(() => {\n if (!resizedHeight.value) {\n return null;\n }\n return { height: `${resizedHeight.value}px !important` };\n });\n const ariaValueNow = computed(() => {\n return Math.round(resizedHeight.value ?? customWidgetHeight.value);\n });\n const referenceHasInteractiveView = computed(() => {\n return hasCustomWidget.value && hasInteractiveView(props.reference.richObjectType);\n });\n const noAccess = computed(() => {\n return !props.reference.accessible;\n });\n const numberOfLines = computed(() => {\n const lineCountOffsets = [450, 550, 650, Infinity];\n return lineCountOffsets.findIndex((max) => width.value < max);\n });\n const descriptionStyle = computed(() => {\n if (numberOfLines.value === 0) {\n return {\n display: \"none\"\n };\n }\n const lineClamp = numberOfLines.value;\n return {\n lineClamp,\n webkitLineClamp: lineClamp\n };\n });\n const compactLink = computed(() => {\n const link = props.reference.openGraphObject.link;\n if (!link) {\n return \"\";\n }\n if (link.startsWith(\"https://\")) {\n return link.substring(8);\n }\n if (link.startsWith(\"http://\")) {\n return link.substring(7);\n }\n return link;\n });\n const route = computed(() => {\n return getRoute(router, props.reference.openGraphObject.link);\n });\n const referenceWidgetLinkComponent = computed(() => {\n return route.value ? RouterLink : \"a\";\n });\n const referenceWidgetLinkProps = computed(() => {\n return route.value ? { to: route.value } : { href: props.reference.openGraphObject.link, target: \"_blank\" };\n });\n watch(isVisible, (val) => {\n if (!val) {\n idleTimeout = setTimeout(() => {\n if (!isVisible.value) {\n destroyReferenceWidget();\n }\n }, IDLE_TIMEOUT);\n return;\n }\n if (idleTimeout) {\n clearTimeout(idleTimeout);\n idleTimeout = null;\n }\n if (!rendered.value) {\n renderReferenceWidget();\n }\n }, { immediate: true });\n onBeforeUnmount(() => {\n if (idleTimeout) {\n clearTimeout(idleTimeout);\n idleTimeout = null;\n }\n stopResize();\n destroyReferenceWidget();\n });\n function enableInteractive() {\n showInteractive.value = true;\n renderReferenceWidget();\n }\n function renderReferenceWidget() {\n if (!customWidgetContent.value) {\n return;\n }\n if (props.reference.richObjectType === \"open-graph\") {\n return;\n }\n customWidgetContent.value.innerHTML = \"\";\n const widget = document.createElement(\"div\");\n widget.style.width = \"100%\";\n customWidgetContent.value.appendChild(widget);\n nextTick(() => {\n renderWidget(widget, {\n ...props.reference,\n interactive: isInteractive.value\n });\n rendered.value = true;\n });\n }\n function destroyReferenceWidget() {\n if (rendered.value && widgetRoot.value) {\n destroyWidget(props.reference.richObjectType, widgetRoot.value);\n rendered.value = false;\n }\n }\n function initResizeLimits() {\n const widgetEl = customWidgetContent.value?.firstElementChild;\n if (widgetEl) {\n const computedStyle = window.getComputedStyle(widgetEl);\n const parsedMin = parseFloat(computedStyle.minHeight);\n const parsedMax = parseFloat(computedStyle.maxHeight);\n resizeMinHeight.value = parsedMin > 0 ? parsedMin : 100;\n resizeMaxHeight.value = Number.isFinite(parsedMax) && parsedMax > 0 ? parsedMax : window.innerHeight - 120;\n } else {\n resizeMinHeight.value = 100;\n resizeMaxHeight.value = window.innerHeight - 120;\n }\n }\n function startResize(event) {\n if (!isWidgetResizable.value || !customWidget.value) {\n return;\n }\n initResizeLimits();\n isResizing.value = true;\n resizeStartY.value = event.clientY;\n resizeStartHeight.value = customWidget.value.getBoundingClientRect().height;\n window.addEventListener(\"pointermove\", onResize);\n window.addEventListener(\"pointerup\", stopResize);\n }\n function onResizeKeydown(delta) {\n if (!isWidgetResizable.value || !customWidget.value) {\n return;\n }\n initResizeLimits();\n const currentHeight = resizedHeight.value ?? resizeStartHeight.value;\n const next = currentHeight + delta;\n resizedHeight.value = Math.min(resizeMaxHeight.value, Math.max(resizeMinHeight.value, next));\n }\n function onResize(event) {\n if (!isResizing.value || !customWidget.value) {\n return;\n }\n const deltaY = event.clientY - resizeStartY.value;\n resizedHeight.value = Math.min(resizeMaxHeight.value, Math.max(resizeMinHeight.value, resizeStartHeight.value + deltaY));\n }\n function stopResize() {\n if (!isResizing.value) {\n return;\n }\n isResizing.value = false;\n window.removeEventListener(\"pointermove\", onResize);\n window.removeEventListener(\"pointerup\", stopResize);\n }\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", {\n ref_key: \"widgetRoot\",\n ref: widgetRoot,\n class: normalizeClass({ \"toggle-interactive\": referenceHasInteractiveView.value && !isInteractive.value })\n }, [\n __props.reference && hasCustomWidget.value ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n id: widgetId,\n ref_key: \"customWidget\",\n ref: customWidget,\n class: normalizeClass([\"widget-custom\", { \"full-width\": referenceHasFullWidth.value }]),\n style: normalizeStyle(customWidgetStyle.value)\n }, [\n createElementVNode(\"div\", {\n ref_key: \"customWidgetContent\",\n ref: customWidgetContent,\n class: \"widget-custom__content\"\n }, null, 512),\n isWidgetResizable.value ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: \"widget-custom__resize-handle\",\n role: \"slider\",\n tabindex: \"0\",\n \"aria-orientation\": \"vertical\",\n \"aria-label\": unref(t)(\"Widget height\"),\n \"aria-valuenow\": ariaValueNow.value,\n \"aria-valuemin\": resizeMinHeight.value,\n \"aria-valuemax\": resizeMaxHeight.value,\n \"aria-controls\": widgetId,\n onPointerdown: withModifiers(startResize, [\"stop\", \"prevent\"]),\n onKeydown: [\n _cache[0] || (_cache[0] = withKeys(withModifiers(($event) => onResizeKeydown(-RESIZE_KEYBOARD_STEP), [\"stop\", \"prevent\"]), [\"up\"])),\n _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => onResizeKeydown(RESIZE_KEYBOARD_STEP), [\"stop\", \"prevent\"]), [\"down\"]))\n ]\n }, null, 40, _hoisted_1)) : createCommentVNode(\"\", true)\n ], 6)) : !noAccess.value && __props.reference && __props.reference.openGraphObject && !hasCustomWidget.value ? (openBlock(), createBlock(resolveDynamicComponent(referenceWidgetLinkComponent.value), mergeProps({ key: 1 }, referenceWidgetLinkProps.value, {\n rel: \"noopener noreferrer\",\n class: \"widget-default\"\n }), {\n default: withCtx(() => [\n __props.reference.openGraphObject.thumb ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"widget-default--image\",\n src: __props.reference.openGraphObject.thumb\n }, null, 8, _hoisted_2)) : createCommentVNode(\"\", true),\n createElementVNode(\"div\", _hoisted_3, [\n createElementVNode(\"p\", _hoisted_4, toDisplayString(__props.reference.openGraphObject.name), 1),\n createElementVNode(\"p\", {\n class: \"widget-default--description\",\n style: normalizeStyle(descriptionStyle.value)\n }, toDisplayString(__props.reference.openGraphObject.description), 5),\n createElementVNode(\"p\", _hoisted_5, toDisplayString(compactLink.value), 1)\n ])\n ]),\n _: 1\n }, 16)) : createCommentVNode(\"\", true),\n __props.interactiveOptIn && referenceHasInteractiveView.value && !isInteractive.value ? (openBlock(), createBlock(NcButton, {\n key: 2,\n class: \"toggle-interactive--button\",\n onClick: enableInteractive\n }, {\n default: withCtx(() => [\n createTextVNode(toDisplayString(unref(t)(\"Enable interactive view\")), 1)\n ]),\n _: 1\n })) : createCommentVNode(\"\", true)\n ], 2);\n };\n }\n});\nconst NcReferenceWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-4b144346\"]]);\nexport {\n NcReferenceWidget as N\n};\n//# sourceMappingURL=NcReferenceWidget.mjs.map\n","import { d as mdiCheck, e as mdiContentCopy } from \"./mdi.mjs\";\nimport { ref, computed, toValue } from \"vue\";\nimport { r as register, e as t23, a as t } from \"./_l10n.mjs\";\nregister(t23);\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst DELAY = 2e3;\nfunction useCopy(content) {\n const isCopied = ref(false);\n const icon = computed(() => isCopied.value ? mdiCheck : mdiContentCopy);\n const altText = computed(() => isCopied.value ? t(\"Copied\") : t(\"Copy to clipboard\"));\n async function copy() {\n if (isCopied.value) {\n return;\n }\n const value = toValue(content);\n try {\n await navigator.clipboard.writeText(value);\n } catch {\n prompt(\"\", value);\n }\n isCopied.value = true;\n setTimeout(() => {\n isCopied.value = false;\n }, DELAY);\n }\n return {\n isCopied,\n copy,\n icon,\n altText\n };\n}\nexport {\n useCopy as u\n};\n//# sourceMappingURL=useCopy.mjs.map\n","import '../assets/NcRichText.css';\nimport { toString } from \"mdast-util-to-string\";\nimport rehypeExternalLinks from \"rehype-external-links\";\nimport rehype2react from \"rehype-react\";\nimport breaks from \"remark-breaks\";\nimport remarkParse from \"remark-parse\";\nimport remark2rehype from \"remark-rehype\";\nimport remarkUnlinkProtocols from \"remark-unlink-protocols\";\nimport { unified } from \"unified\";\nimport { resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createBlock, createCommentVNode, defineComponent, unref, withCtx, createVNode, h, ref } from \"vue\";\nimport { RouterLink } from \"vue-router\";\nimport { N as NcCheckboxRadioSwitch } from \"./NcCheckboxRadioSwitch.mjs\";\nimport { getCurrentUser } from \"@nextcloud/auth\";\nimport axios from \"@nextcloud/axios\";\nimport { generateOcsUrl } from \"@nextcloud/router\";\nimport { getSharingToken } from \"@nextcloud/sharing/public\";\nimport { N as NcReferenceWidget } from \"./NcReferenceWidget.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nimport { U as URL_PATTERN, g as getRoute, N as NcRichTextExternalLink, p as parseUrl, r as remarkAutolink } from \"./autolink.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { N as NcButton } from \"./NcButton.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper.mjs\";\nimport { u as useCopy } from \"./useCopy.mjs\";\nimport { c as createElementId } from \"./createElementId.mjs\";\nimport { u } from \"unist-builder\";\nimport { visitParents, EXIT, SKIP } from \"unist-util-visit-parents\";\nconst _sfc_main$2 = {\n name: \"NcReferenceList\",\n components: {\n NcReferenceWidget\n },\n props: {\n /**\n * The text to extract references from\n */\n text: {\n type: String,\n default: \"\"\n },\n /**\n * The data of the references to display.\n */\n referenceData: {\n type: Array,\n default: null\n },\n /**\n * The maximum number of references to display\n */\n limit: {\n type: Number,\n default: 1\n },\n /**\n * Show the fallback reference if no references are found\n */\n displayFallback: {\n type: Boolean,\n default: false\n },\n /**\n * Whether to render the widgets in interactive mode (if available)\n */\n interactive: {\n type: Boolean,\n default: true\n },\n /**\n * Whether to show user an option to enable to interactive mode for widgets (if available)\n */\n interactiveOptIn: {\n type: Boolean,\n default: false\n }\n },\n emits: [\"loaded\"],\n data() {\n return {\n references: null,\n loading: true\n };\n },\n computed: {\n isVisible() {\n return this.loading || this.displayedReferences.length !== 0;\n },\n values() {\n if (this.referenceData) {\n return this.referenceData;\n }\n if (this.displayFallback && !this.loading && !this.references) {\n return [this.fallbackReference];\n }\n return this.references ? Object.values(this.references) : [];\n },\n firstReference() {\n return this.values[0] ?? null;\n },\n displayedReferences() {\n return this.values.filter(Boolean).slice(0, this.limit);\n },\n fallbackReference() {\n return {\n accessible: true,\n openGraphObject: {\n id: this.text,\n link: this.text,\n name: this.text\n },\n richObjectType: \"open-graph\"\n };\n }\n },\n watch: {\n text: \"fetch\"\n },\n mounted() {\n this.fetch();\n },\n methods: {\n fetch() {\n this.loading = true;\n if (this.referenceData) {\n this.references = null;\n this.loading = false;\n return;\n }\n if (!new RegExp(URL_PATTERN).exec(this.text)) {\n this.references = null;\n this.loading = false;\n return;\n }\n this.resolve().then((response) => {\n this.references = response.data.ocs.data.references;\n this.loading = false;\n this.$emit(\"loaded\");\n }).catch((error) => {\n logger.error(\"[NcReferenceList] Failed to extract references\", { error });\n this.loading = false;\n this.$emit(\"loaded\");\n });\n },\n resolve() {\n const match = new RegExp(URL_PATTERN).exec(this.text.trim());\n const isPublic = getCurrentUser() === null;\n if (this.limit === 1 && match) {\n return isPublic ? axios.get(generateOcsUrl(\"references/resolvePublic\") + `?reference=${encodeURIComponent(match[0])}&sharingToken=${getSharingToken()}`) : axios.get(generateOcsUrl(\"references/resolve\") + `?reference=${encodeURIComponent(match[0])}`);\n }\n return isPublic ? axios.post(generateOcsUrl(\"references/extractPublic\"), {\n text: this.text,\n resolve: true,\n limit: this.limit,\n sharingToken: getSharingToken()\n }) : axios.post(generateOcsUrl(\"references/extract\"), {\n text: this.text,\n resolve: true,\n limit: this.limit\n });\n }\n }\n};\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcReferenceWidget = resolveComponent(\"NcReferenceWidget\");\n return $options.isVisible ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass([\"widgets--list\", { \"icon-loading\": $data.loading }])\n }, [\n (openBlock(true), createElementBlock(Fragment, null, renderList($options.displayedReferences, (reference) => {\n return openBlock(), createBlock(_component_NcReferenceWidget, {\n key: reference.openGraphObject?.id,\n reference,\n interactive: $props.interactive,\n interactiveOptIn: $props.interactiveOptIn\n }, null, 8, [\"reference\", \"interactive\", \"interactiveOptIn\"]);\n }), 128))\n ], 2)) : createCommentVNode(\"\", true);\n}\nconst NcReferenceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render], [\"__scopeId\", \"data-v-22575c85\"]]);\nfunction ccount(value, character) {\n const source = String(value);\n if (typeof character !== \"string\") {\n throw new TypeError(\"Expected character\");\n }\n let count = 0;\n let index = source.indexOf(character);\n while (index !== -1) {\n count++;\n index = source.indexOf(character, index + character.length);\n }\n return count;\n}\nfunction ok$1() {\n}\nconst asciiAlpha = regexCheck(/[A-Za-z]/);\nconst asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\nfunction asciiControl(code2) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code2 !== null && (code2 < 32 || code2 === 127)\n );\n}\nfunction markdownLineEnding(code2) {\n return code2 !== null && code2 < -2;\n}\nfunction markdownLineEndingOrSpace(code2) {\n return code2 !== null && (code2 < 0 || code2 === 32);\n}\nfunction markdownSpace(code2) {\n return code2 === -2 || code2 === -1 || code2 === 32;\n}\nconst unicodePunctuation = regexCheck(new RegExp(\"\\\\p{P}|\\\\p{S}\", \"u\"));\nconst unicodeWhitespace = regexCheck(/\\s/);\nfunction regexCheck(regex) {\n return check;\n function check(code2) {\n return code2 !== null && code2 > -1 && regex.test(String.fromCharCode(code2));\n }\n}\nfunction escapeStringRegexp(string) {\n if (typeof string !== \"string\") {\n throw new TypeError(\"Expected a string\");\n }\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\").replace(/-/g, \"\\\\x2d\");\n}\nconst convert = (\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n (function(test) {\n if (test === null || test === void 0) {\n return ok;\n }\n if (typeof test === \"function\") {\n return castFactory(test);\n }\n if (typeof test === \"object\") {\n return Array.isArray(test) ? anyFactory(test) : (\n // Cast because `ReadonlyArray` goes into the above but `isArray`\n // narrows to `Array`.\n propertiesFactory(\n /** @type {Props} */\n test\n )\n );\n }\n if (typeof test === \"string\") {\n return typeFactory(test);\n }\n throw new Error(\"Expected function, string, or object as test\");\n })\n);\nfunction anyFactory(tests) {\n const checks = [];\n let index = -1;\n while (++index < tests.length) {\n checks[index] = convert(tests[index]);\n }\n return castFactory(any);\n function any(...parameters) {\n let index2 = -1;\n while (++index2 < checks.length) {\n if (checks[index2].apply(this, parameters)) return true;\n }\n return false;\n }\n}\nfunction propertiesFactory(check) {\n const checkAsRecord = (\n /** @type {Record} */\n check\n );\n return castFactory(all);\n function all(node) {\n const nodeAsRecord = (\n /** @type {Record} */\n /** @type {unknown} */\n node\n );\n let key;\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false;\n }\n return true;\n }\n}\nfunction typeFactory(check) {\n return castFactory(type);\n function type(node) {\n return node && node.type === check;\n }\n}\nfunction castFactory(testFunction) {\n return check;\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) && testFunction.call(\n this,\n value,\n typeof index === \"number\" ? index : void 0,\n parent || void 0\n )\n );\n }\n}\nfunction ok() {\n return true;\n}\nfunction looksLikeANode(value) {\n return value !== null && typeof value === \"object\" && \"type\" in value;\n}\nfunction findAndReplace(tree, list2, options) {\n const settings = options || {};\n const ignored = convert(settings.ignore || []);\n const pairs = toPairs(list2);\n let pairIndex = -1;\n while (++pairIndex < pairs.length) {\n visitParents(tree, \"text\", visitor);\n }\n function visitor(node, parents) {\n let index = -1;\n let grandparent;\n while (++index < parents.length) {\n const parent = parents[index];\n const siblings = grandparent ? grandparent.children : void 0;\n if (ignored(\n parent,\n siblings ? siblings.indexOf(parent) : void 0,\n grandparent\n )) {\n return;\n }\n grandparent = parent;\n }\n if (grandparent) {\n return handler(node, parents);\n }\n }\n function handler(node, parents) {\n const parent = parents[parents.length - 1];\n const find = pairs[pairIndex][0];\n const replace2 = pairs[pairIndex][1];\n let start = 0;\n const siblings = parent.children;\n const index = siblings.indexOf(node);\n let change = false;\n let nodes = [];\n find.lastIndex = 0;\n let match = find.exec(node.value);\n while (match) {\n const position = match.index;\n const matchObject = {\n index: match.index,\n input: match.input,\n stack: [...parents, node]\n };\n let value = replace2(...match, matchObject);\n if (typeof value === \"string\") {\n value = value.length > 0 ? { type: \"text\", value } : void 0;\n }\n if (value === false) {\n find.lastIndex = position + 1;\n } else {\n if (start !== position) {\n nodes.push({\n type: \"text\",\n value: node.value.slice(start, position)\n });\n }\n if (Array.isArray(value)) {\n nodes.push(...value);\n } else if (value) {\n nodes.push(value);\n }\n start = position + match[0].length;\n change = true;\n }\n if (!find.global) {\n break;\n }\n match = find.exec(node.value);\n }\n if (change) {\n if (start < node.value.length) {\n nodes.push({ type: \"text\", value: node.value.slice(start) });\n }\n parent.children.splice(index, 1, ...nodes);\n } else {\n nodes = [node];\n }\n return index + nodes.length;\n }\n}\nfunction toPairs(tupleOrList) {\n const result = [];\n if (!Array.isArray(tupleOrList)) {\n throw new TypeError(\"Expected find and replace tuple or list of tuples\");\n }\n const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];\n let index = -1;\n while (++index < list2.length) {\n const tuple = list2[index];\n result.push([toExpression(tuple[0]), toFunction(tuple[1])]);\n }\n return result;\n}\nfunction toExpression(find) {\n return typeof find === \"string\" ? new RegExp(escapeStringRegexp(find), \"g\") : find;\n}\nfunction toFunction(replace2) {\n return typeof replace2 === \"function\" ? replace2 : function() {\n return replace2;\n };\n}\nconst inConstruct = \"phrasing\";\nconst notInConstruct = [\"autolink\", \"link\", \"image\", \"label\"];\nfunction gfmAutolinkLiteralFromMarkdown() {\n return {\n transforms: [transformGfmAutolinkLiterals],\n enter: {\n literalAutolink: enterLiteralAutolink,\n literalAutolinkEmail: enterLiteralAutolinkValue,\n literalAutolinkHttp: enterLiteralAutolinkValue,\n literalAutolinkWww: enterLiteralAutolinkValue\n },\n exit: {\n literalAutolink: exitLiteralAutolink,\n literalAutolinkEmail: exitLiteralAutolinkEmail,\n literalAutolinkHttp: exitLiteralAutolinkHttp,\n literalAutolinkWww: exitLiteralAutolinkWww\n }\n };\n}\nfunction gfmAutolinkLiteralToMarkdown() {\n return {\n unsafe: [\n {\n character: \"@\",\n before: \"[+\\\\-.\\\\w]\",\n after: \"[\\\\-.\\\\w]\",\n inConstruct,\n notInConstruct\n },\n {\n character: \".\",\n before: \"[Ww]\",\n after: \"[\\\\-.\\\\w]\",\n inConstruct,\n notInConstruct\n },\n {\n character: \":\",\n before: \"[ps]\",\n after: \"\\\\/\",\n inConstruct,\n notInConstruct\n }\n ]\n };\n}\nfunction enterLiteralAutolink(token) {\n this.enter({ type: \"link\", title: null, url: \"\", children: [] }, token);\n}\nfunction enterLiteralAutolinkValue(token) {\n this.config.enter.autolinkProtocol.call(this, token);\n}\nfunction exitLiteralAutolinkHttp(token) {\n this.config.exit.autolinkProtocol.call(this, token);\n}\nfunction exitLiteralAutolinkWww(token) {\n this.config.exit.data.call(this, token);\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"link\");\n node.url = \"http://\" + this.sliceSerialize(token);\n}\nfunction exitLiteralAutolinkEmail(token) {\n this.config.exit.autolinkEmail.call(this, token);\n}\nfunction exitLiteralAutolink(token) {\n this.exit(token);\n}\nfunction transformGfmAutolinkLiterals(tree) {\n findAndReplace(\n tree,\n [\n [/(https?:\\/\\/|www(?=\\.))([-.\\w]+)([^ \\t\\r\\n]*)/gi, findUrl],\n [/([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)/g, findEmail]\n ],\n { ignore: [\"link\", \"linkReference\"] }\n );\n}\nfunction findUrl(_, protocol, domain2, path2, match) {\n let prefix = \"\";\n if (!previous(match)) {\n return false;\n }\n if (/^w/i.test(protocol)) {\n domain2 = protocol + domain2;\n protocol = \"\";\n prefix = \"http://\";\n }\n if (!isCorrectDomain(domain2)) {\n return false;\n }\n const parts = splitUrl(domain2 + path2);\n if (!parts[0]) return false;\n const result = {\n type: \"link\",\n title: null,\n url: prefix + protocol + parts[0],\n children: [{ type: \"text\", value: protocol + parts[0] }]\n };\n if (parts[1]) {\n return [result, { type: \"text\", value: parts[1] }];\n }\n return result;\n}\nfunction findEmail(_, atext, label, match) {\n if (\n // Not an expected previous character.\n !previous(match, true) || // Label ends in not allowed character.\n /[-\\d_]$/.test(label)\n ) {\n return false;\n }\n return {\n type: \"link\",\n title: null,\n url: \"mailto:\" + atext + \"@\" + label,\n children: [{ type: \"text\", value: atext + \"@\" + label }]\n };\n}\nfunction isCorrectDomain(domain2) {\n const parts = domain2.split(\".\");\n if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\\d]/.test(parts[parts.length - 2]))) {\n return false;\n }\n return true;\n}\nfunction splitUrl(url) {\n const trailExec = /[!\"&'),.:;<>?\\]}]+$/.exec(url);\n if (!trailExec) {\n return [url, void 0];\n }\n url = url.slice(0, trailExec.index);\n let trail2 = trailExec[0];\n let closingParenIndex = trail2.indexOf(\")\");\n const openingParens = ccount(url, \"(\");\n let closingParens = ccount(url, \")\");\n while (closingParenIndex !== -1 && openingParens > closingParens) {\n url += trail2.slice(0, closingParenIndex + 1);\n trail2 = trail2.slice(closingParenIndex + 1);\n closingParenIndex = trail2.indexOf(\")\");\n closingParens++;\n }\n return [url, trail2];\n}\nfunction previous(match, email) {\n const code2 = match.input.charCodeAt(match.index - 1);\n return (match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2)) && (!email || code2 !== 47);\n}\nfunction normalizeIdentifier(value) {\n return value.replace(/[\\t\\n\\r ]+/g, \" \").replace(/^ | $/g, \"\").toLowerCase().toUpperCase();\n}\nfootnoteReference.peek = footnoteReferencePeek;\nfunction enterFootnoteCallString() {\n this.buffer();\n}\nfunction enterFootnoteCall(token) {\n this.enter({ type: \"footnoteReference\", identifier: \"\", label: \"\" }, token);\n}\nfunction enterFootnoteDefinitionLabelString() {\n this.buffer();\n}\nfunction enterFootnoteDefinition(token) {\n this.enter(\n { type: \"footnoteDefinition\", identifier: \"\", label: \"\", children: [] },\n token\n );\n}\nfunction exitFootnoteCallString(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"footnoteReference\");\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase();\n node.label = label;\n}\nfunction exitFootnoteCall(token) {\n this.exit(token);\n}\nfunction exitFootnoteDefinitionLabelString(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"footnoteDefinition\");\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase();\n node.label = label;\n}\nfunction exitFootnoteDefinition(token) {\n this.exit(token);\n}\nfunction footnoteReferencePeek() {\n return \"[\";\n}\nfunction footnoteReference(node, _, state, info) {\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[^\");\n const exit2 = state.enter(\"footnoteReference\");\n const subexit = state.enter(\"reference\");\n value += tracker.move(\n state.safe(state.associationId(node), { after: \"]\", before: value })\n );\n subexit();\n exit2();\n value += tracker.move(\"]\");\n return value;\n}\nfunction gfmFootnoteFromMarkdown() {\n return {\n enter: {\n gfmFootnoteCallString: enterFootnoteCallString,\n gfmFootnoteCall: enterFootnoteCall,\n gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: enterFootnoteDefinition\n },\n exit: {\n gfmFootnoteCallString: exitFootnoteCallString,\n gfmFootnoteCall: exitFootnoteCall,\n gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: exitFootnoteDefinition\n }\n };\n}\nfunction gfmFootnoteToMarkdown(options) {\n let firstLineBlank = false;\n if (options && options.firstLineBlank) {\n firstLineBlank = true;\n }\n return {\n handlers: { footnoteDefinition, footnoteReference },\n // This is on by default already.\n unsafe: [{ character: \"[\", inConstruct: [\"label\", \"phrasing\", \"reference\"] }]\n };\n function footnoteDefinition(node, _, state, info) {\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[^\");\n const exit2 = state.enter(\"footnoteDefinition\");\n const subexit = state.enter(\"label\");\n value += tracker.move(\n state.safe(state.associationId(node), { before: value, after: \"]\" })\n );\n subexit();\n value += tracker.move(\"]:\");\n if (node.children && node.children.length > 0) {\n tracker.shift(4);\n value += tracker.move(\n (firstLineBlank ? \"\\n\" : \" \") + state.indentLines(\n state.containerFlow(node, tracker.current()),\n firstLineBlank ? mapAll : mapExceptFirst\n )\n );\n }\n exit2();\n return value;\n }\n}\nfunction mapExceptFirst(line, index, blank) {\n return index === 0 ? line : mapAll(line, index, blank);\n}\nfunction mapAll(line, index, blank) {\n return (blank ? \"\" : \" \") + line;\n}\nconst constructsWithoutStrikethrough = [\n \"autolink\",\n \"destinationLiteral\",\n \"destinationRaw\",\n \"reference\",\n \"titleQuote\",\n \"titleApostrophe\"\n];\nhandleDelete.peek = peekDelete;\nfunction gfmStrikethroughFromMarkdown() {\n return {\n canContainEols: [\"delete\"],\n enter: { strikethrough: enterStrikethrough },\n exit: { strikethrough: exitStrikethrough }\n };\n}\nfunction gfmStrikethroughToMarkdown() {\n return {\n unsafe: [\n {\n character: \"~\",\n inConstruct: \"phrasing\",\n notInConstruct: constructsWithoutStrikethrough\n }\n ],\n handlers: { delete: handleDelete }\n };\n}\nfunction enterStrikethrough(token) {\n this.enter({ type: \"delete\", children: [] }, token);\n}\nfunction exitStrikethrough(token) {\n this.exit(token);\n}\nfunction handleDelete(node, _, state, info) {\n const tracker = state.createTracker(info);\n const exit2 = state.enter(\"strikethrough\");\n let value = tracker.move(\"~~\");\n value += state.containerPhrasing(node, {\n ...tracker.current(),\n before: value,\n after: \"~\"\n });\n value += tracker.move(\"~~\");\n exit2();\n return value;\n}\nfunction peekDelete() {\n return \"~\";\n}\nfunction defaultStringLength(value) {\n return value.length;\n}\nfunction markdownTable(table, options) {\n const settings = options || {};\n const align = (settings.align || []).concat();\n const stringLength = settings.stringLength || defaultStringLength;\n const alignments = [];\n const cellMatrix = [];\n const sizeMatrix = [];\n const longestCellByColumn = [];\n let mostCellsPerRow = 0;\n let rowIndex = -1;\n while (++rowIndex < table.length) {\n const row2 = [];\n const sizes2 = [];\n let columnIndex2 = -1;\n if (table[rowIndex].length > mostCellsPerRow) {\n mostCellsPerRow = table[rowIndex].length;\n }\n while (++columnIndex2 < table[rowIndex].length) {\n const cell = serialize(table[rowIndex][columnIndex2]);\n if (settings.alignDelimiters !== false) {\n const size = stringLength(cell);\n sizes2[columnIndex2] = size;\n if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {\n longestCellByColumn[columnIndex2] = size;\n }\n }\n row2.push(cell);\n }\n cellMatrix[rowIndex] = row2;\n sizeMatrix[rowIndex] = sizes2;\n }\n let columnIndex = -1;\n if (typeof align === \"object\" && \"length\" in align) {\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = toAlignment(align[columnIndex]);\n }\n } else {\n const code2 = toAlignment(align);\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = code2;\n }\n }\n columnIndex = -1;\n const row = [];\n const sizes = [];\n while (++columnIndex < mostCellsPerRow) {\n const code2 = alignments[columnIndex];\n let before = \"\";\n let after = \"\";\n if (code2 === 99) {\n before = \":\";\n after = \":\";\n } else if (code2 === 108) {\n before = \":\";\n } else if (code2 === 114) {\n after = \":\";\n }\n let size = settings.alignDelimiters === false ? 1 : Math.max(\n 1,\n longestCellByColumn[columnIndex] - before.length - after.length\n );\n const cell = before + \"-\".repeat(size) + after;\n if (settings.alignDelimiters !== false) {\n size = before.length + size + after.length;\n if (size > longestCellByColumn[columnIndex]) {\n longestCellByColumn[columnIndex] = size;\n }\n sizes[columnIndex] = size;\n }\n row[columnIndex] = cell;\n }\n cellMatrix.splice(1, 0, row);\n sizeMatrix.splice(1, 0, sizes);\n rowIndex = -1;\n const lines = [];\n while (++rowIndex < cellMatrix.length) {\n const row2 = cellMatrix[rowIndex];\n const sizes2 = sizeMatrix[rowIndex];\n columnIndex = -1;\n const line = [];\n while (++columnIndex < mostCellsPerRow) {\n const cell = row2[columnIndex] || \"\";\n let before = \"\";\n let after = \"\";\n if (settings.alignDelimiters !== false) {\n const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);\n const code2 = alignments[columnIndex];\n if (code2 === 114) {\n before = \" \".repeat(size);\n } else if (code2 === 99) {\n if (size % 2) {\n before = \" \".repeat(size / 2 + 0.5);\n after = \" \".repeat(size / 2 - 0.5);\n } else {\n before = \" \".repeat(size / 2);\n after = before;\n }\n } else {\n after = \" \".repeat(size);\n }\n }\n if (settings.delimiterStart !== false && !columnIndex) {\n line.push(\"|\");\n }\n if (settings.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is\n // empty: there will be a closing space.\n !(settings.alignDelimiters === false && cell === \"\") && (settings.delimiterStart !== false || columnIndex)) {\n line.push(\" \");\n }\n if (settings.alignDelimiters !== false) {\n line.push(before);\n }\n line.push(cell);\n if (settings.alignDelimiters !== false) {\n line.push(after);\n }\n if (settings.padding !== false) {\n line.push(\" \");\n }\n if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {\n line.push(\"|\");\n }\n }\n lines.push(\n settings.delimiterEnd === false ? line.join(\"\").replace(/ +$/, \"\") : line.join(\"\")\n );\n }\n return lines.join(\"\\n\");\n}\nfunction serialize(value) {\n return value === null || value === void 0 ? \"\" : String(value);\n}\nfunction toAlignment(value) {\n const code2 = typeof value === \"string\" ? value.codePointAt(0) : 0;\n return code2 === 67 || code2 === 99 ? 99 : code2 === 76 || code2 === 108 ? 108 : code2 === 82 || code2 === 114 ? 114 : 0;\n}\nfunction blockquote(node, _, state, info) {\n const exit2 = state.enter(\"blockquote\");\n const tracker = state.createTracker(info);\n tracker.move(\"> \");\n tracker.shift(2);\n const value = state.indentLines(\n state.containerFlow(node, tracker.current()),\n map$1\n );\n exit2();\n return value;\n}\nfunction map$1(line, _, blank) {\n return \">\" + (blank ? \"\" : \" \") + line;\n}\nfunction patternInScope(stack, pattern) {\n return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);\n}\nfunction listInScope(stack, list2, none) {\n if (typeof list2 === \"string\") {\n list2 = [list2];\n }\n if (!list2 || list2.length === 0) {\n return none;\n }\n let index = -1;\n while (++index < list2.length) {\n if (stack.includes(list2[index])) {\n return true;\n }\n }\n return false;\n}\nfunction hardBreak(_, _1, state, info) {\n let index = -1;\n while (++index < state.unsafe.length) {\n if (state.unsafe[index].character === \"\\n\" && patternInScope(state.stack, state.unsafe[index])) {\n return /[ \\t]/.test(info.before) ? \"\" : \" \";\n }\n }\n return \"\\\\\\n\";\n}\nfunction longestStreak(value, substring) {\n const source = String(value);\n let index = source.indexOf(substring);\n let expected = index;\n let count = 0;\n let max = 0;\n if (typeof substring !== \"string\") {\n throw new TypeError(\"Expected substring\");\n }\n while (index !== -1) {\n if (index === expected) {\n if (++count > max) {\n max = count;\n }\n } else {\n count = 1;\n }\n expected = index + substring.length;\n index = source.indexOf(substring, expected);\n }\n return max;\n}\nfunction formatCodeAsIndented(node, state) {\n return Boolean(\n state.options.fences === false && node.value && // If there’s no info…\n !node.lang && // And there’s a non-whitespace character…\n /[^ \\r\\n]/.test(node.value) && // And the value doesn’t start or end in a blank…\n !/^[\\t ]*(?:[\\r\\n]|$)|(?:^|[\\r\\n])[\\t ]*$/.test(node.value)\n );\n}\nfunction checkFence(state) {\n const marker = state.options.fence || \"`\";\n if (marker !== \"`\" && marker !== \"~\") {\n throw new Error(\n \"Cannot serialize code with `\" + marker + \"` for `options.fence`, expected `` ` `` or `~`\"\n );\n }\n return marker;\n}\nfunction code$1(node, _, state, info) {\n const marker = checkFence(state);\n const raw = node.value || \"\";\n const suffix = marker === \"`\" ? \"GraveAccent\" : \"Tilde\";\n if (formatCodeAsIndented(node, state)) {\n const exit3 = state.enter(\"codeIndented\");\n const value2 = state.indentLines(raw, map);\n exit3();\n return value2;\n }\n const tracker = state.createTracker(info);\n const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));\n const exit2 = state.enter(\"codeFenced\");\n let value = tracker.move(sequence);\n if (node.lang) {\n const subexit = state.enter(`codeFencedLang${suffix}`);\n value += tracker.move(\n state.safe(node.lang, {\n before: value,\n after: \" \",\n encode: [\"`\"],\n ...tracker.current()\n })\n );\n subexit();\n }\n if (node.lang && node.meta) {\n const subexit = state.enter(`codeFencedMeta${suffix}`);\n value += tracker.move(\" \");\n value += tracker.move(\n state.safe(node.meta, {\n before: value,\n after: \"\\n\",\n encode: [\"`\"],\n ...tracker.current()\n })\n );\n subexit();\n }\n value += tracker.move(\"\\n\");\n if (raw) {\n value += tracker.move(raw + \"\\n\");\n }\n value += tracker.move(sequence);\n exit2();\n return value;\n}\nfunction map(line, _, blank) {\n return (blank ? \"\" : \" \") + line;\n}\nfunction checkQuote(state) {\n const marker = state.options.quote || '\"';\n if (marker !== '\"' && marker !== \"'\") {\n throw new Error(\n \"Cannot serialize title with `\" + marker + \"` for `options.quote`, expected `\\\"`, or `'`\"\n );\n }\n return marker;\n}\nfunction definition(node, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const exit2 = state.enter(\"definition\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[\");\n value += tracker.move(\n state.safe(state.associationId(node), {\n before: value,\n after: \"]\",\n ...tracker.current()\n })\n );\n value += tracker.move(\"]: \");\n subexit();\n if (\n // If there’s no url, or…\n !node.url || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? \" \" : \"\\n\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n exit2();\n return value;\n}\nfunction checkEmphasis(state) {\n const marker = state.options.emphasis || \"*\";\n if (marker !== \"*\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize emphasis with `\" + marker + \"` for `options.emphasis`, expected `*`, or `_`\"\n );\n }\n return marker;\n}\nfunction encodeCharacterReference(code2) {\n return \"&#x\" + code2.toString(16).toUpperCase() + \";\";\n}\nfunction classifyCharacter(code2) {\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return 1;\n }\n if (unicodePunctuation(code2)) {\n return 2;\n }\n}\nfunction encodeInfo(outside, inside, marker) {\n const outsideKind = classifyCharacter(outside);\n const insideKind = classifyCharacter(inside);\n if (outsideKind === void 0) {\n return insideKind === void 0 ? (\n // Letter inside:\n // we have to encode *both* letters for `_` as it is looser.\n // it already forms for `*` (and GFMs `~`).\n marker === \"_\" ? { inside: true, outside: true } : { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode both (letter, whitespace).\n { inside: true, outside: true }\n ) : (\n // Punctuation inside: encode outer (letter)\n { inside: false, outside: true }\n );\n }\n if (outsideKind === 1) {\n return insideKind === void 0 ? (\n // Letter inside: already forms.\n { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode both (whitespace).\n { inside: true, outside: true }\n ) : (\n // Punctuation inside: already forms.\n { inside: false, outside: false }\n );\n }\n return insideKind === void 0 ? (\n // Letter inside: already forms.\n { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode inner (whitespace).\n { inside: true, outside: false }\n ) : (\n // Punctuation inside: already forms.\n { inside: false, outside: false }\n );\n}\nemphasis.peek = emphasisPeek;\nfunction emphasis(node, _, state, info) {\n const marker = checkEmphasis(state);\n const exit2 = state.enter(\"emphasis\");\n const tracker = state.createTracker(info);\n const before = tracker.move(marker);\n let between = tracker.move(\n state.containerPhrasing(node, {\n after: marker,\n before,\n ...tracker.current()\n })\n );\n const betweenHead = between.charCodeAt(0);\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n );\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1);\n }\n const betweenTail = between.charCodeAt(between.length - 1);\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail);\n }\n const after = tracker.move(marker);\n exit2();\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n };\n return before + between + after;\n}\nfunction emphasisPeek(_, _1, state) {\n return state.options.emphasis || \"*\";\n}\nfunction visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n let reverse;\n let test;\n let visitor;\n if (typeof testOrVisitor === \"function\" && typeof visitorOrReverse !== \"function\") {\n test = void 0;\n visitor = testOrVisitor;\n reverse = visitorOrReverse;\n } else {\n test = testOrVisitor;\n visitor = visitorOrReverse;\n reverse = maybeReverse;\n }\n visitParents(tree, test, overload, reverse);\n function overload(node, parents) {\n const parent = parents[parents.length - 1];\n const index = parent ? parent.children.indexOf(node) : void 0;\n return visitor(node, index, parent);\n }\n}\nfunction formatHeadingAsSetext(node, state) {\n let literalWithBreak = false;\n visit(node, function(node2) {\n if (\"value\" in node2 && /\\r?\\n|\\r/.test(node2.value) || node2.type === \"break\") {\n literalWithBreak = true;\n return EXIT;\n }\n });\n return Boolean(\n (!node.depth || node.depth < 3) && toString(node) && (state.options.setext || literalWithBreak)\n );\n}\nfunction heading(node, _, state, info) {\n const rank = Math.max(Math.min(6, node.depth || 1), 1);\n const tracker = state.createTracker(info);\n if (formatHeadingAsSetext(node, state)) {\n const exit3 = state.enter(\"headingSetext\");\n const subexit2 = state.enter(\"phrasing\");\n const value2 = state.containerPhrasing(node, {\n ...tracker.current(),\n before: \"\\n\",\n after: \"\\n\"\n });\n subexit2();\n exit3();\n return value2 + \"\\n\" + (rank === 1 ? \"=\" : \"-\").repeat(\n // The whole size…\n value2.length - // Minus the position of the character after the last EOL (or\n // 0 if there is none)…\n (Math.max(value2.lastIndexOf(\"\\r\"), value2.lastIndexOf(\"\\n\")) + 1)\n );\n }\n const sequence = \"#\".repeat(rank);\n const exit2 = state.enter(\"headingAtx\");\n const subexit = state.enter(\"phrasing\");\n tracker.move(sequence + \" \");\n let value = state.containerPhrasing(node, {\n before: \"# \",\n after: \"\\n\",\n ...tracker.current()\n });\n if (/^[\\t ]/.test(value)) {\n value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);\n }\n value = value ? sequence + \" \" + value : sequence;\n if (state.options.closeAtx) {\n value += \" \" + sequence;\n }\n subexit();\n exit2();\n return value;\n}\nhtml.peek = htmlPeek;\nfunction html(node) {\n return node.value || \"\";\n}\nfunction htmlPeek() {\n return \"<\";\n}\nimage.peek = imagePeek;\nfunction image(node, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const exit2 = state.enter(\"image\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"![\");\n value += tracker.move(\n state.safe(node.alt, { before: value, after: \"]\", ...tracker.current() })\n );\n value += tracker.move(\"](\");\n subexit();\n if (\n // If there’s no url but there is a title…\n !node.url && node.title || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? \" \" : \")\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n value += tracker.move(\")\");\n exit2();\n return value;\n}\nfunction imagePeek() {\n return \"!\";\n}\nimageReference.peek = imageReferencePeek;\nfunction imageReference(node, _, state, info) {\n const type = node.referenceType;\n const exit2 = state.enter(\"imageReference\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"![\");\n const alt = state.safe(node.alt, {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n value += tracker.move(alt + \"][\");\n subexit();\n const stack = state.stack;\n state.stack = [];\n subexit = state.enter(\"reference\");\n const reference = state.safe(state.associationId(node), {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n subexit();\n state.stack = stack;\n exit2();\n if (type === \"full\" || !alt || alt !== reference) {\n value += tracker.move(reference + \"]\");\n } else if (type === \"shortcut\") {\n value = value.slice(0, -1);\n } else {\n value += tracker.move(\"]\");\n }\n return value;\n}\nfunction imageReferencePeek() {\n return \"!\";\n}\ninlineCode.peek = inlineCodePeek;\nfunction inlineCode(node, _, state) {\n let value = node.value || \"\";\n let sequence = \"`\";\n let index = -1;\n while (new RegExp(\"(^|[^`])\" + sequence + \"([^`]|$)\").test(value)) {\n sequence += \"`\";\n }\n if (/[^ \\r\\n]/.test(value) && (/^[ \\r\\n]/.test(value) && /[ \\r\\n]$/.test(value) || /^`|`$/.test(value))) {\n value = \" \" + value + \" \";\n }\n while (++index < state.unsafe.length) {\n const pattern = state.unsafe[index];\n const expression = state.compilePattern(pattern);\n let match;\n if (!pattern.atBreak) continue;\n while (match = expression.exec(value)) {\n let position = match.index;\n if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {\n position--;\n }\n value = value.slice(0, position) + \" \" + value.slice(match.index + 1);\n }\n }\n return sequence + value + sequence;\n}\nfunction inlineCodePeek() {\n return \"`\";\n}\nfunction formatLinkAsAutolink(node, state) {\n const raw = toString(node);\n return Boolean(\n !state.options.resourceLink && // If there’s a url…\n node.url && // And there’s a no title…\n !node.title && // And the content of `node` is a single text node…\n node.children && node.children.length === 1 && node.children[0].type === \"text\" && // And if the url is the same as the content…\n (raw === node.url || \"mailto:\" + raw === node.url) && // And that starts w/ a protocol…\n /^[a-z][a-z+.-]+:/i.test(node.url) && // And that doesn’t contain ASCII control codes (character escapes and\n // references don’t work), space, or angle brackets…\n !/[\\0- <>\\u007F]/.test(node.url)\n );\n}\nlink.peek = linkPeek;\nfunction link(node, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const tracker = state.createTracker(info);\n let exit2;\n let subexit;\n if (formatLinkAsAutolink(node, state)) {\n const stack = state.stack;\n state.stack = [];\n exit2 = state.enter(\"autolink\");\n let value2 = tracker.move(\"<\");\n value2 += tracker.move(\n state.containerPhrasing(node, {\n before: value2,\n after: \">\",\n ...tracker.current()\n })\n );\n value2 += tracker.move(\">\");\n exit2();\n state.stack = stack;\n return value2;\n }\n exit2 = state.enter(\"link\");\n subexit = state.enter(\"label\");\n let value = tracker.move(\"[\");\n value += tracker.move(\n state.containerPhrasing(node, {\n before: value,\n after: \"](\",\n ...tracker.current()\n })\n );\n value += tracker.move(\"](\");\n subexit();\n if (\n // If there’s no url but there is a title…\n !node.url && node.title || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? \" \" : \")\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n value += tracker.move(\")\");\n exit2();\n return value;\n}\nfunction linkPeek(node, _, state) {\n return formatLinkAsAutolink(node, state) ? \"<\" : \"[\";\n}\nlinkReference.peek = linkReferencePeek;\nfunction linkReference(node, _, state, info) {\n const type = node.referenceType;\n const exit2 = state.enter(\"linkReference\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[\");\n const text2 = state.containerPhrasing(node, {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n value += tracker.move(text2 + \"][\");\n subexit();\n const stack = state.stack;\n state.stack = [];\n subexit = state.enter(\"reference\");\n const reference = state.safe(state.associationId(node), {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n subexit();\n state.stack = stack;\n exit2();\n if (type === \"full\" || !text2 || text2 !== reference) {\n value += tracker.move(reference + \"]\");\n } else if (type === \"shortcut\") {\n value = value.slice(0, -1);\n } else {\n value += tracker.move(\"]\");\n }\n return value;\n}\nfunction linkReferencePeek() {\n return \"[\";\n}\nfunction checkBullet(state) {\n const marker = state.options.bullet || \"*\";\n if (marker !== \"*\" && marker !== \"+\" && marker !== \"-\") {\n throw new Error(\n \"Cannot serialize items with `\" + marker + \"` for `options.bullet`, expected `*`, `+`, or `-`\"\n );\n }\n return marker;\n}\nfunction checkBulletOther(state) {\n const bullet = checkBullet(state);\n const bulletOther = state.options.bulletOther;\n if (!bulletOther) {\n return bullet === \"*\" ? \"-\" : \"*\";\n }\n if (bulletOther !== \"*\" && bulletOther !== \"+\" && bulletOther !== \"-\") {\n throw new Error(\n \"Cannot serialize items with `\" + bulletOther + \"` for `options.bulletOther`, expected `*`, `+`, or `-`\"\n );\n }\n if (bulletOther === bullet) {\n throw new Error(\n \"Expected `bullet` (`\" + bullet + \"`) and `bulletOther` (`\" + bulletOther + \"`) to be different\"\n );\n }\n return bulletOther;\n}\nfunction checkBulletOrdered(state) {\n const marker = state.options.bulletOrdered || \".\";\n if (marker !== \".\" && marker !== \")\") {\n throw new Error(\n \"Cannot serialize items with `\" + marker + \"` for `options.bulletOrdered`, expected `.` or `)`\"\n );\n }\n return marker;\n}\nfunction checkRule(state) {\n const marker = state.options.rule || \"*\";\n if (marker !== \"*\" && marker !== \"-\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize rules with `\" + marker + \"` for `options.rule`, expected `*`, `-`, or `_`\"\n );\n }\n return marker;\n}\nfunction list(node, parent, state, info) {\n const exit2 = state.enter(\"list\");\n const bulletCurrent = state.bulletCurrent;\n let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state);\n const bulletOther = node.ordered ? bullet === \".\" ? \")\" : \".\" : checkBulletOther(state);\n let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;\n if (!node.ordered) {\n const firstListItem = node.children ? node.children[0] : void 0;\n if (\n // Bullet could be used as a thematic break marker:\n (bullet === \"*\" || bullet === \"-\") && // Empty first list item:\n firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:\n state.stack[state.stack.length - 1] === \"list\" && state.stack[state.stack.length - 2] === \"listItem\" && state.stack[state.stack.length - 3] === \"list\" && state.stack[state.stack.length - 4] === \"listItem\" && // That are each the first child.\n state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0\n ) {\n useDifferentMarker = true;\n }\n if (checkRule(state) === bullet && firstListItem) {\n let index = -1;\n while (++index < node.children.length) {\n const item = node.children[index];\n if (item && item.type === \"listItem\" && item.children && item.children[0] && item.children[0].type === \"thematicBreak\") {\n useDifferentMarker = true;\n break;\n }\n }\n }\n }\n if (useDifferentMarker) {\n bullet = bulletOther;\n }\n state.bulletCurrent = bullet;\n const value = state.containerFlow(node, info);\n state.bulletLastUsed = bullet;\n state.bulletCurrent = bulletCurrent;\n exit2();\n return value;\n}\nfunction checkListItemIndent(state) {\n const style = state.options.listItemIndent || \"one\";\n if (style !== \"tab\" && style !== \"one\" && style !== \"mixed\") {\n throw new Error(\n \"Cannot serialize items with `\" + style + \"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`\"\n );\n }\n return style;\n}\nfunction listItem(node, parent, state, info) {\n const listItemIndent = checkListItemIndent(state);\n let bullet = state.bulletCurrent || checkBullet(state);\n if (parent && parent.type === \"list\" && parent.ordered) {\n bullet = (typeof parent.start === \"number\" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node)) + bullet;\n }\n let size = bullet.length + 1;\n if (listItemIndent === \"tab\" || listItemIndent === \"mixed\" && (parent && parent.type === \"list\" && parent.spread || node.spread)) {\n size = Math.ceil(size / 4) * 4;\n }\n const tracker = state.createTracker(info);\n tracker.move(bullet + \" \".repeat(size - bullet.length));\n tracker.shift(size);\n const exit2 = state.enter(\"listItem\");\n const value = state.indentLines(\n state.containerFlow(node, tracker.current()),\n map2\n );\n exit2();\n return value;\n function map2(line, index, blank) {\n if (index) {\n return (blank ? \"\" : \" \".repeat(size)) + line;\n }\n return (blank ? bullet : bullet + \" \".repeat(size - bullet.length)) + line;\n }\n}\nfunction paragraph(node, _, state, info) {\n const exit2 = state.enter(\"paragraph\");\n const subexit = state.enter(\"phrasing\");\n const value = state.containerPhrasing(node, info);\n subexit();\n exit2();\n return value;\n}\nconst phrasing = (\n /** @type {(node?: unknown) => node is Exclude} */\n convert([\n \"break\",\n \"delete\",\n \"emphasis\",\n // To do: next major: removed since footnotes were added to GFM.\n \"footnote\",\n \"footnoteReference\",\n \"image\",\n \"imageReference\",\n \"inlineCode\",\n // Enabled by `mdast-util-math`:\n \"inlineMath\",\n \"link\",\n \"linkReference\",\n // Enabled by `mdast-util-mdx`:\n \"mdxJsxTextElement\",\n // Enabled by `mdast-util-mdx`:\n \"mdxTextExpression\",\n \"strong\",\n \"text\",\n // Enabled by `mdast-util-directive`:\n \"textDirective\"\n ])\n);\nfunction root(node, _, state, info) {\n const hasPhrasing = node.children.some(function(d) {\n return phrasing(d);\n });\n const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;\n return container.call(state, node, info);\n}\nfunction checkStrong(state) {\n const marker = state.options.strong || \"*\";\n if (marker !== \"*\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize strong with `\" + marker + \"` for `options.strong`, expected `*`, or `_`\"\n );\n }\n return marker;\n}\nstrong.peek = strongPeek;\nfunction strong(node, _, state, info) {\n const marker = checkStrong(state);\n const exit2 = state.enter(\"strong\");\n const tracker = state.createTracker(info);\n const before = tracker.move(marker + marker);\n let between = tracker.move(\n state.containerPhrasing(node, {\n after: marker,\n before,\n ...tracker.current()\n })\n );\n const betweenHead = between.charCodeAt(0);\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n );\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1);\n }\n const betweenTail = between.charCodeAt(between.length - 1);\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail);\n }\n const after = tracker.move(marker + marker);\n exit2();\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n };\n return before + between + after;\n}\nfunction strongPeek(_, _1, state) {\n return state.options.strong || \"*\";\n}\nfunction text$1(node, _, state, info) {\n return state.safe(node.value, info);\n}\nfunction checkRuleRepetition(state) {\n const repetition = state.options.ruleRepetition || 3;\n if (repetition < 3) {\n throw new Error(\n \"Cannot serialize rules with repetition `\" + repetition + \"` for `options.ruleRepetition`, expected `3` or more\"\n );\n }\n return repetition;\n}\nfunction thematicBreak(_, _1, state) {\n const value = (checkRule(state) + (state.options.ruleSpaces ? \" \" : \"\")).repeat(checkRuleRepetition(state));\n return state.options.ruleSpaces ? value.slice(0, -1) : value;\n}\nconst handle = {\n blockquote,\n break: hardBreak,\n code: code$1,\n definition,\n emphasis,\n hardBreak,\n heading,\n html,\n image,\n imageReference,\n inlineCode,\n link,\n linkReference,\n list,\n listItem,\n paragraph,\n root,\n strong,\n text: text$1,\n thematicBreak\n};\nfunction gfmTableFromMarkdown() {\n return {\n enter: {\n table: enterTable,\n tableData: enterCell,\n tableHeader: enterCell,\n tableRow: enterRow\n },\n exit: {\n codeText: exitCodeText,\n table: exitTable,\n tableData: exit,\n tableHeader: exit,\n tableRow: exit\n }\n };\n}\nfunction enterTable(token) {\n const align = token._align;\n this.enter(\n {\n type: \"table\",\n align: align.map(function(d) {\n return d === \"none\" ? null : d;\n }),\n children: []\n },\n token\n );\n this.data.inTable = true;\n}\nfunction exitTable(token) {\n this.exit(token);\n this.data.inTable = void 0;\n}\nfunction enterRow(token) {\n this.enter({ type: \"tableRow\", children: [] }, token);\n}\nfunction exit(token) {\n this.exit(token);\n}\nfunction enterCell(token) {\n this.enter({ type: \"tableCell\", children: [] }, token);\n}\nfunction exitCodeText(token) {\n let value = this.resume();\n if (this.data.inTable) {\n value = value.replace(/\\\\([\\\\|])/g, replace);\n }\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"inlineCode\");\n node.value = value;\n this.exit(token);\n}\nfunction replace($0, $1) {\n return $1 === \"|\" ? $1 : $0;\n}\nfunction gfmTableToMarkdown(options) {\n const settings = options || {};\n const padding = settings.tableCellPadding;\n const alignDelimiters = settings.tablePipeAlign;\n const stringLength = settings.stringLength;\n const around = padding ? \" \" : \"|\";\n return {\n unsafe: [\n { character: \"\\r\", inConstruct: \"tableCell\" },\n { character: \"\\n\", inConstruct: \"tableCell\" },\n // A pipe, when followed by a tab or space (padding), or a dash or colon\n // (unpadded delimiter row), could result in a table.\n { atBreak: true, character: \"|\", after: \"[\t :-]\" },\n // A pipe in a cell must be encoded.\n { character: \"|\", inConstruct: \"tableCell\" },\n // A colon must be followed by a dash, in which case it could start a\n // delimiter row.\n { atBreak: true, character: \":\", after: \"-\" },\n // A delimiter row can also start with a dash, when followed by more\n // dashes, a colon, or a pipe.\n // This is a stricter version than the built in check for lists, thematic\n // breaks, and setex heading underlines though:\n // \n { atBreak: true, character: \"-\", after: \"[:|-]\" }\n ],\n handlers: {\n inlineCode: inlineCodeWithTable,\n table: handleTable,\n tableCell: handleTableCell,\n tableRow: handleTableRow\n }\n };\n function handleTable(node, _, state, info) {\n return serializeData(handleTableAsData(node, state, info), node.align);\n }\n function handleTableRow(node, _, state, info) {\n const row = handleTableRowAsData(node, state, info);\n const value = serializeData([row]);\n return value.slice(0, value.indexOf(\"\\n\"));\n }\n function handleTableCell(node, _, state, info) {\n const exit2 = state.enter(\"tableCell\");\n const subexit = state.enter(\"phrasing\");\n const value = state.containerPhrasing(node, {\n ...info,\n before: around,\n after: around\n });\n subexit();\n exit2();\n return value;\n }\n function serializeData(matrix, align) {\n return markdownTable(matrix, {\n align,\n // @ts-expect-error: `markdown-table` types should support `null`.\n alignDelimiters,\n // @ts-expect-error: `markdown-table` types should support `null`.\n padding,\n // @ts-expect-error: `markdown-table` types should support `null`.\n stringLength\n });\n }\n function handleTableAsData(node, state, info) {\n const children = node.children;\n let index = -1;\n const result = [];\n const subexit = state.enter(\"table\");\n while (++index < children.length) {\n result[index] = handleTableRowAsData(children[index], state, info);\n }\n subexit();\n return result;\n }\n function handleTableRowAsData(node, state, info) {\n const children = node.children;\n let index = -1;\n const result = [];\n const subexit = state.enter(\"tableRow\");\n while (++index < children.length) {\n result[index] = handleTableCell(children[index], node, state, info);\n }\n subexit();\n return result;\n }\n function inlineCodeWithTable(node, parent, state) {\n let value = handle.inlineCode(node, parent, state);\n if (state.stack.includes(\"tableCell\")) {\n value = value.replace(/\\|/g, \"\\\\$&\");\n }\n return value;\n }\n}\nfunction gfmTaskListItemFromMarkdown() {\n return {\n exit: {\n taskListCheckValueChecked: exitCheck,\n taskListCheckValueUnchecked: exitCheck,\n paragraph: exitParagraphWithTaskListItem\n }\n };\n}\nfunction gfmTaskListItemToMarkdown() {\n return {\n unsafe: [{ atBreak: true, character: \"-\", after: \"[:|-]\" }],\n handlers: { listItem: listItemWithTaskListItem }\n };\n}\nfunction exitCheck(token) {\n const node = this.stack[this.stack.length - 2];\n ok$1(node.type === \"listItem\");\n node.checked = token.type === \"taskListCheckValueChecked\";\n}\nfunction exitParagraphWithTaskListItem(token) {\n const parent = this.stack[this.stack.length - 2];\n if (parent && parent.type === \"listItem\" && typeof parent.checked === \"boolean\") {\n const node = this.stack[this.stack.length - 1];\n ok$1(node.type === \"paragraph\");\n const head = node.children[0];\n if (head && head.type === \"text\") {\n const siblings = parent.children;\n let index = -1;\n let firstParaghraph;\n while (++index < siblings.length) {\n const sibling = siblings[index];\n if (sibling.type === \"paragraph\") {\n firstParaghraph = sibling;\n break;\n }\n }\n if (firstParaghraph === node) {\n head.value = head.value.slice(1);\n if (head.value.length === 0) {\n node.children.shift();\n } else if (node.position && head.position && typeof head.position.start.offset === \"number\") {\n head.position.start.column++;\n head.position.start.offset++;\n node.position.start = Object.assign({}, head.position.start);\n }\n }\n }\n }\n this.exit(token);\n}\nfunction listItemWithTaskListItem(node, parent, state, info) {\n const head = node.children[0];\n const checkable = typeof node.checked === \"boolean\" && head && head.type === \"paragraph\";\n const checkbox = \"[\" + (node.checked ? \"x\" : \" \") + \"] \";\n const tracker = state.createTracker(info);\n if (checkable) {\n tracker.move(checkbox);\n }\n let value = handle.listItem(node, parent, state, {\n ...info,\n ...tracker.current()\n });\n if (checkable) {\n value = value.replace(/^(?:[*+-]|\\d+\\.)([\\r\\n]| {1,3})/, check);\n }\n return value;\n function check($0) {\n return $0 + checkbox;\n }\n}\nfunction gfmFromMarkdown() {\n return [\n gfmAutolinkLiteralFromMarkdown(),\n gfmFootnoteFromMarkdown(),\n gfmStrikethroughFromMarkdown(),\n gfmTableFromMarkdown(),\n gfmTaskListItemFromMarkdown()\n ];\n}\nfunction gfmToMarkdown(options) {\n return {\n extensions: [\n gfmAutolinkLiteralToMarkdown(),\n gfmFootnoteToMarkdown(options),\n gfmStrikethroughToMarkdown(),\n gfmTableToMarkdown(options),\n gfmTaskListItemToMarkdown()\n ]\n };\n}\nfunction splice(list2, start, remove, items) {\n const end = list2.length;\n let chunkStart = 0;\n let parameters;\n if (start < 0) {\n start = -start > end ? 0 : end + start;\n } else {\n start = start > end ? end : start;\n }\n remove = remove > 0 ? remove : 0;\n if (items.length < 1e4) {\n parameters = Array.from(items);\n parameters.unshift(start, remove);\n list2.splice(...parameters);\n } else {\n if (remove) list2.splice(start, remove);\n while (chunkStart < items.length) {\n parameters = items.slice(chunkStart, chunkStart + 1e4);\n parameters.unshift(start, 0);\n list2.splice(...parameters);\n chunkStart += 1e4;\n start += 1e4;\n }\n }\n}\nconst hasOwnProperty = {}.hasOwnProperty;\nfunction combineExtensions(extensions) {\n const all = {};\n let index = -1;\n while (++index < extensions.length) {\n syntaxExtension(all, extensions[index]);\n }\n return all;\n}\nfunction syntaxExtension(all, extension) {\n let hook;\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : void 0;\n const left = maybe || (all[hook] = {});\n const right = extension[hook];\n let code2;\n if (right) {\n for (code2 in right) {\n if (!hasOwnProperty.call(left, code2)) left[code2] = [];\n const value = right[code2];\n constructs(\n // @ts-expect-error Looks like a list.\n left[code2],\n Array.isArray(value) ? value : value ? [value] : []\n );\n }\n }\n }\n}\nfunction constructs(existing, list2) {\n let index = -1;\n const before = [];\n while (++index < list2.length) {\n (list2[index].add === \"after\" ? existing : before).push(list2[index]);\n }\n splice(existing, 0, 0, before);\n}\nconst wwwPrefix = {\n tokenize: tokenizeWwwPrefix,\n partial: true\n};\nconst domain = {\n tokenize: tokenizeDomain,\n partial: true\n};\nconst path = {\n tokenize: tokenizePath,\n partial: true\n};\nconst trail = {\n tokenize: tokenizeTrail,\n partial: true\n};\nconst emailDomainDotTrail = {\n tokenize: tokenizeEmailDomainDotTrail,\n partial: true\n};\nconst wwwAutolink = {\n name: \"wwwAutolink\",\n tokenize: tokenizeWwwAutolink,\n previous: previousWww\n};\nconst protocolAutolink = {\n name: \"protocolAutolink\",\n tokenize: tokenizeProtocolAutolink,\n previous: previousProtocol\n};\nconst emailAutolink = {\n name: \"emailAutolink\",\n tokenize: tokenizeEmailAutolink,\n previous: previousEmail\n};\nconst text = {};\nfunction gfmAutolinkLiteral() {\n return {\n text\n };\n}\nlet code = 48;\nwhile (code < 123) {\n text[code] = emailAutolink;\n code++;\n if (code === 58) code = 65;\n else if (code === 91) code = 97;\n}\ntext[43] = emailAutolink;\ntext[45] = emailAutolink;\ntext[46] = emailAutolink;\ntext[95] = emailAutolink;\ntext[72] = [emailAutolink, protocolAutolink];\ntext[104] = [emailAutolink, protocolAutolink];\ntext[87] = [emailAutolink, wwwAutolink];\ntext[119] = [emailAutolink, wwwAutolink];\nfunction tokenizeEmailAutolink(effects, ok2, nok) {\n const self = this;\n let dot;\n let data;\n return start;\n function start(code2) {\n if (!gfmAtext(code2) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code2);\n }\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkEmail\");\n return atext(code2);\n }\n function atext(code2) {\n if (gfmAtext(code2)) {\n effects.consume(code2);\n return atext;\n }\n if (code2 === 64) {\n effects.consume(code2);\n return emailDomain;\n }\n return nok(code2);\n }\n function emailDomain(code2) {\n if (code2 === 46) {\n return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code2);\n }\n if (code2 === 45 || code2 === 95 || asciiAlphanumeric(code2)) {\n data = true;\n effects.consume(code2);\n return emailDomain;\n }\n return emailDomainAfter(code2);\n }\n function emailDomainDot(code2) {\n effects.consume(code2);\n dot = true;\n return emailDomain;\n }\n function emailDomainAfter(code2) {\n if (data && dot && asciiAlpha(self.previous)) {\n effects.exit(\"literalAutolinkEmail\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n return nok(code2);\n }\n}\nfunction tokenizeWwwAutolink(effects, ok2, nok) {\n const self = this;\n return wwwStart;\n function wwwStart(code2) {\n if (code2 !== 87 && code2 !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code2);\n }\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkWww\");\n return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code2);\n }\n function wwwAfter(code2) {\n effects.exit(\"literalAutolinkWww\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n}\nfunction tokenizeProtocolAutolink(effects, ok2, nok) {\n const self = this;\n let buffer = \"\";\n let seen = false;\n return protocolStart;\n function protocolStart(code2) {\n if ((code2 === 72 || code2 === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkHttp\");\n buffer += String.fromCodePoint(code2);\n effects.consume(code2);\n return protocolPrefixInside;\n }\n return nok(code2);\n }\n function protocolPrefixInside(code2) {\n if (asciiAlpha(code2) && buffer.length < 5) {\n buffer += String.fromCodePoint(code2);\n effects.consume(code2);\n return protocolPrefixInside;\n }\n if (code2 === 58) {\n const protocol = buffer.toLowerCase();\n if (protocol === \"http\" || protocol === \"https\") {\n effects.consume(code2);\n return protocolSlashesInside;\n }\n }\n return nok(code2);\n }\n function protocolSlashesInside(code2) {\n if (code2 === 47) {\n effects.consume(code2);\n if (seen) {\n return afterProtocol;\n }\n seen = true;\n return protocolSlashesInside;\n }\n return nok(code2);\n }\n function afterProtocol(code2) {\n return code2 === null || asciiControl(code2) || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || unicodePunctuation(code2) ? nok(code2) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code2);\n }\n function protocolAfter(code2) {\n effects.exit(\"literalAutolinkHttp\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n}\nfunction tokenizeWwwPrefix(effects, ok2, nok) {\n let size = 0;\n return wwwPrefixInside;\n function wwwPrefixInside(code2) {\n if ((code2 === 87 || code2 === 119) && size < 3) {\n size++;\n effects.consume(code2);\n return wwwPrefixInside;\n }\n if (code2 === 46 && size === 3) {\n effects.consume(code2);\n return wwwPrefixAfter;\n }\n return nok(code2);\n }\n function wwwPrefixAfter(code2) {\n return code2 === null ? nok(code2) : ok2(code2);\n }\n}\nfunction tokenizeDomain(effects, ok2, nok) {\n let underscoreInLastSegment;\n let underscoreInLastLastSegment;\n let seen;\n return domainInside;\n function domainInside(code2) {\n if (code2 === 46 || code2 === 95) {\n return effects.check(trail, domainAfter, domainAtPunctuation)(code2);\n }\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || code2 !== 45 && unicodePunctuation(code2)) {\n return domainAfter(code2);\n }\n seen = true;\n effects.consume(code2);\n return domainInside;\n }\n function domainAtPunctuation(code2) {\n if (code2 === 95) {\n underscoreInLastSegment = true;\n } else {\n underscoreInLastLastSegment = underscoreInLastSegment;\n underscoreInLastSegment = void 0;\n }\n effects.consume(code2);\n return domainInside;\n }\n function domainAfter(code2) {\n if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {\n return nok(code2);\n }\n return ok2(code2);\n }\n}\nfunction tokenizePath(effects, ok2) {\n let sizeOpen = 0;\n let sizeClose = 0;\n return pathInside;\n function pathInside(code2) {\n if (code2 === 40) {\n sizeOpen++;\n effects.consume(code2);\n return pathInside;\n }\n if (code2 === 41 && sizeClose < sizeOpen) {\n return pathAtPunctuation(code2);\n }\n if (code2 === 33 || code2 === 34 || code2 === 38 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 60 || code2 === 63 || code2 === 93 || code2 === 95 || code2 === 126) {\n return effects.check(trail, ok2, pathAtPunctuation)(code2);\n }\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return ok2(code2);\n }\n effects.consume(code2);\n return pathInside;\n }\n function pathAtPunctuation(code2) {\n if (code2 === 41) {\n sizeClose++;\n }\n effects.consume(code2);\n return pathInside;\n }\n}\nfunction tokenizeTrail(effects, ok2, nok) {\n return trail2;\n function trail2(code2) {\n if (code2 === 33 || code2 === 34 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 63 || code2 === 95 || code2 === 126) {\n effects.consume(code2);\n return trail2;\n }\n if (code2 === 38) {\n effects.consume(code2);\n return trailCharacterReferenceStart;\n }\n if (code2 === 93) {\n effects.consume(code2);\n return trailBracketAfter;\n }\n if (\n // `<` is an end.\n code2 === 60 || // So is whitespace.\n code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)\n ) {\n return ok2(code2);\n }\n return nok(code2);\n }\n function trailBracketAfter(code2) {\n if (code2 === null || code2 === 40 || code2 === 91 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return ok2(code2);\n }\n return trail2(code2);\n }\n function trailCharacterReferenceStart(code2) {\n return asciiAlpha(code2) ? trailCharacterReferenceInside(code2) : nok(code2);\n }\n function trailCharacterReferenceInside(code2) {\n if (code2 === 59) {\n effects.consume(code2);\n return trail2;\n }\n if (asciiAlpha(code2)) {\n effects.consume(code2);\n return trailCharacterReferenceInside;\n }\n return nok(code2);\n }\n}\nfunction tokenizeEmailDomainDotTrail(effects, ok2, nok) {\n return start;\n function start(code2) {\n effects.consume(code2);\n return after;\n }\n function after(code2) {\n return asciiAlphanumeric(code2) ? nok(code2) : ok2(code2);\n }\n}\nfunction previousWww(code2) {\n return code2 === null || code2 === 40 || code2 === 42 || code2 === 95 || code2 === 91 || code2 === 93 || code2 === 126 || markdownLineEndingOrSpace(code2);\n}\nfunction previousProtocol(code2) {\n return !asciiAlpha(code2);\n}\nfunction previousEmail(code2) {\n return !(code2 === 47 || gfmAtext(code2));\n}\nfunction gfmAtext(code2) {\n return code2 === 43 || code2 === 45 || code2 === 46 || code2 === 95 || asciiAlphanumeric(code2);\n}\nfunction previousUnbalanced(events) {\n let index = events.length;\n let result = false;\n while (index--) {\n const token = events[index][1];\n if ((token.type === \"labelLink\" || token.type === \"labelImage\") && !token._balanced) {\n result = true;\n break;\n }\n if (token._gfmAutolinkLiteralWalkedInto) {\n result = false;\n break;\n }\n }\n if (events.length > 0 && !result) {\n events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;\n }\n return result;\n}\nfunction resolveAll(constructs2, events, context) {\n const called = [];\n let index = -1;\n while (++index < constructs2.length) {\n const resolve = constructs2[index].resolveAll;\n if (resolve && !called.includes(resolve)) {\n events = resolve(events, context);\n called.push(resolve);\n }\n }\n return events;\n}\nfunction factorySpace(effects, ok2, type, max) {\n const limit = max ? max - 1 : Number.POSITIVE_INFINITY;\n let size = 0;\n return start;\n function start(code2) {\n if (markdownSpace(code2)) {\n effects.enter(type);\n return prefix(code2);\n }\n return ok2(code2);\n }\n function prefix(code2) {\n if (markdownSpace(code2) && size++ < limit) {\n effects.consume(code2);\n return prefix;\n }\n effects.exit(type);\n return ok2(code2);\n }\n}\nconst blankLine = {\n partial: true,\n tokenize: tokenizeBlankLine\n};\nfunction tokenizeBlankLine(effects, ok2, nok) {\n return start;\n function start(code2) {\n return markdownSpace(code2) ? factorySpace(effects, after, \"linePrefix\")(code2) : after(code2);\n }\n function after(code2) {\n return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);\n }\n}\nconst indent = {\n tokenize: tokenizeIndent,\n partial: true\n};\nfunction gfmFootnote() {\n return {\n document: {\n [91]: {\n name: \"gfmFootnoteDefinition\",\n tokenize: tokenizeDefinitionStart,\n continuation: {\n tokenize: tokenizeDefinitionContinuation\n },\n exit: gfmFootnoteDefinitionEnd\n }\n },\n text: {\n [91]: {\n name: \"gfmFootnoteCall\",\n tokenize: tokenizeGfmFootnoteCall\n },\n [93]: {\n name: \"gfmPotentialFootnoteCall\",\n add: \"after\",\n tokenize: tokenizePotentialGfmFootnoteCall,\n resolveTo: resolveToPotentialGfmFootnoteCall\n }\n }\n };\n}\nfunction tokenizePotentialGfmFootnoteCall(effects, ok2, nok) {\n const self = this;\n let index = self.events.length;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let labelStart;\n while (index--) {\n const token = self.events[index][1];\n if (token.type === \"labelImage\") {\n labelStart = token;\n break;\n }\n if (token.type === \"gfmFootnoteCall\" || token.type === \"labelLink\" || token.type === \"label\" || token.type === \"image\" || token.type === \"link\") {\n break;\n }\n }\n return start;\n function start(code2) {\n if (!labelStart || !labelStart._balanced) {\n return nok(code2);\n }\n const id = normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n }));\n if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {\n return nok(code2);\n }\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n return ok2(code2);\n }\n}\nfunction resolveToPotentialGfmFootnoteCall(events, context) {\n let index = events.length;\n while (index--) {\n if (events[index][1].type === \"labelImage\" && events[index][0] === \"enter\") {\n events[index][1];\n break;\n }\n }\n events[index + 1][1].type = \"data\";\n events[index + 3][1].type = \"gfmFootnoteCallLabelMarker\";\n const call = {\n type: \"gfmFootnoteCall\",\n start: Object.assign({}, events[index + 3][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n };\n const marker = {\n type: \"gfmFootnoteCallMarker\",\n start: Object.assign({}, events[index + 3][1].end),\n end: Object.assign({}, events[index + 3][1].end)\n };\n marker.end.column++;\n marker.end.offset++;\n marker.end._bufferIndex++;\n const string = {\n type: \"gfmFootnoteCallString\",\n start: Object.assign({}, marker.end),\n end: Object.assign({}, events[events.length - 1][1].start)\n };\n const chunk = {\n type: \"chunkString\",\n contentType: \"string\",\n start: Object.assign({}, string.start),\n end: Object.assign({}, string.end)\n };\n const replacement = [\n // Take the `labelImageMarker` (now `data`, the `!`)\n events[index + 1],\n events[index + 2],\n [\"enter\", call, context],\n // The `[`\n events[index + 3],\n events[index + 4],\n // The `^`.\n [\"enter\", marker, context],\n [\"exit\", marker, context],\n // Everything in between.\n [\"enter\", string, context],\n [\"enter\", chunk, context],\n [\"exit\", chunk, context],\n [\"exit\", string, context],\n // The ending (`]`, properly parsed and labelled).\n events[events.length - 2],\n events[events.length - 1],\n [\"exit\", call, context]\n ];\n events.splice(index, events.length - index + 1, ...replacement);\n return events;\n}\nfunction tokenizeGfmFootnoteCall(effects, ok2, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let size = 0;\n let data;\n return start;\n function start(code2) {\n effects.enter(\"gfmFootnoteCall\");\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n return callStart;\n }\n function callStart(code2) {\n if (code2 !== 94) return nok(code2);\n effects.enter(\"gfmFootnoteCallMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallMarker\");\n effects.enter(\"gfmFootnoteCallString\");\n effects.enter(\"chunkString\").contentType = \"string\";\n return callData;\n }\n function callData(code2) {\n if (\n // Too long.\n size > 999 || // Closing brace with nothing.\n code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)\n ) {\n return nok(code2);\n }\n if (code2 === 93) {\n effects.exit(\"chunkString\");\n const token = effects.exit(\"gfmFootnoteCallString\");\n if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {\n return nok(code2);\n }\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n effects.exit(\"gfmFootnoteCall\");\n return ok2;\n }\n if (!markdownLineEndingOrSpace(code2)) {\n data = true;\n }\n size++;\n effects.consume(code2);\n return code2 === 92 ? callEscape : callData;\n }\n function callEscape(code2) {\n if (code2 === 91 || code2 === 92 || code2 === 93) {\n effects.consume(code2);\n size++;\n return callData;\n }\n return callData(code2);\n }\n}\nfunction tokenizeDefinitionStart(effects, ok2, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let identifier;\n let size = 0;\n let data;\n return start;\n function start(code2) {\n effects.enter(\"gfmFootnoteDefinition\")._container = true;\n effects.enter(\"gfmFootnoteDefinitionLabel\");\n effects.enter(\"gfmFootnoteDefinitionLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionLabelMarker\");\n return labelAtMarker;\n }\n function labelAtMarker(code2) {\n if (code2 === 94) {\n effects.enter(\"gfmFootnoteDefinitionMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionMarker\");\n effects.enter(\"gfmFootnoteDefinitionLabelString\");\n effects.enter(\"chunkString\").contentType = \"string\";\n return labelInside;\n }\n return nok(code2);\n }\n function labelInside(code2) {\n if (\n // Too long.\n size > 999 || // Closing brace with nothing.\n code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)\n ) {\n return nok(code2);\n }\n if (code2 === 93) {\n effects.exit(\"chunkString\");\n const token = effects.exit(\"gfmFootnoteDefinitionLabelString\");\n identifier = normalizeIdentifier(self.sliceSerialize(token));\n effects.enter(\"gfmFootnoteDefinitionLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionLabelMarker\");\n effects.exit(\"gfmFootnoteDefinitionLabel\");\n return labelAfter;\n }\n if (!markdownLineEndingOrSpace(code2)) {\n data = true;\n }\n size++;\n effects.consume(code2);\n return code2 === 92 ? labelEscape : labelInside;\n }\n function labelEscape(code2) {\n if (code2 === 91 || code2 === 92 || code2 === 93) {\n effects.consume(code2);\n size++;\n return labelInside;\n }\n return labelInside(code2);\n }\n function labelAfter(code2) {\n if (code2 === 58) {\n effects.enter(\"definitionMarker\");\n effects.consume(code2);\n effects.exit(\"definitionMarker\");\n if (!defined.includes(identifier)) {\n defined.push(identifier);\n }\n return factorySpace(effects, whitespaceAfter, \"gfmFootnoteDefinitionWhitespace\");\n }\n return nok(code2);\n }\n function whitespaceAfter(code2) {\n return ok2(code2);\n }\n}\nfunction tokenizeDefinitionContinuation(effects, ok2, nok) {\n return effects.check(blankLine, ok2, effects.attempt(indent, ok2, nok));\n}\nfunction gfmFootnoteDefinitionEnd(effects) {\n effects.exit(\"gfmFootnoteDefinition\");\n}\nfunction tokenizeIndent(effects, ok2, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"gfmFootnoteDefinitionIndent\", 4 + 1);\n function afterPrefix(code2) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"gfmFootnoteDefinitionIndent\" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok2(code2) : nok(code2);\n }\n}\nfunction gfmStrikethrough(options) {\n const options_ = options || {};\n let single = options_.singleTilde;\n const tokenizer = {\n name: \"strikethrough\",\n tokenize: tokenizeStrikethrough,\n resolveAll: resolveAllStrikethrough\n };\n if (single === null || single === void 0) {\n single = true;\n }\n return {\n text: {\n [126]: tokenizer\n },\n insideSpan: {\n null: [tokenizer]\n },\n attentionMarkers: {\n null: [126]\n }\n };\n function resolveAllStrikethrough(events, context) {\n let index = -1;\n while (++index < events.length) {\n if (events[index][0] === \"enter\" && events[index][1].type === \"strikethroughSequenceTemporary\" && events[index][1]._close) {\n let open = index;\n while (open--) {\n if (events[open][0] === \"exit\" && events[open][1].type === \"strikethroughSequenceTemporary\" && events[open][1]._open && // If the sizes are the same:\n events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {\n events[index][1].type = \"strikethroughSequence\";\n events[open][1].type = \"strikethroughSequence\";\n const strikethrough = {\n type: \"strikethrough\",\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[index][1].end)\n };\n const text2 = {\n type: \"strikethroughText\",\n start: Object.assign({}, events[open][1].end),\n end: Object.assign({}, events[index][1].start)\n };\n const nextEvents = [[\"enter\", strikethrough, context], [\"enter\", events[open][1], context], [\"exit\", events[open][1], context], [\"enter\", text2, context]];\n const insideSpan = context.parser.constructs.insideSpan.null;\n if (insideSpan) {\n splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));\n }\n splice(nextEvents, nextEvents.length, 0, [[\"exit\", text2, context], [\"enter\", events[index][1], context], [\"exit\", events[index][1], context], [\"exit\", strikethrough, context]]);\n splice(events, open - 1, index - open + 3, nextEvents);\n index = open + nextEvents.length - 2;\n break;\n }\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n if (events[index][1].type === \"strikethroughSequenceTemporary\") {\n events[index][1].type = \"data\";\n }\n }\n return events;\n }\n function tokenizeStrikethrough(effects, ok2, nok) {\n const previous2 = this.previous;\n const events = this.events;\n let size = 0;\n return start;\n function start(code2) {\n if (previous2 === 126 && events[events.length - 1][1].type !== \"characterEscape\") {\n return nok(code2);\n }\n effects.enter(\"strikethroughSequenceTemporary\");\n return more(code2);\n }\n function more(code2) {\n const before = classifyCharacter(previous2);\n if (code2 === 126) {\n if (size > 1) return nok(code2);\n effects.consume(code2);\n size++;\n return more;\n }\n if (size < 2 && !single) return nok(code2);\n const token = effects.exit(\"strikethroughSequenceTemporary\");\n const after = classifyCharacter(code2);\n token._open = !after || after === 2 && Boolean(before);\n token._close = !before || before === 2 && Boolean(after);\n return ok2(code2);\n }\n }\n}\nclass EditMap {\n /**\n * Create a new edit map.\n */\n constructor() {\n this.map = [];\n }\n /**\n * Create an edit: a remove and/or add at a certain place.\n *\n * @param {number} index\n * @param {number} remove\n * @param {Array} add\n * @returns {undefined}\n */\n add(index, remove, add) {\n addImplementation(this, index, remove, add);\n }\n // To do: add this when moving to `micromark`.\n // /**\n // * Create an edit: but insert `add` before existing additions.\n // *\n // * @param {number} index\n // * @param {number} remove\n // * @param {Array} add\n // * @returns {undefined}\n // */\n // addBefore(index, remove, add) {\n // addImplementation(this, index, remove, add, true)\n // }\n /**\n * Done, change the events.\n *\n * @param {Array} events\n * @returns {undefined}\n */\n consume(events) {\n this.map.sort(function(a, b) {\n return a[0] - b[0];\n });\n if (this.map.length === 0) {\n return;\n }\n let index = this.map.length;\n const vecs = [];\n while (index > 0) {\n index -= 1;\n vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);\n events.length = this.map[index][0];\n }\n vecs.push(events.slice());\n events.length = 0;\n let slice = vecs.pop();\n while (slice) {\n for (const element of slice) {\n events.push(element);\n }\n slice = vecs.pop();\n }\n this.map.length = 0;\n }\n}\nfunction addImplementation(editMap, at, remove, add) {\n let index = 0;\n if (remove === 0 && add.length === 0) {\n return;\n }\n while (index < editMap.map.length) {\n if (editMap.map[index][0] === at) {\n editMap.map[index][1] += remove;\n editMap.map[index][2].push(...add);\n return;\n }\n index += 1;\n }\n editMap.map.push([at, remove, add]);\n}\nfunction gfmTableAlign(events, index) {\n let inDelimiterRow = false;\n const align = [];\n while (index < events.length) {\n const event = events[index];\n if (inDelimiterRow) {\n if (event[0] === \"enter\") {\n if (event[1].type === \"tableContent\") {\n align.push(events[index + 1][1].type === \"tableDelimiterMarker\" ? \"left\" : \"none\");\n }\n } else if (event[1].type === \"tableContent\") {\n if (events[index - 1][1].type === \"tableDelimiterMarker\") {\n const alignIndex = align.length - 1;\n align[alignIndex] = align[alignIndex] === \"left\" ? \"center\" : \"right\";\n }\n } else if (event[1].type === \"tableDelimiterRow\") {\n break;\n }\n } else if (event[0] === \"enter\" && event[1].type === \"tableDelimiterRow\") {\n inDelimiterRow = true;\n }\n index += 1;\n }\n return align;\n}\nfunction gfmTable() {\n return {\n flow: {\n null: {\n name: \"table\",\n tokenize: tokenizeTable,\n resolveAll: resolveTable\n }\n }\n };\n}\nfunction tokenizeTable(effects, ok2, nok) {\n const self = this;\n let size = 0;\n let sizeB = 0;\n let seen;\n return start;\n function start(code2) {\n let index = self.events.length - 1;\n while (index > -1) {\n const type = self.events[index][1].type;\n if (type === \"lineEnding\" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`\n type === \"linePrefix\") index--;\n else break;\n }\n const tail = index > -1 ? self.events[index][1].type : null;\n const next = tail === \"tableHead\" || tail === \"tableRow\" ? bodyRowStart : headRowBefore;\n if (next === bodyRowStart && self.parser.lazy[self.now().line]) {\n return nok(code2);\n }\n return next(code2);\n }\n function headRowBefore(code2) {\n effects.enter(\"tableHead\");\n effects.enter(\"tableRow\");\n return headRowStart(code2);\n }\n function headRowStart(code2) {\n if (code2 === 124) {\n return headRowBreak(code2);\n }\n seen = true;\n sizeB += 1;\n return headRowBreak(code2);\n }\n function headRowBreak(code2) {\n if (code2 === null) {\n return nok(code2);\n }\n if (markdownLineEnding(code2)) {\n if (sizeB > 1) {\n sizeB = 0;\n self.interrupt = true;\n effects.exit(\"tableRow\");\n effects.enter(\"lineEnding\");\n effects.consume(code2);\n effects.exit(\"lineEnding\");\n return headDelimiterStart;\n }\n return nok(code2);\n }\n if (markdownSpace(code2)) {\n return factorySpace(effects, headRowBreak, \"whitespace\")(code2);\n }\n sizeB += 1;\n if (seen) {\n seen = false;\n size += 1;\n }\n if (code2 === 124) {\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n seen = true;\n return headRowBreak;\n }\n effects.enter(\"data\");\n return headRowData(code2);\n }\n function headRowData(code2) {\n if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {\n effects.exit(\"data\");\n return headRowBreak(code2);\n }\n effects.consume(code2);\n return code2 === 92 ? headRowEscape : headRowData;\n }\n function headRowEscape(code2) {\n if (code2 === 92 || code2 === 124) {\n effects.consume(code2);\n return headRowData;\n }\n return headRowData(code2);\n }\n function headDelimiterStart(code2) {\n self.interrupt = false;\n if (self.parser.lazy[self.now().line]) {\n return nok(code2);\n }\n effects.enter(\"tableDelimiterRow\");\n seen = false;\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterBefore, \"linePrefix\", self.parser.constructs.disable.null.includes(\"codeIndented\") ? void 0 : 4)(code2);\n }\n return headDelimiterBefore(code2);\n }\n function headDelimiterBefore(code2) {\n if (code2 === 45 || code2 === 58) {\n return headDelimiterValueBefore(code2);\n }\n if (code2 === 124) {\n seen = true;\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n return headDelimiterCellBefore;\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterCellBefore(code2) {\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterValueBefore, \"whitespace\")(code2);\n }\n return headDelimiterValueBefore(code2);\n }\n function headDelimiterValueBefore(code2) {\n if (code2 === 58) {\n sizeB += 1;\n seen = true;\n effects.enter(\"tableDelimiterMarker\");\n effects.consume(code2);\n effects.exit(\"tableDelimiterMarker\");\n return headDelimiterLeftAlignmentAfter;\n }\n if (code2 === 45) {\n sizeB += 1;\n return headDelimiterLeftAlignmentAfter(code2);\n }\n if (code2 === null || markdownLineEnding(code2)) {\n return headDelimiterCellAfter(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterLeftAlignmentAfter(code2) {\n if (code2 === 45) {\n effects.enter(\"tableDelimiterFiller\");\n return headDelimiterFiller(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterFiller(code2) {\n if (code2 === 45) {\n effects.consume(code2);\n return headDelimiterFiller;\n }\n if (code2 === 58) {\n seen = true;\n effects.exit(\"tableDelimiterFiller\");\n effects.enter(\"tableDelimiterMarker\");\n effects.consume(code2);\n effects.exit(\"tableDelimiterMarker\");\n return headDelimiterRightAlignmentAfter;\n }\n effects.exit(\"tableDelimiterFiller\");\n return headDelimiterRightAlignmentAfter(code2);\n }\n function headDelimiterRightAlignmentAfter(code2) {\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterCellAfter, \"whitespace\")(code2);\n }\n return headDelimiterCellAfter(code2);\n }\n function headDelimiterCellAfter(code2) {\n if (code2 === 124) {\n return headDelimiterBefore(code2);\n }\n if (code2 === null || markdownLineEnding(code2)) {\n if (!seen || size !== sizeB) {\n return headDelimiterNok(code2);\n }\n effects.exit(\"tableDelimiterRow\");\n effects.exit(\"tableHead\");\n return ok2(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterNok(code2) {\n return nok(code2);\n }\n function bodyRowStart(code2) {\n effects.enter(\"tableRow\");\n return bodyRowBreak(code2);\n }\n function bodyRowBreak(code2) {\n if (code2 === 124) {\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n return bodyRowBreak;\n }\n if (code2 === null || markdownLineEnding(code2)) {\n effects.exit(\"tableRow\");\n return ok2(code2);\n }\n if (markdownSpace(code2)) {\n return factorySpace(effects, bodyRowBreak, \"whitespace\")(code2);\n }\n effects.enter(\"data\");\n return bodyRowData(code2);\n }\n function bodyRowData(code2) {\n if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {\n effects.exit(\"data\");\n return bodyRowBreak(code2);\n }\n effects.consume(code2);\n return code2 === 92 ? bodyRowEscape : bodyRowData;\n }\n function bodyRowEscape(code2) {\n if (code2 === 92 || code2 === 124) {\n effects.consume(code2);\n return bodyRowData;\n }\n return bodyRowData(code2);\n }\n}\nfunction resolveTable(events, context) {\n let index = -1;\n let inFirstCellAwaitingPipe = true;\n let rowKind = 0;\n let lastCell = [0, 0, 0, 0];\n let cell = [0, 0, 0, 0];\n let afterHeadAwaitingFirstBodyRow = false;\n let lastTableEnd = 0;\n let currentTable;\n let currentBody;\n let currentCell;\n const map2 = new EditMap();\n while (++index < events.length) {\n const event = events[index];\n const token = event[1];\n if (event[0] === \"enter\") {\n if (token.type === \"tableHead\") {\n afterHeadAwaitingFirstBodyRow = false;\n if (lastTableEnd !== 0) {\n flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);\n currentBody = void 0;\n lastTableEnd = 0;\n }\n currentTable = {\n type: \"table\",\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map2.add(index, 0, [[\"enter\", currentTable, context]]);\n } else if (token.type === \"tableRow\" || token.type === \"tableDelimiterRow\") {\n inFirstCellAwaitingPipe = true;\n currentCell = void 0;\n lastCell = [0, 0, 0, 0];\n cell = [0, index + 1, 0, 0];\n if (afterHeadAwaitingFirstBodyRow) {\n afterHeadAwaitingFirstBodyRow = false;\n currentBody = {\n type: \"tableBody\",\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map2.add(index, 0, [[\"enter\", currentBody, context]]);\n }\n rowKind = token.type === \"tableDelimiterRow\" ? 2 : currentBody ? 3 : 1;\n } else if (rowKind && (token.type === \"data\" || token.type === \"tableDelimiterMarker\" || token.type === \"tableDelimiterFiller\")) {\n inFirstCellAwaitingPipe = false;\n if (cell[2] === 0) {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);\n lastCell = [0, 0, 0, 0];\n }\n cell[2] = index;\n }\n } else if (token.type === \"tableCellDivider\") {\n if (inFirstCellAwaitingPipe) {\n inFirstCellAwaitingPipe = false;\n } else {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);\n }\n lastCell = cell;\n cell = [lastCell[1], index, 0, 0];\n }\n }\n } else if (token.type === \"tableHead\") {\n afterHeadAwaitingFirstBodyRow = true;\n lastTableEnd = index;\n } else if (token.type === \"tableRow\" || token.type === \"tableDelimiterRow\") {\n lastTableEnd = index;\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, index, currentCell);\n } else if (cell[1] !== 0) {\n currentCell = flushCell(map2, context, cell, rowKind, index, currentCell);\n }\n rowKind = 0;\n } else if (rowKind && (token.type === \"data\" || token.type === \"tableDelimiterMarker\" || token.type === \"tableDelimiterFiller\")) {\n cell[3] = index;\n }\n }\n if (lastTableEnd !== 0) {\n flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);\n }\n map2.consume(context.events);\n index = -1;\n while (++index < context.events.length) {\n const event = context.events[index];\n if (event[0] === \"enter\" && event[1].type === \"table\") {\n event[1]._align = gfmTableAlign(context.events, index);\n }\n }\n return events;\n}\nfunction flushCell(map2, context, range, rowKind, rowEnd, previousCell) {\n const groupName = rowKind === 1 ? \"tableHeader\" : rowKind === 2 ? \"tableDelimiter\" : \"tableData\";\n const valueName = \"tableContent\";\n if (range[0] !== 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, range[0]));\n map2.add(range[0], 0, [[\"exit\", previousCell, context]]);\n }\n const now = getPoint(context.events, range[1]);\n previousCell = {\n type: groupName,\n start: Object.assign({}, now),\n // Note: correct end is set later.\n end: Object.assign({}, now)\n };\n map2.add(range[1], 0, [[\"enter\", previousCell, context]]);\n if (range[2] !== 0) {\n const relatedStart = getPoint(context.events, range[2]);\n const relatedEnd = getPoint(context.events, range[3]);\n const valueToken = {\n type: valueName,\n start: Object.assign({}, relatedStart),\n end: Object.assign({}, relatedEnd)\n };\n map2.add(range[2], 0, [[\"enter\", valueToken, context]]);\n if (rowKind !== 2) {\n const start = context.events[range[2]];\n const end = context.events[range[3]];\n start[1].end = Object.assign({}, end[1].end);\n start[1].type = \"chunkText\";\n start[1].contentType = \"text\";\n if (range[3] > range[2] + 1) {\n const a = range[2] + 1;\n const b = range[3] - range[2] - 1;\n map2.add(a, b, []);\n }\n }\n map2.add(range[3] + 1, 0, [[\"exit\", valueToken, context]]);\n }\n if (rowEnd !== void 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));\n map2.add(rowEnd, 0, [[\"exit\", previousCell, context]]);\n previousCell = void 0;\n }\n return previousCell;\n}\nfunction flushTableEnd(map2, context, index, table, tableBody) {\n const exits = [];\n const related = getPoint(context.events, index);\n if (tableBody) {\n tableBody.end = Object.assign({}, related);\n exits.push([\"exit\", tableBody, context]);\n }\n table.end = Object.assign({}, related);\n exits.push([\"exit\", table, context]);\n map2.add(index + 1, 0, exits);\n}\nfunction getPoint(events, index) {\n const event = events[index];\n const side = event[0] === \"enter\" ? \"start\" : \"end\";\n return event[1][side];\n}\nconst tasklistCheck = {\n name: \"tasklistCheck\",\n tokenize: tokenizeTasklistCheck\n};\nfunction gfmTaskListItem() {\n return {\n text: {\n [91]: tasklistCheck\n }\n };\n}\nfunction tokenizeTasklistCheck(effects, ok2, nok) {\n const self = this;\n return open;\n function open(code2) {\n if (\n // Exit if there’s stuff before.\n self.previous !== null || // Exit if not in the first content that is the first child of a list\n // item.\n !self._gfmTasklistFirstContentOfListItem\n ) {\n return nok(code2);\n }\n effects.enter(\"taskListCheck\");\n effects.enter(\"taskListCheckMarker\");\n effects.consume(code2);\n effects.exit(\"taskListCheckMarker\");\n return inside;\n }\n function inside(code2) {\n if (markdownLineEndingOrSpace(code2)) {\n effects.enter(\"taskListCheckValueUnchecked\");\n effects.consume(code2);\n effects.exit(\"taskListCheckValueUnchecked\");\n return close;\n }\n if (code2 === 88 || code2 === 120) {\n effects.enter(\"taskListCheckValueChecked\");\n effects.consume(code2);\n effects.exit(\"taskListCheckValueChecked\");\n return close;\n }\n return nok(code2);\n }\n function close(code2) {\n if (code2 === 93) {\n effects.enter(\"taskListCheckMarker\");\n effects.consume(code2);\n effects.exit(\"taskListCheckMarker\");\n effects.exit(\"taskListCheck\");\n return after;\n }\n return nok(code2);\n }\n function after(code2) {\n if (markdownLineEnding(code2)) {\n return ok2(code2);\n }\n if (markdownSpace(code2)) {\n return effects.check({\n tokenize: spaceThenNonSpace\n }, ok2, nok)(code2);\n }\n return nok(code2);\n }\n}\nfunction spaceThenNonSpace(effects, ok2, nok) {\n return factorySpace(effects, after, \"whitespace\");\n function after(code2) {\n return code2 === null ? nok(code2) : ok2(code2);\n }\n}\nfunction gfm(options) {\n return combineExtensions([\n gfmAutolinkLiteral(),\n gfmFootnote(),\n gfmStrikethrough(options),\n gfmTable(),\n gfmTaskListItem()\n ]);\n}\nconst emptyOptions = {};\nfunction remarkGfm(options) {\n const self = (\n /** @type {Processor} */\n this\n );\n const settings = options || emptyOptions;\n const data = self.data();\n const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);\n const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);\n const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);\n micromarkExtensions.push(gfm(settings));\n fromMarkdownExtensions.push(gfmFromMarkdown());\n toMarkdownExtensions.push(gfmToMarkdown(settings));\n}\nconst _sfc_main$1 = /* @__PURE__ */ defineComponent({\n __name: \"NcRichTextCopyButton\",\n props: {\n contentId: {}\n },\n setup(__props) {\n const { copy, icon, altText } = useCopy(() => document.getElementById(__props.contentId).textContent);\n return (_ctx, _cache) => {\n return openBlock(), createBlock(NcButton, {\n variant: \"tertiary\",\n size: \"small\",\n \"aria-label\": unref(altText),\n title: unref(altText),\n onClick: unref(copy)\n }, {\n icon: withCtx(() => [\n createVNode(NcIconSvgWrapper, {\n path: unref(icon),\n inline: \"\"\n }, null, 8, [\"path\"])\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"]);\n };\n }\n});\n/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isTextNode$1(node) {\n return node.type === \"text\";\n}\nconst transformPlaceholders = function(ast) {\n visitParents(ast, isTextNode$1, (node, ancestors) => {\n const parent = ancestors.at(-1);\n const index = parent.children.indexOf(node);\n const placeholders = node.value.split(/(\\{[a-z\\-_.0-9]+\\})/ig).map((entry) => {\n const matches = entry.match(/^\\{([a-z\\-_.0-9]+)\\}$/i);\n if (!matches) {\n return u(\"text\", entry);\n }\n const [, component] = matches;\n return u(\"element\", {\n tagName: `#${component}`,\n children: []\n });\n });\n parent.children.splice(index, 1, ...placeholders);\n });\n};\nconst remarkPlaceholder = () => transformPlaceholders;\n/*!\n * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isCodeNode(node) {\n return [\"code\", \"inlineCode\"].includes(node.type);\n}\nconst remarkStripCode = function() {\n return function(tree) {\n visitParents(tree, isCodeNode, (node, ancestors) => {\n const parent = ancestors.at(-1);\n const index = parent.children.indexOf(node);\n parent.children.splice(index, 1, {\n ...node,\n value: \"\"\n });\n return [SKIP, index + 1];\n });\n };\n};\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isTextNode(node) {\n return [\"text\", \"code\", \"inlineCode\"].includes(node.type);\n}\nconst remarkUnescape = function() {\n return function(tree) {\n visitParents(tree, isTextNode, (node, ancestors) => {\n const parent = ancestors.at(-1);\n const index = parent.children.indexOf(node);\n parent.children.splice(index, 1, {\n ...node,\n value: node.value.replace(/</gmi, \"<\").replace(/>/gmi, \">\")\n });\n return [SKIP, index + 1];\n });\n };\n};\nconst LINK_PROTOCOLS = [\"http\", \"https\", \"mailto\", \"tel\"];\nconst rehypeHighlight = ref(null);\nasync function importRehypeHighlightLibrary() {\n const module = await import(\"rehype-highlight\");\n rehypeHighlight.value = module.default;\n}\nconst _sfc_main = {\n name: \"NcRichText\",\n components: {\n NcReferenceList\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n /**\n * The main text\n */\n text: {\n type: String,\n default: \"\"\n },\n /**\n * Arguments for the richobjects\n */\n arguments: {\n type: Object,\n default: () => {\n return {};\n }\n },\n /**\n * Limit the number of reference widgets to render\n */\n referenceLimit: {\n type: Number,\n default: 0\n },\n /**\n * Whether to render the widgets in interactive mode (if available)\n */\n referenceInteractive: {\n type: Boolean,\n default: true\n },\n /**\n * Whether to show user an option to enable to interactive mode for widgets (if available)\n */\n referenceInteractiveOptIn: {\n type: Boolean,\n default: false\n },\n /** Provide data upfront to avoid extra http request */\n references: {\n type: Array,\n default: null\n },\n /** Provide basic Markdown syntax */\n useMarkdown: {\n type: Boolean,\n default: false\n },\n /** Provide GitHub Flavored Markdown syntax */\n useExtendedMarkdown: {\n type: Boolean,\n default: false\n },\n /** Provide event from rendered markdown inputs */\n interactive: {\n type: Boolean,\n default: false\n },\n /**\n * Automatically convert link-like text to markdown links\n */\n autolink: {\n type: Boolean,\n default: true\n }\n },\n emits: [\n \"interactTodo\"\n ],\n data() {\n return {\n parentId: createElementId()\n };\n },\n methods: {\n renderPlaintext() {\n const placeholders = this.text.split(/(\\{[a-z\\-_.0-9]+\\})/ig).map((entry) => {\n const matches = entry.match(/^\\{([a-z\\-_.0-9]+)\\}$/i);\n if (!matches) {\n return this.prepareTextNode(entry);\n }\n const argumentId = matches[1];\n const argument = this.arguments[argumentId];\n if (typeof argument === \"object\") {\n const { component, props } = argument;\n return h(typeof component === \"string\" ? resolveComponent(component) : component, {\n ...props,\n class: \"rich-text--component\"\n });\n }\n if (argument) {\n return h(\"span\", { class: \"rich-text--fallback\" }, argument);\n }\n return entry;\n });\n return h(\"div\", { class: \"rich-text--wrapper\" }, [\n h(\"div\", {}, placeholders.flat()),\n this.referenceLimit > 0 ? h(\"div\", { class: \"rich-text--reference-widget\" }, [\n h(NcReferenceList, {\n text: this.text,\n referenceData: this.references,\n interactive: this.referenceInteractive,\n interactiveOptIn: this.referenceInteractiveOptIn\n })\n ]) : null\n ]);\n },\n renderMarkdown() {\n const renderedMarkdown = unified().use(remarkParse).use(remarkAutolink, {\n autolink: this.autolink,\n useMarkdown: this.useMarkdown,\n useExtendedMarkdown: this.useExtendedMarkdown\n }).use(remarkUnescape).use(this.useExtendedMarkdown ? remarkGfm : void 0).use(breaks).use(remarkUnlinkProtocols, { except: LINK_PROTOCOLS }).use(remark2rehype, {\n handlers: {\n component(toHast, node) {\n return toHast(node, node.component, { value: node.value });\n }\n }\n }).use(this.useExtendedMarkdown ? rehypeHighlight.value : void 0).use(remarkPlaceholder).use(rehypeExternalLinks, {\n target: \"_blank\",\n rel: [\"noopener noreferrer\"]\n }).use(rehype2react, {\n Fragment,\n jsx: this.createElement,\n jsxs: this.createElement,\n elementAttributeNameCase: \"html\",\n prefix: false\n }).processSync(this.text.replace(/<[^>]+>/g, (match) => match.replace(/\")).result;\n return h(\"div\", { class: \"rich-text--wrapper rich-text--wrapper-markdown\" }, [\n renderedMarkdown,\n this.referenceLimit > 0 ? h(\"div\", { class: \"rich-text--reference-widget\" }, [\n h(NcReferenceList, {\n text: this.prepareReferenceSource(this.text),\n referenceData: this.references,\n interactive: this.referenceInteractive,\n interactiveOptIn: this.referenceInteractiveOptIn\n })\n ]) : null\n ]);\n },\n /**\n * Render plain text nodes\n *\n * @param {string} text - Content of the node\n */\n prepareTextNode(text2) {\n if (this.autolink) {\n text2 = parseUrl(text2);\n }\n if (Array.isArray(text2)) {\n return text2.map((entry) => {\n if (typeof entry === \"string\") {\n return entry;\n }\n const { component, props } = entry;\n return h(component, {\n ...props,\n class: \"rich-text--component\"\n });\n });\n }\n return text2;\n },\n /**\n * Strip content of inline code and code blocks for reference widgets\n * (e.g. ignore fenced links from being added as reference)\n *\n * @param {string} text - Content of the node\n */\n prepareReferenceSource(text2) {\n if (!this.useMarkdown && !this.useExtendedMarkdown) {\n return text2;\n }\n const processor = unified();\n processor.compiler = (tree) => toString(tree);\n return processor.use(remarkParse).use(remarkStripCode).processSync(text2.replace(/\\s/g, \" \")).value;\n },\n createElement(type, props, key) {\n if (key) {\n props.key = key;\n }\n const children = props.children ?? [];\n delete props.children;\n if (!String(type).startsWith(\"#\")) {\n if ([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"].includes(String(type))) {\n type = `h${Math.min(+String(type)[1] + 3, 6)}`;\n }\n let nestedNode = null;\n if (this.useExtendedMarkdown) {\n if (String(type) === \"code\" && !rehypeHighlight.value && props?.class?.includes(\"language\")) {\n importRehypeHighlightLibrary();\n }\n if (String(type) === \"pre\" && children && String(children.type) === \"code\") {\n const id = this.parentId + \"-code-block-\" + createElementId();\n return h(\"p\", { class: \"rich-text__code-block\" }, [\n h(type, { ...props, id }, children),\n h(_sfc_main$1, { class: \"rich-text__code-block-button\", contentId: id })\n ]);\n }\n if (String(type) === \"li\" && Array.isArray(children) && children.length !== 0 && children[0].type === \"input\" && children[0].props.type === \"checkbox\") {\n const [inputNode, , ...labelParts] = children;\n const nestedNodeIndex = labelParts.findIndex((child) => [\"ul\", \"ol\", \"li\", \"blockquote\", \"pre\"].includes(child.type));\n if (nestedNodeIndex !== -1) {\n nestedNode = labelParts[nestedNodeIndex];\n labelParts.splice(nestedNodeIndex);\n }\n const id = this.parentId + \"-markdown-input-\" + createElementId();\n const propsToForward = { ...inputNode.props };\n delete propsToForward.checked;\n const inputComponent = h(NcCheckboxRadioSwitch, {\n ...propsToForward,\n modelValue: inputNode.props.checked,\n id,\n disabled: !this.interactive,\n \"onUpdate:modelValue\": () => {\n this.$emit(\"interactTodo\", id);\n }\n }, { default: () => labelParts });\n return h(type, props, [inputComponent, nestedNode]);\n }\n }\n if (String(type) === \"a\") {\n const route = getRoute(this.$router, props.href);\n if (route) {\n delete props.href;\n delete props.target;\n return h(RouterLink, {\n ...props,\n to: route\n }, { default: () => children });\n }\n const isAllowedScheme = /^(https?:\\/\\/|tel:|mailto:)/.test(props.href);\n if (isAllowedScheme) {\n props.href = props.href.trim();\n return h(NcRichTextExternalLink, props, children);\n } else {\n delete props.href;\n delete props.target;\n return h(\"span\", props, children);\n }\n }\n return h(type, props, children);\n }\n const placeholder = this.arguments[type.slice(1)];\n if (!placeholder) {\n return h(\"span\", { ...props, class: \"rich-text--fallback\" }, [`{${type.slice(1)}}`]);\n }\n if (!placeholder.component) {\n return h(\"span\", { ...props }, [placeholder]);\n }\n return h(\n typeof placeholder.component === \"string\" ? resolveComponent(placeholder.component) : placeholder.component,\n {\n ...props,\n ...placeholder.props,\n class: \"rich-text--component\"\n },\n { default: () => children }\n );\n }\n },\n render() {\n return this.useMarkdown || this.useExtendedMarkdown ? this.renderMarkdown() : this.renderPlaintext();\n }\n};\nconst NcRichText = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-80e57a29\"]]);\nexport {\n NcRichText as N,\n NcReferenceList as a\n};\n//# sourceMappingURL=NcRichText.mjs.map\n","import { l as logger } from \"./logger.mjs\";\nwindow._vue_richtext_custom_picker_elements ??= {};\nwindow._registerCustomPickerElement ??= registerCustomPickerElement;\nclass NcCustomPickerRenderResult {\n element;\n object;\n /**\n * @param element - The HTML element\n * @param object - The object\n */\n constructor(element, object) {\n this.element = element;\n this.object = object;\n }\n}\nfunction isCustomPickerElementRegistered(id) {\n return !!window._vue_richtext_custom_picker_elements[id];\n}\nfunction getCustomPickerElementSize(id) {\n const size = window._vue_richtext_custom_picker_elements[id]?.size;\n if (size && [\"small\", \"normal\", \"large\", \"full\"].includes(size)) {\n return size;\n }\n return null;\n}\nfunction registerCustomPickerElement(id, callback, onDestroy = () => {\n}, size = \"large\") {\n if (window._vue_richtext_custom_picker_elements[id]) {\n logger.error(`Custom reference picker element for id ${id} already registered`);\n return;\n }\n window._vue_richtext_custom_picker_elements[id] = {\n id,\n callback,\n onDestroy,\n size\n };\n}\nfunction renderCustomPickerElement(el, options) {\n const { providerId, accessible } = options;\n if (!window._vue_richtext_custom_picker_elements[providerId]) {\n logger.error(`Custom reference picker element for reference provider ID ${providerId} not registered`);\n return;\n }\n return window._vue_richtext_custom_picker_elements[providerId].callback(el, { providerId, accessible });\n}\nfunction destroyCustomPickerElement(providerId, el, renderResult) {\n if (!window._vue_richtext_custom_picker_elements[providerId]) {\n return;\n }\n window._vue_richtext_custom_picker_elements[providerId].onDestroy(el, renderResult);\n}\nexport {\n NcCustomPickerRenderResult as N,\n renderCustomPickerElement as a,\n destroyCustomPickerElement as d,\n getCustomPickerElementSize as g,\n isCustomPickerElementRegistered as i,\n registerCustomPickerElement as r\n};\n//# sourceMappingURL=customPickerElements.mjs.map\n","export default function debounce(function_, wait = 100, options = {}) {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError(`Expected the first parameter to be a function, got \\`${typeof function_}\\`.`);\n\t}\n\n\tif (wait < 0) {\n\t\tthrow new RangeError('`wait` must not be negative.');\n\t}\n\n\tif (typeof options === 'boolean') {\n\t\tthrow new TypeError('The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.');\n\t}\n\n\tconst {immediate} = options;\n\n\tlet storedContext;\n\tlet storedArguments;\n\tlet timeoutId;\n\tlet timestamp;\n\tlet result;\n\n\tfunction run() {\n\t\tconst callContext = storedContext;\n\t\tconst callArguments = storedArguments;\n\t\tstoredContext = undefined;\n\t\tstoredArguments = undefined;\n\t\tresult = function_.apply(callContext, callArguments);\n\t\treturn result;\n\t}\n\n\tfunction later() {\n\t\tconst last = Date.now() - timestamp;\n\n\t\tif (last < wait && last >= 0) {\n\t\t\ttimeoutId = setTimeout(later, wait - last);\n\t\t} else {\n\t\t\ttimeoutId = undefined;\n\n\t\t\tif (!immediate) {\n\t\t\t\tresult = run();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst debounced = function (...arguments_) {\n\t\tif (\n\t\t\tstoredContext\n\t\t\t&& this !== storedContext\n\t\t\t&& Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)\n\t\t) {\n\t\t\tthrow new Error('Debounced method called with different contexts of the same prototype.');\n\t\t}\n\n\t\tstoredContext = this; // eslint-disable-line unicorn/no-this-assignment\n\t\tstoredArguments = arguments_;\n\t\ttimestamp = Date.now();\n\n\t\tconst callNow = immediate && !timeoutId;\n\n\t\tif (!timeoutId) {\n\t\t\ttimeoutId = setTimeout(later, wait);\n\t\t}\n\n\t\tif (callNow) {\n\t\t\tresult = run();\n\t\t\treturn result;\n\t\t}\n\n\t\treturn undefined;\n\t};\n\n\tObject.defineProperty(debounced, 'isPending', {\n\t\tget() {\n\t\t\treturn timeoutId !== undefined;\n\t\t},\n\t});\n\n\tdebounced.clear = () => {\n\t\tif (!timeoutId) {\n\t\t\treturn;\n\t\t}\n\n\t\tclearTimeout(timeoutId);\n\t\ttimeoutId = undefined;\n\t\tstoredContext = undefined;\n\t\tstoredArguments = undefined;\n\t};\n\n\tdebounced.flush = () => {\n\t\tif (!timeoutId) {\n\t\t\treturn;\n\t\t}\n\n\t\tdebounced.trigger();\n\t};\n\n\tdebounced.trigger = () => {\n\t\tresult = run();\n\n\t\tdebounced.clear();\n\t};\n\n\treturn debounced;\n}\n","import '../assets/referencePickerModal.css';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode, toDisplayString, createCommentVNode, resolveComponent, createVNode, withCtx, withKeys, createBlock, normalizeClass, createTextVNode, withModifiers, normalizeStyle, createApp } from \"vue\";\nimport { emit } from \"@nextcloud/event-bus\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nimport { I as IconClose } from \"./Close.mjs\";\nimport { a as renderCustomPickerElement, d as destroyCustomPickerElement, i as isCustomPickerElementRegistered, g as getCustomPickerElementSize } from \"./customPickerElements.mjs\";\nimport axios from \"@nextcloud/axios\";\nimport { loadState } from \"@nextcloud/initial-state\";\nimport { imagePath, generateOcsUrl } from \"@nextcloud/router\";\nimport { r as register, X as t9, a as t, Y as t47, Z as t42, _ as t26, s as t44, $ as t33, A as t20, a0 as t13 } from \"./_l10n.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nimport { N as NcEmptyContent } from \"./NcEmptyContent.mjs\";\nimport { _ as _sfc_main$9 } from \"./NcHighlight.vue_vue_type_script_lang.mjs\";\nimport { N as NcSelect } from \"./NcSelect.mjs\";\nimport debounce from \"debounce\";\nimport { N as NcReferenceWidget } from \"./NcReferenceWidget.mjs\";\nimport { N as NcLoadingIcon } from \"./NcLoadingIcon.mjs\";\nimport { _ as _sfc_main$a } from \"./NcTextField.vue_vue_type_script_setup_true_lang.mjs\";\nimport { I as IconDotsHorizontal } from \"./NcActions.mjs\";\nimport { N as NcButton } from \"./NcButton.mjs\";\nimport { N as NcModal } from \"./NcModal.mjs\";\nconst _sfc_main$8 = {\n name: \"ArrowLeftIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$8 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$6 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$5 = { d: \"M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z\" };\nconst _hoisted_4$4 = { key: 0 };\nfunction _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon arrow-left-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$5, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$4, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$6))\n ], 16, _hoisted_1$8);\n}\nconst ArrowLeftIcon = /* @__PURE__ */ _export_sfc(_sfc_main$8, [[\"render\", _sfc_render$8]]);\nconst _sfc_main$7 = {\n name: \"NcCustomPickerElement\",\n props: {\n /**\n * The reference provider\n */\n provider: {\n type: Object,\n required: true\n }\n },\n emits: [\n \"cancel\",\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n isRegistered: isCustomPickerElementRegistered(this.provider.id),\n renderResult: null\n };\n },\n mounted() {\n if (this.isRegistered) {\n this.renderElement();\n }\n },\n beforeUnmount() {\n if (this.isRegistered) {\n destroyCustomPickerElement(this.provider.id, this.$el, this.renderResult);\n }\n },\n methods: {\n renderElement() {\n if (this.$refs.domElement) {\n this.$refs.domElement.innerHTML = \"\";\n }\n const renderFunctionResult = renderCustomPickerElement(this.$refs.domElement, { providerId: this.provider.id, accessible: false });\n Promise.resolve(renderFunctionResult).then((result) => {\n this.renderResult = result;\n if (this.renderResult.object?._isVue && this.renderResult.object?.$on) {\n this.renderResult.object.$on(\"submit\", this.onSubmit);\n this.renderResult.object.$on(\"pick\", this.onPick);\n this.renderResult.object.$on(\"cancel\", this.onCancel);\n }\n this.renderResult.element.addEventListener(\"submit\", (e) => {\n this.onSubmit(e.detail);\n });\n this.renderResult.element.addEventListener(\"pick\", (e) => {\n this.onPick(e.detail);\n });\n this.renderResult.element.addEventListener(\"cancel\", this.onCancel);\n });\n },\n onSubmit(value) {\n this.$emit(\"submit\", value);\n },\n onPick(value) {\n this.$emit(\"pick\", value);\n },\n onCancel() {\n this.$emit(\"cancel\");\n }\n }\n};\nconst _hoisted_1$7 = { ref: \"domElement\" };\nfunction _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", _hoisted_1$7, null, 512);\n}\nconst NcCustomPickerElement = /* @__PURE__ */ _export_sfc(_sfc_main$7, [[\"render\", _sfc_render$7], [\"__scopeId\", \"data-v-df9d8f84\"]]);\nconst _sfc_main$6 = {\n name: \"LinkVariantIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$6 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$5 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$4 = { d: \"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z\" };\nconst _hoisted_4$3 = { key: 0 };\nfunction _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon link-variant-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$4, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$3, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$5))\n ], 16, _hoisted_1$6);\n}\nconst LinkVariantIcon = /* @__PURE__ */ _export_sfc(_sfc_main$6, [[\"render\", _sfc_render$6]]);\nregister(t9);\nconst anyLinkProviderId = \"any-link\";\nconst anyLinkProvider = {\n id: anyLinkProviderId,\n title: t(\"Any link\"),\n order: 0,\n icon_url: imagePath(\"core\", \"filetypes/link.svg\")\n};\nwindow._vue_richtext_reference_providers ??= loadState(\"core\", \"reference-provider-list\", []);\nwindow._vue_richtext_reference_provider_timestamps ??= loadState(\"core\", \"reference-provider-timestamps\", {});\nfunction getProvider(providerId) {\n if (providerId === anyLinkProviderId) {\n return anyLinkProvider;\n }\n return getProviders().find((p) => p.id === providerId);\n}\nfunction getProviders() {\n return window._vue_richtext_reference_providers.filter((p) => {\n const keep = !!p.search_providers_ids && p.search_providers_ids.length > 0 || isCustomPickerElementRegistered(p.id);\n if (!keep) {\n logger.debug(`[smart picker] ${p.id} reference provider is discoverable but does not have any related search provider or custom picker component registered`);\n }\n return keep;\n });\n}\nfunction sortProviders(providerList) {\n const timestamps = window._vue_richtext_reference_provider_timestamps;\n return providerList.sort((a, b) => {\n return a.order === b.order ? 0 : a.order > b.order ? 1 : -1;\n }).sort((a, b) => {\n const ta = timestamps[a.id];\n const tb = timestamps[b.id];\n return ta === tb ? 0 : tb === void 0 ? -1 : ta === void 0 ? 1 : ta > tb ? -1 : 1;\n });\n}\nfunction searchProvider(query, limit) {\n const providers = getProviders();\n const escapedQuery = query.replace(/[/\\-\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n const regexp = new RegExp(escapedQuery, \"i\");\n const sortedProviders = sortProviders(providers);\n const filteredSortedProviders = sortedProviders.filter((p) => {\n return p.title.match(regexp);\n });\n const searchResult = limit ? filteredSortedProviders.slice(0, limit) : filteredSortedProviders;\n if (query === \"\" || searchResult.length === 0) {\n searchResult.push(anyLinkProvider);\n }\n return searchResult;\n}\nasync function touchProvider(providerId) {\n const timestamp = Math.floor(Date.now() / 1e3);\n const url = generateOcsUrl(\"references/provider/{providerId}\", { providerId });\n await axios.put(url, { timestamp });\n window._vue_richtext_reference_provider_timestamps[providerId] = timestamp;\n}\nregister(t42, t47);\n/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isUrl(str) {\n try {\n return Boolean(new URL(str));\n } catch {\n return false;\n }\n}\nconst _sfc_main$5 = {\n name: \"NcProviderList\",\n components: {\n NcSelect,\n NcHighlight: _sfc_main$9,\n NcEmptyContent,\n LinkVariantIcon\n },\n emits: [\n \"selectProvider\",\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n selectedProvider: null,\n query: \"\",\n multiselectPlaceholder: t(\"Select provider\"),\n providerIconAlt: t(\"Provider icon\")\n };\n },\n computed: {\n options() {\n const result = [];\n if (this.query !== \"\" && isUrl(this.query)) {\n result.push({\n id: this.query,\n title: this.query,\n isLink: true\n });\n }\n result.push(...searchProvider(this.query));\n return result;\n }\n },\n methods: {\n focus() {\n setTimeout(() => {\n this.$refs[\"provider-select\"]?.$el?.querySelector(\"#provider-select-input\")?.focus();\n }, 300);\n },\n onProviderSelected(p) {\n if (p !== null) {\n if (p.isLink) {\n this.$emit(\"submit\", p.title);\n this.$emit(\"pick\", { link: p.title });\n } else {\n this.$emit(\"selectProvider\", p);\n }\n this.selectedProvider = null;\n }\n },\n onSearch(query) {\n this.query = query;\n }\n }\n};\nconst _hoisted_1$5 = { class: \"provider-list\" };\nconst _hoisted_2$4 = {\n key: 0,\n class: \"provider\"\n};\nconst _hoisted_3$3 = {\n key: 1,\n class: \"provider\"\n};\nconst _hoisted_4$2 = [\"src\", \"alt\"];\nfunction _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcHighlight = resolveComponent(\"NcHighlight\");\n const _component_NcSelect = resolveComponent(\"NcSelect\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$5, [\n createVNode(_component_NcSelect, {\n ref: \"provider-select\",\n modelValue: $data.selectedProvider,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.selectedProvider = $event),\n $options.onProviderSelected\n ],\n class: \"provider-list--select\",\n inputId: \"provider-select-input\",\n label: \"title\",\n placeholder: $data.multiselectPlaceholder,\n options: $options.options,\n appendToBody: false,\n clearSearchOnSelect: true,\n clearSearchOnBlur: () => false,\n filterable: false,\n onSearch: $options.onSearch\n }, {\n option: withCtx((option) => [\n option.isLink ? (openBlock(), createElementBlock(\"div\", _hoisted_2$4, [\n createVNode(_component_LinkVariantIcon, {\n class: \"link-icon\",\n size: 20\n }),\n createElementVNode(\"span\", null, toDisplayString(option.title), 1)\n ])) : (openBlock(), createElementBlock(\"div\", _hoisted_3$3, [\n createElementVNode(\"img\", {\n class: \"provider-icon\",\n src: option.icon_url,\n alt: $data.providerIconAlt\n }, null, 8, _hoisted_4$2),\n createVNode(_component_NcHighlight, {\n class: \"option-text\",\n search: $data.query,\n text: option.title\n }, null, 8, [\"search\", \"text\"])\n ]))\n ]),\n _: 1\n }, 8, [\"modelValue\", \"placeholder\", \"options\", \"onSearch\", \"onUpdate:modelValue\"]),\n createVNode(_component_NcEmptyContent, { class: \"provider-list--empty-content\" }, {\n icon: withCtx(() => [\n createVNode(_component_LinkVariantIcon)\n ]),\n _: 1\n })\n ]);\n}\nconst NcProviderList = /* @__PURE__ */ _export_sfc(_sfc_main$5, [[\"render\", _sfc_render$5], [\"__scopeId\", \"data-v-c9740c42\"]]);\nregister(t26);\nconst _sfc_main$4 = {\n name: \"NcRawLinkInput\",\n components: {\n LinkVariantIcon,\n NcEmptyContent,\n NcLoadingIcon,\n NcReferenceWidget,\n NcTextField: _sfc_main$a\n },\n props: {\n /**\n * The reference provider\n */\n provider: {\n type: Object,\n required: true\n }\n },\n emits: [\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n inputValue: \"\",\n loading: false,\n reference: null,\n abortController: null,\n inputPlaceholder: t(\"Enter link\")\n };\n },\n computed: {\n isLinkValid() {\n return isUrl(this.inputValue);\n },\n debouncedUpdateReference() {\n return debounce(this.updateReference, 500);\n }\n },\n methods: {\n focus() {\n this.$refs[\"url-input\"].$el.getElementsByTagName(\"input\")[0]?.focus();\n },\n onSubmit(e) {\n const value = e.target.value;\n if (this.isLinkValid) {\n this.$emit(\"submit\", value);\n this.$emit(\"pick\", { link: value });\n }\n },\n onClear() {\n this.inputValue = \"\";\n this.reference = null;\n },\n onInput() {\n this.reference = null;\n if (this.abortController) {\n this.abortController.abort();\n }\n if (this.isLinkValid) {\n this.debouncedUpdateReference();\n }\n },\n updateReference() {\n this.loading = true;\n this.abortController = new AbortController();\n axios.get(generateOcsUrl(\"references/resolve\", 2) + \"?reference=\" + encodeURIComponent(this.inputValue), {\n signal: this.abortController.signal\n }).then((response) => {\n this.reference = response.data.ocs.data.references[this.inputValue];\n }).catch((error) => {\n logger.error(\"[NcRawLinkInput] Failed to update reference\", { error });\n }).then(() => {\n this.loading = false;\n });\n }\n }\n};\nconst _hoisted_1$4 = { class: \"raw-link\" };\nconst _hoisted_2$3 = { class: \"input-wrapper\" };\nconst _hoisted_3$2 = [\"src\"];\nfunction _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcLoadingIcon = resolveComponent(\"NcLoadingIcon\");\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcTextField = resolveComponent(\"NcTextField\");\n const _component_NcReferenceWidget = resolveComponent(\"NcReferenceWidget\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$4, [\n createElementVNode(\"div\", _hoisted_2$3, [\n createVNode(_component_NcTextField, {\n ref: \"url-input\",\n modelValue: $data.inputValue,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.inputValue = $event),\n $options.onInput\n ],\n showTrailingButton: $data.inputValue !== \"\",\n label: $data.inputPlaceholder,\n onTrailingButtonClick: $options.onClear,\n onKeyup: withKeys($options.onSubmit, [\"enter\"])\n }, {\n default: withCtx(() => [\n $data.loading ? (openBlock(), createBlock(_component_NcLoadingIcon, {\n key: 0,\n size: 16\n })) : (openBlock(), createBlock(_component_LinkVariantIcon, {\n key: 1,\n size: 16\n }))\n ]),\n _: 1\n }, 8, [\"modelValue\", \"showTrailingButton\", \"label\", \"onTrailingButtonClick\", \"onUpdate:modelValue\", \"onKeyup\"])\n ]),\n $data.reference !== null ? (openBlock(), createBlock(_component_NcReferenceWidget, {\n key: 0,\n class: \"reference-widget\",\n reference: $data.reference\n }, null, 8, [\"reference\"])) : (openBlock(), createBlock(_component_NcEmptyContent, {\n key: 1,\n class: \"raw-link--empty-content\"\n }, {\n icon: withCtx(() => [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon\",\n src: $props.provider.icon_url\n }, null, 8, _hoisted_3$2)) : (openBlock(), createBlock(_component_LinkVariantIcon, { key: 1 }))\n ]),\n _: 1\n }))\n ]);\n}\nconst NcRawLinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$4, [[\"render\", _sfc_render$4], [\"__scopeId\", \"data-v-fb24b594\"]]);\nconst _sfc_main$3 = {\n name: \"NcSearchResult\",\n components: {\n NcHighlight: _sfc_main$9\n },\n props: {\n /**\n * Unified search result entry\n */\n entry: {\n type: Object,\n required: true\n },\n /**\n * The query that led to getting this result\n * Used to highlight the entry text\n */\n query: {\n type: String,\n required: true\n }\n }\n};\nconst _hoisted_1$3 = { class: \"result\" };\nconst _hoisted_2$2 = [\"src\"];\nconst _hoisted_3$1 = { class: \"result--content\" };\nconst _hoisted_4$1 = { class: \"result--content--name\" };\nconst _hoisted_5$1 = { class: \"result--content--subline\" };\nfunction _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcHighlight = resolveComponent(\"NcHighlight\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$3, [\n $props.entry.icon ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass([{ [$props.entry.icon]: true, rounded: $props.entry.rounded }, \"result--icon-class\"])\n }, null, 2)) : (openBlock(), createElementBlock(\"img\", {\n key: 1,\n class: normalizeClass([\"result--image\", { rounded: $props.entry.rounded }]),\n src: $props.entry.thumbnailUrl\n }, null, 10, _hoisted_2$2)),\n createElementVNode(\"div\", _hoisted_3$1, [\n createElementVNode(\"span\", _hoisted_4$1, [\n createVNode(_component_NcHighlight, {\n search: $props.query,\n text: $props.entry.title\n }, null, 8, [\"search\", \"text\"])\n ]),\n createElementVNode(\"span\", _hoisted_5$1, [\n createVNode(_component_NcHighlight, {\n search: $props.query,\n text: $props.entry.subline\n }, null, 8, [\"search\", \"text\"])\n ])\n ])\n ]);\n}\nconst NcSearchResult = /* @__PURE__ */ _export_sfc(_sfc_main$3, [[\"render\", _sfc_render$3], [\"__scopeId\", \"data-v-059edcfb\"]]);\nregister(t33, t42, t44);\nconst LIMIT = 5;\nconst _sfc_main$2 = {\n name: \"NcSearch\",\n components: {\n LinkVariantIcon,\n DotsHorizontalIcon: IconDotsHorizontal,\n NcEmptyContent,\n NcSelect,\n NcSearchResult\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n /**\n * The selected reference provider\n */\n provider: {\n type: Object,\n required: true\n },\n /**\n * Whether to show the empty content when there are no search results\n */\n showEmptyContent: {\n type: Boolean,\n default: true\n },\n /**\n * Placeholder of the search\n */\n searchPlaceholder: {\n type: String,\n default: null\n }\n },\n emits: [\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n searchQuery: \"\",\n selectedResult: null,\n resultsBySearchProvider: {},\n searching: false,\n searchingMoreOf: null,\n abortController: null,\n noOptionsText: t(\"Start typing to search\"),\n providerIconAlt: t(\"Provider icon\")\n };\n },\n computed: {\n mySearchPlaceholder() {\n return this.searchPlaceholder || t(\"Search\");\n },\n searchProviderIds() {\n return this.provider.search_providers_ids;\n },\n options() {\n if (this.searchQuery === \"\") {\n return [];\n }\n const options = [];\n if (isUrl(this.searchQuery)) {\n options.push(this.rawLinkEntry);\n }\n options.push(...this.formattedSearchResults);\n return options;\n },\n rawLinkEntry() {\n return {\n id: \"rawLinkEntry\",\n resourceUrl: this.searchQuery,\n isRawLink: true\n };\n },\n formattedSearchResults() {\n const results = [];\n this.searchProviderIds.forEach((pid) => {\n if (this.resultsBySearchProvider[pid].entries.length > 0) {\n if (this.searchProviderIds.length > 1 || this.resultsBySearchProvider[pid].entries.length > 1) {\n results.push({\n id: \"groupTitle-\" + pid,\n name: this.resultsBySearchProvider[pid].name,\n isCustomGroupTitle: true,\n providerId: pid\n });\n }\n const providerEntriesWithId = this.resultsBySearchProvider[pid].entries.map((entry, index) => {\n return {\n id: \"provider-\" + pid + \"-entry-\" + index,\n ...entry\n };\n });\n results.push(...providerEntriesWithId);\n if (this.resultsBySearchProvider[pid].isPaginated) {\n results.push({\n id: \"moreOf-\" + pid,\n name: this.resultsBySearchProvider[pid].name,\n isMore: true,\n providerId: pid,\n isLoading: this.searchingMoreOf === pid\n });\n }\n }\n });\n return results;\n },\n debouncedUpdateSearch() {\n return debounce(this.updateSearch, 500);\n }\n },\n mounted() {\n this.resetResults();\n },\n beforeUnmount() {\n this.cancelSearchRequests();\n },\n methods: {\n t,\n resetResults() {\n const resultsBySearchProvider = {};\n this.searchProviderIds.forEach((pid) => {\n resultsBySearchProvider[pid] = {\n entries: []\n };\n });\n this.resultsBySearchProvider = resultsBySearchProvider;\n },\n focus() {\n setTimeout(() => {\n this.$refs[\"search-select\"]?.$el?.querySelector(\"#search-select-input\")?.focus();\n }, 300);\n },\n cancelSearchRequests() {\n if (this.abortController) {\n this.abortController.abort();\n }\n },\n onSearchInput(query) {\n this.searchQuery = query;\n this.debouncedUpdateSearch();\n },\n onSelectResultSelected(item) {\n if (item !== null) {\n if (item.resourceUrl) {\n this.cancelSearchRequests();\n this.$emit(\"submit\", item.resourceUrl);\n const reference = { link: item.resourceUrl };\n if (item.title) {\n reference.title = item.title;\n }\n this.$emit(\"pick\", reference);\n } else if (item.isMore) {\n this.searchMoreOf(item.providerId).then(() => {\n this.selectedResult = null;\n });\n }\n }\n },\n searchMoreOf(searchProviderId) {\n this.searchingMoreOf = searchProviderId;\n this.cancelSearchRequests();\n return this.searchProviders(searchProviderId);\n },\n updateSearch() {\n this.cancelSearchRequests();\n this.resetResults();\n if (this.searchQuery === \"\") {\n this.searching = false;\n return;\n }\n return this.searchProviders();\n },\n searchProviders(searchProviderId = null) {\n this.abortController = new AbortController();\n this.searching = true;\n const searchPromises = searchProviderId === null ? [...this.searchProviderIds].map((pid) => {\n return this.searchOneProvider(pid);\n }) : [this.searchOneProvider(searchProviderId, this.resultsBySearchProvider[searchProviderId]?.cursor ?? null)];\n return Promise.allSettled(searchPromises).then((promises) => {\n const isOneCanceled = !!promises.find((p) => {\n return p.status === \"rejected\" && (p.reason.name === \"CanceledError\" || p.reason.code === \"ERR_CANCELED\");\n });\n if (!isOneCanceled) {\n this.searching = false;\n this.searchingMoreOf = null;\n }\n });\n },\n searchOneProvider(providerId, cursor = null) {\n const url = cursor === null ? generateOcsUrl(\"search/providers/{providerId}/search?term={term}&limit={limit}\", { providerId, term: this.searchQuery, limit: LIMIT }) : generateOcsUrl(\"search/providers/{providerId}/search?term={term}&limit={limit}&cursor={cursor}\", { providerId, term: this.searchQuery, limit: LIMIT, cursor });\n return axios.get(url, {\n signal: this.abortController.signal\n }).then((response) => {\n const data = response.data.ocs.data;\n this.resultsBySearchProvider[providerId].name = data.name;\n this.resultsBySearchProvider[providerId].cursor = data.cursor;\n this.resultsBySearchProvider[providerId].isPaginated = data.isPaginated;\n this.resultsBySearchProvider[providerId].entries.push(...data.entries);\n });\n }\n }\n};\nconst _hoisted_1$2 = {\n key: 0,\n class: \"custom-option\"\n};\nconst _hoisted_2$1 = { class: \"option-text\" };\nconst _hoisted_3 = {\n key: 2,\n class: \"custom-option group-name\"\n};\nconst _hoisted_4 = [\"src\"];\nconst _hoisted_5 = { class: \"option-text\" };\nconst _hoisted_6 = {\n key: 3,\n class: \"custom-option\"\n};\nconst _hoisted_7 = {\n key: 0,\n class: \"option-simple-icon icon-loading-small\"\n};\nconst _hoisted_8 = { class: \"option-text\" };\nconst _hoisted_9 = [\"alt\", \"src\"];\nfunction _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcSearchResult = resolveComponent(\"NcSearchResult\");\n const _component_DotsHorizontalIcon = resolveComponent(\"DotsHorizontalIcon\");\n const _component_NcSelect = resolveComponent(\"NcSelect\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", {\n class: normalizeClass([\"smart-picker-search\", { \"with-empty-content\": $props.showEmptyContent }])\n }, [\n createVNode(_component_NcSelect, {\n ref: \"search-select\",\n modelValue: $data.selectedResult,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.selectedResult = $event),\n $options.onSelectResultSelected\n ],\n class: \"smart-picker-search--select\",\n inputId: \"search-select-input\",\n label: \"name\",\n placeholder: $options.mySearchPlaceholder,\n options: $options.options,\n appendToBody: false,\n closeOnSelect: false,\n clearSearchOnSelect: false,\n clearSearchOnBlur: () => false,\n resetFocusOnOptionsChange: false,\n filterable: false,\n autoscroll: true,\n resetOnOptionsChange: false,\n loading: $data.searching,\n onSearch: $options.onSearchInput\n }, {\n option: withCtx((option) => [\n option.isRawLink ? (openBlock(), createElementBlock(\"div\", _hoisted_1$2, [\n createVNode(_component_LinkVariantIcon, {\n class: \"option-simple-icon\",\n size: 20\n }),\n createElementVNode(\"span\", _hoisted_2$1, toDisplayString($options.t(\"Raw link {options}\", { options: option.resourceUrl })), 1)\n ])) : option.resourceUrl ? (openBlock(), createBlock(_component_NcSearchResult, {\n key: 1,\n class: \"search-result\",\n entry: option,\n query: $data.searchQuery\n }, null, 8, [\"entry\", \"query\"])) : option.isCustomGroupTitle ? (openBlock(), createElementBlock(\"span\", _hoisted_3, [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon group-name-icon\",\n src: $props.provider.icon_url\n }, null, 8, _hoisted_4)) : createCommentVNode(\"\", true),\n createElementVNode(\"span\", _hoisted_5, [\n createElementVNode(\"strong\", null, toDisplayString(option.name), 1)\n ])\n ])) : option.isMore ? (openBlock(), createElementBlock(\"span\", _hoisted_6, [\n option.isLoading ? (openBlock(), createElementBlock(\"span\", _hoisted_7)) : (openBlock(), createBlock(_component_DotsHorizontalIcon, {\n key: 1,\n class: \"option-simple-icon\",\n size: 20\n })),\n createElementVNode(\"span\", _hoisted_8, toDisplayString($options.t('Load more \"{options}\"', { options: option.name })), 1)\n ])) : createCommentVNode(\"\", true)\n ]),\n \"no-options\": withCtx(() => [\n createTextVNode(toDisplayString($data.noOptionsText), 1)\n ]),\n _: 1\n }, 8, [\"modelValue\", \"placeholder\", \"options\", \"loading\", \"onSearch\", \"onUpdate:modelValue\"]),\n $props.showEmptyContent ? (openBlock(), createBlock(_component_NcEmptyContent, {\n key: 0,\n class: \"smart-picker-search--empty-content\"\n }, {\n icon: withCtx(() => [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon\",\n alt: $data.providerIconAlt,\n src: $props.provider.icon_url\n }, null, 8, _hoisted_9)) : (openBlock(), createBlock(_component_LinkVariantIcon, { key: 1 }))\n ]),\n _: 1\n })) : createCommentVNode(\"\", true)\n ], 2);\n}\nconst NcSearch = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render$2], [\"__scopeId\", \"data-v-d965b4c7\"]]);\nconst MODES = {\n providerList: 1,\n standardLinkInput: 2,\n searchInput: 3,\n customElement: 4\n};\nconst _sfc_main$1 = {\n name: \"NcReferencePicker\",\n components: {\n NcCustomPickerElement,\n NcProviderList,\n NcRawLinkInput,\n NcSearch\n },\n props: {\n /**\n * Provider to select on creation\n * Default: null. Show the provider list\n */\n initialProvider: {\n type: Object,\n default: () => null\n },\n /**\n * Optional width in pixels\n * Default: 100%\n */\n width: {\n type: Number,\n default: null\n },\n /**\n * Focus on the provider list select input on creation\n * Default: true\n */\n focusOnCreate: {\n type: Boolean,\n default: true\n }\n },\n emits: [\n \"cancel\",\n \"cancelRawLink\",\n \"cancelSearch\",\n \"providerSelected\",\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n MODES,\n selectedProvider: this.initialProvider\n };\n },\n computed: {\n mode() {\n return this.selectedProvider === null ? MODES.providerList : isCustomPickerElementRegistered(this.selectedProvider.id) ? MODES.customElement : this.selectedProvider.search_providers_ids ? MODES.searchInput : MODES.standardLinkInput;\n },\n pickerWrapperStyle() {\n return {\n width: this.width ? this.width + \"px\" : void 0\n };\n }\n },\n mounted() {\n if (this.focusOnCreate) {\n if (this.initialProvider) {\n setTimeout(() => {\n this.$refs[\"url-input\"]?.focus();\n }, 300);\n } else {\n this.$nextTick(() => {\n this.$refs[\"provider-list\"]?.focus();\n });\n }\n }\n },\n methods: {\n onEscapePressed() {\n if (this.selectedProvider !== null) {\n this.deselectProvider();\n } else {\n this.cancelProviderSelection();\n }\n },\n onProviderSelected(provider) {\n this.selectedProvider = provider;\n this.$emit(\"providerSelected\", provider);\n this.$nextTick(() => {\n this.$refs[\"url-input\"]?.focus();\n });\n },\n cancelCustomElement() {\n this.deselectProvider();\n },\n cancelSearch() {\n this.$emit(\"cancelSearch\", this.selectedProvider?.title);\n this.deselectProvider();\n },\n cancelRawLinkInput() {\n this.$emit(\"cancelRawLink\", this.selectedProvider?.title);\n this.deselectProvider();\n },\n cancelProviderSelection() {\n this.$emit(\"cancel\");\n },\n submitLink(link) {\n if (this.selectedProvider !== null) {\n touchProvider(this.selectedProvider.id);\n }\n this.$emit(\"submit\", link);\n this.deselectProvider();\n },\n pickLink(reference) {\n if (this.selectedProvider !== null) {\n touchProvider(this.selectedProvider.id);\n }\n this.$emit(\"pick\", reference);\n this.deselectProvider();\n },\n deselectProvider() {\n this.selectedProvider = null;\n this.$emit(\"providerSelected\", null);\n setTimeout(() => {\n this.$refs[\"provider-list\"]?.focus();\n }, 300);\n }\n }\n};\nconst _hoisted_1$1 = {\n key: 3,\n class: \"custom-element-wrapper\"\n};\nfunction _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcProviderList = resolveComponent(\"NcProviderList\");\n const _component_NcRawLinkInput = resolveComponent(\"NcRawLinkInput\");\n const _component_NcSearch = resolveComponent(\"NcSearch\");\n const _component_NcCustomPickerElement = resolveComponent(\"NcCustomPickerElement\");\n return openBlock(), createElementBlock(\"div\", {\n class: \"reference-picker\",\n style: normalizeStyle($options.pickerWrapperStyle),\n tabindex: \"-1\",\n onKeydown: _cache[0] || (_cache[0] = withKeys(withModifiers((...args) => $options.onEscapePressed && $options.onEscapePressed(...args), [\"stop\", \"prevent\"]), [\"esc\"]))\n }, [\n $options.mode === $data.MODES.providerList ? (openBlock(), createBlock(_component_NcProviderList, {\n key: 0,\n ref: \"provider-list\",\n onSelectProvider: $options.onProviderSelected,\n onSubmit: $options.submitLink,\n onPick: $options.pickLink,\n onCancel: $options.cancelProviderSelection\n }, null, 8, [\"onSelectProvider\", \"onSubmit\", \"onPick\", \"onCancel\"])) : $options.mode === $data.MODES.standardLinkInput ? (openBlock(), createBlock(_component_NcRawLinkInput, {\n key: 1,\n ref: \"url-input\",\n provider: $data.selectedProvider,\n onSubmit: $options.submitLink,\n onPick: $options.pickLink,\n onCancel: $options.cancelRawLinkInput\n }, null, 8, [\"provider\", \"onSubmit\", \"onPick\", \"onCancel\"])) : $options.mode === $data.MODES.searchInput ? (openBlock(), createBlock(_component_NcSearch, {\n key: 2,\n ref: \"url-input\",\n provider: $data.selectedProvider,\n onSubmit: $options.submitLink,\n onPick: $options.pickLink,\n onCancel: $options.cancelSearch\n }, null, 8, [\"provider\", \"onSubmit\", \"onPick\", \"onCancel\"])) : $options.mode === $data.MODES.customElement ? (openBlock(), createElementBlock(\"div\", _hoisted_1$1, [\n createVNode(_component_NcCustomPickerElement, {\n provider: $data.selectedProvider,\n class: \"custom-element\",\n onSubmit: $options.submitLink,\n onPick: $options.pickLink,\n onCancel: $options.cancelCustomElement\n }, null, 8, [\"provider\", \"onSubmit\", \"onPick\", \"onCancel\"])\n ])) : createCommentVNode(\"\", true)\n ], 36);\n}\nconst NcReferencePicker = /* @__PURE__ */ _export_sfc(_sfc_main$1, [[\"render\", _sfc_render$1], [\"__scopeId\", \"data-v-40667c6c\"]]);\nregister(t13, t20);\nconst _sfc_main = {\n name: \"NcReferencePickerModal\",\n components: {\n NcReferencePicker,\n NcModal,\n NcButton,\n ArrowLeftIcon,\n CloseIcon: IconClose\n },\n props: {\n /**\n * Provider to select on creation\n * Show the provider list if no initial one is provided\n */\n initialProvider: {\n type: Object,\n default: () => null\n },\n /**\n * Focus on the input item on create\n */\n focusOnCreate: {\n type: Boolean,\n default: true\n },\n /**\n * If true, add the modal content to the Viewer trap elements via the event-bus\n */\n isInsideViewer: {\n type: Boolean,\n default: false\n }\n },\n emits: [\n \"cancel\",\n \"submit\",\n \"pick\"\n ],\n data() {\n return {\n show: true,\n selectedProvider: this.initialProvider,\n backButtonTitle: t(\"Back to provider selection\"),\n closeButtonTitle: t(\"Close\"),\n closeButtonLabel: t(\"Close Smart Picker\")\n };\n },\n computed: {\n isProviderSelected() {\n return this.selectedProvider !== null;\n },\n showBackButton() {\n return this.initialProvider === null && this.isProviderSelected;\n },\n modalSize() {\n return this.isProviderSelected && isCustomPickerElementRegistered(this.selectedProvider.id) ? getCustomPickerElementSize(this.selectedProvider.id) ?? \"large\" : \"normal\";\n },\n showModalName() {\n return !this.isProviderSelected || !isCustomPickerElementRegistered(this.selectedProvider.id);\n },\n modalName() {\n return this.isProviderSelected ? this.selectedProvider.title : t(\"Smart Picker\");\n }\n },\n mounted() {\n if (this.isInsideViewer) {\n const elem = this.$refs.modal_content;\n emit(\"viewer:trapElements:changed\", elem);\n }\n },\n methods: {\n onCancel() {\n this.show = false;\n this.$emit(\"cancel\");\n },\n onSubmit(value) {\n this.show = false;\n this.$emit(\"submit\", value);\n },\n onPick(value) {\n this.show = false;\n this.$emit(\"pick\", value);\n },\n onProviderSelect(provider) {\n this.selectedProvider = provider;\n if (provider === null && this.initialProvider !== null) {\n this.onCancel();\n }\n },\n onBackClicked() {\n this.$refs.referencePicker.deselectProvider();\n }\n }\n};\nconst _hoisted_1 = {\n ref: \"modal_content\",\n class: \"reference-picker-modal--content\"\n};\nconst _hoisted_2 = { key: 1 };\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_ArrowLeftIcon = resolveComponent(\"ArrowLeftIcon\");\n const _component_NcButton = resolveComponent(\"NcButton\");\n const _component_CloseIcon = resolveComponent(\"CloseIcon\");\n const _component_NcReferencePicker = resolveComponent(\"NcReferencePicker\");\n const _component_NcModal = resolveComponent(\"NcModal\");\n return $data.show ? (openBlock(), createBlock(_component_NcModal, {\n key: 0,\n size: $options.modalSize,\n class: \"reference-picker-modal\",\n onClose: $options.onCancel\n }, {\n default: withCtx(() => [\n createElementVNode(\"div\", _hoisted_1, [\n $options.showBackButton ? (openBlock(), createBlock(_component_NcButton, {\n key: 0,\n \"aria-label\": $data.backButtonTitle,\n title: $data.backButtonTitle,\n class: \"back-button\",\n onClick: $options.onBackClicked\n }, {\n icon: withCtx(() => [\n createVNode(_component_ArrowLeftIcon)\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"])) : createCommentVNode(\"\", true),\n createVNode(_component_NcButton, {\n class: \"close-button\",\n \"aria-label\": $data.closeButtonLabel,\n title: $data.closeButtonTitle,\n variant: \"tertiary\",\n onClick: $options.onCancel\n }, {\n icon: withCtx(() => [\n createVNode(_component_CloseIcon)\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"]),\n $options.showModalName ? (openBlock(), createElementBlock(\"h2\", _hoisted_2, toDisplayString($options.modalName), 1)) : createCommentVNode(\"\", true),\n createVNode(_component_NcReferencePicker, {\n ref: \"referencePicker\",\n initialProvider: $props.initialProvider,\n focusOnCreate: $props.focusOnCreate,\n onProviderSelected: $options.onProviderSelect,\n onSubmit: $options.onSubmit,\n onPick: $options.onPick,\n onCancel: $options.onCancel\n }, null, 8, [\"initialProvider\", \"focusOnCreate\", \"onProviderSelected\", \"onSubmit\", \"onPick\", \"onCancel\"])\n ], 512)\n ]),\n _: 1\n }, 8, [\"size\", \"onClose\"])) : createCommentVNode(\"\", true);\n}\nconst NcReferencePickerModal = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"render\", _sfc_render], [\"__scopeId\", \"data-v-58d45f81\"]]);\nasync function getLinkWithPicker(providerId, isInsideViewer) {\n const modalId = \"referencePickerModal\";\n const modalElement = document.createElement(\"div\");\n modalElement.id = modalId;\n document.body.append(modalElement);\n const { promise, reject, resolve } = Promise.withResolvers();\n const initialProvider = providerId && getProvider(providerId) || null;\n const view = createApp(NcReferencePickerModal, {\n initialProvider,\n isInsideViewer,\n onCancel() {\n view.unmount();\n reject(new Error(\"User cancellation\"));\n },\n onSubmit(link) {\n view.unmount();\n resolve(link);\n }\n });\n view.mount(modalElement);\n return promise;\n}\nasync function getReferenceWithPicker(providerId, isInsideViewer) {\n const modalId = \"referencePickerModal\";\n const modalElement = document.createElement(\"div\");\n modalElement.id = modalId;\n document.body.append(modalElement);\n const { promise, reject, resolve } = Promise.withResolvers();\n const initialProvider = providerId && getProvider(providerId) || null;\n const view = createApp(NcReferencePickerModal, {\n initialProvider,\n isInsideViewer,\n onCancel() {\n view.unmount();\n reject(new Error(\"User cancellation\"));\n },\n onPick(reference) {\n view.unmount();\n resolve(reference);\n }\n });\n view.mount(modalElement);\n return promise;\n}\nexport {\n NcReferencePicker as N,\n anyLinkProviderId as a,\n getProvider as b,\n getProviders as c,\n getReferenceWithPicker as d,\n sortProviders as e,\n NcReferencePickerModal as f,\n getLinkWithPicker as g,\n NcSearch as h,\n searchProvider as s\n};\n//# sourceMappingURL=referencePickerModal.mjs.map\n","\n\n\n\n\n","\n\n\n\n\n\n\n","\n\n\n\n\n","import { defaultWindow, isClient, onClickOutside, onKeyStroke, onLongPress, useActiveElement, useBattery, useBrowserLocation, useClipboard, useColorMode, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useDraggable, useElementBounding, useElementHover, useElementOverflow, useElementSize, useElementVisibility, useEyeDropper, useFullscreen, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePreferredReducedTransparency, useResizeObserver, useScreenSafeArea, useScroll, useScrollLock, useStorage, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from \"@vueuse/core\";\nimport { computed, defineComponent, getCurrentInstance, h, onMounted, reactive, shallowReadonly, shallowRef, toRefs, toValue, watch } from \"vue\";\nimport { createDisposableDirective, isClient as isClient$1, notNullish, reactiveOmit, toArray, toRefs as toRefs$1, tryOnScopeDispose, useToggle } from \"@vueuse/shared\";\n//#region ../core/onClickOutside/component.ts\nconst OnClickOutside = /* #__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst target = shallowRef();\n\tonClickOutside(target, (e) => {\n\t\temit(\"trigger\", e);\n\t}, props.options);\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default());\n\t};\n}, {\n\tname: \"OnClickOutside\",\n\tprops: [\"as\", \"options\"],\n\temits: [\"trigger\"]\n});\n//#endregion\n//#region ../core/onClickOutside/directive.ts\nconst stopClickOutsideMap = /* @__PURE__ */ new WeakMap();\nconst vOnClickOutside = {\n\tmounted(el, binding) {\n\t\tconst capture = !binding.modifiers.bubble;\n\t\tlet stop;\n\t\tif (typeof binding.value === \"function\") stop = onClickOutside(el, binding.value, { capture });\n\t\telse {\n\t\t\tconst [handler, options] = binding.value;\n\t\t\tstop = onClickOutside(el, handler, Object.assign({ capture }, options));\n\t\t}\n\t\tstopClickOutsideMap.set(el, stop);\n\t},\n\tunmounted(el) {\n\t\tconst stop = stopClickOutsideMap.get(el);\n\t\tif (stop && typeof stop === \"function\") stop();\n\t\telse stop === null || stop === void 0 || stop.stop();\n\t\tstopClickOutsideMap.delete(el);\n\t}\n};\n/** @deprecated use `vOnClickOutside` instead */\nconst VOnClickOutside = vOnClickOutside;\n//#endregion\n//#region ../core/onKeyStroke/directive.ts\nconst vOnKeyStroke = createDisposableDirective({ mounted(el, binding) {\n\tvar _binding$arg$split, _binding$arg;\n\tconst keys = (_binding$arg$split = (_binding$arg = binding.arg) === null || _binding$arg === void 0 ? void 0 : _binding$arg.split(\",\")) !== null && _binding$arg$split !== void 0 ? _binding$arg$split : true;\n\tif (typeof binding.value === \"function\") onKeyStroke(keys, binding.value, { target: el });\n\telse {\n\t\tconst [handler, options] = binding.value;\n\t\tonKeyStroke(keys, handler, {\n\t\t\ttarget: el,\n\t\t\t...options\n\t\t});\n\t}\n} });\n//#endregion\n//#region ../core/onLongPress/component.ts\nconst OnLongPress = /* #__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst target = shallowRef();\n\tconst data = onLongPress(target, (e) => {\n\t\temit(\"trigger\", e);\n\t}, props.options);\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"OnLongPress\",\n\tprops: [\"as\", \"options\"],\n\temits: [\"trigger\"]\n});\n//#endregion\n//#region ../core/onLongPress/directive.ts\nconst vOnLongPress = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") onLongPress(el, binding.value, { modifiers: binding.modifiers });\n\telse onLongPress(el, ...binding.value);\n} });\n/** @deprecated use `vOnLongPress` instead */\nconst VOnLongPress = vOnLongPress;\n//#endregion\n//#region ../core/useActiveElement/component.ts\nconst UseActiveElement = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ element: useActiveElement(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseActiveElement\",\n\tprops: [\n\t\t\"deep\",\n\t\t\"triggerOnRemoval\",\n\t\t\"window\",\n\t\t\"document\"\n\t]\n});\n//#endregion\n//#region ../core/useBattery/component.ts\nconst UseBattery = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useBattery(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseBattery\",\n\tprops: [\"navigator\"]\n});\n//#endregion\n//#region ../core/useBrowserLocation/component.ts\nconst UseBrowserLocation = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useBrowserLocation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseBrowserLocation\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useClipboard/component.ts\nconst UseClipboard = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useClipboard(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseClipboard\",\n\tprops: [\n\t\t\"source\",\n\t\t\"read\",\n\t\t\"navigator\",\n\t\t\"copiedDuring\",\n\t\t\"legacy\"\n\t]\n});\n//#endregion\n//#region ../core/useColorMode/component.ts\nconst UseColorMode = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst mode = useColorMode(props);\n\tconst data = reactive({\n\t\tmode,\n\t\tsystem: mode.system,\n\t\tstore: mode.store\n\t});\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseColorMode\",\n\tprops: [\n\t\t\"attribute\",\n\t\t\"deep\",\n\t\t\"disableTransition\",\n\t\t\"emitAuto\",\n\t\t\"eventFilter\",\n\t\t\"flush\",\n\t\t\"initOnMounted\",\n\t\t\"initialValue\",\n\t\t\"listenToStorageChanges\",\n\t\t\"mergeDefaults\",\n\t\t\"modes\",\n\t\t\"onChanged\",\n\t\t\"onError\",\n\t\t\"selector\",\n\t\t\"serializer\",\n\t\t\"shallow\",\n\t\t\"storage\",\n\t\t\"storageKey\",\n\t\t\"storageRef\",\n\t\t\"window\",\n\t\t\"writeDefaults\"\n\t]\n});\n//#endregion\n//#region ../core/useDark/component.ts\nconst UseDark = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst isDark = useDark(props);\n\tconst data = reactive({\n\t\tisDark,\n\t\ttoggleDark: useToggle(isDark)\n\t});\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDark\",\n\tprops: [\n\t\t\"attribute\",\n\t\t\"deep\",\n\t\t\"disableTransition\",\n\t\t\"emitAuto\",\n\t\t\"eventFilter\",\n\t\t\"flush\",\n\t\t\"initOnMounted\",\n\t\t\"initialValue\",\n\t\t\"listenToStorageChanges\",\n\t\t\"mergeDefaults\",\n\t\t\"onChanged\",\n\t\t\"onError\",\n\t\t\"selector\",\n\t\t\"serializer\",\n\t\t\"shallow\",\n\t\t\"storage\",\n\t\t\"storageKey\",\n\t\t\"storageRef\",\n\t\t\"valueDark\",\n\t\t\"valueLight\",\n\t\t\"window\",\n\t\t\"writeDefaults\"\n\t]\n});\n//#endregion\n//#region ../core/useDeviceMotion/component.ts\nconst UseDeviceMotion = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = useDeviceMotion(props);\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDeviceMotion\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"requestPermissions\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useDeviceOrientation/component.ts\nconst UseDeviceOrientation = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDeviceOrientation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDeviceOrientation\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useDevicePixelRatio/component.ts\nconst UseDevicePixelRatio = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDevicePixelRatio(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDevicePixelRatio\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useDevicesList/component.ts\nconst UseDevicesList = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDevicesList(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDevicesList\",\n\tprops: [\n\t\t\"constraints\",\n\t\t\"navigator\",\n\t\t\"onUpdated\",\n\t\t\"requestPermissions\"\n\t]\n});\n//#endregion\n//#region ../core/useDocumentVisibility/component.ts\nconst UseDocumentVisibility = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ visibility: useDocumentVisibility(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDocumentVisibility\",\n\tprops: [\"document\"]\n});\n//#endregion\n//#region ../core/useDraggable/component.ts\nconst UseDraggable = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst handle = computed(() => {\n\t\tvar _toValue;\n\t\treturn (_toValue = toValue(props.handle)) !== null && _toValue !== void 0 ? _toValue : target.value;\n\t});\n\tconst containerElement = computed(() => {\n\t\tvar _ref;\n\t\treturn (_ref = props.containerElement) !== null && _ref !== void 0 ? _ref : void 0;\n\t});\n\tconst disabled = computed(() => !!props.disabled);\n\tconst storageValue = props.storageKey && useStorage(props.storageKey, toValue(props.initialValue) || {\n\t\tx: 0,\n\t\ty: 0\n\t}, isClient ? props.storageType === \"session\" ? sessionStorage : localStorage : void 0);\n\tconst initialValue = storageValue || props.initialValue || {\n\t\tx: 0,\n\t\ty: 0\n\t};\n\tconst onEnd = (position, event) => {\n\t\tvar _props$onEnd;\n\t\t(_props$onEnd = props.onEnd) === null || _props$onEnd === void 0 || _props$onEnd.call(props, position, event);\n\t\tif (!storageValue) return;\n\t\tstorageValue.value.x = position.x;\n\t\tstorageValue.value.y = position.y;\n\t};\n\tconst data = reactive(useDraggable(target, {\n\t\t...props,\n\t\thandle,\n\t\tinitialValue,\n\t\tonEnd,\n\t\tdisabled,\n\t\tcontainerElement\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", {\n\t\t\tref: target,\n\t\t\tstyle: `touch-action:none;${data.style}`\n\t\t}, slots.default(data));\n\t};\n}, {\n\tname: \"UseDraggable\",\n\tprops: [\n\t\t\"storageKey\",\n\t\t\"storageType\",\n\t\t\"initialValue\",\n\t\t\"exact\",\n\t\t\"preventDefault\",\n\t\t\"stopPropagation\",\n\t\t\"pointerTypes\",\n\t\t\"as\",\n\t\t\"handle\",\n\t\t\"axis\",\n\t\t\"onStart\",\n\t\t\"onMove\",\n\t\t\"onEnd\",\n\t\t\"disabled\",\n\t\t\"buttons\",\n\t\t\"containerElement\",\n\t\t\"capture\",\n\t\t\"draggingElement\"\n\t]\n});\n//#endregion\n//#region ../core/useElementBounding/component.ts\nconst UseElementBounding = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useElementBounding(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementBounding\",\n\tprops: [\n\t\t\"as\",\n\t\t\"immediate\",\n\t\t\"reset\",\n\t\t\"updateTiming\",\n\t\t\"windowResize\",\n\t\t\"windowScroll\"\n\t]\n});\n//#endregion\n//#region ../core/useElementBounding/directive.ts\nconst vElementBounding = createDisposableDirective({ mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value, {}] : binding.value;\n\tconst { height, bottom, left, right, top, width, x, y } = useElementBounding(el, options);\n\twatch([\n\t\theight,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\twidth,\n\t\tx,\n\t\ty\n\t], () => handler({\n\t\theight,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\twidth,\n\t\tx,\n\t\ty\n\t}));\n} });\n//#endregion\n//#region ../core/useElementHover/directive.ts\nconst vElementHover = createDisposableDirective({ mounted(el, binding) {\n\tconst value = binding.value;\n\tif (typeof value === \"function\") watch(useElementHover(el), (v) => value(v));\n\telse {\n\t\tconst [handler, options] = value;\n\t\twatch(useElementHover(el, options), (v) => handler(v));\n\t}\n} });\n//#endregion\n//#region ../core/useElementOverflow/component.ts\nconst UseElementOverflow = /* #__PURE__ */ defineComponent({\n\tname: \"UseElementOverflow\",\n\tprops: [\"observeMutation\", \"as\"],\n\temits: [\"update\"],\n\tsetup(props, { slots, attrs, emit }) {\n\t\tconst target = shallowRef();\n\t\tconst info = reactive(useElementOverflow(target, {\n\t\t\tobserveMutation: props.observeMutation,\n\t\t\tonUpdated: (...args) => {\n\t\t\t\temit(\"update\", ...args);\n\t\t\t}\n\t\t}));\n\t\treturn () => {\n\t\t\tif (slots.default) return h(props.as || \"div\", {\n\t\t\t\tref: target,\n\t\t\t\t...attrs\n\t\t\t}, slots.default(info));\n\t\t};\n\t}\n});\n//#endregion\n//#region ../core/_configurable.ts\nconst defaultWindow$1 = isClient$1 ? window : void 0;\nisClient$1 && window.document;\nisClient$1 && window.navigator;\nisClient$1 && window.location;\n//#endregion\n//#region ../core/unrefElement/index.ts\n/**\n* Get the dom element of a ref of element or Vue component instance\n*\n* @param elRef\n*/\nfunction unrefElement(elRef) {\n\tvar _$el;\n\tconst plain = toValue(elRef);\n\treturn (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain;\n}\n//#endregion\n//#region ../core/useMounted/index.ts\n/**\n* Mounted state in ref.\n*\n* @see https://vueuse.org/useMounted\n*\n* @__NO_SIDE_EFFECTS__\n*/\nfunction useMounted() {\n\tconst isMounted = shallowRef(false);\n\tconst instance = getCurrentInstance();\n\tif (instance) onMounted(() => {\n\t\tisMounted.value = true;\n\t}, instance);\n\treturn isMounted;\n}\n//#endregion\n//#region ../core/useSupported/index.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction useSupported(callback) {\n\tconst isMounted = useMounted();\n\treturn computed(() => {\n\t\tisMounted.value;\n\t\treturn Boolean(callback());\n\t});\n}\n//#endregion\n//#region ../core/useMutationObserver/index.ts\n/**\n* Watch for changes being made to the DOM tree.\n*\n* @see https://vueuse.org/useMutationObserver\n* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver MutationObserver MDN\n* @param target\n* @param callback\n* @param options\n*/\nfunction useMutationObserver(target, callback, options = {}) {\n\tconst { window = defaultWindow$1, ...mutationOptions } = options;\n\tlet observer;\n\tconst isSupported = /* @__PURE__ */ useSupported(() => window && \"MutationObserver\" in window);\n\tconst cleanup = () => {\n\t\tif (observer) {\n\t\t\tobserver.disconnect();\n\t\t\tobserver = void 0;\n\t\t}\n\t};\n\tconst stopWatch = watch(computed(() => {\n\t\tconst items = toArray(toValue(target)).map(unrefElement).filter(notNullish);\n\t\treturn new Set(items);\n\t}), (newTargets) => {\n\t\tcleanup();\n\t\tif (isSupported.value && newTargets.size) {\n\t\t\tobserver = new MutationObserver(callback);\n\t\t\tnewTargets.forEach((el) => observer.observe(el, mutationOptions));\n\t\t}\n\t}, {\n\t\timmediate: true,\n\t\tflush: \"post\"\n\t});\n\tconst takeRecords = () => {\n\t\treturn observer === null || observer === void 0 ? void 0 : observer.takeRecords();\n\t};\n\tconst stop = () => {\n\t\tstopWatch();\n\t\tcleanup();\n\t};\n\ttryOnScopeDispose(stop);\n\treturn {\n\t\tisSupported,\n\t\tstop,\n\t\ttakeRecords\n\t};\n}\n//#endregion\n//#region ../core/useResizeObserver/index.ts\n/**\n* Reports changes to the dimensions of an Element's content or the border-box\n*\n* @see https://vueuse.org/useResizeObserver\n* @param target\n* @param callback\n* @param options\n*/\nfunction useResizeObserver$1(target, callback, options = {}) {\n\tconst { window = defaultWindow$1, ...observerOptions } = options;\n\tlet observer;\n\tconst isSupported = /* @__PURE__ */ useSupported(() => window && \"ResizeObserver\" in window);\n\tconst cleanup = () => {\n\t\tif (observer) {\n\t\t\tobserver.disconnect();\n\t\t\tobserver = void 0;\n\t\t}\n\t};\n\tconst stopWatch = watch(computed(() => {\n\t\tconst _targets = toValue(target);\n\t\treturn Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];\n\t}), (els) => {\n\t\tcleanup();\n\t\tif (isSupported.value && window) {\n\t\t\tobserver = new ResizeObserver(callback);\n\t\t\tfor (const _el of els) if (_el) observer.observe(_el, observerOptions);\n\t\t}\n\t}, {\n\t\timmediate: true,\n\t\tflush: \"post\"\n\t});\n\tconst stop = () => {\n\t\tcleanup();\n\t\tstopWatch();\n\t};\n\ttryOnScopeDispose(stop);\n\treturn {\n\t\tisSupported,\n\t\tstop\n\t};\n}\n//#endregion\n//#region ../core/useElementOverflow/index.ts\n/**\n* react a dom's overflow state\n* @see https://vueuse.org/useElementOverflow\n* @param target\n* @param option\n*/\nfunction useElementOverflow$1(target, option = {}) {\n\tconst { observeMutation = false, onUpdated, window = defaultWindow$1 } = option;\n\tconst isXOverflowed = shallowRef(false);\n\tconst isYOverflowed = shallowRef(false);\n\tfunction update(htmlEl) {\n\t\tisXOverflowed.value = htmlEl.scrollWidth > htmlEl.offsetWidth;\n\t\tisYOverflowed.value = htmlEl.scrollHeight > htmlEl.offsetHeight;\n\t}\n\tconst onResizeUpdated = onUpdated;\n\tconst targetEl = computed(() => {\n\t\tconst el = unrefElement(target);\n\t\tif (!el || el instanceof SVGElement) return void 0;\n\t\treturn el;\n\t});\n\tconst targets = () => {\n\t\tconst el = targetEl.value;\n\t\tif (!el || el instanceof SVGElement) return [];\n\t\treturn [el, ...Array.from(el.children).filter((i) => i instanceof HTMLElement)];\n\t};\n\tuseResizeObserver$1(targets, (entries, observer) => {\n\t\tconst el = targetEl.value;\n\t\tif (el) update(el);\n\t\tonResizeUpdated === null || onResizeUpdated === void 0 || onResizeUpdated(entries, observer);\n\t}, { window });\n\tif (observeMutation) {\n\t\tconst onMutationUpdated = onUpdated;\n\t\tuseMutationObserver(targets, (entries, observer) => {\n\t\t\tconst el = targetEl.value;\n\t\t\tif (el) update(el);\n\t\t\tonMutationUpdated === null || onMutationUpdated === void 0 || onMutationUpdated(entries, observer);\n\t\t}, {\n\t\t\twindow,\n\t\t\t...typeof observeMutation === \"object\" ? observeMutation : {\n\t\t\t\tchildList: true,\n\t\t\t\tsubtree: true,\n\t\t\t\tcharacterData: true\n\t\t\t}\n\t\t});\n\t}\n\treturn {\n\t\tisXOverflowed: shallowReadonly(isXOverflowed),\n\t\tisYOverflowed: shallowReadonly(isYOverflowed),\n\t\tstop,\n\t\tupdate: () => {\n\t\t\tconst el = targetEl.value;\n\t\t\tif (el && window) update(el);\n\t\t}\n\t};\n}\n//#endregion\n//#region ../core/useElementOverflow/directive.ts\nconst vElementOverflow = createDisposableDirective({ mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value] : binding.value;\n\tconst info = useElementOverflow$1(el, options);\n\tconst { isXOverflowed, isYOverflowed } = info;\n\twatch([isXOverflowed, isYOverflowed], () => handler(info), { immediate: true });\n} });\n//#endregion\n//#region ../core/useElementSize/component.ts\nconst UseElementSize = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tvar _toValue, _toValue2;\n\tconst target = shallowRef();\n\tconst { width, height } = toRefs(props);\n\tconst data = reactive(useElementSize(target, {\n\t\twidth: (_toValue = toValue(width)) !== null && _toValue !== void 0 ? _toValue : 0,\n\t\theight: (_toValue2 = toValue(height)) !== null && _toValue2 !== void 0 ? _toValue2 : 0\n\t}, {\n\t\tbox: props.box,\n\t\twindow: props.window\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementSize\",\n\tprops: [\n\t\t\"as\",\n\t\t\"box\",\n\t\t\"height\",\n\t\t\"width\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useElementSize/directive.ts\nconst vElementSize = createDisposableDirective({ mounted(el, binding) {\n\tvar _binding$value;\n\tconst handler = typeof binding.value === \"function\" ? binding.value : (_binding$value = binding.value) === null || _binding$value === void 0 ? void 0 : _binding$value[0];\n\tconst { width, height } = useElementSize(el, ...typeof binding.value === \"function\" ? [] : binding.value.slice(1));\n\twatch([width, height], ([width, height]) => handler({\n\t\twidth,\n\t\theight\n\t}), { immediate: true });\n} });\n//#endregion\n//#region ../core/useElementVisibility/component.ts\nconst UseElementVisibility = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useElementVisibility(target, {\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementVisibility\",\n\tprops: [\n\t\t\"as\",\n\t\t\"once\",\n\t\t\"rootMargin\",\n\t\t\"scrollTarget\",\n\t\t\"threshold\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useElementVisibility/directive.ts\nconst vElementVisibility = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") {\n\t\tconst handler = binding.value;\n\t\twatch(useElementVisibility(el), (v) => handler(v), { immediate: true });\n\t} else {\n\t\tconst [handler, options] = binding.value;\n\t\tif (options === null || options === void 0 ? void 0 : options.controls) {\n\t\t\tconst state = useElementVisibility(el, options);\n\t\t\twatch(state.isVisible, () => handler(state), { immediate: true });\n\t\t} else watch(useElementVisibility(el, options), (v) => handler(v), { immediate: true });\n\t}\n} });\n//#endregion\n//#region ../core/useEyeDropper/component.ts\nconst UseEyeDropper = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useEyeDropper(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseEyeDropper\",\n\tprops: [\"initialValue\"]\n});\n//#endregion\n//#region ../core/useFullscreen/component.ts\nconst UseFullscreen = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useFullscreen(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseFullscreen\",\n\tprops: [\n\t\t\"as\",\n\t\t\"autoExit\",\n\t\t\"document\"\n\t]\n});\n//#endregion\n//#region ../core/useGeolocation/component.ts\nconst UseGeolocation = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useGeolocation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseGeolocation\",\n\tprops: [\n\t\t\"enableHighAccuracy\",\n\t\t\"immediate\",\n\t\t\"maximumAge\",\n\t\t\"navigator\",\n\t\t\"timeout\"\n\t]\n});\n//#endregion\n//#region ../core/useIdle/component.ts\nconst UseIdle = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useIdle(props.timeout, props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseIdle\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"events\",\n\t\t\"initialState\",\n\t\t\"listenForVisibilityChange\",\n\t\t\"timeout\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useImage/component.ts\nconst UseImage = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useImage(props));\n\treturn () => {\n\t\tif (data.isLoading && slots.loading) return slots.loading(data);\n\t\telse if (data.error && slots.error) return slots.error(data.error);\n\t\tif (slots.default) return slots.default(data);\n\t\treturn h(props.as || \"img\", props);\n\t};\n}, {\n\tname: \"UseImage\",\n\tprops: [\n\t\t\"alt\",\n\t\t\"as\",\n\t\t\"class\",\n\t\t\"crossorigin\",\n\t\t\"decoding\",\n\t\t\"fetchPriority\",\n\t\t\"height\",\n\t\t\"ismap\",\n\t\t\"loading\",\n\t\t\"referrerPolicy\",\n\t\t\"sizes\",\n\t\t\"src\",\n\t\t\"srcset\",\n\t\t\"usemap\",\n\t\t\"width\"\n\t]\n});\n//#endregion\n//#region ../core/useInfiniteScroll/directive.ts\nconst vInfiniteScroll = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useInfiniteScroll(el, binding.value);\n\telse useInfiniteScroll(el, ...binding.value);\n} });\n//#endregion\n//#region ../core/useIntersectionObserver/directive.ts\nconst vIntersectionObserver = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useIntersectionObserver(el, binding.value);\n\telse useIntersectionObserver(el, ...binding.value);\n} });\n//#endregion\n//#region ../core/useMouse/component.ts\nconst UseMouse = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useMouse(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseMouse\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"initialValue\",\n\t\t\"resetOnTouchEnds\",\n\t\t\"scroll\",\n\t\t\"target\",\n\t\t\"touch\",\n\t\t\"type\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useMouseInElement/component.ts\nconst UseMouseInElement = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useMouseInElement(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseMouseInElement\",\n\tprops: [\n\t\t\"as\",\n\t\t\"eventFilter\",\n\t\t\"handleOutside\",\n\t\t\"initialValue\",\n\t\t\"resetOnTouchEnds\",\n\t\t\"scroll\",\n\t\t\"target\",\n\t\t\"touch\",\n\t\t\"type\",\n\t\t\"window\",\n\t\t\"windowResize\",\n\t\t\"windowScroll\"\n\t]\n});\n//#endregion\n//#region ../core/useMouseInElement/directive.ts\nconst vMouseInElement = createDisposableDirective({ mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value, {}] : binding.value;\n\twatch(reactiveOmit(reactive(useMouseInElement(el, options)), \"stop\"), (val) => handler(val));\n} });\n//#endregion\n//#region ../core/useMousePressed/component.ts\nconst UseMousePressed = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useMousePressed({\n\t\t...props,\n\t\ttarget\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseMousePressed\",\n\tprops: [\n\t\t\"as\",\n\t\t\"capture\",\n\t\t\"drag\",\n\t\t\"initialValue\",\n\t\t\"onPressed\",\n\t\t\"onReleased\",\n\t\t\"touch\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/useNetwork/component.ts\nconst UseNetwork = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useNetwork(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseNetwork\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useNow/component.ts\nconst UseNow = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useNow({\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseNow\",\n\tprops: [\n\t\t\"scheduler\",\n\t\t\"immediate\",\n\t\t\"interval\"\n\t]\n});\n//#endregion\n//#region ../core/useObjectUrl/component.ts\nconst UseObjectUrl = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst { object } = toRefs$1(props);\n\tconst url = useObjectUrl(object);\n\treturn () => {\n\t\tif (slots.default && url.value) return slots.default(url.value);\n\t};\n}, {\n\tname: \"UseObjectUrl\",\n\tprops: [\"object\"]\n});\n//#endregion\n//#region ../core/useOffsetPagination/component.ts\nconst UseOffsetPagination = /* #__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst data = reactive(useOffsetPagination({\n\t\t...props,\n\t\ttotal: toValue(props.total) || void 0,\n\t\tonPageChange(...args) {\n\t\t\tvar _props$onPageChange;\n\t\t\t(_props$onPageChange = props.onPageChange) === null || _props$onPageChange === void 0 || _props$onPageChange.call(props, ...args);\n\t\t\temit(\"page-change\", ...args);\n\t\t},\n\t\tonPageSizeChange(...args) {\n\t\t\tvar _props$onPageSizeChan;\n\t\t\t(_props$onPageSizeChan = props.onPageSizeChange) === null || _props$onPageSizeChan === void 0 || _props$onPageSizeChan.call(props, ...args);\n\t\t\temit(\"page-size-change\", ...args);\n\t\t},\n\t\tonPageCountChange(...args) {\n\t\t\tvar _props$onPageCountCha;\n\t\t\t(_props$onPageCountCha = props.onPageCountChange) === null || _props$onPageCountCha === void 0 || _props$onPageCountCha.call(props, ...args);\n\t\t\temit(\"page-count-change\", ...args);\n\t\t}\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseOffsetPagination\",\n\tprops: [\n\t\t\"onPageChange\",\n\t\t\"onPageCountChange\",\n\t\t\"onPageSizeChange\",\n\t\t\"page\",\n\t\t\"pageSize\",\n\t\t\"total\"\n\t]\n});\n//#endregion\n//#region ../core/useOnline/component.ts\nconst UseOnline = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ isOnline: useOnline(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseOnline\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePageLeave/component.ts\nconst UsePageLeave = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ isLeft: usePageLeave(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePageLeave\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePointer/component.ts\nconst UsePointer = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst el = shallowRef(null);\n\tconst data = reactive(usePointer({\n\t\t...props,\n\t\ttarget: props.target === \"self\" ? el : defaultWindow\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePointer\",\n\tprops: [\n\t\t\"initialValue\",\n\t\t\"pointerTypes\",\n\t\t\"target\",\n\t\t\"window\"\n\t]\n});\n//#endregion\n//#region ../core/usePointerLock/component.ts\nconst UsePointerLock = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(usePointerLock(target));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UsePointerLock\",\n\tprops: [\"as\", \"document\"]\n});\n//#endregion\n//#region ../core/usePreferredColorScheme/component.ts\nconst UsePreferredColorScheme = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ colorScheme: usePreferredColorScheme(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredColorScheme\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredContrast/component.ts\nconst UsePreferredContrast = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ contrast: usePreferredContrast(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredContrast\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredDark/component.ts\nconst UsePreferredDark = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ prefersDark: usePreferredDark(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredDark\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredLanguages/component.ts\nconst UsePreferredLanguages = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ languages: usePreferredLanguages(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredLanguages\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredReducedMotion/component.ts\nconst UsePreferredReducedMotion = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ motion: usePreferredReducedMotion(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredReducedMotion\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/usePreferredReducedTransparency/component.ts\nconst UsePreferredReducedTransparency = /* #__PURE__ */ defineComponent({\n\tname: \"UsePreferredReducedTransparency\",\n\tsetup(props, { slots }) {\n\t\tconst data = reactive({ transparency: usePreferredReducedTransparency() });\n\t\treturn () => {\n\t\t\tif (slots.default) return slots.default(data);\n\t\t};\n\t}\n});\n//#endregion\n//#region ../core/useResizeObserver/directive.ts\nconst vResizeObserver = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useResizeObserver(el, binding.value);\n\telse useResizeObserver(el, ...binding.value);\n} });\n//#endregion\n//#region ../core/useScreenSafeArea/component.ts\nconst UseScreenSafeArea = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useScreenSafeArea());\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { style: {\n\t\t\tpaddingTop: props.top ? data.top : \"\",\n\t\t\tpaddingRight: props.right ? data.right : \"\",\n\t\t\tpaddingBottom: props.bottom ? data.bottom : \"\",\n\t\t\tpaddingLeft: props.left ? data.left : \"\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tmaxHeight: \"100vh\",\n\t\t\tmaxWidth: \"100vw\",\n\t\t\toverflow: \"auto\"\n\t\t} }, slots.default(data));\n\t};\n}, {\n\tname: \"UseScreenSafeArea\",\n\tprops: [\n\t\t\"top\",\n\t\t\"right\",\n\t\t\"bottom\",\n\t\t\"left\"\n\t]\n});\n//#endregion\n//#region ../core/useScroll/directive.ts\nconst vScroll = createDisposableDirective({ mounted(el, binding) {\n\tif (typeof binding.value === \"function\") {\n\t\tconst handler = binding.value;\n\t\tconst state = useScroll(el, {\n\t\t\tonScroll() {\n\t\t\t\thandler(state);\n\t\t\t},\n\t\t\tonStop() {\n\t\t\t\thandler(state);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tconst [handler, options] = binding.value;\n\t\tconst state = useScroll(el, {\n\t\t\t...options,\n\t\t\tonScroll(e) {\n\t\t\t\tvar _options$onScroll;\n\t\t\t\t(_options$onScroll = options.onScroll) === null || _options$onScroll === void 0 || _options$onScroll.call(options, e);\n\t\t\t\thandler(state);\n\t\t\t},\n\t\t\tonStop(e) {\n\t\t\t\tvar _options$onStop;\n\t\t\t\t(_options$onStop = options.onStop) === null || _options$onStop === void 0 || _options$onStop.call(options, e);\n\t\t\t\thandler(state);\n\t\t\t}\n\t\t});\n\t}\n} });\n//#endregion\n//#region ../core/useScrollLock/directive.ts\nfunction onScrollLock() {\n\tlet isMounted = false;\n\tconst state = shallowRef(false);\n\treturn createDisposableDirective((el, binding) => {\n\t\tstate.value = binding.value;\n\t\tif (isMounted) return;\n\t\tisMounted = true;\n\t\tconst isLocked = useScrollLock(el, binding.value);\n\t\twatch(state, (v) => isLocked.value = v);\n\t});\n}\nconst vScrollLock = onScrollLock();\n//#endregion\n//#region ../core/useTimeAgo/component.ts\nconst UseTimeAgo = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useTimeAgo(() => props.time, {\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseTimeAgo\",\n\tprops: [\n\t\t\"fullDateFormatter\",\n\t\t\"max\",\n\t\t\"messages\",\n\t\t\"rounding\",\n\t\t\"showSecond\",\n\t\t\"time\",\n\t\t\"units\",\n\t\t\"updateInterval\"\n\t]\n});\n//#endregion\n//#region ../core/useTimestamp/component.ts\nconst UseTimestamp = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useTimestamp({\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseTimestamp\",\n\tprops: [\n\t\t\"scheduler\",\n\t\t\"callback\",\n\t\t\"immediate\",\n\t\t\"interval\",\n\t\t\"offset\"\n\t]\n});\n//#endregion\n//#region ../core/useVirtualList/component.ts\nconst UseVirtualList = /* #__PURE__ */ defineComponent((props, { slots, expose }) => {\n\tconst { list: listRef } = toRefs(props);\n\tconst { list, containerProps, wrapperProps, scrollTo } = useVirtualList(listRef, props.options);\n\texpose({ scrollTo });\n\tif (containerProps.style && typeof containerProps.style === \"object\" && !Array.isArray(containerProps.style)) containerProps.style.height = props.height || \"300px\";\n\treturn () => h(\"div\", { ...containerProps }, [h(\"div\", { ...wrapperProps.value }, list.value.map((item) => h(\"div\", { style: {\n\t\toverflow: \"hidden\",\n\t\theight: item.height\n\t} }, slots.default ? slots.default(item) : \"Please set content!\")))]);\n}, {\n\tname: \"UseVirtualList\",\n\tprops: [\n\t\t\"height\",\n\t\t\"list\",\n\t\t\"options\"\n\t]\n});\n//#endregion\n//#region ../core/useWindowFocus/component.ts\nconst UseWindowFocus = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ focused: useWindowFocus(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseWindowFocus\",\n\tprops: [\"window\"]\n});\n//#endregion\n//#region ../core/useWindowSize/component.ts\nconst UseWindowSize = /* #__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useWindowSize(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseWindowSize\",\n\tprops: [\n\t\t\"includeScrollbar\",\n\t\t\"initialHeight\",\n\t\t\"initialWidth\",\n\t\t\"listenOrientation\",\n\t\t\"type\",\n\t\t\"window\"\n\t]\n});\n//#endregion\nexport { OnClickOutside, OnLongPress, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseElementBounding, UseElementOverflow, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseWindowFocus, UseWindowSize, VOnClickOutside, VOnLongPress, vElementBounding, vElementHover, vElementOverflow, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vMouseInElement, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };\n","import { l as logger } from \"../../chunks/logger.mjs\";\nfunction registerContactsMenuAction(action) {\n window._nc_contacts_menu_hooks ??= {};\n if (window._nc_contacts_menu_hooks[action.id]) {\n logger.error(`ContactsMenu action for id ${action.id} has already been registered`, {\n action\n });\n return;\n }\n window._nc_contacts_menu_hooks[action.id] = action;\n}\nfunction getEnabledContactsMenuActions(entry) {\n if (!window._nc_contacts_menu_hooks) {\n return [];\n }\n return Object.values(window._nc_contacts_menu_hooks).filter((action) => action.enabled(entry));\n}\nexport {\n getEnabledContactsMenuActions,\n registerContactsMenuAction\n};\n//# sourceMappingURL=index.mjs.map\n","const c = new Int32Array(4);\nclass h {\n static hashStr(i, a = !1) {\n return this.onePassHasher.start().appendStr(i).end(a);\n }\n static hashAsciiStr(i, a = !1) {\n return this.onePassHasher.start().appendAsciiStr(i).end(a);\n }\n // Private Static Variables\n static stateIdentity = new Int32Array([\n 1732584193,\n -271733879,\n -1732584194,\n 271733878\n ]);\n static buffer32Identity = new Int32Array([\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ]);\n static hexChars = \"0123456789abcdef\";\n static hexOut = [];\n // Permanent instance is to use for one-call hashing\n static onePassHasher = new h();\n static _hex(i) {\n const a = h.hexChars, t = h.hexOut;\n let e, s, r, n;\n for (n = 0; n < 4; n += 1)\n for (s = n * 8, e = i[n], r = 0; r < 8; r += 2)\n t[s + 1 + r] = a.charAt(e & 15), e >>>= 4, t[s + 0 + r] = a.charAt(e & 15), e >>>= 4;\n return t.join(\"\");\n }\n static _md5cycle(i, a) {\n let t = i[0], e = i[1], s = i[2], r = i[3];\n t += (e & s | ~e & r) + a[0] - 680876936 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[1] - 389564586 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[2] + 606105819 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[3] - 1044525330 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[4] - 176418897 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[5] + 1200080426 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[6] - 1473231341 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[7] - 45705983 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[8] + 1770035416 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[9] - 1958414417 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[10] - 42063 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[11] - 1990404162 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[12] + 1804603682 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[13] - 40341101 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[14] - 1502002290 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[15] + 1236535329 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & r | s & ~r) + a[1] - 165796510 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[6] - 1069501632 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[11] + 643717713 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[0] - 373897302 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[5] - 701558691 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[10] + 38016083 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[15] - 660478335 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[4] - 405537848 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[9] + 568446438 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[14] - 1019803690 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[3] - 187363961 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[8] + 1163531501 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[13] - 1444681467 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[2] - 51403784 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[7] + 1735328473 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[12] - 1926607734 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e ^ s ^ r) + a[5] - 378558 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[8] - 2022574463 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[11] + 1839030562 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[14] - 35309556 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[1] - 1530992060 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[4] + 1272893353 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[7] - 155497632 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[10] - 1094730640 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[13] + 681279174 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[0] - 358537222 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[3] - 722521979 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[6] + 76029189 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[9] - 640364487 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[12] - 421815835 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[15] + 530742520 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[2] - 995338651 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (s ^ (e | ~r)) + a[0] - 198630844 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[7] + 1126891415 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[14] - 1416354905 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[5] - 57434055 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[12] + 1700485571 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[3] - 1894986606 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[10] - 1051523 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[1] - 2054922799 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[8] + 1873313359 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[15] - 30611744 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[6] - 1560198380 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[13] + 1309151649 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[4] - 145523070 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[11] - 1120210379 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[2] + 718787259 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[9] - 343485551 | 0, e = (e << 21 | e >>> 11) + s | 0, i[0] = t + i[0] | 0, i[1] = e + i[1] | 0, i[2] = s + i[2] | 0, i[3] = r + i[3] | 0;\n }\n _dataLength = 0;\n _bufferLength = 0;\n _state = new Int32Array(4);\n _buffer = new ArrayBuffer(68);\n _buffer8;\n _buffer32;\n constructor() {\n this._buffer8 = new Uint8Array(this._buffer, 0, 68), this._buffer32 = new Uint32Array(this._buffer, 0, 17), this.start();\n }\n /**\n * Initialise buffer to be hashed\n */\n start() {\n return this._dataLength = 0, this._bufferLength = 0, this._state.set(h.stateIdentity), this;\n }\n // Char to code point to to array conversion:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt\n // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown\n /**\n * Append a UTF-8 string to the hash buffer\n * @param str String to append\n */\n appendStr(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r;\n for (r = 0; r < i.length; r += 1) {\n if (s = i.charCodeAt(r), s < 128)\n a[e++] = s;\n else if (s < 2048)\n a[e++] = (s >>> 6) + 192, a[e++] = s & 63 | 128;\n else if (s < 55296 || s > 56319)\n a[e++] = (s >>> 12) + 224, a[e++] = s >>> 6 & 63 | 128, a[e++] = s & 63 | 128;\n else {\n if (s = (s - 55296) * 1024 + (i.charCodeAt(++r) - 56320) + 65536, s > 1114111)\n throw new Error(\n \"Unicode standard supports code points up to U+10FFFF\"\n );\n a[e++] = (s >>> 18) + 240, a[e++] = s >>> 12 & 63 | 128, a[e++] = s >>> 6 & 63 | 128, a[e++] = s & 63 | 128;\n }\n e >= 64 && (this._dataLength += 64, h._md5cycle(this._state, t), e -= 64, t[0] = t[16]);\n }\n return this._bufferLength = e, this;\n }\n /**\n * Append an ASCII string to the hash buffer\n * @param str String to append\n */\n appendAsciiStr(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r = 0;\n for (; ; ) {\n for (s = Math.min(i.length - r, 64 - e); s--; )\n a[e++] = i.charCodeAt(r++);\n if (e < 64)\n break;\n this._dataLength += 64, h._md5cycle(this._state, t), e = 0;\n }\n return this._bufferLength = e, this;\n }\n /**\n * Append a byte array to the hash buffer\n * @param input array to append\n */\n appendByteArray(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r = 0;\n for (; ; ) {\n for (s = Math.min(i.length - r, 64 - e); s--; )\n a[e++] = i[r++];\n if (e < 64)\n break;\n this._dataLength += 64, h._md5cycle(this._state, t), e = 0;\n }\n return this._bufferLength = e, this;\n }\n /**\n * Get the state of the hash buffer\n */\n getState() {\n const i = this._state;\n return {\n buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)),\n buflen: this._bufferLength,\n length: this._dataLength,\n state: [i[0], i[1], i[2], i[3]]\n };\n }\n /**\n * Override the current state of the hash buffer\n * @param state New hash buffer state\n */\n setState(i) {\n const a = i.buffer, t = i.state, e = this._state;\n let s;\n for (this._dataLength = i.length, this._bufferLength = i.buflen, e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], s = 0; s < a.length; s += 1)\n this._buffer8[s] = a.charCodeAt(s);\n }\n /**\n * Hash the current state of the hash buffer and return the result\n * @param raw Whether to return the value as an `Int32Array`\n */\n end(i = !1) {\n const a = this._bufferLength, t = this._buffer8, e = this._buffer32, s = (a >> 2) + 1;\n this._dataLength += a;\n const r = this._dataLength * 8;\n if (t[a] = 128, t[a + 1] = t[a + 2] = t[a + 3] = 0, e.set(h.buffer32Identity.subarray(s), s), a > 55 && (h._md5cycle(this._state, e), e.set(h.buffer32Identity)), r <= 4294967295)\n e[14] = r;\n else {\n const n = r.toString(16).match(/(.*?)(.{0,8})$/);\n if (n === null) return i ? c : \"\";\n const o = parseInt(n[2], 16), _ = parseInt(n[1], 16) || 0;\n e[14] = o, e[15] = _;\n }\n return h._md5cycle(this._state, e), i ? this._state : h._hex(this._state);\n }\n}\nif (h.hashStr(\"hello\") !== \"5d41402abc4b2a76b9719d911017c592\")\n throw new Error(\"Md5 self test failed.\");\nclass l {\n constructor(i, a = !0, t = 1048576) {\n this._callback = i, this._async = a, this._partSize = t, this._configureReader();\n }\n _reader;\n _md5;\n _part;\n // private _length!: number;\n _blob;\n /**\n * Hash a blob of data in the worker\n * @param blob Data to hash\n */\n hash(i) {\n const a = this;\n a._blob = i, a._part = 0, a._md5 = new h(), a._processPart();\n }\n _fail() {\n this._callback({\n success: !1,\n result: \"data read failed\"\n });\n }\n _hashData(i) {\n let a = this;\n a._md5.appendByteArray(new Uint8Array(i.target.result)), a._part * a._partSize >= a._blob.size ? a._callback({\n success: !0,\n result: a._md5.end()\n }) : a._processPart();\n }\n _processPart() {\n const i = this;\n let a = 0, t;\n i._part += 1, i._blob.size > i._partSize ? (a = i._part * i._partSize, a > i._blob.size && (a = i._blob.size), t = i._blob.slice(\n (i._part - 1) * i._partSize,\n a\n )) : t = i._blob, i._async ? i._reader.readAsArrayBuffer(t) : setTimeout(() => {\n try {\n i._hashData({\n target: {\n result: i._reader.readAsArrayBuffer(\n t\n )\n }\n });\n } catch {\n i._fail();\n }\n }, 0);\n }\n _configureReader() {\n const i = this;\n i._async ? (i._reader = new FileReader(), i._reader.onload = i._hashData.bind(i), i._reader.onerror = i._fail.bind(i), i._reader.onabort = i._fail.bind(i)) : i._reader = new FileReaderSync();\n }\n}\nclass u {\n _queue = [];\n _hashWorker;\n _processing;\n _ready = !0;\n constructor(i, a) {\n const t = this;\n Worker ? (t._hashWorker = new Worker(i, a), t._hashWorker.onmessage = t._recievedMessage.bind(t), t._hashWorker.onerror = (e) => {\n t._ready = !1, console.error(\"Hash worker failure\", e);\n }) : (t._ready = !1, console.error(\"Web Workers are not supported in this browser\"));\n }\n /**\n * Hash a blob of data in the worker\n * @param blob Data to hash\n * @returns Promise of the Hashed result\n */\n hash(i) {\n const a = this;\n let t;\n return t = new Promise((e, s) => {\n a._queue.push({\n blob: i,\n resolve: e,\n reject: s\n }), a._processNext();\n }), t;\n }\n /** Terminate any existing hash requests */\n terminate() {\n this._ready = !1, this._hashWorker.terminate();\n }\n // Processes the next item in the queue\n _processNext() {\n this._ready && !this._processing && this._queue.length > 0 && (this._processing = this._queue.pop(), this._hashWorker.postMessage(this._processing.blob));\n }\n // Hash result is returned from the worker\n _recievedMessage(i) {\n const a = i.data;\n a.success ? this._processing?.resolve(a.result) : this._processing?.reject(a.result), this._processing = void 0, this._processNext();\n }\n}\nexport {\n h as Md5,\n l as Md5FileHasher,\n u as ParallelHasher\n};\n//# sourceMappingURL=index.es.js.map\n","import { r as register, t as t4, a as t } from \"./_l10n.mjs\";\nregister(t4);\nclass Color {\n /**\n * @param r - The red value\n * @param g - The green value\n * @param b - The blue value\n * @param name - The name of the color\n */\n constructor(r, g, b, name) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.name = name;\n this.r = Math.min(r, 255);\n this.g = Math.min(g, 255);\n this.b = Math.min(b, 255);\n this.name = name;\n }\n r;\n g;\n b;\n name;\n /**\n * The hexadecimal color string.\n */\n get color() {\n const toHex = (int) => `00${int.toString(16)}`.slice(-2);\n return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}`;\n }\n}\nfunction calculateStepIncrement(steps, color1, color2) {\n return {\n r: (color2.r - color1.r) / steps,\n g: (color2.g - color1.g) / steps,\n b: (color2.b - color1.b) / steps\n };\n}\nfunction mixPalette(steps, color1, color2) {\n const palette = [];\n palette.push(color1);\n const increment = calculateStepIncrement(steps, color1, color2);\n for (let i = 1; i < steps; i++) {\n const r = Math.floor(color1.r + increment.r * i);\n const g = Math.floor(color1.g + increment.g * i);\n const b = Math.floor(color1.b + increment.b * i);\n palette.push(new Color(r, g, b));\n }\n return palette;\n}\nconst COLOR_RED = new Color(182, 70, 157, t(\"Purple\"));\nconst COLOR_YELLOW = new Color(221, 203, 85, t(\"Gold\"));\nconst COLOR_BLUE = new Color(0, 130, 201, t(\"Nextcloud blue\"));\nconst COLOR_BLACK = new Color(0, 0, 0, t(\"Black\"));\nconst COLOR_WHITE = new Color(255, 255, 255, t(\"White\"));\nconst defaultPalette = [\n COLOR_RED,\n new Color(\n ...[191, 103, 139],\n t(\"Rosy brown\")\n // TRANSLATORS: A color name for RGB(191, 103, 139)\n ),\n new Color(\n ...[201, 136, 121],\n t(\"Feldspar\")\n // TRANSLATORS: A color name for RGB(201, 136, 121)\n ),\n new Color(\n ...[211, 169, 103],\n t(\"Whiskey\")\n // TRANSLATORS: A color name for RGB(211, 169, 103)\n ),\n COLOR_YELLOW,\n new Color(\n ...[165, 184, 114],\n t(\"Olivine\")\n // TRANSLATORS: A color name for RGB(165, 184, 114)\n ),\n new Color(\n ...[110, 166, 143],\n t(\"Acapulco\")\n // TRANSLATORS: A color name for RGB(110, 166, 143)\n ),\n new Color(\n ...[55, 148, 172],\n t(\"Boston Blue\")\n // TRANSLATORS: A color name for RGB(55, 148, 172)\n ),\n COLOR_BLUE,\n new Color(\n ...[45, 115, 190],\n t(\"Mariner\")\n // TRANSLATORS: A color name for RGB(45, 115, 190)\n ),\n new Color(\n ...[91, 100, 179],\n t(\"Blue Violet\")\n // TRANSLATORS: A color name for RGB(91, 100, 179)\n ),\n new Color(\n ...[136, 85, 168],\n t(\"Deluge\")\n // TRANSLATORS: A color name for RGB(136, 85, 168)\n )\n];\nfunction generatePalette(steps) {\n const palette1 = mixPalette(steps, COLOR_RED, COLOR_YELLOW);\n const palette2 = mixPalette(steps, COLOR_YELLOW, COLOR_BLUE);\n const palette3 = mixPalette(steps, COLOR_BLUE, COLOR_RED);\n return palette1.concat(palette2).concat(palette3);\n}\nexport {\n Color as C,\n COLOR_BLACK as a,\n COLOR_WHITE as b,\n defaultPalette as d,\n generatePalette as g\n};\n//# sourceMappingURL=colors.mjs.map\n","import { Md5 } from \"ts-md5\";\nimport { g as generatePalette } from \"../../chunks/colors.mjs\";\nfunction hashCode(str) {\n let hash = str;\n if (str.match(/^([0-9a-f]{4}-?){8}$/) === null) {\n hash = Md5.hashStr(str);\n }\n hash = hash.replace(/[^0-9a-f]/g, \"\");\n let finalInt = 0;\n for (let i = 0; i < hash.length; i++) {\n finalInt += parseInt(hash.charAt(i), 16);\n }\n return finalInt;\n}\nfunction usernameToColor(username) {\n const steps = 6;\n const finalPalette = generatePalette(steps);\n const hash = hashCode(username.toLocaleLowerCase());\n return finalPalette[hash % finalPalette.length];\n}\nexport {\n usernameToColor\n};\n//# sourceMappingURL=index.mjs.map\n","'use strict';\n\n(function (global) {\n\n // minimal symbol polyfill for IE11 and others\n if (typeof Symbol !== 'function') {\n var Symbol = function(name) {\n return name;\n }\n\n Symbol.nonNative = true;\n }\n\n const STATE_PLAINTEXT = Symbol('plaintext');\n const STATE_HTML = Symbol('html');\n const STATE_COMMENT = Symbol('comment');\n\n const ALLOWED_TAGS_REGEX = /<(\\w*)>/g;\n const NORMALIZE_TAG_REGEX = /<\\/?([^\\s\\/>]+)/;\n\n function striptags(html, allowable_tags, tag_replacement) {\n html = html || '';\n allowable_tags = allowable_tags || [];\n tag_replacement = tag_replacement || '';\n\n let context = init_context(allowable_tags, tag_replacement);\n\n return striptags_internal(html, context);\n }\n\n function init_striptags_stream(allowable_tags, tag_replacement) {\n allowable_tags = allowable_tags || [];\n tag_replacement = tag_replacement || '';\n\n let context = init_context(allowable_tags, tag_replacement);\n\n return function striptags_stream(html) {\n return striptags_internal(html || '', context);\n };\n }\n\n striptags.init_streaming_mode = init_striptags_stream;\n\n function init_context(allowable_tags, tag_replacement) {\n allowable_tags = parse_allowable_tags(allowable_tags);\n\n return {\n allowable_tags : allowable_tags,\n tag_replacement: tag_replacement,\n\n state : STATE_PLAINTEXT,\n tag_buffer : '',\n depth : 0,\n in_quote_char : ''\n };\n }\n\n function striptags_internal(html, context) {\n if (typeof html != \"string\") {\n throw new TypeError(\"'html' parameter must be a string\");\n }\n\n let allowable_tags = context.allowable_tags;\n let tag_replacement = context.tag_replacement;\n\n let state = context.state;\n let tag_buffer = context.tag_buffer;\n let depth = context.depth;\n let in_quote_char = context.in_quote_char;\n let output = '';\n\n for (let idx = 0, length = html.length; idx < length; idx++) {\n let char = html[idx];\n\n if (state === STATE_PLAINTEXT) {\n switch (char) {\n case '<':\n state = STATE_HTML;\n tag_buffer += char;\n break;\n\n default:\n output += char;\n break;\n }\n }\n\n else if (state === STATE_HTML) {\n switch (char) {\n case '<':\n // ignore '<' if inside a quote\n if (in_quote_char) {\n break;\n }\n\n // we're seeing a nested '<'\n depth++;\n break;\n\n case '>':\n // ignore '>' if inside a quote\n if (in_quote_char) {\n break;\n }\n\n // something like this is happening: '<<>>'\n if (depth) {\n depth--;\n\n break;\n }\n\n // this is closing the tag in tag_buffer\n in_quote_char = '';\n state = STATE_PLAINTEXT;\n tag_buffer += '>';\n\n if (allowable_tags.has(normalize_tag(tag_buffer))) {\n output += tag_buffer;\n } else {\n output += tag_replacement;\n }\n\n tag_buffer = '';\n break;\n\n case '\"':\n case '\\'':\n // catch both single and double quotes\n\n if (char === in_quote_char) {\n in_quote_char = '';\n } else {\n in_quote_char = in_quote_char || char;\n }\n\n tag_buffer += char;\n break;\n\n case '-':\n if (tag_buffer === '':\n if (tag_buffer.slice(-2) == '--') {\n // close the comment\n state = STATE_PLAINTEXT;\n }\n\n tag_buffer = '';\n break;\n\n default:\n tag_buffer += char;\n break;\n }\n }\n }\n\n // save the context for future iterations\n context.state = state;\n context.tag_buffer = tag_buffer;\n context.depth = depth;\n context.in_quote_char = in_quote_char;\n\n return output;\n }\n\n function parse_allowable_tags(allowable_tags) {\n let tag_set = new Set();\n\n if (typeof allowable_tags === 'string') {\n let match;\n\n while ((match = ALLOWED_TAGS_REGEX.exec(allowable_tags))) {\n tag_set.add(match[1]);\n }\n }\n\n else if (!Symbol.nonNative &&\n typeof allowable_tags[Symbol.iterator] === 'function') {\n\n tag_set = new Set(allowable_tags);\n }\n\n else if (typeof allowable_tags.forEach === 'function') {\n // IE11 compatible\n allowable_tags.forEach(tag_set.add, tag_set);\n }\n\n return tag_set;\n }\n\n function normalize_tag(tag_buffer) {\n let match = NORMALIZE_TAG_REGEX.exec(tag_buffer);\n\n return match ? match[1].toLowerCase() : null;\n }\n\n if (typeof define === 'function' && define.amd) {\n // AMD\n define(function module_factory() { return striptags; });\n }\n\n else if (typeof module === 'object' && module.exports) {\n // Node\n module.exports = striptags;\n }\n\n else {\n // Browser\n global.striptags = striptags;\n }\n}(this));\n","import '../assets/NcMentionBubble.css';\nimport { generateUrl } from \"@nextcloud/router\";\nimport { checkIfDarkTheme } from \"../functions/isDarkTheme/index.mjs\";\nfunction getAvatarUrl(user, options) {\n const size = (options?.size || 64) <= 64 ? 64 : 512;\n const guestUrl = options?.isGuest ? \"/guest\" : \"\";\n const themeUrl = options?.isDarkTheme ?? checkIfDarkTheme(document.body) ? \"/dark\" : \"\";\n return generateUrl(`/avatar${guestUrl}/{user}/{size}${themeUrl}?guestFallback=true`, {\n user,\n size\n });\n}\nexport {\n getAvatarUrl as g\n};\n//# sourceMappingURL=NcMentionBubble.vue_vue_type_style_index_0_scoped_3c4a673d_lang.mjs.map\n","import '../assets/NcUserStatusIcon.css';\nimport { defineComponent, useModel, computed, watch, openBlock, createElementBlock, normalizeClass, createCommentVNode, mergeModels } from \"vue\";\nimport axios from \"@nextcloud/axios\";\nimport { getCapabilities } from \"@nextcloud/capabilities\";\nimport { generateOcsUrl } from \"@nextcloud/router\";\nimport { r as register, R as t53, S as t12, a as t } from \"./_l10n.mjs\";\nimport { l as logger } from \"./logger.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nconst awaySvg = '\\n\\n\t\\n\\n';\nconst busySvg = '\\n\\n\t\\n\\n';\nconst dndSvg = '\\n\\n\t\\n\\n';\nconst invisibleSvg = '\\n\\n\t\\n\\n';\nconst onlineSvg = '\\n\\n\t\\n\\n';\nregister(t53);\nregister(t12);\nfunction getUserStatusText(status) {\n switch (status) {\n case \"away\":\n return t(\"away\");\n // TRANSLATORS: User status if the user is currently away from keyboard\n case \"busy\":\n return t(\"busy\");\n case \"dnd\":\n return t(\"do not disturb\");\n case \"online\":\n return t(\"online\");\n case \"invisible\":\n return t(\"invisible\");\n case \"offline\":\n return t(\"offline\");\n default:\n return status;\n }\n}\nconst _hoisted_1 = [\"aria-hidden\", \"aria-label\", \"innerHTML\"];\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcUserStatusIcon\",\n props: /* @__PURE__ */ mergeModels({\n user: { default: void 0 },\n ariaHidden: { type: [Boolean, String], default: false }\n }, {\n \"status\": {},\n \"statusModifiers\": {}\n }),\n emits: [\"update:status\"],\n setup(__props) {\n const status = useModel(__props, \"status\");\n const props = __props;\n const isInvisible = computed(() => status.value && [\"invisible\", \"offline\"].includes(status.value));\n const ariaLabel = computed(() => status.value && (!props.ariaHidden || props.ariaHidden === \"false\") ? t(\"User status: {status}\", { status: getUserStatusText(status.value) }) : void 0);\n watch(() => props.user, async (user) => {\n if (!status.value && user && getCapabilities()?.user_status?.enabled) {\n try {\n const { data } = await axios.get(generateOcsUrl(\"/apps/user_status/api/v1/statuses/{user}\", { user }));\n status.value = data.ocs?.data?.status;\n } catch (error) {\n logger.debug(\"Error while fetching user status\", { error });\n }\n }\n }, { immediate: true });\n const matchSvg = {\n online: onlineSvg,\n away: awaySvg,\n busy: busySvg,\n dnd: dndSvg,\n invisible: invisibleSvg,\n offline: invisibleSvg\n };\n const activeSvg = computed(() => status.value && matchSvg[status.value]);\n return (_ctx, _cache) => {\n return status.value ? (openBlock(), createElementBlock(\"span\", {\n key: 0,\n class: normalizeClass([\"user-status-icon\", {\n \"user-status-icon--invisible\": isInvisible.value\n }]),\n \"aria-hidden\": !ariaLabel.value || void 0,\n \"aria-label\": ariaLabel.value,\n role: \"img\",\n innerHTML: activeSvg.value\n }, null, 10, _hoisted_1)) : createCommentVNode(\"\", true);\n };\n }\n});\nconst NcUserStatusIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-881a79fb\"]]);\nexport {\n NcUserStatusIcon as N,\n getUserStatusText as g\n};\n//# sourceMappingURL=NcUserStatusIcon.mjs.map\n","const ActionGlobalMixin = {\n beforeUpdate() {\n this.text = this.getText();\n },\n data() {\n return {\n // $slots are not reactive.\n // We need to update the content manually\n text: this.getText()\n };\n },\n computed: {\n isLongText() {\n return this.text && this.text.trim().length > 20;\n }\n },\n methods: {\n getText() {\n return this.$slots.default?.()[0].children?.trim?.() || \"\";\n }\n }\n};\nexport {\n ActionGlobalMixin as A\n};\n//# sourceMappingURL=actionGlobal.mjs.map\n","import { warn } from \"vue\";\nimport { N as NC_ACTIONS_CLOSE_MENU } from \"./useNcActions.mjs\";\nimport { A as ActionGlobalMixin } from \"./actionGlobal.mjs\";\nconst ActionTextMixin = {\n mixins: [ActionGlobalMixin],\n props: {\n /**\n * Icon to show with the action, can be either a CSS class or an URL\n */\n icon: {\n type: String,\n default: \"\"\n },\n /**\n * The main text content of the entry.\n */\n name: {\n type: String,\n default: \"\"\n },\n /**\n * The title attribute of the element.\n */\n title: {\n type: String,\n default: \"\"\n },\n /**\n * Whether we close the Actions menu after the click\n */\n closeAfterClick: {\n type: Boolean,\n default: false\n },\n /**\n * Aria label for the button. Not needed if the button has text.\n */\n ariaLabel: {\n type: String,\n default: null\n }\n },\n inject: {\n closeMenu: {\n from: NC_ACTIONS_CLOSE_MENU\n }\n },\n emits: [\n \"click\"\n ],\n created() {\n if (\"ariaHidden\" in this.$attrs) {\n warn(\"[NcAction*]: Do not set the ariaHidden attribute as the root element will inherit the incorrect aria-hidden.\");\n }\n },\n computed: {\n /**\n * Check if icon prop is an URL\n *\n * @return {boolean} Whether the icon prop is an URL\n */\n isIconUrl() {\n try {\n return !!new URL(this.icon, this.icon.startsWith(\"/\") ? window.location.origin : void 0);\n } catch {\n return false;\n }\n }\n },\n methods: {\n onClick(event) {\n this.$emit(\"click\", event);\n if (this.closeAfterClick) {\n this.closeMenu(false);\n }\n }\n }\n};\nexport {\n ActionTextMixin as A\n};\n//# sourceMappingURL=actionText.mjs.map\n","import '../assets/NcActionButton.css';\nimport { c as mdiChevronRight, d as mdiCheck } from \"./mdi.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper.mjs\";\nimport { A as ActionTextMixin } from \"./actionText.mjs\";\nimport { a as NC_ACTIONS_IS_SEMANTIC_MENU } from \"./useNcActions.mjs\";\nimport { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, mergeProps, renderSlot, normalizeStyle, toDisplayString, createCommentVNode, createBlock } from \"vue\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper.mjs\";\nconst _sfc_main = {\n name: \"NcActionButton\",\n components: {\n NcIconSvgWrapper\n },\n mixins: [ActionTextMixin],\n inject: {\n isInSemanticMenu: {\n from: NC_ACTIONS_IS_SEMANTIC_MENU,\n default: false\n }\n },\n props: {\n /**\n * disabled state of the action button\n */\n disabled: {\n type: Boolean,\n default: false\n },\n /**\n * If this is a menu, a chevron icon will\n * be added at the end of the line\n */\n isMenu: {\n type: Boolean,\n default: false\n },\n /**\n * The button's behavior, by default the button acts like a normal button with optional toggle button behavior if `modelValue` is `true` or `false`.\n * But you can also set to checkbox button behavior with tri-state or radio button like behavior.\n * This extends the native HTML button type attribute.\n */\n type: {\n type: String,\n default: \"button\",\n validator: (behavior) => [\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\"].includes(behavior)\n },\n /**\n * The buttons state if `type` is 'checkbox' or 'radio' (meaning if it is pressed / selected).\n * For checkbox and toggle button behavior - boolean value.\n * For radio button behavior - could be a boolean checked or a string with the value of the button.\n * Note: Unlike native radio buttons, NcActionButton are not grouped by name, so you need to connect them by bind correct modelValue.\n *\n * **This is not availabe for `type='submit'` or `type='reset'`**\n *\n * If using `type='checkbox'` a `model-value` of `true` means checked, `false` means unchecked and `null` means indeterminate (tri-state)\n * For `type='radio'` `null` is equal to `false`\n */\n modelValue: {\n type: [Boolean, String],\n default: null\n },\n /**\n * The value used for the `modelValue` when this component is used with radio behavior\n * Similar to the `value` attribute of ``\n */\n value: {\n type: String,\n default: null\n },\n /**\n * Small underlying text content of the entry\n */\n description: {\n type: String,\n default: \"\"\n }\n },\n emits: [\"update:modelValue\"],\n setup() {\n return {\n mdiCheck,\n mdiChevronRight\n };\n },\n computed: {\n /**\n * determines if the action is focusable\n *\n * @return {boolean} is the action focusable ?\n */\n isFocusable() {\n return !this.disabled;\n },\n /**\n * The current \"checked\" or \"pressed\" state for the model behavior\n */\n isChecked() {\n if (this.type === \"radio\" && typeof this.modelValue !== \"boolean\") {\n return this.modelValue === this.value;\n }\n return this.modelValue;\n },\n /**\n * The native HTML type to set on the button\n */\n nativeType() {\n if (this.type === \"submit\" || this.type === \"reset\") {\n return this.type;\n }\n return \"button\";\n },\n /**\n * HTML attributes to bind to the