2 lines
84 KiB
JavaScript
2 lines
84 KiB
JavaScript
(()=>{var e,t,n,r={15340:()=>{},47790:()=>{},51069:()=>{},63063:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(71354),i=n.n(r),o=n(76314),s=n.n(o)()(i());s.push([e.id,".widget-file[data-v-613fea0c]{display:flex;flex-grow:1;color:var(--color-main-text) !important;text-decoration:none !important;padding:0 !important}.widget-file__image[data-v-613fea0c]{width:30%;min-width:160px;max-width:320px;background-position:center;background-size:cover;background-repeat:no-repeat}.widget-file__image--icon[data-v-613fea0c]{min-width:88px;max-width:88px;padding:12px;padding-inline-end:0;display:flex;align-items:center;justify-content:center}.widget-file__title[data-v-613fea0c]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:bold}.widget-file__details[data-v-613fea0c]{padding:12px;flex-grow:1;display:flex;flex-direction:column}.widget-file__details p[data-v-613fea0c]{margin:0;padding:0}.widget-file__description[data-v-613fea0c]{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;-webkit-box-orient:vertical}.widget-file--link[data-v-613fea0c]{color:var(--color-text-maxcontrast)}.widget-file--interactive[data-v-613fea0c]{position:relative;height:400px;max-height:50vh;margin:0}","",{version:3,sources:["webpack://./apps/files/src/views/ReferenceFileWidget.vue"],names:[],mappings:"AACA,8BACC,YAAA,CACA,WAAA,CACA,uCAAA,CACA,+BAAA,CACA,oBAAA,CAEA,qCACC,SAAA,CACA,eAAA,CACA,eAAA,CACA,0BAAA,CACA,qBAAA,CACA,2BAAA,CAEA,2CACC,cAAA,CACA,cAAA,CACA,YAAA,CACA,oBAAA,CACA,YAAA,CACA,kBAAA,CACA,sBAAA,CAIF,qCACC,eAAA,CACA,sBAAA,CACA,kBAAA,CACA,gBAAA,CAGD,uCACC,YAAA,CACA,WAAA,CACA,YAAA,CACA,qBAAA,CAEA,yCACC,QAAA,CACA,SAAA,CAIF,2CACC,eAAA,CACA,sBAAA,CACA,mBAAA,CACA,oBAAA,CACA,YAAA,CACA,2BAAA,CAID,oCACC,mCAAA,CAGD,2CACC,iBAAA,CACA,YAAA,CACA,eAAA,CACA,QAAA",sourcesContent:["\n.widget-file {\n\tdisplay: flex;\n\tflex-grow: 1;\n\tcolor: var(--color-main-text) !important;\n\ttext-decoration: none !important;\n\tpadding: 0 !important;\n\n\t&__image {\n\t\twidth: 30%;\n\t\tmin-width: 160px;\n\t\tmax-width: 320px;\n\t\tbackground-position: center;\n\t\tbackground-size: cover;\n\t\tbackground-repeat: no-repeat;\n\n\t\t&--icon {\n\t\t\tmin-width: 88px;\n\t\t\tmax-width: 88px;\n\t\t\tpadding: 12px;\n\t\t\tpadding-inline-end: 0;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t}\n\t}\n\n\t&__title {\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\twhite-space: nowrap;\n\t\tfont-weight: bold;\n\t}\n\n\t&__details {\n\t\tpadding: 12px;\n\t\tflex-grow: 1;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\n\t\tp {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t&__description {\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\tdisplay: -webkit-box;\n\t\t-webkit-line-clamp: 3;\n\t\tline-clamp: 3;\n\t\t-webkit-box-orient: vertical;\n\t}\n\n\t// No preview, standard link to ressource\n\t&--link {\n\t\tcolor: var(--color-text-maxcontrast);\n\t}\n\n\t&--interactive {\n\t\tposition: relative;\n\t\theight: 400px;\n\t\tmax-height: 50vh;\n\t\tmargin: 0;\n\t}\n}\n"],sourceRoot:""}]);const c=s},63779:()=>{},64688:()=>{},66089:()=>{},73776:()=>{},77199:()=>{},77965:()=>{},78982:()=>{},79368:()=>{},79838:()=>{},99348:(e,t,n)=>{"use strict";var r=n(53334),i=n(85471),o=(n(18465),n(43819)),s=n(86435),c=n(76643),l=n(87798),a=n(19998),u=n(3288),d=n(8019),f=n(40173),h=n(72704),p=n(21777),m=n(19051),v=n(63814),g=n(32505),b=(n(4483),n(61338)),k=n(83427),y=n(89916),w=n(3168);function C(e,t,n=()=>{},r){const i={hasInteractiveView:!0,fullWidth:!1,...r};window._vue_richtext_widgets[e]?w.l.error(`[ReferencePicker]: Widget for id ${e} already registered`):window._vue_richtext_widgets[e]={id:e,callback:t,onDestroy:n,...i}}function x(e){return!!window._vue_richtext_widgets[e]}window._vue_richtext_widgets??={},window._registerWidget??=(e,t,n,r)=>{C(e,t,n,r)},window._vue_richtext_custom_picker_elements??={},window._registerCustomPickerElement??=S;class A{element;object;constructor(e,t){this.element=e,this.object=t}}function _(e){return!!window._vue_richtext_custom_picker_elements[e]}function S(e,t,n=()=>{},r="large"){window._vue_richtext_custom_picker_elements[e]?w.l.error(`Custom reference picker element for id ${e} already registered`):window._vue_richtext_custom_picker_elements[e]={id:e,callback:t,onDestroy:n,size:r}}var P=n(51431),I=n(60176),O=n(6202),L=n(42507),R=n(51550),E=n(75004),T=n(97786),j=n(94294),D=n(44111),B=n(88289),F=n(21286),M=n(57090),N=n(42486);(0,O.r)(O.U);const $={name:"NcReferenceWidget",components:{NcButton:j.N},props:{reference:{type:Object,required:!0},interactive:{type:Boolean,default:!0},interactiveOptIn:{type:Boolean,default:!1}},setup(){const e=(0,i.KR)(!1),t=(0,i.KR)(),{width:n}=(0,T.Lhy)(t);return(0,T.BLq)(t,([t])=>{(0,i.dY)(()=>{e.value=t.isIntersecting})}),{width:n,isVisible:e,widgetRoot:t}},data:()=>({showInteractive:!1,rendered:!1,idleTimeout:null}),computed:{isInteractive(){return!this.interactiveOptIn&&this.interactive||this.showInteractive},hasFullWidth(){return e=this.reference.richObjectType,!!window._vue_richtext_widgets[e]?.fullWidth;var e},hasCustomWidget(){return x(this.reference.richObjectType)},hasInteractiveView(){return x(this.reference.richObjectType)&&(e=this.reference.richObjectType,!!window._vue_richtext_widgets[e]?.hasInteractiveView);var e},noAccess(){return this.reference&&!this.reference.accessible},descriptionStyle(){if(0===this.numberOfLines)return{display:"none"};const e=this.numberOfLines;return{lineClamp:e,webkitLineClamp:e}},numberOfLines(){return[450,550,650,1/0].findIndex(e=>this.width<e)},compactLink(){const e=this.reference.openGraphObject.link;return e?e.startsWith("https://")?e.substring(8):e.startsWith("http://")?e.substring(7):e:""},route(){return(0,D.g)(this.$router,this.reference.openGraphObject.link)},referenceWidgetLinkComponent(){return this.route?f.Wk:"a"},referenceWidgetLinkProps(){return this.route?{to:this.route}:{href:this.reference.openGraphObject.link,target:"_blank"}}},watch:{isVisible:{handler(e){e?(this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.rendered||this.renderWidget()):this.idleTimeout=setTimeout(()=>{this.isVisible||this.destroyWidget()},18e4)},immediate:!0}},beforeDestroy(){this.destroyWidget()},methods:{t:O.a,enableInteractive(){this.showInteractive=!0,this.renderWidget()},renderWidget(){if(!this.$refs.customWidget)return;if("open-graph"===this?.reference?.richObjectType)return;this.$refs.customWidget.innerHTML="";const e=document.createElement("div");e.style="width: 100%;",this.$refs.customWidget.appendChild(e),this.$nextTick(()=>{!function(e,t){const{richObjectType:n,richObject:r,accessible:i,interactive:o}=t;"open-graph"!==n&&(window._vue_richtext_widgets[n]?window._vue_richtext_widgets[n].callback(e,{richObjectType:n,richObject:r,accessible:i,interactive:o}):w.l.error("Widget for rich object type "+n+" not registered"))}(e,{...this.reference,interactive:this.isInteractive}),this.rendered=!0})},destroyWidget(){var e,t;this.rendered&&(e=this.reference.richObjectType,t=this.$el,"open-graph"!==e&&window._vue_richtext_widgets[e]&&window._vue_richtext_widgets[e].onDestroy(t),this.rendered=!1)}}};var z=function(){var e=this,t=e._self._c;return t("div",{ref:"widgetRoot",class:{"toggle-interactive":e.hasInteractiveView&&!e.isInteractive}},[e.reference&&e.hasCustomWidget?t("div",{ref:"customWidget",staticClass:"widget-custom",class:{"full-width":e.hasFullWidth}}):!e.noAccess&&e.reference&&e.reference.openGraphObject&&!e.hasCustomWidget?t(e.referenceWidgetLinkComponent,e._b({tag:"component",staticClass:"widget-default",attrs:{rel:"noopener noreferrer"}},"component",e.referenceWidgetLinkProps,!1),[e.reference.openGraphObject.thumb?t("img",{staticClass:"widget-default--image",attrs:{src:e.reference.openGraphObject.thumb}}):e._e(),t("div",{staticClass:"widget-default--details"},[t("p",{staticClass:"widget-default--name"},[e._v(" "+e._s(e.reference.openGraphObject.name)+" ")]),t("p",{staticClass:"widget-default--description",style:e.descriptionStyle},[e._v(" "+e._s(e.reference.openGraphObject.description)+" ")]),t("p",{staticClass:"widget-default--link"},[e._v(" "+e._s(e.compactLink)+" ")])])]):e._e(),e.interactiveOptIn&&e.hasInteractiveView&&!e.isInteractive?t("NcButton",{staticClass:"toggle-interactive--button",on:{click:e.enableInteractive}},[e._v(" "+e._s(e.t("Enable interactive view"))+" ")]):e._e()],1)},V=[];const W=(0,P.n)($,z,V,!1,null,"f05dd81b").exports,q={name:"NcCustomPickerElement",props:{provider:{type:Object,required:!0}},emits:["cancel","submit"],data(){return{isRegistered:_(this.provider.id),renderResult:null}},mounted(){this.isRegistered&&this.renderElement()},beforeDestroy(){var e,t,n;this.isRegistered&&(e=this.provider.id,t=this.$el,n=this.renderResult,window._vue_richtext_custom_picker_elements[e]&&window._vue_richtext_custom_picker_elements[e].onDestroy(t,n))},methods:{renderElement(){this.$refs.domElement&&(this.$refs.domElement.innerHTML="");const e=function(e,t){const{providerId:n,accessible:r}=t;if(window._vue_richtext_custom_picker_elements[n])return window._vue_richtext_custom_picker_elements[n].callback(e,{providerId:n,accessible:r});w.l.error(`Custom reference picker element for reference provider ID ${n} not registered`)}(this.$refs.domElement,{providerId:this.provider.id,accessible:!1});Promise.resolve(e).then(e=>{this.renderResult=e,this.renderResult.object?._isVue&&this.renderResult.object?.$on&&(this.renderResult.object.$on("submit",this.onSubmit),this.renderResult.object.$on("cancel",this.onCancel)),this.renderResult.element.addEventListener("submit",e=>{this.onSubmit(e.detail)}),this.renderResult.element.addEventListener("cancel",this.onCancel)})},onSubmit(e){this.$emit("submit",e)},onCancel(){this.$emit("cancel")}}};var U=function(){return(0,this._self._c)("div",{ref:"domElement"})},H=[];const G=(0,P.n)(q,U,H,!1,null,"0547d92f").exports,Q={name:"LinkVariantIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Y=function(){var e=this,t=e._self._c;return t("span",e._b({staticClass:"material-design-icon link-variant-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(t){return e.$emit("click",t)}}},"span",e.$attrs,!1),[t("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[t("path",{attrs:{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"}},[e.title?t("title",[e._v(e._s(e.title))]):e._e()])])])},K=[];const Z=(0,P.n)(Q,Y,K,!1,null,null).exports;(0,O.r)(O.V);const J={id:"any-link",title:(0,O.a)("Any link"),order:0,icon_url:(0,v.d0)("core","filetypes/link.svg")};function X(e,t){const n=window._vue_richtext_reference_providers.filter(e=>{const t=!!e.search_providers_ids&&e.search_providers_ids.length>0||_(e.id);return t||w.l.debug(`[smart picker] ${e.id} reference provider is discoverable but does not have any related search provider or custom picker component registered`),t}),r=e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&"),i=new RegExp(r,"i"),o=function(e){const t=window._vue_richtext_reference_provider_timestamps;return e.sort((e,t)=>e.order===t.order?0:e.order>t.order?1:-1).sort((e,n)=>{const r=t[e.id],i=t[n.id];return r===i?0:void 0===i?-1:void 0===r?1:r>i?-1:1})}(n).filter(e=>e.title.match(i)),s=t?o.slice(0,t):o;return""!==e&&0!==s.length||s.push(J),s}window._vue_richtext_reference_providers??=(0,I.C)("core","reference-provider-list",[]),window._vue_richtext_reference_provider_timestamps??=(0,I.C)("core","reference-provider-timestamps",{}),(0,O.r)(O.X,O.W);let ee=0;function te(e,t){return function(){const n=this,r=arguments;clearTimeout(ee),ee=setTimeout(function(){e.apply(n,r)},t)}}function ne(e){try{return Boolean(new URL(e))}catch{return!1}}const re={name:"NcProviderList",components:{NcSelect:E.N,NcHighlight:R.N,NcEmptyContent:L.A,LinkVariantIcon:Z},emits:["select-provider","submit"],data:()=>({selectedProvider:null,query:"",multiselectPlaceholder:(0,O.a)("Select provider"),providerIconAlt:(0,O.a)("Provider icon")}),computed:{options(){const e=[];return""!==this.query&&ne(this.query)&&e.push({id:this.query,title:this.query,isLink:!0}),e.push(...X(this.query)),e}},methods:{focus(){setTimeout(()=>{this.$refs["provider-select"]?.$el?.querySelector("#provider-select-input")?.focus()},300)},onProviderSelected(e){null!==e&&(e.isLink?this.$emit("submit",e.title):this.$emit("select-provider",e),this.selectedProvider=null)},onSearch(e){this.query=e}}};var ie=function(){var e=this,t=e._self._c;return t("div",{staticClass:"provider-list"},[t("NcSelect",{ref:"provider-select",staticClass:"provider-list--select",attrs:{"input-id":"provider-select-input",label:"title",placeholder:e.multiselectPlaceholder,options:e.options,"append-to-body":!1,"clear-search-on-select":!0,"clear-search-on-blur":()=>!1,filterable:!1},on:{search:e.onSearch,input:e.onProviderSelected},scopedSlots:e._u([{key:"option",fn:function(n){return[n.isLink?t("div",{staticClass:"provider"},[t("LinkVariantIcon",{staticClass:"link-icon",attrs:{size:20}}),t("span",[e._v(e._s(n.title))])],1):t("div",{staticClass:"provider"},[t("img",{staticClass:"provider-icon",attrs:{src:n.icon_url,alt:e.providerIconAlt}}),t("NcHighlight",{staticClass:"option-text",attrs:{search:e.query,text:n.title}})],1)]}}]),model:{value:e.selectedProvider,callback:function(t){e.selectedProvider=t},expression:"selectedProvider"}}),t("NcEmptyContent",{staticClass:"provider-list--empty-content",scopedSlots:e._u([{key:"icon",fn:function(){return[t("LinkVariantIcon")]},proxy:!0}])})],1)},oe=[];const se=(0,P.n)(re,ie,oe,!1,null,"f39d58d9").exports;(0,O.r)(O.Y);const ce={name:"NcRawLinkInput",components:{LinkVariantIcon:Z,NcEmptyContent:L.A,NcLoadingIcon:B.A,NcReferenceWidget:W,NcTextField:F.N},props:{provider:{type:Object,required:!0}},emits:["submit"],data:()=>({inputValue:"",loading:!1,reference:null,abortController:null,inputPlaceholder:(0,O.a)("Enter link")}),computed:{isLinkValid(){return ne(this.inputValue)}},methods:{focus(){this.$refs["url-input"].$el.getElementsByTagName("input")[0]?.focus()},onSubmit(e){const t=e.target.value;this.isLinkValid&&this.$emit("submit",t)},onClear(){this.inputValue="",this.reference=null},onInput(){this.reference=null,this.abortController&&this.abortController.abort(),this.isLinkValid&&te(()=>{this.updateReference()},500)()},updateReference(){this.loading=!0,this.abortController=new AbortController,m.Ay.get((0,v.KT)("references/resolve",2)+"?reference="+encodeURIComponent(this.inputValue),{signal:this.abortController.signal}).then(e=>{this.reference=e.data.ocs.data.references[this.inputValue]}).catch(e=>{w.l.error("Could not update reference",{error:e})}).then(()=>{this.loading=!1})}}};var le=function(){var e=this,t=e._self._c;return t("div",{staticClass:"raw-link"},[t("div",{staticClass:"input-wrapper"},[t("NcTextField",{ref:"url-input",attrs:{value:e.inputValue,"show-trailing-button":""!==e.inputValue,label:e.inputPlaceholder},on:{"update:value":[function(t){e.inputValue=t},e.onInput],"trailing-button-click":e.onClear},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.onSubmit.apply(null,arguments)}}},[e.loading?t("NcLoadingIcon",{attrs:{size:16}}):t("LinkVariantIcon",{attrs:{size:16}})],1)],1),null!==e.reference?t("NcReferenceWidget",{staticClass:"reference-widget",attrs:{reference:e.reference}}):t("NcEmptyContent",{staticClass:"raw-link--empty-content",scopedSlots:e._u([{key:"icon",fn:function(){return[e.provider.icon_url?t("img",{staticClass:"provider-icon",attrs:{src:e.provider.icon_url}}):t("LinkVariantIcon")]},proxy:!0}])})],1)},ae=[];const ue=(0,P.n)(ce,le,ae,!1,null,"be630586").exports,de={name:"NcSearchResult",components:{NcHighlight:R.N},props:{entry:{type:Object,required:!0},query:{type:String,required:!0}}};var fe=function(){var e=this,t=e._self._c;return t("div",{staticClass:"result"},[e.entry.icon?t("div",{staticClass:"result--icon-class",class:{[e.entry.icon]:!0,rounded:e.entry.rounded}}):t("img",{staticClass:"result--image",class:{rounded:e.entry.rounded},attrs:{src:e.entry.thumbnailUrl}}),t("div",{staticClass:"result--content"},[t("span",{staticClass:"result--content--name"},[t("NcHighlight",{attrs:{search:e.query,text:e.entry.title}})],1),t("span",{staticClass:"result--content--subline"},[t("NcHighlight",{attrs:{search:e.query,text:e.entry.subline}})],1)])])},he=[];const pe=(0,P.n)(de,fe,he,!1,null,"995c2758").exports;(0,O.r)(O.Z,O.X,O.w);const me={name:"NcSearch",components:{LinkVariantIcon:Z,DotsHorizontalIcon:M.D,NcEmptyContent:L.A,NcSelect:E.N,NcSearchResult:pe},props:{provider:{type:Object,required:!0},showEmptyContent:{type:Boolean,default:!0},searchPlaceholder:{type:String,default:null}},emits:["submit"],data:()=>({searchQuery:"",selectedResult:null,resultsBySearchProvider:{},searching:!1,searchingMoreOf:null,abortController:null,noOptionsText:(0,O.a)("Start typing to search"),providerIconAlt:(0,O.a)("Provider icon")}),computed:{mySearchPlaceholder(){return this.searchPlaceholder||(0,O.a)("Search")},searchProviderIds(){return this.provider.search_providers_ids},options(){if(""===this.searchQuery)return[];const e=[];return ne(this.searchQuery)&&e.push(this.rawLinkEntry),e.push(...this.formattedSearchResults),e},rawLinkEntry(){return{id:"rawLinkEntry",resourceUrl:this.searchQuery,isRawLink:!0}},formattedSearchResults(){const e=[];return this.searchProviderIds.forEach(t=>{if(this.resultsBySearchProvider[t].entries.length>0){(this.searchProviderIds.length>1||this.resultsBySearchProvider[t].entries.length>1)&&e.push({id:"groupTitle-"+t,name:this.resultsBySearchProvider[t].name,isCustomGroupTitle:!0,providerId:t});const n=this.resultsBySearchProvider[t].entries.map((e,n)=>({id:"provider-"+t+"-entry-"+n,...e}));e.push(...n),this.resultsBySearchProvider[t].isPaginated&&e.push({id:"moreOf-"+t,name:this.resultsBySearchProvider[t].name,isMore:!0,providerId:t,isLoading:this.searchingMoreOf===t})}}),e}},mounted(){this.resetResults()},beforeDestroy(){this.cancelSearchRequests()},methods:{t:O.a,resetResults(){const e={};this.searchProviderIds.forEach(t=>{e[t]={entries:[]}}),this.resultsBySearchProvider=e},focus(){setTimeout(()=>{this.$refs["search-select"]?.$el?.querySelector("#search-select-input")?.focus()},300)},cancelSearchRequests(){this.abortController&&this.abortController.abort()},onSearchInput(e){this.searchQuery=e,te(()=>{this.updateSearch()},500)()},onSelectResultSelected(e){null!==e&&(e.resourceUrl?(this.cancelSearchRequests(),this.$emit("submit",e.resourceUrl)):e.isMore&&this.searchMoreOf(e.providerId).then(()=>{this.selectedResult=null}))},searchMoreOf(e){return this.searchingMoreOf=e,this.cancelSearchRequests(),this.searchProviders(e)},updateSearch(){if(this.cancelSearchRequests(),this.resetResults(),""!==this.searchQuery)return this.searchProviders();this.searching=!1},searchProviders(e=null){this.abortController=new AbortController,this.searching=!0;const t=null===e?[...this.searchProviderIds].map(e=>this.searchOneProvider(e)):[this.searchOneProvider(e,this.resultsBySearchProvider[e]?.cursor??null)];return Promise.allSettled(t).then(e=>{e.find(e=>"rejected"===e.status&&("CanceledError"===e.reason.name||"ERR_CANCELED"===e.reason.code))||(this.searching=!1,this.searchingMoreOf=null)})},searchOneProvider(e,t=null){const n=null===t?(0,v.KT)("search/providers/{providerId}/search?term={term}&limit={limit}",{providerId:e,term:this.searchQuery,limit:5}):(0,v.KT)("search/providers/{providerId}/search?term={term}&limit={limit}&cursor={cursor}",{providerId:e,term:this.searchQuery,limit:5,cursor:t});return m.Ay.get(n,{signal:this.abortController.signal}).then(t=>{const n=t.data.ocs.data;this.resultsBySearchProvider[e].name=n.name,this.resultsBySearchProvider[e].cursor=n.cursor,this.resultsBySearchProvider[e].isPaginated=n.isPaginated,this.resultsBySearchProvider[e].entries.push(...n.entries)})}}};var ve=function(){var e=this,t=e._self._c;return t("div",{staticClass:"smart-picker-search",class:{"with-empty-content":e.showEmptyContent}},[t("NcSelect",{ref:"search-select",staticClass:"smart-picker-search--select",attrs:{"input-id":"search-select-input",label:"name",placeholder:e.mySearchPlaceholder,options:e.options,"append-to-body":!1,"close-on-select":!1,"clear-search-on-select":!1,"clear-search-on-blur":()=>!1,"reset-focus-on-options-change":!1,filterable:!1,autoscroll:!0,"reset-on-options-change":!1,loading:e.searching},on:{search:e.onSearchInput,input:e.onSelectResultSelected},scopedSlots:e._u([{key:"option",fn:function(n){return[n.isRawLink?t("div",{staticClass:"custom-option"},[t("LinkVariantIcon",{staticClass:"option-simple-icon",attrs:{size:20}}),t("span",{staticClass:"option-text"},[e._v(" "+e._s(e.t("Raw link {options}",{options:n.resourceUrl}))+" ")])],1):n.resourceUrl?t("NcSearchResult",{staticClass:"search-result",attrs:{entry:n,query:e.searchQuery}}):n.isCustomGroupTitle?t("span",{staticClass:"custom-option group-name"},[e.provider.icon_url?t("img",{staticClass:"provider-icon group-name-icon",attrs:{src:e.provider.icon_url}}):e._e(),t("span",{staticClass:"option-text"},[t("strong",[e._v(e._s(n.name))])])]):n.isMore?t("span",{staticClass:"custom-option"},[n.isLoading?t("span",{staticClass:"option-simple-icon icon-loading-small"}):t("DotsHorizontalIcon",{staticClass:"option-simple-icon",attrs:{size:20}}),t("span",{staticClass:"option-text"},[e._v(" "+e._s(e.t('Load more "{options}"',{options:n.name}))+" ")])],1):e._e()]}},{key:"no-options",fn:function(){return[e._v(" "+e._s(e.noOptionsText)+" ")]},proxy:!0}]),model:{value:e.selectedResult,callback:function(t){e.selectedResult=t},expression:"selectedResult"}}),e.showEmptyContent?t("NcEmptyContent",{staticClass:"smart-picker-search--empty-content",scopedSlots:e._u([{key:"icon",fn:function(){return[e.provider.icon_url?t("img",{staticClass:"provider-icon",attrs:{alt:e.providerIconAlt,src:e.provider.icon_url}}):t("LinkVariantIcon")]},proxy:!0}],null,!1,2922132592)}):e._e()],1)},ge=[];const be=(0,P.n)(me,ve,ge,!1,null,"e61f71e3").exports,ke={providerList:1,standardLinkInput:2,searchInput:3,customElement:4},ye={name:"NcReferencePicker",components:{NcCustomPickerElement:G,NcProviderList:se,NcRawLinkInput:ue,NcSearch:be},props:{initialProvider:{type:Object,default:()=>null},width:{type:Number,default:null},focusOnCreate:{type:Boolean,default:!0}},emits:["cancel","cancel-raw-link","cancel-search","provider-selected","submit"],data(){return{MODES:ke,selectedProvider:this.initialProvider}},computed:{mode(){return null===this.selectedProvider?ke.providerList:_(this.selectedProvider.id)?ke.customElement:this.selectedProvider.search_providers_ids?ke.searchInput:ke.standardLinkInput},pickerWrapperStyle(){return{width:this.width?this.width+"px":void 0}}},mounted(){this.focusOnCreate&&(this.initialProvider?setTimeout(()=>{this.$refs["url-input"]?.focus()},300):this.$nextTick(()=>{this.$refs["provider-list"]?.focus()}))},methods:{onEscapePressed(){null!==this.selectedProvider?this.deselectProvider():this.cancelProviderSelection()},onProviderSelected(e){this.selectedProvider=e,this.$emit("provider-selected",e),this.$nextTick(()=>{this.$refs["url-input"]?.focus()})},cancelCustomElement(){this.deselectProvider()},cancelSearch(){this.$emit("cancel-search",this.selectedProvider?.title),this.deselectProvider()},cancelRawLinkInput(){this.$emit("cancel-raw-link",this.selectedProvider?.title),this.deselectProvider()},cancelProviderSelection(){this.$emit("cancel")},submitLink(e){null!==this.selectedProvider&&async function(e){const t=Math.floor(Date.now()/1e3),n=(0,v.KT)("references/provider/{providerId}",{providerId:e});await m.Ay.put(n,{timestamp:t}),window._vue_richtext_reference_provider_timestamps[e]=t}(this.selectedProvider.id),this.$emit("submit",e),this.deselectProvider()},deselectProvider(){this.selectedProvider=null,this.$emit("provider-selected",null),setTimeout(()=>{this.$refs["provider-list"]?.focus()},300)}}};var we=function(){var e=this,t=e._self._c;return t("div",{staticClass:"reference-picker",style:e.pickerWrapperStyle,attrs:{tabindex:"-1"},on:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),t.preventDefault(),e.onEscapePressed.apply(null,arguments))}}},[e.mode===e.MODES.providerList?t("NcProviderList",{ref:"provider-list",on:{"select-provider":e.onProviderSelected,submit:e.submitLink,cancel:e.cancelProviderSelection}}):e.mode===e.MODES.standardLinkInput?t("NcRawLinkInput",{ref:"url-input",attrs:{provider:e.selectedProvider},on:{submit:e.submitLink,cancel:e.cancelRawLinkInput}}):e.mode===e.MODES.searchInput?t("NcSearch",{ref:"url-input",attrs:{provider:e.selectedProvider},on:{cancel:e.cancelSearch,submit:e.submitLink}}):e.mode===e.MODES.customElement?t("div",{staticClass:"custom-element-wrapper"},[t("NcCustomPickerElement",{staticClass:"custom-element",attrs:{provider:e.selectedProvider},on:{submit:e.submitLink,cancel:e.cancelCustomElement}})],1):e._e()],1)},Ce=[];const xe=(0,P.n)(ye,we,Ce,!1,null,"646d5538").exports;(0,O.r)(O._,O.n);const Ae={name:"NcReferencePickerModal",components:{NcReferencePicker:xe,NcModal:N.A,NcButton:j.N,ArrowLeftIcon:k.A,CloseIcon:y.C},props:{initialProvider:{type:Object,default:()=>null},focusOnCreate:{type:Boolean,default:!0},isInsideViewer:{type:Boolean,default:!1}},emits:["cancel","submit"],data(){return{show:!0,selectedProvider:this.initialProvider,backButtonTitle:(0,O.a)("Back to provider selection"),closeButtonTitle:(0,O.a)("Close"),closeButtonLabel:(0,O.a)("Close Smart Picker")}},computed:{isProviderSelected(){return null!==this.selectedProvider},showBackButton(){return null===this.initialProvider&&this.isProviderSelected},modalSize(){return this.isProviderSelected&&_(this.selectedProvider.id)?function(e){const t=window._vue_richtext_custom_picker_elements[e]?.size;return["small","normal","large","full"].includes(t)?t:null}(this.selectedProvider.id)??"large":"normal"},showModalName(){return!this.isProviderSelected||!_(this.selectedProvider.id)},modalName(){return this.isProviderSelected?this.selectedProvider.title:(0,O.a)("Smart Picker")}},mounted(){if(this.isInsideViewer){const e=this.$refs.modal_content;(0,b.Ic)("viewer:trapElements:changed",e)}},methods:{onCancel(){this.show=!1,this.$emit("cancel")},onSubmit(e){this.show=!1,this.$emit("submit",e)},onProviderSelect(e){this.selectedProvider=e,null===e&&null!==this.initialProvider&&this.onCancel()},onBackClicked(){this.$refs.referencePicker.deselectProvider()}}};var _e=function(){var e=this,t=e._self._c;return e.show?t("NcModal",{staticClass:"reference-picker-modal",attrs:{size:e.modalSize,"can-close":!0},on:{close:e.onCancel}},[t("div",{ref:"modal_content",staticClass:"reference-picker-modal--content"},[e.showBackButton?t("NcButton",{staticClass:"back-button",attrs:{"aria-label":e.backButtonTitle,title:e.backButtonTitle},on:{click:e.onBackClicked},scopedSlots:e._u([{key:"icon",fn:function(){return[t("ArrowLeftIcon")]},proxy:!0}],null,!1,3001860362)}):e._e(),t("NcButton",{staticClass:"close-button",attrs:{"aria-label":e.closeButtonLabel,title:e.closeButtonTitle,variant:"tertiary"},on:{click:e.onCancel},scopedSlots:e._u([{key:"icon",fn:function(){return[t("CloseIcon")]},proxy:!0}],null,!1,2491825086)}),e.showModalName?t("h2",[e._v(" "+e._s(e.modalName)+" ")]):e._e(),t("NcReferencePicker",{ref:"referencePicker",attrs:{"initial-provider":e.initialProvider,"focus-on-create":e.focusOnCreate},on:{"provider-selected":e.onProviderSelect,submit:e.onSubmit,cancel:e.onCancel}})],1)]):e._e()},Se=[];(0,P.n)(Ae,_e,Se,!1,null,"00990f2a").exports;var Pe=n(48191),Ie=n(85603),Oe=n(88751),Le=n(33239),Re=n(47970),Ee=n(64546);const Te={name:"NcReferenceList",components:{NcReferenceWidget:W},props:{text:{type:String,default:""},referenceData:{type:Array,default:null},limit:{type:Number,default:1},displayFallback:{type:Boolean,default:!1},interactive:{type:Boolean,default:!0},interactiveOptIn:{type:Boolean,default:!1}},data:()=>({references:null,loading:!0}),computed:{isVisible(){return this.loading||0!==this.displayedReferences.length},values(){return this.referenceData?this.referenceData:!this.displayFallback||this.loading||this.references?this.references?Object.values(this.references):[]:[this.fallbackReference]},firstReference(){return this.values[0]??null},displayedReferences(){return this.values.filter(Boolean).slice(0,this.limit)},fallbackReference(){return{accessible:!0,openGraphObject:{id:this.text,link:this.text,name:this.text},richObjectType:"open-graph"}}},watch:{text:"fetch"},mounted(){this.fetch()},methods:{fetch(){return this.loading=!0,this.referenceData?(this.references=null,void(this.loading=!1)):new RegExp(D.U).exec(this.text)?void this.resolve().then(e=>{this.references=e.data.ocs.data.references,this.loading=!1,this.$emit("loaded")}).catch(e=>{w.l.error("Failed to extract references",{error:e}),this.loading=!1,this.$emit("loaded")}):(this.references=null,void(this.loading=!1))},resolve(){const e=new RegExp(D.U).exec(this.text.trim()),t=null===(0,p.HW)();return 1===this.limit&&e?t?m.Ay.get((0,v.KT)("references/resolvePublic")+`?reference=${encodeURIComponent(e[0])}&sharingToken=${(0,g.G)()}`):m.Ay.get((0,v.KT)("references/resolve")+`?reference=${encodeURIComponent(e[0])}`):t?m.Ay.post((0,v.KT)("references/extractPublic"),{text:this.text,resolve:!0,limit:this.limit,sharingToken:(0,g.G)()}):m.Ay.post((0,v.KT)("references/extract"),{text:this.text,resolve:!0,limit:this.limit})}}};var je=function(){var e=this,t=e._self._c;return e.isVisible?t("div",{staticClass:"widgets--list",class:{"icon-loading":e.loading}},e._l(e.displayedReferences,function(n){return t("NcReferenceWidget",{key:n.openGraphObject?.id,attrs:{reference:n,interactive:e.interactive,"interactive-opt-in":e.interactiveOptIn}})}),1):e._e()},De=[];const Be=(0,P.n)(Te,je,De,!1,null,"a50e616b").exports;function Fe(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}const Me=Ue(/[A-Za-z]/),Ne=Ue(/[\dA-Za-z]/);function $e(e){return null!==e&&e<-2}function ze(e){return null!==e&&(e<0||32===e)}function Ve(e){return-2===e||-1===e||32===e}const We=Ue(new RegExp("\\p{P}|\\p{S}","u")),qe=Ue(/\s/);function Ue(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}const He=function(e){if(null==e)return Qe;if("function"==typeof e)return Ge(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=He(e[n]);return Ge(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):function(e){const t=e;return Ge(function(n){const r=n;let i;for(i in e)if(r[i]!==t[i])return!1;return!0})}(e);if("string"==typeof e)return t=e,Ge(function(e){return e&&e.type===t});var t;throw new Error("Expected function, string, or object as test")};function Ge(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function Qe(){return!0}const Ye=[],Ke=!1;function Ze(e,t,n,r){let i;i=t;const o=He(i);!function e(t,r,i){const s=t&&"object"==typeof t?t:{};if("string"==typeof s.type){const e="string"==typeof s.tagName?s.tagName:"string"==typeof s.name?s.name:void 0;Object.defineProperty(c,"name",{value:"node ("+t.type+(e?"<"+e+">":"")+")"})}return c;function c(){let s,c,l,a=Ye;if(o(t,r,i[i.length-1]||void 0)&&(a=function(e){return Array.isArray(e)?e:"number"==typeof e?[true,e]:null==e?Ye:[e]}(n(t,i)),a[0]===Ke))return a;if("children"in t&&t.children){const n=t;if(n.children&&"skip"!==a[0])for(c=0,l=i.concat(n);c>-1&&c<n.children.length;){const t=n.children[c];if(s=e(t,c,l)(),s[0]===Ke)return s;c="number"==typeof s[1]?s[1]:c+1}}return a}}(e,void 0,[])()}function Je(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function Xe(e){return"function"==typeof e?e:function(){return e}}const et="phrasing",tt=["autolink","link","image","label"];function nt(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function rt(e){this.config.enter.autolinkProtocol.call(this,e)}function it(e){this.config.exit.autolinkProtocol.call(this,e)}function ot(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function st(e){this.config.exit.autolinkEmail.call(this,e)}function ct(e){this.exit(e)}function lt(e){!function(e,t,n){const r=He((n||{}).ignore||[]),i=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([Je(e[0]),Xe(e[1])])}return t}(t);let o=-1;for(;++o<i.length;)Ze(e,"text",s);function s(e,t){let n,s=-1;for(;++s<t.length;){const e=t[s],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=i[o][0],s=i[o][1];let c=0;const l=n.children.indexOf(e);let a=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,i={index:d.index,input:d.input,stack:[...t,e]};let o=s(...d,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(c!==n&&u.push({type:"text",value:e.value.slice(c,n)}),Array.isArray(o)?u.push(...o):o&&u.push(o),c=n+d[0].length,a=!0),!r.global)break;d=r.exec(e.value)}return a?(c<e.value.length&&u.push({type:"text",value:e.value.slice(c)}),n.children.splice(l,1,...u)):u=[e],l+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,at],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,ut]],{ignore:["link","linkReference"]})}function at(e,t,n,r,i){let o="";if(!dt(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!function(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n))return!1;const s=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=Fe(e,"(");let o=Fe(e,")");for(;-1!==r&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}(n+r);if(!s[0])return!1;const c={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[c,{type:"text",value:s[1]}]:c}function ut(e,t,n,r){return!(!dt(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function dt(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||qe(n)||We(n))&&(!t||47!==n)}function ft(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function ht(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function pt(){this.buffer()}function mt(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=ft(this.sliceSerialize(e)).toLowerCase()}function vt(e){this.exit(e)}function gt(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bt(){this.buffer()}function kt(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=ft(this.sliceSerialize(e)).toLowerCase()}function yt(e){this.exit(e)}function wt(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteReference"),c=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{...i.current(),before:o,after:"]"})),c(),s(),o+=i.move("]"),o}function Ct(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteDefinition"),c=n.enter("label");return o+=i.move(n.safe(n.associationId(e),{...i.current(),before:o,after:"]"})),c(),o+=i.move("]:"+(e.children&&e.children.length>0?" ":"")),i.shift(4),o+=i.move(n.indentLines(n.containerFlow(e,i.current()),xt)),s(),o}function xt(e,t,n){return 0===t?e:(n?"":" ")+e}wt.peek=function(){return"["};const At=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function _t(e){this.enter({type:"delete",children:[]},e)}function St(e){this.exit(e)}function Pt(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function It(e){return null==e?"":String(e)}function Ot(e){return e.length}function Lt(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function Rt(e,t,n){return">"+(n?"":" ")+e}function Et(e,t){return Tt(e,t.inConstruct,!0)&&!Tt(e,t.notInConstruct,!1)}function Tt(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function jt(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if("\n"===n.unsafe[i].character&&Et(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function Dt(e,t,n){return(n?"":" ")+e}function Bt(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ft(e,t,n,r){const i=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),o=n.enter("emphasis"),s=n.createTracker(r);let c=s.move(i);return c+=s.move(n.containerPhrasing(e,{before:c,after:i,...s.current()})),c+=s.move(i),o(),c}Pt.peek=function(){return"~"},Ft.peek=function(e,t,n){return n.options.emphasis||"*"};const Mt={};function Nt(e,t){return $t(e,"boolean"!=typeof Mt.includeImageAlt||Mt.includeImageAlt,"boolean"!=typeof Mt.includeHtml||Mt.includeHtml)}function $t(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return zt(e.children,t,n)}return Array.isArray(e)?zt(e,t,n):""}function zt(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=$t(e[i],t,n);return r.join("")}function Vt(e){return e.value||""}function Wt(e,t,n,r){const i=Bt(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("image");let c=n.enter("label");const l=n.createTracker(r);let a=l.move("![");return a+=l.move(n.safe(e.alt,{before:a,after:"]",...l.current()})),a+=l.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),a+=l.move("<"),a+=l.move(n.safe(e.url,{before:a,after:">",...l.current()})),a+=l.move(">")):(c=n.enter("destinationRaw"),a+=l.move(n.safe(e.url,{before:a,after:e.title?" ":")",...l.current()}))),c(),e.title&&(c=n.enter(`title${o}`),a+=l.move(" "+i),a+=l.move(n.safe(e.title,{before:a,after:i,...l.current()})),a+=l.move(i),c()),a+=l.move(")"),s(),a}function qt(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=n.enter("label");const c=n.createTracker(r);let l=c.move("![");const a=n.safe(e.alt,{before:l,after:"]",...c.current()});l+=c.move(a+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...c.current()});return s(),n.stack=u,o(),"full"!==i&&a&&a===d?"shortcut"===i?l=l.slice(0,-1):l+=c.move("]"):l+=c.move(d+"]"),l}function Ut(e,t,n){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<n.unsafe.length;){const e=n.unsafe[o],t=n.compilePattern(e);let i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(i.index+1)}}return i+r+i}function Ht(e,t){const n=Nt(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function Gt(e,t,n,r){const i=Bt(n),o='"'===i?"Quote":"Apostrophe",s=n.createTracker(r);let c,l;if(Ht(e,n)){const t=n.stack;n.stack=[],c=n.enter("autolink");let r=s.move("<");return r+=s.move(n.containerPhrasing(e,{before:r,after:">",...s.current()})),r+=s.move(">"),c(),n.stack=t,r}c=n.enter("link"),l=n.enter("label");let a=s.move("[");return a+=s.move(n.containerPhrasing(e,{before:a,after:"](",...s.current()})),a+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),a+=s.move("<"),a+=s.move(n.safe(e.url,{before:a,after:">",...s.current()})),a+=s.move(">")):(l=n.enter("destinationRaw"),a+=s.move(n.safe(e.url,{before:a,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${o}`),a+=s.move(" "+i),a+=s.move(n.safe(e.title,{before:a,after:i,...s.current()})),a+=s.move(i),l()),a+=s.move(")"),c(),a}function Qt(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=n.enter("label");const c=n.createTracker(r);let l=c.move("[");const a=n.containerPhrasing(e,{before:l,after:"]",...c.current()});l+=c.move(a+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...c.current()});return s(),n.stack=u,o(),"full"!==i&&a&&a===d?"shortcut"===i?l=l.slice(0,-1):l+=c.move("]"):l+=c.move(d+"]"),l}function Yt(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Kt(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}Vt.peek=function(){return"<"},Wt.peek=function(){return"!"},qt.peek=function(){return"!"},Ut.peek=function(){return"`"},Gt.peek=function(e,t,n){return Ht(e,n)?"<":"["},Qt.peek=function(){return"["};const Zt=He(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Jt(e,t,n,r){const i=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),o=n.enter("strong"),s=n.createTracker(r);let c=s.move(i+i);return c+=s.move(n.containerPhrasing(e,{before:c,after:i,...s.current()})),c+=s.move(i+i),o(),c}Jt.peek=function(e,t,n){return n.options.strong||"*"};const Xt={blockquote:function(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const s=n.indentLines(n.containerFlow(e,o.current()),Rt);return i(),s},break:jt,code:function(e,t,n,r){const i=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),o=e.value||"",s="`"===i?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(o,Dt);return e(),t}const c=n.createTracker(r),l=i.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,s=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===i?++o>s&&(s=o):o=1,i=r+t.length,r=n.indexOf(t,i);return s}(o,i)+1,3)),a=n.enter("codeFenced");let u=c.move(l);if(e.lang){const t=n.enter(`codeFencedLang${s}`);u+=c.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...c.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${s}`);u+=c.move(" "),u+=c.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...c.current()})),t()}return u+=c.move("\n"),o&&(u+=c.move(o+"\n")),u+=c.move(l),a(),u},definition:function(e,t,n,r){const i=Bt(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("definition");let c=n.enter("label");const l=n.createTracker(r);let a=l.move("[");return a+=l.move(n.safe(n.associationId(e),{before:a,after:"]",...l.current()})),a+=l.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),a+=l.move("<"),a+=l.move(n.safe(e.url,{before:a,after:">",...l.current()})),a+=l.move(">")):(c=n.enter("destinationRaw"),a+=l.move(n.safe(e.url,{before:a,after:e.title?" ":"\n",...l.current()}))),c(),e.title&&(c=n.enter(`title${o}`),a+=l.move(" "+i),a+=l.move(n.safe(e.title,{before:a,after:i,...l.current()})),a+=l.move(i),c()),s(),a},emphasis:Ft,hardBreak:jt,heading:function(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(function(e,t){let n=!1;return(0,Re.YR)(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,Ee.dc}),Boolean((!e.depth||e.depth<3)&&Nt(e)&&(t.options.setext||n))}(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===i?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}const s="#".repeat(i),c=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let a=n.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return/^[\t ]/.test(a)&&(a="&#x"+a.charCodeAt(0).toString(16).toUpperCase()+";"+a.slice(1)),a=a?s+" "+a:s,n.options.closeAtx&&(a+=" "+s),l(),c(),a},html:Vt,image:Wt,imageReference:qt,inlineCode:Ut,link:Gt,linkReference:Qt,list:function(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):Yt(n);const c=e.ordered?"."===s?")":".":function(e){const t=Yt(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&s===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),Kt(n)===s&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(s=c),n.bulletCurrent=s;const a=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),a},listItem:function(e,t,n,r){const i=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let o=n.bulletCurrent||Yt(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let s=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const c=n.createTracker(r);c.move(o+" ".repeat(s-o.length)),c.shift(s);const l=n.enter("listItem"),a=n.indentLines(n.containerFlow(e,c.current()),function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?o:o+" ".repeat(s-o.length))+e});return l(),a},paragraph:function(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s},root:function(e,t,n,r){return(e.children.some(function(e){return Zt(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:Jt,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(Kt(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}};function en(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function tn(e){this.exit(e),this.data.inTable=void 0}function nn(e){this.enter({type:"tableRow",children:[]},e)}function rn(e){this.exit(e)}function on(e){this.enter({type:"tableCell",children:[]},e)}function sn(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,cn));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function cn(e,t){return"|"===t?t:e}function ln(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=Xt.inlineCode(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return c(function(e,t,n){const r=e.children;let i=-1;const o=[],s=t.enter("table");for(;++i<r.length;)o[i]=l(r[i],t,n);return s(),o}(e,n,r),e.align)},tableCell:s,tableRow:function(e,t,n,r){const i=c([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function s(e,t,n,r){const i=n.enter("tableCell"),s=n.enter("phrasing"),c=n.containerPhrasing(e,{...r,before:o,after:o});return s(),i(),c}function c(e,t){return function(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||Ot,i=[],o=[],s=[],c=[];let l=0,a=-1;for(;++a<e.length;){const n=[],i=[];let u=-1;for(e[a].length>l&&(l=e[a].length);++u<e[a].length;){const o=It(e[a][u]);if(!1!==t.alignDelimiters){const e=r(o);i[u]=e,(void 0===c[u]||e>c[u])&&(c[u]=e)}n.push(o)}o[a]=n,s[a]=i}let u=-1;if("object"==typeof n&&"length"in n)for(;++u<l;)i[u]=Lt(n[u]);else{const e=Lt(n);for(;++u<l;)i[u]=e}u=-1;const d=[],f=[];for(;++u<l;){const e=i[u];let n="",r="";99===e?(n=":",r=":"):108===e?n=":":114===e&&(r=":");let o=!1===t.alignDelimiters?1:Math.max(1,c[u]-n.length-r.length);const s=n+"-".repeat(o)+r;!1!==t.alignDelimiters&&(o=n.length+o+r.length,o>c[u]&&(c[u]=o),f[u]=o),d[u]=s}o.splice(1,0,d),s.splice(1,0,f),a=-1;const h=[];for(;++a<o.length;){const e=o[a],n=s[a];u=-1;const r=[];for(;++u<l;){const o=e[u]||"";let s="",a="";if(!1!==t.alignDelimiters){const e=c[u]-(n[u]||0),t=i[u];114===t?s=" ".repeat(e):99===t?e%2?(s=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):(s=" ".repeat(e/2),a=s):a=" ".repeat(e)}!1===t.delimiterStart||u||r.push("|"),!1===t.padding||!1===t.alignDelimiters&&""===o||!1===t.delimiterStart&&!u||r.push(" "),!1!==t.alignDelimiters&&r.push(s),r.push(o),!1!==t.alignDelimiters&&r.push(a),!1!==t.padding&&r.push(" "),!1===t.delimiterEnd&&u===l-1||r.push("|")}h.push(!1===t.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return h.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){const r=e.children;let i=-1;const o=[],c=t.enter("tableRow");for(;++i<r.length;)o[i]=s(r[i],0,t,n);return c(),o}}function an(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function un(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let i,o=-1;for(;++o<r.length;){const e=r[o];if("paragraph"===e.type){i=e;break}}i===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function dn(e,t,n,r){const i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,s="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);o&&c.move(s);let l=Xt.listItem(e,t,n,{...r,...c.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+s})),l}function fn(e,t,n,r){const i=e.length;let o,s=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}const hn={}.hasOwnProperty;function pn(e,t){let n;for(n in t){const r=(hn.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){hn.call(r,o)||(r[o]=[]);const e=i[o];mn(r[o],Array.isArray(e)?e:e?[e]:[])}}}function mn(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);fn(e,0,0,r)}const vn={tokenize:function(e,t,n){let r=0;return function t(o){return(87===o||119===o)&&r<3?(r++,e.consume(o),t):46===o&&3===r?(e.consume(o),i):n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},gn={tokenize:function(e,t,n){let r,i,o;return s;function s(t){return 46===t||95===t?e.check(kn,l,c)(t):null===t||ze(t)||qe(t)||45!==t&&We(t)?l(t):(o=!0,e.consume(t),s)}function c(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),s}function l(e){return i||r||!o?n(e):t(e)}},partial:!0},bn={tokenize:function(e,t){let n=0,r=0;return i;function i(s){return 40===s?(n++,e.consume(s),i):41===s&&r<n?o(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(kn,t,o)(s):null===s||ze(s)||qe(s)?t(s):(e.consume(s),i)}function o(t){return 41===t&&r++,e.consume(t),i}},partial:!0},kn={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),o):93===s?(e.consume(s),i):60===s||null===s||ze(s)||qe(s)?t(s):n(s)}function i(e){return null===e||40===e||91===e||ze(e)||qe(e)?t(e):r(e)}function o(e){return Me(e)?s(e):n(e)}function s(t){return 59===t?(e.consume(t),r):Me(t)?(e.consume(t),s):n(t)}},partial:!0},yn={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return Ne(e)?n(e):t(e)}},partial:!0},wn={tokenize:function(e,t,n){const r=this;return function(t){return 87!==t&&119!==t||!Sn.call(r,r.previous)||Ln(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(vn,e.attempt(gn,e.attempt(bn,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:Sn},Cn={tokenize:function(e,t,n){const r=this;let i="",o=!1;return function(t){return 72!==t&&104!==t||!Pn.call(r,r.previous)||Ln(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),s)};function s(t){if(Me(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(58===t){const n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),c}return n(t)}function c(t){return 47===t?(e.consume(t),o?l:(o=!0,c)):n(t)}function l(t){return null===t||function(e){return null!==e&&(e<32||127===e)}(t)||ze(t)||qe(t)||We(t)?n(t):e.attempt(gn,e.attempt(bn,a),n)(t)}function a(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:Pn},xn={tokenize:function(e,t,n){const r=this;let i,o;return function(t){return On(t)&&In.call(r,r.previous)&&!Ln(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(t)):n(t)};function s(t){return On(t)?(e.consume(t),s):64===t?(e.consume(t),c):n(t)}function c(t){return 46===t?e.check(yn,a,l)(t):45===t||95===t||Ne(t)?(o=!0,e.consume(t),c):a(t)}function l(t){return e.consume(t),i=!0,c}function a(s){return o&&i&&Me(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:In},An={};let _n=48;for(;_n<123;)An[_n]=xn,_n++,58===_n?_n=65:91===_n&&(_n=97);function Sn(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||ze(e)}function Pn(e){return!Me(e)}function In(e){return!(47===e||On(e))}function On(e){return 43===e||45===e||46===e||95===e||Ne(e)}function Ln(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Rn(e){return null===e||ze(e)||qe(e)?1:We(e)?2:void 0}function En(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}function Tn(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){return Ve(r)?(e.enter(n),s(r)):t(r)};function s(r){return Ve(r)&&o++<i?(e.consume(r),s):(e.exit(n),t(r))}}An[43]=xn,An[45]=xn,An[46]=xn,An[95]=xn,An[72]=[xn,Cn],An[104]=[xn,Cn],An[87]=[xn,wn],An[119]=[xn,wn];const jn={tokenize:function(e,t,n){return function(t){return Ve(t)?Tn(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||$e(e)?t(e):n(e)}},partial:!0},Dn={tokenize:function(e,t,n){const r=this;return Tn(e,function(e){const i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function Bn(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const e=r.events[i][1];if("labelImage"===e.type){s=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!s||!s._balanced)return n(i);const c=ft(r.sliceSerialize({start:s.end,end:r.now()}));return 94===c.codePointAt(0)&&o.includes(c.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)):n(i)}}function Fn(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function Mn(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),c};function c(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(c){if(s>999||93===c&&!o||null===c||91===c||ze(c))return n(c);if(93===c){e.exit("chunkString");const o=e.exit("gfmFootnoteCallString");return i.includes(ft(r.sliceSerialize(o)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return ze(c)||(o=!0),s++,e.consume(c),92===c?a:l}function a(t){return 91===t||92===t||93===t?(e.consume(t),s++,l):l(t)}}function Nn(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s,c=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",a):n(t)}function a(t){if(c>999||93===t&&!s||null===t||91===t||ze(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return o=ft(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return ze(t)||(s=!0),c++,e.consume(t),92===t?u:a}function u(t){return 91===t||92===t||93===t?(e.consume(t),c++,a):a(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i.includes(o)||i.push(o),Tn(e,f,"gfmFootnoteDefinitionWhitespace")):n(t)}function f(e){return t(e)}}function $n(e,t,n){return e.check(jn,t,e.attempt(Dn,t,n))}function zn(e){e.exit("gfmFootnoteDefinition")}function Vn(e){let t=(e||{}).singleTilde;const n={tokenize:function(e,n,r){const i=this.previous,o=this.events;let s=0;return function(t){return 126===i&&"characterEscape"!==o[o.length-1][1].type?r(t):(e.enter("strikethroughSequenceTemporary"),c(t))};function c(o){const l=Rn(i);if(126===o)return s>1?r(o):(e.consume(o),s++,c);if(s<2&&!t)return r(o);const a=e.exit("strikethroughSequenceTemporary"),u=Rn(o);return a._open=!u||2===u&&Boolean(l),a._close=!l||2===l&&Boolean(u),n(o)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],c=t.parser.constructs.insideSpan.null;c&&fn(s,s.length,0,En(c,e.slice(r+1,n),t)),fn(s,s.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),fn(e,r-1,n-r+3,s),n=r+s.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class Wn{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t)return e.map[i][1]+=n,void e.map[i][2].push(...r);i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push([...e]),e.length=0;let r=n.pop();for(;r;)e.push(...r),r=n.pop();this.map.length=0}}function qn(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}function Un(e,t,n){const r=this;let i,o=0,s=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const i=t>-1?r.events[t][1].type:null,o="tableHead"===i||"tableRow"===i?y:c;return o===y&&r.parser.lazy[r.now().line]?n(e):o(e)};function c(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){return 124===e||(i=!0,s+=1),l(e)}(t)}function l(t){return null===t?n(t):$e(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):Ve(t)?Tn(e,l,"whitespace")(t):(s+=1,i&&(i=!1,o+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,l):(e.enter("data"),a(t)))}function a(t){return null===t||124===t||ze(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:a)}function u(t){return 92===t||124===t?(e.consume(t),a):a(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),i=!1,Ve(t)?Tn(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):f(t))}function f(t){return 45===t||58===t?p(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),h):k(t)}function h(t){return Ve(t)?Tn(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(s+=1,m(t)):null===t||$e(t)?b(t):k(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),v(t)):k(t)}function v(t){return 45===t?(e.consume(t),v):58===t?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(t))}function g(t){return Ve(t)?Tn(e,b,"whitespace")(t):b(t)}function b(n){return 124===n?f(n):(null===n||$e(n))&&i&&o===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):k(n)}function k(e){return n(e)}function y(t){return e.enter("tableRow"),w(t)}function w(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),w):null===n||$e(n)?(e.exit("tableRow"),t(n)):Ve(n)?Tn(e,w,"whitespace")(n):(e.enter("data"),C(n))}function C(t){return null===t||124===t||ze(t)?(e.exit("data"),w(t)):(e.consume(t),92===t?x:C)}function x(t){return 92===t||124===t?(e.consume(t),C):C(t)}}function Hn(e,t){let n,r,i,o=-1,s=!0,c=0,l=[0,0,0,0],a=[0,0,0,0],u=!1,d=0;const f=new Wn;for(;++o<e.length;){const h=e[o],p=h[1];"enter"===h[0]?"tableHead"===p.type?(u=!1,0!==d&&(Qn(f,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(o,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(s=!0,i=void 0,l=[0,0,0,0],a=[0,o+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(o,0,[["enter",r,t]])),c="tableDelimiterRow"===p.type?2:r?3:1):!c||"data"!==p.type&&"tableDelimiterMarker"!==p.type&&"tableDelimiterFiller"!==p.type?"tableCellDivider"===p.type&&(s?s=!1:(0!==l[1]&&(a[0]=a[1],i=Gn(f,t,l,c,void 0,i)),l=a,a=[l[1],o,0,0])):(s=!1,0===a[2]&&(0!==l[1]&&(a[0]=a[1],i=Gn(f,t,l,c,void 0,i),l=[0,0,0,0]),a[2]=o)):"tableHead"===p.type?(u=!0,d=o):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=o,0!==l[1]?(a[0]=a[1],i=Gn(f,t,l,c,o,i)):0!==a[1]&&(i=Gn(f,t,a,c,o,i)),c=0):!c||"data"!==p.type&&"tableDelimiterMarker"!==p.type&&"tableDelimiterFiller"!==p.type||(a[3]=o)}for(0!==d&&Qn(f,t,d,n,r),f.consume(t.events),o=-1;++o<t.events.length;){const e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=qn(t.events,o))}return e}function Gn(e,t,n,r,i,o){const s=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(o.end=Object.assign({},Yn(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=Yn(t.events,n[1]);if(o={type:s,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){const i=Yn(t.events,n[2]),o=Yn(t.events,n[3]),s={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){const r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==i&&(o.end=Object.assign({},Yn(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Qn(e,t,n,r,i){const o=[],s=Yn(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function Yn(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const Kn={tokenize:function(e,t,n){const r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return ze(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return $e(r)?t(r):Ve(r)?e.check({tokenize:Zn},t,n)(r):n(r)}}};function Zn(e,t,n){return Tn(e,function(e){return null===e?n(e):t(e)},"whitespace")}const Jn={};function Xn(e){const t=e||Jn,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return function(e){const t={};let n=-1;for(;++n<e.length;)pn(t,e[n]);return t}([{text:An},{document:{91:{tokenize:Nn,continuation:{tokenize:$n},exit:zn}},text:{91:{tokenize:Mn},93:{add:"after",tokenize:Bn,resolveTo:Fn}}},Vn(e),{flow:{null:{tokenize:Un,resolveAll:Hn}}},{text:{91:Kn}}])}(t)),i.push([{transforms:[lt],enter:{literalAutolink:nt,literalAutolinkEmail:rt,literalAutolinkHttp:rt,literalAutolinkWww:rt},exit:{literalAutolink:ct,literalAutolinkEmail:st,literalAutolinkHttp:it,literalAutolinkWww:ot}},{enter:{gfmFootnoteDefinition:ht,gfmFootnoteDefinitionLabelString:pt,gfmFootnoteCall:gt,gfmFootnoteCallString:bt},exit:{gfmFootnoteDefinition:vt,gfmFootnoteDefinitionLabelString:mt,gfmFootnoteCall:yt,gfmFootnoteCallString:kt}},{canContainEols:["delete"],enter:{strikethrough:_t},exit:{strikethrough:St}},{enter:{table:en,tableData:on,tableHeader:on,tableRow:nn},exit:{codeText:sn,table:tn,tableData:rn,tableHeader:rn,tableRow:rn}},{exit:{taskListCheckValueChecked:an,taskListCheckValueUnchecked:an,paragraph:un}}]),o.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:et,notInConstruct:tt},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:et,notInConstruct:tt},{character:":",before:"[ps]",after:"\\/",inConstruct:et,notInConstruct:tt}]},{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:Ct,footnoteReference:wt}},{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:At}],handlers:{delete:Pt}},ln(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:dn}}]}}(t))}const er=(0,i.pM)({__name:"NcRichTextCopyButton",props:{contentId:null},setup(e){const t=e,{copy:n,icon:r,altText:i}=(0,Ie.u)(()=>document.getElementById(t.contentId).textContent);return{__sfc:!0,props:t,copy:n,icon:r,altText:i,NcButton:j.N,NcIconSvgWrapper:Pe.N}}});var tr=function(){var e=this,t=e._self._c,n=e._self._setupProxy;return t(n.NcButton,{attrs:{variant:"tertiary",size:"small","aria-label":n.altText,title:n.altText},on:{click:n.copy},scopedSlots:e._u([{key:"icon",fn:function(){return[t(n.NcIconSvgWrapper,{attrs:{path:n.icon,inline:""}})]},proxy:!0}])})},nr=[];const rr=(0,P.n)(er,tr,nr,!1,null,null).exports;function ir(){return function(e){(0,Re.YR)(e,e=>"text"===e.type,function(e,t,n){const r=e.value.split(/(\{[a-z\-_.0-9]+\})/gi).map(e=>{const t=e.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!t)return(0,Le.u)("text",e);const[,n]=t;return(0,Le.u)("element",{tagName:`#${n}`})});n.children.splice(t,1,...r)})}}function or(){return function(e){(0,Re.YR)(e,e=>["text","code","inlineCode"].includes(e.type),(e,t,n)=>(n.children.splice(t,1,{...e,value:e.value.replace(/</gim,"<").replace(/>/gim,">")}),[Ee._Z,t+1]))}}const sr=["http","https","mailto","tel"],cr=(0,i.KR)(null),lr={name:"NcRichText",components:{NcReferenceList:Be},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:["interact-todo","interact:todo"],data:()=>({parentId:(0,Oe.G)(5)}),methods:{renderPlaintext(e){const t=this.text.split(/(\{[a-z\-_.0-9]+\})/gi).map(t=>{const n=t.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!n)return function({h:e,context:t},n){return t.autolink&&(n=(0,D.p)(n)),Array.isArray(n)?n.map(t=>{if("string"==typeof t)return t;const{component:n,props:r}=t,i="NcLink"===n.name?void 0:"rich-text--component";return e(n,{props:r,class:i})}):n}({h:e,context:this},t);const r=n[1],i=this.arguments[r];if("object"==typeof i){const{component:t,props:n}=i;return e(t,{props:n,class:"rich-text--component"})}return i?e("span",{class:"rich-text--fallback"},i):t});return e("div",{class:"rich-text--wrapper"},[e("div",{},t.flat()),this.referenceLimit>0?e("div",{class:"rich-text--reference-widget"},[e(Be,{props:{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn}})]):null])},renderMarkdown(e){const t=(0,d.l)().use(l.A).use(D.r,{autolink:this.autolink,useMarkdown:this.useMarkdown,useExtendedMarkdown:this.useExtendedMarkdown}).use(or).use(this.useExtendedMarkdown?Xn:void 0).use(c.A).use(u.A,{except:sr}).use(a.A,{handlers:{component:(e,t)=>e(t,t.component,{value:t.value})}}).use(this.useExtendedMarkdown?cr.value:void 0).use(ir).use(o.A,{target:"_blank",rel:["noopener noreferrer"]}).use(s.A,{createElement:(t,r,i)=>{if(!t.startsWith("#")){if(["h1","h2","h3","h4","h5","h6"].includes(t)&&(t=`h${Math.min(+String(t)[1]+3,6)}`),this.useExtendedMarkdown){if("code"===t&&!cr.value&&r?.attrs?.class?.includes("language")&&async function(){const e=await n.e(5862).then(n.bind(n,75862));cr.value=e.default}(),"pre"===t&&Array.isArray(i)&&"code"===i[0].tag){const n=this.parentId+"-code-block-"+(0,Oe.G)(5);return e("p",{class:"rich-text__code-block"},[e(t,{attrs:{...r,id:n}},i),e(rr,{props:{contentId:n},class:"rich-text__code-block-button"})])}let o=null;if("li"===t&&Array.isArray(i)&&"input"===i[0].tag&&"checkbox"===i[0].data.attrs.type){const[n,...s]=i,c=s.findIndex(e=>["ul","ol","li","blockquote","pre"].includes(e.tag));-1!==c&&(o=s[c],s.splice(c));const l=this.parentId+"-markdown-input-"+(0,Oe.G)(5),a=e(h.N,{attrs:{...n.data.attrs,id:l,disabled:!this.interactive},on:{"update:checked":()=>{this.$emit("interact-todo",l),this.$emit("interact:todo",l)}}},s);return e(t,r,[a,o])}}if("a"===t){const t=(0,D.g)(this.$router,r.attrs.href);if(t)return delete r.attrs.href,delete r.attrs.target,e(f.Wk,{...r,props:{to:t}},i)}return e(t,r,i)}const o=this.arguments[t.slice(1)];return o?o.component?e(o.component,{attrs:r,props:o.props,class:"rich-text--component"},i):e("span",r,[o]):e("span",{attrs:r,class:"rich-text--fallback"},[`{${t.slice(1)}}`])},prefix:!1}).processSync(this.text.replace(/<[^>]+>/g,e=>e.replace(/</g,"<")).replace(/>/gim,">")).result;return e("div",{class:"rich-text--wrapper rich-text--wrapper-markdown"},[t,this.referenceLimit>0?e("div",{class:"rich-text--reference-widget"},[e(Be,{props:{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn}})]):null])}},render(e){return this.useMarkdown||this.useExtendedMarkdown?this.renderMarkdown(e):this.renderPlaintext(e)}};(0,P.n)(lr,null,null,!1,null,"bbc291bc").exports;var ar=n(85168),ur=n(87485);function dr(e){const t=(0,v.$_)(),{globalscale:n}=(0,ur.F)();return n?.token?(0,v.Jv)("/gf/{token}/{fileid}",{token:n.token,fileid:e},{baseURL:t}):(0,v.Jv)("/f/{fileid}",{fileid:e},{baseURL:t})}const fr=(0,n(35947).YK)().setApp("files").detectUser().build(),hr=(0,i.pM)({__name:"FileReferencePickerElement",props:{providerId:null,accessible:{type:Boolean}},emits:["submit","cancel"],setup(e,{emit:t}){const n=`filepicker-${Math.random().toString(36).slice(7)}`,o=new ar.CO((0,r.t)("files","Select file or folder to link to")).allowDirectories(!0).setButtonFactory(s).setContainer(`#${n}`).setMultiSelect(!1).build();function s(e){const t=[],n=e[0];return void 0===n||"/"===n.path?[]:(t.push({label:(0,r.t)("files","Choose {file}",{file:n.displayname}),variant:"primary",callback:()=>{}}),t)}function c(e){t("submit",dr(e.fileid))}return(0,i.sV)(async()=>{try{const[e]=await o.pickNodes();c(e)}catch(e){fr.debug("Aborted picking nodes:",{error:e}),t("cancel")}}),{__sfc:!0,emit:t,containerId:n,filePicker:o,buttonFactory:s,onSubmit:c}}});var pr=n(14486);const mr=(0,pr.A)(hr,function(){return(0,this._self._c)("div",{attrs:{id:this._self._setupProxy.containerId}})},[],!1,null,null,null).exports;var vr=n(43627),gr=n.n(vr),br=n(60557),kr=n(25866);const yr=(0,i.pM)({name:"ReferenceFileWidget",components:{FolderIcon:kr.A,FileIcon:br.A},props:{richObject:{type:Object,required:!0},accessible:{type:Boolean,default:!0},interactive:{type:Boolean,default:!0}},data:()=>({previewUrl:null,failedViewer:!1}),computed:{availableViewerHandlers:()=>window?.OCA?.Viewer?.availableHandlers||[],viewerHandler(){return this.availableViewerHandlers.find(e=>e.mimes.includes(this.richObject.mimetype))},viewerFile(){const e=(0,v.dC)(`dav/files/${(0,p.HW)()?.uid}/${this.richObject.path}`).replace(/\/\/$/,"/");return{filename:this.richObject.path,basename:this.richObject.name,lastmod:new Date(1e3*this.richObject.mtime),size:this.richObject.size,type:"file",mime:this.richObject.mimetype,fileid:this.richObject.id,failed:!1,loaded:!0,davPath:e,source:e}},fileSize(){return window.OC.Util.humanFileSize(this.richObject.size)},fileMtime(){return window.OC.Util.relativeModifiedDate(1e3*this.richObject.mtime)},filePath(){return gr().dirname(this.richObject.path)},filePreviewStyle(){return this.previewUrl?{backgroundImage:"url("+this.previewUrl+")"}:{}},filePreviewClass(){return this.previewUrl?"widget-file__image--preview":"widget-file__image--icon"},isFolder(){return"httpd/unix-directory"===this.richObject.mimetype}},mounted(){if(this.richObject["preview-available"]){const e=(0,v.Jv)("/core/preview?fileId={fileId}&x=250&y=250",{fileId:this.richObject.id}),t=new Image;t.onload=()=>{this.previewUrl=e},t.onerror=e=>{fr.error("could not load recommendation preview",{error:e})},t.src=e}},methods:{navigate(e){this.isFolder?(e.stopPropagation(),e.preventDefault(),this.openFilePicker()):-1===window?.OCA?.Viewer?.mimetypes.indexOf(this.richObject.mimetype)||window?.OCA?.Viewer?.file||(e.stopPropagation(),e.preventDefault(),window?.OCA?.Viewer?.open({path:this.richObject.path}))},openFilePicker(){(0,ar.a1)((0,r.t)("settings","Your files")).allowDirectories(!0).setMultiSelect(!1).addButton({id:"open",label:this.t("settings","Open in files"),callback([e]){e&&window.open(dr(e.fileid))},variant:"primary"}).disableNavigation().startAt(this.richObject.path).build().pick()}}});var wr=n(85072),Cr=n.n(wr),xr=n(97825),Ar=n.n(xr),_r=n(77659),Sr=n.n(_r),Pr=n(55056),Ir=n.n(Pr),Or=n(10540),Lr=n.n(Or),Rr=n(41113),Er=n.n(Rr),Tr=n(63063),jr={};jr.styleTagTransform=Er(),jr.setAttributes=Ir(),jr.insert=Sr().bind(null,"head"),jr.domAPI=Ar(),jr.insertStyleElement=Lr(),Cr()(Tr.A,jr),Tr.A&&Tr.A.locals&&Tr.A.locals;const Dr=(0,pr.A)(yr,function(){var e=this,t=e._self._c;return e._self._setupProxy,e.accessible?e.interactive&&e.viewerHandler&&!e.failedViewer?t(e.viewerHandler.component,e._b({tag:"component",staticClass:"widget-file widget-file--interactive",attrs:{active:!1,"can-swipe":!1,"can-zoom":!1,"is-embedded":!0,"file-list":[e.viewerFile],"is-full-screen":!1,"is-sidebar-shown":!1},on:{error:function(t){e.failedViewer=!0}}},"component",e.viewerFile,!1)):t("a",{staticClass:"widget-file widget-file--link",attrs:{href:e.richObject.link,target:"_blank"},on:{click:e.navigate}},[t("span",{staticClass:"widget-file__image",class:e.filePreviewClass,style:e.filePreviewStyle},[e.previewUrl?e._e():[e.isFolder?t("FolderIcon",{attrs:{size:88,"fill-color":"var(--color-primary-element)"}}):t("FileIcon",{attrs:{size:88}})]],2),e._v(" "),t("span",{staticClass:"widget-file__details"},[t("p",{staticClass:"widget-file__title"},[e._v(e._s(e.richObject.name))]),e._v(" "),t("p",{staticClass:"widget-file__description"},[e._v(e._s(e.fileSize)),t("br"),e._v(e._s(e.fileMtime))]),e._v(" "),t("p",{staticClass:"widget-file__link"},[e._v(e._s(e.filePath))])])]):t("div",{staticClass:"widget-file widget-file--no-access"},[t("span",{staticClass:"widget-file__image widget-file__image--icon"},[e.isFolder?t("FolderIcon",{attrs:{size:88}}):t("FileIcon",{attrs:{size:88}})],1),e._v(" "),t("span",{staticClass:"widget-file__details"},[t("p",{staticClass:"widget-file__title"},[e._v("\n\t\t\t"+e._s(e.t("files","File cannot be accessed"))+"\n\t\t")]),e._v(" "),t("p",{staticClass:"widget-file__description"},[e._v("\n\t\t\t"+e._s(e.t("files","The file could not be found or you do not have permissions to view it. Ask the sender to share it."))+"\n\t\t")])])])},[],!1,null,"613fea0c",null).exports;i.Ay.mixin({methods:{t:r.t}}),C("file",(e,{richObjectType:t,richObject:n,accessible:r,interactive:o})=>{new(i.Ay.extend(Dr))({propsData:{richObjectType:t,richObject:n,accessible:r,interactive:o}}).$mount(e)},()=>{},{hasInteractiveView:!0}),S("files",(e,{providerId:t,accessible:n})=>{const r=new(i.Ay.extend(mr))({propsData:{providerId:t,accessible:n}}).$mount(e);return new A(r.$el,r)},(e,t)=>{t.object.$destroy()})}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={id:e,loaded:!1,exports:{}};return r[e].call(n.exports,n,n.exports,o),n.loaded=!0,n.exports}o.m=r,e=[],o.O=(t,n,r,i)=>{if(!n){var s=1/0;for(u=0;u<e.length;u++){for(var[n,r,i]=e[u],c=!0,l=0;l<n.length;l++)(!1&i||s>=i)&&Object.keys(o.O).every(e=>o.O[e](n[l]))?n.splice(l--,1):(c=!1,i<s&&(s=i));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,r,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,n)=>(o.f[n](e,t),t),[])),o.u=e=>e+"-"+e+".js?v="+{594:"2c86902dfae9a5006399",620:"1faa6454ab9a6286ffeb",2391:"908fc68e4bc9b878c937",2880:"96ff2de012f3b8c1e3a4",4325:"11e9d860db6a9bc25aac",5862:"d020c05f13d21afee82a",7145:"d9c518ca34bfdbd7ff70",8339:"6cdca71a6b3b2d7bef33"}[e],o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="nextcloud-ui-legacy:",o.l=(e,r,i,s)=>{if(t[e])t[e].push(r);else{var c,l;if(void 0!==i)for(var a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var d=a[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==n+i){c=d;break}}c||(l=!0,(c=document.createElement("script")).charset="utf-8",o.nc&&c.setAttribute("nonce",o.nc),c.setAttribute("data-webpack",n+i),c.src=e),t[e]=[r];var f=(n,r)=>{c.onerror=c.onload=null,clearTimeout(h);var i=t[e];if(delete t[e],c.parentNode&&c.parentNode.removeChild(c),i&&i.forEach(e=>e(r)),n)return n(r)},h=setTimeout(f.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),l&&document.head.appendChild(c)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o.j=54,(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var t=globalThis.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={54:0};o.f.j=(t,n)=>{var r=o.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise((n,i)=>r=e[t]=[n,i]);n.push(r[2]=i);var s=o.p+o.u(t),c=new Error;o.l(s,n=>{if(o.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;c.message="Loading chunk "+t+" failed.\n("+i+": "+s+")",c.name="ChunkLoadError",c.type=i,c.request=s,r[1](c)}},"chunk-"+t,t)}},o.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[s,c,l]=n,a=0;if(s.some(t=>0!==e[t])){for(r in c)o.o(c,r)&&(o.m[r]=c[r]);if(l)var u=l(o)}for(t&&t(n);a<s.length;a++)i=s[a],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(u)},n=globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),o.nc=void 0;var s=o.O(void 0,[4208],()=>o(99348));s=o.O(s)})();
|
|
//# sourceMappingURL=files-reference-files.js.map?v=22f17fadd45bc540cae7
|