prismic 1.28.0 → 1.29.0-canary.f62318f

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.
@@ -0,0 +1,197 @@
1
+ import{n as e}from"./package-gU5uHUvG.mjs";import{$ as t,A as n,B as r,D as i,F as a,G as o,H as s,I as c,J as l,K as u,L as d,N as f,O as p,P as m,Q as h,R as g,S as _,T as v,U as ee,V as y,W as b,X as x,Y as S,Z as C,_ as w,a as T,at as E,b as D,et as O,g as te,h as ne,it as k,j as A,l as re,m as j,nt as M,ot as N,p as P,q as F,r as ie,rt as I,t as L,tt as R,w as z,y as B,z as V}from"./packageJson-BEVwXn1i.mjs";import{i as H,r as ae,t as oe}from"./segment-v-IVuJMx.mjs";import{parseArgs as U}from"node:util";import{chmod as se,lstat as W,mkdir as ce,open as le,readFile as ue,realpath as de,rename as fe,rm as pe,stat as me,utimes as he,writeFile as ge}from"node:fs/promises";import{sep as _e}from"node:path";import{fileURLToPath as ve,pathToFileURL as ye}from"node:url";import*as be from"node:crypto";import{createCipheriv as xe,createDecipheriv as Se,createHash as Ce,randomBytes as we,randomUUID as Te}from"node:crypto";import*as Ee from"fs";import{readdir as De,readdirSync as Oe,realpath as ke,realpathSync as Ae,stat as je,statSync as Me}from"fs";import{basename as Ne,dirname as Pe,isAbsolute as Fe,normalize as Ie,posix as Le,relative as Re,resolve as ze,sep as Be}from"path";import{fileURLToPath as Ve}from"url";import{createRequire as He}from"module";import{homedir as Ue,hostname as We,release as Ge}from"node:os";import{setTimeout as Ke}from"node:timers/promises";import{constants as qe,existsSync as Je}from"node:fs";import{exec as Ye,spawn as Xe}from"node:child_process";var Ze=Object.create,Qe=Object.defineProperty,$e=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,tt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty,rt=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),it=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=et(t),a=0,o=i.length,s;a<o;a++)s=i[a],!nt.call(e,s)&&s!==n&&Qe(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=$e(t,s))||r.enumerable});return e},at=(e,t,n)=>(n=e==null?{}:Ze(tt(e)),it(t||!e||!e.__esModule||!nt.call(e,`default`)?Qe(n,`default`,{value:e,enumerable:!0}):n,e));const ot=/([\p{Ll}\d])(\p{Lu})/gu,st=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,ct=/(\d)\p{Ll}|(\p{L})\d/u,lt=/[^\p{L}\d]+/giu,ut=`$1\0$2`;function dt(e){let t=e.trim();t=t.replace(ot,ut).replace(st,ut),t=t.replace(lt,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}function ft(e){let t=dt(e);for(let e=0;e<t.length;e++){let n=t[e],r=ct.exec(n);if(r){let i=r.index+(r[1]??r[2]).length;t.splice(e,1,n.slice(0,i),n.slice(i))}}return t}function pt(e,t){let[n,r,i]=St(e,t);return n+r.map(vt(t?.locale)).join(t?.delimiter??` `)+i}function mt(e,t){let[n,r,i]=St(e,t),a=vt(t?.locale),o=yt(t?.locale),s=t?.mergeAmbiguousCharacters?bt(a,o):xt(a,o);return n+r.map((e,t)=>t===0?a(e):s(e,t)).join(t?.delimiter??``)+i}function ht(e,t){let[n,r,i]=St(e,t),a=vt(t?.locale),o=yt(t?.locale),s=t?.mergeAmbiguousCharacters?bt(a,o):xt(a,o);return n+r.map(s).join(t?.delimiter??``)+i}function gt(e,t){let[n,r,i]=St(e,t),a=vt(t?.locale),o=yt(t?.locale);return n+r.map(bt(a,o)).join(t?.delimiter??` `)+i}function _t(e,t){return pt(e,{delimiter:`_`,...t})}function vt(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function yt(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function bt(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function xt(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function St(e,t={}){let n=t.split??(t.separateNumbers?ft:dt),r=t.prefixCharacters??``,i=t.suffixCharacters??``,a=0,o=e.length;for(;a<e.length;){let t=e.charAt(a);if(!r.includes(t))break;a++}for(;o>a;){let t=o-1,n=e.charAt(t);if(!i.includes(n))break;o=t}return[e.slice(0,a),n(e.slice(a,o)),e.slice(o)]}function Ct(e,t){return(!e||e.endsWith(`
2
+ `))&&!t?.force?e:e+`
3
+ `}function G(e,t){return Ct(t)+e}function wt(e,t){return(!e||e.endsWith(`
4
+
5
+ `))&&!t?.force?e:Ct(e)+`
6
+ `}function K(e,t){return wt(t)+e}function Tt(e){return e.filter(Boolean).join(` | `)||`never`}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Et(Object(n),!0).forEach(function(t){Ot(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ot(e,t,n){return t=kt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kt(e){var t=At(e,`string`);return typeof t==`symbol`?t:String(t)}function At(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}const jt=Mt({});function Mt(e){return t.withOptions=t=>Mt(Dt(Dt({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?Nt(n[e],s):n[e];s+=t}}let c=s.split(`
7
+ `),l=null;for(let e of c){let t=e.match(/^(\s+)\S+/);if(t){let e=t[1].length;l=l?Math.min(l,e):e}}if(l!==null){let e=l;s=c.map(t=>t[0]===` `||t[0]===` `?t.slice(e):t).join(`
8
+ `)}return o&&(s=s.trim()),a&&(s=s.replace(/\\n/g,`
9
+ `).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\v/g,`\v`).replace(/\\b/g,`\b`).replace(/\\f/g,`\f`).replace(/\\0/g,`\0`).replace(/\\x([\da-fA-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/\\u([\da-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function Nt(e,t){if(typeof e!=`string`||!e.includes(`
10
+ `))return e;let n=t.slice(t.lastIndexOf(`
11
+ `)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}const Pt=jt.withOptions({alignValues:!0}),q=(e,...t)=>{let n=Array.from(e);return Pt(Object.assign(n,{raw:n}),...t)},Ft=`https://prismic.io/docs/slices`,It={UID:`https://prismic.io/docs/fields/uid`,Boolean:`https://prismic.io/docs/fields/boolean`,Color:`https://prismic.io/docs/fields/color`,Date:`https://prismic.io/docs/fields/date`,Timestamp:`https://prismic.io/docs/fields/timestamp`,Number:`https://prismic.io/docs/fields/number`,Text:`https://prismic.io/docs/fields/text`,Select:`https://prismic.io/docs/fields/select`,StructuredText:`https://prismic.io/docs/fields/rich-text`,Image:`https://prismic.io/docs/fields/image`,Link:{contentRelationship:`https://prismic.io/docs/fields/content-relationship`,link:`https://prismic.io/docs/fields/link`,linkToMedia:`https://prismic.io/docs/fields/link-to-media`},Embed:`https://prismic.io/docs/fields/embed`,GeoPoint:`https://prismic.io/docs/fields/geopoint`,Table:`https://prismic.io/docs/fields/table`,Group:`https://prismic.io/docs/fields/repeatable-group`,IntegrationFields:`https://prismic.io/docs/fields/integration`,Slices:`https://prismic.io/docs/slices`,Choice:`https://prismic.io/docs/slices`},J=(...e)=>{let t=ht(e.filter(Boolean).join(` `).replace(/[^A-Z0-9]+/gi,` `),{mergeAmbiguousCharacters:!0});return/^[0-9]/.test(t)&&(t=`_${t}`),t},Lt=e=>{if(`json`in e.model)return e.model.label||e.model.id;if(`type`in e.model&&e.model.type===`SharedSlice`)return e.model.name;if(`type`in e.model&&e.model.type===`Slice`)return e.model.fieldset||e.name;if(`type`in e.model){if(e.model.config&&`label`in e.model.config)return e.model.config.label||e.name;if(e.model.config&&`fieldset`in e.model)return e.model.fieldset||e.name}return`\`${e.name}\``};function Rt(e){return e.path.map(e=>e.label?e.label:e.model?Lt({model:e.model,name:e.name}):e.name).join(` → `)}function zt(e){let t=``;for(let n=0;n<e.path.length;n++){n>0&&(t+=`.`);let r=e.path[n];if(r.model&&`type`in r.model&&(r.model.type===`Group`||r.model.type===`Slices`))t+=`${r.name}[]`;else{if(r.name===`items`){let i=e.path[n-1];if(i.model&&`json`in i.model||i.model&&`type`in i.model&&i.model.type===`SharedSlice`){t+=`${r.name}[]`;continue}}t+=r.name}}return t}function Bt(e){switch(e.field.type){case`StructuredText`:return`Rich Text`;case`IntegrationFields`:{let t=e.field.config?.catalog;return`Integration Fields (Catalog: ${t?`\`${t}\``:`*unknown*`})`}case`Link`:switch(e.field.config?.select){case`document`:return`Content Relationship`;case`media`:return`Link to Media`;default:return`Link`}case`Slices`:return`Slice Zone`;default:return e.field.type}}function Vt(e){switch(e.field.type){case`Link`:{let t=It.Link;switch(e.field.config?.select){case`document`:return t.contentRelationship;case`media`:return t.linkToMedia;default:return t.link}}default:{let t=It[e.field.type];if(typeof t==`string`)return t}}}function Ht(e){let t=`/**`,n=Lt({model:e.field,name:e.name}),r=Rt({path:e.path}),i=Bt({field:e.field});t=G(` * ${n} field in *${r}*`,t),t=G(` *`,t),t=G(` * - **Field Type**: ${i}`,t),t=G(` * - **Placeholder**: ${e.field.config&&`placeholder`in e.field.config&&e.field.config.placeholder||`*None*`}`,t);let a=e.field.config&&`default_value`in e.field.config?e.field.config.default_value:void 0;a!==void 0&&(t=G(` * - **Default Value**: ${typeof a==`boolean`?`${a}`:a}`,t)),t=G(` * - **API ID Path**: ${zt({path:[...e.path,{name:e.name,model:e.field}]})}`,t),e.tabName&&(t=G(` * - **Tab**: ${e.tabName}`,t));let o=Vt({field:e.field});return o&&(t=G(` * - **Documentation**: ${o}`,t)),t=G(` */`,t),t}const Ut={Boolean:`Boolean`,Color:`Color`,Date:`Date`,Embed:`Embed`,GeoPoint:`GeoPoint`,Group:`Group`,Image:`Image`,Integration:`IntegrationFields`,Link:`Link`,Number:`Number`,Select:`Select`,Slices:`Slices`,StructuredText:`StructuredText`,Table:`Table`,Text:`Text`,Timestamp:`Timestamp`,UID:`UID`,IntegrationFields:`IntegrationFields`,Range:`Range`,Separator:`Separator`,LegacySlices:`Choice`};function Wt(e){let t=Ht({name:e.name,field:e.field,path:e.path,tabName:e.tabName}),n=[],r=[],i=e.name.includes(`-`)||e.name.includes(`:`)||/^[0-9]/.test(e.name)?`"${e.name}"`:e.name;switch(e.field.type){case`UID`:break;case`Boolean`:t=G(`${i}: prismic.BooleanField;`,t);break;case`Color`:t=G(`${i}: prismic.ColorField;`,t);break;case`Date`:t=G(`${i}: prismic.DateField;`,t);break;case`Embed`:{let n=[];if(e.fieldConfigs.embed?.providerTypes)for(let t in e.fieldConfigs.embed?.providerTypes){let r=e.fieldConfigs.embed?.providerTypes[t];n.push(`({ provider_name: "${t}" } & ${r})`)}let r=Tt(n);t=n.length>0?G(`${i}: prismic.EmbedField<prismic.AnyOEmbed & prismic.OEmbedExtra & (${r})>`,t):G(`${i}: prismic.EmbedField`,t);break}case`GeoPoint`:t=G(`${i}: prismic.GeoPointField;`,t);break;case`Image`:t=e.field.config?.thumbnails&&e.field.config.thumbnails.length>0?G(`${i}: prismic.ImageField<${Tt(e.field.config.thumbnails.map(e=>`"${e.name}"`))}>;`,t):G(`${i}: prismic.ImageField<never>;`,t);break;case`IntegrationFields`:{let n=e.field.config?.catalog?e.fieldConfigs.integrationFields?.catalogTypes?.[e.field.config.catalog]:void 0;t=G(n?`${i}: prismic.IntegrationField<${n}>;`:`${i}: prismic.IntegrationField;`,t);break}case`Link`:{let n=e.field.config&&`variants`in e.field.config&&Array.isArray(e.field.config.variants)&&e.field.config.variants.length>0?e.field.config.variants.map(e=>`"${e.replace(/"/g,`\\"`)}"`).join(` | `):`never`;switch(e.field.config?.select){case`document`:t=`customtypes`in e.field.config&&e.field.config.customtypes&&e.field.config.customtypes.length>0?G(`${i}: ${Tt(e.field.config.customtypes.map(e=>typeof e==`string`?`prismic.ContentRelationshipField<"${e}">`:`ContentRelationshipFieldWithData<${JSON.stringify([e])}>`))};`,t):G(`${i}: prismic.ContentRelationshipField;`,t);break;case`media`:t=G(`${i}: prismic.LinkToMediaField<prismic.FieldState, ${n}>;`,t);break;default:{let r=`prismic.LinkField<string, string, unknown, prismic.FieldState, ${n}>`;e.field.config?.repeat&&(r=`prismic.Repeatable<${r}>`),t=G(`${i}: ${r};`,t);break}}break}case`Number`:t=G(`${i}: prismic.NumberField;`,t);break;case`StructuredText`:t=G(`${i}: prismic.RichTextField;`,t);break;case`Select`:{let n=e.field.config?.options?.map(e=>`"${e}"`)||[],r=n.length?Tt(n):`string`;t=e.field.config?.default_value?G(`${i}: prismic.SelectField<${r}, "filled">;`,t):G(`${i}: prismic.SelectField${n.length>0?`<${r}>`:``};`,t);break}case`Table`:t=G(`${i}: prismic.TableField;`,t);break;case`Text`:t=G(`${i}: prismic.KeyTextField;`,t);break;case`Timestamp`:t=G(`${i}: prismic.TimestampField;`,t);break;case`Group`:{let a=e.path.filter(e=>e.model!==void 0&&`type`in e.model&&e.model.type===Ut.Group),o=a.length>0,s;if(e.path[0].model&&`type`in e.path[0].model&&e.path[0].model.type===`SharedSlice`){let[t,n,r]=e.path;s=J(t.name,`Slice`,n.name,r.name,...a.map(e=>e.name),e.name,`Item`)}else s=J(e.path[0].name,`Document`,`Data`,...a.map(e=>e.name),e.name,`Item`);let c=[...e.path,{name:i,model:e.field}],l=Rt({path:c}),u=Gt({fields:e.field.config?.fields||{},fieldConfigs:e.fieldConfigs,path:c});n.push(...u.auxiliaryTypes),r.push(...u.contentTypeNames),n.push({name:s,code:q`
12
+ /**
13
+ * Item in *${l}*
14
+ */
15
+ export interface ${s} {
16
+ ${u.code}
17
+ }
18
+ `}),r.push(s),t=G(o?`${i}: prismic.NestedGroupField<Simplify<${s}>>;`:`${i}: prismic.GroupField<Simplify<${s}>>;`,t);break}case`Slices`:{let a=[];if(e.field.config?.choices)for(let t in e.field.config.choices){let i=e.field.config.choices[t];if(i.type===`SharedSlice`)a.push(J(t,`Slice`));else if(i.type===`Slice`){let o=J(e.path[0].name,`Document`,`Data`,e.name,t,`Slice`),s;if(i[`non-repeat`]&&Object.keys(i[`non-repeat`]).length>0){s=J(o,`Primary`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`primary`,label:`Primary`}],c=Rt({path:a}),l=Gt({fields:i[`non-repeat`],fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=q`
19
+ /**
20
+ * Primary content in *${c}*
21
+ */
22
+ `;u=l.code?G(q`
23
+ export interface ${s} {
24
+ ${l.code}
25
+ }
26
+ `,u):G(`export interface ${s} {}`,u),n.push({name:s,code:u}),r.push(s)}let c;if(i.repeat&&Object.keys(i.repeat).length>0){c=J(o,`Item`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`items`,label:`Items`}],s=Rt({path:a}),l=Gt({fields:i.repeat,fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=q`
27
+ /**
28
+ * Item content in *${s}*
29
+ */
30
+ `;u=l.code?G(q`
31
+ export interface ${c} {
32
+ ${l.code}
33
+ }
34
+ `,u):G(`export interface ${c} {}`,u),n.push({name:c,code:u}),r.push(c)}n.push({name:o,code:q`
35
+ /**
36
+ * Slice for *${Rt({path:[...e.path,{name:e.name,model:e.field}]})}*
37
+ */
38
+ export type ${o} = prismic.Slice<"${t}", ${s?`Simplify<${s}>`:`Record<string, never>`}, ${c?`Simplify<${c}>`:`never`}>
39
+ `}),a.push(o)}}let o=J(e.path[0].name,`Document`,`Data`,e.name,`Slice`),s=Tt(a);n.push({name:o,code:`type ${o} = ${s}`}),r.push(o),t=G(`${i}: prismic.SliceZone<${o}>;`,t);break}default:t=G(`${i}: unknown;`,t)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function Gt(e){let t=``,n=[],r=[];for(let i in e.fields){let a=e.fields[i],o=Wt({name:i,field:a,path:e.path,fieldConfigs:e.fieldConfigs,tabName:e.tabName});t=K(o.code,t),n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function Kt(e){let t=``,n=[],r=[],i=J(e.model.id,`Document`,`Data`),a=Lt({name:e.model.id,model:e.model}),o=``;for(let t in e.model.json){let{uid:i,...a}=e.model.json[t],s=Gt({fields:a,fieldConfigs:e.fieldConfigs,path:[{name:e.model.id,model:e.model}],tabName:t});o+=s.code,n.push(...s.auxiliaryTypes),r.push(...s.contentTypeNames)}return t=o?q`
40
+ /**
41
+ * Content for ${a} documents
42
+ */
43
+ interface ${i} {
44
+ ${o}
45
+ }
46
+ `:`interface ${i} {}`,{name:i,code:t,auxiliaryTypes:n,contentTypeNames:r}}function qt(e){return`uid`in Object.assign({},...Object.values(e.json))}const Jt=e=>be.createHash(`sha1`).update(JSON.stringify(e)).digest(`hex`);function Yt(e){if(e.cache){let t=Jt(e.model),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=J(e.model.id,`Document`),a=e.localeIDs&&e.localeIDs.length>0?Tt(e.localeIDs.map(e=>`"${e}"`)):`string`,o=qt(e.model)?`PrismicDocumentWithUID`:`PrismicDocumentWithoutUID`,s=Lt({name:e.model.id,model:e.model}),c=Kt({model:e.model,fieldConfigs:e.fieldConfigs});n.push(...c.auxiliaryTypes),r.push(c.name),r.push(...c.contentTypeNames),t=K(c.code,t),t=K(q`
47
+ /**
48
+ * ${s} document from Prismic
49
+ *
50
+ * - **API ID**: \`${e.model.id}\`
51
+ * - **Repeatable**: \`${e.model.repeatable.toString()}\`
52
+ * - **Documentation**: ${`https://prismic.io/docs/content-modeling`}
53
+ *
54
+ * @typeParam Lang - Language API ID of the document.
55
+ */
56
+ export type ${i}<Lang extends string = ${a}> = prismic.${o}<Simplify<${c.name}>, "${e.model.id}", Lang>;
57
+ `,t);let l={name:i,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=Jt(e.model);e.cache.set(t,l)}return l}function Xt(e){if(e.cache){let t=Jt([e.model,e.fieldConfigs]),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=J(e.model.id,`Slice`),a=Lt({name:e.model.id,model:e.model}),o=[];for(let s of e.model.variations){let c=J(i,s.id),l;if(s.primary&&Object.keys(s.primary).length>0){l=J(c,`Primary`);let i=[{name:e.model.id,model:e.model},{name:s.id,label:s.name},{name:`primary`,label:`Primary`}],a=Rt({path:i}),o=Gt({fields:s.primary,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(l);let u=q`
58
+ /**
59
+ * Primary content in *${a}*
60
+ */
61
+ `;t=K(o.code?q`
62
+ ${u}
63
+ export interface ${l} {
64
+ ${o.code}
65
+ }
66
+ `:q`
67
+ ${u}
68
+ export interface ${l} {}
69
+ `,t)}let u;if(s.items&&Object.keys(s.items).length>0){u=J(c,`Item`);let i=[{name:e.model.id,model:e.model},{name:`items`,label:`Items`}],a=Rt({path:i}),o=Gt({fields:s.items,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(u);let l=q`
70
+ /**
71
+ * Primary content in *${a}*
72
+ */
73
+ `;t=K(o.code?q`
74
+ ${l}
75
+ export interface ${u} {
76
+ ${o.code}
77
+ }
78
+ `:q`
79
+ ${l}
80
+ export interface ${u} {}
81
+ `,t)}t=K(q`
82
+ /**
83
+ * ${s.name} variation for ${a} Slice
84
+ *
85
+ * - **API ID**: \`${s.id}\`
86
+ * - **Description**: ${s.description||`*None*`}
87
+ * - **Documentation**: ${Ft}
88
+ */
89
+ export type ${c} = prismic.SharedSliceVariation<"${s.id}", ${l?`Simplify<${l}>`:`Record<string, never>`}, ${u?`Simplify<${u}>`:`never`}>;
90
+ `,t),o.push(c)}let s=J(i,`Variation`),c=Tt(o);r.push(s),r.push(...o),t=K(q`
91
+ /**
92
+ * Slice variation for *${a}*
93
+ */
94
+ type ${s} = ${o.length>0?c:`never`}
95
+ `,t),t=K(q`
96
+ /**
97
+ * ${a} Shared Slice
98
+ *
99
+ * - **API ID**: \`${e.model.id}\`
100
+ * - **Description**: ${e.model.description||`*None*`}
101
+ * - **Documentation**: ${Ft}
102
+ */
103
+ export type ${i} = prismic.SharedSlice<"${e.model.id}", ${s}>;
104
+ `,t);let l={name:i,variationNames:o,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=Jt([e.model,e.fieldConfigs]);e.cache.set(t,l)}return l}const Zt=new class extends Map{#e=0;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Map;#r;#i;#a;constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge==`number`&&e.maxAge===0)throw TypeError("`maxAge` must be a number greater than 0");this.#r=e.maxSize,this.#i=e.maxAge||1/0,this.#a=e.onEviction}get __oldCache(){return this.#n}#o(e){if(typeof this.#a==`function`)for(let[t,n]of e)this.#a(t,n.value)}#s(e,t){return typeof t.expiry==`number`&&t.expiry<=Date.now()&&(typeof this.#a==`function`&&this.#a(e,t.value),this.delete(e))}#c(e,t){if(this.#s(e,t)===!1)return t.value}#l(e,t){return t.expiry?this.#c(e,t):t.value}#u(e,t){let n=t.get(e);return this.#l(e,n)}#d(e,t){this.#t.set(e,t),this.#e++,this.#e>=this.#r&&(this.#e=0,this.#o(this.#n),this.#n=this.#t,this.#t=/* @__PURE__ */ new Map)}#f(e,t){this.#n.delete(e),this.#d(e,t)}*#p(){for(let e of this.#n){let[t,n]=e;this.#t.has(t)||this.#s(t,n)===!1&&(yield e)}for(let e of this.#t){let[t,n]=e;this.#s(t,n)===!1&&(yield e)}}get(e){if(this.#t.has(e)){let t=this.#t.get(e);return this.#l(e,t)}if(this.#n.has(e)){let t=this.#n.get(e);if(this.#s(e,t)===!1)return this.#f(e,t),t.value}}set(e,t,{maxAge:n=this.#i}={}){let r=typeof n==`number`&&n!==1/0?Date.now()+n:void 0;return this.#t.has(e)?this.#t.set(e,{value:t,expiry:r}):this.#d(e,{value:t,expiry:r}),this}has(e){return this.#t.has(e)?!this.#s(e,this.#t.get(e)):this.#n.has(e)?!this.#s(e,this.#n.get(e)):!1}peek(e){if(this.#t.has(e))return this.#u(e,this.#t);if(this.#n.has(e))return this.#u(e,this.#n)}expiresIn(e){let t=this.#t.get(e)??this.#n.get(e);if(t)return t.expiry?t.expiry-Date.now():1/0}delete(e){let t=this.#t.delete(e);return t&&this.#e--,this.#n.delete(e)||t}clear(){this.#t.clear(),this.#n.clear(),this.#e=0}resize(e){if(!(e&&e>0))throw TypeError("`maxSize` must be a number greater than 0");let t=[...this.#p()],n=t.length-e;n<0?(this.#t=new Map(t),this.#n=/* @__PURE__ */ new Map,this.#e=t.length):(n>0&&this.#o(t.slice(0,n)),this.#n=new Map(t.slice(n)),this.#t=/* @__PURE__ */ new Map,this.#e=0),this.#r=e}evict(e=1){let t=Number(e);if(!t||t<=0)return;let n=[...this.#p()],r=Math.trunc(Math.min(t,Math.max(n.length-1,0)));r<=0||(this.#o(n.slice(0,r)),this.#n=new Map(n.slice(r)),this.#t=/* @__PURE__ */ new Map,this.#e=0)}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.#t){let[t,n]=e;this.#s(t,n)===!1&&(yield[t,n.value])}for(let e of this.#n){let[t,n]=e;this.#t.has(t)||this.#s(t,n)===!1&&(yield[t,n.value])}}*entriesDescending(){let e=[...this.#t];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this.#s(n,r)===!1&&(yield[n,r.value])}e=[...this.#n];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this.#t.has(n)||this.#s(n,r)===!1&&(yield[n,r.value])}}*entriesAscending(){for(let[e,t]of this.#p())yield[e,t.value]}get size(){if(!this.#e)return this.#n.size;let e=0;for(let t of this.#n.keys())this.#t.has(t)||e++;return Math.min(this.#e+e,this.#r)}get maxSize(){return this.#r}get maxAge(){return this.#i}entries(){return this.entriesAscending()}forEach(e,t=this){for(let[n,r]of this.entriesAscending())e.call(t,r,n,this)}get[Symbol.toStringTag](){return`QuickLRU`}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}}({maxSize:1e3});function Qt(e={}){let t=e.fieldConfigs||{},n=e.cache??!0,r=``,i=e.typesProvider||`@prismicio/types`,a=`prismic`;r=G(`import type * as prismic from "${i}";`,r),(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace)&&i!==`@prismicio/client`&&(a=`prismicClient`,r=G(`import type * as ${a} from "@prismicio/client";`,r)),r=K(`type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };`,r),r=K(`
105
+ type PickContentRelationshipFieldData<
106
+ TRelationship extends prismic.CustomTypeModelFetchCustomTypeLevel1 | prismic.CustomTypeModelFetchCustomTypeLevel2 | prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2,
107
+ TData extends Record<string, prismic.AnyRegularField | prismic.GroupField | prismic.NestedGroupField | prismic.SliceZone>,
108
+ TLang extends string
109
+ > = |
110
+ // Content relationship fields
111
+ {
112
+ [TSubRelationship in Extract<
113
+ TRelationship["fields"][number], prismic.CustomTypeModelFetchContentRelationshipLevel1
114
+ > as TSubRelationship["id"]]:
115
+ ContentRelationshipFieldWithData<TSubRelationship["customtypes"], TLang>;
116
+ } &
117
+ // Group
118
+ {
119
+ [TGroup in Extract<
120
+ TRelationship["fields"][number], prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2
121
+ > as TGroup["id"]]:
122
+ TData[TGroup["id"]] extends prismic.GroupField<infer TGroupData>
123
+ ? prismic.GroupField<PickContentRelationshipFieldData<TGroup, TGroupData, TLang>>
124
+ : never
125
+ } &
126
+ // Other fields
127
+ {
128
+ [TFieldKey in Extract<TRelationship["fields"][number], string>]:
129
+ TFieldKey extends keyof TData ? TData[TFieldKey] : never;
130
+ };
131
+
132
+ type ContentRelationshipFieldWithData<
133
+ TCustomType extends readonly (prismic.CustomTypeModelFetchCustomTypeLevel1 | string)[] | readonly (prismic.CustomTypeModelFetchCustomTypeLevel2 | string)[],
134
+ TLang extends string = string
135
+ > = {
136
+ [ID in Exclude<TCustomType[number], string>["id"]]:
137
+ prismic.ContentRelationshipField<
138
+ ID,
139
+ TLang,
140
+ PickContentRelationshipFieldData<
141
+ Extract<TCustomType[number], { id: ID }>,
142
+ Extract<prismic.Content.AllDocumentTypes, { type: ID }>["data"],
143
+ TLang
144
+ >
145
+ >
146
+ }[Exclude<TCustomType[number], string>["id"]];
147
+ `,r);let o=[];if(e.customTypeModels){let i=[];for(let a of e.customTypeModels){let s=Yt({model:a,localeIDs:e.localeIDs,fieldConfigs:t,cache:n?Zt:void 0});for(let e of s.auxiliaryTypes)r=K(e.code,r);r=K(s.code,r),i.push(s.name),o.push(s.name),o.push(...s.contentTypeNames)}if(e.customTypeModels.length>0){let e=`AllDocumentTypes`;r=K(`export type ${e} = ${Tt(i)};`,r),o.push(e)}}if(e.sharedSliceModels)for(let i of e.sharedSliceModels){let e=Xt({model:i,fieldConfigs:t,cache:n?Zt:void 0});for(let t of e.auxiliaryTypes)r=K(t.code,r);r=K(e.code,r),o.push(e.name),o.push(...e.contentTypeNames)}if(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace){let t=``;e.clientIntegration.includeCreateClientInterface&&((e.customTypeModels?.length||0)>0?(t=K(`interface CreateClient {
148
+ (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client<AllDocumentTypes>;
149
+ }`,t),t=K(`interface CreateWriteClient {
150
+ (repositoryNameOrEndpoint: string, options: ${a}.WriteClientConfig): ${a}.WriteClient<AllDocumentTypes>;
151
+ }`,t),t=K(`interface CreateMigration {
152
+ (): ${a}.Migration<AllDocumentTypes>;
153
+ }`,t)):(t=K(`interface CreateClient {
154
+ (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client;
155
+ }`,t),t=K(`interface CreateWriteClient {
156
+ (repositoryNameOrEndpoint: string, options?: ${a}.WriteClientConfig): ${a}.WriteClient;
157
+ }`,t),t=K(`interface CreateMigration {
158
+ (): ${a}.Migration;
159
+ }`,t))),e.clientIntegration.includeContentNamespace&&(t=K(q`
160
+ namespace Content {
161
+ export type {
162
+ ${o.join(`,
163
+ `)}
164
+ }
165
+ }
166
+ `,t)),r=K(q`
167
+ declare module "@prismicio/client" {
168
+ ${t}
169
+ }
170
+ `,r)}return r}var $t=/* @__PURE__ */ He(import.meta.url);function en(e){let t=Ie(e);return t.length>1&&t[t.length-1]===Be&&(t=t.substring(0,t.length-1)),t}const tn=/[\\/]/g;function nn(e,t){return e.replace(tn,t)}const rn=/^[a-z]:[\\/]$/i;function an(e){return e===`/`||rn.test(e)}function on(e,t){let{resolvePaths:n,normalizePath:r,pathSeparator:i}=t,a=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return n&&(e=ze(e)),(r||a)&&(e=en(e)),e===`.`?``:nn(e[e.length-1]===i?e:e+i,i)}function sn(e,t){return t+e}function cn(e,t){return function(n,r){return r.startsWith(e)?r.slice(e.length)+n:nn(Re(e,r),t.pathSeparator)+t.pathSeparator+n}}function ln(e){return e}function un(e,t,n){return t+e+n}function dn(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?cn(e,t):r?sn:ln}function fn(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function pn(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}const mn=(e,t)=>{t.push(e||`.`)},hn=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},gn=()=>{};function _n(e,t){let{includeDirs:n,filters:r,relativePaths:i}=t;return n?i?r&&r.length?pn(e):fn(e):r&&r.length?hn:mn:gn}const vn=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},yn=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},bn=(e,t,n,r)=>{n.files++},xn=(e,t)=>{t.push(e)},Sn=()=>{};function Cn(e){let{excludeFiles:t,filters:n,onlyCounts:r}=e;return t?Sn:n&&n.length?r?vn:yn:r?bn:xn}const wn=e=>e,Tn=()=>[``].slice(0,0);function En(e){return e.group?Tn:wn}const Dn=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},On=()=>{};function kn(e){return e.group?Dn:On}const An=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue(),i.realpath(e,(o,s)=>{if(o)return r.dequeue(a?null:o,t);i.stat(s,(i,o)=>{if(i)return r.dequeue(a?null:i,t);if(o.isDirectory()&&Nn(e,s,t))return r.dequeue(null,t);n(o,s),r.dequeue(null,t)})})},jn=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue();try{let r=i.realpathSync(e),a=i.statSync(r);if(a.isDirectory()&&Nn(e,r,t))return;n(a,r)}catch(e){if(!a)throw e}};function Mn(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?jn:An}function Nn(e,t,n){if(n.options.useRealPaths)return Pn(t,n);let r=Pe(e),i=1;for(;r!==n.root&&i<2;){let e=n.symlinks.get(r);e&&(e===t||e.startsWith(t)||t.startsWith(e))?i++:r=Pe(r)}return n.symlinks.set(e,t),i>1}function Pn(e,t){return t.visited.includes(e+t.options.pathSeparator)}const Fn=e=>e.counts,In=e=>e.groups,Ln=e=>e.paths,Rn=e=>e.paths.slice(0,e.options.maxFiles),zn=(e,t,n)=>(Un(t,n,e.counts,e.options.suppressErrors),null),Bn=(e,t,n)=>(Un(t,n,e.paths,e.options.suppressErrors),null),Vn=(e,t,n)=>(Un(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),Hn=(e,t,n)=>(Un(t,n,e.groups,e.options.suppressErrors),null);function Un(e,t,n,r){t(e&&!r?e:null,n)}function Wn(e,t){let{onlyCounts:n,group:r,maxFiles:i}=e;return n?t?Fn:zn:r?t?In:Hn:i?t?Rn:Vn:t?Ln:Bn}const Gn={withFileTypes:!0},Kn=(e,t,n,r,i)=>{if(e.queue.enqueue(),r<0)return e.queue.dequeue(null,e);let{fs:a}=e;e.visited.push(t),e.counts.directories++,a.readdir(t||`.`,Gn,(t,a=[])=>{i(a,n,r),e.queue.dequeue(e.options.suppressErrors?null:t,e)})},qn=(e,t,n,r,i)=>{let{fs:a}=e;if(r<0)return;e.visited.push(t),e.counts.directories++;let o=[];try{o=a.readdirSync(t||`.`,Gn)}catch(t){if(!e.options.suppressErrors)throw t}i(o,n,r)};function Jn(e){return e?qn:Kn}var Yn=class{count=0;constructor(e){this.onQueueEmpty=e}enqueue(){return this.count++,this.count}dequeue(e,t){this.onQueueEmpty&&(--this.count<=0||e)&&(this.onQueueEmpty(e,t),e&&(t.controller.abort(),this.onQueueEmpty=void 0))}},Xn=class{_files=0;_directories=0;set files(e){this._files=e}get files(){return this._files}set directories(e){this._directories=e}get directories(){return this._directories}
171
+ /* c8 ignore next 3 */
172
+ get dirs(){return this._directories}},Zn=class{aborted=!1;abort(){this.aborted=!0}},Qn=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=Wn(t,this.isSynchronous),this.root=on(e,t),this.state={root:an(this.root)?this.root:this.root.slice(0,-1),paths:[``].slice(0,0),groups:[],counts:new Xn,options:t,queue:new Yn((e,t)=>this.callbackInvoker(t,e,n)),symlinks:/* @__PURE__ */ new Map,visited:[``].slice(0,0),controller:new Zn,fs:t.fs||Ee},this.joinPath=dn(this.root,t),this.pushDirectory=_n(this.root,t),this.pushFile=Cn(t),this.getArray=En(t),this.groupFiles=kn(t),this.resolveSymlink=Mn(t,this.isSynchronous),this.walkDirectory=Jn(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,t,n)=>{let{paths:r,options:{filters:i,resolveSymlinks:a,excludeSymlinks:o,exclude:s,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&r.length>c)return;let p=this.getArray(this.state.paths);for(let c=0;c<e.length;++c){let l=e[c];if(l.isFile()||l.isSymbolicLink()&&!a&&!o){let e=this.joinPath(l.name,t);this.pushFile(e,p,this.state.counts,i)}else if(l.isDirectory()){let e=un(l.name,t,this.state.options.pathSeparator);if(s&&s(l.name,e))continue;this.pushDirectory(e,r,i),this.walkDirectory(this.state,e,e,n-1,this.walk)}else if(this.resolveSymlink&&l.isSymbolicLink()){let e=sn(l.name,t);this.resolveSymlink(e,this.state,(t,r)=>{if(t.isDirectory()){if(r=on(r,this.state.options),s&&s(l.name,u?r:e+d))return;this.walkDirectory(this.state,r,u?r:e+d,n-1,this.walk)}else{r=u?r:e;let t=Ne(r),n=on(Pe(r),this.state.options);r=this.joinPath(t,n),this.pushFile(r,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,t,p)}};function $n(e,t){return new Promise((n,r)=>{er(e,t,(e,t)=>{if(e)return r(e);n(t)})})}function er(e,t,n){new Qn(e,t,n).start()}function tr(e,t){return new Qn(e,t).start()}var nr=class{constructor(e,t){this.root=e,this.options=t}withPromise(){return $n(this.root,this.options)}withCallback(e){er(this.root,this.options,e)}sync(){return tr(this.root,this.options)}};let rr=null;
173
+ /* c8 ignore next 6 */
174
+ try{$t.resolve(`picomatch`),rr=$t(`picomatch`)}catch{}var ir=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Be,filters:[]};globFunction;constructor(e){this.options={...this.options,...e},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(e){return this.options.pathSeparator=e,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(e){return this.options.maxDepth=e,this}withMaxFiles(e){return this.options.maxFiles=e,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:e=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=e,this.withFullPaths()}withAbortSignal(e){return this.options.signal=e,this}normalize(){return this.options.normalizePath=!0,this}filter(e){return this.options.filters.push(e),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(e){return this.options.exclude=e,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(e){return new nr(e||`.`,this.options)}withGlobFunction(e){return this.globFunction=e,this}
175
+ /* c8 ignore next 4 */
176
+ crawlWithOptions(e,t){return this.options={...this.options,...t},new nr(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||rr;
177
+ /* c8 ignore next 5 */
178
+ if(!n)throw Error(`Please specify a glob function to use glob matching.`);var r=this.globCache[e.join(`\0`)];return r||(r=n(e,...t),this.globCache[e.join(`\0`)]=r),this.options.filters.push(e=>r(e)),this}},ar=/* @__PURE__ */ rt(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),or=/* @__PURE__ */ rt((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=ar();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),sr=/* @__PURE__ */ rt(((e,t)=>{let n=or(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=ar(),v=e=>e===l||e===a,ee=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let y=t||{},b=e.length-1,x=y.parts===!0||y.tokens===!0||y.scanToEnd===!0,S=[],C=[],w=[],T=e,E=-1,D=0,O=0,te=!1,ne=!1,k=!1,A=!1,re=!1,j=!1,M=!1,N=!1,P=!1,F=!1,ie=0,I,L,R={value:``,depth:0,isGlob:!1},z=()=>E>=b,B=()=>T.charCodeAt(E+1),V=()=>(I=L,T.charCodeAt(++E));for(;E<b;){L=V();let e;if(L===a)M=R.backslashes=!0,L=V(),L===u&&(j=!0);else{if(j===!0||L===u){for(ie++;z()!==!0&&(L=V());)if(L===a)M=R.backslashes=!0,V();else if(L===u)ie++;else{if(j!==!0&&L===s&&(L=V())===s||j!==!0&&L===o){if(te=R.isBrace=!0,k=R.isGlob=!0,F=!0,x===!0)continue;break}if(L===h&&(ie--,ie===0)){j=!1,te=R.isBrace=!0,F=!0;break}}if(x===!0)continue;break}if(L===l){if(S.push(E),C.push(R),R={value:``,depth:0,isGlob:!1},F===!0)continue;if(I===s&&E===D+1){D+=2;continue}O=E+1}else{if(y.noext!==!0&&(L===p||L===i||L===r||L===m||L===c)&&B()===d){if(k=R.isGlob=!0,A=R.isExtglob=!0,F=!0,L===c&&E===D&&(P=!0),x===!0){let e=0;for(;z()!==!0&&(L=V());)if(L===a)M=R.backslashes=!0,V();else if(L===d)e++;else if(L===g&&--e===0){F=!0;break}continue}break}if(L===r){if(I===r&&(re=R.isGlobstar=!0),k=R.isGlob=!0,F=!0,x===!0)continue;break}if(L===m){if(k=R.isGlob=!0,F=!0,x===!0)continue;break}if(L===f){for(;z()!==!0&&(e=V());)if(e===a)M=R.backslashes=!0,V();else if(e===_){ne=R.isBracket=!0,k=R.isGlob=!0,F=!0;break}if(x===!0)continue;break}if(y.nonegate!==!0&&L===c&&E===D)N=R.negated=!0,D++;else{if(y.noparen!==!0&&L===d){if(k=R.isGlob=!0,x===!0){let e=1;for(;z()!==!0&&(L=V());)if(L===a)M=R.backslashes=!0,V();else if(L===d)e++;else if(L===g&&--e===0){F=!0;break}continue}break}if(k===!0){if(F=!0,x===!0)continue;break}}}}}y.noext===!0&&(A=!1,k=!1);let H=T,ae=``,oe=``;D>0&&(ae=T.slice(0,D),T=T.slice(D),O-=D),H&&k===!0&&O>0?(H=T.slice(0,O),oe=T.slice(O)):k===!0?(H=``,oe=T):H=T,H&&H!==``&&H!==`/`&&H!==T&&v(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),y.unescape===!0&&(oe&&=n.removeBackslashes(oe),H&&M===!0&&(H=n.removeBackslashes(H)));let U={prefix:ae,input:e,start:D,base:H,glob:oe,isBrace:te,isBracket:ne,isGlob:k,isExtglob:A,isGlobstar:re,negated:N,negatedExtglob:P};if(y.tokens===!0&&(U.maxDepth=0,v(L)||C.push(R),U.tokens=C),y.parts===!0||y.tokens===!0){let t;for(let n=0;n<S.length;n++){let r=t===void 0?D:t+1,i=S[n],a=e.slice(r,i);y.tokens&&(n===0&&D!==0?(C[n].isPrefix=!0,C[n].value=ae):C[n].value=a,ee(C[n]),U.maxDepth+=C[n].depth),i>=D&&(w.push(a),t=i)}let n=t===void 0?D:t+1,r=e.slice(n);w.push(r),y.tokens&&t&&t+1<e.length&&(C[C.length-1].value=r,ee(C[C.length-1]),U.maxDepth+=C[C.length-1].depth),U.slashes=S,U.parts=w}return U}})),cr=/* @__PURE__ */ rt(((e,t)=>{let n=ar(),r=or(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e)if(o===!0)a+=s,o=!1;else if(s===`\\`)a+=s,o=!0;else if(s===`"`)i=i===1?0:1,a+=s;else{if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e)if(t===!0)t=!1;else if(n===`\\`)t=!0;else if(/[?*+@!()[\]{}]/.test(n))return!1;return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(a&&r===a.repeat(r.length)&&i===a.repeat(i.length)&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0)a=!1;else if(s===`\\`)a=!0;else if(s===`"`)i=i===1?0:1;else if(i!==1){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(!(n>0)){if(s===`(`)r++;else if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>`${e.length===1?r.escapeRegex(e[0]):`[${e.map(e=>r.escapeRegex(e)).join(``)}]`}*`,_=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return n},v=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},ee=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};let a=[],o=!1,s=!0;for(let e of i){let t=_(e);if(t){o=!0,a.push(...t);continue}let n=p(e);if(n&&n.length===1)a.push(n);else if(s=!1,v(e)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:g([...new Set(a)])}:{risky:!0}:{risky:!1}},y=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),v=n.extglobChars(_),{DOT_LITERAL:b,PLUS_LITERAL:x,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:w,NO_DOT:T,NO_DOT_SLASH:E,NO_DOTS_SLASH:D,QMARK:O,QMARK_NO_DOT:te,STAR:ne,START_ANCHOR:k}=_,A=e=>`(${g}(?:(?!${k}${e.dot?w:b}).)*?)`,re=d.dot?``:T,j=d.dot?O:te,M=d.bash===!0?A(d):ne;d.capture&&(M=`(${M})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let N={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,N),p=e.length;let P=[],F=[],ie=[],I=m,L,R=()=>N.index===p-1,z=N.peek=(t=1)=>e[N.index+t],B=N.advance=()=>e[++N.index]||``,V=()=>e.slice(N.index+1),H=(e=``,t=0)=>{N.consumed+=e,N.index+=t},ae=e=>{N.output+=e.output==null?e.value:e.output,H(e.value)},oe=()=>{let e=1;for(;z()===`!`&&(z(2)!==`(`||z(3)===`?`);)B(),N.start++,e++;return e%2!=0&&(N.negated=!0,N.start++,!0)},U=e=>{N[e]++,ie.push(e)},se=e=>{N[e]--,ie.pop()},W=e=>{if(I.type===`globstar`){let t=N.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||P.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(N.output=N.output.slice(0,-I.output.length),I.type=`star`,I.value=`*`,I.output=M,N.output+=I.output)}P.length&&e.type!==`paren`&&(P[P.length-1].inner+=e.value),(e.value||e.output)&&ae(e),I&&I.type===`text`&&e.type===`text`?(I.output=(I.output||I.value)+e.value,I.value+=e.value):(e.prev=I,h.push(e),I=e)},ce=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=I,n.parens=N.parens,n.output=N.output,n.startIndex=N.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;U(`parens`),W({type:e,value:t,output:N.output?``:C}),W({type:`paren`,extglob:!0,value:B(),output:r}),P.push(n)},le=n=>{let i=e.slice(n.startIndex,N.index+1),a=e.slice(n.startIndex+2,N.index),o=ee(a,d);if((n.type===`plus`||n.type===`star`)&&o.risky){let e=o.safeOutput?(n.output?``:C)+(d.capture?`(${o.safeOutput})`:o.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;N.output=n.output+t.output,N.backtrack=!0,W({type:`paren`,extglob:!0,value:L,output:``}),se(`parens`);return}let s=n.close+(d.capture?`)`:``),c;if(n.type===`negate`){let e=M;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=A(d)),(e!==M||R()||/^\)+$/.test(V()))&&(s=n.close=`)$))${e}`),n.inner.includes(`*`)&&(c=V())&&/^\.[^\\/.]+$/.test(c)&&(s=n.close=`)${y(c,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(N.negatedExtglob=!0)}W({type:`paren`,extglob:!0,value:L,output:s}),se(`parens`)};if(d.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?O.repeat(a.length):``):o===0?j+(a?O.repeat(a.length):``):O.repeat(r.length):i===`.`?b.repeat(r.length):i===`*`?t?t+i+(a?M:``):M:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(N.output=e,N):(N.output=r.wrapOutput(i,N,t),N)}for(;!R();){if(L=B(),L===`\0`)continue;if(L===`\\`){let e=z();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){L+=`\\`,W({type:`text`,value:L});continue}let t=/^\\+/.exec(V()),n=0;if(t&&t[0].length>2&&(n=t[0].length,N.index+=n,n%2!=0&&(L+=`\\`)),d.unescape===!0?L=B():L+=B(),N.brackets===0){W({type:`text`,value:L});continue}}if(N.brackets>0&&(L!==`]`||I.value===`[`||I.value===`[^`)){if(d.posix!==!1&&L===`:`){let e=I.value.slice(1);if(e.includes(`[`)&&(I.posix=!0,e.includes(`:`))){let e=I.value.lastIndexOf(`[`),t=I.value.slice(0,e),n=I.value.slice(e+2),r=a[n];if(r){I.value=t+r,N.backtrack=!0,B(),!m.output&&h.indexOf(I)===1&&(m.output=C);continue}}}(L===`[`&&z()!==`:`||L===`-`&&z()===`]`)&&(L=`\\${L}`),L===`]`&&(I.value===`[`||I.value===`[^`)&&(L=`\\${L}`),d.posix===!0&&L===`!`&&I.value===`[`&&(L=`^`),I.value+=L,ae({value:L});continue}if(N.quotes===1&&L!==`"`){L=r.escapeRegex(L),I.value+=L,ae({value:L});continue}if(L===`"`){N.quotes=N.quotes===1?0:1,d.keepQuotes===!0&&W({type:`text`,value:L});continue}if(L===`(`){U(`parens`),W({type:`paren`,value:L});continue}if(L===`)`){if(N.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=P[P.length-1];if(e&&N.parens===e.parens+1){le(P.pop());continue}W({type:`paren`,value:L,output:N.parens?`)`:`\\)`}),se(`parens`);continue}if(L===`[`){if(d.nobracket===!0||!V().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));L=`\\${L}`}else U(`brackets`);W({type:`bracket`,value:L});continue}if(L===`]`){if(d.nobracket===!0||I&&I.type===`bracket`&&I.value.length===1){W({type:`text`,value:L,output:`\\${L}`});continue}if(N.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));W({type:`text`,value:L,output:`\\${L}`});continue}se(`brackets`);let e=I.value.slice(1);if(I.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(L=`/${L}`),I.value+=L,ae({value:L}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(I.value);if(N.output=N.output.slice(0,-I.value.length),d.literalBrackets===!0){N.output+=t,I.value=t;continue}I.value=`(${g}${t}|${I.value})`,N.output+=I.value;continue}if(L===`{`&&d.nobrace!==!0){U(`braces`);let e={type:`brace`,value:L,output:`(`,outputIndex:N.output.length,tokensIndex:N.tokens.length};F.push(e),W(e);continue}if(L===`}`){let e=F[F.length-1];if(d.nobrace===!0||!e){W({type:`text`,value:L,output:L});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),N.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=N.output.slice(0,e.outputIndex),r=N.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,L=t=`\\}`,N.output=n;for(let e of r)N.output+=e.output||e.value}W({type:`brace`,value:L,output:t}),se(`braces`),F.pop();continue}if(L===`|`){P.length>0&&P[P.length-1].conditions++,W({type:`text`,value:L});continue}if(L===`,`){let e=L,t=F[F.length-1];t&&ie[ie.length-1]===`braces`&&(t.comma=!0,e=`|`),W({type:`comma`,value:L,output:e});continue}if(L===`/`){if(I.type===`dot`&&N.index===N.start+1){N.start=N.index+1,N.consumed=``,N.output=``,h.pop(),I=m;continue}W({type:`slash`,value:L,output:S});continue}if(L===`.`){if(N.braces>0&&I.type===`dot`){I.value===`.`&&(I.output=b);let e=F[F.length-1];I.type=`dots`,I.output+=L,I.value+=L,e.dots=!0;continue}if(N.braces+N.parens===0&&I.type!==`bos`&&I.type!==`slash`){W({type:`text`,value:L,output:b});continue}W({type:`dot`,value:L,output:b});continue}if(L===`?`){if(!(I&&I.value===`(`)&&d.noextglob!==!0&&z()===`(`&&z(2)!==`?`){ce(`qmark`,L);continue}if(I&&I.type===`paren`){let e=z(),t=L;(I.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(V()))&&(t=`\\${L}`),W({type:`text`,value:L,output:t});continue}if(d.dot!==!0&&(I.type===`slash`||I.type===`bos`)){W({type:`qmark`,value:L,output:te});continue}W({type:`qmark`,value:L,output:O});continue}if(L===`!`){if(d.noextglob!==!0&&z()===`(`&&(z(2)!==`?`||!/[!=<:]/.test(z(3)))){ce(`negate`,L);continue}if(d.nonegate!==!0&&N.index===0){oe();continue}}if(L===`+`){if(d.noextglob!==!0&&z()===`(`&&z(2)!==`?`){ce(`plus`,L);continue}if(I&&I.value===`(`||d.regex===!1){W({type:`plus`,value:L,output:x});continue}if(I&&(I.type===`bracket`||I.type===`paren`||I.type===`brace`)||N.parens>0){W({type:`plus`,value:L});continue}W({type:`plus`,value:x});continue}if(L===`@`){if(d.noextglob!==!0&&z()===`(`&&z(2)!==`?`){W({type:`at`,extglob:!0,value:L,output:``});continue}W({type:`text`,value:L});continue}if(L!==`*`){(L===`$`||L===`^`)&&(L=`\\${L}`);let e=o.exec(V());e&&(L+=e[0],N.index+=e[0].length),W({type:`text`,value:L});continue}if(I&&(I.type===`globstar`||I.star===!0)){I.type=`star`,I.star=!0,I.value+=L,I.output=M,N.backtrack=!0,N.globstar=!0,H(L);continue}let t=V();if(d.noextglob!==!0&&/^\([^?]/.test(t)){ce(`star`,L);continue}if(I.type===`star`){if(d.noglobstar===!0){H(L);continue}let n=I.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){W({type:`star`,value:L,output:``});continue}let o=N.braces>0&&(n.type===`comma`||n.type===`brace`),s=P.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){W({type:`star`,value:L,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[N.index+4];if(n&&n!==`/`)break;t=t.slice(3),H(`/**`,3)}let c=R()||N.parens>0&&t===`)`.repeat(N.parens)&&!P.some(e=>e.type===`negate`);if(n.type===`bos`&&R()){I.type=`globstar`,I.value+=L,I.output=A(d),N.output=I.output,N.globstar=!0,H(L);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&c){N.output=N.output.slice(0,-(n.output+I.output).length),n.output=`(?:${n.output}`,I.type=`globstar`,I.output=A(d)+(d.strictSlashes?`)`:`|$)`),I.value+=L,N.globstar=!0,N.output+=n.output+I.output,H(L);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;N.output=N.output.slice(0,-(n.output+I.output).length),n.output=`(?:${n.output}`,I.type=`globstar`,I.output=`${A(d)}${S}|${S}${e})`,I.value+=L,N.output+=n.output+I.output,N.globstar=!0,H(L+B()),W({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){I.type=`globstar`,I.value+=L,I.output=`(?:^|${S}|${A(d)}${S})`,N.output=I.output,N.globstar=!0,H(L+B()),W({type:`slash`,value:`/`,output:``});continue}N.output=N.output.slice(0,-I.output.length),I.type=`globstar`,I.output=A(d),I.value+=L,N.output+=I.output,N.globstar=!0,H(L);continue}let n={type:`star`,value:L,output:M};d.bash===!0?(n.output=`.*?`,(I.type===`bos`||I.type===`slash`)&&(n.output=re+n.output),W(n)):I&&(I.type===`bracket`||I.type===`paren`)&&d.regex===!0?(n.output=L,W(n)):((N.index===N.start||I.type===`slash`||I.type===`dot`)&&(I.type===`dot`?(N.output+=E,I.output+=E):d.dot===!0?(N.output+=D,I.output+=D):(N.output+=re,I.output+=re),z()!==`*`&&(N.output+=C,I.output+=C)),W(n))}for(;N.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));N.output=r.escapeLast(N.output,`[`),se(`brackets`)}for(;N.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));N.output=r.escapeLast(N.output,`(`),se(`parens`)}for(;N.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));N.output=r.escapeLast(N.output,`{`),se(`braces`)}if(d.strictSlashes!==!0&&(I.type===`star`||I.type===`bracket`)&&W({type:`maybe_slash`,value:``,output:`${S}?`}),N.backtrack===!0){N.output=``;for(let e of N.tokens)N.output+=e.output==null?e.value:e.output,e.suffix&&(N.output+=e.suffix)}return N};y.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,ee=a.dot?h:p,y=a.capture?``:`?:`,b={negated:!1,prefix:``},x=a.bash===!0?`.*?`:g;a.capture&&(x=`(${x})`);let S=e=>e.noglobstar===!0?x:`(${y}(?:(?!${_}${e.dot?f:l}).)*?)`,C=e=>{switch(e){case`*`:return`${v}${d}${x}`;case`.*`:return`${l}${d}${x}`;case`*.*`:return`${v}${x}${l}${d}${x}`;case`*/*`:return`${v}${x}${u}${d}${ee}${x}`;case`**`:return v+S(a);case`**/*`:return`(?:${v}${S(a)}${u})?${ee}${d}${x}`;case`**/*.*`:return`(?:${v}${S(a)}${u})?${ee}${x}${l}${d}${x}`;case`**/.*`:return`(?:${v}${S(a)}${u})?${l}${d}${x}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=C(t[1]);return n?n+l+t[2]:void 0}}},w=C(r.removePrefix(e,b));return w&&a.strictSlashes!==!0&&(w+=`${u}?`),w},t.exports=y})),lr=/* @__PURE__ */ rt(((e,t)=>{let n=sr(),r=cr(),i=or(),a=ar(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),!r||p)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n,r=n&&n.windows)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e,{windows:r})),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),ur=/* @__PURE__ */ at((/* @__PURE__ */ rt(((e,t)=>{let n=lr(),r=or();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i})))(),1);const dr=Array.isArray,fr=/\\/g,pr=/^[A-Za-z]:$/,mr=process.platform===`win32`,hr=/^(\/?\.\.)+$/;function gr(e,t={}){let n=e.length,r=Array(n),i=Array(n),a,o;for(a=0;a<n;a++){let n=Cr(e[a]);r[a]=n;let s=n.length,c=Array(s);for(o=0;o<s;o++)c[o]=(0,ur.default)(n[o],t);i[a]=c}return e=>{let s=e.split(`/`);if(s[0]===`..`&&hr.test(e))return!0;for(a=0;a<n;a++){let e=r[a],n=i[a],c=s.length,l=Math.min(c,e.length);for(o=0;o<l;){let r=e[o];if(r.includes(`/`))return!0;if(!n[o](s[o]))break;if(!t.noglobstar&&r===`**`)return!0;o++}if(o===c)return!0}return!1}}
179
+ /* node:coverage ignore next 2 */
180
+ const _r=/^[A-Z]:\/$/i,vr=mr?e=>_r.test(e):e=>e===`/`;function yr(e,t,n){if(e===t||t.startsWith(`${e}/`)){if(n){let t=e.length+ +!vr(e);return(e,n)=>e.slice(t,n?-1:void 0)||`.`}let r=t.slice(e.length+1);return r?(e,t)=>{if(e===`.`)return r;let n=`${r}/${e}`;return t?n.slice(0,-1):n}:(e,t)=>t&&e!==`.`?e.slice(0,-1):e}return n?t=>Le.relative(e,t)||`.`:n=>Le.relative(e,`${t}/${n}`)||`.`}function br(e,t){if(t.startsWith(`${e}/`)){let n=t.slice(e.length+1);return e=>`${n}/${e}`}return n=>{let r=Le.relative(e,`${t}/${n}`);return n[n.length-1]===`/`&&r!==``?`${r}/`:r||`.`}}function xr(e){return e.replace(pr,e=>`${e}/`)}const Sr={parts:!0};function Cr(e){let t=ur.default.scan(e,Sr);return t.parts?.length?t.parts:[e]}const wr=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Tr=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Er=mr?e=>e.replace(Tr,`\\$&`):e=>e.replace(wr,`\\$&`);function Dr(e,t){if(t?.caseSensitiveMatch===!1)return!0;let n=ur.default.scan(e);return n.isGlob||n.negated}function Or(...e){console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString(`es`)}]`,...e)}function kr(e){return typeof e==`string`?[e]:e??[]}const Ar=/^(\/?\.\.)+/,jr=/\\(?=[()[\]{}!*+?@|])/g;function Mr(e,t,n,r){let i=t.cwd,a=e;e[e.length-1]===`/`&&(a=e.slice(0,-1)),a[a.length-1]!==`*`&&t.expandDirectories&&(a+=`/**`);let o=Er(i);a=Fe(a.replace(jr,``))?Le.relative(o,a):Le.normalize(a);let s=Ar.exec(a)?.[0],c=Cr(a);if(s){let e=(s.length+1)/3,t=0,r=o.split(`/`);for(;t<e&&c[t+e]===r[r.length+t-e];)a=a.slice(0,(e-t-1)*3)+a.slice((e-t)*3+c[t+e].length+1)||`.`,t++;let l=Le.join(i,s.slice(t*3));l[0]!==`.`&&n.root.length>l.length&&(n.root=xr(l),n.depthOffset=-e+t)}if(!r&&n.depthOffset>=0){n.commonPath??=c;let e=[],t=Math.min(n.commonPath.length,c.length);for(let r=0;r<t;r++){let t=c[r];if(t===`**`&&!c[r+1]){e.pop();break}if(r===c.length-1||t!==n.commonPath[r]||Dr(t))break;e.push(t)}n.depthOffset=e.length,n.commonPath=e,n.root=xr(e.length>0?Le.join(i,...e):i)}return a}function Nr(e,t,n){let r=[],i=[];for(let t of e.ignore)t&&(t[0]!==`!`||t[1]===`(`)&&i.push(Mr(t,e,n,!0));for(let a of t)a&&(a[0]!==`!`||a[1]===`(`?r.push(Mr(a,e,n,!1)):(a[1]!==`!`||a[2]===`(`)&&i.push(Mr(a.slice(1),e,n,!0)));return{match:r,ignore:i}}function Pr(e,t){let n=e.cwd,r={root:n,depthOffset:0},i=Nr(e,t,r);e.debug&&Or(`internal processing patterns:`,i);let{absolute:a,caseSensitiveMatch:o,debug:s,dot:c,followSymbolicLinks:l,onlyDirectories:u}=e,d=r.root.replace(fr,``),f={dot:c,nobrace:e.braceExpansion===!1,nocase:!o,noextglob:e.extglob===!1,noglobstar:e.globstar===!1,posix:!0},p=(0,ur.default)(i.match,f),m=(0,ur.default)(i.ignore,f),h=gr(i.match,f),g=yr(n,d,a),_=a?g:yr(n,d,!0),v=(e,t)=>{let n=_(t,!0);return n!==`.`&&!h(n)||m(n)},ee;e.deep!==void 0&&(ee=Math.round(e.deep-r.depthOffset));let y=new ir({filters:[s?(e,t)=>{let n=g(e,t),r=p(n)&&!m(n);return r&&Or(`matched ${n}`),r}:(e,t)=>{let n=g(e,t);return p(n)&&!m(n)}],exclude:s?(e,t)=>{let n=v(e,t);return Or(`${n?`skipped`:`crawling`} ${t}`),n}:v,fs:e.fs,pathSeparator:`/`,relativePaths:!a,resolvePaths:a,includeBasePath:a,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!e.onlyFiles,maxDepth:ee,signal:e.signal}).crawl(d);return e.debug&&Or(`internal properties:`,{...r,root:d}),[y,n!==d&&!a&&br(n,d)]}function Fr(e,t){if(t)for(let n=e.length-1;n>=0;n--)e[n]=t(e[n]);return e}const Ir={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Lr(e){let t=Object.assign({},e);for(let e in Ir)t[e]===void 0&&Object.assign(t,{[e]:Ir[e]});return t.cwd=(t.cwd instanceof URL?Ve(t.cwd):ze(t.cwd||process.cwd())).replace(fr,`/`),t.ignore=kr(t.ignore),t.fs&&={readdir:t.fs.readdir||De,readdirSync:t.fs.readdirSync||Oe,realpath:t.fs.realpath||ke,realpathSync:t.fs.realpathSync||Ae,stat:t.fs.stat||je,statSync:t.fs.statSync||Me},t.debug&&Or(`globbing with options:`,t),t}function Rr(e,t={}){if(e&&t?.patterns)throw Error(`Cannot pass patterns as both an argument and an option`);let n=dr(e)||typeof e==`string`,r=kr((n?e:e.patterns)??`**/*`),i=Lr(n?t:e);return r.length>0?Pr(i,r):[]}async function zr(e,t){let[n,r]=Rr(e,t);return n?Fr(await n.withPromise(),r):[]}// @__NO_SIDE_EFFECTS__
181
+ function Br(e){return M(a,e)}const Vr=`prismic.io`,Hr=l({PROD:h(),PRISMIC_SENTRY_DSN:d(s(),`https://e1886b1775bd397cd1afc60bfd2ebfc8@o146123.ingest.us.sentry.io/4510445143588864`),PRISMIC_SENTRY_ENVIRONMENT:S(C()),PRISMIC_SENTRY_ENABLED:S(h()),PRISMIC_TELEMETRY_ENABLED:S(h()),PRISMIC_HOST:S(C()),PRISMIC_TOKEN:S(C()),PRISMIC_DOCS_HOST:S(C()),PRISMIC_CONFIG_DIR:S(C()),PRISMIC_TYPE_BUILDER_ENABLED:S(h()),PRISMIC_SYNC_POLL_MS:S((/* @__PURE__ */ Br()).check(I(100))),PRISMIC_AUTH0_DOMAIN:S(C()),PRISMIC_AUTH0_CLIENT_ID:S(C()),PRISMIC_AGENT_WAIT_MS:c(S((/* @__PURE__ */ Br()).check(I(1))),void 0)}),Ur=k(Hr,{...process.env,PROD:`true`});function Wr(e,t){if(t)return A(ye(t));if(process.platform===`win32`){let t=process.env.APPDATA;if(t)return new URL(`${e}/`,A(ye(t)))}if(process.platform!==`darwin`){let t=process.env.XDG_CONFIG_HOME;if(t)return new URL(`${e}/`,A(ye(t)))}let n=A(ye(Ue()));return new URL(`.config/${e}/`,n)}const Y=Wr(`prismic`,Ur.PRISMIC_CONFIG_DIR),Gr=new URL(`credentials.json`,Y),Kr=new URL(`credentials.enc`,Y),qr=new URL(`credentials.lock`,Y),Jr=new URL(`login.lock`,Y),Yr=new URL(`update-notifier.json`,Y),Xr=new URL(`analytics.json`,Y),Zr=1e4,Qr={"User-Agent":`prismic-cli/${e} (${process.platform})`},$r=l({auth0Domain:C(),clientId:C(),deviceCode:C(),userCode:C(),verificationUri:C(),verificationUriComplete:S(C()),expiresAt:F(),intervalMs:F(),startedAt:F()}),ei=l({device_code:C(),user_code:C(),verification_uri:C(),verification_uri_complete:S(C()),expires_in:F(),interval:S(F())});async function ti(e,t){let r=new URL(`oauth/device/code`,si(t.auth0Domain)),i=await n(r,{method:`POST`,body:new URLSearchParams({client_id:t.clientId,...e}),headers:Qr,signal:AbortSignal.timeout(Zr),schema:ei}).catch(e=>{let t=ci(e)??(li(e)?`unavailable`:void 0);throw t?new X(t,e):e});return{auth0Domain:t.auth0Domain,clientId:t.clientId,deviceCode:i.device_code,userCode:i.user_code,verificationUri:i.verification_uri,verificationUriComplete:i.verification_uri_complete,expiresAt:Date.now()+i.expires_in*1e3,intervalMs:i.interval===void 0?5e3:i.interval*1e3,startedAt:Date.now()}}const ni=l({access_token:C(),refresh_token:C(),expires_in:F()});async function ri(e,t){let{signal:r,onUpdate:i}=t,a=e,o=a.intervalMs;for(;;){if(r?.throwIfAborted(),Date.now()>=a.expiresAt)throw new X(`expired`);try{let e=new URL(`oauth/token`,si(a.auth0Domain)),t=await n(e,{method:`POST`,body:new URLSearchParams({grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:a.deviceCode,client_id:a.clientId}),headers:Qr,signal:AbortSignal.timeout(Zr),schema:ni});return{accessToken:t.access_token,refreshToken:t.refresh_token,expiresAt:Date.now()+t.expires_in*1e3}}catch(e){let t=fi(e),n=di(e)?.error;if(n===`authorization_pending`)o=Math.max(a.intervalMs,t);else if(n===`slow_down`)a={...a,intervalMs:a.intervalMs+5e3},await i(a),o=Math.max(a.intervalMs,t);else{let n=ci(e);if(n)throw new X(n,e);if(!li(e))throw e;let r=Math.min(6e4,Math.max(o,1e3)*2);o=Math.max(a.intervalMs,r,t)}}let e=Math.min(o,a.expiresAt-Date.now());e>0&&await Ke(e,void 0,{signal:r}).catch(()=>r?.throwIfAborted())}}const ii=l({access_token:C(),refresh_token:S(C()),expires_in:F()});async function ai(e,t){let r=new URL(`oauth/token`,si(t.auth0Domain)),i=await n(r,{method:`POST`,body:new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:t.clientId}),headers:Qr,signal:AbortSignal.timeout(Zr),schema:ii}).catch(e=>{let t=di(e)?.error;if(t!==`invalid_grant`&&t!==`access_denied`)throw new X(li(e)?`unavailable`:`misconfigured`,e)});if(i)return{accessToken:i.access_token,refreshToken:i.refresh_token??e,expiresAt:Date.now()+i.expires_in*1e3}}async function oi(e,t){let r=new URL(`oauth/revoke`,si(t.auth0Domain));await n(r,{method:`POST`,body:new URLSearchParams({client_id:t.clientId,token:e}),headers:Qr,signal:AbortSignal.timeout(Zr)}).catch(e=>{throw new X(li(e)?`unavailable`:`misconfigured`,e)})}function si(e){return new URL(/^https?:\/\//.test(e)?e:`https://${e}/`)}function ci(e){if(e instanceof i){let t=di(e);switch(t?.error){case`expired_token`:return`expired`;case`access_denied`:return t?.error_description===`email_verification_failed`?`email-unverified`:`declined`;case`invalid_grant`:return`invalid-grant`}return li(e)?void 0:`misconfigured`}if(e instanceof N)return`misconfigured`}function li(e){return e instanceof i?e.status===429||e.status>=500:e instanceof v||e instanceof DOMException&&e.name===`TimeoutError`}const ui=l({error:C(),error_description:S(C())});function di(e){if(e instanceof i)return E(ui,e.body).data}function fi(e){let t=e instanceof i?e.response.headers.get(`Retry-After`):null;if(!t)return 0;let n=Number(t);if(Number.isFinite(n))return Math.max(0,n*1e3);let r=Date.parse(t);return Number.isFinite(r)?Math.max(0,r-Date.now()):0}var X=class extends Error{name=`DeviceFlowError`;reason;detail;constructor(e,t){let n=t===void 0?void 0:pi(t);super(n?`${e} (${n})`:e),this.reason=e,this.detail=n}};function pi(e){return e instanceof i?di(e)?.error??`HTTP ${e.status}`:e instanceof DOMException&&e.name===`TimeoutError`?`timeout`:e instanceof v?`network error`:`unexpected response`}const mi=[36,51];var hi=class extends Error{name=`KeyringError`;reason;constructor(e,t){super(`Keychain error: ${e}`,t),this.reason=e}};const gi={async get(e,t,n){return(await _i([`find-generic-password`,`-s`,e,`-a`,t,`-w`],void 0,n))?.replace(/\n$/,``)},async set(e,t,n,r){if(![e,t,n].every(e=>/^[^\s"'\\]+$/.test(e)))throw TypeError(`Keychain values can't contain spaces, quotes or backslashes.`);await _i([`-i`],`add-generic-password -U -s ${e} -a ${t} -w ${n}\n`,r)},async delete(e,t,n){await _i([`delete-generic-password`,`-s`,e,`-a`,t],void 0,n)}};function _i(e,t,n){return new Promise((r,i)=>{let a=Xe(`/usr/bin/security`,e,{detached:!0,signal:AbortSignal.timeout(n.timeoutMs),stdio:[`pipe`,`pipe`,`ignore`]}),o=``;a.stdout.setEncoding(`utf8`).on(`data`,e=>o+=e),a.on(`error`,e=>{i(new hi(e.name===`AbortError`?`timeout`:`unavailable`,{cause:e}))}),a.on(`close`,e=>{e===0?r(o):e===44?r(void 0):i(new hi(mi.includes(e??0)?`locked`:`rejected`))}),a.stdin.end(t)})}const vi={async get(e,t,n){return await yi(e,t,n,(e,t)=>e.getPassword(t))??void 0},async set(e,t,n,r){await yi(e,t,r,(e,t)=>e.setPassword(n,t))},async delete(e,t,n){await yi(e,t,n,(e,t)=>e.deleteCredential(t))}};async function yi(e,t,n,r){let i;try{({AsyncEntry:i}=await import(`@napi-rs/keyring`))}catch(e){throw new hi(`module-missing`,{cause:e})}let a=AbortSignal.timeout(n.timeoutMs);try{return await r(new i(e,t,{linux:{store:`secret-service`}}),a)}catch(e){if(a.aborted)throw new hi(`timeout`,{cause:e});let t=e instanceof Error?e.message:``;throw/locked/i.test(t)?new hi(`locked`,{cause:e}):new hi(process.platform===`linux`?`unavailable`:`rejected`,{cause:e})}}const bi=process.platform===`darwin`?gi:vi;async function xi(e,t){let{timeoutMs:n}=t,r={id:Te(),pid:process.pid,hostname:We()},i=Date.now()+n,a=25;for(;!await Ci(e,r);)if(!await wi(e)){if(Date.now()>=i)throw new Si(`Timed out waiting for the lock at ${ve(e)}.`);await Ke(a*(.5+Math.random())),a=Math.min(a*2,500)}let o=!1,s=async()=>!o&&(await Ti(e))?.id===r.id,c=setInterval(async()=>{if(!await s())return;let t=/* @__PURE__ */ new Date;await he(Ei(e),t,t).catch(()=>{})},2e3);return c.unref(),{isHeld:s,async release(){clearInterval(c);let t=await s();o=!0,t&&await pe(e,{recursive:!0,force:!0})}}}var Si=class extends Error{name=`LockTimeoutError`};async function Ci(e,t){try{await ce(e)}catch(e){if(e.code===`EEXIST`)return!1;throw e}try{return await ge(Ei(e),JSON.stringify(t),{flag:`wx`}),!0}catch(e){let{code:t}=e;if(t===`EEXIST`||t===`ENOENT`)return!1;throw e}}async function wi(e){let t=await Ti(e),n=await me(Ei(e)).catch(()=>me(e)).catch(()=>void 0);if(!n)return!0;let r=Date.now()-n.mtimeMs,i=r>1e4,a=!t&&r>1e3,o=t?.hostname===We()&&!Di(t.pid);if(!i&&!a&&!o)return!1;let s=new URL(`${e.href}.stale-${Te()}`);try{await fe(e,s)}catch{return!1}let c=await Ti(s);if(c&&c.id!==t?.id)try{return await fe(s,e),!1}catch{}return await pe(s,{recursive:!0,force:!0}),!0}async function Ti(e){try{return JSON.parse(await ue(Ei(e),`utf8`))}catch{return}}function Ei(e){return new URL(`${e.href}/owner.json`)}function Di(e){try{return process.kill(e,0),!0}catch(e){return e.code===`EPERM`}}const Oi=`prismic-cli`,ki=`cli:${Ce(`sha256`).update(ve(Y)).digest(`hex`).slice(0,16)}`,Ai=5e3,ji=3e4,Mi=Buffer.from([1]),Ni=l({host:C(),auth0Domain:C(),clientId:C(),accessToken:S(C()),refreshToken:S(C()),expiresAt:S(F()),pendingLogin:S(y($r,{host:C()}))}),Pi=g([`wsl`,`secret-service-missing`,`locked`,`write-rejected`,`timeout`,`module-missing`]),Fi=g([`keyring`,`file`]),Ii=l({version:S(O()),host:c(S(C()),void 0),store:c(S(Fi),void 0),storeReason:c(S(Pi),void 0),expiresAt:c(S(F()),void 0)});let Li,Ri=!1;async function Z(){let e=oa(await aa(Gr)),{version:t,store:n,storeReason:r}=E(Ii,e).data??{};if(t===void 0)return{};if(t!==2)throw new qi("Your Prismic login was saved by a newer version of the CLI. Update the CLI, or run `prismic login` again.");if(!n)throw Qi();let i=E(Ni,n===`file`?e:oa(await Xi()));if(!i.success)throw Qi();return{login:{store:n,storeReason:r,session:i.data}}}async function zi(){let e=oa(await aa(Gr).catch(()=>void 0));return E(Ii,e).data??{}}const Bi={"module-missing":`module-missing`,unavailable:`secret-service-missing`,locked:`locked`,rejected:`write-rejected`,timeout:`timeout`};async function Vi(e){if(process.platform===`linux`&&/microsoft/i.test(Ge()))return{store:`file`,storeReason:`wsl`};try{if(Li=void 0,!await Ji(Ai)){let t=we(32);await $i(e),await bi.set(Oi,ki,t.toString(`base64`),{timeoutMs:Ai}),Li=t}return{store:`keyring`}}catch(e){if(!(e instanceof hi))throw e;return{store:`file`,storeReason:Bi[e.reason]}}}async function Hi(e,t){let{store:n,storeReason:r,session:i}=t,a;if(n===`keyring`){let{host:t,expiresAt:r,auth0Domain:o,clientId:s}=i;a=await ra(e,[[Kr,ea(JSON.stringify(i),await Yi())],[Gr,P({version:2,host:t,expiresAt:r,store:n,auth0Domain:o,clientId:s})]])}else a=await ra(e,[[Gr,P({version:2,store:n,storeReason:r,...i})]]),await ia(e,Kr);a||Ri||(Ri=!0,console.warn(`Can't make ${ve(Gr)} readable only by you on this disk. Set PRISMIC_CONFIG_DIR to a private folder on another disk.`))}async function Ui(e){let{host:t,store:n}=await zi(),r=n===`keyring`||await j(Kr);t?await ra(e,[[Gr,P({host:t})]]):await ia(e,Gr),await ia(e,Kr),r&&(Li=void 0,await $i(e),await bi.delete(Oi,ki,{timeoutMs:ji}).catch(e=>{if(!(e instanceof hi))throw e;console.warn(`Can't delete your Prismic key from the keychain. Your next login reuses it.`)}))}async function Wi(e){let t=await Ki(qr,{timeoutMs:3e4}).catch(e=>{throw e instanceof Si?new qi(`Another Prismic command is still using your login. Run the command again.`):e});try{return await e(t)}finally{await t.release()}}async function Gi(e){return Ki(Jr,e)}async function Ki(e,t){try{return await na(),await xi(e,t)}catch(e){let t=e.code;throw t!==`EACCES`&&t!==`EPERM`&&t!==`EROFS`?e:new qi(`Can't write to ${ve(Y).replace(/[/\\]$/,``)}. Set PRISMIC_CONFIG_DIR to a private folder outside your project.`,{cause:e})}}var qi=class extends Error{name=`CredentialsError`};async function Ji(e){if(Li)return Li;let t=await bi.get(Oi,ki,{timeoutMs:e}),n=t?Buffer.from(t,`base64`):void 0;return n?.length===32&&(Li=n),Li}async function Yi(){let e=await Ji(ji).catch(e=>{throw e instanceof hi?new qi(`Can't read your Prismic key because ${Zi[e.reason]??`the keychain isn't available. Try again`}, or run \`prismic login\` again.`,{cause:e}):e});if(!e)throw Qi();return e}async function Xi(){let e=await aa(Kr),t=Li!==void 0,n=ta(e,await Yi());return n||!t?n:(Li=void 0,ta(e,await Yi()))}const Zi={locked:`the keychain is locked in this session. Unlock it and try again`,timeout:`the keychain didn't respond. Try again`};function Qi(){return new qi("Your Prismic login can't be decrypted. Run `prismic login` again.")}async function $i(e){if(!await e.isHeld())throw new qi(`Another Prismic command took over the login while this one stalled. Run the command again.`)}function ea(e,t){let n=we(12),r=xe(`aes-256-gcm`,t,n);r.setAAD(Mi);let i=Buffer.concat([r.update(e,`utf8`),r.final()]);return Buffer.concat([Mi,n,r.getAuthTag(),i])}function ta(e,t){if(!(!e||e.length<29||e[0]!==Mi[0]))try{let n=Se(`aes-256-gcm`,t,e.subarray(1,13));return n.setAAD(Mi),n.setAuthTag(e.subarray(13,29)),Buffer.concat([n.update(e.subarray(29)),n.final()]).toString(`utf8`)}catch{return}}async function na(){await ce(Y,{recursive:!0,mode:448}),process.platform!==`win32`&&(await me(Y)).mode&63&&await se(Y,448)}async function ra(e,t){let n=!0;for(let[r,i]of t){let t=new URL(`${r.href}.${Te()}.tmp`);try{let n=await le(t,`wx`,384);try{await n.writeFile(i),await n.sync()}finally{await n.close()}await $i(e),await fe(t,r)}catch(e){throw await pe(t,{force:!0}),e}if(process.platform===`win32`)continue;let a=await W(r);((a.mode&511)!=384||a.uid!==process.getuid?.())&&(n=!1)}return n}async function ia(e,t){await $i(e),await pe(t,{force:!0})}async function aa(e){let t=t=>new qi(`Refusing to read ${ve(e)} because ${t}. Delete it and run \`prismic login\` again.`),n;try{if(process.platform===`win32`&&(await W(e)).isSymbolicLink())throw t(`it's a symbolic link`);n=await le(e,qe.O_RDONLY|(qe.O_NOFOLLOW??0))}catch(n){let{code:r}=n;if(r===`ENOENT`)return;throw r===`ELOOP`?t(`it's a symbolic link`):r===`EACCES`||r===`EPERM`?new qi(`Can't read ${ve(e)}. Delete it and run \`prismic login\` again.`):n}try{let e=await n.stat();if(!e.isFile())throw t(`it isn't a regular file`);if(process.platform===`win32`)return await n.readFile();if(e.uid!==process.getuid?.())throw t(`it belongs to another user`);return e.mode&63&&await n.chmod(384).catch(()=>{}),await n.readFile()}finally{await n.close()}}function oa(e){try{return e&&JSON.parse(e.toString())}catch{return}}function sa(){if(process.env.AI_AGENT?.toLowerCase().startsWith(`claude-code_`))return`claude-code`;if(process.env.AI_AGENT!==void 0)return process.env.AI_AGENT.toLowerCase()||void 0;if(process.env.CLAUDE_CODE_IS_COWORK===`1`||process.env.CLAUDE_CODE_IS_COWORK===`true`)return`claude-cowork`;if(process.env.CLAUDECODE===`1`||process.env.CLAUDE_CODE)return`claude-code`;if(process.env.CODEX_CI===`1`||process.env.CODEX_SANDBOX||process.env.CODEX_THREAD_ID)return`codex`;if(process.env.CURSOR_AGENT===`1`||process.env.CURSOR_EXTENSION_HOST_ROLE===`agent-exec`)return`cursor`;if(process.env.CLINE_ACTIVE===`true`)return`cline`;if(process.env.ANTIGRAVITY_AGENT)return`antigravity`;if(process.env.AUGMENT_AGENT===`1`)return`augment`;if(process.env.OPENCODE_CLIENT===`1`)return`opencode`;if(process.env.GEMINI_CLI===`1`)return`gemini-cli`;if(process.env.TRAE_AI_SHELL_ID)return`trae`;if(process.env.REPL_ID)return`replit`;if(process.env.COPILOT_MODEL||process.env.COPILOT_ALLOW_ALL||process.env.COPILOT_GITHUB_TOKEN)return`github-copilot`;let e=process.env.AGENT?.toLowerCase();if(e===`goose`||e===`amp`)return e;if(process.platform===`linux`&&Je(`/opt/.devin`))return`devin`;if(process.env.IS_SANDBOX===`yes`)return`unknown-sandbox`}function ca(e){let t=process.platform===`darwin`?`open`:process.platform===`win32`?`start ""`:`xdg-open`;Ye(`${t} "${e.toString()}"`)}const la=jt.withOptions({alignValues:!0});function ua(e,...t){if(typeof e==`string`)return la(e);let n=Array.from(e);return la(Object.assign(n,{raw:n}),...t)}function da(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}function fa(e,t){let n=t?.headers?[t.headers,...e]:e,r=[];for(let e of n)for(let t=0;t<e.length;t++)r[t]=Math.max(r[t]??0,e[t].length);return n.map(e=>e.map((t,n)=>n<e.length-1?t.padEnd(r[n]):t).join(` `).trimEnd()).join(`
182
+ `)}const pa=sa()!==void 0,ma={"user-intent":{type:`string`,description:`The user's overall task in one short US English sentence. Paraphrase their original request, not what this command does. Pass the same value on every command for the same task. Used for analytics only.`},"task-id":{type:`string`,description:`Groups the commands of one user request. One id covers the whole request, not one per command. Get a new id from the task-id command when the user asks for something new. Used for analytics only.`},"analytics-intent":{type:`string`,hidden:!0,description:`Renamed to --user-intent.`},"analytics-task-id":{type:`string`,hidden:!0,description:`Renamed to --task-id.`}};function ha(e,t){return async function(){let{positionals:n={},options:r={}}=e,i;try{i=U({args:process.argv.slice(1+e.name.split(` `).length),options:{...r,...ma,help:{type:`boolean`,short:`h`}},allowPositionals:Object.keys(n).length>0,strict:!0})}catch(e){throw e instanceof TypeError&&`code`in e&&typeof e.code==`string`&&e.code.startsWith(`ERR_PARSE_ARGS_`)?new Q(e.message):e}if(i.values.help){let t=Object.keys(n),i={..._a(e.name,e.agents),USAGE:` ${[e.name,...t.map(e=>`<${e}>`),`[options]`].join(` `)}`};t.length>0&&(i.ARGUMENTS=fa(Object.entries(n).map(([e,t])=>[` <${e}>`,t.description+(t.required?` (required)`:``)]))),i.OPTIONS=fa(va(r)),console.info(ya(e.description,i,e.name.split(` `)[0],e.sections))}else{for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!i.positionals[e])throw new Q(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r)){if(t.required&&!(e in i.values))throw new Q(`Missing required option: --${e}`);if(e in i.values&&(t.deprecated&&console.warn(`--${e} is deprecated. ${t.deprecated}`),t.dependsOn&&!(t.dependsOn in i.values)))throw new Q(`--${e} can only be used with --${t.dependsOn}.`)}await t(i)}}}function ga(e){return async function(){let{positionals:[t]}=U({args:process.argv.slice(1+e.name.split(` `).length),options:{...ma,help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});if(t){let n=e.commands[t];if(!n)throw new Q(`Unknown command: ${t}`);await n.handler();return}let n={..._a(e.name),USAGE:` ${e.name} <command> [options]`,COMMANDS:fa(Object.entries(e.commands).filter(([,e])=>!e.hidden).map(([e,t])=>[` ${e}`,t.description])),OPTIONS:fa(va({}))};console.info(ya(e.description,n,e.name,e.sections))}}function _a(e,t){if(!pa)return{};let n=ua`
183
+ Every command except --help, read-only ones included, needs the same
184
+ --task-id and the same --user-intent, the user's request in one sentence, for
185
+ as long as you work on that request. Get the id first: run \`${e.split(` `)[0]} task-id\`
186
+ on its own and wait for its output before you run any other command, as
187
+ commands without the id fail. All the steps of one request share the id, and
188
+ the next request gets a new one. The id and intent are used for analytics
189
+ only.
190
+ `;return{AGENTS:(t?`${n}\n\n${ua(t)}`:n).replace(/^(?=.)/gm,` `)}}function va(e){let t=pa?{...e,...ma}:e,n=[];for(let[e,r]of Object.entries(t)){if(r.deprecated||r.hidden)continue;let t=r.short?`-${r.short}, `:` `,i=r.type===`string`?` string`:``,a=r.description+(r.required?` (required)`:``);n.push([` ${t}--${e}${i}`,a])}return n.push([` -h, --help`,`Show help for command`]),n}function ya(e,t,n,r={}){let i=[ua(e)];for(let[e,n]of Object.entries(t))i.push(``,e,n);for(let[e,t]of Object.entries(r))i.push(``,e,...ua(t).split(`
191
+ `).map(e=>e?` ${e}`:``));return i.push(``,`LEARN MORE`,` Use \`${n} <command> --help\` for more information about a command.`),i.join(`
192
+ `)}function ba(e,t){let n=t.filter(t=>t in e),r=t.map(e=>`--${String(e)}`).join(` or `);if(n.length>1)throw new Q(`Only one of ${r} can be specified.`);if(n.length===0)throw new Q(`Specify one of ${r}.`);return{key:n[0],value:e[n[0]]}}function xa(e,t){let n=t.filter(t=>t in e),r=t.map(e=>`--${String(e)}`).join(` or `);if(n.length>1)throw new Q(`Only one of ${r} can be specified.`)}var Q=class extends Error{name=`CommandError`};const Sa=t([l({type:ee(`USER`),email:C(),shortId:C()}),l({type:ee(`Machine2Machine`),domain:C(),appName:C()})]);async function Ca(e,t){let r=new URL(`validate`,wa(t.host));return n(r,{headers:e?{Authorization:`Bearer ${e}`}:void 0,schema:Sa})}function wa(e){return new URL(`https://auth.${e}/`)}const Ta=l({email:C(),shortId:C(),intercomHash:C()}),Ea=l({domain:C(),name:S(C()),role:S(t([C(),x(C(),C())]))});async function Da(e){let t=new URL(`user/profile`,ka(e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:Ta,unknownErrorMessage:`Failed to load your profile`})}async function Oa(e){let t=new URL(`user/repositories`,ka(e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:l({repositories:V(Ea)}),unknownErrorMessage:`Failed to load your repositories`})}function ka(e){return new URL(`https://api.internal.${e}/`)}const Aa=l({name:S(C()),starter:u(l({id:C(),revision:C(),framework:C(),deploymentUrl:R()})),framework:S(C()),quotas:S(l({sliceMachineEnabled:r()}))});async function ja(e){let t=new URL(``,Ia(e.host));return t.searchParams.set(`repository`,e.repo),n(t,{headers:await No(e),onUnauthorized:e.onUnauthorized,schema:Aa,notFoundMessage:`Repository not found: ${e.repo}`})}async function Ma(e,t){let r=new URL(`type-builder`,Ia(t.host));r.searchParams.set(`repository`,t.repo),await n(r,{method:`PATCH`,json:{framework:e},headers:await No(t),onUnauthorized:t.onUnauthorized,notFoundMessage:`Repository not found: ${t.repo}`})}const Na=l({completedSteps:V(C())});async function Pa(e){let t=new URL(`onboarding`,Ia(e.host));return t.searchParams.set(`repository`,e.repo),n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:Na})}async function Fa(e,t){let r=new URL(`onboarding/${encodeURIComponent(e)}/toggle`,Ia(t.host));return r.searchParams.set(`repository`,t.repo),n(r,{method:`PATCH`,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,schema:Na})}function Ia(e){return new URL(`https://api.internal.${e}/repository/`)}async function La(e){let t=new URL(`customtypes`,Ba(e.host));return e.releaseId&&t.searchParams.set(`release`,e.releaseId),n(t,{headers:await No(e),onUnauthorized:e.onUnauthorized,notFoundMessage:`Repository not found: ${e.repo}`})}async function Ra(e){let t=new URL(`slices`,Ba(e.host));return e.releaseId&&t.searchParams.set(`release`,e.releaseId),n(t,{headers:await No(e),onUnauthorized:e.onUnauthorized,notFoundMessage:`Repository not found: ${e.repo}`})}async function za(e,t){let r=new URL(`bulk-update`,Ba(t.host));t.releaseId&&r.searchParams.set(`release`,t.releaseId),await n(r,{method:`POST`,json:{changes:e},headers:await No(t),onUnauthorized:t.onUnauthorized,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to update models`})}function Ba(e){return new URL(`https://customtypes.${e}/`)}const Va=l({values:l({url:C(),fields:x(C(),C())}),imgixEndpoint:C()}),Ha={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function Ua(e,t){let r=new URL(`delete`,qa(t.host));r.searchParams.set(`repository`,t.repo),await n(r,{method:`POST`,json:{sliceId:e},headers:await No(t),onUnauthorized:t.onUnauthorized})}async function Wa(e,t){let{sliceId:r,variationId:i,repo:a}=t,o=e.type;if(!(o in Ha))throw new Ka(o);let s=await Ga(t),c=Ha[o],l=`${a}/shared-slices/${r}/${i}/${Ce(`sha1`).update(new Uint8Array(await e.arrayBuffer())).digest(`hex`)}${c}`,u=new FormData;for(let[e,t]of Object.entries(s.values.fields))u.append(e,t);u.set(`key`,l),u.set(`Content-Type`,o),u.set(`file`,e),await n(s.values.url,{method:`POST`,body:u});let d=new URL(l,A(s.imgixEndpoint));return d.searchParams.set(`auto`,`compress,format`),d}async function Ga(e){let t=new URL(`presigned-url`,qa(e.host));return t.searchParams.set(`repository`,e.repo),n(t,{headers:await No(e),onUnauthorized:e.onUnauthorized,schema:Va})}var Ka=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){let t=Object.keys(Ha);super(`Unsupported file type: ${e||`unknown`}. Supported: ${t.join(`, `)}`)}};function qa(e){return new URL(`https://api.internal.${e}/screenshot/`)}const Ja=l({id:C(),label:C(),customName:o(C()),isMaster:r()});async function Ya(e){let t=new URL(`repository/locales`,Qa(e.host));return t.searchParams.set(`repository`,e.repo),n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:l({results:V(Ja)}),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load locales`})}async function Xa(e,t){let r=new URL(`repository/locales`,Qa(t.host));return r.searchParams.set(`repository`,t.repo),n(r,{method:`POST`,json:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,schema:Ja,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to save locale`})}async function Za(e,t){let r=new URL(`repository/locales/${encodeURIComponent(e)}`,Qa(t.host));r.searchParams.set(`repository`,t.repo),await n(r,{method:`DELETE`,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Locale not found: ${e}`,unknownErrorMessage:`Failed to remove locale`})}function Qa(e){return new URL(`https://api.internal.${e}/locale/`)}const $a=l({id:C(),label:C(),url:C()});async function eo(e){let t=new URL(`core/repository/preview_configs`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:l({results:V($a)}),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load previews`})}async function to(e,t){let r=new URL(`previews/new`,$(t.repo,t.host));await n(r,{method:`POST`,json:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to add preview`})}async function no(e,t){let r=new URL(`previews/delete/${encodeURIComponent(e)}`,$(t.repo,t.host));await n(r,{method:`POST`,json:{},headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Preview not found: ${e}`,unknownErrorMessage:`Failed to remove preview`})}const ro=l({kind:g([`prod`,`stage`,`dev`]),name:C(),domain:C(),users:V(l({id:C()}))});async function io(e){let t=new URL(`core/environments`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:l({results:V(ro)}),notFoundMessage:`Repository not found: ${e.repo}`})}async function ao(e){let t=new URL(`core/repository`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:l({simulator_url:S(C())}),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load simulator URL`})}async function oo(e,t){let r=new URL(`core/repository`,$(t.repo,t.host));await n(r,{method:`PATCH`,json:{simulator_url:e},headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to set simulator URL`})}async function so(e,t){let r=new URL(`core/documents/search`,$(t.repo,t.host));return n(r,{method:`POST`,json:{customTypes:[e],limit:0},headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,schema:l({total:F()}),notFoundMessage:`Repository not found: ${t.repo}`})}async function co(e,t){let r=new URL(`core/releases`,$(t.repo,t.host));return n(r,{method:`POST`,json:e,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,schema:b({id:C()}),notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to create a release`})}async function lo(e,t){let r=new URL(`core/releases/${encodeURIComponent(e)}`,$(t.repo,t.host));await n(r,{method:`DELETE`,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Release not found: ${e}`,unknownErrorMessage:`Failed to delete the release`})}const uo=l({documentsPublished:r(),documentsUnpublished:r(),releasesCreated:r(),releasesUpdated:r(),tagsCreated:r(),tagsDeleted:r()}),fo=Object.keys(uo.shape),po=l({config:y(uo,{_id:C(),url:C(),active:r(),name:o(C()),secret:o(C()),headers:x(C(),C())})});async function mo(e){let t=new URL(`app/settings/webhooks`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:V(po),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load webhooks`})}async function ho(e,t){let r=vo({...e,active:!0,headers:{}}),i=new URL(`app/settings/webhooks/create`,$(t.repo,t.host));await n(i,{method:`POST`,body:r,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to create webhook`})}async function go(e,t,r){let i=vo(t),a=new URL(`app/settings/webhooks/${encodeURIComponent(e)}`,$(r.repo,r.host));await n(a,{method:`POST`,body:i,headers:{Authorization:`Bearer ${await r.getToken()}`},onUnauthorized:r.onUnauthorized,notFoundMessage:`Webhook not found: ${e}`,unknownErrorMessage:`Failed to update webhook`})}async function _o(e,t){let r=new URL(`app/settings/webhooks/${encodeURIComponent(e)}/delete`,$(t.repo,t.host));await n(r,{method:`POST`,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Webhook not found: ${e}`,unknownErrorMessage:`Failed to delete webhook`})}function vo(e){let t=new FormData;return t.set(`url`,e.url),t.set(`name`,e.name??``),t.set(`secret`,e.secret??``),t.set(`headers`,JSON.stringify(e.headers??{})),t.set(`active`,e.active?`on`:`off`),t.set(`documentsPublished`,e.documentsPublished.toString()),t.set(`documentsUnpublished`,e.documentsUnpublished.toString()),t.set(`releasesCreated`,e.releasesCreated.toString()),t.set(`releasesUpdated`,e.releasesUpdated.toString()),t.set(`tagsCreated`,e.tagsCreated.toString()),t.set(`tagsDeleted`,e.tagsDeleted.toString()),t}const yo=l({id:C(),scope:C(),token:C(),created_at:l({$date:F()})}),bo=l({id:C(),name:C(),wroom_auths:V(yo)}),xo=l({app_name:C(),token:C(),timestamp:F()}),So=l({max_tokens:F(),tokens:V(xo)});async function Co(e){let t=new URL(`settings/security/contentapi`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:V(bo),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load OAuth apps`})}async function wo(e,t){let r=new URL(`settings/security/oauthapp`,$(t.repo,t.host));return n(r,{method:`POST`,json:{app_name:e},headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,schema:bo,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to create OAuth app`})}async function To(e,t,r){let i=new URL(`settings/security/authorizations`,$(r.repo,r.host));return n(i,{method:`POST`,json:{app:e,scope:t},headers:{Authorization:`Bearer ${await r.getToken()}`},onUnauthorized:r.onUnauthorized,schema:yo,notFoundMessage:`Repository not found: ${r.repo}`,unknownErrorMessage:`Failed to create token`})}async function Eo(e,t){let r=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,$(t.repo,t.host));await n(r,{method:`DELETE`,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Token not found: ${e}`,unknownErrorMessage:`Failed to delete token`})}async function Do(e){let t=new URL(`settings/security/customtypesapi`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:So,notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load write tokens`})}async function Oo(e,t){let r=new URL(`settings/security/token`,$(t.repo,t.host));return n(r,{method:`POST`,json:{app_name:e},headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,schema:xo,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to create write token`})}async function ko(e,t){let r=new URL(`settings/security/token/${encodeURIComponent(e)}`,$(t.repo,t.host));await n(r,{method:`DELETE`,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Token not found`,unknownErrorMessage:`Failed to delete write token`})}async function Ao(e){let t=new URL(`syncState`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:l({repository:l({api_access:C()})}),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load repository access`})}async function jo(e,t){let r=new URL(`settings/security/apiaccess`,$(t.repo,t.host));await n(r,{method:`POST`,json:{api_access:e},headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to set repository access`})}async function Mo(e,t){let r=new FormData;r.set(`displayname`,e);let i=new URL(`app/settings/repository`,$(t.repo,t.host));return n(i,{method:`POST`,body:r,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,schema:l({repository:l({name:C()})}),notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to set repository name`})}function $(e,t){return new URL(`https://${Po(e)}.${t}/`)}async function No(e){let t=Po(e.repo);return{Authorization:`Bearer ${await e.getToken()}`,repository:t}}function Po(e){if(!f(e))throw new Fo(e);return e}var Fo=class extends Error{name=`InvalidRepositoryDomainError`;constructor(e){super(`Check your repository domain: ${JSON.stringify(e)}. Pass one repository domain per command, such as "my-repo".`)}};async function Io(e){let t=new URL(`app/dashboard/repositories/${encodeURIComponent(e.domain)}/exists`,Ro(e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:r()})}async function Lo(e){let{domain:t,name:r,framework:i,agent:a,host:o}=e,s=new URL(`app/dashboard/repositories`,Ro(o));s.searchParams.set(`app`,`cli`),a&&s.searchParams.set(`agent`,a),await n(s,{method:`POST`,json:{domain:t,name:r,framework:i,plan:`personal`},headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,unknownErrorMessage:`Failed to create repository`})}function Ro(e){return new URL(`https://${e}/`)}const zo=l({path:C(),title:C(),description:S(C())}),Bo=l({path:C(),title:C(),description:S(C()),anchors:V(l({slug:C(),excerpt:C()}))});async function Vo(e){let t=new URL(`api/index/`,Wo(e.host));return n(t,{schema:V(zo),unknownErrorMessage:`Failed to fetch documentation index`})}async function Ho(e,t){let r=new URL(`api/index/${e}`,Wo(t.host));return n(r,{schema:Bo,notFoundMessage:`Documentation page not found: ${e}`,unknownErrorMessage:`Failed to fetch documentation index`})}async function Uo(e,t){let r=new URL(e,Wo(t.host));return n(r,{headers:{Accept:`text/markdown`,...t.headers},schema:C(),notFoundMessage:`Page not found: ${e}`,unknownErrorMessage:`Failed to fetch documentation page`})}function Wo(e=`prismic.io`){return new URL(`https://${e}/docs/`)}const Go=b({exp:S(F()),type:S(C())});function Ko(e){try{let[,t]=e.split(`.`);if(!t)return;let n=JSON.parse(Buffer.from(t,`base64url`).toString());return k(Go,n)}catch{return}}const qo=l({anonymousId:C(),userId:S(C())}),Jo=!Ur.PRISMIC_TOKEN;let Yo=!1,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss;const cs=crypto.randomUUID();let ls;async function us(e){let{host:t,repo:n}=e;n&&(Xo=n),ts=e.userIntent,ns=e.taskId,rs=e.store,is=e.storeReason;let r=t===`prismic.io`?`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`:`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`;Zo=sa(),Qo=hs(e.loggedIn),{runtime:$o,runtimeProvider:es}=gs();let i=await ys();ss=i??{anonymousId:crypto.randomUUID()},i||await bs(ss),oe({writeKey:r,anonymousId:ss.anonymousId,userId:fs()})}function ds(e){H({userId:e.shortId,intercomHash:e.intercomHash}),Jo&&!Yo&&ss&&(ss.userId=e.shortId,bs(ss))}function fs(){return Jo?ss?.userId:void 0}function ps(){if(!ss)return{};let e=fs();return{"Prismic-Anonymous-Id":ss.anonymousId,...e?{"Prismic-User-Id":e}:{}}}async function ms(){Yo=!0;let e=await ys();e?.userId&&await bs({anonymousId:e.anonymousId})}function hs(e){if(!Ur.PRISMIC_TOKEN)return e?`login`:`none`;let t=Ko(Ur.PRISMIC_TOKEN);return t?t.type===`machine2machine`?`write-token`:`user-token`:`unknown-token`}function gs(){let e=_s();if(e)return{runtime:`cloud`,runtimeProvider:e};let t=vs();return t||process.env.CI?{runtime:`ci`,runtimeProvider:t}:Je(`/.dockerenv`)||Je(`/run/.containerenv`)||process.env.KUBERNETES_SERVICE_HOST?{runtime:`container`}:process.platform!==`linux`||process.env.WSL_DISTRO_NAME?{runtime:`local`}:{runtime:`unknown`}}function _s(){if(process.env.CLAUDE_CODE_REMOTE===`true`)return`claude-code`;if(process.env.CODEX_EXEC_SERVER_REMOTE_BASE_URL)return`codex`;if(process.env.CURSOR_AGENT&&process.env.CLOUD_AGENT_ALL_SECRET_NAMES!==void 0)return`cursor`;if(process.env.CODESPACES===`true`)return`codespaces`;if(process.env.GITPOD_WORKSPACE_ID)return`gitpod`;if(process.versions.webcontainer)return`stackblitz`;if(process.env.REPL_ID)return`replit`;if(process.env.CODESANDBOX_HOST)return`codesandbox`;if(process.env.MODAL_SANDBOX_ID)return`modal`;if(process.env.E2B_SANDBOX)return`e2b`;if(Je(`/opt/.devin`))return`devin`}function vs(){if(process.env.GITHUB_ACTIONS===`true`)return`github-actions`;if(process.env.GITLAB_CI)return`gitlab`;if(process.env.CIRCLECI)return`circleci`;if(process.env.BITBUCKET_BUILD_NUMBER)return`bitbucket`;if(process.env.TF_BUILD)return`azure-pipelines`;if(process.env.JENKINS_URL)return`jenkins`;if(process.env.BUILDKITE)return`buildkite`;if(process.env.CODEBUILD_BUILD_ID)return`codebuild`;if(process.env.TEAMCITY_VERSION)return`teamcity`;if(process.env.VERCEL&&process.env.CI)return`vercel`;if(process.env.NETLIFY)return`netlify`;if(process.env.CF_PAGES)return`cloudflare-pages`}async function ys(){return w(Xr,{schema:qo}).catch(()=>void 0)}async function bs(e){await _(Xr,P(e)).catch(()=>{})}function xs(e,t={}){let{watch:n}=t;ls={type:e,watch:n},ae(`Prismic CLI Start`,{properties:{commandType:e,invocationId:cs,fullCommand:process.argv.join(` `),repository:Xo,watch:n,agent:Zo,auth:Qo,runtime:$o,runtimeProvider:es,userIntent:ts,taskId:ns},groupId:Xo?{Repository:Xo}:void 0})}function Ss(e={}){if(!ls)return;let{type:t,watch:n}=ls;ls=void 0;let{error:r}=e,i=r?r instanceof Error?r.message:String(r):void 0;ae(`Prismic CLI End`,{properties:{commandType:t,invocationId:cs,fullCommand:process.argv.join(` `),success:!process.exitCode,repository:Xo,watch:n,error:i?.slice(0,512),agent:Zo,auth:Qo,store:rs,storeReason:is,loginResult:as?.result,loginResumed:as?.resumed,loginDurationS:as?.durationS,revoked:os,runtime:$o,runtimeProvider:es,userIntent:ts,taskId:ns},groupId:Xo?{Repository:Xo}:void 0})}function Cs(e){let{result:t,resumed:n,startedAt:r}=e;as={result:t,resumed:n,durationS:Math.round((Date.now()-r)/1e3)},e.store&&({store:rs,storeReason:is}=e)}function ws(e){os=e.revoked}const Ts={expired:`expired`,declined:`declined`,"email-unverified":`email-unverified`,"invalid-grant":`error`,misconfigured:`error`,unavailable:`error`};function Es(e){return e instanceof X?Ts[e.reason]:`error`}const Ds=l({telemetry:r()});async function Os(){try{return!(await ks(Ue())||await ks(process.cwd()))}catch{return!0}}async function ks(e){return(await w(new URL(`.prismicrc`,A(ye(e))),{schema:Ds}).catch(()=>void 0))?.telemetry===!1}const As=3e5,js=1e3,Ms={audience:`prismic.io`,scope:`openid profile email offline_access`},Ns=new URL(`.prismic`,A(ye(Ue())));let Ps,Fs=!1,Is,Ls;async function Rs(){return Ur.PRISMIC_TOKEN||Bs()}async function zs(){return Ur.PRISMIC_HOST?Ur.PRISMIC_HOST:(Ls??=zi().then(e=>e.host),await Ls||`prismic.io`)}async function Bs(e={}){let{forceRefresh:t=!1}=e,n=(await Z()).login?.session;if(!n?.refreshToken||n.host!==await zs())return;let r=Hs(n,As);if(r&&!t)return r;Ps??=Wi(async e=>{let{login:t}=await Z();return Vs(e,t,n.accessToken,{canRetry:!0})}).finally(()=>Ps=void 0);try{return await Ps}catch(e){let r=Hs(n);if((e instanceof X||e instanceof qi)&&r&&!t)return r;throw e}}async function Vs(e,t,n,r){let i=t?.session;if(!t||!i?.refreshToken||i.host!==await zs())return;let a=Hs(i,As);if(a&&a!==n)return a;let{refreshToken:o,auth0Domain:s,clientId:c,host:l}=i,u=await ai(o,i);if(u)return await Hi(e,{...t,session:{...i,...u}}),u.accessToken;let d=(await Z()).login;if(r.canRetry&&d?.session.refreshToken!==o&&await e.isHeld())return Vs(e,d,n,{canRetry:!1});await Hi(e,{...t,session:{host:l,auth0Domain:s,clientId:c,pendingLogin:i.pendingLogin}}),Fs=!0}function Hs(e,t=0){let{accessToken:n,expiresAt:r}=e;if(n&&r&&r-t>Date.now())return n}async function Us(e,t){if(Ur.PRISMIC_TOKEN||process.env.CI)return;let n=await Rs();if(n&&t.get(`Authorization`)!==`Bearer ${n}`)return e({headers:{Authorization:`Bearer ${n}`}});if(Is||await Ws(n))return Is??=Gs().finally(()=>Is=void 0),e({headers:{Authorization:`Bearer ${await Is}`}})}async function Ws(e){try{return await Ca(e,{host:await zs()}),!1}catch(e){return e instanceof p||e instanceof z}}async function Gs(e={}){return await Bs({forceRefresh:!0})||(console.error(Fs?`Your login expired.`:`You are not logged in.`),Ks(e))}async function Ks(e={}){let{browser:t=!1}=e,n=await zs(),r=qs(n);if(!r)throw new Q(`Login isn't available for ${n}. Use PRISMIC_TOKEN.`);let i=sa()===void 0&&process.stdin.isTTY===!0&&process.stderr.isTTY===!0,a={host:n,auth0:r,deadline:i?1/0:Date.now()+9e4,startedAt:Date.now(),resumed:!1,waited:!1,tokenBefore:(await Z().catch(()=>void 0))?.login?.session.accessToken},o=process.rawListeners(`SIGINT`);process.removeAllListeners(`SIGINT`),process.once(`SIGINT`,async()=>{a.cancelled=!0,console.error(),a.pending&&await tc(a.pending,void 0);let{resumed:e,startedAt:t,saved:n}=a;Cs({result:n?`success`:`cancelled`,resumed:e,startedAt:t,store:n?.store,storeReason:n?.storeReason}),await Js(n?`Logged in to Prismic.`:`Login cancelled.`,130)});let s;try{s=await Ys(a,{browser:t&&i})}catch(e){throw Cs({result:Es(e),resumed:a.resumed,startedAt:a.startedAt}),e}finally{process.removeAllListeners(`SIGINT`);for(let e of o)process.on(`SIGINT`,e)}let{resumed:c,startedAt:l}=a;if(s.status===`wait-limit`)return Cs({result:`wait-limit`,resumed:c,startedAt:l}),Js(`Waiting for approval. After the user approves, run the same command again. It continues this login.`,1);if(s.status===`logged-out`)throw Cs({result:`cancelled`,resumed:c,startedAt:l}),new Q(`A logout cancelled this login. Run the command again to log in.`);let{token:u,email:d,store:f,storeReason:p}=s;return a.pending&&Cs({result:`success`,resumed:c,startedAt:l,store:f,storeReason:p}),console.error(`Logged in to Prismic as ${d}`),u}function qs(e){if(e===`prismic.io`)return{auth0Domain:`auth0.prismic.io`,clientId:`V1yuPKJOHhuHNMR4Oeo2fj5uTCfVebny`};if(e===`wroom.io`||e===`devops-wroom.com`)return{auth0Domain:`auth0.wroom.io`,clientId:`UKxsYw8EcAspkUPRvoFkrO1aj9cA3zkd`};if(/^[a-z0-9-]+-wroom\.com$/.test(e))return{auth0Domain:`auth0.platform-wroom.com`,clientId:`Opbx7JjftGb5sgjIWKVx0XDBSrW37say`}}async function Js(e,t){process.exitCode=t,Ss({error:e}),await new Promise(t=>process.stderr.write(`${e}\n`,t)),process.exit()}async function Ys(e,t){let n=await Xs(e);if(!n)return{status:`wait-limit`};let r;try{let n=await Zs(e);if(n.status===`logged-out`)return n;if(n.status===`saved`)r=n;else{let{pending:i}=n;i.deviceCode!==e.shown?.deviceCode&&$s(i);let a=i.verificationUriComplete??i.verificationUri;t.browser&&/^https:\/\/[\w\-.:/?=&~+]+$/.test(a)&&URL.canParse(a)&&ca(new URL(a));let o=await ec(e,i);if(`status`in o)return o;let s=await nc(e,i,o);if(!s)return{status:`logged-out`};r=s}}finally{await n.release()}await ms();let{email:i}=await Da({getToken:async()=>r.token,host:e.host});return{...r,status:`logged-in`,email:i}}async function Xs(e){let t=Math.min(e.deadline,Date.now()+9e5);for(;;){let n=e.shown?t-Date.now():0;try{return await Gi({timeoutMs:n})}catch(n){if(!(n instanceof Si))throw n;if(Date.now()>=e.deadline)return;if(Date.now()>=t)throw new X(`expired`)}e.waited=!0;let r=(await Z().catch(()=>void 0))?.login?.session;e.shown=r&&Qs(r,e),e.shown?$s(e.shown):await Ke(js)}}async function Zs(e){return Wi(async t=>{let n=await Z().catch(()=>void 0);if(e.shown&&n&&!n.login)return{status:`logged-out`};let r=n?.login,i=r&&Qs(r.session,e);if(i)return e.pending=i,e.startedAt=i.startedAt,e.resumed=!0,{status:`pending`,pending:i};let a=r?.session.host===e.host?r:void 0,o=a&&Hs(a.session);if(e.waited&&o&&o!==e.tokenBefore)return{status:`saved`,token:o,store:a.store,storeReason:a.storeReason};let s={...await ti(Ms,e.auth0),host:e.host};e.pending=s,e.startedAt=s.startedAt;let c=await Vi(t),l=r?.session??{host:(await zi()).host??e.host,...e.auth0};return await Hi(t,{...c,session:{...l,pendingLogin:s}}),{status:`pending`,pending:s}})}function Qs(e,t){let{pendingLogin:n}=e;if(n&&n.host===t.host&&n.auth0Domain===t.auth0.auth0Domain&&n.clientId===t.auth0.clientId&&n.expiresAt>Date.now())return n}function $s(e){let{userCode:t,verificationUri:n,verificationUriComplete:r}=e,i=Math.max(1,Math.ceil((e.expiresAt-Date.now())/6e4));console.error(ua`
193
+ Open this URL on any device to log in:
194
+ ${r??n}
195
+ ${r===void 0?`Enter the code ${t}.`:`Check that the page shows the code ${t}.`}
196
+ Waiting for the login (the code expires in ${i} ${i===1?`minute`:`minutes`})...
197
+ `)}async function ec(e,t){let n=new AbortController,r=setInterval(async()=>{let r=await Z().catch(()=>void 0);e.cancelled||r&&r.login?.session.pendingLogin?.deviceCode!==t.deviceCode&&n.abort()},js),i=Number.isFinite(e.deadline)?AbortSignal.timeout(Math.max(0,e.deadline-Date.now())):void 0;try{return await ri(t,{signal:i?AbortSignal.any([i,n.signal]):n.signal,onUpdate:n=>tc(t,{...n,host:e.host})})}catch(e){if(e instanceof X)throw await tc(t,void 0),e;if(n.signal.aborted)return{status:`logged-out`};if(i?.aborted)return{status:`wait-limit`};throw e}finally{clearInterval(r)}}async function tc(e,t){await Wi(async n=>{let r=(await Z()).login;r?.session.pendingLogin?.deviceCode===e.deviceCode&&await Hi(n,{...r,session:{...r.session,pendingLogin:t}})}).catch(()=>{})}async function nc(e,t,n){return Wi(async r=>{let i=await Z().catch(()=>void 0);if(i&&i.login?.session.pendingLogin?.deviceCode!==t.deviceCode){await oi(n.refreshToken,t).catch(()=>{});return}let a=i?.login?{store:i.login.store,storeReason:i.login.storeReason}:await Vi(r),o={host:e.host,...e.auth0,...n};await Hi(r,{...a,session:o}),e.saved={...a,token:n.accessToken};let s=i?.login?.session;return s?.refreshToken&&await oi(s.refreshToken,s).catch(()=>{}),e.saved})}async function rc(){let e;try{e=await ue(Ns,`utf-8`)}catch{return}try{let t=JSON.parse(e);if(!t||t.latestKnownVersion===void 0&&t.lastUpdateCheckAt===void 0)return}catch{return}try{await pe(Ns,{force:!0})}catch{}}function ic(e,t,n){let{getKey:r,equals:i=(e,t)=>JSON.stringify(e)===JSON.stringify(t)}=n,a={insert:[],update:[],delete:[]};for(let n of e){let e=t.find(e=>r(e)===r(n));e?i(n,e)||a.update.push(n):a.insert.push(n)}for(let n of t)e.some(e=>r(e)===r(n))||a.delete.push(n);return a}function ac(e){return e.insert.length+e.update.length+e.delete.length>0}const oc=[`Slices`,`UID`,`Choice`];function sc(e,t,n){if(t in e)throw new Sc(t);e[t]=n}function cc(e,t){let n=e[t];if(!n)throw new Cc(t);return n}function lc(e,t,n){let r=new Map(n.map(e=>[e.id,e])),i=r.get(t);if(!i)throw new Tc(`Custom type "${t}" does not exist.`);let a=(e,t,n,i)=>{let o=/* @__PURE__ */ new Map;for(let t of e){let[e,...n]=t.split(`.`),r=o.get(e)??[];r.push(n.join(`.`)),o.set(e,r)}return Array.from(o,([e,o])=>{let s=t[e];if(!s)throw new Tc(`Field "${e}" does not exist on type "${n}".`);let c=o.filter(Boolean);if(c.length===0){if(oc.includes(s.type)||e===`uid`)throw new Tc(`Field "${e}" cannot be fetched from a content relationship.`);if(s.type===`Group`)throw new Tc(`Field "${e}" is a group. Select specific subfields.`);return e}if(c.length!==o.length)throw new Tc(`Field "${e}" cannot be selected both directly and through its subfields.`);if(s.type===`Group`)return{id:e,fields:a(c,s.config?.fields??{},n,i)};if(s.type===`Link`&&s.config?.select===`document`){if(!i)throw new Tc(`Content relationships cannot be nested more than once.`);let t=s.config?.customtypes;if(!t||t.length!==1)throw new Tc(`Field "${e}" must target exactly one custom type to select its fields.`);let n=typeof t[0]==`string`?t[0]:t[0].id,o=r.get(n);if(!o)throw new Tc(`Custom type "${n}" does not exist.`);let l=Object.assign({},...Object.values(o.json));return{id:e,customtypes:[{id:n,fields:a(c,l,n,!1)}]}}throw new Tc(`Field "${e}" is not a group or content relationship field.`)})};return a(e,Object.assign({},...Object.values(i.json)),i.id,!0)}function uc(e,t,n){let r;if(n){if(r=t.json[n],!r)throw new Ec(n,t.id)}else{let[n]=e.split(`.`);if(r=Object.values(t.json).find(e=>n in e),!r)throw new Cc(n)}return bc(e,r)}function dc(e,t,n,r=!1){let i=t.variations.find(e=>e.id===n);if(!i)throw new Dc(n,t.id);if(r){if(!i.items||Object.keys(i.items).length===0)throw new Oc(n,t.id);return bc(e,i.items)}return i.primary??={},bc(e,i.primary)}async function fc(e){let[t,n]=await Promise.all([La(e),Ra(e)]);return{customTypes:t,slices:n}}async function pc({customTypes:e,slices:t},n){let r=(e,t)=>({type:e,id:t.id,payload:t}),i=[...e.insert.map(e=>r(`CUSTOM_TYPE_INSERT`,e)),...e.update.map(e=>r(`CUSTOM_TYPE_UPDATE`,e)),...e.delete.map(({id:e})=>r(`CUSTOM_TYPE_DELETE`,{id:e})),...t.insert.map(e=>r(`SLICE_INSERT`,e)),...t.update.map(e=>r(`SLICE_UPDATE`,e)),...t.delete.map(({id:e})=>r(`SLICE_DELETE`,{id:e}))];i.length>0&&await za(i,n)}function mc(e,t,n={}){let{treatNonCanonicalAsChanged:r=!1}=n;return{customTypes:ic(e.customTypes,t.customTypes,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(hc(e))===JSON.stringify(r?t:hc(t))}),slices:ic(e.slices,t.slices,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(gc(e))===JSON.stringify(r?t:gc(t))})}}function hc(e){return{...yc(e),json:Object.fromEntries(Object.entries(e.json).map(([e,t])=>[e,_c(t)]))}}function gc(e){return{...yc(e),variations:e.variations.map(e=>{let t=yc(e);return e.primary&&(t.primary=_c(e.primary)),e.items&&(t.items=_c(e.items)),t})}}function _c(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=yc(t);return t.type===`Group`&&t.config?.fields&&n.type===`Group`&&n.config?.fields&&(n.config.fields=_c(t.config.fields)),t.type===`Slices`&&t.config?.choices&&n.type===`Slices`&&n.config?.choices&&(n.config.choices=vc(t.config.choices)),[e,n]}))}function vc(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=yc(t);return t.type===`Slice`&&n.type===`Slice`&&(t[`non-repeat`]&&(n[`non-repeat`]=_c(t[`non-repeat`])),t.repeat&&(n.repeat=_c(t.repeat))),[e,n]}))}function yc(e){return Array.isArray(e)?e.map(yc):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,yc(t)]))}function bc(e,t){let[n,...r]=e.split(`.`);if(r.length===0)return{fields:t,fieldId:n};let i=cc(t,n);if(i.type!==`Group`)throw new wc(n);return i.config??={},i.config.fields??={},bc(r.join(`.`),i.config.fields)}function xc(e){return e.flatMap(e=>Object.values(e.json).flatMap(t=>Object.entries(t).flatMap(([t,n])=>n.type===`Slices`?Object.entries(n.config?.choices??{}).flatMap(([r,i])=>i.type===`SharedSlice`?[]:[{id:r,customTypeId:e.id,sliceZoneId:t,sliceZone:n,model:i}]):[])))}var Sc=class extends Error{name=`FieldExistsError`;constructor(e){super(`Field "${e}" already exists.`)}},Cc=class extends Error{name=`FieldNotFoundError`;constructor(e){super(`Field "${e}" does not exist.`)}},wc=class extends Error{name=`UnsupportedNestedFieldError`;constructor(e){super(`Field "${e}" does not support nested fields.`)}},Tc=class extends Error{name=`FieldSelectionError`},Ec=class extends Error{name=`TabNotFoundError`;constructor(e,t){super(`Tab "${e}" does not exist on type "${t}".`)}},Dc=class extends Error{name=`SliceVariationNotFoundError`;constructor(e,t){super(`Variation "${e}" does not exist on slice "${t}".`)}},Oc=class extends Error{name=`SliceItemsNotFoundError`;constructor(e,t){super(`Variation "${e}" of slice "${t}" has no legacy items zone. To add repeatable fields, add a repeatable group to the slice.`)}};const kc=`prismic.config.json`,Ac=l({type:C(),path:C(),uid:S(C()),lang:S(C()),resolvers:S(x(C(),C()))}),jc=l({repositoryName:C(),documentAPIEndpoint:S(R()),libraries:S(V(C())),routes:S(V(Ac))});async function Mc(e){let t=await Rc();return await ge(t,P(e)),t}async function Nc(){let e=await Ic();try{return await w(e,{schema:jc})}catch{throw new Pc}}var Pc=class extends Error{name=`InvalidPrismicConfigError`;message=`${kc} is invalid. Run \`prismic init\` to re-create a config.`};async function Fc(e){let t=await Ic(),n={...await Nc(),...e};return await ge(t,P(n)),n}async function Ic(){let e=await ne(kc,{stop:`package.json`});if(!e)throw new Lc;return e}var Lc=class extends Error{name=`MissingPrismicConfigError`;message=`Could not find a ${kc} file. Run \`prismic init\` to create a config.`};async function Rc(){try{let e=await ie();return new URL(kc,e)}catch(e){throw e instanceof L?new zc({cause:e}):e}}var zc=class extends Error{name=`UnknownProjectRootError`;constructor(e){super(`Could not find your project root.`,e)}};async function Bc(e){let{routes:t=[]}=await Nc();if(t.some(t=>t.type===e.id))return;let n=Wc(e),r={type:e.id,path:n};await Fc({routes:[...t,r].sort((e,t)=>e.type.localeCompare(t.type))})}async function Vc(e){e.format===`page`?await Bc(e):await Hc(e.id)}async function Hc(e){let{routes:t=[]}=await Nc(),n=t.filter(t=>t.type!==e);t.length!==n.length&&await Fc({routes:n})}function Uc(e,t){return e.find(e=>e.type===t&&!e.uid&&!/[?*+]/.test(e.path))}function Wc(e){let{id:t,repeatable:n}=e,r=t.replaceAll(`_`,`-`).toLowerCase();return n?t===`page`?`/:uid`:`/${r}/:uid`:t===`homepage`?`/`:`/${r}`}const Gc=`slicemachine.config.json`,Kc=l({repositoryName:C(),libraries:S(V(C()))});async function qc(){let e=await Xc();try{return await w(e,{schema:Kc})}catch{throw new Jc}}var Jc=class extends Error{name=`InvalidLegacySliceMachineConfigError`;message=`${Gc} is invalid.`};async function Yc(){let e=await Xc();await pe(e)}async function Xc(){let e=await ne(Gc,{stop:`package.json`});if(!e)throw new Zc;return e}var Zc=class extends Error{name=`MissingLegacySliceMachineConfigError`;message=`Could not find a ${Gc} file.`};async function Qc(){let e;try{e=await Ic()}catch(t){if(t instanceof Lc)e=await Rc();else throw t}let t=new URL(`.`,e);return A(ye(await de(ve(t))))}async function $c(){try{return(await Nc()).repositoryName}catch(e){if(e instanceof Lc)try{return(await qc()).repositoryName}catch{}throw e}}async function el(){let e=(await Nc()).libraries;if(!e||e.length<1)return;let t=await Qc();return e.map(e=>A(new URL(e.replace(/^\//,``),t)))}async function tl(){let e=await Qc();return j(new URL(`tsconfig.json`,e))}const nl=[`next`,`nuxt`,`sveltekit`];async function rl(){let{dependencies:e,devDependencies:t,peerDependencies:n}=await re(),r={...e,...t,...n};if(`next`in r){let{NextJsAdapter:e}=await import(`./nextjs-ClznuWuW.mjs`);return new e}if(`nuxt`in r){let{NuxtAdapter:e}=await import(`./nuxt-DtNybhHO.mjs`);return new e}if(`@sveltejs/kit`in r){if(await T(`@sveltejs/kit`)<3){let{SvelteKit2Adapter:e}=await import(`./sveltekit2-BlijLJGO.mjs`);return new e}let{SvelteKitAdapter:e}=await import(`./sveltekit-DJYSs1MK.mjs`);return new e}throw new il}var il=class extends Error{name=`NoSupportedFrameworkError`;message=`No supported framework found. Run this command in a Next.js, Nuxt, or SvelteKit project.`},al=class extends Error{name=`ModelExistsError`},ol=class extends Error{name=`SliceNotFoundError`;constructor(e){super(`Slice "${e}" does not exist. Run \`prismic slice list\` to see available IDs.`)}},sl=class extends Error{name=`CustomTypeNotFoundError`;constructor(e){super(`Type "${e}" does not exist. Run \`prismic type list\` to see available IDs.`)}};async function cl(e,t,n,r){let i=r.find(e=>e.model.id===t||e.directory.href===n.href);if(!i&&!await j(n))return;let a=m(await Qc(),i?.directory??n),o=i?` (id: ${i.model.id})`:``;throw new al(`A ${e} already exists at ${a}${_e}${o}.`)}async function ll(){return await(await rl()).getEnvironment()??await $c()}async function ul(e){let t=await zr(`**/*.{js,jsx,mjs,ts,tsx,mts,svelte}`,{cwd:ve(await Qc()),absolute:!0,ignore:`**/{node_modules,build,dist,out}/**`});for(let n of t)try{if((await ue(n,`utf8`)).includes(e))return!0}catch{}return!1}async function dl(e,t){await j(e)||await _(e,t)}async function fl(){return await tl()?`ts`:`js`}var pl=class{get localPreviewUrl(){return new URL(this.localPreviewConfig.resolverPath,this.localPreviewConfig.websiteURL).href}get localSimulatorUrl(){return new URL(`slice-simulator`,this.localPreviewConfig.websiteURL).href}async initProject({setup:e}){for(let e of await this.getSliceLibraries())await this.createSliceIndexFile(e);e&&await this.setupProject();let t={repo:await $c(),getToken:Rs,host:await zs()};(await ao(t)).simulator_url||await oo(this.localSimulatorUrl,t),(await eo(t)).results.length===0&&await to(this.localPreviewConfig,t)}async getSliceLibraries(){return await el()??[await this.getDefaultSliceLibrary()]}async getSlices(){return hl(await this.getSliceLibraries(),`*/model.json`)}async getSlice(e){let t=(await this.getSlices()).find(t=>t.model.id===e);if(t)return t;let n=xc((await this.getCustomTypes()).map(e=>e.model)).find(t=>t.id===e);if(n){let{customTypeId:t,sliceZoneId:r}=n;throw new Q(`"${e}" is a legacy slice in "${t}". Upgrade it first: \`prismic slice upgrade-legacy ${e} --from ${t}${r===`body`?``:` --slice-zone ${r}`}\`.`)}throw new ol(e)}async createSlice(e){let[t]=await this.getSliceLibraries(),n=A(new URL(ht(e.name),A(t)));await cl(`slice`,e.id,n,await this.getSlices()),await _(new URL(`model.json`,n),P(gc(e))),await this.createSliceIndexFile(t),await this.createSliceComponent(e,n)}async updateSlice(e){let t=await this.getSlice(e.id);await _(t.modelPath,P(gc(e))),await this.createSliceIndexFile(t.library)}async deleteSlice(e){let t=await this.getSlice(e);await pe(t.directory,{recursive:!0}),await this.createSliceIndexFile(t.library)}async getCustomTypeLibraries(){return[new URL(`customtypes/`,await Qc())]}async getCustomTypes(){return hl(await this.getCustomTypeLibraries(),`*/index.json`)}async getCustomType(e){let t=(await this.getCustomTypes()).find(t=>t.model.id===e);if(!t)throw new sl(e);return t}async createCustomType(e){let[t]=await this.getCustomTypeLibraries(),n=A(new URL(e.id,A(t)));if(await cl(`type`,e.id,n,await this.getCustomTypes()),await _(new URL(`index.json`,n),P(hc(e))),e.format!==`page`)return[];await Bc(e);let r=await Qc();return(await this.writePageFiles(e)).map(({path:t})=>`Skipped ${m(r,t)} (already exists). Run \`prismic gen page ${e.id}\` to get the code.`)}async writePageFiles(e){let{routes:t=[]}=await Nc(),n=(Uc(t,e.id)?.path??Wc(e)).split(`/`).filter(Boolean).map(e=>e.startsWith(`:`)?`[${e.slice(1)}]`:e).join(`/`),r=[];for(let t of await this.getPageFiles(e,n))await j(t.path)?r.push(t):await _(t.path,t.contents);return r}async updateCustomType(e){let t=await this.getCustomType(e.id);await _(t.modelPath,P(hc(e))),await Vc(e)}async deleteCustomType(e){let t=await this.getCustomType(e);await pe(t.directory,{recursive:!0}),await Hc(e)}async getModels(){let[e,t]=await Promise.all([this.getCustomTypes(),this.getSlices()]);return{customTypes:e.map(e=>e.model),slices:t.map(e=>e.model)}}async writeModels(e){for(let t of e.slices.update)await this.updateSlice(t);for(let t of e.slices.delete)await this.deleteSlice(t.id);for(let t of e.slices.insert)await this.createSlice(t);for(let t of e.customTypes.update)await this.updateCustomType(t);for(let t of e.customTypes.delete)await this.deleteCustomType(t.id);let t=[];for(let n of e.customTypes.insert)t.push(...await this.createCustomType(n));return t}async generateTypes(){let e=new URL(`prismicio-types.d.ts`,await Qc()),t=Qt({customTypeModels:(await this.getCustomTypes()).map(({model:e})=>({...e,label:e.label??null})),sharedSliceModels:(await this.getSlices()).map(e=>e.model),clientIntegration:{includeContentNamespace:!0,includeCreateClientInterface:!0},cache:!0,typesProvider:`@prismicio/client`});return await _(e,t),e}async getEnvironment(){let e=await ml();if(await j(e))return(await te(e))[this.environmentEnvVarName]||void 0}async setEnvironment(e){await B(await ml(),this.environmentEnvVarName,e)}async unsetEnvironment(){await D(await ml(),this.environmentEnvVarName)}};async function ml(){return new URL(`.env.local`,await Qc())}async function hl(e,t){let n=[];for(let r of e){let e=await zr(t,{absolute:!0,cwd:r}),i=await Promise.all(e.map(async e=>{let t=ye(e),n=await w(t);return{library:r,directory:new URL(`.`,t),modelPath:t,model:n}}));n.push(...i)}return n.sort((e,t)=>e.model.id.toLowerCase().localeCompare(t.model.id.toLowerCase()))}export{us as $,ua as $t,Dc as A,Co as At,uc as B,jo as Bt,Nc as C,Ma as Ct,Cc as D,so as Dt,Sc as E,Ho as Et,gc as F,ao as Ft,zs as G,Wa as Gt,pc as H,oo as Ht,mc as I,Da as It,Us as J,Q as Jt,Rs as K,Xa as Kt,xc as L,Oa as Lt,wc as M,eo as Mt,sc as N,ja as Nt,Tc as O,io as Ot,hc as P,Ao as Pt,fs as Q,xa as Qt,fc as R,mo as Rt,$c as S,ko as St,Fc as T,Uo as Tt,ac as U,Fa as Ut,dc as V,Mo as Vt,rc as W,go as Wt,ms as X,ga as Xt,Gs as Y,ha as Yt,ps as Z,ba as Zt,tl as _,ht as _n,Eo as _t,il as a,Ui as an,Fo as at,Uc as b,Ua as bt,ll as c,Wi as cn,to as ct,dl as d,Y as dn,To as dt,da as en,Os as et,Jc as f,Yr as fn,co as ft,Wc as g,gt as gn,Za as gt,zc as h,mt as hn,Oo as ht,al as i,qi as in,ds as it,Ec as j,Pa as jt,Oc as k,Ya as kt,rl as l,X as ln,Io as lt,Lc as m,Ur as mn,ho as mt,sl as n,ca as nn,Ss as nt,ol as o,Z as on,Ka as ot,Pc as p,Vr as pn,Lo as pt,Ks as q,Ca as qt,nl as r,sa as rn,xs as rt,ul as s,zi as sn,fo as st,pl as t,fa as tn,ws as tt,fl as u,oi as un,wo as ut,Mc as v,_t as vn,no as vt,qc as w,Vo as wt,Qc as x,_o as xt,Yc as y,lo as yt,lc as z,Do as zt};