@sveltia/cms 0.62.2 → 0.62.3
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.
package/dist/sveltia-cms.js
CHANGED
|
@@ -422,7 +422,7 @@ ${s}`,n),this.line=r,this.column=i,this.codeblock=s}}function Xp(t,e=0,n=t.lengt
|
|
|
422
422
|
`}else r+=u,r+=" = ",r+=sy(t[a],c,n),r+=`
|
|
423
423
|
`}}return`${r}
|
|
424
424
|
${i}`.trim()}function Rq(t,e){if(Pd(t)!=="object")throw new TypeError("stringify can only be called with an object");let n=e?.maxDepth??1e3;return oy(t,"",n)}const MC=t=>JSON.parse(t),FC=t=>Ql(Oq(t)),zC=t=>pd.parse(t),Dq=t=>t.startsWith("+++")?"toml-frontmatter":t.startsWith("{")?"json-frontmatter":"yaml-frontmatter",Mq=async({text:t="",path:e,folder:{collectionName:n,fileName:r}})=>{const i=$i(n),s=r?i?._fileMap[r]:void 0;if(!i)throw new Error("Collection not found");if(r&&!s)throw new Error("Collection file not found");t=t.trim().replace(/\r\n?/g,`
|
|
425
|
-
`);const{_file:{format:o,fmDelimiters:a}}=s??i,c=o==="frontmatter"?Dq(t):o,u=bf[c]?.parser;if(u)return u(t);try{if(/^ya?ml$/.test(c))return zC(t);if(c==="toml")return FC(t);if(c==="json")return MC(t);if(/^(?:yaml|toml|json)-frontmatter$/.test(c)){const[d,f]=(o==="frontmatter"?Bw({format:c,delimiter:a}):a)??["---","---"],h=on(d),p=on(f),g=new RegExp(`^${h}\\n(?:(?<head>.*?)\\n)?${p}$(?:\\n(?<body>.+))?`,"ms"),{head:m,body:v}=t.match(g)?.groups??{};if(!m&&!v){if(t)return{body:t};throw new Error("No front matter block found")}if(c==="yaml-frontmatter")return{...zC(m),body:v};if(c==="toml-frontmatter")return{...FC(m),body:v};if(c==="json-frontmatter")return{...MC(m),body:v}}}catch(d){throw new Error(`${e} could not be parsed due to ${d.name}: ${d.message}`)}throw new Error(`${e} could not be parsed due to an unknown format: ${c}`)},ay=({subPath:t,subPathTemplate:e})=>{if(e?.includes("{{slug}}")){const[,n]=t.match(new RegExp(`^${on(e).replace("\\{\\{slug\\}\\}","(.+)")}$`))??[];if(n)return n}return t},Fq=async({file:t,entries:e,errors:n})=>{let r;try{r=await Mq(t)}catch(L){console.error(L),n.push(L)}if(!r)return;const{path:i,sha:s,meta:o={},folder:{collectionName:a,fileName:c,filePathMap:u}}=t,d=$i(a),f=c?d?._fileMap[c]:void 0;if(!d||c&&!f)return;const{fields:h=[],_file:{fullPathRegEx:p,subPath:g,extension:m},_i18n:{i18nEnabled:v,allLocales:y,defaultLocale:b,structure:w,canonicalSlug:{key:x}}}=f??d,k=v&&w==="single_file",S=v&&w==="multiple_files",C=v&&w==="multiple_folders",E=v&&w==="multiple_folders_i18n_root";if(OC(h)){const L=h[0].name;if(k){if(!Zn(r)||!Object.values(r).every(Array.isArray))return;r=Object.fromEntries(Object.entries(r).map(([N,M])=>[N,{[L]:M}]))}else{if(!Array.isArray(r))return;r={[L]:r}}}if(!Zn(r)||/^_index(?:\..+)?\.md$/.test(An(i).basename)&&!(g?.split("/").pop()==="_index"&&m==="md")&&!c)return;let A,P;if(c?S||C||E?[P,A]=Object.entries(u??{}).find(([,L])=>L===i)??[]:A=i:{subPath:A,locale:P}=i.match(p)?.groups??{},!A)return;const I={id:"",sha:s,slug:"",subPath:A,locales:{},...o};if(!v){const L=c||ay({subPath:A,subPathTemplate:g});I.slug=L,I.locales._default={slug:L,path:i,sha:s,content:za(r)}}if(k){const L=c||ay({subPath:A,subPathTemplate:g});I.slug=L,I.locales=Object.fromEntries(y.filter(N=>N in r).map(N=>[N,{slug:L,path:i,sha:s,content:za(r[N])}]))}if(S||C||E){if(!P)return;const L=x&&typeof r[x]=="string"?r[x]:void 0,N=c||ay({subPath:A,subPathTemplate:g}),M={slug:N,path:i,sha:s,content:za(r)},H=`${a}/${L??N}`,q=e.find(G=>G.id===H);if(q){q.locales[P]=M,P===b&&(q.sha=s,q.slug=N,q.subPath=A);return}I.id=H,I.locales[P]=M,P===b&&(I.slug=N,I.sha=s)}e.push(I)},jC=async t=>{const e=[],n=[];return await Promise.all(t.map(r=>Fq({file:r,entries:e,errors:n}))),{entries:e.filter(r=>(r.id=Kr(),!!r.slug&&!!Object.keys(r.locales).length)),errors:n}},zq={service:"",label:"",owner:"",repo:"",branch:""},ly=t=>{const e=[],n=[];t.forEach(i=>{const{path:s}=i,[o]=TC(s),[a]=EC(s,{matchSubFolders:!0});o&&e.push({...i,type:"entry",folder:o}),a&&!e.find(c=>c.path===s)&&n.push({...i,type:"asset",folder:a})});const r=[...e,...n];return{entryFiles:e,assetFiles:n,allFiles:r,count:r.length}},UC=async({repository:t,fetchDefaultBranchName:e,fetchLastCommit:n,fetchFileList:r,fetchFileContents:i})=>{const{databaseName:s,branch:o}=t,a=new Mo(s,"meta"),c=new Mo(s,"file-cache"),u=await a.get("last_commit_hash"),d=await c.entries();let f=o,h;f||(f=await e(),t.branch=f);const{hash:p,message:g}=await n();if(u&&u===p&&d.length?h=ly(d.map(([A,P])=>({path:A,...P}))):(h=ly(await r(p)),a.set("last_commit_hash",p)),rg.set(!g.startsWith("[skip ci]")),!h.count){ni.set([]),Kt.set([]),Ic.set(!0);return}const{entryFiles:m,assetFiles:v,allFiles:y}=h,b=Object.fromEntries(d);y.forEach(({sha:A,path:P},I)=>{b[P]?.sha===A&&Object.assign(y[I],b[P])});const w=y.filter(({meta:A})=>!A),x=w.length?await i(w):{},{entries:k,errors:S}=await jC(m.map(A=>{const{text:P,meta:I}=x[A.path]??{};return{...A,text:A.text??P,meta:A.meta??I}}));ni.set(k),X_.set(S),Kt.set(PC(v.map(A=>{const{meta:P,text:I,size:L}=x[A.path]??{};return{...A,name:A.path.split("/").pop(),meta:A.meta??P,size:A.size??L,text:A.text??I}}))),Ic.set(!0);const C=y.map(({path:A})=>A),E=Object.keys(b).filter(A=>!C.includes(A));w.length&&await c.saveEntries(Object.entries(x)),E.length&&c.deleteEntries(E)},Qp=async(t,e={},{responseType:n="json"}={})=>{let r;e.cache="no-cache",e.headers=new Headers(e.headers),n==="json"&&e.headers.set("Accept","application/json"),e.method==="POST"&&Zn(e.body)&&(e.headers.set("Content-Type","application/json"),e.body=JSON.stringify(e.body));try{r=await fetch(t,e)}catch(c){throw new Error("Failed to send the request",{cause:c})}if(n==="raw")return r;let i;try{if(n==="blob")return r.blob();if(n==="text")return r.text();i=await r.json()}catch(c){throw new Error("Failed to parse the response",{cause:c})}const{ok:s,status:o}=r;if(s&&!(t.endsWith("/graphql")&&Zn(i)&&i.errors))return i;if(!Zn(i))throw new Error("Server responded with an error",{cause:{status:o}});let a="";throw typeof i.error=="string"&&(a=i.error),typeof i.message=="string"&&(a=i.message),Array.isArray(i.errors)&&(typeof i.errors[0]=="string"&&(a=i.errors.join(", ")),Zn(i.errors[0])&&typeof i.errors[0].message=="string"&&(a=i.errors.map(c=>c.message).join(", "))),new Error("Server responded with an error",{cause:{status:o,message:a}})},Od="github",BC="GitHub",jq="https://www.githubstatus.com/",Uq="https://www.githubstatus.com/api/v2/status.json",qC="https://api.github.com",cy={
|
|
425
|
+
`);const{_file:{format:o,fmDelimiters:a}}=s??i,c=o==="frontmatter"?Dq(t):o,u=bf[c]?.parser;if(u)return u(t);try{if(/^ya?ml$/.test(c))return zC(t);if(c==="toml")return FC(t);if(c==="json")return MC(t);if(/^(?:yaml|toml|json)-frontmatter$/.test(c)){const[d,f]=(o==="frontmatter"?Bw({format:c,delimiter:a}):a)??["---","---"],h=on(d),p=on(f),g=new RegExp(`^${h}\\n(?:(?<head>.*?)\\n)?${p}$(?:\\n(?<body>.+))?`,"ms"),{head:m,body:v}=t.match(g)?.groups??{};if(!m&&!v){if(t)return{body:t};throw new Error("No front matter block found")}if(c==="yaml-frontmatter")return{...zC(m),body:v};if(c==="toml-frontmatter")return{...FC(m),body:v};if(c==="json-frontmatter")return{...MC(m),body:v}}}catch(d){throw new Error(`${e} could not be parsed due to ${d.name}: ${d.message}`)}throw new Error(`${e} could not be parsed due to an unknown format: ${c}`)},ay=({subPath:t,subPathTemplate:e})=>{if(e?.includes("{{slug}}")){const[,n]=t.match(new RegExp(`^${on(e).replace("\\{\\{slug\\}\\}","(.+)")}$`))??[];if(n)return n}return t},Fq=async({file:t,entries:e,errors:n})=>{let r;try{r=await Mq(t)}catch(L){console.error(L),n.push(L)}if(!r)return;const{path:i,sha:s,meta:o={},folder:{collectionName:a,fileName:c,filePathMap:u}}=t,d=$i(a),f=c?d?._fileMap[c]:void 0;if(!d||c&&!f)return;const{fields:h=[],_file:{fullPathRegEx:p,subPath:g,extension:m},_i18n:{i18nEnabled:v,allLocales:y,defaultLocale:b,structure:w,canonicalSlug:{key:x}}}=f??d,k=v&&w==="single_file",S=v&&w==="multiple_files",C=v&&w==="multiple_folders",E=v&&w==="multiple_folders_i18n_root";if(OC(h)){const L=h[0].name;if(k){if(!Zn(r)||!Object.values(r).every(Array.isArray))return;r=Object.fromEntries(Object.entries(r).map(([N,M])=>[N,{[L]:M}]))}else{if(!Array.isArray(r))return;r={[L]:r}}}if(!Zn(r)||/^_index(?:\..+)?\.md$/.test(An(i).basename)&&!(g?.split("/").pop()==="_index"&&m==="md")&&!c)return;let A,P;if(c?S||C||E?[P,A]=Object.entries(u??{}).find(([,L])=>L===i)??[]:A=i:{subPath:A,locale:P}=i.match(p)?.groups??{},!A)return;const I={id:"",sha:s,slug:"",subPath:A,locales:{},...o};if(!v){const L=c||ay({subPath:A,subPathTemplate:g});I.slug=L,I.locales._default={slug:L,path:i,sha:s,content:za(r)}}if(k){const L=c||ay({subPath:A,subPathTemplate:g});I.slug=L,I.locales=Object.fromEntries(y.filter(N=>N in r).map(N=>[N,{slug:L,path:i,sha:s,content:za(r[N])}]))}if(S||C||E){if(!P)return;const L=x&&typeof r[x]=="string"?r[x]:void 0,N=c||ay({subPath:A,subPathTemplate:g}),M={slug:N,path:i,sha:s,content:za(r)},H=`${a}/${L??N}`,q=e.find(G=>G.id===H);if(q){q.locales[P]=M,P===b&&(q.sha=s,q.slug=N,q.subPath=A);return}I.id=H,I.locales[P]=M,P===b&&(I.slug=N,I.sha=s)}e.push(I)},jC=async t=>{const e=[],n=[];return await Promise.all(t.map(r=>Fq({file:r,entries:e,errors:n}))),{entries:e.filter(r=>(r.id=Kr(),!!r.slug&&!!Object.keys(r.locales).length)),errors:n}},zq={service:"",label:"",owner:"",repo:"",branch:""},ly=t=>{const e=[],n=[];t.forEach(i=>{const{path:s}=i,[o]=TC(s),[a]=EC(s,{matchSubFolders:!0});o&&e.push({...i,type:"entry",folder:o}),a&&!e.find(c=>c.path===s)&&n.push({...i,type:"asset",folder:a})});const r=[...e,...n];return{entryFiles:e,assetFiles:n,allFiles:r,count:r.length}},UC=async({repository:t,fetchDefaultBranchName:e,fetchLastCommit:n,fetchFileList:r,fetchFileContents:i})=>{const{databaseName:s,branch:o}=t,a=new Mo(s,"meta"),c=new Mo(s,"file-cache"),u=await a.get("last_commit_hash"),d=await c.entries();let f=o,h;f||(f=await e(),t.branch=f);const{hash:p,message:g}=await n();if(u&&u===p&&d.length?h=ly(d.map(([A,P])=>({path:A,...P}))):(h=ly(await r(p)),a.set("last_commit_hash",p)),rg.set(!g.startsWith("[skip ci]")),!h.count){ni.set([]),Kt.set([]),Ic.set(!0);return}const{entryFiles:m,assetFiles:v,allFiles:y}=h,b=Object.fromEntries(d);y.forEach(({sha:A,path:P},I)=>{b[P]?.sha===A&&Object.assign(y[I],b[P])});const w=y.filter(({meta:A})=>!A),x=w.length?await i(w):{},{entries:k,errors:S}=await jC(m.map(A=>{const{text:P,meta:I}=x[A.path]??{};return{...A,text:A.text??P,meta:A.meta??I}}));ni.set(k),X_.set(S),Kt.set(PC(v.map(A=>{const{meta:P,text:I,size:L}=x[A.path]??{};return{...A,name:A.path.split("/").pop(),meta:A.meta??P,size:A.size??L,text:A.text??I}}))),Ic.set(!0);const C=y.map(({path:A})=>A),E=Object.keys(b).filter(A=>!C.includes(A));w.length&&await c.saveEntries(Object.entries(x)),E.length&&c.deleteEntries(E)},Qp=async(t,e={},{responseType:n="json"}={})=>{let r;e.cache="no-cache",e.headers=new Headers(e.headers),n==="json"&&e.headers.set("Accept","application/json"),e.method==="POST"&&Zn(e.body)&&(e.headers.set("Content-Type","application/json"),e.body=JSON.stringify(e.body));try{r=await fetch(t,e)}catch(c){throw new Error("Failed to send the request",{cause:c})}if(n==="raw")return r;let i;try{if(n==="blob")return r.blob();if(n==="text")return r.text();i=await r.json()}catch(c){throw new Error("Failed to parse the response",{cause:c})}const{ok:s,status:o}=r;if(s&&!(t.endsWith("/graphql")&&Zn(i)&&i.errors))return i;if(!Zn(i))throw new Error("Server responded with an error",{cause:{status:o}});let a="";throw typeof i.error=="string"&&(a=i.error),typeof i.message=="string"&&(a=i.message),Array.isArray(i.errors)&&(typeof i.errors[0]=="string"&&(a=i.errors.join(", ")),Zn(i.errors[0])&&typeof i.errors[0].message=="string"&&(a=i.errors.map(c=>c.message).join(", "))),new Error("Server responded with an error",{cause:{status:o,message:a}})},Od="github",BC="GitHub",jq="https://www.githubstatus.com/",Uq="https://www.githubstatus.com/api/v2/status.json",qC="https://api.github.com",cy={origin:"",rest:"",graphql:"",isSelfHosted:!1};mt?.subscribe(t=>{const e=t?.backend.api_root??qC,n=e!==qC,{origin:r}=new URL(e);Object.assign(cy,{origin:r,rest:n?`${r}/api/v3`:r,graphql:n?`${r}/api`:r,isSelfHosted:n})});const es=new Proxy({},{get:(t,e)=>{if(e in t)return t[e];const{baseURL:n,branch:r}=t;if(e==="treeBaseURL")return r?`${n}/tree/${r}`:n;if(e==="blobBaseURL")return r?`${n}/blob/${r}`:""}}),Bq=async()=>{try{const{status:{indicator:t}}=await Qp(Uq);if(t==="none")return"none";if(t==="minor")return"minor";if(t==="major"||t==="critical")return"major"}catch{}return"unknown"},$c=async(t,e={},{token:n=te(mi).token,responseType:r="json"}={})=>{const i=cy[t==="/graphql"?"graphql":"rest"];return e.headers=new Headers(e.headers),e.headers.set("Authorization",`token ${n}`),Qp(`${i}${t}`,e,{responseType:r})},eg=async(t,e={})=>{const{data:n}=await $c("/graphql",{method:"POST",body:{query:t.replace(/\n\s*/g," "),variables:e}});return n},HC=()=>{const{repo:t,branch:e}=te(mt).backend,{origin:n,isSelfHosted:r}=cy,i=r?n:"https://github.com",[s,o]=t.split("/");return Object.assign(es,{service:Od,label:BC,owner:s,repo:o,branch:e,baseURL:`${i}/${s}/${o}`,databaseName:`${Od}:${s}/${o}`,isSelfHosted:r})},qq=()=>{const t=HC();te(_t).devModeEnabled&&console.info("repositoryInfo",t)},Hq=async({token:t,auto:e=!1})=>{if(e&&!t)return;const{hostname:n}=window.location,{site_domain:r=n,base_url:i="https://api.netlify.com",auth_endpoint:s="auth"}=te(mt).backend,o=t||await ZS({backendName:Od,siteDomain:r,authURL:`${$n(i)}/${$n(s)}`,scope:"repo,user"}),{id:a,name:c,login:u,email:d,avatar_url:f,html_url:h}=await $c("/user",{},{token:o});return{backendName:Od,token:o,id:a,name:c,login:u,email:d,avatarURL:f,profileURL:h}},Vq=async()=>{},Wq=async()=>{const{owner:t,repo:e}=es,n=te(mi)?.login,{ok:r}=await $c(`/repos/${t}/${e}/collaborators/${encodeURIComponent(n)}`,{headers:{Accept:"application/json"}},{responseType:"raw"});if(!r)throw new Error("Not a collaborator of the repository",{cause:new Error(te(ce)("repository_no_access",{values:{repo:e}}))})},Gq=async()=>{const{owner:t,repo:e}=es,n=await eg(`
|
|
426
426
|
query {
|
|
427
427
|
repository(owner: "${t}", name: "${e}") {
|
|
428
428
|
defaultBranchRef {
|
|
@@ -485,7 +485,7 @@ ${i}`.trim()}function Rq(t,e){if(Pd(t)!=="object")throw new TypeError("stringify
|
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
`,{input:{branch:{repositoryNameWithOwner:`${n}/${r}`,branchName:i},expectedHeadOid:(await VC()).hash,fileChanges:{additions:s,deletions:o},message:{headline:AC(t,e)}}})).createCommitOnBranch.commit.url},triggerDeployment:async()=>{const{owner:t,repo:e}=es;return $c(`/repos/${t}/${e}/dispatches`,{method:"POST",body:{event_type:"sveltia-cms-publish"}},{responseType:"raw"})}},Ya="gitlab",WC="GitLab",Zq="https://status.gitlab.com/",Xq="https://status-api.hostedstatus.com/1.0/status/5b36dc6502d06804c08349f7",GC="https://gitlab.com/api/v4",uy={
|
|
488
|
+
`,{input:{branch:{repositoryNameWithOwner:`${n}/${r}`,branchName:i},expectedHeadOid:(await VC()).hash,fileChanges:{additions:s,deletions:o},message:{headline:AC(t,e)}}})).createCommitOnBranch.commit.url},triggerDeployment:async()=>{const{owner:t,repo:e}=es;return $c(`/repos/${t}/${e}/dispatches`,{method:"POST",body:{event_type:"sveltia-cms-publish"}},{responseType:"raw"})}},Ya="gitlab",WC="GitLab",Zq="https://status.gitlab.com/",Xq="https://status-api.hostedstatus.com/1.0/status/5b36dc6502d06804c08349f7",GC="https://gitlab.com/api/v4",uy={origin:"",rest:"",graphql:"",isSelfHosted:!1};mt?.subscribe(t=>{const e=t?.backend.api_root??GC,n=e!==GC,{origin:r}=new URL(e);Object.assign(uy,{origin:r,rest:`${r}/api/v4`,graphql:`${r}/api`,isSelfHosted:n})});const Ns=new Proxy({},{get:(t,e)=>{if(e in t)return t[e];const{baseURL:n,branch:r}=t;if(e==="treeBaseURL")return r?`${n}/-/tree/${r}`:n;if(e==="blobBaseURL")return r?`${n}/-/blob/${r}`:""}}),Qq=async()=>{try{const{result:{status_overall:{status_code:t}}}=await Qp(Xq);if(t===100)return"none";if([200,300,400].includes(t))return"minor";if([500,600].includes(t))return"major"}catch{}return"unknown"},Ld=async(t,e={},{token:n=te(mi)?.token,responseType:r="json"}={})=>{const i=uy[t==="/graphql"?"graphql":"rest"];return e.headers=new Headers(e.headers),e.headers.set("Authorization",`Bearer ${n}`),Qp(`${i}${t}`,e,{responseType:r})},Nd=async(t,e={})=>{const{data:n}=await Ld("/graphql",{method:"POST",body:{query:t.replace(/\n\s*/g," "),variables:e}});return n},KC=()=>{const{repo:t,branch:e}=te(mt).backend,{origin:n,isSelfHosted:r}=uy,{owner:i,repo:s}=t.match(/(?<owner>.+)\/(?<repo>[^/]+)$/)?.groups??{};return Object.assign(Ns,{service:Ya,label:WC,owner:i,repo:s,branch:e,baseURL:`${n}/${i}/${s}`,databaseName:`${Ya}:${i}/${s}`,isSelfHosted:r})},e5=()=>{const t=KC();te(_t).devModeEnabled&&console.info("repositoryInfo",t)},t5=async({token:t,auto:e=!1})=>{const{origin:n,hostname:r}=window.location,{site_domain:i=r,base_url:s="https://gitlab.com",auth_endpoint:o="oauth/authorize",auth_type:a,app_id:c=""}=te(mt).backend,u=`${$n(s)}/${$n(o)}`,d="api";let f="";if(t)f=t;else if(a==="pkce"){if(window.opener?.origin===n&&window.name==="auth"){await g3({backendName:Ya,clientId:c,authURL:u.replace("/authorize","/token")});return}if(e)return;f=await h3({backendName:Ya,clientId:c,authURL:u,scope:d})}else{if(e)return;f=await ZS({backendName:Ya,siteDomain:i,authURL:u,scope:d})}const{id:h,name:p,username:g,email:m,avatar_url:v,web_url:y}=await Ld("/user",{},{token:f});return{backendName:Ya,token:f,id:h,name:p,login:g,email:m,avatarURL:v,profileURL:y}},n5=async()=>{},r5=async()=>{const{owner:t,repo:e}=Ns,n=te(mi)?.id,{ok:r}=await Ld(`/projects/${encodeURIComponent(`${t}/${e}`)}/members/all/${n}`,{headers:{Accept:"application/json"}},{responseType:"raw"});if(!r)throw new Error("Not a collaborator of the repository",{cause:new Error(te(ce)("repository_no_access",{values:{repo:e}}))})},i5=async()=>{const{owner:t,repo:e}=Ns,n=await Nd(`
|
|
489
489
|
query {
|
|
490
490
|
project(fullPath: "${t}/${e}") {
|
|
491
491
|
repository {
|
|
@@ -560,7 +560,7 @@ ${i}`.trim()}function Rq(t,e){if(Pd(t)!=="object")throw new TypeError("stringify
|
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
`);if(a.push(...Object.values(c.project.repository).map(({lastCommit:u})=>u)),!o.length)break}return Object.fromEntries(t.map(({path:c,sha:u},d)=>{const{size:f,rawTextBlob:h}=s[d],p=a[d],g={sha:u,size:Number(f),text:h,meta:{}};if(p){const{author:m,authorName:v,authorEmail:y,committedDate:b}=p,{id:w,username:x}=m??{},k=w?.match(/\d+/);g.meta={commitAuthor:{name:v,email:y,id:k?Number(k[0]):void 0,login:x},committedDate:new Date(b)}}return[c,g]}))},l5={name:Ya,label:WC,repository:Ns,statusDashboardURL:Zq,checkStatus:Qq,getRepositoryInfo:KC,init:e5,signIn:t5,signOut:n5,fetchFiles:async()=>{await r5(),await UC({repository:Ns,fetchDefaultBranchName:i5,fetchLastCommit:s5,fetchFileList:o5,fetchFileContents:a5})},fetchBlob:async t=>{const{owner:e,repo:n,branch:r=""}=Ns,{path:i}=t;return Ld(`/projects/${encodeURIComponent(`${e}/${n}`)}/repository/files/${encodeURIComponent(i)}/raw?ref=${encodeURIComponent(r)}`,{},{responseType:"blob"})},commitChanges:async(t,e)=>{const{owner:n,repo:r,branch:i}=Ns;return(await Ld(`/projects/${encodeURIComponent(`${n}/${r}`)}/repository/commits`,{method:"POST",body:{branch:i,commit_message:AC(t,e),actions:await Promise.all(t.map(async({action:o,path:a,previousPath:c,data:u="",base64:d})=>({action:o,content:d??(typeof u!="string"?await jw(u):u),encoding:d||typeof u!="string"?"base64":"text",file_path:a,previous_path:c})))}})).web_url}},YC="local",c5="Local Repository";let dy;const u5=new Proxy({},{get:(t,e)=>(dy??zq)[e]}),fy=et(null),hy="root_dir_handle";let tg;const d5=async({forceReload:t=!1,showPicker:e=!0}={})=>{if(!("showDirectoryPicker"in window))throw new Error("unsupported");let n=t?null:await tg?.get(hy)??null;if(n)if(await n.requestPermission({mode:"readwrite"})!=="granted")n=null;else try{await n.entries().next()}catch(r){n=null,console.error(r)}return!n&&e&&(n=await window.showDirectoryPicker(),n&&(await n.getDirectoryHandle(".git"),await tg?.set(hy,n))),n},f5=async()=>{await tg?.delete(hy)},h5=()=>{const{name:t}=te(mt).backend;dy=ng[t]?.getRepositoryInfo?.();const{databaseName:e}=dy??{};tg=e?new Mo(e,"file-system-handles"):null},p5=async({auto:t=!1})=>{const e=await d5({showPicker:!t});if(e)fy.set(e);else throw new Error("Directory handle could not be acquired");return{backendName:YC}},g5=async()=>{f5()},Id=async t=>{let e=te(fy);if(!t)return e;const n=$n(t).split("/"),r=!0;for(const i of n)e=await(i.includes(".")?e.getFileHandle(i,{create:r}):e.getDirectoryHandle(i,{create:r}));return e},m5=async()=>{const t=te(fy),e=[],n=ec([...te(Z_).map(({filePathMap:o,folderPathMap:a})=>Object.values(o||(a??{}))).flat(1),...te(gi).map(({internalPath:o})=>o)].map(o=>$n(o??""))),r=o=>new RegExp(`^${on(o)}\\b`),i=n.map(r),s=async o=>{for await(const[a,c]of o.entries()){if(a.startsWith("."))continue;const u=(await t?.resolve(c))?.join("/")??"",d=i.some(f=>f.test(u));if(c.kind==="file"){if(!d)continue;try{let f=await c.getFile();f=new File([f],f.name,{type:f.type,lastModified:f.lastModified}),e.push({file:f,path:u})}catch(f){console.error(f)}}if(c.kind==="directory"){const f=r(u);if(!d&&!n.some(h=>f.test(h)))continue;await s(c)}}};return await s(t),Promise.all(e.map(async({file:o,path:a})=>({file:o,path:a.normalize(),size:o.size,sha:await(async()=>{try{return await So(o)}catch(c){console.error(c)}return""})()})))},ng={github:Jq,gitlab:l5,local:{name:YC,label:c5,repository:u5,init:h5,signIn:p5,signOut:g5,fetchFiles:async()=>{const{entryFiles:t,assetFiles:e}=ly(await m5());await Promise.all(t.map(async i=>{try{i.text=await sO(i.file)}catch(s){i.text="",console.error(s)}}));const{entries:n,errors:r}=await jC(t);ni.set(n),X_.set(r),Kt.set(PC(e)),Ic.set(!0)},commitChanges:async t=>Promise.all(t.map(async({action:e,path:n,previousPath:r,data:i})=>{try{let s;if(e==="move"&&r){const{dirname:o,basename:a}=An(n);s=await Id(r),o&&o!==An(r).dirname?await s.move(await Id(o),a):await s.move(a)}if(["create","update","move"].includes(e)&&i){s??=await Id(n);const o=await s.createWritable();try{await o.write(i)}catch{}finally{await o.close()}return s.getFile()}if(e==="delete"){const{dirname:o="",basename:a}=An($n(n));let c=await Id(o);if(await c.removeEntry(a),!o)return null;const u=o.split("/");for(;;){const d=[];for await(const h of c.keys())d.push(h);if(d.length>1||!u.length)break;const f=u.pop();c=await Id(u.join("/")),c.removeEntry(f)}}}catch(s){console.error(s)}return null}))}},Is=et(),Ln=nr([Is],([t],e,n)=>{n(r=>{const i=t?ng[t]:void 0;return i&&i!==r&&i.init(),i})}),rg=et(!0),$d=et({message:"",canRetry:!1}),Ja=et(!0),py=t=>{let e=t.cause?.message||te(ce)("unexpected_error"),n=!1;t.name==="NotFoundError"&&(e=te(ce)("sign_in_error.not_project_root"),n=!0),t.name==="AbortError"&&(e=te(ce)(te(Is)==="local"?"sign_in_error.picker_dismissed":"sign_in_error.authentication_aborted"),n=!0),$d.set({message:e,canRetry:n}),console.error(t.message,t.cause)},v5=async()=>{const t=await Xr.get("sveltia-cms.user")||await Xr.get("decap-cms-user")||await Xr.get("netlify-cms-user");let e=Zn(t)&&t.backendName?t:void 0;const n=e?.backendName?.replace("proxy","local")??te(mt)?.backend?.name;Is.set(n);const r=te(Ln);if(e&&r)try{e=await r.signIn({token:e.token,auto:!0})}catch{e=void 0}if(Ja.set(!e),!(!e||!r)){mi.set(e);try{await r.fetchFiles(),$d.set({message:"",canRetry:!1})}catch(i){[401,403,404].includes(i.cause?.status)?Ja.set(!0):py(i)}}},JC=async t=>{Is.set(t);const e=te(Ln);if(!e)return;let n;try{n=await e.signIn({auto:!1})}catch(r){Ja.set(!0),py(r);return}if(Ja.set(!n),!!n){mi.set(n);try{await e.fetchFiles(),$d.set({message:"",canRetry:!1})}catch(r){py(r)}}},b5=async()=>{await te(Ln)?.signOut(),await Xr.delete("sveltia-cms.user"),Is.set(void 0),mi.set(void 0),Ja.set(!0),Ic.set(!1)};var _5=D('<div role="alert" class="message"> </div>'),y5=D('<div role="alert"> </div>'),w5=D('<div role="alert"><!></div>'),x5=D('<div role="none"><!></div>'),k5=D("<!> <!>",1),S5=D("<!> <!>",1),E5=D('<div role="alert"> </div>'),T5=D('<div role="none" class="buttons svelte-8a6wia"><!> <!></div>');const C5={hash:"svelte-8a6wia",code:".buttons.svelte-8a6wia {display:flex;flex-direction:column;align-items:center;gap:16px;}.buttons.svelte-8a6wia button {width:240px;}"};function A5(t,e){oe(e,!0),Se(t,C5);const[n,r]=ve(),i=()=>j(mt,"$siteConfig",n),s=()=>j(Ja,"$unauthenticated",n),o=()=>j(ce,"$_",n),a=()=>j($d,"$signInError",n);let c=ie(!1),u=ie(!1),d=ie(!1);const f=_(()=>i()?.backend?.name),h=_(()=>l(f)?ng[l(f)]:null),p=_(()=>i()?.backend?.repo?.split("/")?.[1]);sn(()=>{const{hostname:x}=window.location;z(c,Z(x==="127.0.0.1"||x==="localhost"||x.endsWith(".localhost"))),z(u,"showDirectoryPicker"in window),z(d,Z(navigator.userAgentData?.brands.some(({brand:k})=>k==="Brave")??!1)),v5()});var g=T5(),m=$(g);{var v=x=>{var k=_5(),S=$(k);B(C=>K(S,C),[()=>o()("signing_in")]),T(x,k)},y=(x,k)=>{{var S=E=>{var A=y5(),P=$(A);B(I=>K(P,I),[()=>o()("config.error.unsupported_backend",{values:{name:l(f)}})]),T(E,A)},C=E=>{var A=S5(),P=F(A);const I=_(()=>o()("sign_in_with_x",{values:{service:l(h).label}}));Ge(P,{variant:"primary",get label(){return l(I)},onclick:async()=>{await JC(l(f))}});var L=R(P,2);{var N=M=>{var H=k5(),q=F(H);const G=_(()=>o()("work_with_local_repo")),V=_(()=>!l(u));Ge(q,{variant:"primary",get label(){return l(G)},get disabled(){return l(V)},onclick:async()=>{await JC("local")}});var Y=R(q,2);{var Q=W=>{var ne=w5(),de=$(ne);{var fe=le=>{var re=J(),ue=F(re);ur(ue,()=>fi.sanitize(o()("local_backend.disabled").replace("<a>",'<a href="https://github.com/sveltia/sveltia-cms#enabling-local-development-in-brave" target="_blank">'),{ALLOWED_TAGS:["a"],ALLOWED_ATTR:["href","target"]})),T(le,re)},se=le=>{var re=Ue();B(ue=>K(re,ue),[()=>o()("local_backend.unsupported_browser")]),T(le,re)};U(de,le=>{l(d)?le(fe):le(se,!1)})}T(W,ne)},X=(W,ne)=>{{var de=fe=>{var se=x5(),le=$(se);{var re=pe=>{var he=Ue();B(Ie=>K(he,Ie),[()=>o()("work_with_local_repo_description",{values:{repo:l(p)}})]),T(pe,he)},ue=pe=>{var he=Ue();B(Ie=>K(he,Ie),[()=>o()("work_with_local_repo_description_no_repo")]),T(pe,he)};U(le,pe=>{l(p)?pe(re):pe(ue,!1)})}T(fe,se)};U(W,fe=>{a().message||fe(de)},ne)}};U(Y,W=>{l(u)?W(X,!1):W(Q)})}T(M,H)};U(L,M=>{l(c)&&M(N)})}T(E,A)};U(x,E=>{l(h)?E(C,!1):E(S)},k)}};U(m,x=>{s()?x(y,!1):x(v)})}var b=R(m,2);{var w=x=>{var k=E5(),S=$(k);B(()=>K(S,a().message)),T(x,k)};U(b,x=>{a().message&&a().canRetry&&x(w)})}T(t,g),ae(),r()}const Ze=et(),ts=et(!0),ZC=nr([Ze],([t])=>{if(!t)return!1;const{originalLocales:e,currentLocales:n,originalSlugs:r,currentSlugs:i,originalValues:s,currentValues:o}=t;return!Dn(e,n)||!Dn(r,i)||!Dn(s,o)});Ze.subscribe(t=>{te(_t).devModeEnabled&&console.info("entryDraft",t)});const Za=et(!1),gy=et(!1),Rd=et({show:!1,multiple:!1}),my=et({id:void 0,show:!1,status:"success",message:void 0,count:1,sourceLocale:void 0}),Xa=et(null),Ko=et(null),Ri=et(),Rc=et(),ho=t=>{Ze.update(e=>(e&&Object.entries(t).forEach(([n,r])=>{e.expanderStates._[n]!==r&&(e.expanderStates._[n]=r)}),e))},XC=({collectionName:t,fileName:e,valueMap:n,keyPath:r})=>{const i=new Set;return r.split(".").forEach((s,o,a)=>{const c=a.slice(0,o+1).join("."),u=pn({collectionName:t,fileName:e,valueMap:n,keyPath:c}),d=/\.\d+$/.test(c);if(u?.widget==="object")d&&i.add(c),i.add(`${c}#`);else if(u?.widget==="list")i.add(d?c:`${c}#`);else if(o>0){const f=a.slice(0,o).join("."),h=pn({collectionName:t,fileName:e,valueMap:n,keyPath:f});h?.widget==="object"&&h.fields&&i.add(`${f}.${h.name}#`),h?.widget==="list"&&h.field&&i.add(c)}}),[...i]},P5=({collectionName:t,fileName:e,currentValues:n})=>{const r={};Object.entries(te(Ze)?.validities??{}).forEach(([i,s])=>{Object.entries(s).forEach(([o,{valid:a}])=>{a||XC({collectionName:t,fileName:e,valueMap:n[i],keyPath:o}).forEach(c=>{r[c]=!0})})}),ho(r)},O5=async({repository:t})=>{const{databaseName:e}=t??{},n=e?new Mo(e,"ui-settings"):null,r="entry-view",i={showPreview:!0,syncScrolling:!0,selectAssetsView:{type:"grid"},...await n?.get(r)??{}};Ri.set(i),Rc.set(i.selectAssetsView),Ri.subscribe(s=>{(async()=>{try{Dn(s,await n?.get(r))||await n?.set(r,s)}catch{}})()}),Rc.subscribe(s=>{if(!s||!Object.keys(s).length)return;const o=te(Ri)?.selectAssetsView??{};Dn(s,o)||Ri.update(a=>({...a,selectAssetsView:s}))})};Ln.subscribe(t=>{t&&!te(Ri)&&O5(t)});const QC=nr([Za,Wo],([t,e])=>t||e),vy=et(""),$s=et(""),Dd=(t=window.location)=>{const{pathname:e,searchParams:n}=new URL(`${t.origin}${t.hash.substring(1)}`);return{path:decodeURIComponent(e),params:Object.fromEntries(n)}},Fn=(t,{state:e={},replaceState:n=!1,notifyChange:r=!0}={})=>{const i=window.location.hash,s=`#${t}`,o=[{...e,from:i},"",s];n?window.history.replaceState(...o):window.history.pushState(...o),r&&window.dispatchEvent(new HashChangeEvent("hashchange",{oldURL:i,newURL:s}))},Dc=(t,e={})=>{window.history.state?.from?window.history.back():Fn(t,e)},eA=()=>{const{display_url:t,_siteURL:e}=te(mt);window.open(t||e||"/","_blank")};var L5=D('<img alt="" class="logo svelte-4zxkou">'),N5=D('<div role="alert" class="message"> </div>'),I5=D('<div role="alert" class="message"> </div>'),$5=D('<div role="alert" class="message"> </div>'),R5=D('<div role="alert"><div role="none" class="message"> </div> <div role="none" class="error svelte-4zxkou"><!></div></div>'),D5=D('<div role="alert" class="message"> </div>'),M5=D('<div role="alert" class="message"> </div> <!>',1),F5=D('<div role="none" class="container svelte-4zxkou"><div role="none" class="inner svelte-4zxkou"><!> <h1 class="svelte-4zxkou">Sveltia CMS</h1> <!></div></div>');const z5={hash:"svelte-4zxkou",code:".container.svelte-4zxkou {position:absolute;inset:0;z-index:101;flex:auto;display:flex;justify-content:center;align-items:center;gap:16px;padding:32px;transition:filter 250ms;}.container[inert].svelte-4zxkou {filter:opacity(0);}.container.svelte-4zxkou .inner:where(.svelte-4zxkou) {display:flex;flex-direction:column;align-items:center;gap:32px;min-width:240px;max-width:800px;min-height:240px;}.container.svelte-4zxkou .logo:where(.svelte-4zxkou) {max-width:160px;height:auto;}.container.svelte-4zxkou h1:where(.svelte-4zxkou) {font-size:48px;}.container.svelte-4zxkou .logo:where(.svelte-4zxkou) ~ h1:where(.svelte-4zxkou) {font-size:var(--sui-font-size-xxx-large);}.container.svelte-4zxkou .message {margin:0 0 16px;font-size:var(--sui-font-size-large);font-weight:var(--sui-font-weight-normal);text-align:center;}.container.svelte-4zxkou .error:where(.svelte-4zxkou) {border-radius:var(--sui-control-medium-border-radius);padding:12px;background-color:var(--sui-secondary-background-color);font-size:var(--sui-font-size-default);line-height:1.5;text-align:center;}"};function j5(t,e){oe(e,!0),Se(t,z5);const[n,r]=ve(),i=()=>j(ce,"$_",n),s=()=>j(mi,"$user",n),o=()=>j(Ic,"$dataLoaded",n),a=()=>j(mt,"$siteConfig",n),c=()=>j(ey,"$siteConfigError",n),u=()=>j(Yb,"$prefsError",n),d=()=>j(_t,"$prefs",n),f=()=>j($d,"$signInError",n),h=()=>j(YS,"$inAuthPopup",n),p=()=>j(Ja,"$unauthenticated",n),g=()=>j(Ga,"$dataLoadedProgress",n);Ne(()=>{tt($s,i()("welcome_to_sveltia_cms"))});var m=F5(),v=$(m),y=$(v);{var b=S=>{var C=L5();const E=_(()=>a()?.logo_url);B(A=>xe(C,"src",A),[()=>l(E)||`data:image/svg+xml;base64,${btoa(AS)}`]),T(S,C)};U(y,S=>{(a()||c())&&S(b)})}var w=R(y,4);{var x=S=>{var C=N5(),E=$(C);B(A=>K(E,`${c().message??""}
|
|
563
|
-
${A??""}`),[()=>i()("config.error.try_again")]),T(S,C)},k=(S,C)=>{{var E=P=>{var I=I5(),L=$(I);B(N=>K(L,N),[()=>i()(`prefs.error.${u().type}`)]),T(P,I)},A=(P,I)=>{{var L=M=>{var H=$5(),q=$(H);B(G=>K(q,G),[()=>i()("loading_site_config")]),T(M,H)},N=(M,H)=>{{var q=V=>{var Y=R5(),Q=$(Y),X=$(Q),W=R(Q,2),ne=$(W);ur(ne,()=>fi.sanitize(Ct.parseInline(f().message),{ALLOWED_TAGS:["a","code"],ALLOWED_ATTR:["href"]})),B(de=>K(X,de),[()=>i()("loading_site_data_error")]),T(V,Y)},G=(V,Y)=>{{var Q=W=>{var ne=D5(),de=$(ne);B(fe=>K(de,fe),[()=>i()("authorizing")]),T(W,ne)},X=(W,ne)=>{{var de=se=>{A5(se,{})},fe=(se,le)=>{{var re=ue=>{var pe=M5(),he=F(pe),Ie=$(he),Ce=R(he,2);{var Fe=Ae=>{bI(Ae,{get now(){return g()}})};U(Ce,Ae=>{g()!==void 0&&Ae(Fe)})}B(Ae=>K(Ie,Ae),[()=>i()("loading_site_data")]),T(ue,pe)};U(se,ue=>{o()||ue(re)},le)}};U(W,se=>{!s()||p()?se(de):se(fe,!1)},ne)}};U(V,W=>{h()?W(Q):W(X,!1)},Y)}};U(M,V=>{f().message&&!f().canRetry?V(q):V(G,!1)},H)}};U(P,M=>{!a()||!d()?M(L):M(N,!1)},I)}};U(S,P=>{u()?P(E):P(A,!1)},C)}};U(w,S=>{c()?S(x):S(k,!1)})}B(()=>m.inert=s()&&o()),T(t,m),ae(),r()}var U5=D(" <!>",1),B5=D('<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>',1);function q5(t,e){oe(e,!0);const[n,r]=ve(),i=()=>j(Ln,"$backend",n),s=()=>j(mt,"$siteConfig",n),o=()=>j(ce,"$_",n),a=5*60*1e3;let c=0,u=ie(!1),d=ie("none");const f=async()=>{i()?.checkStatus&&z(d,Z(await i().checkStatus()))},h=()=>{f(),c=window.setInterval(()=>{f()},a)},p=()=>{window.clearInterval(c),z(d,"none")},g=()=>{l(u)&&(i()?.checkStatus&&!i().repository?.isSelfHosted?h():p())};sn(()=>(z(u,!0),()=>{p()})),Ne(()=>{l(u),i(),s(),g()});var m=J(),v=F(m);{var y=b=>{var w=B5(),x=F(w);const k=_(()=>l(d)==="major"?"error":"warning");mf(x,()=>({"--sui-infobar-message-justify-content":"center"})),fm(x.lastChild,{get status(){return l(k)},children:(S,C)=>{var E=U5(),A=F(E),P=R(A);const I=_(()=>o()("details"));Ge(P,{variant:"link",get label(){return l(I)},onclick:()=>{window.open(i()?.statusDashboardURL,"_blank")}}),B(L=>K(A,`${L??""} `),[()=>o()(`backend_status.${l(d)}_incident`,{values:{service:i()?.label}})]),T(S,E)},$$slots:{default:!0}}),T(b,w)};U(v,b=>{["minor","major"].includes(l(d))&&b(y)})}T(t,m),ae(),r()}const by="0.62.2";var H5=D(" <!>",1),V5=D('<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>',1);function W5(t,e){oe(e,!0);const[n,r]=ve(),i=()=>j(ce,"$_",n),s=60*60*1e3,o=10*60*1e3;let a=0,c=0,u=ie(!1);const d=async()=>{try{const g=await fetch("https://unpkg.com/@sveltia/cms/package.json");if(!g.ok)return;const{version:m}=await g.json();m&&m!==by&&(c=window.setTimeout(()=>{z(u,!0)},o))}catch{}};sn(()=>{if(document.querySelector('script[src^="https://unpkg.com/@sveltia/cms"]'))return d(),a=window.setInterval(()=>{d()},s),()=>{window.clearInterval(a),window.clearTimeout(c)}});var f=J(),h=F(f);{var p=g=>{var m=V5(),v=F(m);mf(v,()=>({"--sui-infobar-message-justify-content":"center"})),fm(v.lastChild,{children:(y,b)=>{var w=H5(),x=F(w),k=R(x);const S=_(()=>i()("update_now"));Ge(k,{variant:"link",get label(){return l(S)},onclick:()=>{window.location.reload()}}),B(C=>K(x,`${C??""} `),[()=>i()("update_available")]),T(y,w)},$$slots:{default:!0}}),T(g,m)};U(h,g=>{l(u)&&g(p)})}T(t,f),ae(),r()}var G5=D('<div role="none" class="empty svelte-17yv21"><!></div>');const K5={hash:"svelte-17yv21",code:".empty.svelte-17yv21 {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:16px;width:100%;height:100%;text-align:center;}"};function Ar(t,e){Se(t,K5);let n=O(e,"children",3,void 0);var r=G5(),i=$(r);Le(i,()=>n()??Me),T(t,r)}var Y5=D("<img>"),J5=D("<video></video>",2),Z5=D("<audio></audio>"),X5=D('<video playsinline="" class="svelte-1va4mre"></video>',2),Q5=D('<img alt="" class="svelte-1va4mre">'),eH=D('<div role="none" class="blur svelte-1va4mre"><div role="none" class="overlay svelte-1va4mre"></div> <!></div>'),tH=D('<div role="none"><!> <!></div>');const nH={hash:"svelte-1va4mre",code:".preview.svelte-1va4mre {display:inline-flex;align-items:center;justify-content:center;position:relative;width:100%;height:100%;}.preview.tile.svelte-1va4mre {border-width:1px;border-style:solid;border-color:transparent;padding:var(--tile-padding, 12px);}.preview.tile.svelte-1va4mre .sui.icon {font-size:48px;}.preview.icon.svelte-1va4mre {border-radius:var(--sui-control-medium-border-radius);width:var(--icon-size, 32px);height:var(--icon-size, 32px);}.preview.tile.svelte-1va4mre, .preview.icon.svelte-1va4mre {overflow:hidden;aspect-ratio:1/1;}.preview.svelte-1va4mre .blur:where(.svelte-1va4mre) {display:contents;}.preview.svelte-1va4mre .blur:where(.svelte-1va4mre) > :where(.svelte-1va4mre) {position:absolute;inset:0;pointer-events:none;}.preview.svelte-1va4mre .blur:where(.svelte-1va4mre) .overlay {z-index:-1;backdrop-filter:blur(32px) brightness(0.8);}.preview.svelte-1va4mre .blur:where(.svelte-1va4mre) :is(img, video) {width:100%;height:100%;z-index:-2;object-fit:cover;transform:scale(1.2);}.preview.cover.svelte-1va4mre {padding:0;}.preview.cover.svelte-1va4mre > :is(img, video) {flex:auto;}.preview.svelte-1va4mre > :is(img, video) {flex:0;max-width:100%;max-height:100%;}.preview.dissolve.svelte-1va4mre :is(img, video) {opacity:0;transition:opacity 250ms;}.preview.dissolve.loaded.svelte-1va4mre :is(img, video) {opacity:1;}.checkerboard.svelte-1va4mre img:where(.svelte-1va4mre) {background-image:linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%), linear-gradient(45deg, #ccc 25%, #fff 25%, #fff 75%, #ccc 75%);background-size:8px 8px;background-position:0 0, 4px 4px;}.svelte-1va4mre:not(.checkerboard) img:where(.svelte-1va4mre) {background-color:#e5e5e5;}:is(img, video) {object-fit:contain;}.svelte-1va4mre:is(img, video):not([src]) {visibility:hidden;}.cover.svelte-1va4mre :is(img, video) {object-fit:cover;aspect-ratio:1/1;}"};function Rs(t,e){oe(e,!0),Se(t,nH);let n=O(e,"loading",3,"lazy"),r=O(e,"asset",3,void 0),i=O(e,"src",15,void 0),s=O(e,"variant",3,void 0),o=O(e,"blurBackground",3,!1),a=O(e,"cover",3,!1),c=O(e,"checkerboard",3,!1),u=O(e,"dissolve",3,!0),d=O(e,"alt",3,""),f=O(e,"controls",3,!1),h=nt(e,["$$slots","$$events","$$legacy","kind","loading","asset","src","variant","blurBackground","cover","checkerboard","dissolve","alt","controls"]),p=ie(void 0),g=ie(!1),m=ie(!1);const v=_(()=>!!r()&&!!s()),y=_(()=>l(v)||e.kind==="image"||r()?.name.endsWith(".pdf"));let b=!1;const w=async()=>{if(!(!r()||!l(p)||b)){b=!0,z(g,!1),n()==="lazy"&&await uu(l(p));try{i(l(v)?await SC(r()):await W_(r()))}catch{z(g,!0)}b=!1}},x=async()=>{!l(p)||!i()||((l(y)?!l(p).complete:!l(p).readyState)&&await new Promise(L=>{l(p)?.addEventListener(l(y)?"load":"loadedmetadata",()=>{L(void 0)},{once:!0})}),u()&&await uu(l(p)),z(m,!0),r()&&l(v)&&i().startsWith("blob:")&&URL.revokeObjectURL(i()))};Ne(()=>{l(p),r(),w()}),Ne(()=>{l(p),i(),x()});var k=tH();let S;var C=$(k);{var E=L=>{Ye(L,{name:"draft"})},A=(L,N)=>{{var M=q=>{var G=Y5();let V;Tt(G,Y=>z(p,Y),()=>l(p)),B(()=>V=bt(G,V,{loading:n(),src:i(),alt:d(),...h},"svelte-1va4mre")),T(q,G)},H=(q,G)=>{{var V=Q=>{var X=J5();let W;Tt(X,ne=>z(p,ne),()=>l(p)),B(()=>W=bt(X,W,{src:i(),controls:f()||void 0,playsinline:!0,...h},"svelte-1va4mre")),T(Q,X)},Y=(Q,X)=>{{var W=de=>{var fe=J(),se=F(fe);{var le=ue=>{var pe=Z5();let he;Tt(pe,Ie=>z(p,Ie),()=>l(p)),B(()=>he=bt(pe,he,{src:i(),controls:!0,playsinline:!0,...h},"svelte-1va4mre")),T(ue,pe)},re=ue=>{Ye(ue,{name:"audio_file"})};U(se,ue=>{f()?ue(le):ue(re,!1)})}T(de,fe)},ne=de=>{Ye(de,{name:"draft"})};U(Q,de=>{e.kind==="audio"?de(W):de(ne,!1)},X)}};U(q,Q=>{e.kind==="video"?Q(V):Q(Y,!1)},G)}};U(L,q=>{l(y)?q(M):q(H,!1)},N)}};U(C,L=>{l(g)?L(E):L(A,!1)})}var P=R(C,2);{var I=L=>{var N=eH(),M=R($(N),2);{var H=G=>{var V=X5();B(()=>xe(V,"src",i())),T(G,V)},q=G=>{var V=Q5();B(()=>{xe(V,"loading",n()),xe(V,"src",i())}),T(G,V)};U(M,G=>{e.kind==="video"?G(H):G(q,!1)})}T(L,N)};U(P,L=>{o()&&L(I)})}B(L=>S=Wt(k,1,`preview ${s()??""}`,"svelte-1va4mre",S,L),[()=>({cover:a(),checkerboard:c(),dissolve:u(),loaded:l(m)})]),T(t,k),ae()}const rH=/^(?:\d{4}-[01]\d-[0-3]\d)?(?:T?[0-2]\d:[0-5]\d)?(?::[0-5]\d)?(?:\.\d+)?(?:[+-][0-2]\d:[0-5]\d|Z)?$/,_y={year:"numeric",month:"short",day:"numeric"},yy={hour:"numeric",minute:"numeric",hour12:!0},tA=(t,e)=>{let n=()=>e?.().link,r=()=>e?.().collectionLabel,i=()=>e?.().entryLabel;var s=sH(),o=$(s);Ge(o,{role:"link",variant:"link",onclick:()=>Fn(n()),children:(a,c)=>{var u=iH(),d=$(u);B(()=>K(d,`${r()??""} › ${i()??""}`)),T(a,u)},$$slots:{default:!0}}),T(t,s)};var iH=D('<span role="none"> </span>'),sH=D("<p><!></p>"),oH=D('<div role="none" class="preview svelte-1i169qh"><!></div>'),aH=D('<section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section>'),lH=D('<section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section>'),cH=D('<a target="_blank"> </a>'),uH=D("<a> </a>"),dH=D('<section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section>'),fH=D('<section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section>'),hH=D("<p> </p>"),pH=D('<div role="none" class="detail svelte-1i169qh"><!> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section> <!> <!> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p><!></p></section> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p><!></p></section> <!> <!> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <!></section></div>');const gH={hash:"svelte-1i169qh",code:".detail.svelte-1i169qh {flex:none;overflow-x:hidden;overflow-y:auto;padding:16px;width:320px;}.detail.svelte-1i169qh .preview:where(.svelte-1i169qh) {overflow:hidden;margin:0 0 16px;border-radius:var(--sui-control-large-border-radius);background-color:var(--sui-content-background-color);aspect-ratio:1/1;}.detail.svelte-1i169qh section:where(.svelte-1i169qh) {margin:0 0 16px;}.detail.svelte-1i169qh section:where(.svelte-1i169qh) > * {margin:0 0 4px;word-break:break-all;}.detail.svelte-1i169qh h4:where(.svelte-1i169qh) {font-size:var(--sui-font-size-small);font-weight:var(--sui-font-weight-bold);color:var(--sui-secondary-foreground-color);}"};function nA(t,e){oe(e,!0),Se(t,gH);const[n,r]=ve(),i=()=>j(ce,"$_",n),s=()=>j(Pn,"$appLocale",n);let o=O(e,"showPreview",3,!1),a=ie(Z({...Jp}));const c=_(()=>e.asset.path),u=_(()=>e.asset.size),d=_(()=>e.asset.kind),f=_(()=>e.asset.commitAuthor),h=_(()=>e.asset.commitDate),p=_(()=>l(a).publicURL),g=_(()=>l(a).repoBlobURL),m=_(()=>l(a).dimensions),v=_(()=>l(a).duration),y=_(()=>l(a).usedEntries),b=_(()=>An(l(c))),w=_(()=>Qe(l(b).extension,"")),x=_(()=>Wp(l(d))||l(c).endsWith(".pdf")),k=async()=>{z(a,Z(e.asset?await Zp(e.asset):{...Jp}))};Ne(()=>{e.asset,k()});var S=pH(),C=$(S);{var E=ge=>{var we=oH(),Be=$(we);const ot=_(()=>l(d)==="image"),ut=_(()=>["audio","video"].includes(l(d)));Rs(Be,{get kind(){return l(d)},get asset(){return e.asset},variant:"tile",get checkerboard(){return l(ot)},get controls(){return l(ut)}}),T(ge,we)};U(C,ge=>{o()&&l(x)&&ge(E)})}var A=R(C,2),P=$(A),I=$(P),L=R(P,2),N=$(L),M=R(A,2),H=$(M),q=$(H),G=R(H,2),V=$(G),Y=R(M,2);{var Q=ge=>{var we=aH(),Be=$(we),ot=$(Be),ut=R(Be,2),rt=$(ut);B(We=>{K(ot,We),K(rt,l(m)?`${l(m).width}×${l(m).height}`:"–")},[()=>i()("dimensions")]),T(ge,we)};U(Y,ge=>{l(x)&&ge(Q)})}var X=R(Y,2);{var W=ge=>{var we=lH(),Be=$(we),ot=$(Be),ut=R(Be,2),rt=$(ut);B((We,dt)=>{K(ot,We),K(rt,dt)},[()=>i()("duration"),()=>l(v)?nq(l(v)):"–"]),T(ge,we)};U(X,ge=>{["audio","video"].includes(l(d))&&ge(W)})}var ne=R(X,2),de=$(ne),fe=$(de),se=R(de,2),le=$(se);{var re=ge=>{var we=cH(),Be=$(we);B(()=>{xe(we,"href",l(p)),K(Be,l(p))}),T(ge,we)},ue=ge=>{var we=Ue("–");T(ge,we)};U(le,ge=>{l(p)?ge(re):ge(ue,!1)})}var pe=R(ne,2),he=$(pe),Ie=$(he),Ce=R(he,2),Fe=$(Ce);{var Ae=ge=>{var we=uH(),Be=$(we);B(()=>{xe(we,"href",l(g)),K(Be,`/${l(c)??""}`)}),T(ge,we)},be=ge=>{var we=Ue();B(()=>K(we,`/${l(c)??""}`)),T(ge,we)};U(Fe,ge=>{l(g)?ge(Ae):ge(be,!1)})}var _e=R(pe,2);{var $e=ge=>{var we=dH(),Be=$(we),ot=$(Be),ut=R(Be,2),rt=$(ut);B(We=>{K(ot,We),K(rt,l(f).name||l(f).login||l(f).email)},[()=>i()("sort_keys.commit_author")]),T(ge,we)};U(_e,ge=>{l(f)&&ge($e)})}var He=R(_e,2);{var Xe=ge=>{var we=fH(),Be=$(we),ot=$(Be),ut=R(Be,2),rt=$(ut);B((We,dt)=>{K(ot,We),K(rt,dt)},[()=>i()("sort_keys.commit_date"),()=>l(h).toLocaleString(s()??void 0,{..._y,...yy})]),T(ge,we)};U(He,ge=>{l(h)&&ge(Xe)})}var Ve=R(He,2),Oe=$(Ve),ye=$(Oe),De=R(Oe,2);st(De,17,()=>l(y),ge=>ge.sha,(ge,we)=>{var Be=J(),ot=F(Be);st(ot,17,()=>lo(l(we)),ut=>ut.name,(ut,rt)=>{var We=J();const dt=_(()=>l(rt).label||l(rt).name);var lt=F(We);st(lt,17,()=>Ho(l(rt),l(we)),ht=>ht.name,(ht,kt)=>{tA(ht,()=>({link:`/collections/${l(rt).name}/entries/${l(kt).name}`,collectionLabel:l(dt),entryLabel:l(kt).label||l(kt).name}))},ht=>{var kt=Pg(()=>({link:`/collections/${l(rt).name}/entries/${l(we).subPath}`,collectionLabel:l(dt),entryLabel:Vo(l(rt),l(we),{useTemplate:!0})}));tA(ht,()=>l(kt))}),T(ut,We)}),T(ge,Be)},ge=>{var we=hH(),Be=$(we);B(ot=>K(Be,ot),[()=>i()("sort_keys.none")]),T(ge,we)}),B((ge,we,Be,ot,ut,rt,We)=>{K(I,ge),K(N,we),K(q,Be),K(V,ot),K(fe,ut),K(Ie,rt),K(ye,We)},[()=>i()("kind"),()=>i()(`file_type_labels.${l(w)}`,{default:Js.getType(l(c))??l(w).toUpperCase()}),()=>i()("size"),()=>s()?U_(l(u)):"",()=>i()("public_url"),()=>i()("file_path"),()=>i()("used_in")]),T(t,S),ae(),r()}var mH=D("<!> <!> <!>",1),vH=D("<!> <!>",1);function rA(t,e){oe(e,!0);const[n,r]=ve(),i=()=>j(ce,"$_",n);let s=O(e,"assets",19,()=>[]),o=ie(Z([])),a=ie(!1);const c=Z({show:!1,text:"",status:"success"}),u=_(()=>s().length===1),d=_(()=>l(o).filter(({publicURL:S})=>!!S).map(({publicURL:S})=>S));let f;const h=async()=>{if(f=void 0,!l(u))return!1;const S=await Wa(s()[0]);return f=S,ru(S.type)?!0:S.type.startsWith("image/")?typeof navigator.clipboard.write=="function":!1},p=async()=>{await navigator.clipboard.writeText(l(d).join(`
|
|
563
|
+
${A??""}`),[()=>i()("config.error.try_again")]),T(S,C)},k=(S,C)=>{{var E=P=>{var I=I5(),L=$(I);B(N=>K(L,N),[()=>i()(`prefs.error.${u().type}`)]),T(P,I)},A=(P,I)=>{{var L=M=>{var H=$5(),q=$(H);B(G=>K(q,G),[()=>i()("loading_site_config")]),T(M,H)},N=(M,H)=>{{var q=V=>{var Y=R5(),Q=$(Y),X=$(Q),W=R(Q,2),ne=$(W);ur(ne,()=>fi.sanitize(Ct.parseInline(f().message),{ALLOWED_TAGS:["a","code"],ALLOWED_ATTR:["href"]})),B(de=>K(X,de),[()=>i()("loading_site_data_error")]),T(V,Y)},G=(V,Y)=>{{var Q=W=>{var ne=D5(),de=$(ne);B(fe=>K(de,fe),[()=>i()("authorizing")]),T(W,ne)},X=(W,ne)=>{{var de=se=>{A5(se,{})},fe=(se,le)=>{{var re=ue=>{var pe=M5(),he=F(pe),Ie=$(he),Ce=R(he,2);{var Fe=Ae=>{bI(Ae,{get now(){return g()}})};U(Ce,Ae=>{g()!==void 0&&Ae(Fe)})}B(Ae=>K(Ie,Ae),[()=>i()("loading_site_data")]),T(ue,pe)};U(se,ue=>{o()||ue(re)},le)}};U(W,se=>{!s()||p()?se(de):se(fe,!1)},ne)}};U(V,W=>{h()?W(Q):W(X,!1)},Y)}};U(M,V=>{f().message&&!f().canRetry?V(q):V(G,!1)},H)}};U(P,M=>{!a()||!d()?M(L):M(N,!1)},I)}};U(S,P=>{u()?P(E):P(A,!1)},C)}};U(w,S=>{c()?S(x):S(k,!1)})}B(()=>m.inert=s()&&o()),T(t,m),ae(),r()}var U5=D(" <!>",1),B5=D('<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>',1);function q5(t,e){oe(e,!0);const[n,r]=ve(),i=()=>j(Ln,"$backend",n),s=()=>j(mt,"$siteConfig",n),o=()=>j(ce,"$_",n),a=5*60*1e3;let c=0,u=ie(!1),d=ie("none");const f=async()=>{i()?.checkStatus&&z(d,Z(await i().checkStatus()))},h=()=>{f(),c=window.setInterval(()=>{f()},a)},p=()=>{window.clearInterval(c),z(d,"none")},g=()=>{l(u)&&(i()?.checkStatus&&!i().repository?.isSelfHosted?h():p())};sn(()=>(z(u,!0),()=>{p()})),Ne(()=>{l(u),i(),s(),g()});var m=J(),v=F(m);{var y=b=>{var w=B5(),x=F(w);const k=_(()=>l(d)==="major"?"error":"warning");mf(x,()=>({"--sui-infobar-message-justify-content":"center"})),fm(x.lastChild,{get status(){return l(k)},children:(S,C)=>{var E=U5(),A=F(E),P=R(A);const I=_(()=>o()("details"));Ge(P,{variant:"link",get label(){return l(I)},onclick:()=>{window.open(i()?.statusDashboardURL,"_blank")}}),B(L=>K(A,`${L??""} `),[()=>o()(`backend_status.${l(d)}_incident`,{values:{service:i()?.label}})]),T(S,E)},$$slots:{default:!0}}),T(b,w)};U(v,b=>{["minor","major"].includes(l(d))&&b(y)})}T(t,m),ae(),r()}const by="0.62.3";var H5=D(" <!>",1),V5=D('<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>',1);function W5(t,e){oe(e,!0);const[n,r]=ve(),i=()=>j(ce,"$_",n),s=60*60*1e3,o=10*60*1e3;let a=0,c=0,u=ie(!1);const d=async()=>{try{const g=await fetch("https://unpkg.com/@sveltia/cms/package.json");if(!g.ok)return;const{version:m}=await g.json();m&&m!==by&&(c=window.setTimeout(()=>{z(u,!0)},o))}catch{}};sn(()=>{if(document.querySelector('script[src^="https://unpkg.com/@sveltia/cms"]'))return d(),a=window.setInterval(()=>{d()},s),()=>{window.clearInterval(a),window.clearTimeout(c)}});var f=J(),h=F(f);{var p=g=>{var m=V5(),v=F(m);mf(v,()=>({"--sui-infobar-message-justify-content":"center"})),fm(v.lastChild,{children:(y,b)=>{var w=H5(),x=F(w),k=R(x);const S=_(()=>i()("update_now"));Ge(k,{variant:"link",get label(){return l(S)},onclick:()=>{window.location.reload()}}),B(C=>K(x,`${C??""} `),[()=>i()("update_available")]),T(y,w)},$$slots:{default:!0}}),T(g,m)};U(h,g=>{l(u)&&g(p)})}T(t,f),ae(),r()}var G5=D('<div role="none" class="empty svelte-17yv21"><!></div>');const K5={hash:"svelte-17yv21",code:".empty.svelte-17yv21 {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:16px;width:100%;height:100%;text-align:center;}"};function Ar(t,e){Se(t,K5);let n=O(e,"children",3,void 0);var r=G5(),i=$(r);Le(i,()=>n()??Me),T(t,r)}var Y5=D("<img>"),J5=D("<video></video>",2),Z5=D("<audio></audio>"),X5=D('<video playsinline="" class="svelte-1va4mre"></video>',2),Q5=D('<img alt="" class="svelte-1va4mre">'),eH=D('<div role="none" class="blur svelte-1va4mre"><div role="none" class="overlay svelte-1va4mre"></div> <!></div>'),tH=D('<div role="none"><!> <!></div>');const nH={hash:"svelte-1va4mre",code:".preview.svelte-1va4mre {display:inline-flex;align-items:center;justify-content:center;position:relative;width:100%;height:100%;}.preview.tile.svelte-1va4mre {border-width:1px;border-style:solid;border-color:transparent;padding:var(--tile-padding, 12px);}.preview.tile.svelte-1va4mre .sui.icon {font-size:48px;}.preview.icon.svelte-1va4mre {border-radius:var(--sui-control-medium-border-radius);width:var(--icon-size, 32px);height:var(--icon-size, 32px);}.preview.tile.svelte-1va4mre, .preview.icon.svelte-1va4mre {overflow:hidden;aspect-ratio:1/1;}.preview.svelte-1va4mre .blur:where(.svelte-1va4mre) {display:contents;}.preview.svelte-1va4mre .blur:where(.svelte-1va4mre) > :where(.svelte-1va4mre) {position:absolute;inset:0;pointer-events:none;}.preview.svelte-1va4mre .blur:where(.svelte-1va4mre) .overlay {z-index:-1;backdrop-filter:blur(32px) brightness(0.8);}.preview.svelte-1va4mre .blur:where(.svelte-1va4mre) :is(img, video) {width:100%;height:100%;z-index:-2;object-fit:cover;transform:scale(1.2);}.preview.cover.svelte-1va4mre {padding:0;}.preview.cover.svelte-1va4mre > :is(img, video) {flex:auto;}.preview.svelte-1va4mre > :is(img, video) {flex:0;max-width:100%;max-height:100%;}.preview.dissolve.svelte-1va4mre :is(img, video) {opacity:0;transition:opacity 250ms;}.preview.dissolve.loaded.svelte-1va4mre :is(img, video) {opacity:1;}.checkerboard.svelte-1va4mre img:where(.svelte-1va4mre) {background-image:linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%), linear-gradient(45deg, #ccc 25%, #fff 25%, #fff 75%, #ccc 75%);background-size:8px 8px;background-position:0 0, 4px 4px;}.svelte-1va4mre:not(.checkerboard) img:where(.svelte-1va4mre) {background-color:#e5e5e5;}:is(img, video) {object-fit:contain;}.svelte-1va4mre:is(img, video):not([src]) {visibility:hidden;}.cover.svelte-1va4mre :is(img, video) {object-fit:cover;aspect-ratio:1/1;}"};function Rs(t,e){oe(e,!0),Se(t,nH);let n=O(e,"loading",3,"lazy"),r=O(e,"asset",3,void 0),i=O(e,"src",15,void 0),s=O(e,"variant",3,void 0),o=O(e,"blurBackground",3,!1),a=O(e,"cover",3,!1),c=O(e,"checkerboard",3,!1),u=O(e,"dissolve",3,!0),d=O(e,"alt",3,""),f=O(e,"controls",3,!1),h=nt(e,["$$slots","$$events","$$legacy","kind","loading","asset","src","variant","blurBackground","cover","checkerboard","dissolve","alt","controls"]),p=ie(void 0),g=ie(!1),m=ie(!1);const v=_(()=>!!r()&&!!s()),y=_(()=>l(v)||e.kind==="image"||r()?.name.endsWith(".pdf"));let b=!1;const w=async()=>{if(!(!r()||!l(p)||b)){b=!0,z(g,!1),n()==="lazy"&&await uu(l(p));try{i(l(v)?await SC(r()):await W_(r()))}catch{z(g,!0)}b=!1}},x=async()=>{!l(p)||!i()||((l(y)?!l(p).complete:!l(p).readyState)&&await new Promise(L=>{l(p)?.addEventListener(l(y)?"load":"loadedmetadata",()=>{L(void 0)},{once:!0})}),u()&&await uu(l(p)),z(m,!0),r()&&l(v)&&i().startsWith("blob:")&&URL.revokeObjectURL(i()))};Ne(()=>{l(p),r(),w()}),Ne(()=>{l(p),i(),x()});var k=tH();let S;var C=$(k);{var E=L=>{Ye(L,{name:"draft"})},A=(L,N)=>{{var M=q=>{var G=Y5();let V;Tt(G,Y=>z(p,Y),()=>l(p)),B(()=>V=bt(G,V,{loading:n(),src:i(),alt:d(),...h},"svelte-1va4mre")),T(q,G)},H=(q,G)=>{{var V=Q=>{var X=J5();let W;Tt(X,ne=>z(p,ne),()=>l(p)),B(()=>W=bt(X,W,{src:i(),controls:f()||void 0,playsinline:!0,...h},"svelte-1va4mre")),T(Q,X)},Y=(Q,X)=>{{var W=de=>{var fe=J(),se=F(fe);{var le=ue=>{var pe=Z5();let he;Tt(pe,Ie=>z(p,Ie),()=>l(p)),B(()=>he=bt(pe,he,{src:i(),controls:!0,playsinline:!0,...h},"svelte-1va4mre")),T(ue,pe)},re=ue=>{Ye(ue,{name:"audio_file"})};U(se,ue=>{f()?ue(le):ue(re,!1)})}T(de,fe)},ne=de=>{Ye(de,{name:"draft"})};U(Q,de=>{e.kind==="audio"?de(W):de(ne,!1)},X)}};U(q,Q=>{e.kind==="video"?Q(V):Q(Y,!1)},G)}};U(L,q=>{l(y)?q(M):q(H,!1)},N)}};U(C,L=>{l(g)?L(E):L(A,!1)})}var P=R(C,2);{var I=L=>{var N=eH(),M=R($(N),2);{var H=G=>{var V=X5();B(()=>xe(V,"src",i())),T(G,V)},q=G=>{var V=Q5();B(()=>{xe(V,"loading",n()),xe(V,"src",i())}),T(G,V)};U(M,G=>{e.kind==="video"?G(H):G(q,!1)})}T(L,N)};U(P,L=>{o()&&L(I)})}B(L=>S=Wt(k,1,`preview ${s()??""}`,"svelte-1va4mre",S,L),[()=>({cover:a(),checkerboard:c(),dissolve:u(),loaded:l(m)})]),T(t,k),ae()}const rH=/^(?:\d{4}-[01]\d-[0-3]\d)?(?:T?[0-2]\d:[0-5]\d)?(?::[0-5]\d)?(?:\.\d+)?(?:[+-][0-2]\d:[0-5]\d|Z)?$/,_y={year:"numeric",month:"short",day:"numeric"},yy={hour:"numeric",minute:"numeric",hour12:!0},tA=(t,e)=>{let n=()=>e?.().link,r=()=>e?.().collectionLabel,i=()=>e?.().entryLabel;var s=sH(),o=$(s);Ge(o,{role:"link",variant:"link",onclick:()=>Fn(n()),children:(a,c)=>{var u=iH(),d=$(u);B(()=>K(d,`${r()??""} › ${i()??""}`)),T(a,u)},$$slots:{default:!0}}),T(t,s)};var iH=D('<span role="none"> </span>'),sH=D("<p><!></p>"),oH=D('<div role="none" class="preview svelte-1i169qh"><!></div>'),aH=D('<section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section>'),lH=D('<section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section>'),cH=D('<a target="_blank"> </a>'),uH=D("<a> </a>"),dH=D('<section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section>'),fH=D('<section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section>'),hH=D("<p> </p>"),pH=D('<div role="none" class="detail svelte-1i169qh"><!> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p> </p></section> <!> <!> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p><!></p></section> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <p><!></p></section> <!> <!> <section class="svelte-1i169qh"><h4 class="svelte-1i169qh"> </h4> <!></section></div>');const gH={hash:"svelte-1i169qh",code:".detail.svelte-1i169qh {flex:none;overflow-x:hidden;overflow-y:auto;padding:16px;width:320px;}.detail.svelte-1i169qh .preview:where(.svelte-1i169qh) {overflow:hidden;margin:0 0 16px;border-radius:var(--sui-control-large-border-radius);background-color:var(--sui-content-background-color);aspect-ratio:1/1;}.detail.svelte-1i169qh section:where(.svelte-1i169qh) {margin:0 0 16px;}.detail.svelte-1i169qh section:where(.svelte-1i169qh) > * {margin:0 0 4px;word-break:break-all;}.detail.svelte-1i169qh h4:where(.svelte-1i169qh) {font-size:var(--sui-font-size-small);font-weight:var(--sui-font-weight-bold);color:var(--sui-secondary-foreground-color);}"};function nA(t,e){oe(e,!0),Se(t,gH);const[n,r]=ve(),i=()=>j(ce,"$_",n),s=()=>j(Pn,"$appLocale",n);let o=O(e,"showPreview",3,!1),a=ie(Z({...Jp}));const c=_(()=>e.asset.path),u=_(()=>e.asset.size),d=_(()=>e.asset.kind),f=_(()=>e.asset.commitAuthor),h=_(()=>e.asset.commitDate),p=_(()=>l(a).publicURL),g=_(()=>l(a).repoBlobURL),m=_(()=>l(a).dimensions),v=_(()=>l(a).duration),y=_(()=>l(a).usedEntries),b=_(()=>An(l(c))),w=_(()=>Qe(l(b).extension,"")),x=_(()=>Wp(l(d))||l(c).endsWith(".pdf")),k=async()=>{z(a,Z(e.asset?await Zp(e.asset):{...Jp}))};Ne(()=>{e.asset,k()});var S=pH(),C=$(S);{var E=ge=>{var we=oH(),Be=$(we);const ot=_(()=>l(d)==="image"),ut=_(()=>["audio","video"].includes(l(d)));Rs(Be,{get kind(){return l(d)},get asset(){return e.asset},variant:"tile",get checkerboard(){return l(ot)},get controls(){return l(ut)}}),T(ge,we)};U(C,ge=>{o()&&l(x)&&ge(E)})}var A=R(C,2),P=$(A),I=$(P),L=R(P,2),N=$(L),M=R(A,2),H=$(M),q=$(H),G=R(H,2),V=$(G),Y=R(M,2);{var Q=ge=>{var we=aH(),Be=$(we),ot=$(Be),ut=R(Be,2),rt=$(ut);B(We=>{K(ot,We),K(rt,l(m)?`${l(m).width}×${l(m).height}`:"–")},[()=>i()("dimensions")]),T(ge,we)};U(Y,ge=>{l(x)&&ge(Q)})}var X=R(Y,2);{var W=ge=>{var we=lH(),Be=$(we),ot=$(Be),ut=R(Be,2),rt=$(ut);B((We,dt)=>{K(ot,We),K(rt,dt)},[()=>i()("duration"),()=>l(v)?nq(l(v)):"–"]),T(ge,we)};U(X,ge=>{["audio","video"].includes(l(d))&&ge(W)})}var ne=R(X,2),de=$(ne),fe=$(de),se=R(de,2),le=$(se);{var re=ge=>{var we=cH(),Be=$(we);B(()=>{xe(we,"href",l(p)),K(Be,l(p))}),T(ge,we)},ue=ge=>{var we=Ue("–");T(ge,we)};U(le,ge=>{l(p)?ge(re):ge(ue,!1)})}var pe=R(ne,2),he=$(pe),Ie=$(he),Ce=R(he,2),Fe=$(Ce);{var Ae=ge=>{var we=uH(),Be=$(we);B(()=>{xe(we,"href",l(g)),K(Be,`/${l(c)??""}`)}),T(ge,we)},be=ge=>{var we=Ue();B(()=>K(we,`/${l(c)??""}`)),T(ge,we)};U(Fe,ge=>{l(g)?ge(Ae):ge(be,!1)})}var _e=R(pe,2);{var $e=ge=>{var we=dH(),Be=$(we),ot=$(Be),ut=R(Be,2),rt=$(ut);B(We=>{K(ot,We),K(rt,l(f).name||l(f).login||l(f).email)},[()=>i()("sort_keys.commit_author")]),T(ge,we)};U(_e,ge=>{l(f)&&ge($e)})}var He=R(_e,2);{var Xe=ge=>{var we=fH(),Be=$(we),ot=$(Be),ut=R(Be,2),rt=$(ut);B((We,dt)=>{K(ot,We),K(rt,dt)},[()=>i()("sort_keys.commit_date"),()=>l(h).toLocaleString(s()??void 0,{..._y,...yy})]),T(ge,we)};U(He,ge=>{l(h)&&ge(Xe)})}var Ve=R(He,2),Oe=$(Ve),ye=$(Oe),De=R(Oe,2);st(De,17,()=>l(y),ge=>ge.sha,(ge,we)=>{var Be=J(),ot=F(Be);st(ot,17,()=>lo(l(we)),ut=>ut.name,(ut,rt)=>{var We=J();const dt=_(()=>l(rt).label||l(rt).name);var lt=F(We);st(lt,17,()=>Ho(l(rt),l(we)),ht=>ht.name,(ht,kt)=>{tA(ht,()=>({link:`/collections/${l(rt).name}/entries/${l(kt).name}`,collectionLabel:l(dt),entryLabel:l(kt).label||l(kt).name}))},ht=>{var kt=Pg(()=>({link:`/collections/${l(rt).name}/entries/${l(we).subPath}`,collectionLabel:l(dt),entryLabel:Vo(l(rt),l(we),{useTemplate:!0})}));tA(ht,()=>l(kt))}),T(ut,We)}),T(ge,Be)},ge=>{var we=hH(),Be=$(we);B(ot=>K(Be,ot),[()=>i()("sort_keys.none")]),T(ge,we)}),B((ge,we,Be,ot,ut,rt,We)=>{K(I,ge),K(N,we),K(q,Be),K(V,ot),K(fe,ut),K(Ie,rt),K(ye,We)},[()=>i()("kind"),()=>i()(`file_type_labels.${l(w)}`,{default:Js.getType(l(c))??l(w).toUpperCase()}),()=>i()("size"),()=>s()?U_(l(u)):"",()=>i()("public_url"),()=>i()("file_path"),()=>i()("used_in")]),T(t,S),ae(),r()}var mH=D("<!> <!> <!>",1),vH=D("<!> <!>",1);function rA(t,e){oe(e,!0);const[n,r]=ve(),i=()=>j(ce,"$_",n);let s=O(e,"assets",19,()=>[]),o=ie(Z([])),a=ie(!1);const c=Z({show:!1,text:"",status:"success"}),u=_(()=>s().length===1),d=_(()=>l(o).filter(({publicURL:S})=>!!S).map(({publicURL:S})=>S));let f;const h=async()=>{if(f=void 0,!l(u))return!1;const S=await Wa(s()[0]);return f=S,ru(S.type)?!0:S.type.startsWith("image/")?typeof navigator.clipboard.write=="function":!1},p=async()=>{await navigator.clipboard.writeText(l(d).join(`
|
|
564
564
|
`))},g=async()=>{await navigator.clipboard.writeText(s().map(({path:S})=>`/${S}`).join(`
|
|
565
565
|
`))},m=async()=>{let S=f;if(ru(S.type)){await navigator.clipboard.writeText(await S.text());return}if(!S.type.startsWith("image/"))throw new Error("Unsupported type");S.type!=="image/png"&&(S=await yC(S)),await navigator.clipboard.write([new ClipboardItem({"image/png":S})])},v=async(S,C,E)=>{try{await S(),c.status="success",c.text=l(u)?C:E}catch{c.status="error",c.text=i()("clipboard_error")}finally{c.show=!0}};Ne(()=>{(async()=>(z(o,Z(await Promise.all(s().map(Zp)))),z(a,Z(await h()))))()});var y=vH(),b=F(y);const w=_(()=>!s().length),x=_(()=>i()("copy"));fr(b,{variant:"ghost",get disabled(){return l(w)},get label(){return l(x)},popupPosition:"bottom-right",popup:C=>{const E=_(()=>i()("copy_options"));rr(C,{get"aria-label"(){return l(E)},children:(A,P)=>{var I=mH(),L=F(I);const N=_(()=>l(u)?i()("public_url"):i()("public_urls")),M=_(()=>!l(d).length);pt(L,{get label(){return l(N)},get disabled(){return l(M)},onclick:()=>{v(p,i()("asset_url_copied"),i()("asset_urls_copied"))}});var H=R(L,2);const q=_(()=>l(u)?i()("file_path"):i()("file_paths"));pt(H,{get label(){return l(q)},onclick:()=>{v(g,i()("asset_path_copied"),i()("asset_paths_copied"))}});var G=R(H,2);const V=_(()=>i()("file_data")),Y=_(()=>!l(a));pt(G,{get label(){return l(V)},get disabled(){return l(Y)},onclick:()=>{v(m,i()("asset_data_copied"),i()("asset_data_copied"))}}),T(A,I)},$$slots:{default:!0}})},$$slots:{popup:!0}});var k=R(b,2);Kn(k,{get show(){return c.show},set show(S){c.show=S},children:(S,C)=>{qn(S,{get status(){return c.status},children:(E,A)=>{var P=Ue();B(()=>K(P,c.text)),T(E,P)},$$slots:{default:!0}})},$$slots:{default:!0}}),T(t,y),ae(),r()}const Qa={saved:!1,moved:!1,renamed:!1,deleted:!1,published:!1,count:1},Md=et({...Qa}),iA=async(t,e=[])=>{const n=te(ni),r=t.map(i=>{const{locales:s,slug:o}=n.find(a=>a.id===i)??{};if(s)return Object.values(s).map(({path:a})=>({action:"delete",slug:o,path:a}))}).flat(1).filter((i,s,o)=>i&&o.findIndex(a=>a?.path===i.path)===s);e.length&&r.push(...e.map(i=>({action:"delete",path:i}))),await te(Ln)?.commitChanges(r,{commitType:"delete",collection:te(Hn)}),ni.set(n.filter(i=>!t.includes(i.id))),Md.set({...Qa,deleted:!0,count:t.length}),e.length&&Kt.update(i=>i.filter(s=>!e.includes(s.path)))},bH=({fieldConfig:t,keyPath:e})=>{const n={},{default:r,output_code_only:i=!1,keys:s={code:"code",lang:"lang"}}=t;if(i)n[e]=typeof r=="string"?r:"";else{const o=Zn(r)?r:void 0,a=o?o[s.code]:r,c=o?o[s.lang]:"";n[e]={},n[`${e}.${s.code}`]=typeof a=="string"?a:"",n[`${e}.${s.lang}`]=typeof c=="string"?c:""}return n},sA=(t,e)=>{const{default:n}=t;return typeof n!="string"?n:n.replaceAll(/{{(.+?)}}/g,(r,i)=>i==="locale"?e:i==="datetime"?new Date().toJSON().replace(/\d+\.\d+Z$/,"00.000Z"):i==="uuid"?Kr():i==="uuid_short"?Kr("short"):i==="uuid_shorter"?Kr("shorter"):"")},_H=t=>{const{default:e,required:n=!0}=t;return e&&Zn(e)?e:n?{"":""}:{}},wy=({entryDraft:t,keyPath:e,locale:n})=>Object.entries(te(t).currentValues[n]??{}).filter(([r])=>r.startsWith(`${e}.`)).map(([r,i])=>[r.replace(`${e}.`,""),i]),yH=({pairs:t,edited:e})=>t.map(([n],r,i)=>{if(!n.trim()&&e[r])return"empty";if(n.trim()&&i.findIndex(s=>s[0]===n)!==r)return"duplicate"}),wH=({entryDraft:t,keyPath:e,locale:n,fieldConfig:r,pairs:i})=>{const{i18n:s}=r;ts.set(!1),t.update(o=>(o&&Object.entries(o.currentValues).forEach(([a,c])=>{(a===n||s==="duplicate")&&(Object.entries(c).forEach(([u])=>{u.startsWith(`${e}.`)&&delete c[u]}),i.forEach(([u,d])=>{c[`${e}.${u}`]=d}))}),o)),ts.set(!0)},oA=t=>{const{prefix:e,use_b32_encoding:n}=t,r=n?Wg():Kr();return e?`${e}${r}`:r},xH=({fieldConfig:t,keyPath:e,newContent:n,value:r})=>{const{widget:i="string"}=t,s=()=>{n[e]=[],r.split(/,\s*/).forEach((o,a)=>{n[`${e}.${a}`]=o})};if(i==="boolean"){n[e]=r==="true";return}if(i==="list"){const{field:o,fields:a,types:c}=t;if(!(!!o||!!a||!!c)){s();return}}if(i==="markdown"){n[e]=tO(r);return}if(i==="number"){const{value_type:o="int"}=t;if(o==="int"||o==="float"){const a=o==="int"?Number.parseInt(r,10):Number.parseFloat(r);Number.isNaN(a)||(n[e]=a)}else n[e]=r;return}if(i==="relation"||i==="select"){const{multiple:o=!1}=t;if(o){s();return}}n[e]=r},ig=(t,e,n={})=>{const r={},i=({fieldConfig:s,keyPath:o})=>{if(o in n){xH({fieldConfig:s,keyPath:o,newContent:r,value:n[o]});return}const{widget:a="string",default:c}=s,u=Cd({fieldConfig:s,locale:e}),d=Array.isArray(c)&&!!c.length;if(a==="list"){const{fields:f,types:h}=s;if(!d){r[o]=[];return}if(f||h){c.forEach((p,g)=>{Object.entries(p).forEach(([m,v])=>{r[[o,g,m].join(".")]=v})});return}c.forEach((p,g)=>{r[[o,g].join(".")]=p});return}if(a==="object"){const{fields:f,types:h}=s;!u||Array.isArray(h)?r[o]=null:f?.forEach(p=>{i({keyPath:[o,p.name].join("."),fieldConfig:p})});return}if(a==="boolean"){r[o]=typeof c=="boolean"?c:!1;return}if(a==="code"){Object.assign(r,bH({fieldConfig:s,keyPath:o}));return}if(a==="relation"||a==="select"){const{multiple:f=!1}=s;if(f){d?c.forEach((h,p)=>{r[[o,p].join(".")]=h}):r[o]=[];return}}if(a==="datetime"){r[o]=LB(s);return}if(a==="hidden"){r[o]=sA(s,e);return}if(a==="keyvalue"){Object.entries(_H(s)).forEach(([f,h])=>{r[`${o}.${f}`]=String(h)});return}r[o]=c!==void 0?c:""};return t.forEach(s=>{i({keyPath:s.name,fieldConfig:s})}),r},xy=({draft:{collectionName:t,fileName:e},locale:n,target:r={},getValueMap:i=void 0})=>{const s=$i(t),o=e?s?._fileMap[e]:void 0;if(!s||e&&!o)return;const{defaultLocale:a,canonicalSlug:{key:c}}=(o??s)._i18n;return new Proxy(r,{set:(u,d,f)=>{if(u[d]!==f&&(u[d]=f),[c].includes(d))return!0;const h=typeof i=="function"?i():u,p=pn({collectionName:t,fileName:e,valueMap:h,keyPath:d});if(!p)return!0;const g=te(Ze)?.validities?.[n]?.[d];return g&&typeof f=="string"&&Cd({fieldConfig:p,locale:n})&&(g.valueMissing=!f),te(ts)&&p.i18n==="duplicate"&&n===a&&Object.entries(te(Ze).currentValues).forEach(([m,v])=>{if(d.includes(".")){const{path:y}=d.match(/(?<path>.+?)\.[^.]*$/)?.groups??{};if(!Object.keys(v).some(b=>b.startsWith(`${y}.`))&&!pn({collectionName:t,fileName:e,valueMap:h,keyPath:y}))return}if(p.widget==="relation"){const{value_field:y}=p;y.startsWith("{{locale}}/")&&(f=f.replace(new RegExp(`^${n}/`),`${m}/`))}m!==n&&v[d]!==f&&(v[d]=f)}),!0}})},Fd=({collection:t,collectionFile:e,originalEntry:n={},dynamicValues:r,expanderStates:i})=>{const s=t.name,o=e?.name,{id:a,slug:c,locales:u}=n,d=a===void 0,{fields:f=[],_i18n:h}=e??t,{allLocales:p,initialLocales:g,defaultLocale:m,canonicalSlug:{key:v="translationKey"}}=h,y=d?g:p.filter(k=>!!u?.[k]?.content),b=Object.fromEntries(p.map(k=>[k,y.includes(k)])),w=d?{}:v in(u?.[m]?.content??{})?Object.fromEntries(p.map(k=>[k,u?.[k]?.slug])):{_:u?.[m].slug},x=Object.fromEntries(y.map(k=>d?[k,ig(f,k,r)]:[k,structuredClone(u?.[k]?.content)]));Ze.set({isNew:d&&!o,collectionName:s,collection:t,fileName:o,collectionFile:e,originalEntry:d?void 0:n,originalLocales:b,currentLocales:structuredClone(b),originalSlugs:w,currentSlugs:structuredClone(w),originalValues:x,currentValues:Object.fromEntries(y.map(k=>[k,xy({draft:{collectionName:s,fileName:o},locale:k,target:structuredClone(x[k])})])),files:{},validities:Object.fromEntries(p.map(k=>[k,{}])),expanderStates:i??{_:{}}}),EH({collectionName:s,fileName:o,slug:c})},kH=()=>{const t=te(Ze),{collectionName:e,fileName:n,collection:r,collectionFile:i,currentValues:s,validities:o}=t,{defaultLocale:a}=(i??r)._i18n,{canonicalSlug:{key:c}}=(i??r)._i18n;Object.entries(s).forEach(([u,d])=>{delete d[c],Object.keys(d).forEach(f=>{const h=pn({collectionName:e,fileName:n,valueMap:d,keyPath:f});if(h?.widget==="uuid"&&(u===a||[!0,"translate"].includes(h?.i18n??!1))&&(d[f]=oA(h)),h?.widget==="hidden"){if(Array.isArray(h.default)&&f.match(/\.\d+$/)&&(delete d[f],f=f.replace(/\.\d+$/,""),f in d))return;(u===a||[!0,"translate"].includes(h?.i18n??!1))&&(d[f]=sA(h,u))}})}),Object.keys(o).forEach(u=>{o[u]={}}),Ze.set({...t,isNew:!0,originalEntry:void 0,originalSlugs:{},currentSlugs:{}}),gy.set(!0)};let aA=0,el;const lA={saved:!1,restored:!1,deleted:!1},sg=et({show:!1}),Yo=et({...lA}),og=async(t,e="")=>{await el?.delete([t,e])},ky=async(t,e="")=>{const n=await el?.get([t,e]);return n?n.siteConfigVersion===te(Q_)?n:(await og(t,e),null):null},SH=async t=>{const{collectionName:e,originalEntry:n,currentLocales:r={},currentSlugs:i={},currentValues:s={},files:o}=t,a=n?.slug||"";if(te(ZC)){const c={timestamp:new Date,siteConfigVersion:te(Q_),collectionName:e,slug:a,currentLocales:r,currentSlugs:Ql(i),currentValues:Ql(s),files:o};await el?.put(c)}else await ky(e,a)&&await og(e,a)},EH=async({collectionName:t,fileName:e,slug:n=""})=>{const r=await ky(t,n);if(!r)return;const{timestamp:i,currentLocales:s,currentSlugs:o,currentValues:a,files:c}=r,u=await new Promise(d=>{sg.set({show:!0,timestamp:i,resolve:d})});u!==void 0&&(u?(ts.set(!1),Ze.update(d=>(d&&(d.currentLocales=s,d.currentSlugs=o,Object.entries(a).forEach(([f,h])=>{Object.entries(h).forEach(([p,g])=>{typeof g=="string"&&[...g.matchAll(zw("g"))].forEach(([m])=>{const v=c[m];if(v instanceof File){const y=URL.createObjectURL(v);h[p]=g.replaceAll(m,y),d.files[y]=v}})}),d.currentValues[f]?Object.assign(d.currentValues[f],h):d.currentValues[f]=xy({draft:{collectionName:t,fileName:e},locale:f,target:structuredClone(h)}),d.originalValues[f]||(d.originalValues[f]={})})),d)),ts.set(!0)):await og(t,n),Yo.set({restored:u,deleted:!u,saved:!1}))},TH=async()=>{const t=te(Ze);if(!t||te(Yo).saved)return;const{collectionName:e,originalEntry:n}=t;await ky(e,n?.slug)&&Yo.set({restored:!1,deleted:!1,saved:!0})},CH=()=>{Yo.set({...lA})};Ln.subscribe(t=>{if(t&&!el){const{databaseName:e}=t.repository??{};if(e){el=new Mo(e,"draft-backups",{keyPath:["collectionName","slug"]});return}}el=null}),Ze.subscribe(t=>{globalThis.clearTimeout(aA),t&&el&&(aA=globalThis.setTimeout(()=>{SH(t)},500))});const cA=(t,e)=>{const{minlength:n,maxlength:r}=t,i=Number.isInteger(n)&&n<=(r??1/0),s=Number.isInteger(r)&&(n??0)<=r,o=e?[...e.trim()].length:0,a=i&&o<n,c=s&&o>r;return{count:o,hasMin:i,hasMax:s,tooShort:a,tooLong:c,invalid:a||c}},AH=/^\/?(?<pattern>.+?)(?:\/(?<flags>[dgimsuvy]*))?$/,PH=()=>{const{collection:t,collectionFile:e,fileName:n,currentLocales:r,currentValues:i,files:s,validities:o}=te(Ze),{i18nEnabled:a,defaultLocale:c}=(e??t)._i18n;let u=!0;return Object.entries(i).forEach(([d,f])=>{const h=Object.entries(f);if(!r[d]){o[d]=Object.fromEntries(h.map(([g])=>[g,{valid:!0}]));return}o[d]={};const p=(g,m)=>{const v=pn({collectionName:t.name,fileName:n,valueMap:f,keyPath:g});if(!v)return;const{widget:y="string",i18n:b=!1,pattern:w}=v,x=Cd({fieldConfig:v,locale:d});if(d!==c&&(!a||b===!1||b==="none"||b==="duplicate"))return;if(!["select","relation"].includes(y)&&/\.\d+$/.test(g)){const q=g.replace(/\.\d+$/,"");if(q in o[d]||p(q,void 0),y==="list"){const{field:G,fields:V,types:Y}=v;if(!G&&!V&&!Y)return}}const{multiple:k=!1}=v,{min:S,max:C}=v;let E=!1,A=!1,P=!1,I=!1,L=!1,N=!1,M=!1;if(y==="list"){if(g in o[d])return;const q=new RegExp(`^${on(g)}\\.\\d+$`),G=Array.isArray(m)&&m.length?m:h.filter(([V])=>q.test(V)).map(([,V])=>V).filter(V=>V!==void 0)??[];x&&!G.length?E=!0:typeof S=="number"&&G.length<S?I=!0:typeof C=="number"&&G.length>C&&(L=!0)}if(y==="object"&&x&&!m&&(E=!0),y==="keyvalue"){const q=g.match(/(.+?)(?:\.[^.]*)?$/)?.[1],G=pn({collectionName:t.name,fileName:n,valueMap:f,keyPath:q});if(q in o[d]||G?.widget!=="keyvalue")return;g=q;const Y=wy({entryDraft:Ze,keyPath:q,locale:d});x&&!Y.length?E=!0:typeof S=="number"&&Y.length<S?I=!0:typeof C=="number"&&Y.length>C&&(L=!0)}if(!["object","list","hidden","compute","keyvalue"].includes(y)){if(y==="code"){const{output_code_only:q=!1,keys:G={code:"code",lang:"lang"}}=v,V=g.match(`(.+)\\.(?:${G.code}|${G.lang})$`)?.[1]??"";if(V&&(g=V),g in o[d])return;q||(m=f[`${g}.${G.code}`])}if(["file","image"].includes(y)&&typeof m=="string"&&m.startsWith("blob:")&&(m=s[m]?.name),typeof m=="string"&&(m=m.trim()),x&&(m==null||m===""||k&&!m.length)&&(E=!0),Array.isArray(w)&&typeof w[0]=="string"){const{pattern:q,flags:G}=w[0].match(AH)?.groups??{},V=new RegExp(q,G);q&&!V.test(String(m))&&(N=!0)}if(["string","text"].includes(y)&&({tooShort:A,tooLong:P}=cA(v,m)),y==="string"&&m){const{type:q="text"}=v;if(q!=="text"){const G=document.createElement("input");G.type=q,G.value=m,{typeMismatch:M}=G.validity}q==="email"&&!M&&!m.split("@")[1]?.includes(".")&&(M=!0)}if(y==="number"){const{value_type:q="int"}=v;typeof S=="number"&&m!==null&&Number(m)<S?I=!0:typeof C=="number"&&m!==null&&Number(m)>C&&(L=!0),(q==="int"||q==="float")&&x&&m===null&&(M=!0)}}const H=new Proxy({valueMissing:E,tooShort:A,tooLong:P,rangeUnderflow:I,rangeOverflow:L,patternMismatch:N,typeMismatch:M},{get:(q,G)=>G==="valid"?!Object.values(q).some(Boolean):q[G]});o[d][g]=H,H.valid||(u=!1)};h.forEach(([g,m])=>{p(g,m)})}),Ze.update(d=>({...d,validities:o})),u},uA=(t,e=te(mt)?.output?.json??{})=>{const{indent_style:n="space",indent_size:r=n==="tab"?1:2}=e;return JSON.stringify(t,null,n==="tab"?" ".repeat(r):r).trim()},dA=t=>Rq(t).trim(),fA=(t,e=te(mt)?.output?.yaml??{},n={})=>{const{indent_size:r=2,quote:i="none"}=e,{quote:s=!1}=n;return pd.stringify(t,null,{indent:r,lineWidth:0,defaultKeyType:"PLAIN",defaultStringType:s||i==="double"?"QUOTE_DOUBLE":i==="single"?"QUOTE_SINGLE":"PLAIN",singleQuote:!(s||i==="double")}).trim()},hA=async({content:t,_file:e})=>{const{format:n,fmDelimiters:r,yamlQuote:i=!1}=e,s=bf[n]?.formatter;if(s)return`${(await s(t)).trim()}
|
|
566
566
|
`;try{if(/^ya?ml$/.test(n))return`${fA(t,void 0,{quote:i})}
|