@sveltia/cms 0.157.0 → 0.157.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -107,7 +107,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
107
107
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
108
108
  `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(ky(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Ny(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ky(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(jy(t.key)&&!ky(t.sep,`newline`)){let e=Ny(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):ky(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!ky(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||ky(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=Ny(My(t));Py(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
109
109
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
110
- `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=Ny(My(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=Ny(My(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}}));function ine(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Dy||null,prettyErrors:t}}function ane(e,t={}){let{lineCounter:n,prettyErrors:r}=ine(t),i=new Fy(n?.addNewLine),a=new dy(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new Lv(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(zv(e,n)),o.warnings.forEach(zv(e,n))),o}function Ly(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=ane(e,n);if(!i)return null;if(i.warnings.forEach(e=>s_(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Ry(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return Yh(e)&&!r?e.toString(n):new Pv(e,r,n).toString(n)}var one=o((()=>{fy(),Fv(),Bv(),c_(),tg(),Oy(),Iy()})),zy=o((()=>{fy(),Fv(),Ete(),Bv(),kg(),tg(),y_(),Mg(),T_(),A_(),vy(),Ey(),Oy(),Iy(),one(),fg()})),By=o((()=>{zy(),zy()})),Vy,Hy,Uy,Wy,Gy,Ky,qy,Jy,Yy=o((()=>{Zf(),$b(),Vy=rn(!1),Hy=rn(),Uy=rn([]),Wy=rn([]),Gy=rn([]),Ky={source:void 0,fileMap:new Map,regexFolders:[]},qy=()=>{let e=A(Uy);if(e===Ky.source)return Ky;let t=new Map,n=[];return e.forEach(e=>{e.filePathMap?[...new Set(Object.values(e.filePathMap))].forEach(n=>{let r=t.get(n);r?r.push(e):t.set(n,[e])}):n.push([e,Xb(e.collectionName)?._file?.fullPathRegEx])}),Ky.source=e,Ky.fileMap=t,Ky.regexFolders=n,Ky},Jy=e=>{let{fileMap:t,regexFolders:n}=qy();return[...t.get(e)??[],...n.filter(([,t])=>t?.test(e)).map(([e])=>e)].sort((e,t)=>(t.folderPath??``).localeCompare(e.folderPath??``))}})),Xy,Zy,Qy,$y,eb,tb,nb,rb=o((()=>{Zf(),VP(),Yy(),$b(),Xy=e=>!(`divider`in e)&&typeof e.file==`string`&&Array.isArray(e.fields),Zy=e=>e.filter(e=>Xy(e)),Qy=(e,t)=>{let n=typeof e==`string`?Xb(e):e;if(!(!n||!(`_fileMap`in n)))return n._fileMap[t]},$y=e=>e.label||e.name,eb=(e,t)=>`_fileMap`in e?Object.values(e._fileMap).filter(({_file:e,_i18n:n})=>e.fullPath===t.locales[n.defaultLocale]?.path):[],tb=(e,t)=>{let n=A(Uy).find(({collectionName:n,fileName:r})=>n===e&&r===t);if(!n?.filePathMap)return;let r=new Set(Object.values(n.filePathMap));return A(Wy).find(e=>Object.values(e.locales).some(({path:e})=>r.has(e)))},nb=(e,t)=>{if(e&&t){let{collections:n,singletons:r}=A(IP);if(e===`_singletons`)return Array.isArray(r)?Zy(r).findIndex(e=>e.name===t):-1;let i=Wb({collections:n}).find(({name:t})=>t===e);if(i&&`files`in i)return i.files.findIndex(({name:e})=>e===t)}return-1}})),ib,ab,ob,sb=o((()=>{ib={slug_length:!1,yaml_quote:!1,uuid_read_only:!1,save_all_locales:!1,automatic_deployments:!1,multiple_folders_i18n_root:!1,omit_default_locale_from_filename:!1},ab={slug_length:"The `slug_length` collection option is deprecated and will be removed in Sveltia CMS 1.0. Use the global `slug.maxlength` option instead. ",yaml_quote:"The `yaml_quote` collection option is deprecated and will be removed in Sveltia CMS 1.0. Use the global `output.yaml.quote` option instead. `yaml_quote: true` is equivalent to `quote: double`. https://sveltiacms.app/en/docs/data-output#controlling-data-output",uuid_read_only:"The `read_only` option for the UUID field type is deprecated and will be removed in Sveltia CMS 1.0. Use the `readonly` option instead.",save_all_locales:"The `save_all_locales` i18n option is deprecated and will be removed in Sveltia CMS 1.0. Use the `initial_locales` option instead. `save_all_locales: false` is equivalent to `initial_locales: all`. https://sveltiacms.app/en/docs/i18n#disabling-non-default-locale-content",automatic_deployments:"The `automatic_deployments` backend option is deprecated and will be removed in Sveltia CMS 1.0. Use the `skip_ci` option instead. `automatic_deployments: false` is equivalent to `skip_ci: true`, and `automatic_deployments: true` is equivalent to `skip_ci: false`. https://sveltiacms.app/en/docs/deployments#disabling-automatic-deployments",multiple_folders_i18n_root:"The `multiple_folders_i18n_root` i18n structure is deprecated and will be removed in Sveltia CMS 1.0. Use the `multiple_root_folders` structure instead. https://sveltiacms.app/en/docs/i18n#multiple-root-folders",omit_default_locale_from_filename:"The `omit_default_locale_from_filename` i18n option is deprecated and will be removed in Sveltia CMS 1.0. Use the `omit_default_locale_from_file_path` option instead. https://sveltiacms.app/en/docs/i18n#managing-content-structure"},ob=(e,t)=>{ib[e]||(console.warn(t??ab[e]),ib[e]=!0)}})),cb,lb,ub=o((()=>{Z(),$b(),cb=e=>{if(!Bb(e))return;let{index_file:t}=e;if(!t)return;let n=t===!0?{}:t;return{name:n.name??`_index`,label:n.label??X(`index_file`),icon:n.icon??`home`,fields:n.fields,editor:n.editor}},lb=(e,t)=>{let n=cb(e);return n?t.slug===n.name:!1}})),db,fb,pb,mb,hb,gb,_b=o((()=>{Z(),db=e=>{let t;if(e!==`_default`)try{[t]=Intl.getCanonicalLocales(e)}catch{}return t},fb=new Map,pb=(e,{displayLocale:t=db(Lh.current??`en`)}={})=>{let n=db(e);if(!n)return;let r;t?(r=fb.get(t),r||(r=new Intl.DisplayNames(t,{type:`language`}),fb.set(t,r))):r=new Intl.DisplayNames(void 0,{type:`language`});try{return r.of(n)}catch(e){console.error(e);return}},mb=new Map,hb=(e,t={})=>{let n={style:`narrow`,type:`conjunction`,...t},r=`${e}|${n.style}|${n.type}`,i=mb.get(r);return i||(i=new Intl.ListFormat(db(e),n),mb.set(r,i)),i},gb=({_i18n:e,locale:t,path:n})=>{let{defaultLocale:r,omitDefaultLocaleFromFilePath:i}=e;return i&&t===r&&(n=n.replace(/{{locale}}[./]/,``)),n.replaceAll(`{{locale}}`,t)}})),vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb=o((()=>{kp(),gp(),sb(),$b(),ub(),_b(),vb=/\\\{\\\{.+?\\\}\\\}/g,yb=new Map,bb=({extension:e,format:t})=>(t?yb.get(t)?.extension:void 0)||e||(t===`raw`?`txt`:t===`yaml`||t===`yml`?`yml`:t===`toml`?`toml`:t===`json`?`json`:`md`),xb=({extension:e,format:t})=>t||(e===`yaml`||e===`yml`?`yaml`:e===`toml`?`toml`:e===`json`?`json`:[`md`,`mkd`,`mkdn`,`mdwn`,`mdown`,`markdown`].includes(e)?`frontmatter`:`yaml-frontmatter`),Sb=(e,t)=>e?`(?<subPath>${up(e).replace(vb,`[^/]+?`)}${t?`|${t}`:``})`:`(?<subPath>[^/]+?)`,Cb=({extension:e,format:t,basePath:n,subPath:r,indexFileName:i,_i18n:a})=>{let{allLocales:o,defaultLocale:s,omitDefaultLocaleFromFilePath:c,structureMap:{i18nMultiFile:l,i18nMultiFolder:u,i18nMultiRootFolder:d}}=a,f=`(?<locale>${o.join(`|`)})`,p=o.filter(e=>e!==s).join(`|`),m=c?`(?:(?<locale>${p})\\/)?`:`${f}\\/`,h=c?`(?:\\.(?<locale>${p}))?`:`\\.${f}`,g=[`^`,d?m:``,n?`${up(n)}\\/`:``,u?m:``,Sb(r,i),l?h:``,`\\.`,bb({format:t,extension:e}),`$`].join(``);return new RegExp(g)},wb=({format:e,delimiter:t})=>{if(typeof t==`string`&&t.trim())return[t,t];if(Array.isArray(t)&&t.length===2)return t;if(e===`json-frontmatter`)return[`{`,`}`];if(e===`toml-frontmatter`)return[`+++`,`+++`];if(e===`yaml-frontmatter`)return[`---`,`---`]},Tb=({rawCollection:e,file:t,_i18n:n})=>{let{folder:r,path:i,extension:a,format:o,frontmatter_delimiter:s,yaml_quote:c}=e,l=Bb(e),u=t?.file?fp(t.file):void 0,d=u?xp(u).extension:a,f=t?.format??o,p=bb({format:f,extension:d}),m=xb({format:f,extension:p}),h=t?.frontmatter_delimiter??s,g=l?fp(r):void 0,_=l?cb(e)?.name:void 0;return c!==void 0&&ob(`yaml_quote`),{extension:p,format:m,basePath:g,subPath:l?i:void 0,fullPathRegEx:g===void 0?void 0:Cb({extension:p,format:m,basePath:g,subPath:i,indexFileName:_,_i18n:n}),fullPath:u?gb({_i18n:n,locale:n.defaultLocale,path:u}):void 0,fmDelimiters:wb({format:m,delimiter:h}),yamlQuote:!!c}}})),Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb=o((()=>{f(),Zf(),VP(),sb(),$b(),Db={SINGLE_FILE:`single_file`,SINGLE_FILE_FLAT_DEFAULT:`single_file_flat_default`,MULTIPLE_FILES:`multiple_files`,MULTIPLE_FOLDERS:`multiple_folders`,MULTIPLE_FOLDERS_I18N_ROOT:`multiple_folders_i18n_root`,MULTIPLE_ROOT_FOLDERS:`multiple_root_folders`},Ob=`_default`,kb={key:`translationKey`,value:`{{slug}}`},Ab={i18nEnabled:!1,saveAllLocales:!0,allLocales:[Ob],initialLocales:[Ob],defaultLocale:Ob,structure:Db.SINGLE_FILE,structureMap:{i18nSingleFile:!1,i18nSingleFileFlatDefault:!1,i18nMultiFile:!1,i18nMultiFolder:!1,i18nMultiRootFolder:!1},canonicalSlug:{...kb},omitDefaultLocaleFromFilePath:!1,omitDefaultLocaleFromPreviewPath:!1},jb=(e,t)=>{let n=A(IP);if(!u(n.i18n))return;let r=structuredClone(n.i18n);if(e.i18n||Hb(e)){if(u(e.i18n)&&Object.assign(r,e.i18n),t)if(t.i18n)u(t.i18n)&&Object.assign(r,t.i18n);else return}else return;return r},Mb=(e,t)=>t?t.file.includes(`{{locale}}`)?Db.MULTIPLE_FILES:e===Db.SINGLE_FILE_FLAT_DEFAULT?Db.SINGLE_FILE_FLAT_DEFAULT:Db.SINGLE_FILE:e,Nb=(e,t)=>({i18nSingleFile:e&&t===Db.SINGLE_FILE,i18nSingleFileFlatDefault:e&&t===Db.SINGLE_FILE_FLAT_DEFAULT,i18nMultiFile:e&&t===Db.MULTIPLE_FILES,i18nMultiFolder:e&&t===Db.MULTIPLE_FOLDERS,i18nMultiRootFolder:e&&(t===Db.MULTIPLE_FOLDERS_I18N_ROOT||t===Db.MULTIPLE_ROOT_FOLDERS)}),Pb=(e,t,n)=>e?n&&t.includes(n)?n:t[0]:Ob,Fb=(e,t,n)=>e===`all`?t:e===`default`?[n]:t.filter(t=>t===n||(Array.isArray(e)?e.includes(t):!0)),Ib=(e,t)=>{let n=jb(e,t),{structure:r=Db.SINGLE_FILE,locales:i=[],default_locale:a,initial_locales:o,save_all_locales:s=!0,canonical_slug:c={key:void 0,value:void 0},omit_default_locale_from_filename:l,omit_default_locale_from_file_path:u=l??!1,omit_default_locale_from_preview_path:d=!1}=n??{};n?.save_all_locales!==void 0&&ob(`save_all_locales`),l!==void 0&&ob(`omit_default_locale_from_filename`);let{key:f=kb.key,value:p=kb.value}=c,m=i.length>0,h=m?i:[Ob],g=Pb(m,h,a),_=Mb(r,t),v=Nb(m,_),y=m?s===!0&&o===void 0:!0,b=Fb(o,h,g),x=u&&(t?/{{locale}}[./]/.test(t.file):v.i18nMultiFile);return _===`multiple_folders_i18n_root`&&ob(`multiple_folders_i18n_root`),{i18nEnabled:m,saveAllLocales:y,allLocales:h,defaultLocale:g,initialLocales:b,structure:_,structureMap:v,canonicalSlug:{key:f,value:p},omitDefaultLocaleFromFilePath:x,omitDefaultLocaleFromPreviewPath:d}}})),Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b=o((()=>{Z(),gp(),Zf(),VP(),rb(),Eb(),Lb(),Rb=rn(),zb=new Map,Bb=e=>typeof e.folder==`string`&&!Array.isArray(e.files),Vb=e=>e.folder===void 0&&Array.isArray(e.files),Hb=e=>Vb(e)&&e.name===`_singletons`,Ub=(e,{visible:t=void 0,type:n=void 0}={})=>`divider`in e||t&&e.hide?!1:n===`entry`?Bb(e):n===`file`?Vb(e):n===`singleton`?Hb(e):Bb(e)||Vb(e),Wb=({collections:e=A(IP)?.collections??[],visible:t,type:n}={})=>e.filter(e=>Ub(e,{visible:t,type:n})),Gb=()=>Wb({visible:!0})[0],Kb=e=>{if(!(`folder`in e))return[];let{fields:t,thumbnail:n=!0}=e;return n===!1?[]:typeof n==`string`?[n]:Array.isArray(n)?n:t?.length?t.filter(({widget:e=`string`})=>[`image`,`file`].includes(e)).map(({name:e})=>e):[]},qb=(e,t)=>({...e,_i18n:t,_type:`entry`,_file:Tb({rawCollection:e,_i18n:t}),_thumbnailFieldNames:Kb(e)}),Jb=(e,t,n)=>({...e,_i18n:t,_type:Hb(e)?`singleton`:`file`,_fileMap:Object.fromEntries(n.filter(Xy).map(t=>{let n=Ib(e,t),r=Tb({rawCollection:e,file:t,_i18n:n});return[t.name,{...t,_file:r,_i18n:n}]}))}),Yb=()=>{let e=A(IP)?.singletons;if(!Array.isArray(e))return;let t=Zy(e).map(e=>({...e,file:fp(e.file)}));if(!t.length)return;let n={name:`_singletons`,files:t};return Jb(n,Ib(n),t)},Xb=e=>{let t=zb.get(e);if(t)return t;if(e===`_singletons`){let t=Yb();return zb.set(e,t),t}let n=Wb().find(t=>t.name===e);if(!n){zb.set(e,void 0);return}let r=Bb(n)?n:void 0,i=Vb(n)?n:void 0;if(!r&&!i){zb.set(e,void 0);return}r?r.folder=fp(r.folder):i?.files.forEach(e=>{e.file&&=fp(e.file)});let a=Ib(n),o=r?qb(r,a):Jb(i,a,i.files);return zb.set(e,o),o},Zb=(e,{useSingular:t=!1}={})=>{let{_type:n,name:r,label:i,label_singular:a}=e;return n===`singleton`?X(`files`):t&&a?a:i||r},Qb=e=>e?e===`_singletons`?9999999:A(IP)?.collections?.findIndex(({name:t})=>t===e)??-1:-1})),ex,tx,nx,rx,ix,ax,ox,sx,sne=o((()=>{kp(),gp(),$b(),rb(),ex=[],tx=e=>e.includes(`{{media_folder}}`)||e.includes(`{{public_folder}}`),nx=(e,{globalMediaFolder:t,globalPublicFolder:n})=>e.trim().replace(`{{media_folder}}`,`/${t}`).replace(`{{public_folder}}`,`/${n}`).replace(`//`,`/`),rx=({collectionName:e,fileName:t,typedKeyPath:n,isIndexFile:r=!1,mediaFolder:i,publicFolder:a,baseFolder:o,globalFolders:s})=>{if(tx(i)){if(!s)return;i=nx(i,s)}if(a===void 0)a=i;else if(tx(a)){if(!s)return;a=nx(a,s)}i=i.replace(/^\.(?:\/|$)/,``);let c=!i.startsWith(`/`);return{collectionName:e,fileName:t,typedKeyPath:n,isIndexFile:r,internalPath:fp(c?o??``:i),internalSubPath:c?fp(i):void 0,publicPath:/^($|[.@])/.test(a)?a:`/${fp(a)}`,entryRelative:c,hasTemplateTags:/{{.+?}}/.test(i)}},ix=e=>{if(e.mediaFolder===void 0)return;let t=rx(e);if(!t)return;let{globalMediaFolder:n,globalPublicFolder:r}=e.globalFolders??{};!t.entryRelative&&t.internalPath===n&&t.publicPath===r||ex.push(t)},ax=({collectionName:e,files:t,globalFolders:n})=>{Zy(t).forEach(t=>{let{name:r,file:i,media_folder:a,public_folder:o}=t;ix({collectionName:e,fileName:r,mediaFolder:a,publicFolder:o,baseFolder:xp(i).dirname,globalFolders:n})})},ox=({fieldMediaFolders:e,validCollections:t,globalFolders:n})=>{e.forEach(({fieldConfig:e,context:r})=>{let i=r.collection;(i.name===`_singletons`||t.some(e=>e.name===i.name))&&ix({collectionName:i.name,fileName:r.collectionFile?.name,mediaFolder:e.media_folder,publicFolder:e.public_folder,baseFolder:`folder`in i?i.folder:void 0,typedKeyPath:r.typedKeyPath,isIndexFile:r.isIndexFile,globalFolders:n})})},sx=(e,t=[])=>{ex.length=0;let{media_folder:n,public_folder:r,collections:i,singletons:a}=e,o=n!==void 0,s=o?fp(n).replace(/^\.$/,``):``,c=o?r?`/${fp(r)}`.replace(/^\/@/,`@`):`/${s}`:``,l={collectionName:void 0,internalPath:void 0,internalSubPath:void 0,publicPath:void 0,entryRelative:!1,hasTemplateTags:!1},u=o?{...l,internalPath:s,publicPath:c}:void 0,d=o?{globalMediaFolder:s,globalPublicFolder:c}:void 0,f=Wb({collections:i});f.forEach(e=>{let{name:t,files:n,folder:r,path:i,media_folder:a,public_folder:s}=e;ix({collectionName:t,mediaFolder:o&&a===void 0&&i!==void 0?``:a,publicFolder:s,baseFolder:r,entryPath:i,globalFolders:d}),n?.length&&ax({collectionName:t,files:n,globalFolders:d})}),a?.length&&ax({collectionName:`_singletons`,files:a,globalFolders:d}),ox({fieldMediaFolders:t,validCollections:f,globalFolders:d}),ex.sort((e,t)=>hp(e.internalPath,t.internalPath));let p=[];return u&&p.push(u),p.push(...ex),p.length&&p.unshift(l),p}})),cx,lx,ux,dx,fx,px,mx,cne=o((()=>{gp(),$b(),rb(),_b(),Lb(),cx=({collection:e,file:t})=>{let n=fp(t.file);if(!n.includes(`{{locale}}`))return{_default:n};let r=Ib(e,t);return Object.fromEntries(r.allLocales.map(e=>[e,gb({_i18n:r,locale:e,path:n})]))},lx=(e,t)=>{if(Xy(t))return{collectionName:e.name,fileName:t.name,filePathMap:cx({collection:e,file:t})}},ux=(e,t)=>hp(Object.values(e.filePathMap??{})[0],Object.values(t.filePathMap??{})[0]),dx=({collections:e})=>Wb({collections:e,type:`entry`}).map(e=>{let{name:t,folder:n}=e,r=fp(n),{allLocales:i,structureMap:{i18nMultiRootFolder:a}}=Ib(e);return{collectionName:t,folderPath:r,folderPathMap:Object.fromEntries(i.map(e=>[e,a?`${e}/${r}`:r]))}}).sort((e,t)=>hp(e.folderPath,t.folderPath)),fx=({collections:e})=>Wb({collections:e,type:`file`}).flatMap(e=>(e.files??[]).map(t=>lx(e,t))).filter(e=>!!e).sort(ux),px=({singletons:e})=>{let t=Array.isArray(e)?Zy(e):[];if(!t.length)return[];let n={name:`_singletons`,files:t};return t.map(e=>lx(n,e)).filter(e=>!!e).sort(ux)},mx=e=>[...dx(e),...fx(e),...px(e)]}));
110
+ `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=Ny(My(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=Ny(My(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}}));function ine(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Dy||null,prettyErrors:t}}function ane(e,t={}){let{lineCounter:n,prettyErrors:r}=ine(t),i=new Fy(n?.addNewLine),a=new dy(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new Lv(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(zv(e,n)),o.warnings.forEach(zv(e,n))),o}function Ly(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=ane(e,n);if(!i)return null;if(i.warnings.forEach(e=>s_(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Ry(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return Yh(e)&&!r?e.toString(n):new Pv(e,r,n).toString(n)}var one=o((()=>{fy(),Fv(),Bv(),c_(),tg(),Oy(),Iy()})),zy=o((()=>{fy(),Fv(),Ete(),Bv(),kg(),tg(),y_(),Mg(),T_(),A_(),vy(),Ey(),Oy(),Iy(),one(),fg()})),By=o((()=>{zy(),zy()})),Vy,Hy,Uy,Wy,Gy,Ky,qy,Jy,Yy=o((()=>{Zf(),$b(),Vy=rn(!1),Hy=rn(),Uy=rn([]),Wy=rn([]),Gy=rn([]),Ky={source:void 0,fileMap:new Map,regexFolders:[]},qy=()=>{let e=A(Uy);if(e===Ky.source)return Ky;let t=new Map,n=[];return e.forEach(e=>{e.filePathMap?[...new Set(Object.values(e.filePathMap))].forEach(n=>{let r=t.get(n);r?r.push(e):t.set(n,[e])}):n.push([e,Xb(e.collectionName)?._file?.fullPathRegEx])}),Ky.source=e,Ky.fileMap=t,Ky.regexFolders=n,Ky},Jy=e=>{let{fileMap:t,regexFolders:n}=qy();return[...t.get(e)??[],...n.filter(([,t])=>t?.test(e)).map(([e])=>e)].sort((e,t)=>(t.folderPath??``).localeCompare(e.folderPath??``))}})),Xy,Zy,Qy,$y,eb,tb,nb,rb=o((()=>{Zf(),VP(),Yy(),$b(),Xy=e=>!(`divider`in e)&&typeof e.file==`string`&&Array.isArray(e.fields),Zy=e=>e.filter(e=>Xy(e)),Qy=(e,t)=>{let n=typeof e==`string`?Xb(e):e;if(!(!n||!(`_fileMap`in n)))return n._fileMap[t]},$y=e=>e.label||e.name,eb=(e,t)=>`_fileMap`in e?Object.values(e._fileMap).filter(({_file:e,_i18n:n})=>e.fullPath===t.locales[n.defaultLocale]?.path):[],tb=(e,t)=>{let n=A(Uy).find(({collectionName:n,fileName:r})=>n===e&&r===t);if(!n?.filePathMap)return;let r=new Set(Object.values(n.filePathMap));return A(Wy).find(e=>Object.values(e.locales).some(({path:e})=>r.has(e)))},nb=(e,t)=>{if(e&&t){let{collections:n,singletons:r}=A(IP);if(e===`_singletons`)return Array.isArray(r)?Zy(r).findIndex(e=>e.name===t):-1;let i=Wb({collections:n}).find(({name:t})=>t===e);if(i&&`files`in i)return i.files.findIndex(({name:e})=>e===t)}return-1}})),ib,ab,ob,sb=o((()=>{ib={slug_length:!1,yaml_quote:!1,uuid_read_only:!1,save_all_locales:!1,automatic_deployments:!1,multiple_folders_i18n_root:!1,omit_default_locale_from_filename:!1},ab={slug_length:"The `slug_length` collection option is deprecated and will be removed in Sveltia CMS 1.0. Use the global `slug.maxlength` option instead. ",yaml_quote:"The `yaml_quote` collection option is deprecated and will be removed in Sveltia CMS 1.0. Use the global `output.yaml.quote` option instead. `yaml_quote: true` is equivalent to `quote: double`. https://sveltiacms.app/en/docs/data-output#controlling-data-output",uuid_read_only:"The `read_only` option for the UUID field type is deprecated and will be removed in Sveltia CMS 1.0. Use the `readonly` option instead.",save_all_locales:"The `save_all_locales` i18n option is deprecated and will be removed in Sveltia CMS 1.0. Use the `initial_locales` option instead. `save_all_locales: false` is equivalent to `initial_locales: all`. https://sveltiacms.app/en/docs/i18n#disabling-non-default-locale-content",automatic_deployments:"The `automatic_deployments` backend option is deprecated and will be removed in Sveltia CMS 1.0. Use the `skip_ci` option instead. `automatic_deployments: false` is equivalent to `skip_ci: true`, and `automatic_deployments: true` is equivalent to `skip_ci: false`. https://sveltiacms.app/en/docs/deployments#disabling-automatic-deployments",multiple_folders_i18n_root:"The `multiple_folders_i18n_root` i18n structure is deprecated and will be removed in Sveltia CMS 1.0. Use the `multiple_root_folders` structure instead. https://sveltiacms.app/en/docs/i18n#multiple-root-folders",omit_default_locale_from_filename:"The `omit_default_locale_from_filename` i18n option is deprecated and will be removed in Sveltia CMS 1.0. Use the `omit_default_locale_from_file_path` option instead. https://sveltiacms.app/en/docs/i18n#managing-content-structure"},ob=(e,t)=>{ib[e]||(console.warn(t??ab[e]),ib[e]=!0)}})),cb,lb,ub=o((()=>{Z(),$b(),cb=e=>{if(!Bb(e))return;let{index_file:t}=e;if(!t)return;let n=t===!0?{}:t;return{name:n.name??`_index`,label:n.label??X(`index_file`),icon:n.icon??`home`,fields:n.fields,editor:n.editor}},lb=(e,t)=>{let n=cb(e);return n?t.slug===n.name:!1}})),db,fb,pb,mb,hb,gb,_b=o((()=>{Z(),db=e=>{let t;if(e!==`_default`)try{[t]=Intl.getCanonicalLocales(e)}catch{}return t},fb=new Map,pb=(e,{displayLocale:t=db(Lh.current??`en`)}={})=>{let n=db(e);if(!n)return;let r;t?(r=fb.get(t),r||(r=new Intl.DisplayNames(t,{type:`language`}),fb.set(t,r))):r=new Intl.DisplayNames(void 0,{type:`language`});try{return r.of(n)}catch(e){console.error(e);return}},mb=new Map,hb=(e,t={})=>{let n={style:`narrow`,type:`conjunction`,...t},r=`${e}|${n.style}|${n.type}`,i=mb.get(r);return i||(i=new Intl.ListFormat(db(e),n),mb.set(r,i)),i},gb=({_i18n:e,locale:t,path:n})=>{let{defaultLocale:r,omitDefaultLocaleFromFilePath:i}=e;return i&&t===r&&(n=n.replace(/{{locale}}[./]/,``)),n.replaceAll(`{{locale}}`,t)}})),vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb=o((()=>{kp(),gp(),sb(),$b(),ub(),_b(),vb=/\\\{\\\{.+?\\\}\\\}/g,yb=new Map,bb=({extension:e,format:t})=>(t?yb.get(t)?.extension:void 0)||e||(t===`raw`?`txt`:t===`yaml`||t===`yml`?`yml`:t===`toml`?`toml`:t===`json`?`json`:`md`),xb=({extension:e,format:t})=>t||(e===`yaml`||e===`yml`?`yaml`:e===`toml`?`toml`:e===`json`?`json`:[`md`,`mkd`,`mkdn`,`mdwn`,`mdown`,`markdown`].includes(e)?`frontmatter`:`yaml-frontmatter`),Sb=(e,t)=>e?`(?<subPath>${up(e).replace(vb,`[^/]+?`)}${t?`|${t}`:``})`:`(?<subPath>[^/]+?)`,Cb=({extension:e,format:t,basePath:n,subPath:r,indexFileName:i,_i18n:a})=>{let{allLocales:o,defaultLocale:s,omitDefaultLocaleFromFilePath:c,structureMap:{i18nMultiFile:l,i18nMultiFolder:u,i18nMultiRootFolder:d}}=a,f=`(?<locale>${o.join(`|`)})`,p=o.filter(e=>e!==s).join(`|`),m=c?`(?:(?<locale>${p})\\/)?`:`${f}\\/`,h=c?`(?:\\.(?<locale>${p}))?`:`\\.${f}`,g=[`^`,d?m:``,n?`${up(n)}\\/`:``,u?m:``,Sb(r,i),l?h:``,`\\.`,bb({format:t,extension:e}),`$`].join(``);return new RegExp(g)},wb=({format:e,delimiter:t})=>{if(typeof t==`string`&&t.trim())return[t,t];if(Array.isArray(t)&&t.length===2)return t;if(e===`json-frontmatter`)return[`{`,`}`];if(e===`toml-frontmatter`)return[`+++`,`+++`];if(e===`yaml-frontmatter`)return[`---`,`---`]},Tb=({rawCollection:e,file:t,_i18n:n})=>{let{folder:r,path:i,extension:a,format:o,frontmatter_delimiter:s,yaml_quote:c}=e,l=Bb(e),u=t?.file?fp(t.file):void 0,d=u?xp(u).extension:a,f=t?.format??o,p=bb({format:f,extension:d}),m=xb({format:f,extension:p}),h=t?.frontmatter_delimiter??s,g=l?fp(r):void 0,_=l?cb(e)?.name:void 0;return c!==void 0&&ob(`yaml_quote`),{extension:p,format:m,basePath:g,subPath:l?i:void 0,fullPathRegEx:g===void 0?void 0:Cb({extension:p,format:m,basePath:g,subPath:i,indexFileName:_,_i18n:n}),fullPath:u?gb({_i18n:n,locale:n.defaultLocale,path:u}):void 0,fmDelimiters:wb({format:m,delimiter:h}),yamlQuote:!!c}}})),Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb=o((()=>{f(),Zf(),VP(),sb(),$b(),Db={SINGLE_FILE:`single_file`,SINGLE_FILE_DEFAULT_ROOT:`single_file_default_root`,MULTIPLE_FILES:`multiple_files`,MULTIPLE_FOLDERS:`multiple_folders`,MULTIPLE_FOLDERS_I18N_ROOT:`multiple_folders_i18n_root`,MULTIPLE_ROOT_FOLDERS:`multiple_root_folders`},Ob=`_default`,kb={key:`translationKey`,value:`{{slug}}`},Ab={i18nEnabled:!1,saveAllLocales:!0,allLocales:[Ob],initialLocales:[Ob],defaultLocale:Ob,structure:Db.SINGLE_FILE,structureMap:{i18nSingleFile:!1,i18nSingleFileDefaultRoot:!1,i18nMultiFile:!1,i18nMultiFolder:!1,i18nMultiRootFolder:!1},canonicalSlug:{...kb},omitDefaultLocaleFromFilePath:!1,omitDefaultLocaleFromPreviewPath:!1},jb=(e,t)=>{let n=A(IP);if(!u(n.i18n))return;let r=structuredClone(n.i18n);if(e.i18n||Hb(e)){if(u(e.i18n)&&Object.assign(r,e.i18n),t)if(t.i18n)u(t.i18n)&&Object.assign(r,t.i18n);else return}else return;return r},Mb=(e,t)=>t?t.file.includes(`{{locale}}`)?Db.MULTIPLE_FILES:e===Db.SINGLE_FILE_DEFAULT_ROOT?Db.SINGLE_FILE_DEFAULT_ROOT:Db.SINGLE_FILE:e,Nb=(e,t)=>({i18nSingleFile:e&&t===Db.SINGLE_FILE,i18nSingleFileDefaultRoot:e&&t===Db.SINGLE_FILE_DEFAULT_ROOT,i18nMultiFile:e&&t===Db.MULTIPLE_FILES,i18nMultiFolder:e&&t===Db.MULTIPLE_FOLDERS,i18nMultiRootFolder:e&&(t===Db.MULTIPLE_FOLDERS_I18N_ROOT||t===Db.MULTIPLE_ROOT_FOLDERS)}),Pb=(e,t,n)=>e?n&&t.includes(n)?n:t[0]:Ob,Fb=(e,t,n)=>e===`all`?t:e===`default`?[n]:t.filter(t=>t===n||(Array.isArray(e)?e.includes(t):!0)),Ib=(e,t)=>{let n=jb(e,t),{structure:r=Db.SINGLE_FILE,locales:i=[],default_locale:a,initial_locales:o,save_all_locales:s=!0,canonical_slug:c={key:void 0,value:void 0},omit_default_locale_from_filename:l,omit_default_locale_from_file_path:u=l??!1,omit_default_locale_from_preview_path:d=!1}=n??{};n?.save_all_locales!==void 0&&ob(`save_all_locales`),l!==void 0&&ob(`omit_default_locale_from_filename`);let{key:f=kb.key,value:p=kb.value}=c,m=i.length>0,h=m?i:[Ob],g=Pb(m,h,a),_=Mb(r,t),v=Nb(m,_),y=m?s===!0&&o===void 0:!0,b=Fb(o,h,g),x=u&&(t?/{{locale}}[./]/.test(t.file):v.i18nMultiFile);return _===`multiple_folders_i18n_root`&&ob(`multiple_folders_i18n_root`),{i18nEnabled:m,saveAllLocales:y,allLocales:h,defaultLocale:g,initialLocales:b,structure:_,structureMap:v,canonicalSlug:{key:f,value:p},omitDefaultLocaleFromFilePath:x,omitDefaultLocaleFromPreviewPath:d}}})),Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b=o((()=>{Z(),gp(),Zf(),VP(),rb(),Eb(),Lb(),Rb=rn(),zb=new Map,Bb=e=>typeof e.folder==`string`&&!Array.isArray(e.files),Vb=e=>e.folder===void 0&&Array.isArray(e.files),Hb=e=>Vb(e)&&e.name===`_singletons`,Ub=(e,{visible:t=void 0,type:n=void 0}={})=>`divider`in e||t&&e.hide?!1:n===`entry`?Bb(e):n===`file`?Vb(e):n===`singleton`?Hb(e):Bb(e)||Vb(e),Wb=({collections:e=A(IP)?.collections??[],visible:t,type:n}={})=>e.filter(e=>Ub(e,{visible:t,type:n})),Gb=()=>Wb({visible:!0})[0],Kb=e=>{if(!(`folder`in e))return[];let{fields:t,thumbnail:n=!0}=e;return n===!1?[]:typeof n==`string`?[n]:Array.isArray(n)?n:t?.length?t.filter(({widget:e=`string`})=>[`image`,`file`].includes(e)).map(({name:e})=>e):[]},qb=(e,t)=>({...e,_i18n:t,_type:`entry`,_file:Tb({rawCollection:e,_i18n:t}),_thumbnailFieldNames:Kb(e)}),Jb=(e,t,n)=>({...e,_i18n:t,_type:Hb(e)?`singleton`:`file`,_fileMap:Object.fromEntries(n.filter(Xy).map(t=>{let n=Ib(e,t),r=Tb({rawCollection:e,file:t,_i18n:n});return[t.name,{...t,_file:r,_i18n:n}]}))}),Yb=()=>{let e=A(IP)?.singletons;if(!Array.isArray(e))return;let t=Zy(e).map(e=>({...e,file:fp(e.file)}));if(!t.length)return;let n={name:`_singletons`,files:t};return Jb(n,Ib(n),t)},Xb=e=>{let t=zb.get(e);if(t)return t;if(e===`_singletons`){let t=Yb();return zb.set(e,t),t}let n=Wb().find(t=>t.name===e);if(!n){zb.set(e,void 0);return}let r=Bb(n)?n:void 0,i=Vb(n)?n:void 0;if(!r&&!i){zb.set(e,void 0);return}r?r.folder=fp(r.folder):i?.files.forEach(e=>{e.file&&=fp(e.file)});let a=Ib(n),o=r?qb(r,a):Jb(i,a,i.files);return zb.set(e,o),o},Zb=(e,{useSingular:t=!1}={})=>{let{_type:n,name:r,label:i,label_singular:a}=e;return n===`singleton`?X(`files`):t&&a?a:i||r},Qb=e=>e?e===`_singletons`?9999999:A(IP)?.collections?.findIndex(({name:t})=>t===e)??-1:-1})),ex,tx,nx,rx,ix,ax,ox,sx,sne=o((()=>{kp(),gp(),$b(),rb(),ex=[],tx=e=>e.includes(`{{media_folder}}`)||e.includes(`{{public_folder}}`),nx=(e,{globalMediaFolder:t,globalPublicFolder:n})=>e.trim().replace(`{{media_folder}}`,`/${t}`).replace(`{{public_folder}}`,`/${n}`).replace(`//`,`/`),rx=({collectionName:e,fileName:t,typedKeyPath:n,isIndexFile:r=!1,mediaFolder:i,publicFolder:a,baseFolder:o,globalFolders:s})=>{if(tx(i)){if(!s)return;i=nx(i,s)}if(a===void 0)a=i;else if(tx(a)){if(!s)return;a=nx(a,s)}i=i.replace(/^\.(?:\/|$)/,``);let c=!i.startsWith(`/`);return{collectionName:e,fileName:t,typedKeyPath:n,isIndexFile:r,internalPath:fp(c?o??``:i),internalSubPath:c?fp(i):void 0,publicPath:/^($|[.@])/.test(a)?a:`/${fp(a)}`,entryRelative:c,hasTemplateTags:/{{.+?}}/.test(i)}},ix=e=>{if(e.mediaFolder===void 0)return;let t=rx(e);if(!t)return;let{globalMediaFolder:n,globalPublicFolder:r}=e.globalFolders??{};!t.entryRelative&&t.internalPath===n&&t.publicPath===r||ex.push(t)},ax=({collectionName:e,files:t,globalFolders:n})=>{Zy(t).forEach(t=>{let{name:r,file:i,media_folder:a,public_folder:o}=t;ix({collectionName:e,fileName:r,mediaFolder:a,publicFolder:o,baseFolder:xp(i).dirname,globalFolders:n})})},ox=({fieldMediaFolders:e,validCollections:t,globalFolders:n})=>{e.forEach(({fieldConfig:e,context:r})=>{let i=r.collection;(i.name===`_singletons`||t.some(e=>e.name===i.name))&&ix({collectionName:i.name,fileName:r.collectionFile?.name,mediaFolder:e.media_folder,publicFolder:e.public_folder,baseFolder:`folder`in i?i.folder:void 0,typedKeyPath:r.typedKeyPath,isIndexFile:r.isIndexFile,globalFolders:n})})},sx=(e,t=[])=>{ex.length=0;let{media_folder:n,public_folder:r,collections:i,singletons:a}=e,o=n!==void 0,s=o?fp(n).replace(/^\.$/,``):``,c=o?r?`/${fp(r)}`.replace(/^\/@/,`@`):`/${s}`:``,l={collectionName:void 0,internalPath:void 0,internalSubPath:void 0,publicPath:void 0,entryRelative:!1,hasTemplateTags:!1},u=o?{...l,internalPath:s,publicPath:c}:void 0,d=o?{globalMediaFolder:s,globalPublicFolder:c}:void 0,f=Wb({collections:i});f.forEach(e=>{let{name:t,files:n,folder:r,path:i,media_folder:a,public_folder:s}=e;ix({collectionName:t,mediaFolder:o&&a===void 0&&i!==void 0?``:a,publicFolder:s,baseFolder:r,entryPath:i,globalFolders:d}),n?.length&&ax({collectionName:t,files:n,globalFolders:d})}),a?.length&&ax({collectionName:`_singletons`,files:a,globalFolders:d}),ox({fieldMediaFolders:t,validCollections:f,globalFolders:d}),ex.sort((e,t)=>hp(e.internalPath,t.internalPath));let p=[];return u&&p.push(u),p.push(...ex),p.length&&p.unshift(l),p}})),cx,lx,ux,dx,fx,px,mx,cne=o((()=>{gp(),$b(),rb(),_b(),Lb(),cx=({collection:e,file:t})=>{let n=fp(t.file);if(!n.includes(`{{locale}}`))return{_default:n};let r=Ib(e,t);return Object.fromEntries(r.allLocales.map(e=>[e,gb({_i18n:r,locale:e,path:n})]))},lx=(e,t)=>{if(Xy(t))return{collectionName:e.name,fileName:t.name,filePathMap:cx({collection:e,file:t})}},ux=(e,t)=>hp(Object.values(e.filePathMap??{})[0],Object.values(t.filePathMap??{})[0]),dx=({collections:e})=>Wb({collections:e,type:`entry`}).map(e=>{let{name:t,folder:n}=e,r=fp(n),{allLocales:i,structureMap:{i18nMultiRootFolder:a}}=Ib(e);return{collectionName:t,folderPath:r,folderPathMap:Object.fromEntries(i.map(e=>[e,a?`${e}/${r}`:r]))}}).sort((e,t)=>hp(e.folderPath,t.folderPath)),fx=({collections:e})=>Wb({collections:e,type:`file`}).flatMap(e=>(e.files??[]).map(t=>lx(e,t))).filter(e=>!!e).sort(ux),px=({singletons:e})=>{let t=Array.isArray(e)?Zy(e):[];if(!t.length)return[];let n={name:`_singletons`,files:t};return t.map(e=>lx(n,e)).filter(e=>!!e).sort(ux)},mx=e=>[...dx(e),...fx(e),...px(e)]}));
111
111
  /*!
112
112
  * Copyright (c) Squirrel Chat et al., All rights reserved.
113
113
  * SPDX-License-Identifier: BSD-3-Clause
@@ -166,7 +166,7 @@ function lne(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop(
166
166
  `).map(e=>e.startsWith(`*.`)&&e.includes(`filter=lfs`)?e.split(` `)[0].slice(2).toLowerCase():``).filter(Boolean)??[])})),BS=s(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof ee||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new ee(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var ee=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),te=ee.prototype;return w.prototype=te,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){te[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,ee,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),VS=s(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_customParseFormat=r()})(e,(function(){var e={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return(e=+e)+(e>68?1900:2e3)},c=function(e){return function(t){this[e]=+t}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||={}).offset=function(e){if(!e||e===`Z`)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return n===0?0:t[0]===`+`?-n:n}(e)}],u=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?`pm`:`PM`);return n},f={A:[a,function(e){this.afternoon=d(e,!1)}],a:[a,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*e}],SS:[r,function(e){this.milliseconds=10*e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[i,c(`seconds`)],ss:[i,c(`seconds`)],m:[i,c(`minutes`)],mm:[i,c(`minutes`)],H:[i,c(`hours`)],h:[i,c(`hours`)],HH:[i,c(`hours`)],hh:[i,c(`hours`)],D:[i,c(`day`)],DD:[r,c(`day`)],Do:[a,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,``)===e&&(this.day=r)}],w:[i,c(`week`)],ww:[r,c(`week`)],M:[i,c(`month`)],MM:[r,c(`month`)],MMM:[a,function(e){var t=u(`months`),n=(u(`monthsShort`)||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw Error();this.month=n%12||n}],MMMM:[a,function(e){var t=u(`months`).indexOf(e)+1;if(t<1)throw Error();this.month=t%12||t}],Y:[/[+-]?\d+/,c(`year`)],YY:[r,function(e){this.year=s(e)}],YYYY:[/\d{4}/,c(`year`)],Z:l,ZZ:l};function p(n){for(var r=n,i=o&&o.formats,a=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var a=r&&r.toUpperCase();return n||i[r]||e[r]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),s=a.length,c=0;c<s;c+=1){var l=a[c],u=f[l],d=u&&u[0],p=u&&u[1];a[c]=p?{regex:d,parser:p}:l.replace(/^\[|\]$/g,``)}return function(e){for(var t={},n=0,r=0;n<s;n+=1){var i=a[n];if(typeof i==`string`)r+=i.length;else{var o=i.regex,c=i.parser,l=e.slice(r),u=o.exec(l)[0];c.call(t,u),e=e.replace(u,``)}}return function(e){var t=e.afternoon;if(t!==void 0){var n=e.hours;t?n<12&&(e.hours+=12):n===12&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,a=e.args;this.$u=r;var s=a[1];if(typeof s==`string`){var c=!0===a[2],l=!0===a[3],u=c||l,d=a[2];l&&(d=a[2]),o=this.$locale(),!c&&d&&(o=n.Ls[d]),this.$d=function(e,t,n,r){try{if([`x`,`X`].indexOf(t)>-1)return new Date((t===`X`?1e3:1)*e);var i=p(t)(e),a=i.year,o=i.month,s=i.day,c=i.hours,l=i.minutes,u=i.seconds,d=i.milliseconds,f=i.zone,m=i.week,h=new Date,g=s||(a||o?1:h.getDate()),_=a||h.getFullYear(),v=0;a&&!o||(v=o>0?o-1:h.getMonth());var y,b=c||0,x=l||0,S=u||0,C=d||0;return f?new Date(Date.UTC(_,v,g,b,x,S,C+60*f.offset*1e3)):n?new Date(Date.UTC(_,v,g,b,x,S,C)):(y=new Date(_,v,g,b,x,S,C),m&&(y=r(y).week(m).toDate()),y)}catch{return new Date(``)}}(t,s,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(s)&&(this.$d=new Date(``)),o={}}else if(s instanceof Array)for(var f=s.length,m=1;m<=f;m+=1){a[1]=s[m-1];var h=n.apply(this,a);if(h.isValid()){this.$d=h.$d,this.$L=h.$L,this.init();break}m===f&&(this.$d=new Date(``))}else i.call(this,e)}}}))})),HS=s(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_localizedFormat=r()})(e,(function(){var e={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`};return function(t,n,r){var i=n.prototype,a=i.format;r.en.formats=e,i.format=function(t){t===void 0&&(t=`YYYY-MM-DDTHH:mm:ssZ`);var n=this.$locale().formats,r=function(t,n){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,r,i){var a=i&&i.toUpperCase();return r||n[i]||e[i]||n[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))}(t,n===void 0?{}:n);return a.call(this,r)}}}))})),US=s(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_utc=r()})(e,(function(){var e=`minute`,t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(r,i,a){var o=i.prototype;a.utc=function(e){return new i({date:e,utc:!0,args:arguments})},o.utc=function(t){var n=a(this.toDate(),{locale:this.$L,utc:!0});return t?n.add(this.utcOffset(),e):n},o.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var s=o.parse;o.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var c=o.init;o.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else c.call(this)};var l=o.utcOffset;o.utcOffset=function(r,i){var a=this.$utils().u;if(a(r))return this.$u?0:a(this.$offset)?l.call(this):this.$offset;if(typeof r==`string`&&(r=function(e){e===void 0&&(e=``);var r=e.match(t);if(!r)return null;var i=(``+r[0]).match(n)||[`-`,0,0],a=i[0],o=60*i[1]+ +i[2];return o===0?0:a===`+`?o:-o}(r),r===null))return this;var o=Math.abs(r)<=16?60*r:r;if(o===0)return this.utc(i);var s=this.clone();if(i)return s.$offset=o,s.$u=!1,s;var c=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(o+c,e)).$offset=o,s.$x.$localOffset=c,s};var u=o.format;o.format=function(e){var t=e||(this.$u?`YYYY-MM-DDTHH:mm:ss[Z]`:``);return u.call(this,t)},o.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},o.isUTC=function(){return!!this.$u},o.toISOString=function(){return this.toDate().toISOString()},o.toString=function(){return this.toDate().toUTCString()};var d=o.toDate;o.toDate=function(e){return e===`s`&&this.$offset?a(this.format(`YYYY-MM-DD HH:mm:ss:SSS`)).toDate():d.call(this)};var f=o.diff;o.diff=function(e,t,n){if(e&&this.$u===e.$u)return f.call(this,e,t,n);var r=this.local(),i=a(e).local();return f.call(r,i,t,n)}}}))})),WS,GS,KS,qS,JS,YS,XS=o((()=>{WS=/^\d{4}-[01]\d-[0-3]\d$/,GS=/T00:00(?::00)?(?:\.000)?Z$/,KS={year:`numeric`,month:`short`,day:`numeric`},qS={hour:`numeric`,minute:`numeric`,hour12:!0},JS={...KS,...qS},YS=(e,t)=>e.toLocaleString(t??void 0,JS)})),ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC=o((()=>{Bp(),ZS=l(BS(),1),QS=l(VS(),1),$S=l(HS(),1),eC=l(US(),1),_b(),XS(),ZS.default.extend(QS.default),ZS.default.extend($S.default),ZS.default.extend(eC.default),tC=e=>{let{type:t=`datetime-local`,min:n=void 0,max:r=void 0,step:i=void 0,format:a,date_format:o=void 0,time_format:s=void 0,picker_utc:c=!1}=e,l=typeof o==`string`?o:``,u=typeof s==`string`?s:``,d=t===`date`||s===!1,f=t===`time`||o===!1;return{type:d?`date`:f?`time`:`datetime-local`,min:typeof n==`string`&&n?n:void 0,max:typeof r==`string`&&r?r:d?`9999-12-31`:f?void 0:`9999-12-31T23:59`,step:typeof i==`number`&&Number.isInteger(i)&&i>0||i===`any`?i:void 0,format:a||[l,u].join(` `).trim()||void 0,dateOnly:d,timeOnly:f,utc:c}},nC=e=>e instanceof Date&&!Number.isNaN(e.getTime()),rC=e=>e?ZS.default.utc:ZS.default,iC=(e,t)=>{let{format:n,timeOnly:r,utc:i}=tC(t);if(!e)return;let a;if(n){let t=rC(i),r=t(e,n);if(!r.isValid()&&(r=t(e),!r.isValid())){console.error(`Invalid Date`,e);return}return r.toDate()}if(a=r?new Date(`${new Date().toJSON().split(`T`)[0]}T${e}`):new Date(e),nC(a))return a;console.error(`Invalid Date`,e)},aC=e=>{let{dateOnly:t,timeOnly:n,utc:r}=tC(e),{year:i,month:a,day:o,hour:s,minute:c}=zp({timeZone:r?`UTC`:void 0}),l=`${i}-${a}-${o}`,u=`${s}:${c}`;return t?l:n?u:r?`${l}T${u}:00.000Z`:`${l}T${u}`},oC=(e,t,n)=>{let{format:r,dateOnly:i,timeOnly:a,utc:o}=tC(n),s=i?`YYYY-MM-DD`:a?`HH:mm`:`YYYY-MM-DDTHH:mm`,c=`:00${t?.endsWith(`.000`)?`.000`:``}`;if(e===``)return``;if(e){if(r){let t=rC(o),n=t(e,s);return!n.isValid()&&(n=t(e),!n.isValid())?(console.info(`Invalid date`,e),``):n.format(r)}return i?e:o?`${e}:00.000Z`:`${e}${c}`}},sC=(e,t)=>{let{dateOnly:n,timeOnly:r,utc:i}=tC(t);if(!e)return``;let a=n?e.match(/^(?<date>\d{4}-[01]\d-[0-3]\d)\b/)?.groups?.date:r?e.match(/(?:^|T)(?<time>[0-2]\d:[0-5]\d)\b/)?.groups?.time:void 0;if(a)return a;let o=iC(e,t);if(!o)return``;let{year:s,month:c,day:l,hour:u,minute:d}=zp({date:o,timeZone:i?`UTC`:void 0}),f=`${s}-${c}-${l}`,p=`${u}:${d}`;return n?f:r?p:`${f}T${p}`},cC=({locale:e,fieldConfig:t,currentValue:n})=>{let{format:r,dateOnly:i,timeOnly:a,utc:o}=tC(t);if(typeof n!=`string`||!n.trim())return``;if(r){let e=rC(o),t=e(n,r);return!t.isValid()&&(t=e(n),!t.isValid())?(console.error(`Invalid Date`,n),``):t.format(r)}let s=iC(n,t),c=db(e);return nC(s)?a?s.toLocaleTimeString(c,qS):i?s.toLocaleDateString(c,{...KS,timeZone:o||WS.test(n)||GS.test(n)?`UTC`:void 0}):s.toLocaleString(c,{...KS,...qS,timeZone:o?`UTC`:void 0,timeZoneName:o?void 0:`short`}):``}})),uC,jne,Mne,Nne,dC,fC,pC,Pne,Fne,Ine,Lne,Rne,zne,Bne,Vne,mC,hC=o((()=>{gp(),uC=l(BS(),1),jne=l(VS(),1),Mne=l(HS(),1),Nne=l(US(),1),UP(),lC(),uC.default.extend(jne.default),uC.default.extend(Mne.default),uC.default.extend(Nne.default),dC=/^date\('(?<format>.+?)'(?:,\s*'(?<timeZone>.+?)')?\)$/,fC=/^default\('(?<defaultValue>.+?)'\)$/,pC=/^ternary\('(?<truthyValue>.*?)',\s*'(?<falsyValue>.*?)'\)$/,Pne=/^truncate\((?<max>\d+)(?:,\s*'(?<ellipsis>.+?)')?\)$/,Fne=e=>String(e).toUpperCase(),Ine=e=>String(e).toLowerCase(),Lne=(e,{format:t,timeZone:n},r)=>{let i=String(e),{dateOnly:a,utc:o}=tC(r),s=(n===`utc`||o||a&&i.match(/^\d{4}-[01]\d-[0-3]\d$/)||a&&i.match(/T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?Z$/)?uC.default.utc:uC.default)(i);return s.isValid()?s.format(t):``},Rne=(e,{defaultValue:t})=>e?String(e):t,zne=(e,{truthyValue:t,falsyValue:n})=>e?t:n,Bne=(e,{max:t,ellipsis:n=`…`})=>dp(String(e),Number(t),{ellipsis:n}),Vne=({fieldConfig:e,value:t,transformation:n,locale:r})=>{if(n===`upper`)return Fne(t);if(n===`lower`)return Ine(t);if(n===`slugify`)return HP(String(t),{locale:r});let i=n.match(dC);if(i?.groups)return Lne(t,i.groups,e??{});let a=n.match(fC);if(a?.groups)return Rne(t,a.groups);let o=n.match(pC);if(o?.groups)return zne(t,o.groups);let s=n.match(Pne);return s?.groups?Bne(t,s.groups):String(t)},mC=({fieldConfig:e,value:t,transformations:n,locale:r})=>(n.forEach(n=>{t=Vne({fieldConfig:e,value:t,transformation:n,locale:r})}),t)})),gC,_C,Hne,vC=o((()=>{gC=[`file`,`image`],_C=[...gC,`relation`,`select`],Hne=[..._C,`datetime`,`keyvalue`,`list`,`number`]})),Une,Wne,Gne,yC,bC,xC,Kne,qne,SC=o((()=>{Zf(),VP(),Une=`https://console.cloudinary.com`,Wne=[`cloud_name`,`api_key`,`username`,`timestamp`,`signature`,`integration`,`use_saml`,`saml_iframe_support`],Gne=[`integration`,`inline_container`,`z_index`,`multiple`,`max_files`,`default_transformations`,`insert_caption`,`remove_header`,`folder`,`search`,`collection`,`asset`,`transformation`,`sandboxNotAllowedAttributes`,`theme`],yC=e=>{let t=A(IP);if(e??=t,e?.media_libraries&&`cloudinary`in e.media_libraries)return e.media_libraries.cloudinary;if(!e?.media_library)return;let n=e.media_library.name===`cloudinary`,r=!e.media_library.name&&t?.media_library?.name===`cloudinary`;if(n||r)return e.media_library},bC=new Map,xC=e=>{let t=e?JSON.stringify(e):`global`,n=bC.get(t);if(n)return n;let r=yC()||{config:{}},i=yC(e)||{config:{}},a={...r,...i,config:{...r.config,...i.config}};return bC.set(t,a),a},Kne=e=>{let t=yC(e)??yC(),{cloud_name:n,api_key:r}=(t?t.config:void 0)??{};return!!(n&&r)},qne={serviceType:`cloud_storage`,serviceId:`cloudinary`,serviceLabel:`Cloudinary`,serviceURL:`https://cloudinary.com/`,showServiceLink:!0,hotlinking:!0,authType:`widget`,developerURL:`https://cloudinary.com/documentation/`,apiKeyURL:`https://console.cloudinary.com/settings/api-keys`,apiKeyPattern:/^[A-Za-z0-9_-]{15,}$/,isEnabled:Kne}})),CC,wC,Jne,TC,Yne,Xne,EC,DC,OC,kC,AC=o((()=>{tS(),IS(),CC=async(e,t)=>{let n=new TextEncoder,r=await crypto.subtle.importKey(`raw`,typeof e==`string`?n.encode(e):e,{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),i=await crypto.subtle.sign(`HMAC`,r,n.encode(t));return new Uint8Array(i)},wC=async e=>{let t=typeof e==`string`?new TextEncoder().encode(e):e,n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},Jne=async({method:e,url:t,headers:n,payloadHash:r,accessKeyId:i,secretAccessKey:a,region:o,service:s,date:c})=>{let l=new URL(t),u=c.toISOString().replace(/[:-]|\.\d{3}/g,``),d=u.slice(0,8),f=l.pathname,p=[...l.searchParams.entries()].sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join(`&`),m=Object.entries(n).map(([e,t])=>`${e.toLowerCase()}:${t.trim()}`).sort().join(`
167
167
  `),h=Object.keys(n).map(e=>e.toLowerCase()).sort().join(`;`),g=[e,f,p,`${m}\n`,h,r].join(`
168
168
  `),_=`AWS4-HMAC-SHA256`,v=`${d}/${o}/${s}/aws4_request`,y=[_,u,v,await wC(g)].join(`
169
- `),b=await CC(await CC(await CC(await CC(await CC(`AWS4${a}`,d),o),s),`aws4_request`),y),x=Array.from(b).map(e=>e.toString(16).padStart(2,`0`)).join(``);return[`${_} Credential=${i}/${v},`,`SignedHeaders=${h}, Signature=${x}`].join(` `)},TC=async({method:e,url:t,config:n,secretAccessKey:r,body:i=``,extraHeaders:a={}})=>{let{access_key_id:o,region:s=`us-east-1`}=n,c=new Date,l=new URL(t),u=await wC(i),d={Host:l.host,"x-amz-date":c.toISOString().replace(/[:-]|\.\d{3}/g,``),"x-amz-content-sha256":u,...a},f=await Jne({method:e,url:t,headers:d,payloadHash:u,accessKeyId:o,secretAccessKey:r,region:s,service:`s3`,date:c});return fetch(t,{method:e,headers:{...d,Authorization:f},...i&&{body:i}})},Yne=e=>{let t=new DOMParser().parseFromString(e,`text/xml`),n=e=>{if(e.children.length===0)return e.textContent;let t={};return Array.from(e.children).forEach(e=>{let r=e.tagName,i=n(e);t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i}),t};return n(t.documentElement)},Xne=({bucket:e,key:t,endpoint:n,region:r,forcePathStyle:i,publicUrl:a})=>a?`${a}/${t}`:n?`${n}/${e}/${t}`:i?`https://s3.${r}.amazonaws.com/${e}/${t}`:`https://${e}.s3.${r}.amazonaws.com/${t}`,EC=(e,t)=>{let{bucket:n,region:r,endpoint:i,force_path_style:a,prefix:o=``,public_url:s}=t;return e.map(e=>{let t=e.Key,c=t.split(`/`).pop()||t,l=o&&t.startsWith(o)?t.slice(o.length):t,u=Xne({bucket:n,key:t,endpoint:i,region:r,forcePathStyle:a,publicUrl:s});return{id:t,description:l,previewURL:u,downloadURL:u,fileName:c,lastModified:new Date(e.LastModified),size:Number(e.Size),kind:FS(t)}})},DC=async(e,t,{maxPages:n=10}={})=>{let{bucket:r,region:i,endpoint:a,force_path_style:o,prefix:s=``}=e,{kind:c,apiKey:l}=t;if(!l)return Promise.reject(Error(`S3 secret access key is required`));let u=[],d;for(let t=0;t<n;t+=1){let t=new URLSearchParams({"list-type":`2`,"max-keys":`1000`,...s&&{prefix:s},...d&&{"continuation-token":d}}),n=await TC({method:`GET`,url:a?`${a}/${r}?${t}`:o?`https://s3.${i}.amazonaws.com/${r}?${t}`:`https://${r}.s3.${i}.amazonaws.com/?${t}`,config:e,secretAccessKey:l});if(!n.ok){let e=await n.text();return Promise.reject(Error(`Failed to list objects: ${e}`))}let c=Yne(await n.text()),f=(c.Contents?Array.isArray(c.Contents)?c.Contents:[c.Contents]:[]).filter(e=>!e.Key.endsWith(`/`));if(u.push(...f),d=c.NextContinuationToken,c.IsTruncated!==`true`||!d)break;await eS(50)}return EC(c?u.filter(e=>FS(e.Key)===c):u,e)},OC=async(e,t,n)=>{let r=await DC(t,n,{maxPages:5}),i=e.toLowerCase();return r.filter(e=>e.fileName.toLowerCase().includes(i)||e.description.toLowerCase().includes(i))},kC=async(e,t,n)=>{if(e.length===0)return[];let{bucket:r,region:i,endpoint:a,force_path_style:o,prefix:s=``}=t,{apiKey:c}=n;if(!c)return Promise.reject(Error(`S3 secret access key is required`));let l=[];for(let n of e){let u=n.name.split(/[/\\]/).filter(Boolean).at(-1)??n.name,d=s?`${s}${u}`:u,f=await TC({method:`PUT`,url:a?`${a}/${r}/${d}`:o?`https://s3.${i}.amazonaws.com/${r}/${d}`:`https://${r}.s3.${i}.amazonaws.com/${d}`,config:t,secretAccessKey:c,body:await n.arrayBuffer(),extraHeaders:{"Content-Type":n.type||`application/octet-stream`,"x-amz-acl":`public-read`}});if(!f.ok){let e=await f.text();throw Error(`Failed to upload file ${n.name}: ${e}`)}l.push({Key:d,LastModified:new Date().toISOString(),ETag:``,Size:n.size,ContentType:n.type}),e.length>1&&await eS(50)}return EC(l,t)}})),jC,Zne,Qne,$ne,ere,tre,nre=o((()=>{Zf(),VP(),AC(),jC=(e=A(IP))=>e?.media_libraries?.aws_s3??(e?.media_library?.name===`aws_s3`?e?.media_library:void 0),Zne=e=>{let t=jC(e)??jC();return!!(t&&t.access_key_id&&t.bucket&&t.region)},Qne=async e=>{let{fieldConfig:t}=e,n=jC(t)??jC();return n?DC(n,e):Promise.reject(Error(`Amazon S3 configuration is not available`))},$ne=async(e,t)=>{let{fieldConfig:n}=t,r=jC(n)??jC();return r?OC(e,r,t):Promise.reject(Error(`Amazon S3 configuration is not available`))},ere=async(e,t)=>{let{fieldConfig:n}=t,r=jC(n)??jC();return r?kC(e,r,t):Promise.reject(Error(`Amazon S3 configuration is not available`))},tre={serviceType:`cloud_storage`,serviceId:`aws_s3`,serviceLabel:`Amazon S3`,serviceURL:`https://aws.amazon.com/s3/`,showServiceLink:!0,hotlinking:!0,authType:`api_key`,developerURL:`https://docs.aws.amazon.com/s3/`,apiKeyURL:`https://console.aws.amazon.com/iam/home#/security_credentials`,apiKeyPattern:/^[A-Za-z0-9/+=]{40}$/,isEnabled:Zne,list:Qne,search:$ne,upload:ere}})),MC,rre,ire,are,ore,NC,sre=o((()=>{Zf(),VP(),AC(),MC=(e=A(IP))=>e?.media_libraries?.cloudflare_r2??(e?.media_library?.name===`cloudflare_r2`?e?.media_library:void 0),rre=e=>{let t=MC(e)??MC();return!!(t&&t.access_key_id&&t.bucket&&t.account_id)},ire=async e=>{let{fieldConfig:t}=e,n=MC(t)??MC();return n?DC({...n,region:`auto`,endpoint:`https://${n.account_id}.r2.cloudflarestorage.com`},e):Promise.reject(Error(`Cloudflare R2 configuration is not available`))},are=async(e,t)=>{let{fieldConfig:n}=t,r=MC(n)??MC();return r?OC(e,{...r,region:`auto`,endpoint:`https://${r.account_id}.r2.cloudflarestorage.com`},t):Promise.reject(Error(`Cloudflare R2 configuration is not available`))},ore=async(e,t)=>{let{fieldConfig:n}=t,r=MC(n)??MC();return r?kC(e,{...r,region:`auto`,endpoint:`https://${r.account_id}.r2.cloudflarestorage.com`},t):Promise.reject(Error(`Cloudflare R2 configuration is not available`))},NC={serviceType:`cloud_storage`,serviceId:`cloudflare_r2`,serviceLabel:`Cloudflare R2`,serviceURL:`https://www.cloudflare.com/developer-platform/r2/`,showServiceLink:!0,hotlinking:!0,authType:`api_key`,developerURL:`https://developers.cloudflare.com/r2/`,apiKeyURL:`https://dash.cloudflare.com/?to=/:account/r2/api-tokens`,apiKeyPattern:/^[A-Za-z0-9/+=]{40,}$/,isEnabled:rre,list:ire,search:are,upload:ore}})),PC,FC,IC,LC,RC,zC,cre=o((()=>{Zf(),VP(),AC(),PC=(e=A(IP))=>e?.media_libraries?.digitalocean_spaces??(e?.media_library?.name===`digitalocean_spaces`?e?.media_library:void 0),FC=e=>{let t=PC(e)??PC();return!!(t&&t.access_key_id&&t.bucket&&t.region)},IC=async e=>{let{fieldConfig:t}=e,n=PC(t)??PC();return n?DC({...n,endpoint:`https://${n.region}.digitaloceanspaces.com`,public_url:n.public_url??`https://${n.bucket}.${n.region}.digitaloceanspaces.com`},e):Promise.reject(Error(`DigitalOcean Spaces configuration is not available`))},LC=async(e,t)=>{let{fieldConfig:n}=t,r=PC(n)??PC();return r?OC(e,{...r,endpoint:`https://${r.region}.digitaloceanspaces.com`,public_url:r.public_url??`https://${r.bucket}.${r.region}.digitaloceanspaces.com`},t):Promise.reject(Error(`DigitalOcean Spaces configuration is not available`))},RC=async(e,t)=>{let{fieldConfig:n}=t,r=PC(n)??PC();return r?kC(e,{...r,endpoint:`https://${r.region}.digitaloceanspaces.com`,public_url:r.public_url??`https://${r.bucket}.${r.region}.digitaloceanspaces.com`},t):Promise.reject(Error(`DigitalOcean Spaces configuration is not available`))},zC={serviceType:`cloud_storage`,serviceId:`digitalocean_spaces`,serviceLabel:`DigitalOcean Spaces`,serviceURL:`https://www.digitalocean.com/products/spaces`,showServiceLink:!0,hotlinking:!0,authType:`api_key`,developerURL:`https://docs.digitalocean.com/products/spaces/`,apiKeyURL:`https://cloud.digitalocean.com/account/api/spaces`,apiKeyPattern:/^[A-Za-z0-9/+=]{43}$/,isEnabled:FC,list:IC,search:LC,upload:RC}})),lre=s(((e,t)=>{function n(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}t.exports=function(e,t,i){if(typeof t!=`string`)throw Error(`Input must be string`);for(var a=t.length,o=0,s,c,l=0;l<a;l+=1){if(s=t.charCodeAt(l),c=t[l],n(s)&&r(t.charCodeAt(l+1))&&(l+=1,c+=t[l]),o+=e(c),o===i)return t.slice(0,l+1);if(o>i)return t.slice(0,l-c.length+1)}return t}})),ure=s(((e,t)=>{function n(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}t.exports=function(e){if(typeof e!=`string`)throw Error(`Input must be string`);for(var t=e.length,i=0,a=null,o=null,s=0;s<t;s++)a=e.charCodeAt(s),r(a)?o!=null&&n(o)?i+=1:i+=3:a<=127?i+=1:a>=128&&a<=2047?i+=2:a>=2048&&a<=65535&&(i+=3),o=a;return i}})),dre=s(((e,t)=>{var n=lre(),r=ure();t.exports=n.bind(null,r)})),fre=s(((e,t)=>{var n=dre(),r=/[\/\?<>\\:\*\|"]/g,i=/[\x00-\x1f\x80-\x9f]/g,a=/^\.+$/,o=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;function s(e,t){for(var n=e.length;n>0&&(e[n-1]===`.`||e[n-1]===` `);)n--;return n<e.length?e.slice(0,n)+t:e}function c(e,t){if(typeof e!=`string`)throw Error(`Input must be string`);var c=e.replace(r,t).replace(i,t).replace(a,t).replace(o,t);return c=s(c,t),n(c,255)}t.exports=function(e,t){var n=t&&t.replacement||``,r=c(e,n);return n===``?r:c(r,``)}})),BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC=o((()=>{Z(),lp(),kp(),gp(),BC=l(fre(),1),UP(),VC=(e,t)=>RegExp(`^${e.split(`/`).map(t).join(`\\/`)}(?=\\/|$)`),HC=e=>{let t=e.startsWith(`@`);return t&&(e=e.slice(1)),e=e.split(`/`).map(e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)).join(`/`),t?`@${e}`:e},UC=e=>decodeURIComponent(e),WC=new Map,GC=e=>{let t=Lh.current,n=WC.get(t);n||(n=new Intl.NumberFormat(t,{maximumFractionDigits:1}),WC.set(t,n));let r=1e3,i=r*1e3,a=i*1e3,o=a*1e3;return e<r?X(`file_size_units.b`,{values:{size:n.format(e)}}):e<i?X(`file_size_units.kb`,{values:{size:n.format(e/r)}}):e<a?X(`file_size_units.mb`,{values:{size:n.format(e/i)}}):e<o?X(`file_size_units.gb`,{values:{size:n.format(e/a)}}):X(`file_size_units.tb`,{values:{size:n.format(e/o)}})},KC=(e,t)=>{if(!t.length)return e;let{filename:n,extension:r}=xp(e),i=RegExp(`^${up(n)}(?:-(?<num>\\d+?))?${r?`\\.${r}`:``}$`),a=t.sort((e,t)=>hp(e.split(`.`)[0],t.split(`.`)[0])).findLast(e=>i.test(e));return a?`${n}-${Number(a.match(i)?.groups?.num??0)+1}${r?`.${r}`:``}`:e},qC=(e,{slugificationEnabled:t=!1,assetNamesInSameFolder:n=[]}={})=>{let r=(0,BC.default)(e.normalize().replace(/[\s\u00A0\u202F]+/g,` `));if(t){let{filename:e,extension:t}=xp(r);r=`${HP(e)}${t?`.${t.toLowerCase()}`:``}`}return KC(r,n)},JC=e=>e.filter(Boolean).join(`/`),YC=e=>{let t=e.split(`/`),n=!1;return t.forEach((e,r)=>{if(e===`.`||e===`..`){if(n&&(t[r]=null,e===`..`)){let e=t.findLastIndex((e,t)=>!!e&&t<r);e>-1&&(t[e]=null)}}else n=!0}),JC(t)},XC=e=>typeof e==`string`?new Blob([e],{type:`text/plain`}):e,ZC=async e=>{let t=await XC(e).arrayBuffer();return cp(new Blob([`blob ${t.byteLength}\0`,t]))}})),$C,ew,tw,nw,rw,iw,aw,ow,sw,cw,pre=o((()=>{tS(),Zf(),VP(),QC(),$C=(e=A(IP))=>e?.media_libraries?.uploadcare??(e?.media_library?.name===`uploadcare`?e?.media_library:void 0),ew=e=>{let t=$C(e)??$C();return t?t.config?.publicKey:void 0},tw=e=>!!ew(e),nw=(e,{fieldConfig:t}={})=>{let{settings:{autoFilename:n=!1,defaultOperations:r=void 0}={},config:{cdnBase:i=void 0}={}}=($C(t)??$C())||{};return e.map(e=>{let{uuid:t,original_filename:a,original_file_url:o,mime_type:s,datetime_uploaded:c,size:l}=e,u=`${new URL(i??o).origin}/${t}/`,d=s.startsWith(`image/`),f=s.startsWith(`video/`);return{id:t,description:a,previewURL:`${u}${d?`-/preview/400x400/`:``}`,downloadURL:`${u}${d&&r?`-${r}`:``}${n?a:``}`,fileName:a,lastModified:new Date(c),size:l,kind:d?`image`:f?`video`:`other`}})},rw=async(e,{maxPages:t=10,filter:n}={})=>{let{kind:r,fieldConfig:i,apiKey:a}=e,o=ew(i);if(!o)return Promise.reject(Error(`Uploadcare public key is not configured`));let s={Accept:`application/vnd.uploadcare-v0.7+json`,Authorization:`Uploadcare.Simple ${o}:${a}`},c=new URLSearchParams({limit:`100`,ordering:`-datetime_uploaded`,stored:`true`}),l=[],u=`https://api.uploadcare.com/files/?${c}`;for(let e=0;e<t&&u;e+=1){let e=await fetch(u,{headers:s});if(!e.ok)return Promise.reject(Error(`Failed to fetch files: ${e.statusText}`));let t=await e.json(),{results:i}=t;if(r===`image`&&(i=i.filter(e=>e.is_image)),n&&(i=i.filter(n)),l.push(...i),u=t.next,!u)break;await eS(50)}return nw(l,{fieldConfig:i})},iw=async e=>rw(e),aw=async(e,t)=>{let n=e.toLowerCase();return rw(t,{filter:e=>e.original_filename.toLowerCase().includes(n)})},ow=async(e,t)=>{let n=new TextEncoder,r=n.encode(String(t)),i=n.encode(e),a=await crypto.subtle.importKey(`raw`,i,{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),o=await crypto.subtle.sign(`HMAC`,a,r);return Array.from(new Uint8Array(o)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},sw=async(e,t)=>{if(e.length===0)return[];let{fieldConfig:n,apiKey:r}=t,i=ew(n);if(!i)return Promise.reject(Error(`Uploadcare public key is not configured`));if(!r)return Promise.reject(Error(`Uploadcare secret key is not provided`));let a=Math.floor(Date.now()/1e3)+1800,o=await ow(r,a),s=new FormData;s.append(`UPLOADCARE_PUB_KEY`,i),s.append(`UPLOADCARE_STORE`,`1`),s.append(`signature`,o),s.append(`expire`,String(a)),e.forEach(e=>{s.append(qC(e.name),e)});let c=await fetch(`https://upload.uploadcare.com/base/`,{method:`POST`,body:s});if(!c.ok)throw Error(`Failed to upload files: ${c.statusText}`);let l=await c.json();return nw(Object.entries(l).filter(([e])=>!e.startsWith(`UPLOADCARE_`)).map(([t,n])=>{let r=e.find(e=>e.name===t),i=r?.type||`application/octet-stream`,a=i.startsWith(`image/`);return{uuid:n,original_filename:t,original_file_url:`https://ucarecdn.com/${n}/${t}`,size:r?.size||0,mime_type:i,is_image:a,is_ready:!0,content_info:null,datetime_uploaded:new Date().toISOString(),datetime_stored:new Date().toISOString(),datetime_removed:null}}),{fieldConfig:n})},cw={serviceType:`cloud_storage`,serviceId:`uploadcare`,serviceLabel:`Uploadcare`,serviceURL:`https://uploadcare.com/`,showServiceLink:!0,hotlinking:!0,authType:`api_key`,developerURL:`https://uploadcare.com/docs/`,apiKeyURL:`https://app.uploadcare.com/projects/-/api-keys/`,apiKeyPattern:/^[a-f0-9]{20}$/,isEnabled:tw,list:iw,search:aw,upload:sw}})),lw,uw,dw=o((()=>{SC(),nre(),sre(),cre(),pre(),lw={aws_s3:tre,cloudflare_r2:NC,cloudinary:qne,digitalocean_spaces:zC,uploadcare:cw},uw=Object.keys(lw)})),fw,pw,mw,hw,gw,_w,vw,yw,bw,xw,Sw,Cw,ww,mre=o((()=>{fw=`@sveltia/cms`,pw=`0.157.0`,mw=`Sveltia CMS is a modern, lightweight, Git-based headless content management system.`,hw=[`svelte`,`cms`,`content-management-system`],gw=`https://sveltiacms.app/en/`,_w={type:`git`,url:`git+https://github.com/sveltia/sveltia-cms.git`},vw={name:`Kohei Yoshino`,url:`https://github.com/kyoshino`},yw=`module`,bw={build:`vite build`,"build:watch":`vite build --watch`,check:`pnpm run '/^check:.*/'`,"check:audit":`pnpm audit --ignore-registry-errors`,"check:cspell":`cspell --no-progress`,"check:eslint":`eslint .`,"check:imports":`node scripts/find-unused-imports.js`,"check:oxlint":`oxlint .`,"check:prettier":`prettier --check .`,"check:stylelint":`stylelint '**/*.{css,scss,svelte}'`,"check:svelte":`svelte-check`,dev:`vite`,format:`prettier --write .`,prepublishOnly:`vite build`,preview:`vite preview`,test:`NODE_OPTIONS=--no-experimental-webstorage vitest run`,"test:coverage":`NODE_OPTIONS=--no-experimental-webstorage vitest run --coverage`,"test:watch":`NODE_OPTIONS=--no-experimental-webstorage vitest`},xw={"@jsquash/webp":`^1.5.0`,"@lexical/markdown":`^0.43.0`,"@sindresorhus/transliterate":`^2.3.1`,"@sveltia/i18n":`^1.0.5`,"@sveltia/ui":`^0.37.2`,"@sveltia/utils":`^0.10.6`,"create-react-class":`^15.7.0`,dayjs:`^1.11.20`,deepmerge:`^4.3.1`,exifr:`^7.1.3`,"fast-deep-equal":`^3.1.3`,flat:`^6.0.1`,immutable:`^5.1.5`,"isomorphic-dompurify":`^3.10.0`,leaflet:`^1.9.4`,lexical:`^0.43.0`,marked:`^18.0.2`,"marked-bidi":`^1.0.15`,mime:`^4.1.0`,"parse-entities":`^4.0.2`,"pdfjs-dist":`^5.6.205`,qrcode:`^1.5.4`,react:`^19.2.5`,"react-dom":`^19.2.5`,"sanitize-filename":`^1.6.4`,"smol-toml":`^1.6.1`,svgo:`^4.0.1`,"terra-draw":`^1.28.8`,"terra-draw-leaflet-adapter":`1.0.3`,turndown:`^7.2.4`,yaml:`^2.8.3`},Sw={"@stylistic/eslint-plugin":`^5.10.0`,"@sveltejs/vite-plugin-svelte":`^7.0.0`,"@types/leaflet":`^1.9.21`,"@types/node":`^25.6.0`,"@types/qrcode":`^1.5.6`,"@types/react":`^19.2.14`,"@types/react-dom":`^19.2.3`,"@vitest/coverage-v8":`^4.1.5`,cspell:`^10.0.0`,eslint:`^9.39.4`,"eslint-config-airbnb-extended":`^3.1.0`,"eslint-config-prettier":`^10.1.8`,"eslint-plugin-jsdoc":`^62.9.0`,"eslint-plugin-package-json":`^0.91.1`,"eslint-plugin-svelte":`^3.17.1`,"eslint-plugin-unused-imports":`^4.4.1`,globals:`^17.5.0`,oxlint:`^1.61.0`,postcss:`^8.5.10`,"postcss-html":`^1.8.1`,prettier:`^3.8.3`,"prettier-plugin-svelte":`^3.5.1`,sass:`^1.99.0`,stylelint:`^17.9.0`,"stylelint-config-recommended-scss":`^17.0.1`,"stylelint-scss":`^7.0.0`,svelte:`^5.55.5`,"svelte-check":`^4.4.6`,"svelte-preprocess":`^6.0.3`,"ts-json-schema-generator":`^2.9.0`,typescript:`^5.9.3`,vite:`^8.0.10`,vitest:`^4.1.5`},Cw={directory:`package`,access:`public`,provenance:!0},ww={name:fw,version:pw,description:mw,keywords:hw,homepage:gw,repository:_w,license:`MIT`,author:vw,type:yw,scripts:bw,dependencies:xw,devDependencies:Sw,publishConfig:Cw}})),Tw,Ew,Dw=o((()=>{mre(),{dependencies:Tw,version:Ew}=ww})),Ow,kw,Aw,jw,Mw=o((()=>{Ow=`modulepreload`,kw=function(e){return`/`+e},Aw={},jw=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=kw(t,n),t in Aw)return;Aw[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ow,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})}})),Nw,Pw,Fw=o((()=>{Dw(),Mw(),Nw=e=>{let t=`https://unpkg.com/${e}`,n=Tw[e]?.replace(/^\D/,``);return n?`${t}@${n}`:t},Pw=async(e,t)=>jw(()=>import(`${Nw(e)}/${t}`),[])})),Iw,Lw,Rw,zw,Bw,Vw,Hw,Uw,Ww=o((()=>{Iw=[`avif`,`gif`,`jpeg`,`png`,`webp`],Lw=Iw.map(e=>`image/${e}`),Rw=/\b(?:avif|gif|jpe?g|png|webp)$/i,zw=[`svg`],Bw=[`image/svg+xml`],Vw=/\b(?:svg)$/i,[...Iw,...zw],Hw=[...Lw,...Bw],Uw=[`webp`]})),Gw,Kw,qw,Jw=o((()=>{Fw(),Ww(),Gw={},Kw=async e=>{if(e in Gw)return Gw[e];let t=`image/${e}`,n=new OffscreenCanvas(1,1);n.getContext(`2d`);let r=(await n.convertToBlob({type:t})).type===t;return Gw[e]=r,r},qw=async(e,{format:t=`webp`,quality:n=85}={})=>{let r=`image/${t}`;if(!await Kw(t)&&Uw.includes(t)){let i=e.getContext(`2d`).getImageData(0,0,e.width,e.height);try{let e=(await Pw(`@jsquash/${t}`,`encode.js?module`)).default,a=await e(i,{quality:n});return new Blob([a],{type:r})}catch{}}return e.convertToBlob({type:r,quality:n/100})}})),Yw,Xw,Zw=o((()=>{Yw=({width:e,height:t},{width:n=e,height:r=t,fit:i=`scale-down`}={})=>{let a={scale:1,width:e,height:t};if(e===n&&t===r)return a;let o=e<=n&&t<=r,s=1,c=0,l=0;if(i===`scale-down`){if(o)return a;i=`contain`}return i===`contain`&&(s=Math.min(n/e,r/t),c=e*s,l=t*s),{scale:s,width:c,height:l}},Xw=(e,t,n)=>{let{scale:r,width:i,height:a}=Yw(t,n);return e.width=i,e.height=a,{scale:r,width:i,height:a}}})),Qw,$w,eT,tT,nT,rT=o((()=>{Fw(),Jw(),Zw(),Qw=async({blob:e})=>{let t=URL.createObjectURL(e),n=new Image;return new Promise(e=>{n.addEventListener(`load`,()=>{e({source:n,naturalWidth:n.naturalWidth,naturalHeight:n.naturalHeight}),URL.revokeObjectURL(t)},{once:!0}),n.src=t})},$w=async({blob:e})=>{let t=URL.createObjectURL(e),n=document.createElement(`video`);return new Promise(e=>{n.addEventListener(`canplay`,()=>{n.pause(),e({source:n,naturalWidth:n.videoWidth,naturalHeight:n.videoHeight}),URL.revokeObjectURL(t)},{once:!0}),n.muted=!0,n.autoplay=!0,n.playsInline=!0,n.src=t,n.style.opacity=`0`,n.style.pointerEvents=`none`,document.body.appendChild(n)})},eT=async e=>e.type.startsWith(`video/`)?$w({blob:e}):Qw({blob:e}),tT=async(e,{format:t=`png`,quality:n=85,width:r=void 0,height:i=void 0,fit:a=`scale-down`}={})=>{let o,s=0,c=0;try{o=await createImageBitmap(e),{width:s,height:c}=o}catch{({source:o,naturalWidth:s,naturalHeight:c}=await eT(e))}r??=s,i??=c;let l=new OffscreenCanvas(512,512),u=l.getContext(`2d`);return Xw(l,{width:s,height:c},{fit:a,width:r,height:i}),u.drawImage(o,0,0,l.width,l.height),o instanceof HTMLVideoElement&&document.body.removeChild(o),qw(l,{format:t,quality:n})},nT=async e=>{let t=await e.text();try{let{optimize:n}=await Pw(`svgo`,`dist/svgo.browser.js`),{data:r}=n(t);return new Blob([r],{type:e.type})}catch{}return e}})),iT,aT,oT,sT,cT,lT,hre=o((()=>{Fw(),Jw(),Zw(),Mw(),iT=Nw(`pdfjs-dist`),aT=`${iT}/build/pdf.min.mjs`,oT=`${iT}/build/pdf.worker.min.mjs`,sT={isEvalSupported:!1,disableAutoFetch:!0,cMapUrl:`${iT}/cmaps/`,iccUrl:`${iT}/iccs/`,standardFontDataUrl:`${iT}/standard_fonts/`,wasmUrl:`${iT}/wasm/`},lT=async(e,{format:t=`png`,quality:n=85,width:r=void 0,height:i=void 0,fit:a=`scale-down`}={})=>{if(!cT)try{cT=await jw(()=>import(aT),[]),cT.GlobalWorkerOptions.workerSrc=oT}catch{throw Error(`Failed to load PDF.js library`)}let o=URL.createObjectURL(e),s=new OffscreenCanvas(512,512),c=s.getContext(`2d`);try{let e=await(await cT.getDocument({...sT,url:o}).promise).getPage(1),t=e.getViewport({scale:1}),{scale:n}=Xw(s,{width:t.width,height:t.height},{width:r,height:i,fit:a});await e.render({canvasContext:c,viewport:n===1?t:e.getViewport({scale:n})}).promise,URL.revokeObjectURL(o)}catch{throw Error(`Failed to render PDF`)}return qw(s,{format:t,quality:n})}})),uT,dT,fT,pT,mT,hT,gT,_T,vT=o((()=>{kp(),tS(),mS(),gp(),ES(),Zf(),pF(),Rp(),dP(),VP(),dw(),SC(),QC(),rT(),hre(),uT=new Set,dT=async(e,t=0)=>{let{file:n,handle:r,blobURL:i,name:a,path:o}=e;if(i)return fetch(i).then(e=>e.blob());let s;if(n)s=n;else if(r)try{s=await r.getFile()}catch{throw Error(`Failed to retrieve blob from file handle`)}else{if(uT.has(o)&&t<=25)return await eS(200),dT(e,t+1);uT.add(o);let n=await A(lP)?.fetchBlob?.(e);if(!n)throw Error(`Failed to retrieve blob`);s=new Blob([n],{type:TS.getType(a)??n.type})}return e.blobURL=URL.createObjectURL(s),uT.delete(o),s},fT=async e=>(e.blobURL||await dT(e),e.blobURL),pT=void 0,mT=async(e,{cacheOnly:t=!1}={})=>{let n=e.name.endsWith(`.pdf`);if(!([`image`,`video`].includes(e.kind)||n))return;if(pT===void 0){let{databaseName:e}=A(lP)?.repository??{};pT=e?new dS(e,`asset-thumbnails`):null}let r=await pT?.get(e.sha);if(!r){if(t)return;let i=await dT(e),a={format:`webp`,quality:85,width:512,height:512,fit:`contain`};r=n?await lT(i,a):await tT(i,a),await pT?.set(e.sha,r)}return URL.createObjectURL(r)},hT=(e,{pathOnly:t=!1,allowSpecial:n=!1,entry:r=void 0}={})=>{let{publicPath:i,entryRelative:a,hasTemplateTags:o}=e.folder.collectionName===void 0?e.folder:Ip(e.path).find(({collectionName:e})=>e!==void 0)??A(jp);if(a){if(t){let t=xp(e.path).dirname,n=r?xp(Object.values(r.locales)[0].path).dirname:void 0;if(t!==void 0&&n!==void 0){if(t===n)return e.name;let r=`${n}/`;return e.path.startsWith(r)?e.path.slice(r.length):void 0}let{internalPath:i,internalSubPath:a}=e.folder;if(e.path===JC([i,a,e.name]))return e.path.slice(i.length+1)}return}let{_baseURL:s=``,output:{encode_file_path:c=!1}={}}=A(IP),l=o?e.path.replace(VC(e.folder.internalPath??``,e=>{let t=e.match(/{{(?<tag>.+?)}}/)?.groups?.tag;return t?`(?<${t}>[^/]+)`:up(e)}),i?.replaceAll(/{{(.+?)}}/g,`$<$1>`)??``):e.path.replace(e.folder.internalPath??``,i===`/`?``:i??``);if(c&&(l=HC(l)),!(!l.startsWith(`/`)&&!n))return t?l:`${s}${l}`},gT=e=>{if(lw.cloudinary?.isEnabled?.()){let t=xC(e);if(t.output_filename_only&&t.config?.cloud_name)return`https://res.cloudinary.com/${t.config.cloud_name}`}},_T=async({value:e,entry:t,collectionName:n,fileName:r,fieldConfig:i,typedKeyPath:a,thumbnail:o=!1})=>{if(!e)return;if(/^(?:https?|data|blob):/.test(e))return e;if(lF(e)){let t=gT(i);if(t)return`${t}/${e}`}let s=uF({value:e,entry:t,collectionName:n,fileName:r,typedKeyPath:a});if(s)return(o?await mT(s):await fT(s))??hT(s)}})),yT,bT,xT,ST,CT,wT,TT,ET,DT,OT=o((()=>{Bp(),yT=l(BS(),1),bT=l(VS(),1),xT=l(HS(),1),ST=l(US(),1),Zf(),dP(),KP(),VP(),Yy(),$b(),ub(),lC(),yT.default.extend(bT.default),yT.default.extend(xT.default),yT.default.extend(ST.default),CT=/{{(?:year|month|day|hour|minute|second)}}/,wT=e=>Jy(Object.values(e.locales)[0].path).map(({collectionName:e})=>Xb(e)).filter(e=>!!e),TT=({dateFieldName:e,fields:t,content:n})=>{let r=e?t.find(({widget:t,name:n})=>t===`datetime`&&n===e):t.find(({widget:e})=>e===`datetime`),i=r?n[r.name]:void 0;if(!r||!i)return;let a=r,{picker_utc:o=!1}=a,s=iC(i,a);if(nC(s))return zp({date:s,timeZone:o?`UTC`:void 0})},ET=(e,t,n,r)=>{let{show_preview_links:i=!0,_baseURL:a}=A(IP)??{},{slug:o,path:s,content:c}=e.locales[t]??{},{preview_path:l,preview_path_date_field:u,fields:d=[],_i18n:{defaultLocale:f,omitDefaultLocaleFromPreviewPath:p}}=r??n;if(!i||!a||!s||!c||!l)return;let m=lb(n,e),h=(m?cb(n):void 0)?.fields??d,g;if(CT.test(l)&&(g=TT({dateFieldName:u,fields:h,content:c}),!g))return;let _=l;t===f&&p&&(_=_.replace(/{{locale}}[./]/,``));try{let e=GP(_,{type:`preview_path`,collection:n,content:c,locale:t,currentSlug:o,entryFilePath:s,dateTimeParts:g,isIndexFile:m});return`${a.replace(/\/$/,``)}/${e.replace(/^\//,``)}`}catch{return}},DT=(e,t)=>`${A(lP)?.repository?.blobBaseURL}/${e.locales[t]?.path}?plain=1`})),kT,AT,jT=o((()=>{kT=/^\/?(?<pattern>.+?)(?:\/(?<flags>[dgimsuy]*))?$/,AT=e=>{if(e instanceof RegExp)return e;if(typeof e==`string`){let{pattern:t,flags:n}=e.match(kT)?.groups??{};if(t)try{return new RegExp(t,n)}catch{}}}})),MT,NT,PT,FT,IT,LT,RT,zT=o((()=>{Zf(),vT(),VP(),Yy(),$b(),rb(),ub(),OT(),$k(),jT(),MT=/!\[.*?\]\((.+?)(?:\s+".*?")?\)/g,NT=rn([]),PT=an(NT,e=>new Set(e.map(e=>e.id))),FT=e=>{let t=Xb(e);if(!t)return[];let{_type:n,_i18n:{defaultLocale:r}}=t,{filter:i}=n===`entry`?t:{},a=i?.field,o=AT(i?.pattern),s=i?.value===void 0?[]:Array.isArray(i.value)?i.value:[i.value],c;if(n===`entry`){let n=t._file?.fullPathRegEx;c=n?e=>n.test(Object.values(e.locales)[0]?.path??``):t=>wT(t).some(({name:t})=>t===e)}else{let t=new Set(A(Uy).filter(({collectionName:t})=>t===e).flatMap(({filePathMap:e})=>e?Object.values(e):[]));c=e=>{let n=Object.values(e.locales)[0]?.path;return!!n&&t.has(n)}}return A(Wy).filter(t=>{if(!c(t))return!1;if(!a)return!0;let n=Qk({entry:t,locale:r,collectionName:e,key:a})??null;return o?o.test(n):s.includes(n)})},IT=async({assetURL:e,newURL:t,collectionName:n,entry:r,content:i,keyPath:a,value:o,isIndexFile:s,collectionFile:c})=>{let l=c?.name,u=Kk({collectionName:n,fileName:l,valueMap:i,keyPath:a,isIndexFile:s});if(!u)return!1;let d=e.startsWith(`blob:`),f={entry:r,collectionName:n,fileName:l},{widget:p=`string`}=u;if([`image`,`file`].includes(p)){let n=d?await _T({...f,value:o})===e:o===e;return n&&t&&(i[a]=t),n}if([`richtext`,`markdown`].includes(p)){let n=[...o.matchAll(MT)];if(n.length)return(await Promise.all(n.map(async([,n])=>{let r=(d?await _T({...f,value:n}):n)===e;return r&&t&&(i[a]=i[a].replace(n,t)),r}))).some(Boolean)}return!1},LT=async(e,{entries:t=A(Wy),newURL:n=``}={})=>{let r=A(IP)?._baseURL,i=r&&!e.startsWith(`blob:`)?e.replace(r,``):e,a=i.startsWith(`blob:`),o=!!n,s=await Promise.all(t.map(async e=>{let{locales:t}=e,r=wT(e),s=!1;for(let{content:c}of Object.values(t)){for(let[t,l]of Object.entries(c))if(!(typeof l!=`string`||!l)&&!(!a&&!l.includes(i))){for(let a of r){let r={assetURL:i,newURL:n,collectionName:a.name,entry:e,content:c,keyPath:t,value:l,isIndexFile:lb(a,e)},u=eb(a,e),d;if(d=u.length?(await Promise.all(u.map(e=>IT({...r,collectionFile:e})))).includes(!0):await IT({...r}),d&&(s=!0,!o))break}if(s&&!o)break}if(s&&!o)break}return s}));return t.filter((e,t)=>s[t])},RT=e=>{let t=cb(e);return t?!FT(e.name).some(({slug:e})=>e===t.name):!1}}));function BT(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return $T(e,t,n)}}function gre(e){return function(){return eE(e,[...arguments])}}function VT(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sE;if(KT&&KT(e,null),!oE(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(qT(t)||(t[r]=e),i=e)}e[i]=!0}return e}function _re(e){for(let t=0;t<e.length;t++)_E(e,t)||(e[t]=null);return e}function HT(e){let t=QT(null);for(let[n,r]of GT(e))_E(e,n)&&(oE(r)?t[n]=_re(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=HT(r):t[n]=r);return t}function vre(e){switch(typeof e){case`string`:return e;case`number`:return pE(e);case`boolean`:return mE(e);case`bigint`:return hE?hE(e):`0`;case`symbol`:return gE?gE(e):`Symbol()`;case`undefined`:return vE(e);case`function`:case`object`:{if(e===null)return vE(e);let t=e,n=UT(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:vE(e)}return vE(e)}default:return vE(e)}}function UT(e,t){for(;e!==null;){let n=YT(e,t);if(n){if(n.get)return BT(n.get);if(typeof n.value==`function`)return BT(n.value)}e=JT(e)}function n(){return null}return n}function yre(e){try{return yE(e,``),!0}catch{return!1}}function WT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:WE(),t=e=>WT(e);if(t.version=`3.4.1`,t.removed=[],!e||!e.document||e.document.nodeType!==UE.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=UT(m,`cloneNode`),g=UT(m,`remove`),_=UT(m,`nextSibling`),v=UT(m,`childNodes`),y=UT(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:ee}=r,te=KE();t.isSupported=typeof GT==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ne,ERB_EXPR:re,TMPLIT_EXPR:ie,DATA_ATTR:ae,ARIA_ATTR:oe,IS_SCRIPT_OR_DATA:se,ATTR_WHITESPACE:ce,CUSTOM_ELEMENT:le}=HE,{IS_ALLOWED_URI:ue}=HE,de=null,E=VT({},[...xE,...SE,...CE,...TE,...DE]),fe=null,pe=VT({},[...OE,...kE,...AE,...jE]),me=Object.seal(QT(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),he=null,ge=null,_e=Object.seal(QT(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ve=!0,ye=!0,be=!1,xe=!0,Se=!1,Ce=!0,we=!1,Te=!1,Ee=!1,De=!1,Oe=!1,ke=!1,Ae=!0,je=!1,Me=`user-content-`,Ne=!0,Pe=!1,Fe={},Ie=null,Le=VT({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),Re=null,ze=VT({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Be=null,Ve=VT({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),He=`http://www.w3.org/1998/Math/MathML`,Ue=`http://www.w3.org/2000/svg`,We=`http://www.w3.org/1999/xhtml`,Ge=We,Ke=!1,qe=null,Je=VT({},[He,Ue,We],cE),Ye=VT({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Xe=VT({},[`annotation-xml`]),Ze=VT({},[`title`,`style`,`font`,`a`,`script`]),Qe=null,$e=[`application/xhtml+xml`,`text/html`],et=null,tt=null,nt=n.createElement(`form`),rt=function(e){return e instanceof RegExp||e instanceof Function},it=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(tt&&tt===e)return;(!e||typeof e!=`object`)&&(e={}),e=HT(e),Qe=$e.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,et=Qe===`application/xhtml+xml`?cE:sE,de=_E(e,`ALLOWED_TAGS`)&&oE(e.ALLOWED_TAGS)?VT({},e.ALLOWED_TAGS,et):E,fe=_E(e,`ALLOWED_ATTR`)&&oE(e.ALLOWED_ATTR)?VT({},e.ALLOWED_ATTR,et):pe,qe=_E(e,`ALLOWED_NAMESPACES`)&&oE(e.ALLOWED_NAMESPACES)?VT({},e.ALLOWED_NAMESPACES,cE):Je,Be=_E(e,`ADD_URI_SAFE_ATTR`)&&oE(e.ADD_URI_SAFE_ATTR)?VT(HT(Ve),e.ADD_URI_SAFE_ATTR,et):Ve,Re=_E(e,`ADD_DATA_URI_TAGS`)&&oE(e.ADD_DATA_URI_TAGS)?VT(HT(ze),e.ADD_DATA_URI_TAGS,et):ze,Ie=_E(e,`FORBID_CONTENTS`)&&oE(e.FORBID_CONTENTS)?VT({},e.FORBID_CONTENTS,et):Le,he=_E(e,`FORBID_TAGS`)&&oE(e.FORBID_TAGS)?VT({},e.FORBID_TAGS,et):HT({}),ge=_E(e,`FORBID_ATTR`)&&oE(e.FORBID_ATTR)?VT({},e.FORBID_ATTR,et):HT({}),Fe=_E(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?HT(e.USE_PROFILES):e.USE_PROFILES:!1,ve=e.ALLOW_ARIA_ATTR!==!1,ye=e.ALLOW_DATA_ATTR!==!1,be=e.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=e.SAFE_FOR_TEMPLATES||!1,Ce=e.SAFE_FOR_XML!==!1,we=e.WHOLE_DOCUMENT||!1,De=e.RETURN_DOM||!1,Oe=e.RETURN_DOM_FRAGMENT||!1,ke=e.RETURN_TRUSTED_TYPE||!1,Ee=e.FORCE_BODY||!1,Ae=e.SANITIZE_DOM!==!1,je=e.SANITIZE_NAMED_PROPS||!1,Ne=e.KEEP_CONTENT!==!1,Pe=e.IN_PLACE||!1,ue=yre(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:LE,Ge=typeof e.NAMESPACE==`string`?e.NAMESPACE:We,Ye=_E(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?HT(e.MATHML_TEXT_INTEGRATION_POINTS):VT({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Xe=_E(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?HT(e.HTML_INTEGRATION_POINTS):VT({},[`annotation-xml`]);let t=_E(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?HT(e.CUSTOM_ELEMENT_HANDLING):QT(null);if(me=QT(null),_E(t,`tagNameCheck`)&&rt(t.tagNameCheck)&&(me.tagNameCheck=t.tagNameCheck),_E(t,`attributeNameCheck`)&&rt(t.attributeNameCheck)&&(me.attributeNameCheck=t.attributeNameCheck),_E(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(me.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Se&&(ye=!1),Oe&&(De=!0),Fe&&(de=VT({},DE),fe=QT(null),Fe.html===!0&&(VT(de,xE),VT(fe,OE)),Fe.svg===!0&&(VT(de,SE),VT(fe,kE),VT(fe,jE)),Fe.svgFilters===!0&&(VT(de,CE),VT(fe,kE),VT(fe,jE)),Fe.mathMl===!0&&(VT(de,TE),VT(fe,AE),VT(fe,jE))),_e.tagCheck=null,_e.attributeCheck=null,_E(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?_e.tagCheck=e.ADD_TAGS:oE(e.ADD_TAGS)&&(de===E&&(de=HT(de)),VT(de,e.ADD_TAGS,et))),_E(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?_e.attributeCheck=e.ADD_ATTR:oE(e.ADD_ATTR)&&(fe===pe&&(fe=HT(fe)),VT(fe,e.ADD_ATTR,et))),_E(e,`ADD_URI_SAFE_ATTR`)&&oE(e.ADD_URI_SAFE_ATTR)&&VT(Be,e.ADD_URI_SAFE_ATTR,et),_E(e,`FORBID_CONTENTS`)&&oE(e.FORBID_CONTENTS)&&(Ie===Le&&(Ie=HT(Ie)),VT(Ie,e.FORBID_CONTENTS,et)),_E(e,`ADD_FORBID_CONTENTS`)&&oE(e.ADD_FORBID_CONTENTS)&&(Ie===Le&&(Ie=HT(Ie)),VT(Ie,e.ADD_FORBID_CONTENTS,et)),Ne&&(de[`#text`]=!0),we&&VT(de,[`html`,`head`,`body`]),de.table&&(VT(de,[`tbody`]),delete he.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw bE(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw bE(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=GE(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));XT&&XT(e),tt=e},at=VT({},[...SE,...CE,...wE]),ot=VT({},[...TE,...EE]),st=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:Ge,tagName:`template`});let n=sE(e.tagName),r=sE(t.tagName);return qe[e.namespaceURI]?e.namespaceURI===Ue?t.namespaceURI===We?n===`svg`:t.namespaceURI===He?n===`svg`&&(r===`annotation-xml`||Ye[r]):!!at[n]:e.namespaceURI===He?t.namespaceURI===We?n===`math`:t.namespaceURI===Ue?n===`math`&&Xe[r]:!!ot[n]:e.namespaceURI===We?t.namespaceURI===Ue&&!Xe[r]||t.namespaceURI===He&&!Ye[r]?!1:!ot[n]&&(Ze[n]||!at[n]):!!(Qe===`application/xhtml+xml`&&qe[e.namespaceURI]):!1},ct=function(e){iE(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},lt=function(e,n){try{iE(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{iE(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(De||Oe)try{ct(n)}catch{}else try{n.setAttribute(e,``)}catch{}},ut=function(e){let t=null,r=null;if(Ee)e=`<remove></remove>`+e;else{let t=lE(e,/^[\r\n\t ]+/);r=t&&t[0]}Qe===`application/xhtml+xml`&&Ge===We&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(Ge===We)try{t=new f().parseFromString(i,Qe)}catch{}if(!t||!t.documentElement){t=S.createDocument(Ge,`template`,null);try{t.documentElement.innerHTML=Ke?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ge===We?T.call(t,we?`html`:`body`)[0]:we?t.documentElement:a},D=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},dt=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},ft=function(e){return typeof s==`function`&&e instanceof s};function pt(e,n,r){tE(e,e=>{e.call(t,n,r,tt)})}let mt=function(e){let n=null;if(pt(te.beforeSanitizeElements,e,null),dt(e))return ct(e),!0;let r=et(e.nodeName);if(pt(te.uponSanitizeElement,e,{tagName:r,allowedTags:de}),Ce&&e.hasChildNodes()&&!ft(e.firstElementChild)&&yE(/<[/\w!]/g,e.innerHTML)&&yE(/<[/\w!]/g,e.textContent)||Ce&&e.namespaceURI===We&&r===`style`&&ft(e.firstElementChild)||e.nodeType===UE.progressingInstruction||Ce&&e.nodeType===UE.comment&&yE(/<[/\w]/g,e.data))return ct(e),!0;if(he[r]||!(_e.tagCheck instanceof Function&&_e.tagCheck(r))&&!de[r]){if(!he[r]&&_t(r)&&(me.tagNameCheck instanceof RegExp&&yE(me.tagNameCheck,r)||me.tagNameCheck instanceof Function&&me.tagNameCheck(r)))return!1;if(Ne&&!Ie[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);t.insertBefore(r,_(e))}}}return ct(e),!0}return e instanceof c&&!st(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&yE(/<\/no(script|embed|frames)/i,e.innerHTML)?(ct(e),!0):(Se&&e.nodeType===UE.text&&(n=e.textContent,tE([ne,re,ie],e=>{n=uE(n,e,` `)}),e.textContent!==n&&(iE(t.removed,{element:e.cloneNode()}),e.textContent=n)),pt(te.afterSanitizeElements,e,null),!1)},ht=function(e,t,r){if(ge[t]||Ae&&(t===`id`||t===`name`)&&(r in n||r in nt))return!1;if(!(ye&&!ge[t]&&yE(ae,t))&&!(ve&&yE(oe,t))&&!(_e.attributeCheck instanceof Function&&_e.attributeCheck(t,e))){if(!fe[t]||ge[t]){if(!(_t(e)&&(me.tagNameCheck instanceof RegExp&&yE(me.tagNameCheck,e)||me.tagNameCheck instanceof Function&&me.tagNameCheck(e))&&(me.attributeNameCheck instanceof RegExp&&yE(me.attributeNameCheck,t)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(t,e))||t===`is`&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&yE(me.tagNameCheck,r)||me.tagNameCheck instanceof Function&&me.tagNameCheck(r))))return!1}else if(!Be[t]&&!yE(ue,uE(r,ce,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&dE(r,`data:`)===0&&Re[e])&&!(be&&!yE(se,uE(r,ce,``)))&&r)return!1}return!0},gt=VT({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),_t=function(e){return!gt[sE(e)]&&yE(le,e)},vt=function(e){pt(te.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||dt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:fe,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=et(a),l=s,u=a===`value`?l:fE(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,pt(te.uponSanitizeAttribute,e,r),u=r.attrValue,je&&(c===`id`||c===`name`)&&dE(u,Me)!==0&&(lt(a,e),u=Me+u),Ce&&yE(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){lt(a,e);continue}if(c===`attributename`&&lE(u,`href`)){lt(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){lt(a,e);continue}if(!xe&&yE(/\/>/i,u)){lt(a,e);continue}Se&&tE([ne,re,ie],e=>{u=uE(u,e,` `)});let d=et(e.nodeName);if(!ht(d,c,u)){lt(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),dt(e)?ct(e):rE(t.removed)}catch{lt(a,e)}}pt(te.afterSanitizeAttributes,e,null)},yt=function(e){let t=null,n=D(e);for(pt(te.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)pt(te.uponSanitizeShadowNode,t,null),mt(t),vt(t),t.content instanceof a&&yt(t.content);pt(te.afterSanitizeShadowDOM,e,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(Ke=!e,Ke&&(e=`<!-->`),typeof e!=`string`&&!ft(e)&&(e=vre(e),typeof e!=`string`))throw bE(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(Te||it(n),t.removed=[],typeof e==`string`&&(Pe=!1),Pe){let t=e.nodeName;if(typeof t==`string`){let e=et(t);if(!de[e]||he[e])throw bE(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=ut(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===UE.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!De&&!Se&&!we&&e.indexOf(`<`)===-1)return b&&ke?b.createHTML(e):e;if(i=ut(e),!i)return De?null:ke?x:``}i&&Ee&&ct(i.firstChild);let u=D(Pe?e:i);for(;c=u.nextNode();)mt(c),vt(c),c.content instanceof a&&yt(c.content);if(Pe)return e;if(De){if(Se){i.normalize();let e=i.innerHTML;tE([ne,re,ie],t=>{e=uE(e,t,` `)}),i.innerHTML=e}if(Oe)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(fe.shadowroot||fe.shadowrootmode)&&(l=ee.call(r,l,!0)),l}let d=we?i.outerHTML:i.innerHTML;return we&&de[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&yE(BE,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
169
+ `),b=await CC(await CC(await CC(await CC(await CC(`AWS4${a}`,d),o),s),`aws4_request`),y),x=Array.from(b).map(e=>e.toString(16).padStart(2,`0`)).join(``);return[`${_} Credential=${i}/${v},`,`SignedHeaders=${h}, Signature=${x}`].join(` `)},TC=async({method:e,url:t,config:n,secretAccessKey:r,body:i=``,extraHeaders:a={}})=>{let{access_key_id:o,region:s=`us-east-1`}=n,c=new Date,l=new URL(t),u=await wC(i),d={Host:l.host,"x-amz-date":c.toISOString().replace(/[:-]|\.\d{3}/g,``),"x-amz-content-sha256":u,...a},f=await Jne({method:e,url:t,headers:d,payloadHash:u,accessKeyId:o,secretAccessKey:r,region:s,service:`s3`,date:c});return fetch(t,{method:e,headers:{...d,Authorization:f},...i&&{body:i}})},Yne=e=>{let t=new DOMParser().parseFromString(e,`text/xml`),n=e=>{if(e.children.length===0)return e.textContent;let t={};return Array.from(e.children).forEach(e=>{let r=e.tagName,i=n(e);t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i}),t};return n(t.documentElement)},Xne=({bucket:e,key:t,endpoint:n,region:r,forcePathStyle:i,publicUrl:a})=>a?`${a}/${t}`:n?`${n}/${e}/${t}`:i?`https://s3.${r}.amazonaws.com/${e}/${t}`:`https://${e}.s3.${r}.amazonaws.com/${t}`,EC=(e,t)=>{let{bucket:n,region:r,endpoint:i,force_path_style:a,prefix:o=``,public_url:s}=t;return e.map(e=>{let t=e.Key,c=t.split(`/`).pop()||t,l=o&&t.startsWith(o)?t.slice(o.length):t,u=Xne({bucket:n,key:t,endpoint:i,region:r,forcePathStyle:a,publicUrl:s});return{id:t,description:l,previewURL:u,downloadURL:u,fileName:c,lastModified:new Date(e.LastModified),size:Number(e.Size),kind:FS(t)}})},DC=async(e,t,{maxPages:n=10}={})=>{let{bucket:r,region:i,endpoint:a,force_path_style:o,prefix:s=``}=e,{kind:c,apiKey:l}=t;if(!l)return Promise.reject(Error(`S3 secret access key is required`));let u=[],d;for(let t=0;t<n;t+=1){let t=new URLSearchParams({"list-type":`2`,"max-keys":`1000`,...s&&{prefix:s},...d&&{"continuation-token":d}}),n=await TC({method:`GET`,url:a?`${a}/${r}?${t}`:o?`https://s3.${i}.amazonaws.com/${r}?${t}`:`https://${r}.s3.${i}.amazonaws.com/?${t}`,config:e,secretAccessKey:l});if(!n.ok){let e=await n.text();return Promise.reject(Error(`Failed to list objects: ${e}`))}let c=Yne(await n.text()),f=(c.Contents?Array.isArray(c.Contents)?c.Contents:[c.Contents]:[]).filter(e=>!e.Key.endsWith(`/`));if(u.push(...f),d=c.NextContinuationToken,c.IsTruncated!==`true`||!d)break;await eS(50)}return EC(c?u.filter(e=>FS(e.Key)===c):u,e)},OC=async(e,t,n)=>{let r=await DC(t,n,{maxPages:5}),i=e.toLowerCase();return r.filter(e=>e.fileName.toLowerCase().includes(i)||e.description.toLowerCase().includes(i))},kC=async(e,t,n)=>{if(e.length===0)return[];let{bucket:r,region:i,endpoint:a,force_path_style:o,prefix:s=``}=t,{apiKey:c}=n;if(!c)return Promise.reject(Error(`S3 secret access key is required`));let l=[];for(let n of e){let u=n.name.split(/[/\\]/).filter(Boolean).at(-1)??n.name,d=s?`${s}${u}`:u,f=await TC({method:`PUT`,url:a?`${a}/${r}/${d}`:o?`https://s3.${i}.amazonaws.com/${r}/${d}`:`https://${r}.s3.${i}.amazonaws.com/${d}`,config:t,secretAccessKey:c,body:await n.arrayBuffer(),extraHeaders:{"Content-Type":n.type||`application/octet-stream`,"x-amz-acl":`public-read`}});if(!f.ok){let e=await f.text();throw Error(`Failed to upload file ${n.name}: ${e}`)}l.push({Key:d,LastModified:new Date().toISOString(),ETag:``,Size:n.size,ContentType:n.type}),e.length>1&&await eS(50)}return EC(l,t)}})),jC,Zne,Qne,$ne,ere,tre,nre=o((()=>{Zf(),VP(),AC(),jC=(e=A(IP))=>e?.media_libraries?.aws_s3??(e?.media_library?.name===`aws_s3`?e?.media_library:void 0),Zne=e=>{let t=jC(e)??jC();return!!(t&&t.access_key_id&&t.bucket&&t.region)},Qne=async e=>{let{fieldConfig:t}=e,n=jC(t)??jC();return n?DC(n,e):Promise.reject(Error(`Amazon S3 configuration is not available`))},$ne=async(e,t)=>{let{fieldConfig:n}=t,r=jC(n)??jC();return r?OC(e,r,t):Promise.reject(Error(`Amazon S3 configuration is not available`))},ere=async(e,t)=>{let{fieldConfig:n}=t,r=jC(n)??jC();return r?kC(e,r,t):Promise.reject(Error(`Amazon S3 configuration is not available`))},tre={serviceType:`cloud_storage`,serviceId:`aws_s3`,serviceLabel:`Amazon S3`,serviceURL:`https://aws.amazon.com/s3/`,showServiceLink:!0,hotlinking:!0,authType:`api_key`,developerURL:`https://docs.aws.amazon.com/s3/`,apiKeyURL:`https://console.aws.amazon.com/iam/home#/security_credentials`,apiKeyPattern:/^[A-Za-z0-9/+=]{40}$/,isEnabled:Zne,list:Qne,search:$ne,upload:ere}})),MC,rre,ire,are,ore,NC,sre=o((()=>{Zf(),VP(),AC(),MC=(e=A(IP))=>e?.media_libraries?.cloudflare_r2??(e?.media_library?.name===`cloudflare_r2`?e?.media_library:void 0),rre=e=>{let t=MC(e)??MC();return!!(t&&t.access_key_id&&t.bucket&&t.account_id)},ire=async e=>{let{fieldConfig:t}=e,n=MC(t)??MC();return n?DC({...n,region:`auto`,endpoint:`https://${n.account_id}.r2.cloudflarestorage.com`},e):Promise.reject(Error(`Cloudflare R2 configuration is not available`))},are=async(e,t)=>{let{fieldConfig:n}=t,r=MC(n)??MC();return r?OC(e,{...r,region:`auto`,endpoint:`https://${r.account_id}.r2.cloudflarestorage.com`},t):Promise.reject(Error(`Cloudflare R2 configuration is not available`))},ore=async(e,t)=>{let{fieldConfig:n}=t,r=MC(n)??MC();return r?kC(e,{...r,region:`auto`,endpoint:`https://${r.account_id}.r2.cloudflarestorage.com`},t):Promise.reject(Error(`Cloudflare R2 configuration is not available`))},NC={serviceType:`cloud_storage`,serviceId:`cloudflare_r2`,serviceLabel:`Cloudflare R2`,serviceURL:`https://www.cloudflare.com/developer-platform/r2/`,showServiceLink:!0,hotlinking:!0,authType:`api_key`,developerURL:`https://developers.cloudflare.com/r2/`,apiKeyURL:`https://dash.cloudflare.com/?to=/:account/r2/api-tokens`,apiKeyPattern:/^[A-Za-z0-9/+=]{40,}$/,isEnabled:rre,list:ire,search:are,upload:ore}})),PC,FC,IC,LC,RC,zC,cre=o((()=>{Zf(),VP(),AC(),PC=(e=A(IP))=>e?.media_libraries?.digitalocean_spaces??(e?.media_library?.name===`digitalocean_spaces`?e?.media_library:void 0),FC=e=>{let t=PC(e)??PC();return!!(t&&t.access_key_id&&t.bucket&&t.region)},IC=async e=>{let{fieldConfig:t}=e,n=PC(t)??PC();return n?DC({...n,endpoint:`https://${n.region}.digitaloceanspaces.com`,public_url:n.public_url??`https://${n.bucket}.${n.region}.digitaloceanspaces.com`},e):Promise.reject(Error(`DigitalOcean Spaces configuration is not available`))},LC=async(e,t)=>{let{fieldConfig:n}=t,r=PC(n)??PC();return r?OC(e,{...r,endpoint:`https://${r.region}.digitaloceanspaces.com`,public_url:r.public_url??`https://${r.bucket}.${r.region}.digitaloceanspaces.com`},t):Promise.reject(Error(`DigitalOcean Spaces configuration is not available`))},RC=async(e,t)=>{let{fieldConfig:n}=t,r=PC(n)??PC();return r?kC(e,{...r,endpoint:`https://${r.region}.digitaloceanspaces.com`,public_url:r.public_url??`https://${r.bucket}.${r.region}.digitaloceanspaces.com`},t):Promise.reject(Error(`DigitalOcean Spaces configuration is not available`))},zC={serviceType:`cloud_storage`,serviceId:`digitalocean_spaces`,serviceLabel:`DigitalOcean Spaces`,serviceURL:`https://www.digitalocean.com/products/spaces`,showServiceLink:!0,hotlinking:!0,authType:`api_key`,developerURL:`https://docs.digitalocean.com/products/spaces/`,apiKeyURL:`https://cloud.digitalocean.com/account/api/spaces`,apiKeyPattern:/^[A-Za-z0-9/+=]{43}$/,isEnabled:FC,list:IC,search:LC,upload:RC}})),lre=s(((e,t)=>{function n(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}t.exports=function(e,t,i){if(typeof t!=`string`)throw Error(`Input must be string`);for(var a=t.length,o=0,s,c,l=0;l<a;l+=1){if(s=t.charCodeAt(l),c=t[l],n(s)&&r(t.charCodeAt(l+1))&&(l+=1,c+=t[l]),o+=e(c),o===i)return t.slice(0,l+1);if(o>i)return t.slice(0,l-c.length+1)}return t}})),ure=s(((e,t)=>{function n(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}t.exports=function(e){if(typeof e!=`string`)throw Error(`Input must be string`);for(var t=e.length,i=0,a=null,o=null,s=0;s<t;s++)a=e.charCodeAt(s),r(a)?o!=null&&n(o)?i+=1:i+=3:a<=127?i+=1:a>=128&&a<=2047?i+=2:a>=2048&&a<=65535&&(i+=3),o=a;return i}})),dre=s(((e,t)=>{var n=lre(),r=ure();t.exports=n.bind(null,r)})),fre=s(((e,t)=>{var n=dre(),r=/[\/\?<>\\:\*\|"]/g,i=/[\x00-\x1f\x80-\x9f]/g,a=/^\.+$/,o=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;function s(e,t){for(var n=e.length;n>0&&(e[n-1]===`.`||e[n-1]===` `);)n--;return n<e.length?e.slice(0,n)+t:e}function c(e,t){if(typeof e!=`string`)throw Error(`Input must be string`);var c=e.replace(r,t).replace(i,t).replace(a,t).replace(o,t);return c=s(c,t),n(c,255)}t.exports=function(e,t){var n=t&&t.replacement||``,r=c(e,n);return n===``?r:c(r,``)}})),BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC=o((()=>{Z(),lp(),kp(),gp(),BC=l(fre(),1),UP(),VC=(e,t)=>RegExp(`^${e.split(`/`).map(t).join(`\\/`)}(?=\\/|$)`),HC=e=>{let t=e.startsWith(`@`);return t&&(e=e.slice(1)),e=e.split(`/`).map(e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)).join(`/`),t?`@${e}`:e},UC=e=>decodeURIComponent(e),WC=new Map,GC=e=>{let t=Lh.current,n=WC.get(t);n||(n=new Intl.NumberFormat(t,{maximumFractionDigits:1}),WC.set(t,n));let r=1e3,i=r*1e3,a=i*1e3,o=a*1e3;return e<r?X(`file_size_units.b`,{values:{size:n.format(e)}}):e<i?X(`file_size_units.kb`,{values:{size:n.format(e/r)}}):e<a?X(`file_size_units.mb`,{values:{size:n.format(e/i)}}):e<o?X(`file_size_units.gb`,{values:{size:n.format(e/a)}}):X(`file_size_units.tb`,{values:{size:n.format(e/o)}})},KC=(e,t)=>{if(!t.length)return e;let{filename:n,extension:r}=xp(e),i=RegExp(`^${up(n)}(?:-(?<num>\\d+?))?${r?`\\.${r}`:``}$`),a=t.sort((e,t)=>hp(e.split(`.`)[0],t.split(`.`)[0])).findLast(e=>i.test(e));return a?`${n}-${Number(a.match(i)?.groups?.num??0)+1}${r?`.${r}`:``}`:e},qC=(e,{slugificationEnabled:t=!1,assetNamesInSameFolder:n=[]}={})=>{let r=(0,BC.default)(e.normalize().replace(/[\s\u00A0\u202F]+/g,` `));if(t){let{filename:e,extension:t}=xp(r);r=`${HP(e)}${t?`.${t.toLowerCase()}`:``}`}return KC(r,n)},JC=e=>e.filter(Boolean).join(`/`),YC=e=>{let t=e.split(`/`),n=!1;return t.forEach((e,r)=>{if(e===`.`||e===`..`){if(n&&(t[r]=null,e===`..`)){let e=t.findLastIndex((e,t)=>!!e&&t<r);e>-1&&(t[e]=null)}}else n=!0}),JC(t)},XC=e=>typeof e==`string`?new Blob([e],{type:`text/plain`}):e,ZC=async e=>{let t=await XC(e).arrayBuffer();return cp(new Blob([`blob ${t.byteLength}\0`,t]))}})),$C,ew,tw,nw,rw,iw,aw,ow,sw,cw,pre=o((()=>{tS(),Zf(),VP(),QC(),$C=(e=A(IP))=>e?.media_libraries?.uploadcare??(e?.media_library?.name===`uploadcare`?e?.media_library:void 0),ew=e=>{let t=$C(e)??$C();return t?t.config?.publicKey:void 0},tw=e=>!!ew(e),nw=(e,{fieldConfig:t}={})=>{let{settings:{autoFilename:n=!1,defaultOperations:r=void 0}={},config:{cdnBase:i=void 0}={}}=($C(t)??$C())||{};return e.map(e=>{let{uuid:t,original_filename:a,original_file_url:o,mime_type:s,datetime_uploaded:c,size:l}=e,u=`${new URL(i??o).origin}/${t}/`,d=s.startsWith(`image/`),f=s.startsWith(`video/`);return{id:t,description:a,previewURL:`${u}${d?`-/preview/400x400/`:``}`,downloadURL:`${u}${d&&r?`-${r}`:``}${n?a:``}`,fileName:a,lastModified:new Date(c),size:l,kind:d?`image`:f?`video`:`other`}})},rw=async(e,{maxPages:t=10,filter:n}={})=>{let{kind:r,fieldConfig:i,apiKey:a}=e,o=ew(i);if(!o)return Promise.reject(Error(`Uploadcare public key is not configured`));let s={Accept:`application/vnd.uploadcare-v0.7+json`,Authorization:`Uploadcare.Simple ${o}:${a}`},c=new URLSearchParams({limit:`100`,ordering:`-datetime_uploaded`,stored:`true`}),l=[],u=`https://api.uploadcare.com/files/?${c}`;for(let e=0;e<t&&u;e+=1){let e=await fetch(u,{headers:s});if(!e.ok)return Promise.reject(Error(`Failed to fetch files: ${e.statusText}`));let t=await e.json(),{results:i}=t;if(r===`image`&&(i=i.filter(e=>e.is_image)),n&&(i=i.filter(n)),l.push(...i),u=t.next,!u)break;await eS(50)}return nw(l,{fieldConfig:i})},iw=async e=>rw(e),aw=async(e,t)=>{let n=e.toLowerCase();return rw(t,{filter:e=>e.original_filename.toLowerCase().includes(n)})},ow=async(e,t)=>{let n=new TextEncoder,r=n.encode(String(t)),i=n.encode(e),a=await crypto.subtle.importKey(`raw`,i,{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),o=await crypto.subtle.sign(`HMAC`,a,r);return Array.from(new Uint8Array(o)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},sw=async(e,t)=>{if(e.length===0)return[];let{fieldConfig:n,apiKey:r}=t,i=ew(n);if(!i)return Promise.reject(Error(`Uploadcare public key is not configured`));if(!r)return Promise.reject(Error(`Uploadcare secret key is not provided`));let a=Math.floor(Date.now()/1e3)+1800,o=await ow(r,a),s=new FormData;s.append(`UPLOADCARE_PUB_KEY`,i),s.append(`UPLOADCARE_STORE`,`1`),s.append(`signature`,o),s.append(`expire`,String(a)),e.forEach(e=>{s.append(qC(e.name),e)});let c=await fetch(`https://upload.uploadcare.com/base/`,{method:`POST`,body:s});if(!c.ok)throw Error(`Failed to upload files: ${c.statusText}`);let l=await c.json();return nw(Object.entries(l).filter(([e])=>!e.startsWith(`UPLOADCARE_`)).map(([t,n])=>{let r=e.find(e=>e.name===t),i=r?.type||`application/octet-stream`,a=i.startsWith(`image/`);return{uuid:n,original_filename:t,original_file_url:`https://ucarecdn.com/${n}/${t}`,size:r?.size||0,mime_type:i,is_image:a,is_ready:!0,content_info:null,datetime_uploaded:new Date().toISOString(),datetime_stored:new Date().toISOString(),datetime_removed:null}}),{fieldConfig:n})},cw={serviceType:`cloud_storage`,serviceId:`uploadcare`,serviceLabel:`Uploadcare`,serviceURL:`https://uploadcare.com/`,showServiceLink:!0,hotlinking:!0,authType:`api_key`,developerURL:`https://uploadcare.com/docs/`,apiKeyURL:`https://app.uploadcare.com/projects/-/api-keys/`,apiKeyPattern:/^[a-f0-9]{20}$/,isEnabled:tw,list:iw,search:aw,upload:sw}})),lw,uw,dw=o((()=>{SC(),nre(),sre(),cre(),pre(),lw={aws_s3:tre,cloudflare_r2:NC,cloudinary:qne,digitalocean_spaces:zC,uploadcare:cw},uw=Object.keys(lw)})),fw,pw,mw,hw,gw,_w,vw,yw,bw,xw,Sw,Cw,ww,mre=o((()=>{fw=`@sveltia/cms`,pw=`0.157.1`,mw=`Sveltia CMS is a modern, lightweight, Git-based headless content management system.`,hw=[`svelte`,`cms`,`content-management-system`],gw=`https://sveltiacms.app/en/`,_w={type:`git`,url:`git+https://github.com/sveltia/sveltia-cms.git`},vw={name:`Kohei Yoshino`,url:`https://github.com/kyoshino`},yw=`module`,bw={build:`vite build`,"build:watch":`vite build --watch`,check:`pnpm run '/^check:.*/'`,"check:audit":`pnpm audit --ignore-registry-errors`,"check:cspell":`cspell --no-progress`,"check:eslint":`eslint .`,"check:imports":`node scripts/find-unused-imports.js`,"check:oxlint":`oxlint .`,"check:prettier":`prettier --check .`,"check:stylelint":`stylelint '**/*.{css,scss,svelte}'`,"check:svelte":`svelte-check`,dev:`vite`,format:`prettier --write .`,prepublishOnly:`vite build`,preview:`vite preview`,test:`NODE_OPTIONS=--no-experimental-webstorage vitest run`,"test:coverage":`NODE_OPTIONS=--no-experimental-webstorage vitest run --coverage`,"test:watch":`NODE_OPTIONS=--no-experimental-webstorage vitest`},xw={"@jsquash/webp":`^1.5.0`,"@lexical/markdown":`^0.43.0`,"@sindresorhus/transliterate":`^2.3.1`,"@sveltia/i18n":`^1.0.5`,"@sveltia/ui":`^0.37.2`,"@sveltia/utils":`^0.10.6`,"create-react-class":`^15.7.0`,dayjs:`^1.11.20`,deepmerge:`^4.3.1`,exifr:`^7.1.3`,"fast-deep-equal":`^3.1.3`,flat:`^6.0.1`,immutable:`^5.1.5`,"isomorphic-dompurify":`^3.10.0`,leaflet:`^1.9.4`,lexical:`^0.43.0`,marked:`^18.0.2`,"marked-bidi":`^1.0.15`,mime:`^4.1.0`,"parse-entities":`^4.0.2`,"pdfjs-dist":`^5.6.205`,qrcode:`^1.5.4`,react:`^19.2.5`,"react-dom":`^19.2.5`,"sanitize-filename":`^1.6.4`,"smol-toml":`^1.6.1`,svgo:`^4.0.1`,"terra-draw":`^1.28.8`,"terra-draw-leaflet-adapter":`1.0.3`,turndown:`^7.2.4`,yaml:`^2.8.3`},Sw={"@stylistic/eslint-plugin":`^5.10.0`,"@sveltejs/vite-plugin-svelte":`^7.0.0`,"@types/leaflet":`^1.9.21`,"@types/node":`^25.6.0`,"@types/qrcode":`^1.5.6`,"@types/react":`^19.2.14`,"@types/react-dom":`^19.2.3`,"@vitest/coverage-v8":`^4.1.5`,cspell:`^10.0.0`,eslint:`^9.39.4`,"eslint-config-airbnb-extended":`^3.1.0`,"eslint-config-prettier":`^10.1.8`,"eslint-plugin-jsdoc":`^62.9.0`,"eslint-plugin-package-json":`^0.91.1`,"eslint-plugin-svelte":`^3.17.1`,"eslint-plugin-unused-imports":`^4.4.1`,globals:`^17.5.0`,oxlint:`^1.61.0`,postcss:`^8.5.10`,"postcss-html":`^1.8.1`,prettier:`^3.8.3`,"prettier-plugin-svelte":`^3.5.1`,sass:`^1.99.0`,stylelint:`^17.9.0`,"stylelint-config-recommended-scss":`^17.0.1`,"stylelint-scss":`^7.0.0`,svelte:`^5.55.5`,"svelte-check":`^4.4.6`,"svelte-preprocess":`^6.0.3`,"ts-json-schema-generator":`^2.9.0`,typescript:`^5.9.3`,vite:`^8.0.10`,vitest:`^4.1.5`},Cw={directory:`package`,access:`public`,provenance:!0},ww={name:fw,version:pw,description:mw,keywords:hw,homepage:gw,repository:_w,license:`MIT`,author:vw,type:yw,scripts:bw,dependencies:xw,devDependencies:Sw,publishConfig:Cw}})),Tw,Ew,Dw=o((()=>{mre(),{dependencies:Tw,version:Ew}=ww})),Ow,kw,Aw,jw,Mw=o((()=>{Ow=`modulepreload`,kw=function(e){return`/`+e},Aw={},jw=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=kw(t,n),t in Aw)return;Aw[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ow,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})}})),Nw,Pw,Fw=o((()=>{Dw(),Mw(),Nw=e=>{let t=`https://unpkg.com/${e}`,n=Tw[e]?.replace(/^\D/,``);return n?`${t}@${n}`:t},Pw=async(e,t)=>jw(()=>import(`${Nw(e)}/${t}`),[])})),Iw,Lw,Rw,zw,Bw,Vw,Hw,Uw,Ww=o((()=>{Iw=[`avif`,`gif`,`jpeg`,`png`,`webp`],Lw=Iw.map(e=>`image/${e}`),Rw=/\b(?:avif|gif|jpe?g|png|webp)$/i,zw=[`svg`],Bw=[`image/svg+xml`],Vw=/\b(?:svg)$/i,[...Iw,...zw],Hw=[...Lw,...Bw],Uw=[`webp`]})),Gw,Kw,qw,Jw=o((()=>{Fw(),Ww(),Gw={},Kw=async e=>{if(e in Gw)return Gw[e];let t=`image/${e}`,n=new OffscreenCanvas(1,1);n.getContext(`2d`);let r=(await n.convertToBlob({type:t})).type===t;return Gw[e]=r,r},qw=async(e,{format:t=`webp`,quality:n=85}={})=>{let r=`image/${t}`;if(!await Kw(t)&&Uw.includes(t)){let i=e.getContext(`2d`).getImageData(0,0,e.width,e.height);try{let e=(await Pw(`@jsquash/${t}`,`encode.js?module`)).default,a=await e(i,{quality:n});return new Blob([a],{type:r})}catch{}}return e.convertToBlob({type:r,quality:n/100})}})),Yw,Xw,Zw=o((()=>{Yw=({width:e,height:t},{width:n=e,height:r=t,fit:i=`scale-down`}={})=>{let a={scale:1,width:e,height:t};if(e===n&&t===r)return a;let o=e<=n&&t<=r,s=1,c=0,l=0;if(i===`scale-down`){if(o)return a;i=`contain`}return i===`contain`&&(s=Math.min(n/e,r/t),c=e*s,l=t*s),{scale:s,width:c,height:l}},Xw=(e,t,n)=>{let{scale:r,width:i,height:a}=Yw(t,n);return e.width=i,e.height=a,{scale:r,width:i,height:a}}})),Qw,$w,eT,tT,nT,rT=o((()=>{Fw(),Jw(),Zw(),Qw=async({blob:e})=>{let t=URL.createObjectURL(e),n=new Image;return new Promise(e=>{n.addEventListener(`load`,()=>{e({source:n,naturalWidth:n.naturalWidth,naturalHeight:n.naturalHeight}),URL.revokeObjectURL(t)},{once:!0}),n.src=t})},$w=async({blob:e})=>{let t=URL.createObjectURL(e),n=document.createElement(`video`);return new Promise(e=>{n.addEventListener(`canplay`,()=>{n.pause(),e({source:n,naturalWidth:n.videoWidth,naturalHeight:n.videoHeight}),URL.revokeObjectURL(t)},{once:!0}),n.muted=!0,n.autoplay=!0,n.playsInline=!0,n.src=t,n.style.opacity=`0`,n.style.pointerEvents=`none`,document.body.appendChild(n)})},eT=async e=>e.type.startsWith(`video/`)?$w({blob:e}):Qw({blob:e}),tT=async(e,{format:t=`png`,quality:n=85,width:r=void 0,height:i=void 0,fit:a=`scale-down`}={})=>{let o,s=0,c=0;try{o=await createImageBitmap(e),{width:s,height:c}=o}catch{({source:o,naturalWidth:s,naturalHeight:c}=await eT(e))}r??=s,i??=c;let l=new OffscreenCanvas(512,512),u=l.getContext(`2d`);return Xw(l,{width:s,height:c},{fit:a,width:r,height:i}),u.drawImage(o,0,0,l.width,l.height),o instanceof HTMLVideoElement&&document.body.removeChild(o),qw(l,{format:t,quality:n})},nT=async e=>{let t=await e.text();try{let{optimize:n}=await Pw(`svgo`,`dist/svgo.browser.js`),{data:r}=n(t);return new Blob([r],{type:e.type})}catch{}return e}})),iT,aT,oT,sT,cT,lT,hre=o((()=>{Fw(),Jw(),Zw(),Mw(),iT=Nw(`pdfjs-dist`),aT=`${iT}/build/pdf.min.mjs`,oT=`${iT}/build/pdf.worker.min.mjs`,sT={isEvalSupported:!1,disableAutoFetch:!0,cMapUrl:`${iT}/cmaps/`,iccUrl:`${iT}/iccs/`,standardFontDataUrl:`${iT}/standard_fonts/`,wasmUrl:`${iT}/wasm/`},lT=async(e,{format:t=`png`,quality:n=85,width:r=void 0,height:i=void 0,fit:a=`scale-down`}={})=>{if(!cT)try{cT=await jw(()=>import(aT),[]),cT.GlobalWorkerOptions.workerSrc=oT}catch{throw Error(`Failed to load PDF.js library`)}let o=URL.createObjectURL(e),s=new OffscreenCanvas(512,512),c=s.getContext(`2d`);try{let e=await(await cT.getDocument({...sT,url:o}).promise).getPage(1),t=e.getViewport({scale:1}),{scale:n}=Xw(s,{width:t.width,height:t.height},{width:r,height:i,fit:a});await e.render({canvasContext:c,viewport:n===1?t:e.getViewport({scale:n})}).promise,URL.revokeObjectURL(o)}catch{throw Error(`Failed to render PDF`)}return qw(s,{format:t,quality:n})}})),uT,dT,fT,pT,mT,hT,gT,_T,vT=o((()=>{kp(),tS(),mS(),gp(),ES(),Zf(),pF(),Rp(),dP(),VP(),dw(),SC(),QC(),rT(),hre(),uT=new Set,dT=async(e,t=0)=>{let{file:n,handle:r,blobURL:i,name:a,path:o}=e;if(i)return fetch(i).then(e=>e.blob());let s;if(n)s=n;else if(r)try{s=await r.getFile()}catch{throw Error(`Failed to retrieve blob from file handle`)}else{if(uT.has(o)&&t<=25)return await eS(200),dT(e,t+1);uT.add(o);let n=await A(lP)?.fetchBlob?.(e);if(!n)throw Error(`Failed to retrieve blob`);s=new Blob([n],{type:TS.getType(a)??n.type})}return e.blobURL=URL.createObjectURL(s),uT.delete(o),s},fT=async e=>(e.blobURL||await dT(e),e.blobURL),pT=void 0,mT=async(e,{cacheOnly:t=!1}={})=>{let n=e.name.endsWith(`.pdf`);if(!([`image`,`video`].includes(e.kind)||n))return;if(pT===void 0){let{databaseName:e}=A(lP)?.repository??{};pT=e?new dS(e,`asset-thumbnails`):null}let r=await pT?.get(e.sha);if(!r){if(t)return;let i=await dT(e),a={format:`webp`,quality:85,width:512,height:512,fit:`contain`};r=n?await lT(i,a):await tT(i,a),await pT?.set(e.sha,r)}return URL.createObjectURL(r)},hT=(e,{pathOnly:t=!1,allowSpecial:n=!1,entry:r=void 0}={})=>{let{publicPath:i,entryRelative:a,hasTemplateTags:o}=e.folder.collectionName===void 0?e.folder:Ip(e.path).find(({collectionName:e})=>e!==void 0)??A(jp);if(a){if(t){let t=xp(e.path).dirname,n=r?xp(Object.values(r.locales)[0].path).dirname:void 0;if(t!==void 0&&n!==void 0){if(t===n)return e.name;let r=`${n}/`;return e.path.startsWith(r)?e.path.slice(r.length):void 0}let{internalPath:i,internalSubPath:a}=e.folder;if(e.path===JC([i,a,e.name]))return e.path.slice(i.length+1)}return}let{_baseURL:s=``,output:{encode_file_path:c=!1}={}}=A(IP),l=o?e.path.replace(VC(e.folder.internalPath??``,e=>{let t=e.match(/{{(?<tag>.+?)}}/)?.groups?.tag;return t?`(?<${t}>[^/]+)`:up(e)}),i?.replaceAll(/{{(.+?)}}/g,`$<$1>`)??``):e.path.replace(e.folder.internalPath??``,i===`/`?``:i??``);if(c&&(l=HC(l)),!(!l.startsWith(`/`)&&!n))return t?l:`${s}${l}`},gT=e=>{if(lw.cloudinary?.isEnabled?.()){let t=xC(e);if(t.output_filename_only&&t.config?.cloud_name)return`https://res.cloudinary.com/${t.config.cloud_name}`}},_T=async({value:e,entry:t,collectionName:n,fileName:r,fieldConfig:i,typedKeyPath:a,thumbnail:o=!1})=>{if(!e)return;if(/^(?:https?|data|blob):/.test(e))return e;if(lF(e)){let t=gT(i);if(t)return`${t}/${e}`}let s=uF({value:e,entry:t,collectionName:n,fileName:r,typedKeyPath:a});if(s)return(o?await mT(s):await fT(s))??hT(s)}})),yT,bT,xT,ST,CT,wT,TT,ET,DT,OT=o((()=>{Bp(),yT=l(BS(),1),bT=l(VS(),1),xT=l(HS(),1),ST=l(US(),1),Zf(),dP(),KP(),VP(),Yy(),$b(),ub(),lC(),yT.default.extend(bT.default),yT.default.extend(xT.default),yT.default.extend(ST.default),CT=/{{(?:year|month|day|hour|minute|second)}}/,wT=e=>Jy(Object.values(e.locales)[0].path).map(({collectionName:e})=>Xb(e)).filter(e=>!!e),TT=({dateFieldName:e,fields:t,content:n})=>{let r=e?t.find(({widget:t,name:n})=>t===`datetime`&&n===e):t.find(({widget:e})=>e===`datetime`),i=r?n[r.name]:void 0;if(!r||!i)return;let a=r,{picker_utc:o=!1}=a,s=iC(i,a);if(nC(s))return zp({date:s,timeZone:o?`UTC`:void 0})},ET=(e,t,n,r)=>{let{show_preview_links:i=!0,_baseURL:a}=A(IP)??{},{slug:o,path:s,content:c}=e.locales[t]??{},{preview_path:l,preview_path_date_field:u,fields:d=[],_i18n:{defaultLocale:f,omitDefaultLocaleFromPreviewPath:p}}=r??n;if(!i||!a||!s||!c||!l)return;let m=lb(n,e),h=(m?cb(n):void 0)?.fields??d,g;if(CT.test(l)&&(g=TT({dateFieldName:u,fields:h,content:c}),!g))return;let _=l;t===f&&p&&(_=_.replace(/{{locale}}[./]/,``));try{let e=GP(_,{type:`preview_path`,collection:n,content:c,locale:t,currentSlug:o,entryFilePath:s,dateTimeParts:g,isIndexFile:m});return`${a.replace(/\/$/,``)}/${e.replace(/^\//,``)}`}catch{return}},DT=(e,t)=>`${A(lP)?.repository?.blobBaseURL}/${e.locales[t]?.path}?plain=1`})),kT,AT,jT=o((()=>{kT=/^\/?(?<pattern>.+?)(?:\/(?<flags>[dgimsuy]*))?$/,AT=e=>{if(e instanceof RegExp)return e;if(typeof e==`string`){let{pattern:t,flags:n}=e.match(kT)?.groups??{};if(t)try{return new RegExp(t,n)}catch{}}}})),MT,NT,PT,FT,IT,LT,RT,zT=o((()=>{Zf(),vT(),VP(),Yy(),$b(),rb(),ub(),OT(),$k(),jT(),MT=/!\[.*?\]\((.+?)(?:\s+".*?")?\)/g,NT=rn([]),PT=an(NT,e=>new Set(e.map(e=>e.id))),FT=e=>{let t=Xb(e);if(!t)return[];let{_type:n,_i18n:{defaultLocale:r}}=t,{filter:i}=n===`entry`?t:{},a=i?.field,o=AT(i?.pattern),s=i?.value===void 0?[]:Array.isArray(i.value)?i.value:[i.value],c;if(n===`entry`){let n=t._file?.fullPathRegEx;c=n?e=>n.test(Object.values(e.locales)[0]?.path??``):t=>wT(t).some(({name:t})=>t===e)}else{let t=new Set(A(Uy).filter(({collectionName:t})=>t===e).flatMap(({filePathMap:e})=>e?Object.values(e):[]));c=e=>{let n=Object.values(e.locales)[0]?.path;return!!n&&t.has(n)}}return A(Wy).filter(t=>{if(!c(t))return!1;if(!a)return!0;let n=Qk({entry:t,locale:r,collectionName:e,key:a})??null;return o?o.test(n):s.includes(n)})},IT=async({assetURL:e,newURL:t,collectionName:n,entry:r,content:i,keyPath:a,value:o,isIndexFile:s,collectionFile:c})=>{let l=c?.name,u=Kk({collectionName:n,fileName:l,valueMap:i,keyPath:a,isIndexFile:s});if(!u)return!1;let d=e.startsWith(`blob:`),f={entry:r,collectionName:n,fileName:l},{widget:p=`string`}=u;if([`image`,`file`].includes(p)){let n=d?await _T({...f,value:o})===e:o===e;return n&&t&&(i[a]=t),n}if([`richtext`,`markdown`].includes(p)){let n=[...o.matchAll(MT)];if(n.length)return(await Promise.all(n.map(async([,n])=>{let r=(d?await _T({...f,value:n}):n)===e;return r&&t&&(i[a]=i[a].replace(n,t)),r}))).some(Boolean)}return!1},LT=async(e,{entries:t=A(Wy),newURL:n=``}={})=>{let r=A(IP)?._baseURL,i=r&&!e.startsWith(`blob:`)?e.replace(r,``):e,a=i.startsWith(`blob:`),o=!!n,s=await Promise.all(t.map(async e=>{let{locales:t}=e,r=wT(e),s=!1;for(let{content:c}of Object.values(t)){for(let[t,l]of Object.entries(c))if(!(typeof l!=`string`||!l)&&!(!a&&!l.includes(i))){for(let a of r){let r={assetURL:i,newURL:n,collectionName:a.name,entry:e,content:c,keyPath:t,value:l,isIndexFile:lb(a,e)},u=eb(a,e),d;if(d=u.length?(await Promise.all(u.map(e=>IT({...r,collectionFile:e})))).includes(!0):await IT({...r}),d&&(s=!0,!o))break}if(s&&!o)break}if(s&&!o)break}return s}));return t.filter((e,t)=>s[t])},RT=e=>{let t=cb(e);return t?!FT(e.name).some(({slug:e})=>e===t.name):!1}}));function BT(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return $T(e,t,n)}}function gre(e){return function(){return eE(e,[...arguments])}}function VT(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sE;if(KT&&KT(e,null),!oE(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(qT(t)||(t[r]=e),i=e)}e[i]=!0}return e}function _re(e){for(let t=0;t<e.length;t++)_E(e,t)||(e[t]=null);return e}function HT(e){let t=QT(null);for(let[n,r]of GT(e))_E(e,n)&&(oE(r)?t[n]=_re(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=HT(r):t[n]=r);return t}function vre(e){switch(typeof e){case`string`:return e;case`number`:return pE(e);case`boolean`:return mE(e);case`bigint`:return hE?hE(e):`0`;case`symbol`:return gE?gE(e):`Symbol()`;case`undefined`:return vE(e);case`function`:case`object`:{if(e===null)return vE(e);let t=e,n=UT(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:vE(e)}return vE(e)}default:return vE(e)}}function UT(e,t){for(;e!==null;){let n=YT(e,t);if(n){if(n.get)return BT(n.get);if(typeof n.value==`function`)return BT(n.value)}e=JT(e)}function n(){return null}return n}function yre(e){try{return yE(e,``),!0}catch{return!1}}function WT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:WE(),t=e=>WT(e);if(t.version=`3.4.1`,t.removed=[],!e||!e.document||e.document.nodeType!==UE.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=UT(m,`cloneNode`),g=UT(m,`remove`),_=UT(m,`nextSibling`),v=UT(m,`childNodes`),y=UT(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:ee}=r,te=KE();t.isSupported=typeof GT==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ne,ERB_EXPR:re,TMPLIT_EXPR:ie,DATA_ATTR:ae,ARIA_ATTR:oe,IS_SCRIPT_OR_DATA:se,ATTR_WHITESPACE:ce,CUSTOM_ELEMENT:le}=HE,{IS_ALLOWED_URI:ue}=HE,de=null,E=VT({},[...xE,...SE,...CE,...TE,...DE]),fe=null,pe=VT({},[...OE,...kE,...AE,...jE]),me=Object.seal(QT(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),he=null,ge=null,_e=Object.seal(QT(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ve=!0,ye=!0,be=!1,xe=!0,Se=!1,Ce=!0,we=!1,Te=!1,Ee=!1,De=!1,Oe=!1,ke=!1,Ae=!0,je=!1,Me=`user-content-`,Ne=!0,Pe=!1,Fe={},Ie=null,Le=VT({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),Re=null,ze=VT({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Be=null,Ve=VT({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),He=`http://www.w3.org/1998/Math/MathML`,Ue=`http://www.w3.org/2000/svg`,We=`http://www.w3.org/1999/xhtml`,Ge=We,Ke=!1,qe=null,Je=VT({},[He,Ue,We],cE),Ye=VT({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Xe=VT({},[`annotation-xml`]),Ze=VT({},[`title`,`style`,`font`,`a`,`script`]),Qe=null,$e=[`application/xhtml+xml`,`text/html`],et=null,tt=null,nt=n.createElement(`form`),rt=function(e){return e instanceof RegExp||e instanceof Function},it=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(tt&&tt===e)return;(!e||typeof e!=`object`)&&(e={}),e=HT(e),Qe=$e.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,et=Qe===`application/xhtml+xml`?cE:sE,de=_E(e,`ALLOWED_TAGS`)&&oE(e.ALLOWED_TAGS)?VT({},e.ALLOWED_TAGS,et):E,fe=_E(e,`ALLOWED_ATTR`)&&oE(e.ALLOWED_ATTR)?VT({},e.ALLOWED_ATTR,et):pe,qe=_E(e,`ALLOWED_NAMESPACES`)&&oE(e.ALLOWED_NAMESPACES)?VT({},e.ALLOWED_NAMESPACES,cE):Je,Be=_E(e,`ADD_URI_SAFE_ATTR`)&&oE(e.ADD_URI_SAFE_ATTR)?VT(HT(Ve),e.ADD_URI_SAFE_ATTR,et):Ve,Re=_E(e,`ADD_DATA_URI_TAGS`)&&oE(e.ADD_DATA_URI_TAGS)?VT(HT(ze),e.ADD_DATA_URI_TAGS,et):ze,Ie=_E(e,`FORBID_CONTENTS`)&&oE(e.FORBID_CONTENTS)?VT({},e.FORBID_CONTENTS,et):Le,he=_E(e,`FORBID_TAGS`)&&oE(e.FORBID_TAGS)?VT({},e.FORBID_TAGS,et):HT({}),ge=_E(e,`FORBID_ATTR`)&&oE(e.FORBID_ATTR)?VT({},e.FORBID_ATTR,et):HT({}),Fe=_E(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?HT(e.USE_PROFILES):e.USE_PROFILES:!1,ve=e.ALLOW_ARIA_ATTR!==!1,ye=e.ALLOW_DATA_ATTR!==!1,be=e.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=e.SAFE_FOR_TEMPLATES||!1,Ce=e.SAFE_FOR_XML!==!1,we=e.WHOLE_DOCUMENT||!1,De=e.RETURN_DOM||!1,Oe=e.RETURN_DOM_FRAGMENT||!1,ke=e.RETURN_TRUSTED_TYPE||!1,Ee=e.FORCE_BODY||!1,Ae=e.SANITIZE_DOM!==!1,je=e.SANITIZE_NAMED_PROPS||!1,Ne=e.KEEP_CONTENT!==!1,Pe=e.IN_PLACE||!1,ue=yre(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:LE,Ge=typeof e.NAMESPACE==`string`?e.NAMESPACE:We,Ye=_E(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?HT(e.MATHML_TEXT_INTEGRATION_POINTS):VT({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Xe=_E(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?HT(e.HTML_INTEGRATION_POINTS):VT({},[`annotation-xml`]);let t=_E(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?HT(e.CUSTOM_ELEMENT_HANDLING):QT(null);if(me=QT(null),_E(t,`tagNameCheck`)&&rt(t.tagNameCheck)&&(me.tagNameCheck=t.tagNameCheck),_E(t,`attributeNameCheck`)&&rt(t.attributeNameCheck)&&(me.attributeNameCheck=t.attributeNameCheck),_E(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(me.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Se&&(ye=!1),Oe&&(De=!0),Fe&&(de=VT({},DE),fe=QT(null),Fe.html===!0&&(VT(de,xE),VT(fe,OE)),Fe.svg===!0&&(VT(de,SE),VT(fe,kE),VT(fe,jE)),Fe.svgFilters===!0&&(VT(de,CE),VT(fe,kE),VT(fe,jE)),Fe.mathMl===!0&&(VT(de,TE),VT(fe,AE),VT(fe,jE))),_e.tagCheck=null,_e.attributeCheck=null,_E(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?_e.tagCheck=e.ADD_TAGS:oE(e.ADD_TAGS)&&(de===E&&(de=HT(de)),VT(de,e.ADD_TAGS,et))),_E(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?_e.attributeCheck=e.ADD_ATTR:oE(e.ADD_ATTR)&&(fe===pe&&(fe=HT(fe)),VT(fe,e.ADD_ATTR,et))),_E(e,`ADD_URI_SAFE_ATTR`)&&oE(e.ADD_URI_SAFE_ATTR)&&VT(Be,e.ADD_URI_SAFE_ATTR,et),_E(e,`FORBID_CONTENTS`)&&oE(e.FORBID_CONTENTS)&&(Ie===Le&&(Ie=HT(Ie)),VT(Ie,e.FORBID_CONTENTS,et)),_E(e,`ADD_FORBID_CONTENTS`)&&oE(e.ADD_FORBID_CONTENTS)&&(Ie===Le&&(Ie=HT(Ie)),VT(Ie,e.ADD_FORBID_CONTENTS,et)),Ne&&(de[`#text`]=!0),we&&VT(de,[`html`,`head`,`body`]),de.table&&(VT(de,[`tbody`]),delete he.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw bE(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw bE(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=GE(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));XT&&XT(e),tt=e},at=VT({},[...SE,...CE,...wE]),ot=VT({},[...TE,...EE]),st=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:Ge,tagName:`template`});let n=sE(e.tagName),r=sE(t.tagName);return qe[e.namespaceURI]?e.namespaceURI===Ue?t.namespaceURI===We?n===`svg`:t.namespaceURI===He?n===`svg`&&(r===`annotation-xml`||Ye[r]):!!at[n]:e.namespaceURI===He?t.namespaceURI===We?n===`math`:t.namespaceURI===Ue?n===`math`&&Xe[r]:!!ot[n]:e.namespaceURI===We?t.namespaceURI===Ue&&!Xe[r]||t.namespaceURI===He&&!Ye[r]?!1:!ot[n]&&(Ze[n]||!at[n]):!!(Qe===`application/xhtml+xml`&&qe[e.namespaceURI]):!1},ct=function(e){iE(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},lt=function(e,n){try{iE(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{iE(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(De||Oe)try{ct(n)}catch{}else try{n.setAttribute(e,``)}catch{}},ut=function(e){let t=null,r=null;if(Ee)e=`<remove></remove>`+e;else{let t=lE(e,/^[\r\n\t ]+/);r=t&&t[0]}Qe===`application/xhtml+xml`&&Ge===We&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(Ge===We)try{t=new f().parseFromString(i,Qe)}catch{}if(!t||!t.documentElement){t=S.createDocument(Ge,`template`,null);try{t.documentElement.innerHTML=Ke?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ge===We?T.call(t,we?`html`:`body`)[0]:we?t.documentElement:a},D=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},dt=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},ft=function(e){return typeof s==`function`&&e instanceof s};function pt(e,n,r){tE(e,e=>{e.call(t,n,r,tt)})}let mt=function(e){let n=null;if(pt(te.beforeSanitizeElements,e,null),dt(e))return ct(e),!0;let r=et(e.nodeName);if(pt(te.uponSanitizeElement,e,{tagName:r,allowedTags:de}),Ce&&e.hasChildNodes()&&!ft(e.firstElementChild)&&yE(/<[/\w!]/g,e.innerHTML)&&yE(/<[/\w!]/g,e.textContent)||Ce&&e.namespaceURI===We&&r===`style`&&ft(e.firstElementChild)||e.nodeType===UE.progressingInstruction||Ce&&e.nodeType===UE.comment&&yE(/<[/\w]/g,e.data))return ct(e),!0;if(he[r]||!(_e.tagCheck instanceof Function&&_e.tagCheck(r))&&!de[r]){if(!he[r]&&_t(r)&&(me.tagNameCheck instanceof RegExp&&yE(me.tagNameCheck,r)||me.tagNameCheck instanceof Function&&me.tagNameCheck(r)))return!1;if(Ne&&!Ie[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);t.insertBefore(r,_(e))}}}return ct(e),!0}return e instanceof c&&!st(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&yE(/<\/no(script|embed|frames)/i,e.innerHTML)?(ct(e),!0):(Se&&e.nodeType===UE.text&&(n=e.textContent,tE([ne,re,ie],e=>{n=uE(n,e,` `)}),e.textContent!==n&&(iE(t.removed,{element:e.cloneNode()}),e.textContent=n)),pt(te.afterSanitizeElements,e,null),!1)},ht=function(e,t,r){if(ge[t]||Ae&&(t===`id`||t===`name`)&&(r in n||r in nt))return!1;if(!(ye&&!ge[t]&&yE(ae,t))&&!(ve&&yE(oe,t))&&!(_e.attributeCheck instanceof Function&&_e.attributeCheck(t,e))){if(!fe[t]||ge[t]){if(!(_t(e)&&(me.tagNameCheck instanceof RegExp&&yE(me.tagNameCheck,e)||me.tagNameCheck instanceof Function&&me.tagNameCheck(e))&&(me.attributeNameCheck instanceof RegExp&&yE(me.attributeNameCheck,t)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(t,e))||t===`is`&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&yE(me.tagNameCheck,r)||me.tagNameCheck instanceof Function&&me.tagNameCheck(r))))return!1}else if(!Be[t]&&!yE(ue,uE(r,ce,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&dE(r,`data:`)===0&&Re[e])&&!(be&&!yE(se,uE(r,ce,``)))&&r)return!1}return!0},gt=VT({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),_t=function(e){return!gt[sE(e)]&&yE(le,e)},vt=function(e){pt(te.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||dt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:fe,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=et(a),l=s,u=a===`value`?l:fE(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,pt(te.uponSanitizeAttribute,e,r),u=r.attrValue,je&&(c===`id`||c===`name`)&&dE(u,Me)!==0&&(lt(a,e),u=Me+u),Ce&&yE(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){lt(a,e);continue}if(c===`attributename`&&lE(u,`href`)){lt(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){lt(a,e);continue}if(!xe&&yE(/\/>/i,u)){lt(a,e);continue}Se&&tE([ne,re,ie],e=>{u=uE(u,e,` `)});let d=et(e.nodeName);if(!ht(d,c,u)){lt(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),dt(e)?ct(e):rE(t.removed)}catch{lt(a,e)}}pt(te.afterSanitizeAttributes,e,null)},yt=function(e){let t=null,n=D(e);for(pt(te.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)pt(te.uponSanitizeShadowNode,t,null),mt(t),vt(t),t.content instanceof a&&yt(t.content);pt(te.afterSanitizeShadowDOM,e,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(Ke=!e,Ke&&(e=`<!-->`),typeof e!=`string`&&!ft(e)&&(e=vre(e),typeof e!=`string`))throw bE(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(Te||it(n),t.removed=[],typeof e==`string`&&(Pe=!1),Pe){let t=e.nodeName;if(typeof t==`string`){let e=et(t);if(!de[e]||he[e])throw bE(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=ut(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===UE.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!De&&!Se&&!we&&e.indexOf(`<`)===-1)return b&&ke?b.createHTML(e):e;if(i=ut(e),!i)return De?null:ke?x:``}i&&Ee&&ct(i.firstChild);let u=D(Pe?e:i);for(;c=u.nextNode();)mt(c),vt(c),c.content instanceof a&&yt(c.content);if(Pe)return e;if(De){if(Se){i.normalize();let e=i.innerHTML;tE([ne,re,ie],t=>{e=uE(e,t,` `)}),i.innerHTML=e}if(Oe)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(fe.shadowroot||fe.shadowrootmode)&&(l=ee.call(r,l,!0)),l}let d=we?i.outerHTML:i.innerHTML;return we&&de[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&yE(BE,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
170
170
  `+d),Se&&tE([ne,re,ie],e=>{d=uE(d,e,` `)}),b&&ke?b.createHTML(d):d},t.setConfig=function(){it(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Te=!0},t.clearConfig=function(){tt=null,Te=!1},t.isValidAttribute=function(e,t,n){return tt||it({}),ht(et(e),et(t),n)},t.addHook=function(e,t){typeof t==`function`&&iE(te[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=nE(te[e],t);return n===-1?void 0:aE(te[e],n,1)[0]}return rE(te[e])},t.removeHooks=function(e){te[e]=[]},t.removeAllHooks=function(){te=KE()},t}var GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,bre=o((()=>{({entries:GT,setPrototypeOf:KT,isFrozen:qT,getPrototypeOf:JT,getOwnPropertyDescriptor:YT}=Object),{freeze:XT,seal:ZT,create:QT}=Object,{apply:$T,construct:eE}=typeof Reflect<`u`&&Reflect,XT||=function(e){return e},ZT||=function(e){return e},$T||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},eE||=function(e){return new e(...[...arguments].slice(1))},tE=BT(Array.prototype.forEach),nE=BT(Array.prototype.lastIndexOf),rE=BT(Array.prototype.pop),iE=BT(Array.prototype.push),aE=BT(Array.prototype.splice),oE=Array.isArray,sE=BT(String.prototype.toLowerCase),cE=BT(String.prototype.toString),lE=BT(String.prototype.match),uE=BT(String.prototype.replace),dE=BT(String.prototype.indexOf),fE=BT(String.prototype.trim),pE=BT(Number.prototype.toString),mE=BT(Boolean.prototype.toString),hE=typeof BigInt>`u`?null:BT(BigInt.prototype.toString),gE=typeof Symbol>`u`?null:BT(Symbol.prototype.toString),_E=BT(Object.prototype.hasOwnProperty),vE=BT(Object.prototype.toString),yE=BT(RegExp.prototype.test),bE=gre(TypeError),xE=XT(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),SE=XT(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),CE=XT([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),wE=XT([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),TE=XT(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),EE=XT([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),DE=XT([`#text`]),OE=XT(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),kE=XT(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),AE=XT(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),jE=XT([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ME=ZT(/\{\{[\w\W]*|[\w\W]*\}\}/gm),NE=ZT(/<%[\w\W]*|[\w\W]*%>/gm),PE=ZT(/\$\{[\w\W]*/gm),FE=ZT(/^data-[\-\w.\u00B7-\uFFFF]+$/),IE=ZT(/^aria-[\-\w]+$/),LE=ZT(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),RE=ZT(/^(?:\w+script|data):/i),zE=ZT(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),BE=ZT(/^html$/i),VE=ZT(/^[a-z][.\w]*(-[.\w]+)+$/i),HE=Object.freeze({__proto__:null,ARIA_ATTR:IE,ATTR_WHITESPACE:zE,CUSTOM_ELEMENT:VE,DATA_ATTR:FE,DOCTYPE_NAME:BE,ERB_EXPR:NE,IS_ALLOWED_URI:LE,IS_SCRIPT_OR_DATA:RE,MUSTACHE_EXPR:ME,TMPLIT_EXPR:PE}),UE={element:1,text:3,progressingInstruction:7,comment:8,document:9},WE=function(){return typeof window>`u`?null:window},GE=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},KE=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},qE=WT()})),JE,YE=o((()=>{bre(),JE=qE.sanitize.bind(qE),qE.isSupported,qE.addHook.bind(qE),qE.removeHook.bind(qE),qE.removeHooks.bind(qE),qE.removeAllHooks.bind(qE),qE.setConfig.bind(qE),qE.clearConfig.bind(qE),qE.isValidAttribute.bind(qE),qE.version,qE.removed}));function XE(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function ZE(e){oD=e}function QE(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(lD.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}function $E(e,t){if(t){if(lD.escapeTest.test(e))return e.replace(lD.escapeReplace,gO)}else if(lD.escapeTestNoEncode.test(e))return e.replace(lD.escapeReplaceNoEncode,gO);return e}function eD(e){try{e=encodeURI(e).replace(lD.percentDecode,`%`)}catch{return null}return e}function tD(e,t){let n=e.replace(lD.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(lD.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(lD.slashPipe,`|`);return n}function nD(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function rD(e){let t=e.split(`
171
171
  `),n=t.length-1;for(;n>=0&&lD.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
172
172
  `)}function xre(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Sre(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function iD(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Cre(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
@@ -230,7 +230,7 @@ ${this.parser.parse(e)}</blockquote>
230
230
  ${e}</tr>
231
231
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
232
232
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${$E(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=eD(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+$E(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=eD(e);if(i===null)return $E(n);e=i;let a=`<img src="${e}" alt="${$E(n)}"`;return t&&(a+=` title="${$E(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:$E(e.text)}},bO=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},xO=class e{options;renderer;textRenderer;constructor(e){this.options=e||oD,this.options.renderer=this.options.renderer||new yO,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new bO}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},SO=class{options;block;constructor(e){this.options=e||oD}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?vO.lex:vO.lexInline}provideParser(e=this.block){return e?xO.parse:xO.parseInline}},CO=class{defaults=XE();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=xO;Renderer=yO;TextRenderer=bO;Lexer=vO;Tokenizer=_O;Hooks=SO;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new yO(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new _O(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new SO;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];SO.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&SO.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return vO.lex(e,t??this.defaults)}parser(e,t){return xO.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?vO.lex:vO.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?xO.parse:xO.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?vO.lex:vO.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?xO.parse:xO.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
233
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+$E(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},wO=new CO,aD.options=aD.setOptions=function(e){return wO.setOptions(e),aD.defaults=wO.defaults,ZE(aD.defaults),aD},aD.getDefaults=XE,aD.defaults=oD,aD.use=function(...e){return wO.use(...e),aD.defaults=wO.defaults,ZE(aD.defaults),aD},aD.walkTokens=function(e,t){return wO.walkTokens(e,t)},aD.parseInline=wO.parseInline,aD.Parser=xO,aD.parser=xO.parse,aD.Renderer=yO,aD.TextRenderer=bO,aD.Lexer=vO,aD.lexer=vO.lex,aD.Tokenizer=_O,aD.Hooks=SO,aD.parse=aD,aD.options,aD.setOptions,TO=aD.use,aD.walkTokens,EO=aD.parseInline,DO=aD,xO.parse,vO.lex})),kO,wre=o((()=>{kO=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`)})),AO,Tre=o((()=>{AO={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`}}));function jO(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}var MO=o((()=>{}));function Ere(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}var Dre=o((()=>{}));function Ore(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}var kre=o((()=>{}));function NO(e){return Ore(e)||jO(e)}var Are=o((()=>{kre(),MO()}));function PO(e){let t=`&`+e+`;`;FO.innerHTML=t;let n=FO.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}var FO,jre=o((()=>{FO=document.createElement(`i`)}));function Mre(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?NO:u===`decimal`?jO:Ere;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&kO.includes(y)&&(_=y,v=PO(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?PO(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):NO(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(Nre(e))h(7,S),C=`�`;else if(e in AO)h(6,S),C=AO[e];else{let t=``;Pre(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,IO[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function Nre(e){return e>=55296&&e<=57343||e>1114111}function Pre(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var IO,Fre=o((()=>{wre(),Tre(),MO(),Dre(),Are(),jre(),IO=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`]})),Ire=o((()=>{Fre()})),LO,RO,zO,BO,VO,HO=o((()=>{Bp(),gp(),YE(),OO(),Ire(),hC(),ub(),$k(),LO=(e,{allowMarkdown:t=!1}={})=>(e=EO(e),e=JE(e,{ALLOWED_TAGS:t?[`strong`,`em`,`code`]:[]}),e=Mre(e),e.trim()),RO=(e,{identifierField:t=`title`,useBody:n=!0}={})=>{let r=[t,`title`,`name`,`label`].find(t=>typeof e[t]==`string`&&!!e[t].trim());return r?e[r].trim():n&&typeof e.body==`string`?e.body.match(/^#+\s+(?<header>.+?)(?:\s+\{#.+?\})?\s*$/m)?.groups?.header??``:``},zO=(e,t)=>{let{slug:n,entryPath:r,basePath:i,locales:a,commitDate:o,commitAuthor:s}=t;if(e===`slug`)return n;if(e===`locales`)return a.sort((e,t)=>e.localeCompare(t)).join(`, `);if(e===`dirname`){let e=r.replace(/[^/]+$/,``);if(i){let t=i.endsWith(`/`)?i:`${i}/`;e.startsWith(t)?e=e.slice(t.length):e.startsWith(i)&&(e=e.slice(i.length))}return fp(e)}if(e===`filename`)return r.split(`/`).pop().split(`.`).shift();if(e===`extension`)return r.split(`/`).pop().split(`.`).pop();if(e===`commit_date`)return o??``;if(e===`commit_author`)return s?.name||s?.login||s?.email},BO=(e,t)=>{let{content:n,collectionName:r,replaceSubContext:i,defaultLocale:a}=t,[o,...s]=e.split(/\s*\|\s*/),c=o.replace(/^fields\./,``),l={collectionName:r,valueMap:n,keyPath:c},u=zO(o,i);if(u===void 0&&(u=s.some(e=>dC.test(e)||pC.test(e))?n[c]:Xk({...l,locale:a})),u===void 0)return``;if(u instanceof Date&&!s.length){let{year:e,month:t,day:n}=zp({date:u});return`${e}-${t}-${n}`}return s.length&&(u=mC({fieldConfig:Kk({...l}),value:u,transformations:s,locale:a})),String(u)},VO=(e,t,{locale:n,useTemplate:r=!1,allowMarkdown:i=!1}={})=>{if(lb(e,t))return cb(e)?.label;let{_type:a,name:o,_i18n:{defaultLocale:s}}=e,{_file:{basePath:c}={},identifier_field:l=`title`,summary:u}=a===`entry`?e:{},{locales:d,slug:f,commitDate:p,commitAuthor:m}=t,{content:h={},path:g=``}=d[n??s]??Object.values(d)[0]??{};if(!r||!u)return LO(RO(h,{identifierField:l})||f.replaceAll(`-`,` `),{allowMarkdown:i});let _={content:h,collectionName:o,replaceSubContext:{slug:f,entryPath:g,basePath:c,locales:Object.keys(d),commitDate:p,commitAuthor:m},defaultLocale:s};return LO(u.replace(/{{(.+?)}}/g,(e,t)=>BO(t,_)),{allowMarkdown:i})}})),UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik,ak,ok,sk,ck,lk,uk,dk,fk,pk,mk=o((()=>{_S(),gp(),$b(),zT(),ub(),$k(),HO(),Gx(),UO=new Map,WO=new WeakMap,GO=e=>{let t=WO.get(e);if(t)return t;let n=new Map;return e.forEach(({value:e,label:t})=>{n.has(e)||n.set(e,t)}),WO.set(e,n),n},KO=new WeakMap,qO=0,JO=e=>(KO.has(e)||(KO.set(e,qO),qO+=1),KO.get(e)),YO=e=>/{{.+?}}/.test(e)?e:e===`slug`?`{{fields.slug}}`:`{{${e}}}`,XO=e=>{if(!e||e.widget!==`list`)return!1;let t=`fields`in e,n=`types`in e;return t||n},ZO=(e,t,n)=>{let{slug:r,locale:i,getDisplayValue:a}=t,{content:o,locales:s,defaultLocale:c,identifierField:l}=n;if(e===`slug`)return r;if(e===`locale`)return i;let u=e.replace(/^fields\./,``);return a(u)||a(u,c)||RO(o,{identifierField:l})||RO(s[c]?.content||{},{identifierField:l})||r},QO=(e,t,n,r)=>{let{label:i,value:a,searchValue:o}=e;return t.forEach(e=>{let t=ZO(e,n,r);i=i.replaceAll(`{{${e}}}`,t),a=a.replaceAll(`{{${e}}}`,t),o=o?.replaceAll(`{{${e}}}`,t)??``}),{label:i,value:a,searchValue:o}},$O=e=>[...e.matchAll(/{{(.+?)}}/g)].map(e=>e[1]),ek=(e,t)=>{let n=e.value_field,r=e.display_fields??[n??`{{${t}}}`],i=e.search_fields??r,a=YO(n??`{{slug}}`),o=r.map(YO).join(` `),s=i.map(YO).join(` `),c=gS([...$O(o),...$O(a),...$O(s)]);return{_valueField:a,_displayField:o,_searchField:s,allFieldNames:c,hasListFields:c.some(e=>e.includes(`*`))}},tk=(e,t,n=void 0,r=[])=>e.filter(e=>!n||n===e.slug).map(e=>{let{content:n}=e.locales[t]??e.locales._default??{};return{refEntry:e,hasContent:!!n&&Object.keys(n).length>0,content:n??{}}}).filter(({hasContent:e,content:t})=>e&&r.every(({field:e,values:n})=>n.includes(t[e]))),nk=({templates:e,allFieldNames:t,context:n,fallbackContext:r})=>{let{slug:i}=n,{_displayField:a,_valueField:o,_searchField:s}=e,{content:c,locales:l,defaultLocale:u,identifierField:d}=r,f=Object.fromEntries(t.map(e=>[e,ZO(e,n,r)])),p=a,m=o,h=s;return Object.entries(f).forEach(([e,t])=>{p=p.replaceAll(`{{${e}}}`,t),m=m.replaceAll(`{{${e}}}`,t),h=h.replaceAll(`{{${e}}}`,t)}),(!p||p.trim()===``)&&(p=RO(c,{identifierField:d})||RO(l[u]?.content||{},{identifierField:d})||i),{label:p||``,value:m||i,searchValue:h||p||``}},rk=(e,t)=>{let n=new Map,r=new Map;return e.filter(e=>e.includes(`*`)).forEach(e=>{let r=e.replace(/\.\*.*$/,``),i=Kk({...t,keyPath:r});n.set(e,{baseFieldName:r,fieldConfig:i,isComplexListField:XO(i)})}),[...n.entries()].forEach(([e,t])=>{let{baseFieldName:n}=t;r.has(n)||r.set(n,[]),r.get(n).push([e,t])}),r},ik=new Map,ak=({baseFieldName:e,groupEntries:t,content:n,templates:r,allFieldNames:i,context:a,fallbackContext:o})=>{let{_displayField:s,_valueField:c,_searchField:l}=r,u=Wx(ik,e,()=>RegExp(`^${up(e)}.\\d+$`));return Object.entries(n).filter(([e])=>u.test(e)).map(([e,t])=>{let n=e.match(/\.(\d+)$/);return{index:parseInt(n[1],10),value:t}}).sort((e,t)=>e.index-t.index).map(({value:e})=>{let n={label:s,value:c,searchValue:l};t.forEach(([t])=>{n.label=n.label.replaceAll(`{{${t}}}`,e),n.value=n.value.replaceAll(`{{${t}}}`,e),n.searchValue=n.searchValue.replaceAll(`{{${t}}}`,e)});let{label:r,value:u,searchValue:d}=QO(n,i.filter(e=>!e.includes(`*`)),a,o);return{label:r||``,value:u||a.slug,searchValue:d||r||``}})},ok=/^(.+)\.\*\.(.+)$/,sk=new Map,ck=e=>{let t=null;return e.some(([e])=>(t=e.match(ok),!!t)),t},lk=({groupEntries:e,content:t,templates:n,allFieldNames:r,context:i,fallbackContext:a})=>{let[,o,s]=ck(e)??[];if(!o)return[];let c=Wx(sk,`${o}:${s}`,()=>{let e=up(o),t=up(s);return RegExp(`^${e}.([0-9]+).${t}$`)}),l=Object.entries(t).filter(([e])=>c.test(e)).map(([e,t])=>{let n=e.match(c);return{index:parseInt(n[1],10),value:t}}).sort((e,t)=>e.index-t.index),{_displayField:u,_valueField:d,_searchField:f}=n;return l.map(({index:n})=>{let o={label:u,value:d,searchValue:f};e.forEach(([e])=>{let r=e.match(ok);if(r){let[,i,a]=r,s=t[`${i}.${n}.${a}`]||``;o.label=o.label.replaceAll(`{{${e}}}`,s),o.value=o.value.replaceAll(`{{${e}}}`,s),o.searchValue=o.searchValue.replaceAll(`{{${e}}}`,s)}});let{label:s,value:c,searchValue:l}=QO(o,r.filter(e=>!e.includes(`*`)),i,a);return{label:s||``,value:c||i.slug,searchValue:l||s||``}})},uk=({baseFieldGroups:e,content:t,templates:n,allFieldNames:r,context:i,fallbackContext:a})=>{let o=[],s=!1;return e.forEach((e,c)=>{if(e.length===0)return;let[,l]=e[0],u={groupEntries:e,content:t,templates:n,allFieldNames:r,context:i,fallbackContext:a},d=l.isComplexListField?lk({...u}):ak({...u,baseFieldName:c});o.push(...d),s=!0}),{results:o,hasProcessedListFields:s}},dk=({refEntry:e,content:t,collection:n,templates:r,allFieldNames:i,hasListFields:a,collectionName:o,fileName:s,locale:c,identifierField:l,defaultLocale:u})=>{let{slug:d,locales:f}=e,p={collectionName:o,fileName:s,isIndexFile:lb(n,e),keyPath:``},m={slug:d,locale:c,getDisplayValue:(e,n)=>Xk({...p,keyPath:e,valueMap:n?f[n].content:t,locale:n??c})},h={content:t,locales:f,defaultLocale:u,identifierField:l};if(!a)return[nk({templates:r,allFieldNames:i,context:m,fallbackContext:h})];let{results:g,hasProcessedListFields:_}=uk({baseFieldGroups:rk(i,p),content:t,templates:r,allFieldNames:i,context:m,fallbackContext:h});if(_)return g;let{_displayField:v,_valueField:y,_searchField:b}=r,{label:x,value:S,searchValue:C}=QO({label:v,value:y,searchValue:b},i.filter(e=>!e.includes(`*`)),m,h);return[{label:x||``,value:S||d,searchValue:C||x||``}]},fk=(e,t,n)=>{let r=`${e}|${JO(t)}|${JO(n)}`,i=UO.get(r);if(i)return i;let{collection:a,file:o,filters:s}=t,c=Xb(a);if(!c)return UO.set(r,[]),[];let{_type:l,_i18n:{defaultLocale:u}}=c,{identifier_field:d=`title`}=l===`entry`?c:{},f=s??[],p=ek(t,d),{allFieldNames:m,hasListFields:h}=p,g=tk(n,e,o,f).flatMap(({refEntry:t,content:n})=>dk({refEntry:t,content:n,collection:c,templates:p,allFieldNames:m,hasListFields:h,collectionName:a,fileName:o,locale:e,identifierField:d,defaultLocale:u})).sort((e,t)=>hp(e.label,t.label));return UO.set(r,g),g},pk=({fieldConfig:e,valueMap:t,keyPath:n,locale:r})=>{let{multiple:i,collection:a}=e,o=GO(fk(r,e,FT(a))),s=e=>o.get(e)||e;return i?Object.entries(t).filter(([e])=>e.match(`^${up(n)}\\.\\d+$`)).map(([,e])=>e).map(s):s(t[n])}})),hk,gk,_k,vk=o((()=>{nc(),hk=({multiline:e,dotAll:t,source:n})=>e||t||n.includes(`[\\s\\S]`)||n.includes(`[\\S\\s]`),gk=e=>tc(Object.fromEntries(Object.entries(ec(e)).filter(([e])=>!e.split(`.`).pop()?.startsWith(`__sc_`)))),_k=e=>e.replace(/"/g,`'`)})),yk,bk,xk,Sk,Ck=o((()=>{yk=/!\[(?<alt>(?:[^\]\\]|\\.)*)\]\((?<src>(?:[^"()\\]|\\.|\([^)]*\)|"[^"]*")*?)(?:\s+"(?<title>(?:[^"\\]|\\.)*)")?\)/,bk=new RegExp(yk,`g`),xk=/\[!\[(?<alt2>(?:[^\]\\]|\\.)*)\]\((?<src2>(?:[^"()\\]|\\.|\([^)]*\)|"[^"]*")*?)(?:\s+"(?<title2>(?:[^"\\]|\\.)*)")?\)\](?:\((?<link>[^)]*\([^)]*\)[^)]*|[^)]*)\))/,Sk=RegExp(`${yk.source}|${xk.source}`)})),wk,Tk,Ek,Dk=o((()=>{YE(),wk=e=>e.replace(/&(?![a-zA-Z0-9#]+;)/g,`&amp;`).replaceAll(`"`,`&quot;`),Tk={ALLOWED_TAGS:[`a`],ALLOWED_ATTR:[`href`,`target`,`rel`]},Ek=(e,t)=>JE(e.replace(`<a>`,`<a href="${wk(t)}" target="_blank" rel="noopener noreferrer">`),Tk)})),Ok,kk,Ak,jk,Mk=o((()=>{Z(),vk(),Ck(),Dk(),Ok=new Map,kk={id:`image`,label:`Image`,fields:[{name:`src`,label:`Source`,widget:`image`},{name:`alt`,label:`Alt Text`,required:!1},{name:`title`,label:`Title`,required:!1}],pattern:yk,toBlock:e=>{let{src:t=``,alt:n=``,title:r=``}=e;return t?`![${n}](${t}${r?` "${_k(r)}"`:``})`:``},toPreview:e=>{let{src:t=``,alt:n=``,title:r=``}=e;return`<img src="${wk(t)}" alt="${wk(n)}" title="${wk(r)}">`}},Ak={id:`linked-image`,label:`Image`,fields:[...kk.fields,{name:`link`,label:`Link`,required:!1}],pattern:Sk,fromBlock:e=>{let{src:t,alt:n,title:r,src2:i,alt2:a,title2:o,link:s}=e.groups??{};return{src:(t||i||``).trim(),alt:(n||a||``).trim(),title:(r||o||``).trim(),link:(s||``).trim()}},toBlock:e=>{let{src:t=``,alt:n=``,title:r=``,link:i=``}=e,a=t?`![${n}](${t}${r?` "${_k(r)}"`:``})`:``;return a&&i?`[${a}](${i})`:a},toPreview:e=>{let{src:t=``,alt:n=``,title:r=``,link:i=``}=e,a=`<img src="${wk(t)}" alt="${wk(n)}" title="${wk(r)}">`;return i?`<a href="${wk(i)}">${a}</a>`:a}},jk=e=>{if(Ok.has(e))return Ok.get(e);let t={icon:`image`,label:X(`editor_components.image`),fields:[{name:`src`,label:X(`editor_components.src`),widget:`image`},{name:`alt`,label:X(`editor_components.alt`),required:!1},{name:`title`,label:X(`editor_components.title`),required:!1}]};return{image:{...kk,...t},"linked-image":{...Ak,...t,fields:[...t.fields,{name:`link`,label:X(`editor_components.link`),required:!1}]}}[e]}})),Nk,Pk,Fk,Ik,Lre=o((()=>{_S(),Nk=new Map,Pk=new WeakMap,Fk=e=>{let t=Pk.get(e);return t===void 0&&(t=JSON.stringify(e),Pk.set(e,t)),t},Ik=({fieldConfig:e,valueMap:t,keyPath:n})=>{let{multiple:r,options:i}=e,a=hS(i),o;if(r){let e=`${n}.`;o=Object.entries(t).filter(([t])=>t.startsWith(e)&&/^\d+$/.test(t.slice(e.length))).map(([,e])=>e)}let s=Fk(i),c=r?`${n}|${s}|${JSON.stringify(o)}`:`${n}|${s}|${String(t[n])}`,l=Nk.get(c);if(l)return l;let u=e=>i.find(t=>t.value===e)?.label||e;if(r){let e=a?o.map(u):o;return Nk.set(c,e),e}let d=t[n],f=a?u(d):d;return Nk.set(c,f),f}})),Lk,Rk,zk,Bk=o((()=>{Zf(),VP(),Lk=e=>{if(!e)return;let t=Object.values(e);if(t.some(e=>e.config?.multiple===!0))return!0;if(t.some(e=>e.config?.multiple===!1))return!1},Rk=e=>{if(!e?.config)return;let{multiple:t}=e.config;if(typeof t==`boolean`)return t},zk=e=>{let t=A(IP);return e.multiple??Lk(e.media_libraries)??Rk(e.media_library)??Lk(t?.media_libraries)??Rk(t?.media_library)??!1}})),Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,Xk,Zk,Qk,$k=o((()=>{gp(),hC(),$b(),rb(),ub(),vC(),lC(),mk(),Mk(),Lre(),_b(),Bk(),Gx(),Vk=new Map,Hk=(e,t)=>{if(e.length!==1)return!1;let[n]=e;return n.widget===t&&`root`in n&&n.root===!0},Uk=e=>{let t=e.widget??`string`;return gC.includes(t)?zk(e):_C.includes(t)?!!e.multiple:!1},Wk=e=>{let t=e.match(/^(.*?)<([^>]+)>(.*)$/);if(!t)return{cleanKey:e};let[,n,r,i]=t;return i?{cleanKey:e}:{cleanKey:n||``,typeName:r}},Gk=({field:e,key:t,keyPathArray:n,segmentIndex:r,pendingExplicitType:i,valueMap:a})=>{let{cleanKey:o,typeName:s}=Wk(t),{widget:c=`text`}=e,l=s??i,u=/^\d+$/.test(o),d=o===`*`;if((u||d)&&_C.includes(c))return{field:Uk(e)?e:void 0,explicitType:l};let{field:f}=e,{fields:p}=e,{types:m,typeKey:h=`type`}=e;if(f){let e=u||d?n[r+1]:void 0;return{field:!e||f.name===e||f.widget===`object`&&`fields`in f&&f.fields?.some(t=>t.name===e)?f:void 0,explicitType:l}}if(p&&(u||d))return{field:e,explicitType:l};if(p&&!u&&o!==``)return{field:p.find(({name:e})=>e===o),explicitType:l};if(m&&(u||d)){let e=l??a[[n.slice(0,r).join(`.`),o,h].join(`.`)];return{field:m.find(({name:t})=>t===e),explicitType:d?void 0:l}}if(m&&t!==h&&o!==h&&o!==``){let e=l??a[[n.slice(0,r).join(`.`),h].join(`.`)];return{field:m.find(({name:t})=>t===e)?.fields?.find(({name:e})=>e===o),explicitType:void 0}}return{field:void 0,explicitType:l}},Kk=e=>{let{collectionName:t,fileName:n=void 0,componentName:r=void 0,valueMap:i={},keyPath:a,isIndexFile:o=!1}=e,s=/(?:^|\.)(\d+|\*)(?:\.|$)/.test(a)?JSON.stringify(e):`${t}|${n??``}|${r??``}|${a}|${o?`1`:`0`}`;if(Vk.has(s))return Vk.get(s);let c=Xb(t),l=c&&n?Qy(c,n):void 0;if(!c||n&&c?._type!==`entry`&&!l){Vk.set(s,void 0);return}let{fields:u=[]}=l??c,d=o?cb(c):void 0,f=r?jk(r)?.fields??[]:d?.fields??u,p=a.split(`.`),m,h;if(p.forEach((e,t)=>{if(t===0){let{cleanKey:t,typeName:n}=Wk(e);m=f.find(({name:e})=>e===t),!m&&d?.fields&&(m=u.find(({name:e})=>e===t)),n&&(h=n)}else if(m){let n=Gk({field:m,key:e,keyPathArray:p,segmentIndex:t,pendingExplicitType:h,valueMap:i});m=n.field,h=n.explicitType}}),h&&m&&`types`in m){let{types:e}=m;m=e.find(({name:e})=>e===h)}return Vk.set(s,m),m},qk=({fieldConfig:{required:e=!0},locale:t})=>Array.isArray(e)?e.includes(t):!!e,Jk=new Map,Yk=new Map,Xk=({collectionName:e,fileName:t,valueMap:n={},keyPath:r,locale:i,transformations:a,isIndexFile:o=!1})=>{let s=Kk({collectionName:e,fileName:t,valueMap:n,keyPath:r,isIndexFile:o}),c=n[r];if(c===void 0&&a?.length)return``;if(s?.widget===`datetime`&&(a?.some(e=>dC.test(e))||(c=cC({locale:i,fieldConfig:s,currentValue:c}))),s?.widget===`relation`&&(c=pk({fieldConfig:s,valueMap:n,keyPath:r,locale:i})),s?.widget===`select`&&(c=Ik({fieldConfig:s,valueMap:n,keyPath:r})),s?.widget===`list`){let{fields:e}=s,{types:t}=s;if(!(e||t)){let e=Wx(Jk,r,()=>RegExp(`^${up(r)}${String.raw`\.\d+$`}`));c=hb(i).format(Object.entries(n).filter(([t,n])=>e.test(t)&&typeof n==`string`&&!!n).map(([,e])=>e))}}if(s?.widget===`number`){let{value_type:e=`int`}=s;if(e===`int`||e===`float`){let e=db(i),t=Yk.get(e);t||(t=Intl.NumberFormat(e),Yk.set(e,t)),c=t.format(Number(c))}}return Array.isArray(c)&&(c=hb(i).format(c)),a?.length&&(c=mC({fieldConfig:s,value:c,transformations:a,locale:i})),String(c??``)},Zk=({valueMap:e,locale:t,keyPath:n,keyPathRegex:r,getFieldArgs:i})=>{let a=[`${n}.title`,`${n}.name`,...Object.keys(e)].find(t=>{let n=e[t];if(!r.test(t)||!(typeof n==`string`&&n.trim()||typeof n==`number`&&!Number.isNaN(n)))return!1;let a=Kk({...i,keyPath:t});return!!a&&a.widget!==`hidden`});return a?Xk({...i,keyPath:a,locale:t}):``},Qk=({entry:e,locale:t,collectionName:n,key:r,resolveRef:i=!0})=>{let{slug:a,locales:o,commitAuthor:{name:s,login:c,email:l}={},commitDate:u}=e;if(r===`slug`)return a;if(r===`commit_author`)return s||c||l;if(r===`commit_date`)return u;let{content:d}=o[t]??{};if(d===void 0)return;let f=Xb(n);if(f){if(i){let i=Kk({collectionName:n,keyPath:r,isIndexFile:lb(f,e)});if(i?.widget===`relation`)return pk({fieldConfig:i,valueMap:d,keyPath:r,locale:t})}return d[r]}}})),eA,tA,nA,rA,iA,aA,oA,sA,cA,lA,uA,dA,fA,pA,mA=o((()=>{lp(),f(),gp(),nc(),$b(),rb(),ub(),$k(),$x(),Gx(),eA=e=>/\/_index(?:\.[\w-]+)?\.md$/.test(e),tA=new Map,nA=({subPath:e,subPathTemplate:t})=>{if(t?.includes(`{{slug}}`)){let n=Wx(tA,t,()=>{let e=``,n=t;for(;n.length>0;){let t=n.indexOf(`{{`);if(t===-1){e+=up(n);break}t>0&&(e+=up(n.substring(0,t)));let r=n.indexOf(`}}`,t);if(r===-1){e+=up(n);break}let i=n.substring(t,r+2);e+=i===`{{slug}}`?`([^/]+)`:`[^/]+?`,n=n.substring(r+2)}return RegExp(`^${e}$`)}),[,r]=e.match(n)??[];if(r)return r}return e},rA=async(e,t)=>{try{return await Qx(e)}catch(e){console.error(e),t.push(e);return}},iA=({rawContent:e,fields:t,i18nSingleFile:n,validate:r})=>{let i=t[0].name;if(n)return!u(e)||!Object.values(e).every(r)?void 0:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{[i]:t}]));if(r(e))return{[i]:e}},aA=(e,t,n)=>{if(!u(e))return;let r=t.filter(e=>e!==n),i=Object.fromEntries(Object.entries(e).filter(([e])=>!r.includes(e))),a={[n]:i};return r.forEach(t=>{u(e[t])&&(a[t]=e[t])}),a},oA=(e,t,n)=>{let r={rawContent:e,fields:t,i18nSingleFile:n};return Hk(t,`list`)?iA({...r,validate:Array.isArray}):Hk(t,`keyvalue`)?iA({...r,validate:e=>u(e)&&Object.values(e).every(e=>typeof e==`string`)}):u(e)?e:void 0},sA=(e,t,n,r,i)=>r?.split(`/`).pop()===`_index`&&/\/_index(?:\.[\w-]+)?\.[\w]+$/.test(e)&&i!==`md`?!0:eA(e)?!(t||cb(n)?.name===`_index`||r?.split(`/`).pop()===`_index`&&i===`md`):!1,cA=(e,t,n,r,i)=>{let{path:a,folder:{filePathMap:o}}=e;if(t){if(i){let[e,t]=Object.entries(o??{}).find(([,e])=>e===a)??[];return{subPath:t,locale:e}}return{subPath:a,locale:void 0}}if(!n)return{subPath:void 0,locale:void 0};let s=a.match(n);if(!s?.groups)return{subPath:void 0,locale:void 0};let{subPath:c,locale:l=r}=s.groups;return{subPath:c,locale:l}},lA=(e,t,n,r,i,a)=>{let o=r||nA({subPath:i,subPathTemplate:a});e.slug=o,e.locales._default={slug:o,path:n,content:ec(t)}},uA=(e,t,n,r,i,a,o)=>{let s=r||nA({subPath:i,subPathTemplate:a});e.slug=s,e.locales=Object.fromEntries(o.filter(e=>e in t).map(e=>[e,{slug:s,path:n,content:ec(t[e])}]))},dA=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=l&&typeof t[l]==`string`?t[l]:void 0,f=r||nA({subPath:i,subPathTemplate:a}),p={slug:f,path:n,content:ec(t)},m=`${c}/${d??f}`,h=u.find(e=>e.id===m);return h?(h.locales[o]=p,o===s&&(h.slug=f,h.subPath=i),!0):(e.id=m,e.locales[o]=p,o===s&&(e.slug=f),!1)},fA=async({file:e,entries:t,errors:n})=>{let r=await rA(e,n);if(!r)return;let{path:i,meta:a={},folder:{collectionName:o,fileName:s}}=e,c=Xb(o),l=c&&s?Qy(c,s):void 0;if(!c||s&&!l)return;let{fields:u=[],_file:{fullPathRegEx:d,subPath:f,extension:p},_i18n:{i18nEnabled:m,allLocales:h,defaultLocale:g,structureMap:{i18nSingleFile:_,i18nSingleFileFlatDefault:v,i18nMultiFile:y,i18nMultiFolder:b,i18nMultiRootFolder:x},canonicalSlug:{key:S}}}=l??c,C=v?aA(r,h,g):r;if(!C)return;let w=oA(C,u,_||v);if(!w||sA(i,s,c,f,p))return;let T=y||b||x,{subPath:ee,locale:te}=cA(e,s,d,g,T);if(!ee||T&&!te)return;let ne={id:``,slug:``,subPath:ee,locales:{},...a};if(!m)lA(ne,w,i,s,ee,f);else if(_||v)uA(ne,w,i,s,ee,f,h);else if(dA(ne,w,i,s,ee,f,te,g,o,S,t))return;t.push(ne)},pA=async e=>{let t=[],n=[];return await Promise.all(e.map(e=>fA({file:e,entries:t,errors:n}))),{entries:t.filter(e=>(e.id=op(),!!e.slug&&!!Object.keys(e.locales).length)),errors:n}}})),hA,gA=o((()=>{Rp(),zS(),Yy(),mA(),hA=e=>{let t=[],n=[],r=[];e.forEach(e=>{let{path:i,name:a}=e;if(a.startsWith(`.`))LS.test(a)&&r.push({...e,type:`config`});else{let[r]=Jy(i),[a]=Ip(i);r&&t.push({...e,type:`entry`,folder:r}),a&&!t.find(e=>e.path===i)&&!eA(i)&&n.push({...e,type:`asset`,folder:a})}});let i=[...t,...n,...r];return{entryFiles:t,assetFiles:n,configFiles:r,allFiles:i,count:i.length}}})),_A,vA,yA,bA,xA,SA,CA,wA,TA,EA=o((()=>{Zf(),_A=rn(!1),vA=rn(!1),yA=rn(!1),bA=rn(!1),xA=rn(!1),SA=rn(!1),CA=rn(!1),wA=rn(!0),TA=()=>{let{location:{hostname:e},navigator:{userAgentData:t,platform:n},matchMedia:r}=globalThis;_A.set(e===`127.0.0.1`||/^(.+\.)?localhost$/.test(e)),vA.set(`showDirectoryPicker`in globalThis),yA.set(t?.brands.some(({brand:e})=>e===`Brave`)??!1),bA.set(t?.platform===`macOS`||n.startsWith(`Mac`));let i=r(`(width < 768px)`),a=r(`(768px <= width < 1024px)`),o=r(`(1024px <= width)`),s=r(`(pointer: fine)`),c=()=>xA.set(i.matches),l=()=>SA.set(a.matches),u=()=>CA.set(o.matches),d=()=>wA.set(s.matches);c(),l(),u(),d(),i.addEventListener(`change`,c),a.addEventListener(`change`,l),o.addEventListener(`change`,u),s.addEventListener(`change`,d)}})),DA,OA,kA,AA,jA,MA,NA,PA,FA,IA,LA,RA,zA,BA,VA,HA,UA,WA,GA,KA,qA=o((()=>{_S(),kp(),gp(),Zf(),pF(),Rp(),IS(),zS(),gA(),Yy(),Eb(),mA(),EA(),QC(),DA=10*1024*1024,OA=10,kA=async(e,t,n=`file`)=>{let r=fp(t??``),i=e;if(!r){if(n===`directory`)return i;throw Error(`Path is required for file handle retrieval`)}let a=r.split(`/`),o=a.length-1;for await(let[e,t]of a.entries())i=await(e===o&&n===`file`?i.getFileHandle(t,{create:!0}):i.getDirectoryHandle(t,{create:!0}));return i},AA=(e,t)=>kA(e,t,`file`),jA=(e,t)=>kA(e,t,`directory`),MA=e=>e?VC(e,e=>up(e).replace(vb,`.+?`)):/^.+$/,NA=async(e,t,n=``)=>{let{scanningPaths:r,scanningPathsRegEx:i,fileHandles:a,pathRegexCache:o}=t;for await(let[s,c]of e.entries()){if(s.startsWith(`.`)&&!LS.test(s))continue;let e=n?`${n}/${s}`:s,l=i.some(t=>t.test(e));if(c.kind===`file`&&l&&a.push({handle:c,path:e}),c.kind===`directory`){let n=o.get(e);n||(n=MA(e),o.set(e,n)),(l||r.some(e=>n.test(e)))&&await NA(c,t,e)}}},PA=()=>{let e=A(Uy).flatMap(({filePathMap:e,folderPathMap:t})=>Object.values(e||(t??{}))),t=A(Ap).filter(({internalPath:e})=>e!==void 0).map(({internalPath:e})=>e);return gS([...e,...t].map(e=>fp(e??``)))},FA=async e=>{let t=[],n=PA();return await NA(e,{rootDirHandle:e,scanningPaths:n,scanningPathsRegEx:n.map(MA),fileHandles:t,pathRegexCache:new Map}),t.map(({handle:e,path:t})=>({handle:e,path:t.normalize(),name:e.name.normalize(),size:0,sha:``}))},IA=async e=>{let{name:t,handle:n}=e;if(t===`.gitkeep`)return e;try{let r=await n.getFile();if(r.size>DA)return console.warn(`File ${t} is too large (${r.size} bytes), skipping content read`),{...e,text:``};let i=await wp(r);return{...e,text:i}}catch(t){return console.error(t),{...e,text:``}}},LA=async e=>{let{name:t,handle:n}=e,r=FS(t);try{let t=await n.getFile(),{size:i}=t,a=await ZC(t);return{...e,kind:r,size:i,sha:a}}catch(t){return console.error(t),{...e,kind:r}}},RA=async e=>{let{entryFiles:t,assetFiles:n,configFiles:r}=hA(await FA(e)),i=[],a=[];for(let e=0;e<t.length;e+=OA){let n=t.slice(e,e+OA),r=await Promise.all(n.map(e=>IA(e)));i.push(...r)}for(let e=0;e<r.length;e+=OA){let t=r.slice(e,e+OA),n=await Promise.all(t.map(e=>IA(e)));a.push(...n)}let{entries:o,errors:s}=await pA(i),c=[];for(let e=0;e<n.length;e+=OA){let t=n.slice(e,e+OA),r=await Promise.all(t.map(e=>LA(e)));c.push(...r)}Wy.set(o),QP.set(c),RS.set(a),Gy.set(s),Vy.set(!0)},zA=()=>`move`in FileSystemFileHandle.prototype&&!A(yA),BA=async(e,t)=>{let n=await e.createWritable?.();try{await n?.write(t)}finally{try{await n?.close()}catch{}}},VA=async({rootDirHandle:e,previousPath:t,path:n})=>{let{dirname:r,basename:i}=xp(n),{dirname:a,basename:o}=xp(t),s=await AA(e,t);if(zA())return await s.move(await jA(e,r),i),s;let c=await AA(e,n),l=await jA(e,a);return await BA(c,await s.getFile()),await l.removeEntry(o),c},HA=async({rootDirHandle:e,fileHandle:t,path:n,data:r})=>{let i;if(!t)if(zA()){let{dirname:r,basename:a}=xp(fp(n));t=await AA(e,`${r?`${r}/`:``}.sveltia-tmp-${crypto.randomUUID()}`),i={dirname:r,basename:a}}else t=await AA(e,n);if(await BA(t,r),i){let{dirname:n,basename:r}=i;await t.move(await jA(e,n),r)}return t.getFile()},UA=async(e,t)=>{for(let n=t.length;n>0;--n){let r=t[n-1],i=await jA(e,t.slice(0,n-1).join(`/`)),a=await i.getDirectoryHandle(r);for await(let e of a.entries())return;await i.removeEntry(r)}},WA=async({rootDirHandle:e,path:t})=>{let{dirname:n=``,basename:r}=xp(fp(t));await(await jA(e,n)).removeEntry(r),n&&await UA(e,n.split(`/`))},GA=async(e,{action:t,path:n,previousPath:r,data:i})=>{let a;return t===`move`&&r&&(a=await VA({rootDirHandle:e,previousPath:r,path:n})),[`create`,`update`,`move`].includes(t)&&i?HA({rootDirHandle:e,fileHandle:a,path:n,data:i}):(t===`delete`&&await WA({rootDirHandle:e,path:n}),null)},KA=async(e,t)=>{let n=await Promise.all(t.map(async t=>{let{path:n,data:r}=t,i=null;if(e)try{i=await GA(e,t)}catch(e){console.error(e)}if(!i){if(r===void 0)return null;i=XC(r)}return[n,{file:i,sha:await ZC(i)}]}));return{sha:await ZC(new Date().toJSON()),files:Object.fromEntries(n.filter(e=>!!e))}}})),JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,Rre=o((()=>{mS(),Zf(),dP(),qA(),VP(),JA=`local`,YA=`Local Repository`,XA=void 0,ZA={service:``,label:``,owner:``,repo:``,branch:``},QA=new Proxy({},{get:(e,t)=>(XA??ZA)[t]}),$A=`root_dir_handle`,ej=void 0,tj=void 0,nj=async({forceReload:e=!1,showPicker:t=!0}={})=>{if(!(`showDirectoryPicker`in window))throw Error(`unsupported`);let n=e?null:await ej?.get($A)??null;if(n)if(await n.requestPermission({mode:`readwrite`})!==`granted`)n=null;else try{await n.entries().next()}catch(e){n=null,console.error(e)}if(!n&&t&&(n=await window.showDirectoryPicker(),n)){try{await n.getDirectoryHandle(`.git`)}catch(e){if(e.name===`TypeMismatchError`)await n.getFileHandle(`.git`);else throw e}await ej?.set($A,n)}return n},rj=()=>{let{name:e}=A(IP).backend;XA=iP[e]?.init?.();let{databaseName:t}=XA??{};return ej=t?new dS(t,`file-system-handles`):null,QA},ij=async({auto:e=!1})=>{let t=await nj({showPicker:!e});if(t)tj=t;else throw Error(`Directory handle could not be acquired`);return{backendName:JA}},aj=async()=>{await ej?.delete($A)},oj=async()=>{await RA(tj)},sj=async e=>KA(tj,e),cj={isGit:!1,name:JA,label:YA,repository:QA,init:rj,signIn:ij,signOut:aj,fetchFiles:oj,commitChanges:sj}})),lj,uj,dj,fj,pj,mj,hj,gj,_j,vj,zre=o((()=>{qA(),Yy(),lj=`sveltia-cms-test`,uj=`test-repo`,dj=`Test`,fj=void 0,pj=()=>void 0,mj=async()=>{try{fj=await jA(await navigator.storage.getDirectory(),lj)}catch{}return{backendName:uj}},hj=async()=>{},gj=async()=>{fj?await RA(fj):Vy.set(!0)},_j=async e=>KA(fj,e),vj={isGit:!1,name:uj,label:dj,init:pj,signIn:mj,signOut:hj,fetchFiles:gj,commitChanges:_j}})),yj,bj,xj,Sj,Cj,wj,Tj=o((()=>{yj=`gitea`,bj=`Gitea / Forgejo`,xj=`https://gitea.com/api/v1`,Sj=`https://gitea.com`,Cj=`login/oauth/authorize`,wj=1.24})),Ej,Dj=o((()=>{mS(),Zf(),Ej=rn(),Ej.subscribe(e=>{(async()=>{try{e?await pS.set(`sveltia-cms.user`,e):e===null&&await pS.delete(`sveltia-cms.user`)}catch{}})()})})),Oj,kj,Aj,jj,Mj,Nj,Pj=o((()=>{Z(),Zf(),Dj(),iS(),Oj={clientId:``,authScope:``,authURL:``,tokenURL:``,authScheme:`token`,restBaseURL:``,graphqlBaseURL:``},kj={...Oj},Aj={},jj=async({clientId:e,tokenURL:t,refreshToken:n})=>{let r,i=``;if(!nS(t))throw Error(X(`sign_in_error.TOKEN_REFRESH_FAILED`));try{r=await fetch(t,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({grant_type:`refresh_token`,client_id:e,refresh_token:n})})}catch{}if(!r?.ok)throw Error(X(`sign_in_error.TOKEN_REFRESH_FAILED`));return{access_token:i,refresh_token:n}=await r.json(),Ej.update(e=>e&&{...e,token:i,refreshToken:n}),{token:i,refreshToken:n}},Mj=async(e,{method:t=`GET`,headers:n={},body:r=null,isGraphQL:i=!1,responseType:a=`json`,token:o=void 0,refreshToken:s=void 0}={})=>{let{clientId:c,tokenURL:l,restBaseURL:u,graphqlBaseURL:d,authScheme:f=`token`}=kj,p=A(Ej),m=i?d:u;return o??=p?.token,s??=p?.refreshToken,n.Authorization=`${f} ${o}`,rS(`${m}${e}`,{method:t,headers:n,body:r},{responseType:a,refreshAccessToken:s?()=>jj({clientId:c,tokenURL:l,refreshToken:s}):void 0})},Nj=async(e,t={})=>{e=e.replace(/\n\s*/g,` `),Object.entries(Aj).forEach(([n,r])=>{e.includes(`$${n}`)&&(t[n]??=r)});let{data:n}=await Mj(``,{method:`POST`,body:{query:e,variables:t},isGraphQL:!0});return n}})),Fj,Ij=o((()=>{Zf(),Pj(),Dj(),Fj=async({token:e,refreshToken:t},n,r)=>{let i=await Mj(`/user`,{token:e,refreshToken:t}),a=A(Ej);return a?.token&&a.token!==e&&(e=a.token,t=a.refreshToken),{backendName:n,id:i.id,name:i[r.name],login:i[r.login],email:i.email,avatarURL:i.avatar_url,profileURL:i[r.profileURL],token:e,refreshToken:t}}})),Lj,Bre=o((()=>{Tj(),Ij(),Lj=e=>Fj(e,yj,{name:`full_name`,login:`login`,profileURL:`html_url`})})),Rj,zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj=o((()=>{Z(),lp(),f(),mS(),Zf(),VP(),iS(),Rj=rn(!1),zj=({authURL:e})=>{let{availHeight:t,availWidth:n}=window.screen,r=t/2-800/2,i=n/2-600/2;return window.open(e,`auth`,`width=600,height=800,top=${r},left=${i}`)},Bj=async({backendName:e,authURL:t})=>{let n=zj({authURL:t});return new Promise((r,i)=>{let a=e===`github`?setInterval(()=>{n?.closed&&(clearInterval(a),i(Object.assign(Error(`Authentication aborted`),{name:`AbortError`})))},1e3):0,o=({origin:s,data:c})=>{if(s!==new URL(t).origin||typeof c!=`string`)return;let l=e;if(c===`authorizing:${l}`){n?.postMessage(c,s);return}let{result:d}=c.match(`^authorization:${l}:(success|error):(?<result>.+)`)?.groups??{},f;try{f=d?JSON.parse(d):{error:`No data`},u(f)||(f={error:`Malformed data`})}catch{f={error:`Malformed data`}}`token`in f?r(f):i(Error(`Authentication failed`,{cause:Error(f.errorCode?X(`sign_in_error.${f.errorCode}`,{default:f.error}):f.error)})),window.removeEventListener(`message`,o),clearInterval(a),n?.close()};window.addEventListener(`message`,o)})},Vj=async({backendName:e,siteDomain:t,authURL:n,scope:r})=>{let{hostname:i}=window.location;t??=i===`localhost`?`cms.netlify.com`:i;try{new URL(n).origin===`https://api.netlify.com`&&(t=new URL(`https://${t}`).hostname)}catch{}return Bj({backendName:e,authURL:`${n}?${new URLSearchParams({provider:e,site_id:t,scope:r})}`})},Hj=async()=>{let e=`${sp()}${sp()}`,t=btoa(await cp(e,{algorithm:`SHA-256`,format:`binary`})).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``);return{csrfToken:op().replaceAll(`-`,``),codeVerifier:e,codeChallenge:t}},Uj=async({backendName:e,clientId:t,authURL:n,scope:r})=>{let{csrfToken:i,codeVerifier:a,codeChallenge:o}=await Hj(),{origin:s,pathname:c}=window.location,l=`${s}${c}`,u=new URLSearchParams({client_id:t,redirect_uri:l,response_type:`code`,state:i,scope:r,code_challenge:o,code_challenge_method:`S256`});return await pS.set(`sveltia-cms.auth`,{csrfToken:i,codeVerifier:a,realAuthURL:`${n}?${u}`}),await pS.set(`sveltia-cms.user`,{backendName:e}),Bj({backendName:e,authURL:l})},Wj=({provider:e=`unknown`,token:t,refreshToken:n,error:r,errorCode:i})=>{let a=r?`error`:`success`,o=r?{provider:e,error:r,errorCode:i}:{provider:e,token:t,refreshToken:n},s=({data:t,origin:n})=>{t===`authorizing:${e}`&&(window.opener?.postMessage(`authorization:${e}:${a}:${JSON.stringify(o)}`,n),window.removeEventListener(`message`,s))};window.addEventListener(`message`,s),window.opener?.postMessage(`authorizing:${e}`,window.location.origin)},Gj=async({backendName:e,clientId:t,tokenURL:n,code:r,state:i})=>{let{origin:a,pathname:o}=new URL(window.location.href),{csrfToken:s,codeVerifier:c}=await pS.get(`sveltia-cms.auth`)??{},l=e,u=`${a}${o}`;if(await pS.delete(`sveltia-cms.auth`),!s||!c||i!==s)return Wj({provider:l,error:X(`sign_in_error.CSRF_DETECTED`),errorCode:`CSRF_DETECTED`});let d,f=``,p=``,m=``;if(!nS(n))return Wj({provider:l,error:X(`sign_in_error.TOKEN_REQUEST_FAILED`),errorCode:`TOKEN_REQUEST_FAILED`});try{d=await fetch(n,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({grant_type:`authorization_code`,client_id:t,code:r,redirect_uri:u,code_verifier:c})})}catch{}if(!d)return Wj({provider:l,error:X(`sign_in_error.TOKEN_REQUEST_FAILED`),errorCode:`TOKEN_REQUEST_FAILED`});try{({access_token:f,refresh_token:p,error:m}=await d.json())}catch{return Wj({provider:l,error:X(`sign_in_error.MALFORMED_RESPONSE`),errorCode:`MALFORMED_RESPONSE`})}return Wj({provider:l,token:f,refreshToken:p,error:m})},Kj=async({backendName:e,clientId:t,tokenURL:n})=>{Rj.set(!0);let{search:r}=window.location,{code:i,state:a}=Object.fromEntries(new URLSearchParams(r));if(i&&a)await Gj({backendName:e,clientId:t,tokenURL:n,code:i,state:a});else{let{realAuthURL:e}=await pS.get(`sveltia-cms.auth`)??{};e&&(window.location.href=e)}},qj=async({auto:e,apiConfig:t})=>{let{backend:n}=A(IP),{name:r,site_domain:i,auth_type:a}=n,{clientId:o,authScope:s,authURL:c,tokenURL:l}=t,u={backendName:r,authURL:c,scope:s};if(r===`gitea`||a===`pkce`){let t=window.opener?.origin===window.location.origin&&window.name===`auth`;return t&&await Kj({backendName:r,clientId:o,tokenURL:l}),t||e?void 0:Uj({...u,clientId:o})}if(!e)return Vj({...u,siteDomain:i})},Jj=async({options:{token:e,refreshToken:t,auto:n=!1},apiConfig:r})=>{if(!e){let i=await qj({auto:n,apiConfig:r});if(!i)return;({token:e,refreshToken:t}=i)}return{token:e,refreshToken:t}}})),Xj,Zj,Qj,Vre=o((()=>{Bre(),Pj(),Yj(),Xj=e=>{let{origin:t}=new URL(e);return`${t}/user/settings/applications`},Zj=async e=>{let{token:t,refreshToken:n}=await Jj({options:e,apiConfig:kj})??{};if(t)return Lj({token:t,refreshToken:n})},Qj=async()=>void 0})),$j,eM,tM=o((()=>{$j={service:``,label:``,owner:``,repo:``,branch:``,repoURL:``,treeBaseURL:``,blobBaseURL:``,isSelfHosted:!1,databaseName:``},eM=(e,t)=>`${e===`https://api.github.com`?`https://github.com`:e.replace(/\/api(?:\/v\d+)?(?:\/.*)?/,``)}/${t}`})),nM,rM,iM,aM,oM,sM,cM=o((()=>{Z(),Pj(),tM(),nM={...$j},rM=null,iM=(e,t)=>({treeBaseURL:t?`${e}/src/branch/${t}`:e,blobBaseURL:t?`${e}/src/branch/${t}`:``,commitBaseURL:`${e}/commit`}),aM=async()=>{let{owner:e,repo:t}=nM;return rM??=await Mj(`/repos/${e}/${t}`),rM},oM=async()=>{let{repo:e}=nM;try{let{permissions:t}=await aM();if(!t?.pull)throw Error(`Not a collaborator of the repository`,{cause:Error(X(`repository_no_access`,{values:{repo:e}}))})}catch(t){throw t instanceof Error&&t.message.includes(`Not a collaborator`)?t:Error(`Failed to check repository access`,{cause:Error(X(`repository_not_found`,{values:{repo:e}}))})}},sM=async()=>{let{repo:e,repoURL:t=``}=nM;try{let{default_branch:n}=await aM();if(!n)throw Error(`Failed to retrieve the default branch name.`,{cause:Error(X(`repository_empty`,{values:{repo:e}}))});return Object.assign(nM,{branch:n},iM(t,n)),n}catch{throw Error(`Failed to retrieve the default branch name.`,{cause:Error(X(`repository_not_found`,{values:{repo:e}}))})}}})),lM,uM,dM=o((()=>{Zf(),VP(),$b(),Dj(),lM={create:`Create {{collection}} “{{slug}}”`,update:`Update {{collection}} “{{slug}}”`,delete:`Delete {{collection}} “{{slug}}”`,uploadMedia:`Upload “{{path}}”`,deleteMedia:`Delete “{{path}}”`,openAuthoring:`{{message}}`},uM=(e,{commitType:t=`update`,collection:n,skipCI:r=void 0})=>{let{commit_messages:i={},skip_ci:a,automatic_deployments:o}=A(IP)?.backend??{},{email:s=``,login:c=``,name:l=``}=A(Ej),[u=``]=e.map(e=>e.slug).filter(Boolean),[d,...f]=e.map(({path:e})=>e),p=n?Zb(n,{useSingular:!0}):``,m=i[t]||lM[t]||``;return[`create`,`update`,`delete`].includes(t)&&(m=m.replaceAll(`{{slug}}`,u).replaceAll(`{{collection}}`,p).replaceAll(`{{path}}`,d).replaceAll(`{{author-email}}`,s).replaceAll(`{{author-login}}`,c).replaceAll(`{{author-name}}`,l)),[`uploadMedia`,`deleteMedia`].includes(t)&&(m=m.replaceAll(`{{path}}`,d).replaceAll(`{{author-email}}`,s).replaceAll(`{{author-login}}`,c).replaceAll(`{{author-name}}`,l),f.length&&(m+=` +${f.length}`)),[`openAuthoring`].includes(t)&&(m=m.replaceAll(`{{message}}`,t).replaceAll(`{{author-email}}`,s).replaceAll(`{{author-login}}`,c).replaceAll(`{{author-name}}`,l)),![`delete`,`deleteMedia`].includes(t)&&(r??(a===!0||o===!1))&&(m=`[skip ci] ${m}`),m}})),fM,pM,mM,hM=o((()=>{Z(),kp(),Zf(),cM(),Pj(),dM(),Dj(),fM=async()=>{let{owner:e,repo:t,branch:n}=nM;try{let{commit:{id:r,message:i}}=await Mj(`/repos/${e}/${t}/branches/${n}`);return{hash:r,message:i}}catch{throw Error(`Failed to retrieve the last commit hash.`,{cause:Error(X(`branch_not_found`,{values:{repo:t,branch:n}}))})}},pM=async(e,t)=>{let{owner:n,repo:r,branch:i}=nM,a=uM(e,t),{name:o,email:s}=A(Ej),c=new Date().toJSON(),l=await Promise.all(e.map(async({action:e,path:t,previousPath:n,previousSha:r,data:i=``})=>({operation:e===`move`?`update`:e,path:t,content:await Ep(i),from_path:n,sha:r}))),{commit:u,files:d}=await Mj(`/repos/${n}/${r}/contents`,{method:`POST`,body:{branch:i,author:{name:o,email:s},committer:{name:o,email:s},dates:{author:c,committer:c},message:a,files:l}});return{sha:u.sha,date:new Date(u.created),files:Object.fromEntries(d.map((t,n)=>[t?.path??e[n].path,{sha:t?.sha??``}]))}},mM=async e=>{let{owner:t,repo:n,branch:r}=nM,i=await Promise.all(e.map(e=>Mj(`/repos/${t}/${n}/commits?sha=${encodeURIComponent(r??``)}&path=${encodeURIComponent(e)}&limit=100`))),a=new Map;return i.flat().forEach(e=>{a.has(e.sha)||a.set(e.sha,{sha:e.sha,authorName:e.commit?.author?.name??``,authorEmail:e.commit?.author?.email,authorAvatarURL:e.author?.avatar_url,authorLogin:e.author?.login,date:new Date(e.commit?.author?.date??e.created)})}),[...a.values()].sort((e,t)=>t.date.getTime()-e.date.getTime())}})),gM,_M,Hre=o((()=>{Z(),Tj(),cM(),Pj(),gM={isForgejo:!1},_M=async()=>{let{version:e}=await Mj(`/version`),t=Number.parseFloat(e),n=t>10,r=n?`Forgejo`:`Gitea`,i=n?12:wj;if(Object.assign(gM,{isForgejo:n}),Object.assign(nM,{label:r}),t<i)throw Error(`Unsupported ${r} version`,{cause:Error(X(`backend_unsupported_version`,{values:{name:r,version:i}}))})}})),vM,yM,bM,xM,SM,CM,wM,TM=o((()=>{kp(),mS(),pF(),IS(),dP(),zS(),gA(),Yy(),mA(),vM=async({metaDB:e,lastHash:t,cachedFileEntries:n,fetchFileList:r})=>{let i=await e.get(`last_commit_hash`),a=await e.get(`git_config_fetched`);if(i&&i===t&&a&&n.length)return hA(n.map(([e,t])=>({path:e,name:xp(e).basename,...t})));let o=hA(await r(t));return e.set(`last_commit_hash`,t),e.set(`git_config_fetched`,!0),o},yM=({allFiles:e,cachedFiles:t})=>{e.forEach(({sha:n,path:r},i)=>{t[r]?.sha===n&&Object.assign(e[i],t[r])})},bM=({fileInfo:e,fetchedFileMap:t})=>{let{meta:n,size:r,text:i}=t[e.path]??{};return{...e,size:e.size??r,text:e.text??i,meta:e.meta??n}},xM=e=>{let{name:t,meta:n={},...r}=e,i=FS(t);return{...r,...n,name:t,kind:i}},SM=({entries:e,assets:t,configFiles:n,errors:r=[]})=>{Wy.set(e),QP.set(t),RS.set(n),Gy.set(r),Vy.set(!0)},CM=async({cacheDB:e,allFiles:t,cachedFiles:n,fetchingFiles:r,fetchedFileMap:i})=>{let a=new Set(t.map(({path:e})=>e)),o=Object.keys(n).filter(e=>!a.has(e));r.length&&await e.saveEntries(Object.entries(i)),o.length&&e.deleteEntries(o)},wM=async({repository:e,fetchDefaultBranchName:t,fetchLastCommit:n,fetchFileList:r,fetchFileContents:i})=>{let{databaseName:a,branch:o}=e,s=new dS(a,`meta`),c=new dS(a,`file-cache`),l=await c.entries(),u=o;u||(u=await t(),e.branch=u);let{hash:d,message:f}=await n(),p=await vM({metaDB:s,lastHash:d,cachedFileEntries:l,fetchFileList:r});if(uP.set(!f.startsWith(`[skip ci]`)),!p.count){SM({entries:[],assets:[],configFiles:[]});return}let{entryFiles:m,assetFiles:h,configFiles:g,allFiles:_}=p,v=Object.fromEntries(l);yM({allFiles:_,cachedFiles:v});let y=_.filter(({meta:e})=>!e),b=y.length?await i(y):{},{entries:x,errors:S}=await pA(m.map(e=>bM({fileInfo:e,fetchedFileMap:b})));SM({entries:x,assets:h.map(e=>xM(bM({fileInfo:e,fetchedFileMap:b}))),configFiles:g.map(e=>bM({fileInfo:e,fetchedFileMap:b})),errors:S}),await CM({cacheDB:c,allFiles:_,cachedFiles:v,fetchingFiles:y,fetchedFileMap:b})}})),EM,DM,OM,kM,AM,Ure=o((()=>{kp(),hM(),Hre(),cM(),Pj(),TM(),Yy(),EM=async e=>{let{owner:t,repo:n,branch:r}=nM,i=`/repos/${t}/${n}/git/trees/${e??r}?recursive=1`,a=[],o=1;for(;;){let{tree:e,truncated:t}=await Mj(`${i}&page=${o}`);if(e&&a.push(...e),e&&t)o+=1;else break}return a.filter(({type:e})=>e===`blob`).map(({path:e,sha:t,size:n})=>({path:e,sha:t,size:n,name:xp(e).basename}))},DM=async(e,t)=>{let n=await Promise.all(e.map(async({path:e,sha:n,size:r},i)=>{let a=t[i];return[e,{sha:n,size:r??0,text:a?.content&&a.encoding===`base64`?await Dp(a.content):``,meta:{}}]}).filter(e=>!!e));return Object.fromEntries(n)},OM=async e=>{let{owner:t,repo:n,branch:r}=nM,{isForgejo:i}=gM,a=i?`/repos/${t}/${n}/git/blobs`:`/repos/${t}/${n}/file-contents?ref=${r}`,o=i?`sha`:`path`,s=e.filter(({type:e})=>e!==`asset`).map(({[o]:e})=>e);if(!s.length)return{};let c=[],l=[...s];Hy.set(0);let{default_paging_num:u=30}=await Mj(`/settings/api`);for(;;){let e=l.splice(0,u),t=await(i?Mj(`${a}?shas=${e.join(`,`)}`):Mj(a,{method:`POST`,body:{files:e}}));if(c.push(...t),Hy.set(Math.ceil((s.length-l.length)/s.length*100)),!l.length)break}return Hy.set(void 0),DM(e,c)},kM=async()=>{await _M(),await oM(),await wM({repository:nM,fetchDefaultBranchName:sM,fetchLastCommit:fM,fetchFileList:EM,fetchFileContents:OM})},AM=async e=>{let{owner:t,repo:n,branch:r}=nM,{path:i}=e;return Mj(`/repos/${t}/${n}/media/${r}/${encodeURI(i)}`,{responseType:`blob`})}})),jM=s(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),MM,NM,PM,FM,IM=o((()=>{Z(),mS(),MM=l(jM(),1),Zf(),NM=`sveltia-cms.prefs`,PM=rn(),FM=rn({},e=>{PM.set(void 0),(async()=>{try{let t=await pS.get(NM)??{};t.apiKeys??={},t.useDraftBackup??=!0,t.closeOnSave??=!0,t.closeWithEscape??=!0,t.underlineLinks??=!0,t.beta??=!1,t.devModeEnabled??=!1,t.defaultTranslationService??=`google`,e(t)}catch{PM.set({type:`permission_denied`})}})()}),FM.subscribe(e=>{if(!e||!Object.keys(e).length)return;(async()=>{try{(0,MM.default)(e,await pS.get(NM))||await pS.set(NM,e)}catch{}})();let{locale:t,theme:n,underlineLinks:r=!0,beta:i=!1,devModeEnabled:a=!1}=e;t&&Sh.includes(t)&&Lh.set(t);let o=!n||n===`auto`,s=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;Object.assign(document.documentElement.dataset,{theme:o?s:n,autoTheming:o,underlineLinks:r,beta:i,devMode:a})})})),LM,RM,Wre=o((()=>{gp(),Zf(),Vre(),hM(),Tj(),Ure(),cM(),Pj(),tM(),VP(),IM(),LM=()=>{let{backend:e}=A(IP)??{};if(e?.name!==`gitea`)return;let{repo:t,branch:n,base_url:r=Sj,auth_endpoint:i=Cj,app_id:a=``,api_root:o=xj}=e,[s,c]=t.split(`/`),l=`${s}/${c}`,u=`${fp(r)}/${fp(i)}`,d=eM(o,l);return Object.assign(nM,{service:yj,label:bj,owner:s,repo:c,branch:n,repoURL:d,tokenPageURL:Xj(d),databaseName:`${yj}:${l}`,isSelfHosted:o!==xj},iM(d,n)),Object.assign(kj,{clientId:a,authScope:`read:repository,write:repository,read:user`,authURL:u,tokenURL:u.replace(`/authorize`,`/access_token`),restBaseURL:fp(o)}),A(FM).devModeEnabled&&console.info(`repositoryInfo`,nM),nM},RM={isGit:!0,name:yj,label:bj,repository:nM,init:LM,signIn:Zj,signOut:Qj,fetchFiles:kM,fetchBlob:AM,commitChanges:pM,fetchFileCommits:mM}})),zM,BM,VM,HM,UM,WM,GM,KM=o((()=>{zM=`github`,BM=`GitHub`,VM=`https://api.github.com`,HM=`https://api.netlify.com`,UM=`auth`,WM=`https://github.com`,GM=`login/oauth/authorize`})),qM,JM,Gre=o((()=>{gp(),KM(),qM=e=>(e=fp(e),e===`https://api.github.com`||e.endsWith(`/api/v3`)?e:e.endsWith(`/api`)?`${e}/v3`:`${e}/api/v3`),JM=e=>(e=fp(e),e===`https://api.github.com`?`${e}/graphql`:e.endsWith(`/graphql`)?e:e.endsWith(`/api/v3`)?e.replace(`/api/v3`,`/graphql`):e.endsWith(`/api`)?`${e}/graphql`:`${e}/api/graphql`)})),YM,Kre=o((()=>{KM(),Ij(),YM=e=>Fj(e,zM,{name:`name`,login:`login`,profileURL:`html_url`})})),XM,ZM,QM,qre=o((()=>{Kre(),Pj(),Yj(),XM=e=>{let{origin:t}=new URL(e);return`${t}/settings/personal-access-tokens/new?${new URLSearchParams({name:`Sveltia CMS`,contents:`write`})}`},ZM=async e=>{let{token:t,refreshToken:n}=await Jj({options:e,apiConfig:kj})??{};if(t)return YM({token:t,refreshToken:n})},QM=async()=>void 0})),$M,eN,tN,nN,rN,iN=o((()=>{Z(),Zf(),Pj(),tM(),Dj(),$M={...$j},eN=(e,t)=>({treeBaseURL:t?`${e}/tree/${t}`:e,blobBaseURL:t?`${e}/blob/${t}`:``,commitBaseURL:`${e}/commit`}),tN=async()=>{let{owner:e,repo:t}=$M,n=A(Ej)?.login,{ok:r}=await Mj(`/repos/${e}/${t}/collaborators/${encodeURIComponent(n)}`,{headers:{Accept:`application/json`},responseType:`raw`});if(!r)throw Error(`Not a collaborator of the repository`,{cause:Error(X(`repository_no_access`,{values:{repo:t}}))})},nN=`
233
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+$E(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},wO=new CO,aD.options=aD.setOptions=function(e){return wO.setOptions(e),aD.defaults=wO.defaults,ZE(aD.defaults),aD},aD.getDefaults=XE,aD.defaults=oD,aD.use=function(...e){return wO.use(...e),aD.defaults=wO.defaults,ZE(aD.defaults),aD},aD.walkTokens=function(e,t){return wO.walkTokens(e,t)},aD.parseInline=wO.parseInline,aD.Parser=xO,aD.parser=xO.parse,aD.Renderer=yO,aD.TextRenderer=bO,aD.Lexer=vO,aD.lexer=vO.lex,aD.Tokenizer=_O,aD.Hooks=SO,aD.parse=aD,aD.options,aD.setOptions,TO=aD.use,aD.walkTokens,EO=aD.parseInline,DO=aD,xO.parse,vO.lex})),kO,wre=o((()=>{kO=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`)})),AO,Tre=o((()=>{AO={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`}}));function jO(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}var MO=o((()=>{}));function Ere(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}var Dre=o((()=>{}));function Ore(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}var kre=o((()=>{}));function NO(e){return Ore(e)||jO(e)}var Are=o((()=>{kre(),MO()}));function PO(e){let t=`&`+e+`;`;FO.innerHTML=t;let n=FO.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}var FO,jre=o((()=>{FO=document.createElement(`i`)}));function Mre(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?NO:u===`decimal`?jO:Ere;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&kO.includes(y)&&(_=y,v=PO(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?PO(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):NO(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(Nre(e))h(7,S),C=`�`;else if(e in AO)h(6,S),C=AO[e];else{let t=``;Pre(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,IO[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function Nre(e){return e>=55296&&e<=57343||e>1114111}function Pre(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var IO,Fre=o((()=>{wre(),Tre(),MO(),Dre(),Are(),jre(),IO=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`]})),Ire=o((()=>{Fre()})),LO,RO,zO,BO,VO,HO=o((()=>{Bp(),gp(),YE(),OO(),Ire(),hC(),ub(),$k(),LO=(e,{allowMarkdown:t=!1}={})=>(e=EO(e),e=JE(e,{ALLOWED_TAGS:t?[`strong`,`em`,`code`]:[]}),e=Mre(e),e.trim()),RO=(e,{identifierField:t=`title`,useBody:n=!0}={})=>{let r=[t,`title`,`name`,`label`].find(t=>typeof e[t]==`string`&&!!e[t].trim());return r?e[r].trim():n&&typeof e.body==`string`?e.body.match(/^#+\s+(?<header>.+?)(?:\s+\{#.+?\})?\s*$/m)?.groups?.header??``:``},zO=(e,t)=>{let{slug:n,entryPath:r,basePath:i,locales:a,commitDate:o,commitAuthor:s}=t;if(e===`slug`)return n;if(e===`locales`)return a.sort((e,t)=>e.localeCompare(t)).join(`, `);if(e===`dirname`){let e=r.replace(/[^/]+$/,``);if(i){let t=i.endsWith(`/`)?i:`${i}/`;e.startsWith(t)?e=e.slice(t.length):e.startsWith(i)&&(e=e.slice(i.length))}return fp(e)}if(e===`filename`)return r.split(`/`).pop().split(`.`).shift();if(e===`extension`)return r.split(`/`).pop().split(`.`).pop();if(e===`commit_date`)return o??``;if(e===`commit_author`)return s?.name||s?.login||s?.email},BO=(e,t)=>{let{content:n,collectionName:r,replaceSubContext:i,defaultLocale:a}=t,[o,...s]=e.split(/\s*\|\s*/),c=o.replace(/^fields\./,``),l={collectionName:r,valueMap:n,keyPath:c},u=zO(o,i);if(u===void 0&&(u=s.some(e=>dC.test(e)||pC.test(e))?n[c]:Xk({...l,locale:a})),u===void 0)return``;if(u instanceof Date&&!s.length){let{year:e,month:t,day:n}=zp({date:u});return`${e}-${t}-${n}`}return s.length&&(u=mC({fieldConfig:Kk({...l}),value:u,transformations:s,locale:a})),String(u)},VO=(e,t,{locale:n,useTemplate:r=!1,allowMarkdown:i=!1}={})=>{if(lb(e,t))return cb(e)?.label;let{_type:a,name:o,_i18n:{defaultLocale:s}}=e,{_file:{basePath:c}={},identifier_field:l=`title`,summary:u}=a===`entry`?e:{},{locales:d,slug:f,commitDate:p,commitAuthor:m}=t,{content:h={},path:g=``}=d[n??s]??Object.values(d)[0]??{};if(!r||!u)return LO(RO(h,{identifierField:l})||f.replaceAll(`-`,` `),{allowMarkdown:i});let _={content:h,collectionName:o,replaceSubContext:{slug:f,entryPath:g,basePath:c,locales:Object.keys(d),commitDate:p,commitAuthor:m},defaultLocale:s};return LO(u.replace(/{{(.+?)}}/g,(e,t)=>BO(t,_)),{allowMarkdown:i})}})),UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik,ak,ok,sk,ck,lk,uk,dk,fk,pk,mk=o((()=>{_S(),gp(),$b(),zT(),ub(),$k(),HO(),Gx(),UO=new Map,WO=new WeakMap,GO=e=>{let t=WO.get(e);if(t)return t;let n=new Map;return e.forEach(({value:e,label:t})=>{n.has(e)||n.set(e,t)}),WO.set(e,n),n},KO=new WeakMap,qO=0,JO=e=>(KO.has(e)||(KO.set(e,qO),qO+=1),KO.get(e)),YO=e=>/{{.+?}}/.test(e)?e:e===`slug`?`{{fields.slug}}`:`{{${e}}}`,XO=e=>{if(!e||e.widget!==`list`)return!1;let t=`fields`in e,n=`types`in e;return t||n},ZO=(e,t,n)=>{let{slug:r,locale:i,getDisplayValue:a}=t,{content:o,locales:s,defaultLocale:c,identifierField:l}=n;if(e===`slug`)return r;if(e===`locale`)return i;let u=e.replace(/^fields\./,``);return a(u)||a(u,c)||RO(o,{identifierField:l})||RO(s[c]?.content||{},{identifierField:l})||r},QO=(e,t,n,r)=>{let{label:i,value:a,searchValue:o}=e;return t.forEach(e=>{let t=ZO(e,n,r);i=i.replaceAll(`{{${e}}}`,t),a=a.replaceAll(`{{${e}}}`,t),o=o?.replaceAll(`{{${e}}}`,t)??``}),{label:i,value:a,searchValue:o}},$O=e=>[...e.matchAll(/{{(.+?)}}/g)].map(e=>e[1]),ek=(e,t)=>{let n=e.value_field,r=e.display_fields??[n??`{{${t}}}`],i=e.search_fields??r,a=YO(n??`{{slug}}`),o=r.map(YO).join(` `),s=i.map(YO).join(` `),c=gS([...$O(o),...$O(a),...$O(s)]);return{_valueField:a,_displayField:o,_searchField:s,allFieldNames:c,hasListFields:c.some(e=>e.includes(`*`))}},tk=(e,t,n=void 0,r=[])=>e.filter(e=>!n||n===e.slug).map(e=>{let{content:n}=e.locales[t]??e.locales._default??{};return{refEntry:e,hasContent:!!n&&Object.keys(n).length>0,content:n??{}}}).filter(({hasContent:e,content:t})=>e&&r.every(({field:e,values:n})=>n.includes(t[e]))),nk=({templates:e,allFieldNames:t,context:n,fallbackContext:r})=>{let{slug:i}=n,{_displayField:a,_valueField:o,_searchField:s}=e,{content:c,locales:l,defaultLocale:u,identifierField:d}=r,f=Object.fromEntries(t.map(e=>[e,ZO(e,n,r)])),p=a,m=o,h=s;return Object.entries(f).forEach(([e,t])=>{p=p.replaceAll(`{{${e}}}`,t),m=m.replaceAll(`{{${e}}}`,t),h=h.replaceAll(`{{${e}}}`,t)}),(!p||p.trim()===``)&&(p=RO(c,{identifierField:d})||RO(l[u]?.content||{},{identifierField:d})||i),{label:p||``,value:m||i,searchValue:h||p||``}},rk=(e,t)=>{let n=new Map,r=new Map;return e.filter(e=>e.includes(`*`)).forEach(e=>{let r=e.replace(/\.\*.*$/,``),i=Kk({...t,keyPath:r});n.set(e,{baseFieldName:r,fieldConfig:i,isComplexListField:XO(i)})}),[...n.entries()].forEach(([e,t])=>{let{baseFieldName:n}=t;r.has(n)||r.set(n,[]),r.get(n).push([e,t])}),r},ik=new Map,ak=({baseFieldName:e,groupEntries:t,content:n,templates:r,allFieldNames:i,context:a,fallbackContext:o})=>{let{_displayField:s,_valueField:c,_searchField:l}=r,u=Wx(ik,e,()=>RegExp(`^${up(e)}.\\d+$`));return Object.entries(n).filter(([e])=>u.test(e)).map(([e,t])=>{let n=e.match(/\.(\d+)$/);return{index:parseInt(n[1],10),value:t}}).sort((e,t)=>e.index-t.index).map(({value:e})=>{let n={label:s,value:c,searchValue:l};t.forEach(([t])=>{n.label=n.label.replaceAll(`{{${t}}}`,e),n.value=n.value.replaceAll(`{{${t}}}`,e),n.searchValue=n.searchValue.replaceAll(`{{${t}}}`,e)});let{label:r,value:u,searchValue:d}=QO(n,i.filter(e=>!e.includes(`*`)),a,o);return{label:r||``,value:u||a.slug,searchValue:d||r||``}})},ok=/^(.+)\.\*\.(.+)$/,sk=new Map,ck=e=>{let t=null;return e.some(([e])=>(t=e.match(ok),!!t)),t},lk=({groupEntries:e,content:t,templates:n,allFieldNames:r,context:i,fallbackContext:a})=>{let[,o,s]=ck(e)??[];if(!o)return[];let c=Wx(sk,`${o}:${s}`,()=>{let e=up(o),t=up(s);return RegExp(`^${e}.([0-9]+).${t}$`)}),l=Object.entries(t).filter(([e])=>c.test(e)).map(([e,t])=>{let n=e.match(c);return{index:parseInt(n[1],10),value:t}}).sort((e,t)=>e.index-t.index),{_displayField:u,_valueField:d,_searchField:f}=n;return l.map(({index:n})=>{let o={label:u,value:d,searchValue:f};e.forEach(([e])=>{let r=e.match(ok);if(r){let[,i,a]=r,s=t[`${i}.${n}.${a}`]||``;o.label=o.label.replaceAll(`{{${e}}}`,s),o.value=o.value.replaceAll(`{{${e}}}`,s),o.searchValue=o.searchValue.replaceAll(`{{${e}}}`,s)}});let{label:s,value:c,searchValue:l}=QO(o,r.filter(e=>!e.includes(`*`)),i,a);return{label:s||``,value:c||i.slug,searchValue:l||s||``}})},uk=({baseFieldGroups:e,content:t,templates:n,allFieldNames:r,context:i,fallbackContext:a})=>{let o=[],s=!1;return e.forEach((e,c)=>{if(e.length===0)return;let[,l]=e[0],u={groupEntries:e,content:t,templates:n,allFieldNames:r,context:i,fallbackContext:a},d=l.isComplexListField?lk({...u}):ak({...u,baseFieldName:c});o.push(...d),s=!0}),{results:o,hasProcessedListFields:s}},dk=({refEntry:e,content:t,collection:n,templates:r,allFieldNames:i,hasListFields:a,collectionName:o,fileName:s,locale:c,identifierField:l,defaultLocale:u})=>{let{slug:d,locales:f}=e,p={collectionName:o,fileName:s,isIndexFile:lb(n,e),keyPath:``},m={slug:d,locale:c,getDisplayValue:(e,n)=>Xk({...p,keyPath:e,valueMap:n?f[n].content:t,locale:n??c})},h={content:t,locales:f,defaultLocale:u,identifierField:l};if(!a)return[nk({templates:r,allFieldNames:i,context:m,fallbackContext:h})];let{results:g,hasProcessedListFields:_}=uk({baseFieldGroups:rk(i,p),content:t,templates:r,allFieldNames:i,context:m,fallbackContext:h});if(_)return g;let{_displayField:v,_valueField:y,_searchField:b}=r,{label:x,value:S,searchValue:C}=QO({label:v,value:y,searchValue:b},i.filter(e=>!e.includes(`*`)),m,h);return[{label:x||``,value:S||d,searchValue:C||x||``}]},fk=(e,t,n)=>{let r=`${e}|${JO(t)}|${JO(n)}`,i=UO.get(r);if(i)return i;let{collection:a,file:o,filters:s}=t,c=Xb(a);if(!c)return UO.set(r,[]),[];let{_type:l,_i18n:{defaultLocale:u}}=c,{identifier_field:d=`title`}=l===`entry`?c:{},f=s??[],p=ek(t,d),{allFieldNames:m,hasListFields:h}=p,g=tk(n,e,o,f).flatMap(({refEntry:t,content:n})=>dk({refEntry:t,content:n,collection:c,templates:p,allFieldNames:m,hasListFields:h,collectionName:a,fileName:o,locale:e,identifierField:d,defaultLocale:u})).sort((e,t)=>hp(e.label,t.label));return UO.set(r,g),g},pk=({fieldConfig:e,valueMap:t,keyPath:n,locale:r})=>{let{multiple:i,collection:a}=e,o=GO(fk(r,e,FT(a))),s=e=>o.get(e)||e;return i?Object.entries(t).filter(([e])=>e.match(`^${up(n)}\\.\\d+$`)).map(([,e])=>e).map(s):s(t[n])}})),hk,gk,_k,vk=o((()=>{nc(),hk=({multiline:e,dotAll:t,source:n})=>e||t||n.includes(`[\\s\\S]`)||n.includes(`[\\S\\s]`),gk=e=>tc(Object.fromEntries(Object.entries(ec(e)).filter(([e])=>!e.split(`.`).pop()?.startsWith(`__sc_`)))),_k=e=>e.replace(/"/g,`'`)})),yk,bk,xk,Sk,Ck=o((()=>{yk=/!\[(?<alt>(?:[^\]\\]|\\.)*)\]\((?<src>(?:[^"()\\]|\\.|\([^)]*\)|"[^"]*")*?)(?:\s+"(?<title>(?:[^"\\]|\\.)*)")?\)/,bk=new RegExp(yk,`g`),xk=/\[!\[(?<alt2>(?:[^\]\\]|\\.)*)\]\((?<src2>(?:[^"()\\]|\\.|\([^)]*\)|"[^"]*")*?)(?:\s+"(?<title2>(?:[^"\\]|\\.)*)")?\)\](?:\((?<link>[^)]*\([^)]*\)[^)]*|[^)]*)\))/,Sk=RegExp(`${yk.source}|${xk.source}`)})),wk,Tk,Ek,Dk=o((()=>{YE(),wk=e=>e.replace(/&(?![a-zA-Z0-9#]+;)/g,`&amp;`).replaceAll(`"`,`&quot;`),Tk={ALLOWED_TAGS:[`a`],ALLOWED_ATTR:[`href`,`target`,`rel`]},Ek=(e,t)=>JE(e.replace(`<a>`,`<a href="${wk(t)}" target="_blank" rel="noopener noreferrer">`),Tk)})),Ok,kk,Ak,jk,Mk=o((()=>{Z(),vk(),Ck(),Dk(),Ok=new Map,kk={id:`image`,label:`Image`,fields:[{name:`src`,label:`Source`,widget:`image`},{name:`alt`,label:`Alt Text`,required:!1},{name:`title`,label:`Title`,required:!1}],pattern:yk,toBlock:e=>{let{src:t=``,alt:n=``,title:r=``}=e;return t?`![${n}](${t}${r?` "${_k(r)}"`:``})`:``},toPreview:e=>{let{src:t=``,alt:n=``,title:r=``}=e;return`<img src="${wk(t)}" alt="${wk(n)}" title="${wk(r)}">`}},Ak={id:`linked-image`,label:`Image`,fields:[...kk.fields,{name:`link`,label:`Link`,required:!1}],pattern:Sk,fromBlock:e=>{let{src:t,alt:n,title:r,src2:i,alt2:a,title2:o,link:s}=e.groups??{};return{src:(t||i||``).trim(),alt:(n||a||``).trim(),title:(r||o||``).trim(),link:(s||``).trim()}},toBlock:e=>{let{src:t=``,alt:n=``,title:r=``,link:i=``}=e,a=t?`![${n}](${t}${r?` "${_k(r)}"`:``})`:``;return a&&i?`[${a}](${i})`:a},toPreview:e=>{let{src:t=``,alt:n=``,title:r=``,link:i=``}=e,a=`<img src="${wk(t)}" alt="${wk(n)}" title="${wk(r)}">`;return i?`<a href="${wk(i)}">${a}</a>`:a}},jk=e=>{if(Ok.has(e))return Ok.get(e);let t={icon:`image`,label:X(`editor_components.image`),fields:[{name:`src`,label:X(`editor_components.src`),widget:`image`},{name:`alt`,label:X(`editor_components.alt`),required:!1},{name:`title`,label:X(`editor_components.title`),required:!1}]};return{image:{...kk,...t},"linked-image":{...Ak,...t,fields:[...t.fields,{name:`link`,label:X(`editor_components.link`),required:!1}]}}[e]}})),Nk,Pk,Fk,Ik,Lre=o((()=>{_S(),Nk=new Map,Pk=new WeakMap,Fk=e=>{let t=Pk.get(e);return t===void 0&&(t=JSON.stringify(e),Pk.set(e,t)),t},Ik=({fieldConfig:e,valueMap:t,keyPath:n})=>{let{multiple:r,options:i}=e,a=hS(i),o;if(r){let e=`${n}.`;o=Object.entries(t).filter(([t])=>t.startsWith(e)&&/^\d+$/.test(t.slice(e.length))).map(([,e])=>e)}let s=Fk(i),c=r?`${n}|${s}|${JSON.stringify(o)}`:`${n}|${s}|${String(t[n])}`,l=Nk.get(c);if(l)return l;let u=e=>i.find(t=>t.value===e)?.label||e;if(r){let e=a?o.map(u):o;return Nk.set(c,e),e}let d=t[n],f=a?u(d):d;return Nk.set(c,f),f}})),Lk,Rk,zk,Bk=o((()=>{Zf(),VP(),Lk=e=>{if(!e)return;let t=Object.values(e);if(t.some(e=>e.config?.multiple===!0))return!0;if(t.some(e=>e.config?.multiple===!1))return!1},Rk=e=>{if(!e?.config)return;let{multiple:t}=e.config;if(typeof t==`boolean`)return t},zk=e=>{let t=A(IP);return e.multiple??Lk(e.media_libraries)??Rk(e.media_library)??Lk(t?.media_libraries)??Rk(t?.media_library)??!1}})),Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,Xk,Zk,Qk,$k=o((()=>{gp(),hC(),$b(),rb(),ub(),vC(),lC(),mk(),Mk(),Lre(),_b(),Bk(),Gx(),Vk=new Map,Hk=(e,t)=>{if(e.length!==1)return!1;let[n]=e;return n.widget===t&&`root`in n&&n.root===!0},Uk=e=>{let t=e.widget??`string`;return gC.includes(t)?zk(e):_C.includes(t)?!!e.multiple:!1},Wk=e=>{let t=e.match(/^(.*?)<([^>]+)>(.*)$/);if(!t)return{cleanKey:e};let[,n,r,i]=t;return i?{cleanKey:e}:{cleanKey:n||``,typeName:r}},Gk=({field:e,key:t,keyPathArray:n,segmentIndex:r,pendingExplicitType:i,valueMap:a})=>{let{cleanKey:o,typeName:s}=Wk(t),{widget:c=`text`}=e,l=s??i,u=/^\d+$/.test(o),d=o===`*`;if((u||d)&&_C.includes(c))return{field:Uk(e)?e:void 0,explicitType:l};let{field:f}=e,{fields:p}=e,{types:m,typeKey:h=`type`}=e;if(f){let e=u||d?n[r+1]:void 0;return{field:!e||f.name===e||f.widget===`object`&&`fields`in f&&f.fields?.some(t=>t.name===e)?f:void 0,explicitType:l}}if(p&&(u||d))return{field:e,explicitType:l};if(p&&!u&&o!==``)return{field:p.find(({name:e})=>e===o),explicitType:l};if(m&&(u||d)){let e=l??a[[n.slice(0,r).join(`.`),o,h].join(`.`)];return{field:m.find(({name:t})=>t===e),explicitType:d?void 0:l}}if(m&&t!==h&&o!==h&&o!==``){let e=l??a[[n.slice(0,r).join(`.`),h].join(`.`)];return{field:m.find(({name:t})=>t===e)?.fields?.find(({name:e})=>e===o),explicitType:void 0}}return{field:void 0,explicitType:l}},Kk=e=>{let{collectionName:t,fileName:n=void 0,componentName:r=void 0,valueMap:i={},keyPath:a,isIndexFile:o=!1}=e,s=/(?:^|\.)(\d+|\*)(?:\.|$)/.test(a)?JSON.stringify(e):`${t}|${n??``}|${r??``}|${a}|${o?`1`:`0`}`;if(Vk.has(s))return Vk.get(s);let c=Xb(t),l=c&&n?Qy(c,n):void 0;if(!c||n&&c?._type!==`entry`&&!l){Vk.set(s,void 0);return}let{fields:u=[]}=l??c,d=o?cb(c):void 0,f=r?jk(r)?.fields??[]:d?.fields??u,p=a.split(`.`),m,h;if(p.forEach((e,t)=>{if(t===0){let{cleanKey:t,typeName:n}=Wk(e);m=f.find(({name:e})=>e===t),!m&&d?.fields&&(m=u.find(({name:e})=>e===t)),n&&(h=n)}else if(m){let n=Gk({field:m,key:e,keyPathArray:p,segmentIndex:t,pendingExplicitType:h,valueMap:i});m=n.field,h=n.explicitType}}),h&&m&&`types`in m){let{types:e}=m;m=e.find(({name:e})=>e===h)}return Vk.set(s,m),m},qk=({fieldConfig:{required:e=!0},locale:t})=>Array.isArray(e)?e.includes(t):!!e,Jk=new Map,Yk=new Map,Xk=({collectionName:e,fileName:t,valueMap:n={},keyPath:r,locale:i,transformations:a,isIndexFile:o=!1})=>{let s=Kk({collectionName:e,fileName:t,valueMap:n,keyPath:r,isIndexFile:o}),c=n[r];if(c===void 0&&a?.length)return``;if(s?.widget===`datetime`&&(a?.some(e=>dC.test(e))||(c=cC({locale:i,fieldConfig:s,currentValue:c}))),s?.widget===`relation`&&(c=pk({fieldConfig:s,valueMap:n,keyPath:r,locale:i})),s?.widget===`select`&&(c=Ik({fieldConfig:s,valueMap:n,keyPath:r})),s?.widget===`list`){let{fields:e}=s,{types:t}=s;if(!(e||t)){let e=Wx(Jk,r,()=>RegExp(`^${up(r)}${String.raw`\.\d+$`}`));c=hb(i).format(Object.entries(n).filter(([t,n])=>e.test(t)&&typeof n==`string`&&!!n).map(([,e])=>e))}}if(s?.widget===`number`){let{value_type:e=`int`}=s;if(e===`int`||e===`float`){let e=db(i),t=Yk.get(e);t||(t=Intl.NumberFormat(e),Yk.set(e,t)),c=t.format(Number(c))}}return Array.isArray(c)&&(c=hb(i).format(c)),a?.length&&(c=mC({fieldConfig:s,value:c,transformations:a,locale:i})),String(c??``)},Zk=({valueMap:e,locale:t,keyPath:n,keyPathRegex:r,getFieldArgs:i})=>{let a=[`${n}.title`,`${n}.name`,...Object.keys(e)].find(t=>{let n=e[t];if(!r.test(t)||!(typeof n==`string`&&n.trim()||typeof n==`number`&&!Number.isNaN(n)))return!1;let a=Kk({...i,keyPath:t});return!!a&&a.widget!==`hidden`});return a?Xk({...i,keyPath:a,locale:t}):``},Qk=({entry:e,locale:t,collectionName:n,key:r,resolveRef:i=!0})=>{let{slug:a,locales:o,commitAuthor:{name:s,login:c,email:l}={},commitDate:u}=e;if(r===`slug`)return a;if(r===`commit_author`)return s||c||l;if(r===`commit_date`)return u;let{content:d}=o[t]??{};if(d===void 0)return;let f=Xb(n);if(f){if(i){let i=Kk({collectionName:n,keyPath:r,isIndexFile:lb(f,e)});if(i?.widget===`relation`)return pk({fieldConfig:i,valueMap:d,keyPath:r,locale:t})}return d[r]}}})),eA,tA,nA,rA,iA,aA,oA,sA,cA,lA,uA,dA,fA,pA,mA=o((()=>{lp(),f(),gp(),nc(),$b(),rb(),ub(),$k(),$x(),Gx(),eA=e=>/\/_index(?:\.[\w-]+)?\.md$/.test(e),tA=new Map,nA=({subPath:e,subPathTemplate:t})=>{if(t?.includes(`{{slug}}`)){let n=Wx(tA,t,()=>{let e=``,n=t;for(;n.length>0;){let t=n.indexOf(`{{`);if(t===-1){e+=up(n);break}t>0&&(e+=up(n.substring(0,t)));let r=n.indexOf(`}}`,t);if(r===-1){e+=up(n);break}let i=n.substring(t,r+2);e+=i===`{{slug}}`?`([^/]+)`:`[^/]+?`,n=n.substring(r+2)}return RegExp(`^${e}$`)}),[,r]=e.match(n)??[];if(r)return r}return e},rA=async(e,t)=>{try{return await Qx(e)}catch(e){console.error(e),t.push(e);return}},iA=({rawContent:e,fields:t,i18nSingleFile:n,validate:r})=>{let i=t[0].name;if(n)return!u(e)||!Object.values(e).every(r)?void 0:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{[i]:t}]));if(r(e))return{[i]:e}},aA=(e,t,n)=>{if(!u(e))return;let r=t.filter(e=>e!==n),i=Object.fromEntries(Object.entries(e).filter(([e])=>!r.includes(e))),a={[n]:i};return r.forEach(t=>{u(e[t])&&(a[t]=e[t])}),a},oA=(e,t,n)=>{let r={rawContent:e,fields:t,i18nSingleFile:n};return Hk(t,`list`)?iA({...r,validate:Array.isArray}):Hk(t,`keyvalue`)?iA({...r,validate:e=>u(e)&&Object.values(e).every(e=>typeof e==`string`)}):u(e)?e:void 0},sA=(e,t,n,r,i)=>r?.split(`/`).pop()===`_index`&&/\/_index(?:\.[\w-]+)?\.[\w]+$/.test(e)&&i!==`md`?!0:eA(e)?!(t||cb(n)?.name===`_index`||r?.split(`/`).pop()===`_index`&&i===`md`):!1,cA=(e,t,n,r,i)=>{let{path:a,folder:{filePathMap:o}}=e;if(t){if(i){let[e,t]=Object.entries(o??{}).find(([,e])=>e===a)??[];return{subPath:t,locale:e}}return{subPath:a,locale:void 0}}if(!n)return{subPath:void 0,locale:void 0};let s=a.match(n);if(!s?.groups)return{subPath:void 0,locale:void 0};let{subPath:c,locale:l=r}=s.groups;return{subPath:c,locale:l}},lA=(e,t,n,r,i,a)=>{let o=r||nA({subPath:i,subPathTemplate:a});e.slug=o,e.locales._default={slug:o,path:n,content:ec(t)}},uA=(e,t,n,r,i,a,o)=>{let s=r||nA({subPath:i,subPathTemplate:a});e.slug=s,e.locales=Object.fromEntries(o.filter(e=>e in t).map(e=>[e,{slug:s,path:n,content:ec(t[e])}]))},dA=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=l&&typeof t[l]==`string`?t[l]:void 0,f=r||nA({subPath:i,subPathTemplate:a}),p={slug:f,path:n,content:ec(t)},m=`${c}/${d??f}`,h=u.find(e=>e.id===m);return h?(h.locales[o]=p,o===s&&(h.slug=f,h.subPath=i),!0):(e.id=m,e.locales[o]=p,o===s&&(e.slug=f),!1)},fA=async({file:e,entries:t,errors:n})=>{let r=await rA(e,n);if(!r)return;let{path:i,meta:a={},folder:{collectionName:o,fileName:s}}=e,c=Xb(o),l=c&&s?Qy(c,s):void 0;if(!c||s&&!l)return;let{fields:u=[],_file:{fullPathRegEx:d,subPath:f,extension:p},_i18n:{i18nEnabled:m,allLocales:h,defaultLocale:g,structureMap:{i18nSingleFile:_,i18nSingleFileDefaultRoot:v,i18nMultiFile:y,i18nMultiFolder:b,i18nMultiRootFolder:x},canonicalSlug:{key:S}}}=l??c,C=v?aA(r,h,g):r;if(!C)return;let w=oA(C,u,_||v);if(!w||sA(i,s,c,f,p))return;let T=y||b||x,{subPath:ee,locale:te}=cA(e,s,d,g,T);if(!ee||T&&!te)return;let ne={id:``,slug:``,subPath:ee,locales:{},...a};if(!m)lA(ne,w,i,s,ee,f);else if(_||v)uA(ne,w,i,s,ee,f,h);else if(dA(ne,w,i,s,ee,f,te,g,o,S,t))return;t.push(ne)},pA=async e=>{let t=[],n=[];return await Promise.all(e.map(e=>fA({file:e,entries:t,errors:n}))),{entries:t.filter(e=>(e.id=op(),!!e.slug&&!!Object.keys(e.locales).length)),errors:n}}})),hA,gA=o((()=>{Rp(),zS(),Yy(),mA(),hA=e=>{let t=[],n=[],r=[];e.forEach(e=>{let{path:i,name:a}=e;if(a.startsWith(`.`))LS.test(a)&&r.push({...e,type:`config`});else{let[r]=Jy(i),[a]=Ip(i);r&&t.push({...e,type:`entry`,folder:r}),a&&!t.find(e=>e.path===i)&&!eA(i)&&n.push({...e,type:`asset`,folder:a})}});let i=[...t,...n,...r];return{entryFiles:t,assetFiles:n,configFiles:r,allFiles:i,count:i.length}}})),_A,vA,yA,bA,xA,SA,CA,wA,TA,EA=o((()=>{Zf(),_A=rn(!1),vA=rn(!1),yA=rn(!1),bA=rn(!1),xA=rn(!1),SA=rn(!1),CA=rn(!1),wA=rn(!0),TA=()=>{let{location:{hostname:e},navigator:{userAgentData:t,platform:n},matchMedia:r}=globalThis;_A.set(e===`127.0.0.1`||/^(.+\.)?localhost$/.test(e)),vA.set(`showDirectoryPicker`in globalThis),yA.set(t?.brands.some(({brand:e})=>e===`Brave`)??!1),bA.set(t?.platform===`macOS`||n.startsWith(`Mac`));let i=r(`(width < 768px)`),a=r(`(768px <= width < 1024px)`),o=r(`(1024px <= width)`),s=r(`(pointer: fine)`),c=()=>xA.set(i.matches),l=()=>SA.set(a.matches),u=()=>CA.set(o.matches),d=()=>wA.set(s.matches);c(),l(),u(),d(),i.addEventListener(`change`,c),a.addEventListener(`change`,l),o.addEventListener(`change`,u),s.addEventListener(`change`,d)}})),DA,OA,kA,AA,jA,MA,NA,PA,FA,IA,LA,RA,zA,BA,VA,HA,UA,WA,GA,KA,qA=o((()=>{_S(),kp(),gp(),Zf(),pF(),Rp(),IS(),zS(),gA(),Yy(),Eb(),mA(),EA(),QC(),DA=10*1024*1024,OA=10,kA=async(e,t,n=`file`)=>{let r=fp(t??``),i=e;if(!r){if(n===`directory`)return i;throw Error(`Path is required for file handle retrieval`)}let a=r.split(`/`),o=a.length-1;for await(let[e,t]of a.entries())i=await(e===o&&n===`file`?i.getFileHandle(t,{create:!0}):i.getDirectoryHandle(t,{create:!0}));return i},AA=(e,t)=>kA(e,t,`file`),jA=(e,t)=>kA(e,t,`directory`),MA=e=>e?VC(e,e=>up(e).replace(vb,`.+?`)):/^.+$/,NA=async(e,t,n=``)=>{let{scanningPaths:r,scanningPathsRegEx:i,fileHandles:a,pathRegexCache:o}=t;for await(let[s,c]of e.entries()){if(s.startsWith(`.`)&&!LS.test(s))continue;let e=n?`${n}/${s}`:s,l=i.some(t=>t.test(e));if(c.kind===`file`&&l&&a.push({handle:c,path:e}),c.kind===`directory`){let n=o.get(e);n||(n=MA(e),o.set(e,n)),(l||r.some(e=>n.test(e)))&&await NA(c,t,e)}}},PA=()=>{let e=A(Uy).flatMap(({filePathMap:e,folderPathMap:t})=>Object.values(e||(t??{}))),t=A(Ap).filter(({internalPath:e})=>e!==void 0).map(({internalPath:e})=>e);return gS([...e,...t].map(e=>fp(e??``)))},FA=async e=>{let t=[],n=PA();return await NA(e,{rootDirHandle:e,scanningPaths:n,scanningPathsRegEx:n.map(MA),fileHandles:t,pathRegexCache:new Map}),t.map(({handle:e,path:t})=>({handle:e,path:t.normalize(),name:e.name.normalize(),size:0,sha:``}))},IA=async e=>{let{name:t,handle:n}=e;if(t===`.gitkeep`)return e;try{let r=await n.getFile();if(r.size>DA)return console.warn(`File ${t} is too large (${r.size} bytes), skipping content read`),{...e,text:``};let i=await wp(r);return{...e,text:i}}catch(t){return console.error(t),{...e,text:``}}},LA=async e=>{let{name:t,handle:n}=e,r=FS(t);try{let t=await n.getFile(),{size:i}=t,a=await ZC(t);return{...e,kind:r,size:i,sha:a}}catch(t){return console.error(t),{...e,kind:r}}},RA=async e=>{let{entryFiles:t,assetFiles:n,configFiles:r}=hA(await FA(e)),i=[],a=[];for(let e=0;e<t.length;e+=OA){let n=t.slice(e,e+OA),r=await Promise.all(n.map(e=>IA(e)));i.push(...r)}for(let e=0;e<r.length;e+=OA){let t=r.slice(e,e+OA),n=await Promise.all(t.map(e=>IA(e)));a.push(...n)}let{entries:o,errors:s}=await pA(i),c=[];for(let e=0;e<n.length;e+=OA){let t=n.slice(e,e+OA),r=await Promise.all(t.map(e=>LA(e)));c.push(...r)}Wy.set(o),QP.set(c),RS.set(a),Gy.set(s),Vy.set(!0)},zA=()=>`move`in FileSystemFileHandle.prototype&&!A(yA),BA=async(e,t)=>{let n=await e.createWritable?.();try{await n?.write(t)}finally{try{await n?.close()}catch{}}},VA=async({rootDirHandle:e,previousPath:t,path:n})=>{let{dirname:r,basename:i}=xp(n),{dirname:a,basename:o}=xp(t),s=await AA(e,t);if(zA())return await s.move(await jA(e,r),i),s;let c=await AA(e,n),l=await jA(e,a);return await BA(c,await s.getFile()),await l.removeEntry(o),c},HA=async({rootDirHandle:e,fileHandle:t,path:n,data:r})=>{let i;if(!t)if(zA()){let{dirname:r,basename:a}=xp(fp(n));t=await AA(e,`${r?`${r}/`:``}.sveltia-tmp-${crypto.randomUUID()}`),i={dirname:r,basename:a}}else t=await AA(e,n);if(await BA(t,r),i){let{dirname:n,basename:r}=i;await t.move(await jA(e,n),r)}return t.getFile()},UA=async(e,t)=>{for(let n=t.length;n>0;--n){let r=t[n-1],i=await jA(e,t.slice(0,n-1).join(`/`)),a=await i.getDirectoryHandle(r);for await(let e of a.entries())return;await i.removeEntry(r)}},WA=async({rootDirHandle:e,path:t})=>{let{dirname:n=``,basename:r}=xp(fp(t));await(await jA(e,n)).removeEntry(r),n&&await UA(e,n.split(`/`))},GA=async(e,{action:t,path:n,previousPath:r,data:i})=>{let a;return t===`move`&&r&&(a=await VA({rootDirHandle:e,previousPath:r,path:n})),[`create`,`update`,`move`].includes(t)&&i?HA({rootDirHandle:e,fileHandle:a,path:n,data:i}):(t===`delete`&&await WA({rootDirHandle:e,path:n}),null)},KA=async(e,t)=>{let n=await Promise.all(t.map(async t=>{let{path:n,data:r}=t,i=null;if(e)try{i=await GA(e,t)}catch(e){console.error(e)}if(!i){if(r===void 0)return null;i=XC(r)}return[n,{file:i,sha:await ZC(i)}]}));return{sha:await ZC(new Date().toJSON()),files:Object.fromEntries(n.filter(e=>!!e))}}})),JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,Rre=o((()=>{mS(),Zf(),dP(),qA(),VP(),JA=`local`,YA=`Local Repository`,XA=void 0,ZA={service:``,label:``,owner:``,repo:``,branch:``},QA=new Proxy({},{get:(e,t)=>(XA??ZA)[t]}),$A=`root_dir_handle`,ej=void 0,tj=void 0,nj=async({forceReload:e=!1,showPicker:t=!0}={})=>{if(!(`showDirectoryPicker`in window))throw Error(`unsupported`);let n=e?null:await ej?.get($A)??null;if(n)if(await n.requestPermission({mode:`readwrite`})!==`granted`)n=null;else try{await n.entries().next()}catch(e){n=null,console.error(e)}if(!n&&t&&(n=await window.showDirectoryPicker(),n)){try{await n.getDirectoryHandle(`.git`)}catch(e){if(e.name===`TypeMismatchError`)await n.getFileHandle(`.git`);else throw e}await ej?.set($A,n)}return n},rj=()=>{let{name:e}=A(IP).backend;XA=iP[e]?.init?.();let{databaseName:t}=XA??{};return ej=t?new dS(t,`file-system-handles`):null,QA},ij=async({auto:e=!1})=>{let t=await nj({showPicker:!e});if(t)tj=t;else throw Error(`Directory handle could not be acquired`);return{backendName:JA}},aj=async()=>{await ej?.delete($A)},oj=async()=>{await RA(tj)},sj=async e=>KA(tj,e),cj={isGit:!1,name:JA,label:YA,repository:QA,init:rj,signIn:ij,signOut:aj,fetchFiles:oj,commitChanges:sj}})),lj,uj,dj,fj,pj,mj,hj,gj,_j,vj,zre=o((()=>{qA(),Yy(),lj=`sveltia-cms-test`,uj=`test-repo`,dj=`Test`,fj=void 0,pj=()=>void 0,mj=async()=>{try{fj=await jA(await navigator.storage.getDirectory(),lj)}catch{}return{backendName:uj}},hj=async()=>{},gj=async()=>{fj?await RA(fj):Vy.set(!0)},_j=async e=>KA(fj,e),vj={isGit:!1,name:uj,label:dj,init:pj,signIn:mj,signOut:hj,fetchFiles:gj,commitChanges:_j}})),yj,bj,xj,Sj,Cj,wj,Tj=o((()=>{yj=`gitea`,bj=`Gitea / Forgejo`,xj=`https://gitea.com/api/v1`,Sj=`https://gitea.com`,Cj=`login/oauth/authorize`,wj=1.24})),Ej,Dj=o((()=>{mS(),Zf(),Ej=rn(),Ej.subscribe(e=>{(async()=>{try{e?await pS.set(`sveltia-cms.user`,e):e===null&&await pS.delete(`sveltia-cms.user`)}catch{}})()})})),Oj,kj,Aj,jj,Mj,Nj,Pj=o((()=>{Z(),Zf(),Dj(),iS(),Oj={clientId:``,authScope:``,authURL:``,tokenURL:``,authScheme:`token`,restBaseURL:``,graphqlBaseURL:``},kj={...Oj},Aj={},jj=async({clientId:e,tokenURL:t,refreshToken:n})=>{let r,i=``;if(!nS(t))throw Error(X(`sign_in_error.TOKEN_REFRESH_FAILED`));try{r=await fetch(t,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({grant_type:`refresh_token`,client_id:e,refresh_token:n})})}catch{}if(!r?.ok)throw Error(X(`sign_in_error.TOKEN_REFRESH_FAILED`));return{access_token:i,refresh_token:n}=await r.json(),Ej.update(e=>e&&{...e,token:i,refreshToken:n}),{token:i,refreshToken:n}},Mj=async(e,{method:t=`GET`,headers:n={},body:r=null,isGraphQL:i=!1,responseType:a=`json`,token:o=void 0,refreshToken:s=void 0}={})=>{let{clientId:c,tokenURL:l,restBaseURL:u,graphqlBaseURL:d,authScheme:f=`token`}=kj,p=A(Ej),m=i?d:u;return o??=p?.token,s??=p?.refreshToken,n.Authorization=`${f} ${o}`,rS(`${m}${e}`,{method:t,headers:n,body:r},{responseType:a,refreshAccessToken:s?()=>jj({clientId:c,tokenURL:l,refreshToken:s}):void 0})},Nj=async(e,t={})=>{e=e.replace(/\n\s*/g,` `),Object.entries(Aj).forEach(([n,r])=>{e.includes(`$${n}`)&&(t[n]??=r)});let{data:n}=await Mj(``,{method:`POST`,body:{query:e,variables:t},isGraphQL:!0});return n}})),Fj,Ij=o((()=>{Zf(),Pj(),Dj(),Fj=async({token:e,refreshToken:t},n,r)=>{let i=await Mj(`/user`,{token:e,refreshToken:t}),a=A(Ej);return a?.token&&a.token!==e&&(e=a.token,t=a.refreshToken),{backendName:n,id:i.id,name:i[r.name],login:i[r.login],email:i.email,avatarURL:i.avatar_url,profileURL:i[r.profileURL],token:e,refreshToken:t}}})),Lj,Bre=o((()=>{Tj(),Ij(),Lj=e=>Fj(e,yj,{name:`full_name`,login:`login`,profileURL:`html_url`})})),Rj,zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj=o((()=>{Z(),lp(),f(),mS(),Zf(),VP(),iS(),Rj=rn(!1),zj=({authURL:e})=>{let{availHeight:t,availWidth:n}=window.screen,r=t/2-800/2,i=n/2-600/2;return window.open(e,`auth`,`width=600,height=800,top=${r},left=${i}`)},Bj=async({backendName:e,authURL:t})=>{let n=zj({authURL:t});return new Promise((r,i)=>{let a=e===`github`?setInterval(()=>{n?.closed&&(clearInterval(a),i(Object.assign(Error(`Authentication aborted`),{name:`AbortError`})))},1e3):0,o=({origin:s,data:c})=>{if(s!==new URL(t).origin||typeof c!=`string`)return;let l=e;if(c===`authorizing:${l}`){n?.postMessage(c,s);return}let{result:d}=c.match(`^authorization:${l}:(success|error):(?<result>.+)`)?.groups??{},f;try{f=d?JSON.parse(d):{error:`No data`},u(f)||(f={error:`Malformed data`})}catch{f={error:`Malformed data`}}`token`in f?r(f):i(Error(`Authentication failed`,{cause:Error(f.errorCode?X(`sign_in_error.${f.errorCode}`,{default:f.error}):f.error)})),window.removeEventListener(`message`,o),clearInterval(a),n?.close()};window.addEventListener(`message`,o)})},Vj=async({backendName:e,siteDomain:t,authURL:n,scope:r})=>{let{hostname:i}=window.location;t??=i===`localhost`?`cms.netlify.com`:i;try{new URL(n).origin===`https://api.netlify.com`&&(t=new URL(`https://${t}`).hostname)}catch{}return Bj({backendName:e,authURL:`${n}?${new URLSearchParams({provider:e,site_id:t,scope:r})}`})},Hj=async()=>{let e=`${sp()}${sp()}`,t=btoa(await cp(e,{algorithm:`SHA-256`,format:`binary`})).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``);return{csrfToken:op().replaceAll(`-`,``),codeVerifier:e,codeChallenge:t}},Uj=async({backendName:e,clientId:t,authURL:n,scope:r})=>{let{csrfToken:i,codeVerifier:a,codeChallenge:o}=await Hj(),{origin:s,pathname:c}=window.location,l=`${s}${c}`,u=new URLSearchParams({client_id:t,redirect_uri:l,response_type:`code`,state:i,scope:r,code_challenge:o,code_challenge_method:`S256`});return await pS.set(`sveltia-cms.auth`,{csrfToken:i,codeVerifier:a,realAuthURL:`${n}?${u}`}),await pS.set(`sveltia-cms.user`,{backendName:e}),Bj({backendName:e,authURL:l})},Wj=({provider:e=`unknown`,token:t,refreshToken:n,error:r,errorCode:i})=>{let a=r?`error`:`success`,o=r?{provider:e,error:r,errorCode:i}:{provider:e,token:t,refreshToken:n},s=({data:t,origin:n})=>{t===`authorizing:${e}`&&(window.opener?.postMessage(`authorization:${e}:${a}:${JSON.stringify(o)}`,n),window.removeEventListener(`message`,s))};window.addEventListener(`message`,s),window.opener?.postMessage(`authorizing:${e}`,window.location.origin)},Gj=async({backendName:e,clientId:t,tokenURL:n,code:r,state:i})=>{let{origin:a,pathname:o}=new URL(window.location.href),{csrfToken:s,codeVerifier:c}=await pS.get(`sveltia-cms.auth`)??{},l=e,u=`${a}${o}`;if(await pS.delete(`sveltia-cms.auth`),!s||!c||i!==s)return Wj({provider:l,error:X(`sign_in_error.CSRF_DETECTED`),errorCode:`CSRF_DETECTED`});let d,f=``,p=``,m=``;if(!nS(n))return Wj({provider:l,error:X(`sign_in_error.TOKEN_REQUEST_FAILED`),errorCode:`TOKEN_REQUEST_FAILED`});try{d=await fetch(n,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({grant_type:`authorization_code`,client_id:t,code:r,redirect_uri:u,code_verifier:c})})}catch{}if(!d)return Wj({provider:l,error:X(`sign_in_error.TOKEN_REQUEST_FAILED`),errorCode:`TOKEN_REQUEST_FAILED`});try{({access_token:f,refresh_token:p,error:m}=await d.json())}catch{return Wj({provider:l,error:X(`sign_in_error.MALFORMED_RESPONSE`),errorCode:`MALFORMED_RESPONSE`})}return Wj({provider:l,token:f,refreshToken:p,error:m})},Kj=async({backendName:e,clientId:t,tokenURL:n})=>{Rj.set(!0);let{search:r}=window.location,{code:i,state:a}=Object.fromEntries(new URLSearchParams(r));if(i&&a)await Gj({backendName:e,clientId:t,tokenURL:n,code:i,state:a});else{let{realAuthURL:e}=await pS.get(`sveltia-cms.auth`)??{};e&&(window.location.href=e)}},qj=async({auto:e,apiConfig:t})=>{let{backend:n}=A(IP),{name:r,site_domain:i,auth_type:a}=n,{clientId:o,authScope:s,authURL:c,tokenURL:l}=t,u={backendName:r,authURL:c,scope:s};if(r===`gitea`||a===`pkce`){let t=window.opener?.origin===window.location.origin&&window.name===`auth`;return t&&await Kj({backendName:r,clientId:o,tokenURL:l}),t||e?void 0:Uj({...u,clientId:o})}if(!e)return Vj({...u,siteDomain:i})},Jj=async({options:{token:e,refreshToken:t,auto:n=!1},apiConfig:r})=>{if(!e){let i=await qj({auto:n,apiConfig:r});if(!i)return;({token:e,refreshToken:t}=i)}return{token:e,refreshToken:t}}})),Xj,Zj,Qj,Vre=o((()=>{Bre(),Pj(),Yj(),Xj=e=>{let{origin:t}=new URL(e);return`${t}/user/settings/applications`},Zj=async e=>{let{token:t,refreshToken:n}=await Jj({options:e,apiConfig:kj})??{};if(t)return Lj({token:t,refreshToken:n})},Qj=async()=>void 0})),$j,eM,tM=o((()=>{$j={service:``,label:``,owner:``,repo:``,branch:``,repoURL:``,treeBaseURL:``,blobBaseURL:``,isSelfHosted:!1,databaseName:``},eM=(e,t)=>`${e===`https://api.github.com`?`https://github.com`:e.replace(/\/api(?:\/v\d+)?(?:\/.*)?/,``)}/${t}`})),nM,rM,iM,aM,oM,sM,cM=o((()=>{Z(),Pj(),tM(),nM={...$j},rM=null,iM=(e,t)=>({treeBaseURL:t?`${e}/src/branch/${t}`:e,blobBaseURL:t?`${e}/src/branch/${t}`:``,commitBaseURL:`${e}/commit`}),aM=async()=>{let{owner:e,repo:t}=nM;return rM??=await Mj(`/repos/${e}/${t}`),rM},oM=async()=>{let{repo:e}=nM;try{let{permissions:t}=await aM();if(!t?.pull)throw Error(`Not a collaborator of the repository`,{cause:Error(X(`repository_no_access`,{values:{repo:e}}))})}catch(t){throw t instanceof Error&&t.message.includes(`Not a collaborator`)?t:Error(`Failed to check repository access`,{cause:Error(X(`repository_not_found`,{values:{repo:e}}))})}},sM=async()=>{let{repo:e,repoURL:t=``}=nM;try{let{default_branch:n}=await aM();if(!n)throw Error(`Failed to retrieve the default branch name.`,{cause:Error(X(`repository_empty`,{values:{repo:e}}))});return Object.assign(nM,{branch:n},iM(t,n)),n}catch{throw Error(`Failed to retrieve the default branch name.`,{cause:Error(X(`repository_not_found`,{values:{repo:e}}))})}}})),lM,uM,dM=o((()=>{Zf(),VP(),$b(),Dj(),lM={create:`Create {{collection}} “{{slug}}”`,update:`Update {{collection}} “{{slug}}”`,delete:`Delete {{collection}} “{{slug}}”`,uploadMedia:`Upload “{{path}}”`,deleteMedia:`Delete “{{path}}”`,openAuthoring:`{{message}}`},uM=(e,{commitType:t=`update`,collection:n,skipCI:r=void 0})=>{let{commit_messages:i={},skip_ci:a,automatic_deployments:o}=A(IP)?.backend??{},{email:s=``,login:c=``,name:l=``}=A(Ej),[u=``]=e.map(e=>e.slug).filter(Boolean),[d,...f]=e.map(({path:e})=>e),p=n?Zb(n,{useSingular:!0}):``,m=i[t]||lM[t]||``;return[`create`,`update`,`delete`].includes(t)&&(m=m.replaceAll(`{{slug}}`,u).replaceAll(`{{collection}}`,p).replaceAll(`{{path}}`,d).replaceAll(`{{author-email}}`,s).replaceAll(`{{author-login}}`,c).replaceAll(`{{author-name}}`,l)),[`uploadMedia`,`deleteMedia`].includes(t)&&(m=m.replaceAll(`{{path}}`,d).replaceAll(`{{author-email}}`,s).replaceAll(`{{author-login}}`,c).replaceAll(`{{author-name}}`,l),f.length&&(m+=` +${f.length}`)),[`openAuthoring`].includes(t)&&(m=m.replaceAll(`{{message}}`,t).replaceAll(`{{author-email}}`,s).replaceAll(`{{author-login}}`,c).replaceAll(`{{author-name}}`,l)),![`delete`,`deleteMedia`].includes(t)&&(r??(a===!0||o===!1))&&(m=`[skip ci] ${m}`),m}})),fM,pM,mM,hM=o((()=>{Z(),kp(),Zf(),cM(),Pj(),dM(),Dj(),fM=async()=>{let{owner:e,repo:t,branch:n}=nM;try{let{commit:{id:r,message:i}}=await Mj(`/repos/${e}/${t}/branches/${n}`);return{hash:r,message:i}}catch{throw Error(`Failed to retrieve the last commit hash.`,{cause:Error(X(`branch_not_found`,{values:{repo:t,branch:n}}))})}},pM=async(e,t)=>{let{owner:n,repo:r,branch:i}=nM,a=uM(e,t),{name:o,email:s}=A(Ej),c=new Date().toJSON(),l=await Promise.all(e.map(async({action:e,path:t,previousPath:n,previousSha:r,data:i=``})=>({operation:e===`move`?`update`:e,path:t,content:await Ep(i),from_path:n,sha:r}))),{commit:u,files:d}=await Mj(`/repos/${n}/${r}/contents`,{method:`POST`,body:{branch:i,author:{name:o,email:s},committer:{name:o,email:s},dates:{author:c,committer:c},message:a,files:l}});return{sha:u.sha,date:new Date(u.created),files:Object.fromEntries(d.map((t,n)=>[t?.path??e[n].path,{sha:t?.sha??``}]))}},mM=async e=>{let{owner:t,repo:n,branch:r}=nM,i=await Promise.all(e.map(e=>Mj(`/repos/${t}/${n}/commits?sha=${encodeURIComponent(r??``)}&path=${encodeURIComponent(e)}&limit=100`))),a=new Map;return i.flat().forEach(e=>{a.has(e.sha)||a.set(e.sha,{sha:e.sha,authorName:e.commit?.author?.name??``,authorEmail:e.commit?.author?.email,authorAvatarURL:e.author?.avatar_url,authorLogin:e.author?.login,date:new Date(e.commit?.author?.date??e.created)})}),[...a.values()].sort((e,t)=>t.date.getTime()-e.date.getTime())}})),gM,_M,Hre=o((()=>{Z(),Tj(),cM(),Pj(),gM={isForgejo:!1},_M=async()=>{let{version:e}=await Mj(`/version`),t=Number.parseFloat(e),n=t>10,r=n?`Forgejo`:`Gitea`,i=n?12:wj;if(Object.assign(gM,{isForgejo:n}),Object.assign(nM,{label:r}),t<i)throw Error(`Unsupported ${r} version`,{cause:Error(X(`backend_unsupported_version`,{values:{name:r,version:i}}))})}})),vM,yM,bM,xM,SM,CM,wM,TM=o((()=>{kp(),mS(),pF(),IS(),dP(),zS(),gA(),Yy(),mA(),vM=async({metaDB:e,lastHash:t,cachedFileEntries:n,fetchFileList:r})=>{let i=await e.get(`last_commit_hash`),a=await e.get(`git_config_fetched`);if(i&&i===t&&a&&n.length)return hA(n.map(([e,t])=>({path:e,name:xp(e).basename,...t})));let o=hA(await r(t));return e.set(`last_commit_hash`,t),e.set(`git_config_fetched`,!0),o},yM=({allFiles:e,cachedFiles:t})=>{e.forEach(({sha:n,path:r},i)=>{t[r]?.sha===n&&Object.assign(e[i],t[r])})},bM=({fileInfo:e,fetchedFileMap:t})=>{let{meta:n,size:r,text:i}=t[e.path]??{};return{...e,size:e.size??r,text:e.text??i,meta:e.meta??n}},xM=e=>{let{name:t,meta:n={},...r}=e,i=FS(t);return{...r,...n,name:t,kind:i}},SM=({entries:e,assets:t,configFiles:n,errors:r=[]})=>{Wy.set(e),QP.set(t),RS.set(n),Gy.set(r),Vy.set(!0)},CM=async({cacheDB:e,allFiles:t,cachedFiles:n,fetchingFiles:r,fetchedFileMap:i})=>{let a=new Set(t.map(({path:e})=>e)),o=Object.keys(n).filter(e=>!a.has(e));r.length&&await e.saveEntries(Object.entries(i)),o.length&&e.deleteEntries(o)},wM=async({repository:e,fetchDefaultBranchName:t,fetchLastCommit:n,fetchFileList:r,fetchFileContents:i})=>{let{databaseName:a,branch:o}=e,s=new dS(a,`meta`),c=new dS(a,`file-cache`),l=await c.entries(),u=o;u||(u=await t(),e.branch=u);let{hash:d,message:f}=await n(),p=await vM({metaDB:s,lastHash:d,cachedFileEntries:l,fetchFileList:r});if(uP.set(!f.startsWith(`[skip ci]`)),!p.count){SM({entries:[],assets:[],configFiles:[]});return}let{entryFiles:m,assetFiles:h,configFiles:g,allFiles:_}=p,v=Object.fromEntries(l);yM({allFiles:_,cachedFiles:v});let y=_.filter(({meta:e})=>!e),b=y.length?await i(y):{},{entries:x,errors:S}=await pA(m.map(e=>bM({fileInfo:e,fetchedFileMap:b})));SM({entries:x,assets:h.map(e=>xM(bM({fileInfo:e,fetchedFileMap:b}))),configFiles:g.map(e=>bM({fileInfo:e,fetchedFileMap:b})),errors:S}),await CM({cacheDB:c,allFiles:_,cachedFiles:v,fetchingFiles:y,fetchedFileMap:b})}})),EM,DM,OM,kM,AM,Ure=o((()=>{kp(),hM(),Hre(),cM(),Pj(),TM(),Yy(),EM=async e=>{let{owner:t,repo:n,branch:r}=nM,i=`/repos/${t}/${n}/git/trees/${e??r}?recursive=1`,a=[],o=1;for(;;){let{tree:e,truncated:t}=await Mj(`${i}&page=${o}`);if(e&&a.push(...e),e&&t)o+=1;else break}return a.filter(({type:e})=>e===`blob`).map(({path:e,sha:t,size:n})=>({path:e,sha:t,size:n,name:xp(e).basename}))},DM=async(e,t)=>{let n=await Promise.all(e.map(async({path:e,sha:n,size:r},i)=>{let a=t[i];return[e,{sha:n,size:r??0,text:a?.content&&a.encoding===`base64`?await Dp(a.content):``,meta:{}}]}).filter(e=>!!e));return Object.fromEntries(n)},OM=async e=>{let{owner:t,repo:n,branch:r}=nM,{isForgejo:i}=gM,a=i?`/repos/${t}/${n}/git/blobs`:`/repos/${t}/${n}/file-contents?ref=${r}`,o=i?`sha`:`path`,s=e.filter(({type:e})=>e!==`asset`).map(({[o]:e})=>e);if(!s.length)return{};let c=[],l=[...s];Hy.set(0);let{default_paging_num:u=30}=await Mj(`/settings/api`);for(;;){let e=l.splice(0,u),t=await(i?Mj(`${a}?shas=${e.join(`,`)}`):Mj(a,{method:`POST`,body:{files:e}}));if(c.push(...t),Hy.set(Math.ceil((s.length-l.length)/s.length*100)),!l.length)break}return Hy.set(void 0),DM(e,c)},kM=async()=>{await _M(),await oM(),await wM({repository:nM,fetchDefaultBranchName:sM,fetchLastCommit:fM,fetchFileList:EM,fetchFileContents:OM})},AM=async e=>{let{owner:t,repo:n,branch:r}=nM,{path:i}=e;return Mj(`/repos/${t}/${n}/media/${r}/${encodeURI(i)}`,{responseType:`blob`})}})),jM=s(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),MM,NM,PM,FM,IM=o((()=>{Z(),mS(),MM=l(jM(),1),Zf(),NM=`sveltia-cms.prefs`,PM=rn(),FM=rn({},e=>{PM.set(void 0),(async()=>{try{let t=await pS.get(NM)??{};t.apiKeys??={},t.useDraftBackup??=!0,t.closeOnSave??=!0,t.closeWithEscape??=!0,t.underlineLinks??=!0,t.beta??=!1,t.devModeEnabled??=!1,t.defaultTranslationService??=`google`,e(t)}catch{PM.set({type:`permission_denied`})}})()}),FM.subscribe(e=>{if(!e||!Object.keys(e).length)return;(async()=>{try{(0,MM.default)(e,await pS.get(NM))||await pS.set(NM,e)}catch{}})();let{locale:t,theme:n,underlineLinks:r=!0,beta:i=!1,devModeEnabled:a=!1}=e;t&&Sh.includes(t)&&Lh.set(t);let o=!n||n===`auto`,s=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;Object.assign(document.documentElement.dataset,{theme:o?s:n,autoTheming:o,underlineLinks:r,beta:i,devMode:a})})})),LM,RM,Wre=o((()=>{gp(),Zf(),Vre(),hM(),Tj(),Ure(),cM(),Pj(),tM(),VP(),IM(),LM=()=>{let{backend:e}=A(IP)??{};if(e?.name!==`gitea`)return;let{repo:t,branch:n,base_url:r=Sj,auth_endpoint:i=Cj,app_id:a=``,api_root:o=xj}=e,[s,c]=t.split(`/`),l=`${s}/${c}`,u=`${fp(r)}/${fp(i)}`,d=eM(o,l);return Object.assign(nM,{service:yj,label:bj,owner:s,repo:c,branch:n,repoURL:d,tokenPageURL:Xj(d),databaseName:`${yj}:${l}`,isSelfHosted:o!==xj},iM(d,n)),Object.assign(kj,{clientId:a,authScope:`read:repository,write:repository,read:user`,authURL:u,tokenURL:u.replace(`/authorize`,`/access_token`),restBaseURL:fp(o)}),A(FM).devModeEnabled&&console.info(`repositoryInfo`,nM),nM},RM={isGit:!0,name:yj,label:bj,repository:nM,init:LM,signIn:Zj,signOut:Qj,fetchFiles:kM,fetchBlob:AM,commitChanges:pM,fetchFileCommits:mM}})),zM,BM,VM,HM,UM,WM,GM,KM=o((()=>{zM=`github`,BM=`GitHub`,VM=`https://api.github.com`,HM=`https://api.netlify.com`,UM=`auth`,WM=`https://github.com`,GM=`login/oauth/authorize`})),qM,JM,Gre=o((()=>{gp(),KM(),qM=e=>(e=fp(e),e===`https://api.github.com`||e.endsWith(`/api/v3`)?e:e.endsWith(`/api`)?`${e}/v3`:`${e}/api/v3`),JM=e=>(e=fp(e),e===`https://api.github.com`?`${e}/graphql`:e.endsWith(`/graphql`)?e:e.endsWith(`/api/v3`)?e.replace(`/api/v3`,`/graphql`):e.endsWith(`/api`)?`${e}/graphql`:`${e}/api/graphql`)})),YM,Kre=o((()=>{KM(),Ij(),YM=e=>Fj(e,zM,{name:`name`,login:`login`,profileURL:`html_url`})})),XM,ZM,QM,qre=o((()=>{Kre(),Pj(),Yj(),XM=e=>{let{origin:t}=new URL(e);return`${t}/settings/personal-access-tokens/new?${new URLSearchParams({name:`Sveltia CMS`,contents:`write`})}`},ZM=async e=>{let{token:t,refreshToken:n}=await Jj({options:e,apiConfig:kj})??{};if(t)return YM({token:t,refreshToken:n})},QM=async()=>void 0})),$M,eN,tN,nN,rN,iN=o((()=>{Z(),Zf(),Pj(),tM(),Dj(),$M={...$j},eN=(e,t)=>({treeBaseURL:t?`${e}/tree/${t}`:e,blobBaseURL:t?`${e}/blob/${t}`:``,commitBaseURL:`${e}/commit`}),tN=async()=>{let{owner:e,repo:t}=$M,n=A(Ej)?.login,{ok:r}=await Mj(`/repos/${e}/${t}/collaborators/${encodeURIComponent(n)}`,{headers:{Accept:`application/json`},responseType:`raw`});if(!r)throw Error(`Not a collaborator of the repository`,{cause:Error(X(`repository_no_access`,{values:{repo:t}}))})},nN=`
234
234
  query($owner: String!, $repo: String!) {
235
235
  repository(owner: $owner, name: $repo) {
236
236
  defaultBranchRef {
@@ -567,7 +567,7 @@ svg.leaflet-image-layer.leaflet-interactive path {pointer-events:visiblePainted;
567
567
  }.wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) {flex:auto;overflow:hidden;}.wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) iframe:where(.svelte-9guikv),
568
568
  .wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) pre:where(.svelte-9guikv),
569
569
  .wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) .markdown:where(.svelte-9guikv) {display:block;width:100%;height:100%;}.wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) pre:where(.svelte-9guikv),
570
- .wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) .markdown:where(.svelte-9guikv) {margin:0;padding:16px;overflow:auto;}.wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) pre:where(.svelte-9guikv) {white-space:pre-wrap;}.wrapper.svelte-9guikv .row:where(.svelte-9guikv) .detail {background-color:var(--sui-primary-background-color);}`}})),U0,W0,G0=o((()=>{Zf(),dP(),VP(),U0=an([IP,lP],([e,t])=>{if(!e||!t?.isGit)return!1;let{skip_ci:n,automatic_deployments:r}=e.backend;return typeof n==`boolean`||typeof r==`boolean`}),W0=an([IP,lP],([e,t])=>{if(!e||!t?.isGit)return!1;let{skip_ci:n,automatic_deployments:r}=e.backend;return n===!0||r===!1})})),K0,q0,J0,Y0=o((()=>{Zf(),pF(),I1(),IS(),G0(),V1(),P1(),ZP(),QC(),K0=e=>{let{files:t,folder:n,originalAsset:r}=e,{slugify_filename:i=!1}=YP().config,a=n?.internalPath===void 0?[]:fF(n.internalPath).map(e=>e.name.normalize());return t.map(e=>{let t=r?.name??qC(e.name,{slugificationEnabled:i,assetNamesInSameFolder:a});return a.includes(t)||a.push(t),{action:r?`update`:`create`,name:t,path:r?.path??[n?.internalPath,t].join(`/`),file:e}})},q0=({count:e})=>{let t=A(rF),n=A(iF);t&&rF.set(tF(t.path)),n&&iF.set(tF(n.path)),F1.set({...M1,saved:!0,published:A(U0)&&!A(W0),count:e})},J0=async(e,t)=>{let{files:n,folder:r}=e,i=K0(e),a=i.map(({name:e,path:t,file:n})=>({name:e,path:t,size:n.size,kind:FS(e),folder:r}));await B1({changes:i.map(({action:e,path:t,file:n})=>({action:e,path:t,data:n})),savingAssets:a,options:t}),q0({count:n.length})}}));function kle(e,t){O(t,!0),K(e,Z0);let n=()=>j(oF,`$editingAsset`,i),r=()=>j(n$,`$showAssetOverlay`,i),[i,a]=ln(),o=M(n),s=N(!1),c=N(void 0),l=N(void 0),u=N(void 0),d=N(!1),f=async()=>{P(c,await dT(z(o)),!0),P(l,await z(c).text(),!0),P(u,z(l),!0),P(s,!0)},p=()=>{cn(oF,void 0),P(c,void 0),P(l,void 0),P(u,void 0)},m=async()=>{z(o)&&z(c)&&typeof z(u)==`string`&&await J0({folder:z(o).folder,files:[new File([z(u)],z(o).name,{type:z(c).type})],originalAsset:z(o)},{commitType:`uploadMedia`})};Kr(()=>{z(o)&&z(c)===void 0&&f()}),Kr(()=>{r()||P(s,!1)});{let t=e=>{{let t=M(()=>X(`wrap_long_lines`));XR(e,{get label(){return z(t)},get checked(){return z(d)},set checked(e){P(d,e,!0)}})}},n=M(()=>X(`edit_x`,{values:{name:z(o)?.name??``}})),r=M(()=>X(`save`)),i=M(()=>z(u)===z(l));uL(e,{size:`x-large`,get title(){return z(n)},get okLabel(){return z(r)},get okDisabled(){return z(i)},okShortcuts:`Accel+S`,onOk:()=>{m()},onClose:()=>{p()},get open(){return z(s)},set open(e){P(s,e,!0)},footerExtra:t,children:(e,t)=>{var n=X0();let r;uQ(F(n),{flex:!0,get value(){return z(u)},set value(e){P(u,e,!0)}}),D(n),R(()=>r=Qo(n,1,`wrapper svelte-1lnkfih`,null,r,{wrap:z(d)})),U(e,n)},$$slots:{footerExtra:!0,default:!0}})}k(),a()}var X0,Z0,Ale=o((()=>{Q(),Y(),Z(),VQ(),pF(),Y0(),vT(),u$(),X0=V(`<div role="none"><!></div>`),Z0={hash:`svelte-1lnkfih`,code:`.wrapper.svelte-1lnkfih {display:contents;}.wrapper.svelte-1lnkfih textarea {min-height:40dvh;max-height:80dvh;font-family:var(--sui-font-family-monospace);font-size:var(--sui-font-size-monospace);text-wrap:nowrap;resize:vertical;}.wrapper.svelte-1lnkfih .wrap textarea {text-wrap:wrap;}`}})),Q0,$0,e2=o((()=>{gp(),KP(),ub(),_b(),QC(),Q0=({basePath:e,path:t,extension:n,locale:r,omitLocale:i,structure:a})=>{switch(a){case`multiple_folders`:return i?`${e}/${t}.${n}`:`${e}/${r}/${t}.${n}`;case`multiple_folders_i18n_root`:case`multiple_root_folders`:return i?`${e}/${t}.${n}`:`${r}/${e}/${t}.${n}`;case`multiple_files`:return i?`${e}/${t}.${n}`:`${e}/${t}.${r}.${n}`;default:return`${e}/${t}.${n}`}},$0=({draft:e,locale:t,slug:n})=>{let{collection:r,collectionFile:i,originalEntry:a,currentValues:o,isIndexFile:s}=e,{_i18n:{defaultLocale:c,structure:l,omitDefaultLocaleFromFilePath:u}}=i??r;if(i){let{_i18n:e,file:n}=i;return gb({_i18n:e,locale:t,path:fp(n)})}if(a?.locales[t]?.slug===n)return a.locales[t].path;let d=r,{_file:{basePath:f,subPath:p,extension:m}}=d,h=s?cb(d)?.name:p?GP(p,{collection:d,locale:t,content:o[c],currentSlug:n}):n;return s&&h?.endsWith(`.${m}`)&&(h=h.slice(0,-m.length-1)),JC(Q0({basePath:f,path:h,extension:m,locale:t,omitLocale:u&&t===c,structure:l}).split(`/`))}})),t2,n2,r2,i2,a2,o2,s2=o((()=>{KP(),ub(),t2=(e,t)=>{let n={...e};return Object.entries(n).forEach(([e,r])=>{typeof r==`string`&&r.startsWith(`blob:`)&&t[r]&&(n[e]=t[r].file.name.replace(/\.[^.]+$/,``))}),n},n2=({draft:e})=>{let{collection:t,collectionFile:n,currentSlugs:r,currentValues:i,files:a,isIndexFile:o}=e,{_i18n:{defaultLocale:s}}=n??t;return{collection:t,content:{...t2(i[s],a),_slug:r?.[s]??r?._},locale:s,isIndexFile:o}},r2=({draft:e,locale:t,localizingKeyPaths:n})=>{let{isNew:r,collection:i,collectionFile:a,originalLocales:o,currentSlugs:s,currentValues:c,files:l,isIndexFile:u}=e,{_type:d}=i,{identifier_field:f=`title`,slug:p=`{{${f}}}`}=d===`entry`?i:{},{_i18n:{defaultLocale:m}}=a??i,h=s?.[t]??s?._;return r||!o[t]?GP(p,{collection:i,locale:t,content:{...t2(c[m],l),...t2(Object.fromEntries(n.map(e=>[e,c[t]?.[e]])),l),_slug:h},isIndexFile:u}):h},i2=({draft:e,defaultLocaleSlug:t})=>{let{collection:n,collectionFile:r,currentLocales:i}=e,{_type:a}=n,{identifier_field:o=`title`,slug:s=`{{${o}}}`}=a===`entry`?n:{},{_i18n:{defaultLocale:c,structureMap:{i18nSingleFile:l,i18nSingleFileFlatDefault:u}}}=r??n,d=[...s.matchAll(/{{((?:fields\.)?.+?)( \| localize)?}}/g)].filter(([,,e])=>!!e).map(([,e])=>e.replace(/^fields\./,``));if(!(l||u||!d.length))return Object.fromEntries(Object.entries(i).map(([n])=>[n,n===c?t:r2({draft:e,locale:n,localizingKeyPaths:d})]))},a2=({draft:e,defaultLocaleSlug:t,localizedSlugs:n,fillSlugOptions:r})=>{if(!n)return;let{collection:i,collectionFile:a}=e,{_i18n:{canonicalSlug:{value:o}}}=a??i;return o===`{{slug}}`?t:GP(o,{...r,currentSlug:t})},o2=({draft:e})=>{let{isNew:t,collection:n,collectionFile:r,fileName:i,currentSlugs:a,isIndexFile:o}=e,{_type:s}=n,{identifier_field:c=`title`,slug:l=`{{${c}}}`}=s===`entry`?n:{};if(o)return{defaultLocaleSlug:cb(n)?.name,localizedSlugs:void 0,canonicalSlug:void 0};let{_i18n:{defaultLocale:u}}=r??n,d=n2({draft:e}),f=i??(t?GP(l,d):a?.[u]??a?._),p=i2({draft:e,defaultLocaleSlug:f});return{defaultLocaleSlug:f,localizedSlugs:p,canonicalSlug:a2({draft:e,defaultLocaleSlug:f,localizedSlugs:p,fillSlugOptions:d})}}})),c2,l2,u2,d2,f2,p2,m2,h2,g2,_2,jle=o((()=>{c2=l(jM(),1),pF(),IS(),KP(),e2(),s2(),QC(),l2=[`multiple_folders`,`multiple_folders_i18n_root`,`multiple_root_folders`],u2=/(?<path>.+?)(?:\/[^/]+)?$/,d2=(e,t)=>e.includes(`{{`)?GP(e,t):e,f2=(e,t)=>{let n=e.lastIndexOf(`.`),r=e.substring(0,n),i=t?.includes(`/`)?t.split(`/`).at(-1):void 0;return i&&!i.includes(`{{`)&&(r=r.match(u2)?.groups?.path),r},p2=({internalPath:e,internalSubPath:t,entryFolderPath:n,isMultiFolders:r,isNestedEntry:i,fillSlugOptions:a})=>YC(d2(JC([r||i?n:e,t]),a)),m2=({publicPath:e,subPathFolderPath:t,subPath:n,isMultiFolders:r,fillSlugOptions:i})=>!r&&/^\.?$/.test(e)?e:YC(d2(r?JC([...Array((n?.match(/\//g)??[]).length+1).fill(`..`),e,t]):e,i)),h2=({folder:e,fillSlugOptions:t})=>{let{entryRelative:n,internalPath:r,internalSubPath:i,publicPath:a}=e;if(r===void 0||a===void 0)return{resolvedInternalPath:``,resolvedPublicPath:``};if(!n)return{resolvedInternalPath:GP(r,t),resolvedPublicPath:GP(a,t)};let{collection:o,entryFilePath:s}=t,c=l2.includes(o._i18n.structure),l=o._type===`entry`?o._file.subPath:void 0,u=l?.match(u2)?.groups?.path??``;return{resolvedInternalPath:p2({internalPath:r,internalSubPath:i,entryFolderPath:f2(s??``,l),isMultiFolders:c,isNestedEntry:l?.includes(`/`)??!1,fillSlugOptions:t}),resolvedPublicPath:m2({publicPath:a,subPathFolderPath:u,subPath:l,isMultiFolders:c,fillSlugOptions:t})}},g2=({draft:e,defaultLocaleSlug:t,folder:n})=>{let{collection:r,collectionName:i,collectionFile:a,isIndexFile:o}=e,{_i18n:{defaultLocale:s}}=a??r,c=h2({folder:n,fillSlugOptions:{...n2({draft:e}),type:`media_folder`,currentSlug:t,entryFilePath:$0({draft:e,locale:s,slug:t}),isIndexFile:o}}),{resolvedInternalPath:l}=c;return{assetFolderPaths:c,assetNamesInSameFolder:fF(l).map(e=>e.name.normalize()),savingAssetProps:{collectionName:i,folder:n}}},_2=async({file:e,folder:t,blobURL:n,draft:r,defaultLocaleSlug:i,keyPath:a,content:o,changes:s,savingAssets:c,slugificationEnabled:l,encodingEnabled:u})=>{let d=await ZC(e),f=c.find(e=>e.sha===d&&(!t.entryRelative||(0,c2.default)(e.folder,t))),{savingAssetProps:p,assetNamesInSameFolder:m,assetFolderPaths:{resolvedInternalPath:h,resolvedPublicPath:g}}=g2({draft:r,defaultLocaleSlug:i,folder:t}),_=``;if(f)_=f.name;else{_=qC(e.name,{slugificationEnabled:l,assetNamesInSameFolder:m});let t=h?`${h}/${_}`:_;m.push(_),s.push({action:`create`,path:t,data:e}),c.push({...p,blobURL:n,name:_,path:t,sha:d,size:e.size,kind:FS(_)})}let v=g?`${g===`/`?``:g}/${_}`:_;u&&(v=HC(v)),o[a]=o[a].replaceAll(n,v)}})),v2,y2,b2,x2,S2,C2,w2,T2=o((()=>{v2=l(jM(),1),Zf(),IM(),y2=/\.__sc_\w+$/,b2=rn(),x2=rn(!0),S2=rn(!1),C2=e=>Object.fromEntries(Object.entries(e).filter(([e])=>!y2.test(e))),w2=an([b2],([e])=>{if(!e)return!1;let{originalLocales:t,currentLocales:n,originalSlugs:r,currentSlugs:i,originalValues:a,currentValues:o}=e,s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,C2(t)]));return!(0,v2.default)(t,n)||!(0,v2.default)(r,i)||!(0,v2.default)(a,s)}),b2.subscribe(e=>{A(FM).devModeEnabled&&console.info(`entryDraft`,e)})})),E2,D2,Mle=o((()=>{$k(),vC(),E2=({field:e,keyPath:t,keyPathList:n})=>{let{widget:r}=e,i=r===`list`;if(n.push(t),i||r===`object`){let{fields:r}=e,{types:a,typeKey:o=`type`}=e;if(r)r.forEach(e=>{E2({field:e,keyPath:i?`${t}.*.${e.name}`:`${t}.${e.name}`,keyPathList:n})});else if(a)n.push(i?`${t}.*.${o}`:`${t}.${o}`),a.forEach(e=>{e.fields?.forEach(e=>{E2({field:e,keyPath:i?`${t}.*.${e.name}`:`${t}.${e.name}`,keyPathList:n})})});else if(i){let{field:r}=e;r?E2({field:r,keyPath:`${t}.*`,keyPathList:n}):n.push(`${t}.*`)}}else r&&_C.includes(r)&&Uk(e)&&n.push(`${t}.*`)},D2=e=>{let t=[];return e.forEach(e=>{E2({field:e,keyPath:e.name,keyPathList:t})}),t}})),O2,k2,A2,j2,M2,Nle=o((()=>{f(),gp(),nc(),Ux(),Zf(),VP(),T2(),Mle(),$k(),lC(),Gx(),O2=new Map,k2=e=>e==null||e===``||Array.isArray(e)&&!e.length||u(e)&&!Object.keys(e).length,A2=({key:e,field:t,locale:n,unsortedMap:r,sortedMap:i,isTomlOutput:a,omitEmptyOptionalFields:o})=>{if(y2.test(e)){delete r[e];return}let s=r[e];if(a&&t?.widget===`datetime`&&!tC(t).format){let e=new Cx(s);s=e.isValid()?e:void 0}if(o&&t&&!qk({fieldConfig:t,locale:n})&&k2(s)){let t=Object.keys(r).filter(t=>t.startsWith(`${e}.`));t.some(e=>!y2.test(e)&&!k2(r[e]))?i[e]=s:t.forEach(e=>{delete r[e]})}else i[e]=s;delete r[e]},j2=({collectionName:e,fileName:t,fields:n,locale:r,valueMap:i,canonicalSlugKey:a,isIndexFile:o=!1,isTomlOutput:s=!1})=>{let c=d(i),l={},{omit_empty_optional_fields:u=!1}=A(IP)?.output??{},f={collectionName:e,fileName:t,valueMap:i,isIndexFile:o},p={locale:r,unsortedMap:c,sortedMap:l,isTomlOutput:s,omitEmptyOptionalFields:u};return a&&a in c&&A2({...p,key:a}),D2(n).forEach(e=>{let t=Kk({...f,keyPath:e});if(e in c)A2({...p,key:e,field:t});else if(t?.widget===`keyvalue`)l[e]={},Object.entries(c).filter(([t])=>t.startsWith(`${e}.`)).forEach(([e])=>{A2({...p,key:e,field:t})});else{let n=Wx(O2,e,()=>RegExp(`^${up(e.replaceAll(`*`,`\\d+`)).replaceAll(`\\\\d\\+`,`\\d+`)}$`));Object.keys(c).filter(e=>n.test(e)).sort(([e,t])=>hp(e,t)).forEach(e=>{let n=t??Kk({...f,keyPath:e});A2({...p,key:e,field:n})})}}),Object.keys(c).sort(([e,t])=>hp(e,t)).forEach(e=>{A2({...p,key:e})}),tc(l)},M2=({draft:e,locale:t,valueMap:n})=>{let{collection:r,collectionName:i,collectionFile:a,fields:o,isIndexFile:s}=e,{_file:c,_i18n:{canonicalSlug:{key:l}}}=a??r,u=[`toml`,`toml-frontmatter`].includes(c.format),d=j2({collectionName:i,fileName:a?.name,fields:o,locale:t,valueMap:n,canonicalSlugKey:l,isIndexFile:s,isTomlOutput:u});return!u&&Hk(o,`list`)?d[o[0].name]??[]:Hk(o,`keyvalue`)?d[o[0].name]??{}:d}})),N2,P2,F2,I2,L2,Ple=o((()=>{Ux(),Zf(),By(),VP(),Eb(),N2=(e,t=A(IP)?.output?.json??{})=>{let{indent_style:n=`space`,indent_size:r=n===`tab`?1:2}=t;return JSON.stringify(e,null,n===`tab`?` `.repeat(r):r).trim()},P2=e=>Cne(e).trim(),F2=(e,t=A(IP)?.output?.yaml??{},n={})=>{let{indent_size:r=2,indent_sequences:i=!0,quote:a=`none`}=t,{quote:o=!1}=n;return Ry(e,null,{indent:r,indentSeq:i,lineWidth:0,defaultKeyType:`PLAIN`,defaultStringType:o||a===`double`?`QUOTE_DOUBLE`:a===`single`?`QUOTE_SINGLE`:`PLAIN`,singleQuote:!(o||a===`double`)}).trim()},I2=({content:e,_file:t})=>{let{format:n,fmDelimiters:r,yamlQuote:i=!1}=t,[a,o]=r??[`---`,`---`],s=typeof e.body==`string`?e.body:``;if(delete e.body,!Object.keys(e).length)return`${s}\n`;try{let t=``;if(n===`frontmatter`||n===`yaml-frontmatter`)t=F2(e,void 0,{quote:i});else if(n===`toml-frontmatter`)t=P2(e);else if(n===`json-frontmatter`)t=N2(e);else return``;return`${a}\n${t}\n${o}\n${s?`\n${s}\n`:``}`}catch(e){console.error(e)}return``},L2=async({content:e,_file:t})=>{let{format:n,yamlQuote:r=!1}=t,i=yb.get(n)?.formatter;if(i)return`${(await i(e)).trim()}\n`;if(n===`raw`)return typeof e.body==`string`?`${e.body}\n`:``;try{if(/^ya?ml$/.test(n))return`${F2(e,void 0,{quote:r})}\n`;if(n===`toml`)return`${P2(e)}\n`;if(n===`json`)return`${N2(e)}\n`}catch(e){return console.error(e),``}return/^(?:(?:yaml|toml|json)-)?frontmatter$/.test(n)?I2({content:e,_file:t}):``}})),R2,z2,B2,V2,H2,U2=o((()=>{kp(),f(),mS(),Zf(),Rp(),dP(),VP(),bF(),jle(),e2(),Nle(),$k(),Ple(),ZP(),R2=async({draft:e,slugs:{defaultLocaleSlug:t,canonicalSlug:n,localizedSlugs:r}})=>{let i=A(jp),{collection:a,collectionName:o,collectionFile:s,fileName:c,isIndexFile:l,currentLocales:u,currentValues:f,files:p}=e,{_i18n:{canonicalSlug:{key:m}}}=s??a,h=[],g=[],{slugify_filename:_=!1}=YP().config,{encode_file_path:v=!1}=A(IP)?.output??{},y={collectionName:o,fileName:c,keyPath:``,valueMap:{},isIndexFile:l},b={draft:e,defaultLocaleSlug:t,changes:h,savingAssets:g,slugificationEnabled:_};return{localizedEntryMap:Object.fromEntries(await Promise.all(Object.entries(f).map(async([a,o])=>{let s=r?.[a]??t,c=$0({draft:e,locale:a,slug:s});return u[a]?(o[m]=n,await Promise.all(Object.entries(o).map(async([e,t])=>{if(t===void 0){delete o[e];return}if(typeof t!=`string`)return;o[e]=t.trim();let n=[...t.matchAll(_p(`g`))];if(!n.length)return;let r=Kk({...y,valueMap:o,keyPath:e}),a={...b,keyPath:e,content:o,encodingEnabled:r?.widget===`richtext`||r?.widget===`markdown`?!0:v};await Promise.all(n.map(async([e])=>{let{file:t,folder:n=i}=p[e]??{};t&&await _2({...a,file:t,folder:n,blobURL:e})}))})),[a,{slug:s,path:c,content:d(o)}]):[a,{path:c}]}))),changes:h,savingAssets:g}},z2=async({previousPath:e,cacheDB:t})=>{if(e)return(await t?.get(e))?.sha},B2=async({draft:e,savingEntry:t,cacheDB:n})=>{let{collection:r,isNew:i,originalSlugs:a,originalEntry:o,collectionFile:s}=e,{_file:c,_i18n:{i18nEnabled:l,defaultLocale:u,structureMap:{i18nSingleFileFlatDefault:d}={}}}=s??r,{slug:f,path:p,content:m}=t.locales[u],h=!i&&(a?.[u]??a?._)!==f,g=o?.locales[u]?.path;return{action:i?`create`:h?`move`:`update`,slug:f,path:p,previousPath:h?g:void 0,previousSha:await z2({cacheDB:n,previousPath:g}),data:await L2({content:(()=>{if(!l)return M2({draft:e,locale:`_default`,valueMap:m});let n=Object.fromEntries(Object.entries(t.locales).filter(([,e])=>!!e.content).map(([t,n])=>[t,M2({draft:e,locale:t,valueMap:n.content})]));if(d){let{lang:e,...t}=n[u]??{},r=Object.fromEntries(Object.entries(n).filter(([e])=>e!==u));return{lang:[u,...Object.keys(r)],...t,...r}}return n})(),_file:c})}},V2=async({draft:e,savingEntry:t,cacheDB:n,locale:r})=>{let{collection:i,isNew:a,originalLocales:o,currentLocales:s,originalSlugs:c,originalEntry:l,collectionFile:u}=e,{_file:d}=u??i,{slug:f,path:p,content:m}=t.locales[r]??{},h=l?.locales[r]?.path,g=await z2({cacheDB:n,previousPath:h});if(s[r]){let t=!a&&o[r]&&(c?.[r]??c?._)!==f;return{action:a||!o[r]?`create`:t?`move`:`update`,slug:f,path:p,previousPath:t?h:void 0,previousSha:g,data:await L2({content:M2({draft:e,locale:r,valueMap:m}),_file:d})}}if(!a&&o[r])return{action:`delete`,slug:f,path:p,previousSha:g}},H2=async({draft:e,slugs:t})=>{let{id:n,collection:r,collectionFile:i}=e,{defaultLocaleSlug:a}=t,{_file:o,_i18n:{i18nEnabled:s,allLocales:c,defaultLocale:l,structureMap:{i18nSingleFile:u,i18nSingleFileFlatDefault:d}}}=i??r,{localizedEntryMap:f,changes:p,savingAssets:m}=await R2({draft:e,slugs:t}),h={id:n,slug:a,subPath:o.fullPathRegEx?f[l].path.match(o.fullPathRegEx)?.groups?.subPath??a:a,locales:Object.fromEntries(Object.entries(f))};await yF({type:`preSave`,draft:e,savingEntry:h});let g=A(lP)?.repository?.databaseName,_={draft:e,savingEntry:h,cacheDB:g?new dS(g,`file-cache`):void 0};return!s||u||d?p.push(await B2({..._})):await Promise.all(c.map(async e=>{let t=await V2({..._,locale:e});t&&p.push(t)})),{savingEntry:h,savingAssets:m,changes:p}}})),W2,G2,K2,q2,J2,Y2,Fle=o((()=>{kp(),Zf(),pF(),I1(),Rp(),vT(),V1(),P1(),zT(),rb(),ub(),U2(),s2(),OT(),W2=({entry:e})=>{let{locales:t}=e,n=Object.entries(t),r=Object.fromEntries(n.map(([e])=>[e,!0])),i=Object.fromEntries(n.map(([e,{slug:t}])=>[e,t])),a=Object.fromEntries(n.map(([e,{content:t}])=>[e,t]));return{createdAt:Date.now(),isNew:!1,canPreview:!0,originalEntry:e,originalLocales:r,currentLocales:structuredClone(r),originalSlugs:i,currentSlugs:structuredClone(i),originalValues:a,currentValues:structuredClone(a),files:{},validities:{},validationMessages:{},expanderStates:{}}},G2=async({draftProps:e,indexFile:t,savingEntries:n,changes:r})=>{let{collection:i,collectionFile:a}=e,{fields:o=[]}=a??i,s={...e,fields:t?.fields??o},{savingEntry:c,changes:l}=await H2({draft:s,slugs:o2({draft:s})});n.push(c),r.push(...l)},K2=async({entry:e,savingEntries:t,changes:n})=>{let r=W2({entry:e});await Promise.all(wT(e).map(async i=>{let a=i.name,o=lb(i,e),s=o?cb(i):void 0,c=eb(i,e),l={indexFile:s,savingEntries:t,changes:n},u={...r,collection:i,collectionName:a,isIndexFile:o};c.length?await Promise.all(c.map(e=>G2({...l,draftProps:{...u,collectionFile:e,fileName:e.name}}))):await G2({...l,draftProps:u})}))},q2=async({_globalAssetFolder:e,newPath:t,asset:n,savingEntries:r,changes:i})=>{let a=hT(n)??n.blobURL,o=a?await LT(a):[];if(!a||!o.length)return;let{publicPath:s}=Ip(n.path).find(({collectionName:e})=>e!==void 0)??e,c=await LT(a,{entries:structuredClone(o),newURL:t.replace(n.folder.internalPath??``,s??``)});c.length&&await Promise.all(c.map(async e=>K2({entry:e,savingEntries:r,changes:i})))},J2=({action:e,movedAssets:t})=>{let n=A(rF)?.path,r=t.find(e=>e.asset.path===n),i=A(iF)?.path,a=t.find(e=>e.asset.path===i);r&&rF.set(tF(r.path)),a&&iF.set(tF(a.path)),F1.set({...M1,moved:e===`move`,renamed:e===`rename`,count:t.length})},Y2=async(e,t)=>{let n=A(jp),r=[],i=[],a=[];await Promise.all(t.map(async({asset:e,path:t})=>{let o=t,s=xp(o).basename;a.push({...e,path:o,name:s}),r.push({action:`move`,path:o,previousPath:e.path,previousSha:e.sha,data:new File([e.file??await dT(e)],s)}),await q2({_globalAssetFolder:n,newPath:o,asset:e,savingEntries:i,changes:r})})),await B1({changes:r,savingEntries:i,savingAssets:a,options:{commitType:`uploadMedia`}}),J2({action:e,movedAssets:t})}}));function Ile(e,t){let n=Ta();O(t,!0),K(e,Q2);let r=()=>j(sF,`$renamingAsset`,a),i=()=>j(n$,`$showAssetOverlay`,a),[a,o]=ln(),s=N(!1),c=N(gr({filename:``})),l=N(``),u=N(gr([])),d=N(gr([])),f=M(r),p=M(()=>z(c).dirname),m=M(()=>z(c).filename),h=M(()=>z(c).extension),g=M(()=>{if(!z(l).trim())return`empty`;if(z(l).includes(`/`))return`character`;if(z(u).includes(`${z(l)}${z(h)?`.${z(h)}`:``}`))return`duplicate`}),_=M(()=>!!z(g)),v=async()=>{z(f)&&(P(c,xp(z(f).path),!0),P(l,z(m),!0),P(u,fF(z(p)).map(e=>e.name).filter(e=>e!==z(f).name),!0),P(d,await E1(z(f)),!0),P(s,!0))},y=async()=>{if(!z(f))return;let e=z(f).path,t=`${z(p)}/${z(l)}${z(h)?`.${z(h)}`:``}`;await Y2(`rename`,[{asset:z(f),path:t}]),g$().path===`/assets/${e}`&&await b$(`/assets/${t}`,{replaceState:!0,notifyChange:!1})};Kr(()=>{z(f)&&v()}),Kr(()=>{i()||(P(s,!1),cn(sF,void 0))});{let t=M(()=>X(`rename_x`,{values:{name:z(f)?.name??``}})),r=M(()=>X(`rename`)),i=M(()=>z(l)===z(m)||z(_));uL(e,{get title(){return z(t)},get okLabel(){return z(r)},get okDisabled(){return z(i)},onOk:()=>{y()},onClose:()=>{cn(sF,void 0)},get open(){return z(s)},set open(e){P(s,e,!0)},children:(e,t)=>{var r=Z2(),i=I(r),a=F(i,!0);D(i);var o=L(i,2),s=F(o);bL(s,{flex:!0,get invalid(){return z(_)},get"aria-errormessage"(){return`${n}-error`},get value(){return z(l)},set value(e){P(l,e,!0)}});var c=L(s,2),u=e=>{var t=X2(),n=F(t);D(t),R(()=>W(n,`.${z(h)??``}`)),U(e,t)};G(c,e=>{z(h)&&e(u)}),D(o);var f=L(o,2),p=F(f),m=e=>{var t=wa();R(e=>W(t,e),[()=>X(`enter_new_name_for_asset_error.${z(g)}`)]),U(e,t)};G(p,e=>{z(_)&&e(m)}),D(f),R(e=>{W(a,e),q(f,`id`,`${n}-error`)},[()=>X(`enter_new_name_for_asset`,{values:{count:z(d).length}})]),U(e,r)},$$slots:{default:!0}})}k(),o()}var X2,Z2,Q2,Lle=o((()=>{Q(),Y(),Z(),VQ(),kp(),C$(),pF(),Fle(),D1(),u$(),X2=V(`<span role="none"> </span>`),Z2=V(`<p class="svelte-22gadf"> </p> <div role="none" class="svelte-22gadf"><!> <!></div> <div role="none" class="error svelte-22gadf"><!></div>`,1),Q2={hash:`svelte-22gadf`,code:`p.svelte-22gadf {margin:0 0 8px;}div.svelte-22gadf {display:flex;align-items:center;gap:4px;}.error.svelte-22gadf {margin:0;color:var(--sui-error-foreground-color);font-size:var(--sui-font-size-small);}`}}));function Rle(e,t){O(t,!0),K(e,t4);let n=()=>j(c$,`$listedAssets`,s),r=()=>j(rF,`$focusedAsset`,s),i=()=>j(xA,`$isSmallScreen`,s),a=()=>j(SA,`$isMediumScreen`,s),o=()=>j(Xie,`$selectedAssetPathSet`,s),[s,c]=ln(),l=M(()=>t.asset.name),u=M(()=>t.asset.kind),d=e=>{nF.update(n=>{let r=n.indexOf(t.asset);return e&&r===-1&&n.push(t.asset),!e&&r>-1&&n.splice(r,1),n})};{let s=M(()=>n().indexOf(t.asset));LL(e,{get"aria-rowindex"(){return z(s)},onChange:e=>{d(e.detail.selected)},onfocus:()=>{cn(rF,t.asset)},onclick:()=>{(i()||a())&&r()&&MS(r())&&b$(`/assets/${r().path}`,{transitionType:`forwards`})},ondblclick:()=>{r()&&MS(r())&&b$(`/assets/${r().path}`,{transitionType:`forwards`})},children:(e,n)=>{var r=e4(),s=I(r),c=e=>{PL(e,{class:`checkbox`,children:(e,n)=>{{let n=M(()=>o().has(t.asset.path));oL(e,{role:`none`,tabindex:`-1`,get checked(){return z(n)},onChange:({detail:{checked:e}})=>{d(e)}})}},$$slots:{default:!0}})};G(s,e=>{i()||a()||e(c)});var f=L(s,2);PL(f,{class:`image`,children:(e,n)=>{{let n=M(()=>t.viewType===`list`?`icon`:`tile`),r=M(()=>z(u)===`image`);r0(e,{get kind(){return z(u)},get asset(){return t.asset},get variant(){return z(n)},get cover(){return i()},get checkerboard(){return z(r)}})}},$$slots:{default:!0}});var p=L(f,2),m=e=>{PL(e,{class:`title`,children:(e,t)=>{var n=$2();YF(F(n),{lines:2,children:(e,t)=>{dt();var n=wa();R(()=>W(n,z(l))),U(e,n)},$$slots:{default:!0}}),D(n),U(e,n)},$$slots:{default:!0}})};G(p,e=>{(!i()||t.viewType===`list`)&&e(m)}),U(e,r)},$$slots:{default:!0}})}k(),c()}var $2,e4,t4,zle=o((()=>{Q(),Y(),VQ(),u0(),C$(),pF(),IS(),u$(),EA(),$2=V(`<div role="none" class="label svelte-17zk54k"><!></div>`),e4=V(`<!> <!> <!>`,1),t4={hash:`svelte-17zk54k`,code:`.label.svelte-17zk54k {word-break:break-all;}`}}));function n4(e,t){let n=J(t,`loading`,3,`lazy`),r=J(t,`asset`,3,void 0),i=J(t,`src`,3,void 0),a=J(t,`variant`,3,void 0),o=J(t,`blurBackground`,3,!1),s=J(t,`cover`,3,!1),c=J(t,`checkerboard`,3,!1),l=J(t,`alt`,3,``),u=zs(t,[`$$slots`,`$$events`,`$$legacy`,`loading`,`asset`,`src`,`variant`,`blurBackground`,`cover`,`checkerboard`,`alt`]);r0(e,Bs({kind:`image`,get loading(){return n()},get asset(){return r()},get src(){return i()},get variant(){return a()},get blurBackground(){return o()},get cover(){return s()},get checkerboard(){return c()},get alt(){return l()}},()=>u))}var r4=o((()=>{Q(),Y(),u0()}));function i4(e,t){O(t,!0),K(e,c4);let n=J(t,`files`,27,()=>gr([])),r=J(t,`transformedFileMap`,3,void 0),i=J(t,`removable`,3,!0);var a=s4();ro(a,23,n,(e,t)=>`${e.name}-${t}`,(e,t,a)=>{var o=H();Ua(I(o),eS,null,e=>{let o=M(()=>{let{name:e,type:n,size:r}=z(t);return{name:e,type:n,size:r}}),s=M(()=>r()?.get(z(t)));var c=o4(),l=F(c),u=e=>{{let n=M(()=>URL.createObjectURL(z(t)));n4(e,{get src(){return z(n)},variant:`icon`,checkerboard:!0})}},d=M(()=>Hw.includes(z(o).type)),f=e=>{var t=a4();NF(F(t),{name:`draft`}),D(t),U(e,t)};G(l,e=>{z(d)?e(u):e(f,-1)});var p=L(l,2),m=F(p);YF(F(m),{children:(e,t)=>{dt();var n=wa();R(e=>W(n,e),[()=>z(o).name.normalize()]),U(e,n)},$$slots:{default:!0}}),D(m);var h=L(m,2),g=F(h);Ya(g,()=>Lh.current,e=>{var n=wa();R(e=>W(n,e),[()=>X(`file_meta`,{values:{type:X(`file_type_labels.${z(t).type.split(`/`)[1]}`,{default:xp(z(o).name).extension?.toUpperCase()}),size:GC(z(o).size)}})]),U(e,n)});var _=L(g,2),v=e=>{var t=wa();R(e=>W(t,e),[()=>X(`file_meta_converted_from_x`,{values:{type:X(`file_type_labels.${z(s).type.split(`/`)[1]}`,{default:xp(z(s).name).extension?.toUpperCase()})}})]),U(e,t)};G(_,e=>{z(s)&&z(s).type!==z(t).type&&e(v)}),D(h),D(p);var y=L(p,2);{let e=M(()=>X(`remove`)),t=M(()=>!i()||n().length===1);fI(y,{variant:`ghost`,iconic:!0,get"aria-label"(){return z(e)},get hidden(){return z(t)},onclick:e=>{e.stopPropagation(),n().splice(z(a),1)},children:(e,t)=>{NF(e,{name:`close`})},$$slots:{default:!0}})}D(c),U(e,c)}),U(e,o)}),D(a),U(e,a),k()}var a4,o4,s4,c4,l4=o((()=>{Q(),Y(),Z(),VQ(),kp(),tS(),r4(),QC(),Ww(),a4=V(`<span role="none" class="image svelte-lbhi1w"><!></span>`),o4=V(`<div role="listitem" class="file svelte-lbhi1w"><!> <div role="none" class="info svelte-lbhi1w"><div role="none" class="name"><!></div> <div role="none" class="meta svelte-lbhi1w"><!> <!></div></div> <!></div>`),s4=V(`<div role="list" class="files svelte-lbhi1w"></div>`),c4={hash:`svelte-lbhi1w`,code:`.files.svelte-lbhi1w {display:flex;flex-direction:column;gap:16px;margin:0 8px;}.file.svelte-lbhi1w {display:flex;align-items:center;gap:16px;overflow:hidden;}.file.svelte-lbhi1w .preview {flex:none;}.file.svelte-lbhi1w .image:where(.svelte-lbhi1w) {flex:none;display:flex;justify-content:center;align-items:center;width:40px;height:40px;aspect-ratio:1/1;object-fit:cover;border-radius:var(--sui-control-medium-border-radius);background-color:var(--sui-tertiary-background-color);}.file.svelte-lbhi1w .info:where(.svelte-lbhi1w) {flex:auto;display:flex;flex-direction:column;gap:4px;overflow:hidden;text-align:start;}.file.svelte-lbhi1w .info:where(.svelte-lbhi1w) .meta:where(.svelte-lbhi1w) {font-size:var(--sui-font-size-small);color:var(--sui-secondary-foreground-color);}`}}));function u4(e,t){O(t,!0),K(e,g4);let n=()=>j(wA,`$hasMouse`,r),[r,i]=ln(),a=e=>{var t=H(),n=I(t),r=e=>{var t=wa();R(e=>W(t,e),[()=>X(`dropped_image_type_mismatch`)]),U(e,t)},i=M(()=>o()===Hw.join(`,`)),a=e=>{var t=wa();R(e=>W(t,e),[()=>X(`dropped_file_type_mismatch`,{values:{type:hb(Lh.current,{type:`disjunction`}).format(o().split(/,\s*/))}})]),U(e,t)};G(n,e=>{z(i)?e(r):e(a,-1)}),U(e,t)},o=J(t,`accept`,3,void 0),s=J(t,`disabled`,3,!1),c=J(t,`multiple`,3,!1),l=J(t,`showUploadButton`,3,!1),u=J(t,`showFilePreview`,3,!1),d=J(t,`onDrop`,3,void 0),f=J(t,`children`,3,void 0),p=N(void 0),m=N(!1),h=N(!1),g=N(!1),_=N(void 0),v=N(gr([])),y=M(()=>l()||u()&&z(v).length),b=()=>{z(_)?.open()},x=()=>{z(v).length&&(P(v,[],!0),d()?.({files:z(v)}))},S=e=>{P(v,c()?e:e.slice(0,1),!0),d()?.({files:z(v)})},C=e=>{d()?.({files:e.detail.files})};Ys(()=>(z(p)?.addEventListener(`Select`,C),()=>{z(p)?.removeEventListener(`Select`,C)})),Kr(()=>{!z(y)&&z(h)&&P(g,!0)});var w={openFilePicker:b,reset:x},T=h4(),ee=I(T),te=F(ee),ne=e=>{var t=p4(),r=F(t),i=e=>{var t=f4(),r=I(t),i=F(r),o=e=>{var t=wa();R(e=>W(t,e),[()=>X(`drop_files_or_click_to_browse`,{values:{count:c()?2:1}})]),U(e,t)},l=e=>{var t=wa();R(e=>W(t,e),[()=>X(`tap_to_browse`)]),U(e,t)};G(i,e=>{n()?e(o):e(l,-1)}),D(r);var u=L(r,2),d=F(u);{let e=e=>{NF(e,{name:`cloud_upload`})},t=M(()=>X(`choose_files`,{values:{count:c()?2:1}}));fI(d,{variant:`primary`,get label(){return z(t)},get disabled(){return s()},onclick:()=>{b()},startIcon:e,$$slots:{startIcon:!0}})}D(u);var f=L(u,2),p=e=>{var t=d4();a(F(t)),D(t),U(e,t)};G(f,e=>{z(h)&&e(p)}),U(e,t)};G(r,e=>{l()&&e(i)});var o=L(r,2),d=e=>{i4(e,{get files(){return z(v)},set files(e){P(v,e,!0)}})};G(o,e=>{u()&&z(v).length&&e(d)}),D(t),U(e,t)},re=e=>{var t=H();go(I(t),()=>f()??E),U(e,t)};G(te,e=>{z(y)?e(ne):e(re,-1)});var ie=L(te,2),ae=e=>{var t=m4(),n=F(t),r=F(n);NF(r,{name:`download`});var i=L(r,2),a=F(i,!0);D(i),D(n),D(t),R(e=>W(a,e),[()=>X(`drop_files_here`,{values:{count:c()?2:1}})]),U(e,t)};G(ie,e=>{z(m)&&e(ae)}),D(ee),Ps(ee,e=>P(p,e),()=>z(p));var oe=L(ee,2);Ps(OL(oe,{get accept(){return o()},get multiple(){return c()},onSelect:({files:e})=>{S(e)}}),e=>P(_,e,!0),()=>z(_));var se=L(oe,2),ce=e=>{{let t=M(()=>X(`unsupported_file_type`));vL(e,{get title(){return z(t)},get open(){return z(g)},set open(e){P(g,e,!0)},children:(e,t)=>{a(e)},$$slots:{default:!0}})}};G(se,e=>{z(y)||e(ce)}),ua(`dragover`,ee,e=>{e.preventDefault(),!(s()||!e.dataTransfer)&&(e.dataTransfer.dropEffect=`copy`,P(m,!0),P(h,!1))}),ua(`dragleave`,ee,e=>{e.preventDefault(),!s()&&P(m,!1)}),ua(`dragend`,ee,e=>{e.preventDefault(),!s()&&P(m,!1)}),ua(`drop`,ee,async e=>{if(e.preventDefault(),s()||!e.dataTransfer)return;P(m,!1);let t=await Cp(e.dataTransfer,{accept:o()});t.length?S(t):P(h,!0)}),U(e,T);var le=k(w);return i(),le}var d4,f4,p4,m4,h4,g4,_4=o((()=>{Q(),Y(),Z(),VQ(),kp(),Zs(),l4(),_b(),EA(),Ww(),d4=V(`<div role="alert"><!></div>`),f4=V(`<div role="none"><!></div> <div role="none"><!></div> <!>`,1),p4=V(`<div role="none" class="content svelte-1hhq62q"><!> <!></div>`),m4=V(`<div role="none" class="drop-indicator svelte-1hhq62q"><div role="none" class="svelte-1hhq62q"><!> <span role="none"> </span></div></div>`),h4=V(`<div role="none" class="drop-target svelte-1hhq62q"><!> <!></div> <!> <!>`,1),g4={hash:`svelte-1hhq62q`,code:`.drop-target.svelte-1hhq62q {display:flex;flex-direction:column;position:relative;overflow:hidden;height:100%;pointer-events:auto;}.drop-target.svelte-1hhq62q > .group {overflow-y:auto;padding:16px;width:100%;height:100%;}.drop-target.svelte-1hhq62q button:not(:disabled) {pointer-events:auto;}.drop-indicator.svelte-1hhq62q {position:absolute;inset:0;z-index:10;border-radius:var(--sui-control-large-border-radius);background-color:hsl(var(--sui-background-color-4-hsl)/80%);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);text-align:center;pointer-events:none;}.drop-indicator.svelte-1hhq62q div:where(.svelte-1hhq62q) {position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4px;border:4px dashed var(--sui-primary-accent-color);border-radius:var(--sui-control-large-border-radius);font-size:var(--sui-font-size-x-large);}.drop-indicator.svelte-1hhq62q div:where(.svelte-1hhq62q) .icon {color:var(--sui-secondary-foreground-color);font-size:48px;}.content.svelte-1hhq62q {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;overflow:auto;height:100%;min-height:320px;text-align:center;}`}}));function v4(e,t){O(t,!0);let n=()=>j(Np,`$targetAssetFolder`,r),[r,i]=ln(),a=J(t,`label`,3,void 0),o=M(()=>!Lp(n()));{let t=e=>{NF(e,{name:`cloud_upload`})},n=M(()=>!a()),r=M(()=>X(`upload_assets`));fI(e,{variant:`primary`,get iconic(){return z(n)},get disabled(){return z(o)},get label(){return a()},get"aria-label"(){return z(r)},onclick:()=>{cn(r$,!0)},startIcon:t,$$slots:{startIcon:!0}})}k(),i()}var y4=o((()=>{Q(),Y(),Z(),VQ(),Rp(),u$()}));function b4(e,t){K(e,S4);let n=J(t,`children`,3,void 0),r=zs(t,[`$$slots`,`$$events`,`$$legacy`,`children`]);var i=x4();us(i,()=>({role:`group`,class:`list-container`,...r}),void 0,void 0,void 0,`svelte-1sdsl2g`),go(F(i),()=>n()??E),D(i),U(e,i)}var x4,S4,C4=o((()=>{Q(),Y(),x4=V(`<div><!></div>`),S4={hash:`svelte-1sdsl2g`,code:`.list-container.svelte-1sdsl2g {--icon-size: 36px;flex:auto;position:relative;height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;}`}}));function w4(e,t){O(t,!0),K(e,E4);let n=J(t,`children`,3,void 0),r=zs(t,[`$$slots`,`$$events`,`$$legacy`,`viewType`,`children`]);var i=T4();Ua(F(i),eS,null,e=>{kae(e,Bs({multiple:!0,clickToSelect:!1},()=>r,{children:(e,t)=>{var r=H();go(I(r),()=>n()??E),U(e,r)},$$slots:{default:!0}}))}),D(i),R(()=>Qo(i,1,`${t.viewType??``}-view`,`svelte-1sfbolp`)),U(e,i),k()}var T4,E4,D4=o((()=>{Q(),Y(),VQ(),tS(),T4=V(`<div role="none"><!></div>`),E4={hash:`svelte-1sfbolp`,code:`:is(.grid-view.svelte-1sfbolp, .list-view.svelte-1sfbolp) {display:block;padding:0 16px 16px;height:100%;overflow-y:auto;}
570
+ .wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) .markdown:where(.svelte-9guikv) {margin:0;padding:16px;overflow:auto;}.wrapper.svelte-9guikv .row:where(.svelte-9guikv) .preview:where(.svelte-9guikv) pre:where(.svelte-9guikv) {white-space:pre-wrap;}.wrapper.svelte-9guikv .row:where(.svelte-9guikv) .detail {background-color:var(--sui-primary-background-color);}`}})),U0,W0,G0=o((()=>{Zf(),dP(),VP(),U0=an([IP,lP],([e,t])=>{if(!e||!t?.isGit)return!1;let{skip_ci:n,automatic_deployments:r}=e.backend;return typeof n==`boolean`||typeof r==`boolean`}),W0=an([IP,lP],([e,t])=>{if(!e||!t?.isGit)return!1;let{skip_ci:n,automatic_deployments:r}=e.backend;return n===!0||r===!1})})),K0,q0,J0,Y0=o((()=>{Zf(),pF(),I1(),IS(),G0(),V1(),P1(),ZP(),QC(),K0=e=>{let{files:t,folder:n,originalAsset:r}=e,{slugify_filename:i=!1}=YP().config,a=n?.internalPath===void 0?[]:fF(n.internalPath).map(e=>e.name.normalize());return t.map(e=>{let t=r?.name??qC(e.name,{slugificationEnabled:i,assetNamesInSameFolder:a});return a.includes(t)||a.push(t),{action:r?`update`:`create`,name:t,path:r?.path??[n?.internalPath,t].join(`/`),file:e}})},q0=({count:e})=>{let t=A(rF),n=A(iF);t&&rF.set(tF(t.path)),n&&iF.set(tF(n.path)),F1.set({...M1,saved:!0,published:A(U0)&&!A(W0),count:e})},J0=async(e,t)=>{let{files:n,folder:r}=e,i=K0(e),a=i.map(({name:e,path:t,file:n})=>({name:e,path:t,size:n.size,kind:FS(e),folder:r}));await B1({changes:i.map(({action:e,path:t,file:n})=>({action:e,path:t,data:n})),savingAssets:a,options:t}),q0({count:n.length})}}));function kle(e,t){O(t,!0),K(e,Z0);let n=()=>j(oF,`$editingAsset`,i),r=()=>j(n$,`$showAssetOverlay`,i),[i,a]=ln(),o=M(n),s=N(!1),c=N(void 0),l=N(void 0),u=N(void 0),d=N(!1),f=async()=>{P(c,await dT(z(o)),!0),P(l,await z(c).text(),!0),P(u,z(l),!0),P(s,!0)},p=()=>{cn(oF,void 0),P(c,void 0),P(l,void 0),P(u,void 0)},m=async()=>{z(o)&&z(c)&&typeof z(u)==`string`&&await J0({folder:z(o).folder,files:[new File([z(u)],z(o).name,{type:z(c).type})],originalAsset:z(o)},{commitType:`uploadMedia`})};Kr(()=>{z(o)&&z(c)===void 0&&f()}),Kr(()=>{r()||P(s,!1)});{let t=e=>{{let t=M(()=>X(`wrap_long_lines`));XR(e,{get label(){return z(t)},get checked(){return z(d)},set checked(e){P(d,e,!0)}})}},n=M(()=>X(`edit_x`,{values:{name:z(o)?.name??``}})),r=M(()=>X(`save`)),i=M(()=>z(u)===z(l));uL(e,{size:`x-large`,get title(){return z(n)},get okLabel(){return z(r)},get okDisabled(){return z(i)},okShortcuts:`Accel+S`,onOk:()=>{m()},onClose:()=>{p()},get open(){return z(s)},set open(e){P(s,e,!0)},footerExtra:t,children:(e,t)=>{var n=X0();let r;uQ(F(n),{flex:!0,get value(){return z(u)},set value(e){P(u,e,!0)}}),D(n),R(()=>r=Qo(n,1,`wrapper svelte-1lnkfih`,null,r,{wrap:z(d)})),U(e,n)},$$slots:{footerExtra:!0,default:!0}})}k(),a()}var X0,Z0,Ale=o((()=>{Q(),Y(),Z(),VQ(),pF(),Y0(),vT(),u$(),X0=V(`<div role="none"><!></div>`),Z0={hash:`svelte-1lnkfih`,code:`.wrapper.svelte-1lnkfih {display:contents;}.wrapper.svelte-1lnkfih textarea {min-height:40dvh;max-height:80dvh;font-family:var(--sui-font-family-monospace);font-size:var(--sui-font-size-monospace);text-wrap:nowrap;resize:vertical;}.wrapper.svelte-1lnkfih .wrap textarea {text-wrap:wrap;}`}})),Q0,$0,e2=o((()=>{gp(),KP(),ub(),_b(),QC(),Q0=({basePath:e,path:t,extension:n,locale:r,omitLocale:i,structure:a})=>{switch(a){case`multiple_folders`:return i?`${e}/${t}.${n}`:`${e}/${r}/${t}.${n}`;case`multiple_folders_i18n_root`:case`multiple_root_folders`:return i?`${e}/${t}.${n}`:`${r}/${e}/${t}.${n}`;case`multiple_files`:return i?`${e}/${t}.${n}`:`${e}/${t}.${r}.${n}`;default:return`${e}/${t}.${n}`}},$0=({draft:e,locale:t,slug:n})=>{let{collection:r,collectionFile:i,originalEntry:a,currentValues:o,isIndexFile:s}=e,{_i18n:{defaultLocale:c,structure:l,omitDefaultLocaleFromFilePath:u}}=i??r;if(i){let{_i18n:e,file:n}=i;return gb({_i18n:e,locale:t,path:fp(n)})}if(a?.locales[t]?.slug===n)return a.locales[t].path;let d=r,{_file:{basePath:f,subPath:p,extension:m}}=d,h=s?cb(d)?.name:p?GP(p,{collection:d,locale:t,content:o[c],currentSlug:n}):n;return s&&h?.endsWith(`.${m}`)&&(h=h.slice(0,-m.length-1)),JC(Q0({basePath:f,path:h,extension:m,locale:t,omitLocale:u&&t===c,structure:l}).split(`/`))}})),t2,n2,r2,i2,a2,o2,s2=o((()=>{KP(),ub(),t2=(e,t)=>{let n={...e};return Object.entries(n).forEach(([e,r])=>{typeof r==`string`&&r.startsWith(`blob:`)&&t[r]&&(n[e]=t[r].file.name.replace(/\.[^.]+$/,``))}),n},n2=({draft:e})=>{let{collection:t,collectionFile:n,currentSlugs:r,currentValues:i,files:a,isIndexFile:o}=e,{_i18n:{defaultLocale:s}}=n??t;return{collection:t,content:{...t2(i[s],a),_slug:r?.[s]??r?._},locale:s,isIndexFile:o}},r2=({draft:e,locale:t,localizingKeyPaths:n})=>{let{isNew:r,collection:i,collectionFile:a,originalLocales:o,currentSlugs:s,currentValues:c,files:l,isIndexFile:u}=e,{_type:d}=i,{identifier_field:f=`title`,slug:p=`{{${f}}}`}=d===`entry`?i:{},{_i18n:{defaultLocale:m}}=a??i,h=s?.[t]??s?._;return r||!o[t]?GP(p,{collection:i,locale:t,content:{...t2(c[m],l),...t2(Object.fromEntries(n.map(e=>[e,c[t]?.[e]])),l),_slug:h},isIndexFile:u}):h},i2=({draft:e,defaultLocaleSlug:t})=>{let{collection:n,collectionFile:r,currentLocales:i}=e,{_type:a}=n,{identifier_field:o=`title`,slug:s=`{{${o}}}`}=a===`entry`?n:{},{_i18n:{defaultLocale:c,structureMap:{i18nSingleFile:l,i18nSingleFileDefaultRoot:u}}}=r??n,d=[...s.matchAll(/{{((?:fields\.)?.+?)( \| localize)?}}/g)].filter(([,,e])=>!!e).map(([,e])=>e.replace(/^fields\./,``));if(!(l||u||!d.length))return Object.fromEntries(Object.entries(i).map(([n])=>[n,n===c?t:r2({draft:e,locale:n,localizingKeyPaths:d})]))},a2=({draft:e,defaultLocaleSlug:t,localizedSlugs:n,fillSlugOptions:r})=>{if(!n)return;let{collection:i,collectionFile:a}=e,{_i18n:{canonicalSlug:{value:o}}}=a??i;return o===`{{slug}}`?t:GP(o,{...r,currentSlug:t})},o2=({draft:e})=>{let{isNew:t,collection:n,collectionFile:r,fileName:i,currentSlugs:a,isIndexFile:o}=e,{_type:s}=n,{identifier_field:c=`title`,slug:l=`{{${c}}}`}=s===`entry`?n:{};if(o)return{defaultLocaleSlug:cb(n)?.name,localizedSlugs:void 0,canonicalSlug:void 0};let{_i18n:{defaultLocale:u}}=r??n,d=n2({draft:e}),f=i??(t?GP(l,d):a?.[u]??a?._),p=i2({draft:e,defaultLocaleSlug:f});return{defaultLocaleSlug:f,localizedSlugs:p,canonicalSlug:a2({draft:e,defaultLocaleSlug:f,localizedSlugs:p,fillSlugOptions:d})}}})),c2,l2,u2,d2,f2,p2,m2,h2,g2,_2,jle=o((()=>{c2=l(jM(),1),pF(),IS(),KP(),e2(),s2(),QC(),l2=[`multiple_folders`,`multiple_folders_i18n_root`,`multiple_root_folders`],u2=/(?<path>.+?)(?:\/[^/]+)?$/,d2=(e,t)=>e.includes(`{{`)?GP(e,t):e,f2=(e,t)=>{let n=e.lastIndexOf(`.`),r=e.substring(0,n),i=t?.includes(`/`)?t.split(`/`).at(-1):void 0;return i&&!i.includes(`{{`)&&(r=r.match(u2)?.groups?.path),r},p2=({internalPath:e,internalSubPath:t,entryFolderPath:n,isMultiFolders:r,isNestedEntry:i,fillSlugOptions:a})=>YC(d2(JC([r||i?n:e,t]),a)),m2=({publicPath:e,subPathFolderPath:t,subPath:n,isMultiFolders:r,fillSlugOptions:i})=>!r&&/^\.?$/.test(e)?e:YC(d2(r?JC([...Array((n?.match(/\//g)??[]).length+1).fill(`..`),e,t]):e,i)),h2=({folder:e,fillSlugOptions:t})=>{let{entryRelative:n,internalPath:r,internalSubPath:i,publicPath:a}=e;if(r===void 0||a===void 0)return{resolvedInternalPath:``,resolvedPublicPath:``};if(!n)return{resolvedInternalPath:GP(r,t),resolvedPublicPath:GP(a,t)};let{collection:o,entryFilePath:s}=t,c=l2.includes(o._i18n.structure),l=o._type===`entry`?o._file.subPath:void 0,u=l?.match(u2)?.groups?.path??``;return{resolvedInternalPath:p2({internalPath:r,internalSubPath:i,entryFolderPath:f2(s??``,l),isMultiFolders:c,isNestedEntry:l?.includes(`/`)??!1,fillSlugOptions:t}),resolvedPublicPath:m2({publicPath:a,subPathFolderPath:u,subPath:l,isMultiFolders:c,fillSlugOptions:t})}},g2=({draft:e,defaultLocaleSlug:t,folder:n})=>{let{collection:r,collectionName:i,collectionFile:a,isIndexFile:o}=e,{_i18n:{defaultLocale:s}}=a??r,c=h2({folder:n,fillSlugOptions:{...n2({draft:e}),type:`media_folder`,currentSlug:t,entryFilePath:$0({draft:e,locale:s,slug:t}),isIndexFile:o}}),{resolvedInternalPath:l}=c;return{assetFolderPaths:c,assetNamesInSameFolder:fF(l).map(e=>e.name.normalize()),savingAssetProps:{collectionName:i,folder:n}}},_2=async({file:e,folder:t,blobURL:n,draft:r,defaultLocaleSlug:i,keyPath:a,content:o,changes:s,savingAssets:c,slugificationEnabled:l,encodingEnabled:u})=>{let d=await ZC(e),f=c.find(e=>e.sha===d&&(!t.entryRelative||(0,c2.default)(e.folder,t))),{savingAssetProps:p,assetNamesInSameFolder:m,assetFolderPaths:{resolvedInternalPath:h,resolvedPublicPath:g}}=g2({draft:r,defaultLocaleSlug:i,folder:t}),_=``;if(f)_=f.name;else{_=qC(e.name,{slugificationEnabled:l,assetNamesInSameFolder:m});let t=h?`${h}/${_}`:_;m.push(_),s.push({action:`create`,path:t,data:e}),c.push({...p,blobURL:n,name:_,path:t,sha:d,size:e.size,kind:FS(_)})}let v=g?`${g===`/`?``:g}/${_}`:_;u&&(v=HC(v)),o[a]=o[a].replaceAll(n,v)}})),v2,y2,b2,x2,S2,C2,w2,T2=o((()=>{v2=l(jM(),1),Zf(),IM(),y2=/\.__sc_\w+$/,b2=rn(),x2=rn(!0),S2=rn(!1),C2=e=>Object.fromEntries(Object.entries(e).filter(([e])=>!y2.test(e))),w2=an([b2],([e])=>{if(!e)return!1;let{originalLocales:t,currentLocales:n,originalSlugs:r,currentSlugs:i,originalValues:a,currentValues:o}=e,s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,C2(t)]));return!(0,v2.default)(t,n)||!(0,v2.default)(r,i)||!(0,v2.default)(a,s)}),b2.subscribe(e=>{A(FM).devModeEnabled&&console.info(`entryDraft`,e)})})),E2,D2,Mle=o((()=>{$k(),vC(),E2=({field:e,keyPath:t,keyPathList:n})=>{let{widget:r}=e,i=r===`list`;if(n.push(t),i||r===`object`){let{fields:r}=e,{types:a,typeKey:o=`type`}=e;if(r)r.forEach(e=>{E2({field:e,keyPath:i?`${t}.*.${e.name}`:`${t}.${e.name}`,keyPathList:n})});else if(a)n.push(i?`${t}.*.${o}`:`${t}.${o}`),a.forEach(e=>{e.fields?.forEach(e=>{E2({field:e,keyPath:i?`${t}.*.${e.name}`:`${t}.${e.name}`,keyPathList:n})})});else if(i){let{field:r}=e;r?E2({field:r,keyPath:`${t}.*`,keyPathList:n}):n.push(`${t}.*`)}}else r&&_C.includes(r)&&Uk(e)&&n.push(`${t}.*`)},D2=e=>{let t=[];return e.forEach(e=>{E2({field:e,keyPath:e.name,keyPathList:t})}),t}})),O2,k2,A2,j2,M2,Nle=o((()=>{f(),gp(),nc(),Ux(),Zf(),VP(),T2(),Mle(),$k(),lC(),Gx(),O2=new Map,k2=e=>e==null||e===``||Array.isArray(e)&&!e.length||u(e)&&!Object.keys(e).length,A2=({key:e,field:t,locale:n,unsortedMap:r,sortedMap:i,isTomlOutput:a,omitEmptyOptionalFields:o})=>{if(y2.test(e)){delete r[e];return}let s=r[e];if(a&&t?.widget===`datetime`&&!tC(t).format){let e=new Cx(s);s=e.isValid()?e:void 0}if(o&&t&&!qk({fieldConfig:t,locale:n})&&k2(s)){let t=Object.keys(r).filter(t=>t.startsWith(`${e}.`));t.some(e=>!y2.test(e)&&!k2(r[e]))?i[e]=s:t.forEach(e=>{delete r[e]})}else i[e]=s;delete r[e]},j2=({collectionName:e,fileName:t,fields:n,locale:r,valueMap:i,canonicalSlugKey:a,isIndexFile:o=!1,isTomlOutput:s=!1})=>{let c=d(i),l={},{omit_empty_optional_fields:u=!1}=A(IP)?.output??{},f={collectionName:e,fileName:t,valueMap:i,isIndexFile:o},p={locale:r,unsortedMap:c,sortedMap:l,isTomlOutput:s,omitEmptyOptionalFields:u};return a&&a in c&&A2({...p,key:a}),D2(n).forEach(e=>{let t=Kk({...f,keyPath:e});if(e in c)A2({...p,key:e,field:t});else if(t?.widget===`keyvalue`)l[e]={},Object.entries(c).filter(([t])=>t.startsWith(`${e}.`)).forEach(([e])=>{A2({...p,key:e,field:t})});else{let n=Wx(O2,e,()=>RegExp(`^${up(e.replaceAll(`*`,`\\d+`)).replaceAll(`\\\\d\\+`,`\\d+`)}$`));Object.keys(c).filter(e=>n.test(e)).sort(([e,t])=>hp(e,t)).forEach(e=>{let n=t??Kk({...f,keyPath:e});A2({...p,key:e,field:n})})}}),Object.keys(c).sort(([e,t])=>hp(e,t)).forEach(e=>{A2({...p,key:e})}),tc(l)},M2=({draft:e,locale:t,valueMap:n})=>{let{collection:r,collectionName:i,collectionFile:a,fields:o,isIndexFile:s}=e,{_file:c,_i18n:{canonicalSlug:{key:l}}}=a??r,u=[`toml`,`toml-frontmatter`].includes(c.format),d=j2({collectionName:i,fileName:a?.name,fields:o,locale:t,valueMap:n,canonicalSlugKey:l,isIndexFile:s,isTomlOutput:u});return!u&&Hk(o,`list`)?d[o[0].name]??[]:Hk(o,`keyvalue`)?d[o[0].name]??{}:d}})),N2,P2,F2,I2,L2,Ple=o((()=>{Ux(),Zf(),By(),VP(),Eb(),N2=(e,t=A(IP)?.output?.json??{})=>{let{indent_style:n=`space`,indent_size:r=n===`tab`?1:2}=t;return JSON.stringify(e,null,n===`tab`?` `.repeat(r):r).trim()},P2=e=>Cne(e).trim(),F2=(e,t=A(IP)?.output?.yaml??{},n={})=>{let{indent_size:r=2,indent_sequences:i=!0,quote:a=`none`}=t,{quote:o=!1}=n;return Ry(e,null,{indent:r,indentSeq:i,lineWidth:0,defaultKeyType:`PLAIN`,defaultStringType:o||a===`double`?`QUOTE_DOUBLE`:a===`single`?`QUOTE_SINGLE`:`PLAIN`,singleQuote:!(o||a===`double`)}).trim()},I2=({content:e,_file:t})=>{let{format:n,fmDelimiters:r,yamlQuote:i=!1}=t,[a,o]=r??[`---`,`---`],s=typeof e.body==`string`?e.body:``;if(delete e.body,!Object.keys(e).length)return`${s}\n`;try{let t=``;if(n===`frontmatter`||n===`yaml-frontmatter`)t=F2(e,void 0,{quote:i});else if(n===`toml-frontmatter`)t=P2(e);else if(n===`json-frontmatter`)t=N2(e);else return``;return`${a}\n${t}\n${o}\n${s?`\n${s}\n`:``}`}catch(e){console.error(e)}return``},L2=async({content:e,_file:t})=>{let{format:n,yamlQuote:r=!1}=t,i=yb.get(n)?.formatter;if(i)return`${(await i(e)).trim()}\n`;if(n===`raw`)return typeof e.body==`string`?`${e.body}\n`:``;try{if(/^ya?ml$/.test(n))return`${F2(e,void 0,{quote:r})}\n`;if(n===`toml`)return`${P2(e)}\n`;if(n===`json`)return`${N2(e)}\n`}catch(e){return console.error(e),``}return/^(?:(?:yaml|toml|json)-)?frontmatter$/.test(n)?I2({content:e,_file:t}):``}})),R2,z2,B2,V2,H2,U2=o((()=>{kp(),f(),mS(),Zf(),Rp(),dP(),VP(),bF(),jle(),e2(),Nle(),$k(),Ple(),ZP(),R2=async({draft:e,slugs:{defaultLocaleSlug:t,canonicalSlug:n,localizedSlugs:r}})=>{let i=A(jp),{collection:a,collectionName:o,collectionFile:s,fileName:c,isIndexFile:l,currentLocales:u,currentValues:f,files:p}=e,{_i18n:{canonicalSlug:{key:m}}}=s??a,h=[],g=[],{slugify_filename:_=!1}=YP().config,{encode_file_path:v=!1}=A(IP)?.output??{},y={collectionName:o,fileName:c,keyPath:``,valueMap:{},isIndexFile:l},b={draft:e,defaultLocaleSlug:t,changes:h,savingAssets:g,slugificationEnabled:_};return{localizedEntryMap:Object.fromEntries(await Promise.all(Object.entries(f).map(async([a,o])=>{let s=r?.[a]??t,c=$0({draft:e,locale:a,slug:s});return u[a]?(o[m]=n,await Promise.all(Object.entries(o).map(async([e,t])=>{if(t===void 0){delete o[e];return}if(typeof t!=`string`)return;o[e]=t.trim();let n=[...t.matchAll(_p(`g`))];if(!n.length)return;let r=Kk({...y,valueMap:o,keyPath:e}),a={...b,keyPath:e,content:o,encodingEnabled:r?.widget===`richtext`||r?.widget===`markdown`?!0:v};await Promise.all(n.map(async([e])=>{let{file:t,folder:n=i}=p[e]??{};t&&await _2({...a,file:t,folder:n,blobURL:e})}))})),[a,{slug:s,path:c,content:d(o)}]):[a,{path:c}]}))),changes:h,savingAssets:g}},z2=async({previousPath:e,cacheDB:t})=>{if(e)return(await t?.get(e))?.sha},B2=async({draft:e,savingEntry:t,cacheDB:n})=>{let{collection:r,isNew:i,originalSlugs:a,originalEntry:o,collectionFile:s}=e,{_file:c,_i18n:{i18nEnabled:l,defaultLocale:u,structureMap:{i18nSingleFileDefaultRoot:d}={}}}=s??r,{slug:f,path:p,content:m}=t.locales[u],h=!i&&(a?.[u]??a?._)!==f,g=o?.locales[u]?.path;return{action:i?`create`:h?`move`:`update`,slug:f,path:p,previousPath:h?g:void 0,previousSha:await z2({cacheDB:n,previousPath:g}),data:await L2({content:(()=>{if(!l)return M2({draft:e,locale:`_default`,valueMap:m});let n=Object.fromEntries(Object.entries(t.locales).filter(([,e])=>!!e.content).map(([t,n])=>[t,M2({draft:e,locale:t,valueMap:n.content})]));if(d){let{lang:e,...t}=n[u]??{},r=Object.fromEntries(Object.entries(n).filter(([e])=>e!==u));return{lang:[u,...Object.keys(r)],...t,...r}}return n})(),_file:c})}},V2=async({draft:e,savingEntry:t,cacheDB:n,locale:r})=>{let{collection:i,isNew:a,originalLocales:o,currentLocales:s,originalSlugs:c,originalEntry:l,collectionFile:u}=e,{_file:d}=u??i,{slug:f,path:p,content:m}=t.locales[r]??{},h=l?.locales[r]?.path,g=await z2({cacheDB:n,previousPath:h});if(s[r]){let t=!a&&o[r]&&(c?.[r]??c?._)!==f;return{action:a||!o[r]?`create`:t?`move`:`update`,slug:f,path:p,previousPath:t?h:void 0,previousSha:g,data:await L2({content:M2({draft:e,locale:r,valueMap:m}),_file:d})}}if(!a&&o[r])return{action:`delete`,slug:f,path:p,previousSha:g}},H2=async({draft:e,slugs:t})=>{let{id:n,collection:r,collectionFile:i}=e,{defaultLocaleSlug:a}=t,{_file:o,_i18n:{i18nEnabled:s,allLocales:c,defaultLocale:l,structureMap:{i18nSingleFile:u,i18nSingleFileDefaultRoot:d}}}=i??r,{localizedEntryMap:f,changes:p,savingAssets:m}=await R2({draft:e,slugs:t}),h={id:n,slug:a,subPath:o.fullPathRegEx?f[l].path.match(o.fullPathRegEx)?.groups?.subPath??a:a,locales:Object.fromEntries(Object.entries(f))};await yF({type:`preSave`,draft:e,savingEntry:h});let g=A(lP)?.repository?.databaseName,_={draft:e,savingEntry:h,cacheDB:g?new dS(g,`file-cache`):void 0};return!s||u||d?p.push(await B2({..._})):await Promise.all(c.map(async e=>{let t=await V2({..._,locale:e});t&&p.push(t)})),{savingEntry:h,savingAssets:m,changes:p}}})),W2,G2,K2,q2,J2,Y2,Fle=o((()=>{kp(),Zf(),pF(),I1(),Rp(),vT(),V1(),P1(),zT(),rb(),ub(),U2(),s2(),OT(),W2=({entry:e})=>{let{locales:t}=e,n=Object.entries(t),r=Object.fromEntries(n.map(([e])=>[e,!0])),i=Object.fromEntries(n.map(([e,{slug:t}])=>[e,t])),a=Object.fromEntries(n.map(([e,{content:t}])=>[e,t]));return{createdAt:Date.now(),isNew:!1,canPreview:!0,originalEntry:e,originalLocales:r,currentLocales:structuredClone(r),originalSlugs:i,currentSlugs:structuredClone(i),originalValues:a,currentValues:structuredClone(a),files:{},validities:{},validationMessages:{},expanderStates:{}}},G2=async({draftProps:e,indexFile:t,savingEntries:n,changes:r})=>{let{collection:i,collectionFile:a}=e,{fields:o=[]}=a??i,s={...e,fields:t?.fields??o},{savingEntry:c,changes:l}=await H2({draft:s,slugs:o2({draft:s})});n.push(c),r.push(...l)},K2=async({entry:e,savingEntries:t,changes:n})=>{let r=W2({entry:e});await Promise.all(wT(e).map(async i=>{let a=i.name,o=lb(i,e),s=o?cb(i):void 0,c=eb(i,e),l={indexFile:s,savingEntries:t,changes:n},u={...r,collection:i,collectionName:a,isIndexFile:o};c.length?await Promise.all(c.map(e=>G2({...l,draftProps:{...u,collectionFile:e,fileName:e.name}}))):await G2({...l,draftProps:u})}))},q2=async({_globalAssetFolder:e,newPath:t,asset:n,savingEntries:r,changes:i})=>{let a=hT(n)??n.blobURL,o=a?await LT(a):[];if(!a||!o.length)return;let{publicPath:s}=Ip(n.path).find(({collectionName:e})=>e!==void 0)??e,c=await LT(a,{entries:structuredClone(o),newURL:t.replace(n.folder.internalPath??``,s??``)});c.length&&await Promise.all(c.map(async e=>K2({entry:e,savingEntries:r,changes:i})))},J2=({action:e,movedAssets:t})=>{let n=A(rF)?.path,r=t.find(e=>e.asset.path===n),i=A(iF)?.path,a=t.find(e=>e.asset.path===i);r&&rF.set(tF(r.path)),a&&iF.set(tF(a.path)),F1.set({...M1,moved:e===`move`,renamed:e===`rename`,count:t.length})},Y2=async(e,t)=>{let n=A(jp),r=[],i=[],a=[];await Promise.all(t.map(async({asset:e,path:t})=>{let o=t,s=xp(o).basename;a.push({...e,path:o,name:s}),r.push({action:`move`,path:o,previousPath:e.path,previousSha:e.sha,data:new File([e.file??await dT(e)],s)}),await q2({_globalAssetFolder:n,newPath:o,asset:e,savingEntries:i,changes:r})})),await B1({changes:r,savingEntries:i,savingAssets:a,options:{commitType:`uploadMedia`}}),J2({action:e,movedAssets:t})}}));function Ile(e,t){let n=Ta();O(t,!0),K(e,Q2);let r=()=>j(sF,`$renamingAsset`,a),i=()=>j(n$,`$showAssetOverlay`,a),[a,o]=ln(),s=N(!1),c=N(gr({filename:``})),l=N(``),u=N(gr([])),d=N(gr([])),f=M(r),p=M(()=>z(c).dirname),m=M(()=>z(c).filename),h=M(()=>z(c).extension),g=M(()=>{if(!z(l).trim())return`empty`;if(z(l).includes(`/`))return`character`;if(z(u).includes(`${z(l)}${z(h)?`.${z(h)}`:``}`))return`duplicate`}),_=M(()=>!!z(g)),v=async()=>{z(f)&&(P(c,xp(z(f).path),!0),P(l,z(m),!0),P(u,fF(z(p)).map(e=>e.name).filter(e=>e!==z(f).name),!0),P(d,await E1(z(f)),!0),P(s,!0))},y=async()=>{if(!z(f))return;let e=z(f).path,t=`${z(p)}/${z(l)}${z(h)?`.${z(h)}`:``}`;await Y2(`rename`,[{asset:z(f),path:t}]),g$().path===`/assets/${e}`&&await b$(`/assets/${t}`,{replaceState:!0,notifyChange:!1})};Kr(()=>{z(f)&&v()}),Kr(()=>{i()||(P(s,!1),cn(sF,void 0))});{let t=M(()=>X(`rename_x`,{values:{name:z(f)?.name??``}})),r=M(()=>X(`rename`)),i=M(()=>z(l)===z(m)||z(_));uL(e,{get title(){return z(t)},get okLabel(){return z(r)},get okDisabled(){return z(i)},onOk:()=>{y()},onClose:()=>{cn(sF,void 0)},get open(){return z(s)},set open(e){P(s,e,!0)},children:(e,t)=>{var r=Z2(),i=I(r),a=F(i,!0);D(i);var o=L(i,2),s=F(o);bL(s,{flex:!0,get invalid(){return z(_)},get"aria-errormessage"(){return`${n}-error`},get value(){return z(l)},set value(e){P(l,e,!0)}});var c=L(s,2),u=e=>{var t=X2(),n=F(t);D(t),R(()=>W(n,`.${z(h)??``}`)),U(e,t)};G(c,e=>{z(h)&&e(u)}),D(o);var f=L(o,2),p=F(f),m=e=>{var t=wa();R(e=>W(t,e),[()=>X(`enter_new_name_for_asset_error.${z(g)}`)]),U(e,t)};G(p,e=>{z(_)&&e(m)}),D(f),R(e=>{W(a,e),q(f,`id`,`${n}-error`)},[()=>X(`enter_new_name_for_asset`,{values:{count:z(d).length}})]),U(e,r)},$$slots:{default:!0}})}k(),o()}var X2,Z2,Q2,Lle=o((()=>{Q(),Y(),Z(),VQ(),kp(),C$(),pF(),Fle(),D1(),u$(),X2=V(`<span role="none"> </span>`),Z2=V(`<p class="svelte-22gadf"> </p> <div role="none" class="svelte-22gadf"><!> <!></div> <div role="none" class="error svelte-22gadf"><!></div>`,1),Q2={hash:`svelte-22gadf`,code:`p.svelte-22gadf {margin:0 0 8px;}div.svelte-22gadf {display:flex;align-items:center;gap:4px;}.error.svelte-22gadf {margin:0;color:var(--sui-error-foreground-color);font-size:var(--sui-font-size-small);}`}}));function Rle(e,t){O(t,!0),K(e,t4);let n=()=>j(c$,`$listedAssets`,s),r=()=>j(rF,`$focusedAsset`,s),i=()=>j(xA,`$isSmallScreen`,s),a=()=>j(SA,`$isMediumScreen`,s),o=()=>j(Xie,`$selectedAssetPathSet`,s),[s,c]=ln(),l=M(()=>t.asset.name),u=M(()=>t.asset.kind),d=e=>{nF.update(n=>{let r=n.indexOf(t.asset);return e&&r===-1&&n.push(t.asset),!e&&r>-1&&n.splice(r,1),n})};{let s=M(()=>n().indexOf(t.asset));LL(e,{get"aria-rowindex"(){return z(s)},onChange:e=>{d(e.detail.selected)},onfocus:()=>{cn(rF,t.asset)},onclick:()=>{(i()||a())&&r()&&MS(r())&&b$(`/assets/${r().path}`,{transitionType:`forwards`})},ondblclick:()=>{r()&&MS(r())&&b$(`/assets/${r().path}`,{transitionType:`forwards`})},children:(e,n)=>{var r=e4(),s=I(r),c=e=>{PL(e,{class:`checkbox`,children:(e,n)=>{{let n=M(()=>o().has(t.asset.path));oL(e,{role:`none`,tabindex:`-1`,get checked(){return z(n)},onChange:({detail:{checked:e}})=>{d(e)}})}},$$slots:{default:!0}})};G(s,e=>{i()||a()||e(c)});var f=L(s,2);PL(f,{class:`image`,children:(e,n)=>{{let n=M(()=>t.viewType===`list`?`icon`:`tile`),r=M(()=>z(u)===`image`);r0(e,{get kind(){return z(u)},get asset(){return t.asset},get variant(){return z(n)},get cover(){return i()},get checkerboard(){return z(r)}})}},$$slots:{default:!0}});var p=L(f,2),m=e=>{PL(e,{class:`title`,children:(e,t)=>{var n=$2();YF(F(n),{lines:2,children:(e,t)=>{dt();var n=wa();R(()=>W(n,z(l))),U(e,n)},$$slots:{default:!0}}),D(n),U(e,n)},$$slots:{default:!0}})};G(p,e=>{(!i()||t.viewType===`list`)&&e(m)}),U(e,r)},$$slots:{default:!0}})}k(),c()}var $2,e4,t4,zle=o((()=>{Q(),Y(),VQ(),u0(),C$(),pF(),IS(),u$(),EA(),$2=V(`<div role="none" class="label svelte-17zk54k"><!></div>`),e4=V(`<!> <!> <!>`,1),t4={hash:`svelte-17zk54k`,code:`.label.svelte-17zk54k {word-break:break-all;}`}}));function n4(e,t){let n=J(t,`loading`,3,`lazy`),r=J(t,`asset`,3,void 0),i=J(t,`src`,3,void 0),a=J(t,`variant`,3,void 0),o=J(t,`blurBackground`,3,!1),s=J(t,`cover`,3,!1),c=J(t,`checkerboard`,3,!1),l=J(t,`alt`,3,``),u=zs(t,[`$$slots`,`$$events`,`$$legacy`,`loading`,`asset`,`src`,`variant`,`blurBackground`,`cover`,`checkerboard`,`alt`]);r0(e,Bs({kind:`image`,get loading(){return n()},get asset(){return r()},get src(){return i()},get variant(){return a()},get blurBackground(){return o()},get cover(){return s()},get checkerboard(){return c()},get alt(){return l()}},()=>u))}var r4=o((()=>{Q(),Y(),u0()}));function i4(e,t){O(t,!0),K(e,c4);let n=J(t,`files`,27,()=>gr([])),r=J(t,`transformedFileMap`,3,void 0),i=J(t,`removable`,3,!0);var a=s4();ro(a,23,n,(e,t)=>`${e.name}-${t}`,(e,t,a)=>{var o=H();Ua(I(o),eS,null,e=>{let o=M(()=>{let{name:e,type:n,size:r}=z(t);return{name:e,type:n,size:r}}),s=M(()=>r()?.get(z(t)));var c=o4(),l=F(c),u=e=>{{let n=M(()=>URL.createObjectURL(z(t)));n4(e,{get src(){return z(n)},variant:`icon`,checkerboard:!0})}},d=M(()=>Hw.includes(z(o).type)),f=e=>{var t=a4();NF(F(t),{name:`draft`}),D(t),U(e,t)};G(l,e=>{z(d)?e(u):e(f,-1)});var p=L(l,2),m=F(p);YF(F(m),{children:(e,t)=>{dt();var n=wa();R(e=>W(n,e),[()=>z(o).name.normalize()]),U(e,n)},$$slots:{default:!0}}),D(m);var h=L(m,2),g=F(h);Ya(g,()=>Lh.current,e=>{var n=wa();R(e=>W(n,e),[()=>X(`file_meta`,{values:{type:X(`file_type_labels.${z(t).type.split(`/`)[1]}`,{default:xp(z(o).name).extension?.toUpperCase()}),size:GC(z(o).size)}})]),U(e,n)});var _=L(g,2),v=e=>{var t=wa();R(e=>W(t,e),[()=>X(`file_meta_converted_from_x`,{values:{type:X(`file_type_labels.${z(s).type.split(`/`)[1]}`,{default:xp(z(s).name).extension?.toUpperCase()})}})]),U(e,t)};G(_,e=>{z(s)&&z(s).type!==z(t).type&&e(v)}),D(h),D(p);var y=L(p,2);{let e=M(()=>X(`remove`)),t=M(()=>!i()||n().length===1);fI(y,{variant:`ghost`,iconic:!0,get"aria-label"(){return z(e)},get hidden(){return z(t)},onclick:e=>{e.stopPropagation(),n().splice(z(a),1)},children:(e,t)=>{NF(e,{name:`close`})},$$slots:{default:!0}})}D(c),U(e,c)}),U(e,o)}),D(a),U(e,a),k()}var a4,o4,s4,c4,l4=o((()=>{Q(),Y(),Z(),VQ(),kp(),tS(),r4(),QC(),Ww(),a4=V(`<span role="none" class="image svelte-lbhi1w"><!></span>`),o4=V(`<div role="listitem" class="file svelte-lbhi1w"><!> <div role="none" class="info svelte-lbhi1w"><div role="none" class="name"><!></div> <div role="none" class="meta svelte-lbhi1w"><!> <!></div></div> <!></div>`),s4=V(`<div role="list" class="files svelte-lbhi1w"></div>`),c4={hash:`svelte-lbhi1w`,code:`.files.svelte-lbhi1w {display:flex;flex-direction:column;gap:16px;margin:0 8px;}.file.svelte-lbhi1w {display:flex;align-items:center;gap:16px;overflow:hidden;}.file.svelte-lbhi1w .preview {flex:none;}.file.svelte-lbhi1w .image:where(.svelte-lbhi1w) {flex:none;display:flex;justify-content:center;align-items:center;width:40px;height:40px;aspect-ratio:1/1;object-fit:cover;border-radius:var(--sui-control-medium-border-radius);background-color:var(--sui-tertiary-background-color);}.file.svelte-lbhi1w .info:where(.svelte-lbhi1w) {flex:auto;display:flex;flex-direction:column;gap:4px;overflow:hidden;text-align:start;}.file.svelte-lbhi1w .info:where(.svelte-lbhi1w) .meta:where(.svelte-lbhi1w) {font-size:var(--sui-font-size-small);color:var(--sui-secondary-foreground-color);}`}}));function u4(e,t){O(t,!0),K(e,g4);let n=()=>j(wA,`$hasMouse`,r),[r,i]=ln(),a=e=>{var t=H(),n=I(t),r=e=>{var t=wa();R(e=>W(t,e),[()=>X(`dropped_image_type_mismatch`)]),U(e,t)},i=M(()=>o()===Hw.join(`,`)),a=e=>{var t=wa();R(e=>W(t,e),[()=>X(`dropped_file_type_mismatch`,{values:{type:hb(Lh.current,{type:`disjunction`}).format(o().split(/,\s*/))}})]),U(e,t)};G(n,e=>{z(i)?e(r):e(a,-1)}),U(e,t)},o=J(t,`accept`,3,void 0),s=J(t,`disabled`,3,!1),c=J(t,`multiple`,3,!1),l=J(t,`showUploadButton`,3,!1),u=J(t,`showFilePreview`,3,!1),d=J(t,`onDrop`,3,void 0),f=J(t,`children`,3,void 0),p=N(void 0),m=N(!1),h=N(!1),g=N(!1),_=N(void 0),v=N(gr([])),y=M(()=>l()||u()&&z(v).length),b=()=>{z(_)?.open()},x=()=>{z(v).length&&(P(v,[],!0),d()?.({files:z(v)}))},S=e=>{P(v,c()?e:e.slice(0,1),!0),d()?.({files:z(v)})},C=e=>{d()?.({files:e.detail.files})};Ys(()=>(z(p)?.addEventListener(`Select`,C),()=>{z(p)?.removeEventListener(`Select`,C)})),Kr(()=>{!z(y)&&z(h)&&P(g,!0)});var w={openFilePicker:b,reset:x},T=h4(),ee=I(T),te=F(ee),ne=e=>{var t=p4(),r=F(t),i=e=>{var t=f4(),r=I(t),i=F(r),o=e=>{var t=wa();R(e=>W(t,e),[()=>X(`drop_files_or_click_to_browse`,{values:{count:c()?2:1}})]),U(e,t)},l=e=>{var t=wa();R(e=>W(t,e),[()=>X(`tap_to_browse`)]),U(e,t)};G(i,e=>{n()?e(o):e(l,-1)}),D(r);var u=L(r,2),d=F(u);{let e=e=>{NF(e,{name:`cloud_upload`})},t=M(()=>X(`choose_files`,{values:{count:c()?2:1}}));fI(d,{variant:`primary`,get label(){return z(t)},get disabled(){return s()},onclick:()=>{b()},startIcon:e,$$slots:{startIcon:!0}})}D(u);var f=L(u,2),p=e=>{var t=d4();a(F(t)),D(t),U(e,t)};G(f,e=>{z(h)&&e(p)}),U(e,t)};G(r,e=>{l()&&e(i)});var o=L(r,2),d=e=>{i4(e,{get files(){return z(v)},set files(e){P(v,e,!0)}})};G(o,e=>{u()&&z(v).length&&e(d)}),D(t),U(e,t)},re=e=>{var t=H();go(I(t),()=>f()??E),U(e,t)};G(te,e=>{z(y)?e(ne):e(re,-1)});var ie=L(te,2),ae=e=>{var t=m4(),n=F(t),r=F(n);NF(r,{name:`download`});var i=L(r,2),a=F(i,!0);D(i),D(n),D(t),R(e=>W(a,e),[()=>X(`drop_files_here`,{values:{count:c()?2:1}})]),U(e,t)};G(ie,e=>{z(m)&&e(ae)}),D(ee),Ps(ee,e=>P(p,e),()=>z(p));var oe=L(ee,2);Ps(OL(oe,{get accept(){return o()},get multiple(){return c()},onSelect:({files:e})=>{S(e)}}),e=>P(_,e,!0),()=>z(_));var se=L(oe,2),ce=e=>{{let t=M(()=>X(`unsupported_file_type`));vL(e,{get title(){return z(t)},get open(){return z(g)},set open(e){P(g,e,!0)},children:(e,t)=>{a(e)},$$slots:{default:!0}})}};G(se,e=>{z(y)||e(ce)}),ua(`dragover`,ee,e=>{e.preventDefault(),!(s()||!e.dataTransfer)&&(e.dataTransfer.dropEffect=`copy`,P(m,!0),P(h,!1))}),ua(`dragleave`,ee,e=>{e.preventDefault(),!s()&&P(m,!1)}),ua(`dragend`,ee,e=>{e.preventDefault(),!s()&&P(m,!1)}),ua(`drop`,ee,async e=>{if(e.preventDefault(),s()||!e.dataTransfer)return;P(m,!1);let t=await Cp(e.dataTransfer,{accept:o()});t.length?S(t):P(h,!0)}),U(e,T);var le=k(w);return i(),le}var d4,f4,p4,m4,h4,g4,_4=o((()=>{Q(),Y(),Z(),VQ(),kp(),Zs(),l4(),_b(),EA(),Ww(),d4=V(`<div role="alert"><!></div>`),f4=V(`<div role="none"><!></div> <div role="none"><!></div> <!>`,1),p4=V(`<div role="none" class="content svelte-1hhq62q"><!> <!></div>`),m4=V(`<div role="none" class="drop-indicator svelte-1hhq62q"><div role="none" class="svelte-1hhq62q"><!> <span role="none"> </span></div></div>`),h4=V(`<div role="none" class="drop-target svelte-1hhq62q"><!> <!></div> <!> <!>`,1),g4={hash:`svelte-1hhq62q`,code:`.drop-target.svelte-1hhq62q {display:flex;flex-direction:column;position:relative;overflow:hidden;height:100%;pointer-events:auto;}.drop-target.svelte-1hhq62q > .group {overflow-y:auto;padding:16px;width:100%;height:100%;}.drop-target.svelte-1hhq62q button:not(:disabled) {pointer-events:auto;}.drop-indicator.svelte-1hhq62q {position:absolute;inset:0;z-index:10;border-radius:var(--sui-control-large-border-radius);background-color:hsl(var(--sui-background-color-4-hsl)/80%);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);text-align:center;pointer-events:none;}.drop-indicator.svelte-1hhq62q div:where(.svelte-1hhq62q) {position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4px;border:4px dashed var(--sui-primary-accent-color);border-radius:var(--sui-control-large-border-radius);font-size:var(--sui-font-size-x-large);}.drop-indicator.svelte-1hhq62q div:where(.svelte-1hhq62q) .icon {color:var(--sui-secondary-foreground-color);font-size:48px;}.content.svelte-1hhq62q {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;overflow:auto;height:100%;min-height:320px;text-align:center;}`}}));function v4(e,t){O(t,!0);let n=()=>j(Np,`$targetAssetFolder`,r),[r,i]=ln(),a=J(t,`label`,3,void 0),o=M(()=>!Lp(n()));{let t=e=>{NF(e,{name:`cloud_upload`})},n=M(()=>!a()),r=M(()=>X(`upload_assets`));fI(e,{variant:`primary`,get iconic(){return z(n)},get disabled(){return z(o)},get label(){return a()},get"aria-label"(){return z(r)},onclick:()=>{cn(r$,!0)},startIcon:t,$$slots:{startIcon:!0}})}k(),i()}var y4=o((()=>{Q(),Y(),Z(),VQ(),Rp(),u$()}));function b4(e,t){K(e,S4);let n=J(t,`children`,3,void 0),r=zs(t,[`$$slots`,`$$events`,`$$legacy`,`children`]);var i=x4();us(i,()=>({role:`group`,class:`list-container`,...r}),void 0,void 0,void 0,`svelte-1sdsl2g`),go(F(i),()=>n()??E),D(i),U(e,i)}var x4,S4,C4=o((()=>{Q(),Y(),x4=V(`<div><!></div>`),S4={hash:`svelte-1sdsl2g`,code:`.list-container.svelte-1sdsl2g {--icon-size: 36px;flex:auto;position:relative;height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;}`}}));function w4(e,t){O(t,!0),K(e,E4);let n=J(t,`children`,3,void 0),r=zs(t,[`$$slots`,`$$events`,`$$legacy`,`viewType`,`children`]);var i=T4();Ua(F(i),eS,null,e=>{kae(e,Bs({multiple:!0,clickToSelect:!1},()=>r,{children:(e,t)=>{var r=H();go(I(r),()=>n()??E),U(e,r)},$$slots:{default:!0}}))}),D(i),R(()=>Qo(i,1,`${t.viewType??``}-view`,`svelte-1sfbolp`)),U(e,i),k()}var T4,E4,D4=o((()=>{Q(),Y(),VQ(),tS(),T4=V(`<div role="none"><!></div>`),E4={hash:`svelte-1sfbolp`,code:`:is(.grid-view.svelte-1sfbolp, .list-view.svelte-1sfbolp) {display:block;padding:0 16px 16px;height:100%;overflow-y:auto;}
571
571
 
572
572
  @media (width < 768px) {.grid-view.svelte-1sfbolp {padding:4px;}
573
573
  }.grid-view.svelte-1sfbolp .row-group-caption {display:block;grid-column:1/-1;}.grid-view.svelte-1sfbolp .row-group-caption th {display:block;}.grid-view.svelte-1sfbolp .row-group:not(:first-child) .row-group-caption {margin-top:16px;}.grid-view.svelte-1sfbolp .grid-body {display:grid;grid-template-columns:repeat(auto-fill, minmax(var(--grid-size, 200px), 1fr));gap:16px;border-width:0;}