@sveltia/cms 0.3.5 → 0.3.6
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/README.md +1 -1
- package/dist/sveltia-cms.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ While recreating all the features found in Netlify/Decap CMS is not our goal, we
|
|
|
92
92
|
| File/Image | The `media_library` options are not yet supported other than `max_file_size` and `choose_url`. |
|
|
93
93
|
| Map | Not yet supported. |
|
|
94
94
|
| Markdown | It’s a plain text editor at this time. We’ll soon implement a rich text editor with i18n issues addressed. |
|
|
95
|
-
| Relation | The `search_fields`
|
|
95
|
+
| Relation | The `search_fields` options is not yet supported. The `options_length` option will be ignored because it confuses users and Sveltia CMS doesn’t have the search performance issue. |
|
|
96
96
|
|
|
97
97
|
### Beta features in Netlify/Decap CMS
|
|
98
98
|
|
package/dist/sveltia-cms.js
CHANGED
|
@@ -214,7 +214,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
214
214
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
215
215
|
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var n;const r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){const s="end"in r.value?r.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){const s=e.items[e.items.length-2],i=(n=s==null?void 0:s.value)==null?void 0:n.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const s=!this.onKeyLine&&this.indent===e.indent&&r.sep;let i=[];if(s&&r.sep&&!r.value){const l=[];for(let o=0;o<r.sep.length;++o){const a=r.sep[o];switch(a.type){case"newline":l.push(o);break;case"space":break;case"comment":a.indent>e.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(i=r.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":s||r.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!Zn(r.start,"explicit-key-ind")?r.start.push(this.sourceToken):s||r.value?(i.push(this.sourceToken),e.items.push({start:i})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(Zn(r.start,"explicit-key-ind"))if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Zn(r.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(U0(r.key)&&!Zn(r.sep,"newline")){const l=hi(r.start),o=r.key,a=r.sep;a.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:o,sep:a}]})}else i.length>0?r.sep=r.sep.concat(i,this.sourceToken):r.sep.push(this.sourceToken);else if(Zn(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{const l=hi(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Zn(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const l=this.flowScalar(this.type);s||r.value?(e.items.push({start:i,key:l,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(l):(Object.assign(r,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(e);if(l){s&&l.type!=="block-seq"&&Zn(r.start,"explicit-key-ind")&&e.items.push({start:i}),this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var n;const r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){const s="end"in r.value?r.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){const s=e.items[e.items.length-2],i=(n=s==null?void 0:s.value)==null?void 0:n.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Zn(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){const s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:s,sep:[]}):r.sep?this.stack.push(s):Object.assign(r,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const s=To(n),i=hi(s);Wm(e);const l=e.end.splice(1,e.end.length);l.push(this.sourceToken);const o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:l}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
|
|
216
216
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
217
|
-
`,r)+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;const r=To(e),n=hi(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;const r=To(e),n=hi(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.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;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function B0(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new F0||null,prettyErrors:e}}function r4(t,e={}){const{lineCounter:r,prettyErrors:n}=B0(e),s=new od(r==null?void 0:r.addNewLine),i=new ld(e),l=Array.from(i.compose(s.parse(t)));if(n&&r)for(const o of l)o.errors.forEach(ia(t,r)),o.warnings.forEach(ia(t,r));return l.length>0?l:Object.assign([],{empty:!0},i.streamInfo())}function z0(t,e={}){const{lineCounter:r,prettyErrors:n}=B0(e),s=new od(r==null?void 0:r.addNewLine),i=new ld(e);let l=null;for(const o of i.compose(s.parse(t),!0,t.length))if(!l)l=o;else if(l.options.logLevel!=="silent"){l.errors.push(new Ds(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(l.errors.forEach(ia(t,r)),l.warnings.forEach(ia(t,r))),l}function s4(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);const s=z0(t,r);if(!s)return null;if(s.warnings.forEach(i=>a0(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:n},r))}function i4(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){const s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(t===void 0){const{keepUndefined:s}=r??e??{};if(!s)return}return new sl(t,n,r).toString(r)}const qi=Object.freeze(Object.defineProperty({__proto__:null,Alias:Ya,CST:e4,Composer:ld,Document:sl,Lexer:j0,LineCounter:F0,Pair:Xt,Parser:od,Scalar:Ue,Schema:ec,YAMLError:sd,YAMLMap:Rn,YAMLParseError:Ds,YAMLSeq:xs,YAMLWarning:T0,isAlias:Js,isCollection:Et,isDocument:no,isMap:Qs,isNode:Nt,isPair:vt,isScalar:pt,isSeq:tl,parse:s4,parseAllDocuments:r4,parseDocument:z0,stringify:i4,visit:_s,visitAsync:Va},Symbol.toStringTag,{value:"Module"})),qm=["image","video","audio","document","other"],Zu={image:/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff|webp)$/i,video:/\.(?:avi|mp4|mpeg|ogv|ts|webm|3gp|3g2)$/i,audio:/\.(?:aac|midi?|mp3|opus|wav|weba)$/i,document:/\.(?:csv|docx?|odp|ods|odt|pdf|pptx?|rtf|xslx?)$/i},zn=Ce([]),gr=Ce([]),Jn=Ce(),us=Ce([]),Ys=Ce(),jn=Ce({folder:null,files:[]}),l4=bn([jn],([t],e)=>{var r;e(!!((r=t.files)!=null&&r.length))}),o4=t=>re(gr).findLast(e=>[null,t].includes(e.collectionName)),ad=t=>{var e;return((e=Object.entries(Zu).find(([,r])=>t.match(r)))==null?void 0:e[0])||"other"},sc=t=>{const[,e,r]=t.match(/(.+?)\/([^/]+)$/)||[];if(!e)return null;const{internalPath:n}=re(gr).findLast(s=>s.publicPath===e)||{};return n?re(zn).find(s=>s.path===`${n}/${r}`):null},gs=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),H0=(t=1e3)=>new Promise(e=>{window.setTimeout(()=>{e()},t)}),Xu=Ce(!1),cd=Ce([]),br=Ce([]),Tt=Ce(),fs=Ce([]),a4=t=>{const e=re(ut);let r="single_file",n=[],s;t.i18n===!0&&gs(e.i18n)&&({structure:r="single_file",locales:n=[],default_locale:s=void 0}=e.i18n),gs(t.i18n)&&({structure:r="single_file",locales:n=[],default_locale:s=void 0}=t.i18n);const i=!!n.length;return{structure:r,hasLocales:i,locales:i?n:[],defaultLocale:i?s&&n.includes(s)?s:n[0]:void 0}},kr=t=>{const e=re(ut).collections.find(r=>r.name===t);return{...e,_i18n:a4(e)}},ic=t=>{const e=kr(t);if(!e)return[];const{filter:r,_i18n:n}=e,{defaultLocale:s="default"}=n;return(re(br)||[]).filter(i=>{var l;return i.collectionName===t&&(!r||((l=i.locales[s])==null?void 0:l.content[r.field])===r.value)})},ud=(t,e)=>re(br).find(r=>r.collectionName===t&&r.fileName===e),lc=(t,e,r,n)=>{const s=kr(t),{fields:i}=e?s.files.find(({name:a})=>a===e):s,l=r.split(".");let o;return l.forEach((a,c)=>{if(c===0)o=i.find(({name:u})=>u===a);else if(o){const u=a.match(/^\d+$/),{field:f,fields:d,types:h,typeKey:p="type"}=o;f?o=f:d&&!u?o=d.find(({name:g})=>g===a):h&&u&&(o=h.find(({name:g})=>g===n[`${l.slice(0,c).join(".")}.${a}.${p}`]))}}),o},Jt=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Gs=t=>t.replace(/^\//,"").replace(/\/$/,""),Cs=()=>window.crypto.randomUUID(),ut=Ce(),{DEV:V0,VITE_CONFIG_PORT:c4}={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1},u4=t=>{var e,r;if(!gs(t))throw new Error("parse_failed");if(!((e=t.collections)!=null&&e.length))throw new Error("no_collection");if(!((r=t.backend)!=null&&r.repo))throw new Error("no_backend");if(!t.media_folder)throw new Error("no_media_folder")},f4=async()=>{const{href:t="
|
|
217
|
+
`,r)+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;const r=To(e),n=hi(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;const r=To(e),n=hi(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.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;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function B0(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new F0||null,prettyErrors:e}}function r4(t,e={}){const{lineCounter:r,prettyErrors:n}=B0(e),s=new od(r==null?void 0:r.addNewLine),i=new ld(e),l=Array.from(i.compose(s.parse(t)));if(n&&r)for(const o of l)o.errors.forEach(ia(t,r)),o.warnings.forEach(ia(t,r));return l.length>0?l:Object.assign([],{empty:!0},i.streamInfo())}function z0(t,e={}){const{lineCounter:r,prettyErrors:n}=B0(e),s=new od(r==null?void 0:r.addNewLine),i=new ld(e);let l=null;for(const o of i.compose(s.parse(t),!0,t.length))if(!l)l=o;else if(l.options.logLevel!=="silent"){l.errors.push(new Ds(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(l.errors.forEach(ia(t,r)),l.warnings.forEach(ia(t,r))),l}function s4(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);const s=z0(t,r);if(!s)return null;if(s.warnings.forEach(i=>a0(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:n},r))}function i4(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){const s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(t===void 0){const{keepUndefined:s}=r??e??{};if(!s)return}return new sl(t,n,r).toString(r)}const qi=Object.freeze(Object.defineProperty({__proto__:null,Alias:Ya,CST:e4,Composer:ld,Document:sl,Lexer:j0,LineCounter:F0,Pair:Xt,Parser:od,Scalar:Ue,Schema:ec,YAMLError:sd,YAMLMap:Rn,YAMLParseError:Ds,YAMLSeq:xs,YAMLWarning:T0,isAlias:Js,isCollection:Et,isDocument:no,isMap:Qs,isNode:Nt,isPair:vt,isScalar:pt,isSeq:tl,parse:s4,parseAllDocuments:r4,parseDocument:z0,stringify:i4,visit:_s,visitAsync:Va},Symbol.toStringTag,{value:"Module"})),qm=["image","video","audio","document","other"],Zu={image:/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff|webp)$/i,video:/\.(?:avi|mp4|mpeg|ogv|ts|webm|3gp|3g2)$/i,audio:/\.(?:aac|midi?|mp3|opus|wav|weba)$/i,document:/\.(?:csv|docx?|odp|ods|odt|pdf|pptx?|rtf|xslx?)$/i},zn=Ce([]),gr=Ce([]),Jn=Ce(),us=Ce([]),Ys=Ce(),jn=Ce({folder:null,files:[]}),l4=bn([jn],([t],e)=>{var r;e(!!((r=t.files)!=null&&r.length))}),o4=t=>re(gr).findLast(e=>[null,t].includes(e.collectionName)),ad=t=>{var e;return((e=Object.entries(Zu).find(([,r])=>t.match(r)))==null?void 0:e[0])||"other"},sc=t=>{const[,e,r]=t.match(/(.+?)\/([^/]+)$/)||[];if(!e)return null;const{internalPath:n}=re(gr).findLast(s=>s.publicPath===e)||{};return n?re(zn).find(s=>s.path===`${n}/${r}`):null},gs=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),H0=(t=1e3)=>new Promise(e=>{window.setTimeout(()=>{e()},t)}),Xu=Ce(!1),cd=Ce([]),br=Ce([]),Tt=Ce(),fs=Ce([]),a4=t=>{const e=re(ut);let r="single_file",n=[],s;(t==null?void 0:t.i18n)===!0&&gs(e==null?void 0:e.i18n)&&({structure:r="single_file",locales:n=[],default_locale:s=void 0}=e.i18n),gs(t==null?void 0:t.i18n)&&({structure:r="single_file",locales:n=[],default_locale:s=void 0}=t.i18n);const i=!!n.length;return{structure:r,hasLocales:i,locales:i?n:[],defaultLocale:i?s&&n.includes(s)?s:n[0]:void 0}},kr=t=>{const e=re(ut).collections.find(r=>r.name===t);return{...e,_i18n:a4(e)}},ic=t=>{const e=kr(t);if(!e)return[];const{filter:r,_i18n:n}=e,{defaultLocale:s="default"}=n;return(re(br)||[]).filter(i=>{var l;return i.collectionName===t&&(!r||((l=i.locales[s])==null?void 0:l.content[r.field])===r.value)})},ud=(t,e)=>re(br).find(r=>r.collectionName===t&&r.fileName===e),lc=(t,e,r,n)=>{const s=kr(t),{fields:i}=e?s.files.find(({name:a})=>a===e):s,l=r.split(".");let o;return l.forEach((a,c)=>{if(c===0)o=i.find(({name:u})=>u===a);else if(o){const u=a.match(/^\d+$/),{field:f,fields:d,types:h,typeKey:p="type"}=o;f?o=f:d&&!u?o=d.find(({name:g})=>g===a):h&&u&&(o=h.find(({name:g})=>g===n[`${l.slice(0,c).join(".")}.${a}.${p}`]))}}),o},Jt=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Gs=t=>t.replace(/^\//,"").replace(/\/$/,""),Cs=()=>window.crypto.randomUUID(),ut=Ce(),{DEV:V0,VITE_CONFIG_PORT:c4}={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1},u4=t=>{var e,r;if(!gs(t))throw new Error("parse_failed");if(!((e=t.collections)!=null&&e.length))throw new Error("no_collection");if(!((r=t.backend)!=null&&r.repo))throw new Error("no_backend");if(!t.media_folder)throw new Error("no_media_folder")},f4=async()=>{const{href:t="./config.yml"}=document.querySelector('link[type="text/yaml"][rel="cms-config-url"]')||{};let e,r;try{try{e=await fetch(t)}catch{throw new Error("fetch_failed")}if(!e.ok)throw new Error("fetch_failed");try{r=qi.parse(await e.text())}catch{throw new Error("parse_failed")}u4(r),V0&&!r.site_url&&(r.site_url=`http://localhost:${c4||5174}`),ut.set(r)}catch(n){ut.set({error:n.message}),console.error(n)}};ut.subscribe(t=>{if(V0&&console.info("siteConfig",t),!t||t.error)return;const{media_folder:e,public_folder:r,collections:n}=t,s=Gs(e);Tt.set(kr(n[0].name)),cd.set([...n.filter(({folder:i})=>!!i).map(({name:i,folder:l,extension:o,format:a,frontmatter_delimiter:c})=>({collectionName:i,folder:l,extension:o,format:a,frontmatterDelimiter:c})),...n.filter(({files:i})=>!!i).map(({name:i,files:l})=>l.map(({name:o,file:a,extension:c,format:u,frontmatter_delimiter:f})=>({collectionName:i,fileName:o,file:a,extension:c,format:u,frontmatterDelimiter:f}))).flat(1)]),gr.set([{collectionName:null,internalPath:s,publicPath:r||`/${s}`},...n.filter(i=>{var l;return((l=i.media_folder)==null?void 0:l.startsWith("/"))&&i.public_folder}).map(i=>({collectionName:i.name,internalPath:Gs(i.media_folder),publicPath:i.public_folder}))].sort((i,l)=>i.internalPath.localeCompare(l.internalPath)))});const cn=Ce(),d4=async t=>{const{site_domain:e=document.domain,base_url:r="https://api.netlify.com",auth_endpoint:n="auth"}=re(ut).backend,s=600,i=800,{availHeight:l,availWidth:o}=window.screen,a=l/2-i/2,c=o/2-s/2,u=window.open(`${r}/${n}?provider=${t}&site_id=${e}&scope=repo`,"auth",`width=${s},height=${i},top=${a},left=${c}`);return new Promise(f=>{const d=({origin:h,data:p})=>{if(h!==r||typeof p!="string")return;if(p===`authorizing:${t}`){u.postMessage(p,h);return}const[,g,y]=p.match(new RegExp(`^authorization:${t}:(success|error):(.+)`))||[];let b;try{b=y?JSON.parse(y):void 0}catch{}f(g==="success"&&gs(b)&&typeof b.token=="string"?b.token:null),window.removeEventListener("message",d),u.close()};window.addEventListener("message",d)})},h4="1.38.0",_e=SyntaxError,Mt=RangeError,Fe=TypeError,Gt=Error,an=void 0,Gr=typeof BigInt>"u"?an:BigInt,fd=RegExp,dd=WeakMap,Y0=WeakMap.prototype.get,G0=WeakMap.prototype.set,Sn=Object.create,Ti=Number.isSafeInteger,Pr=Object.getOwnPropertyNames,An=Object.freeze,W0=Object.prototype.isPrototypeOf,pn=Object.seal?Object.preventExtensions(Object.create(null)):null,Ki=Function.prototype.bind,Km=RegExp.prototype.test,Zm=RegExp.prototype.exec,hd=Reflect.apply,Ju=Proxy,Xm=typeof Symbol>"u"?an:Symbol.toStringTag,q0=Object.defineProperty,ds=Object.assign,md=Object,m4=Math.floor,Fs=Array.isArray,Zi=1/0,pd=String.fromCharCode,oa=Array,Oo=Object.prototype.hasOwnProperty,Jm=Object.prototype.propertyIsEnumerable,bs=Function.prototype.apply;var K0=Jm.call.bind(Jm),ts=md.hasOwn||function(){return Oo.bind?Oo.call.bind(Oo):function(e,r){return Oo.call(e,r)}}(),Z0=md.create;function Qm(t){var e=Z0(pn);return ts(t,"value")&&(e.value=t.value),ts(t,"writable")&&(e.writable=t.writable),ts(t,"get")&&(e.get=t.get),ts(t,"set")&&(e.set=t.set),ts(t,"enumerable")&&(e.enumerable=t.enumerable),ts(t,"configurable")&&(e.configurable=t.configurable),e}const p4=function(e,r){if(!r&&typeof e!="function"&&(r=e,e=Sn(pn)),ds)ds(e,r);else for(var n in r)ts(r,n)&&(e[n]=r[n]);if(e.default=e,typeof e=="function")e.prototype&&An(e.prototype);else if(Xm){var s=Sn(pn);s.value="Module",q0(e,Xm,s)}return An(e)};/*!@preserve@license
|
|
218
218
|
* 模块名称:j-regexp
|
|
219
219
|
* 模块功能:可读性更好的正则表达式创建方式。从属于“简计划”。
|
|
220
220
|
More readable way for creating RegExp. Belong to "Plan J".
|