prismic 1.27.0 → 1.28.0-canary.ce68e95

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-DyBW88GE.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,p as N,q as P,r as F,rt as I,t as L,tt as R,w as z,y as B,z as V}from"./packageJson-Du_fIYqH.mjs";import{i as H,r as U,t as ie}from"./segment-nmtJFNW1.mjs";import{parseArgs as ae}from"node:util";import{chmod as W,lstat as oe,mkdir as G,open as se,readFile as ce,realpath as le,rename as ue,rm as de,stat as fe,utimes as pe,writeFile as me}from"node:fs/promises";import{sep as he}from"node:path";import{fileURLToPath as ge,pathToFileURL as _e}from"node:url";import*as ve from"node:crypto";import{createCipheriv as ye,createDecipheriv as be,createHash as xe,randomBytes as Se,randomUUID as Ce}from"node:crypto";import*as we from"fs";import{readdir as Te,readdirSync as Ee,realpath as De,realpathSync as Oe,stat as ke,statSync as Ae}from"fs";import{basename as je,dirname as Me,isAbsolute as Ne,normalize as Pe,posix as Fe,relative as Ie,resolve as Le,sep as Re}from"path";import{fileURLToPath as ze}from"url";import{createRequire as Be}from"module";import{homedir as Ve,hostname as He,release as Ue}from"node:os";import{setTimeout as We}from"node:timers/promises";import{constants as Ge,existsSync as Ke}from"node:fs";import{exec as qe,spawn as Je}from"node:child_process";var Ye=Object.create,Xe=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,Qe=Object.getOwnPropertyNames,$e=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty,tt=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),nt=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Qe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!et.call(e,s)&&s!==n&&Xe(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Ze(t,s))||r.enumerable});return e},rt=(e,t,n)=>(n=e==null?{}:Ye($e(e)),nt(t||!e||!e.__esModule||!et.call(e,`default`)?Xe(n,`default`,{value:e,enumerable:!0}):n,e));const it=/([\p{Ll}\d])(\p{Lu})/gu,at=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,ot=/(\d)\p{Ll}|(\p{L})\d/u,st=/[^\p{L}\d]+/giu,ct=`$1\0$2`;function lt(e){let t=e.trim();t=t.replace(it,ct).replace(at,ct),t=t.replace(st,`\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 ut(e){let t=lt(e);for(let e=0;e<t.length;e++){let n=t[e],r=ot.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 dt(e,t){let[n,r,i]=bt(e,t);return n+r.map(gt(t?.locale)).join(t?.delimiter??` `)+i}function ft(e,t){let[n,r,i]=bt(e,t),a=gt(t?.locale),o=_t(t?.locale),s=t?.mergeAmbiguousCharacters?vt(a,o):yt(a,o);return n+r.map((e,t)=>t===0?a(e):s(e,t)).join(t?.delimiter??``)+i}function pt(e,t){let[n,r,i]=bt(e,t),a=gt(t?.locale),o=_t(t?.locale),s=t?.mergeAmbiguousCharacters?vt(a,o):yt(a,o);return n+r.map(s).join(t?.delimiter??``)+i}function mt(e,t){let[n,r,i]=bt(e,t),a=gt(t?.locale),o=_t(t?.locale);return n+r.map(vt(a,o)).join(t?.delimiter??` `)+i}function ht(e,t){return dt(e,{delimiter:`_`,...t})}function gt(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function _t(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function vt(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function yt(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function bt(e,t={}){let n=t.split??(t.separateNumbers?ut:lt),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 xt(e,t){return(!e||e.endsWith(`
2
+ `))&&!t?.force?e:e+`
3
+ `}function K(e,t){return xt(t)+e}function St(e,t){return(!e||e.endsWith(`
4
+
5
+ `))&&!t?.force?e:xt(e)+`
6
+ `}function q(e,t){return St(t)+e}function Ct(e){return e.filter(Boolean).join(` | `)||`never`}function wt(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 Tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?wt(Object(n),!0).forEach(function(t){Et(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Et(e,t,n){return t=Dt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dt(e){var t=Ot(e,`string`);return typeof t==`symbol`?t:String(t)}function Ot(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 kt=At({});function At(e){return t.withOptions=t=>At(Tt(Tt({},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?jt(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 jt(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 Mt=kt.withOptions({alignValues:!0}),J=(e,...t)=>{let n=Array.from(e);return Mt(Object.assign(n,{raw:n}),...t)},Nt=`https://prismic.io/docs/slices`,Pt={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`},Y=(...e)=>{let t=pt(e.filter(Boolean).join(` `).replace(/[^A-Z0-9]+/gi,` `),{mergeAmbiguousCharacters:!0});return/^[0-9]/.test(t)&&(t=`_${t}`),t},Ft=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 It(e){return e.path.map(e=>e.label?e.label:e.model?Ft({model:e.model,name:e.name}):e.name).join(` → `)}function Lt(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 Rt(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 zt(e){switch(e.field.type){case`Link`:{let t=Pt.Link;switch(e.field.config?.select){case`document`:return t.contentRelationship;case`media`:return t.linkToMedia;default:return t.link}}default:{let t=Pt[e.field.type];if(typeof t==`string`)return t}}}function Bt(e){let t=`/**`,n=Ft({model:e.field,name:e.name}),r=It({path:e.path}),i=Rt({field:e.field});t=K(` * ${n} field in *${r}*`,t),t=K(` *`,t),t=K(` * - **Field Type**: ${i}`,t),t=K(` * - **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=K(` * - **Default Value**: ${typeof a==`boolean`?`${a}`:a}`,t)),t=K(` * - **API ID Path**: ${Lt({path:[...e.path,{name:e.name,model:e.field}]})}`,t),e.tabName&&(t=K(` * - **Tab**: ${e.tabName}`,t));let o=zt({field:e.field});return o&&(t=K(` * - **Documentation**: ${o}`,t)),t=K(` */`,t),t}const Vt={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 Ht(e){let t=Bt({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=K(`${i}: prismic.BooleanField;`,t);break;case`Color`:t=K(`${i}: prismic.ColorField;`,t);break;case`Date`:t=K(`${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=Ct(n);t=n.length>0?K(`${i}: prismic.EmbedField<prismic.AnyOEmbed & prismic.OEmbedExtra & (${r})>`,t):K(`${i}: prismic.EmbedField`,t);break}case`GeoPoint`:t=K(`${i}: prismic.GeoPointField;`,t);break;case`Image`:t=e.field.config?.thumbnails&&e.field.config.thumbnails.length>0?K(`${i}: prismic.ImageField<${Ct(e.field.config.thumbnails.map(e=>`"${e.name}"`))}>;`,t):K(`${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=K(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?K(`${i}: ${Ct(e.field.config.customtypes.map(e=>typeof e==`string`?`prismic.ContentRelationshipField<"${e}">`:`ContentRelationshipFieldWithData<${JSON.stringify([e])}>`))};`,t):K(`${i}: prismic.ContentRelationshipField;`,t);break;case`media`:t=K(`${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=K(`${i}: ${r};`,t);break}}break}case`Number`:t=K(`${i}: prismic.NumberField;`,t);break;case`StructuredText`:t=K(`${i}: prismic.RichTextField;`,t);break;case`Select`:{let n=e.field.config?.options?.map(e=>`"${e}"`)||[],r=n.length?Ct(n):`string`;t=e.field.config?.default_value?K(`${i}: prismic.SelectField<${r}, "filled">;`,t):K(`${i}: prismic.SelectField${n.length>0?`<${r}>`:``};`,t);break}case`Table`:t=K(`${i}: prismic.TableField;`,t);break;case`Text`:t=K(`${i}: prismic.KeyTextField;`,t);break;case`Timestamp`:t=K(`${i}: prismic.TimestampField;`,t);break;case`Group`:{let a=e.path.filter(e=>e.model!==void 0&&`type`in e.model&&e.model.type===Vt.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=Y(t.name,`Slice`,n.name,r.name,...a.map(e=>e.name),e.name,`Item`)}else s=Y(e.path[0].name,`Document`,`Data`,...a.map(e=>e.name),e.name,`Item`);let c=[...e.path,{name:i,model:e.field}],l=It({path:c}),u=Ut({fields:e.field.config?.fields||{},fieldConfigs:e.fieldConfigs,path:c});n.push(...u.auxiliaryTypes),r.push(...u.contentTypeNames),n.push({name:s,code:J`
12
+ /**
13
+ * Item in *${l}*
14
+ */
15
+ export interface ${s} {
16
+ ${u.code}
17
+ }
18
+ `}),r.push(s),t=K(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(Y(t,`Slice`));else if(i.type===`Slice`){let o=Y(e.path[0].name,`Document`,`Data`,e.name,t,`Slice`),s;if(i[`non-repeat`]&&Object.keys(i[`non-repeat`]).length>0){s=Y(o,`Primary`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`primary`,label:`Primary`}],c=It({path:a}),l=Ut({fields:i[`non-repeat`],fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=J`
19
+ /**
20
+ * Primary content in *${c}*
21
+ */
22
+ `;u=l.code?K(J`
23
+ export interface ${s} {
24
+ ${l.code}
25
+ }
26
+ `,u):K(`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=Y(o,`Item`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`items`,label:`Items`}],s=It({path:a}),l=Ut({fields:i.repeat,fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=J`
27
+ /**
28
+ * Item content in *${s}*
29
+ */
30
+ `;u=l.code?K(J`
31
+ export interface ${c} {
32
+ ${l.code}
33
+ }
34
+ `,u):K(`export interface ${c} {}`,u),n.push({name:c,code:u}),r.push(c)}n.push({name:o,code:J`
35
+ /**
36
+ * Slice for *${It({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=Y(e.path[0].name,`Document`,`Data`,e.name,`Slice`),s=Ct(a);n.push({name:o,code:`type ${o} = ${s}`}),r.push(o),t=K(`${i}: prismic.SliceZone<${o}>;`,t);break}default:t=K(`${i}: unknown;`,t)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function Ut(e){let t=``,n=[],r=[];for(let i in e.fields){let a=e.fields[i],o=Ht({name:i,field:a,path:e.path,fieldConfigs:e.fieldConfigs,tabName:e.tabName});t=q(o.code,t),n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function Wt(e){let t=``,n=[],r=[],i=Y(e.model.id,`Document`,`Data`),a=Ft({name:e.model.id,model:e.model}),o=``;for(let t in e.model.json){let{uid:i,...a}=e.model.json[t],s=Ut({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?J`
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 Gt(e){return`uid`in Object.assign({},...Object.values(e.json))}const Kt=e=>ve.createHash(`sha1`).update(JSON.stringify(e)).digest(`hex`);function qt(e){if(e.cache){let t=Kt(e.model),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=Y(e.model.id,`Document`),a=e.localeIDs&&e.localeIDs.length>0?Ct(e.localeIDs.map(e=>`"${e}"`)):`string`,o=Gt(e.model)?`PrismicDocumentWithUID`:`PrismicDocumentWithoutUID`,s=Ft({name:e.model.id,model:e.model}),c=Wt({model:e.model,fieldConfigs:e.fieldConfigs});n.push(...c.auxiliaryTypes),r.push(c.name),r.push(...c.contentTypeNames),t=q(c.code,t),t=q(J`
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=Kt(e.model);e.cache.set(t,l)}return l}function Jt(e){if(e.cache){let t=Kt([e.model,e.fieldConfigs]),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=Y(e.model.id,`Slice`),a=Ft({name:e.model.id,model:e.model}),o=[];for(let s of e.model.variations){let c=Y(i,s.id),l;if(s.primary&&Object.keys(s.primary).length>0){l=Y(c,`Primary`);let i=[{name:e.model.id,model:e.model},{name:s.id,label:s.name},{name:`primary`,label:`Primary`}],a=It({path:i}),o=Ut({fields:s.primary,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(l);let u=J`
58
+ /**
59
+ * Primary content in *${a}*
60
+ */
61
+ `;t=q(o.code?J`
62
+ ${u}
63
+ export interface ${l} {
64
+ ${o.code}
65
+ }
66
+ `:J`
67
+ ${u}
68
+ export interface ${l} {}
69
+ `,t)}let u;if(s.items&&Object.keys(s.items).length>0){u=Y(c,`Item`);let i=[{name:e.model.id,model:e.model},{name:`items`,label:`Items`}],a=It({path:i}),o=Ut({fields:s.items,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(u);let l=J`
70
+ /**
71
+ * Primary content in *${a}*
72
+ */
73
+ `;t=q(o.code?J`
74
+ ${l}
75
+ export interface ${u} {
76
+ ${o.code}
77
+ }
78
+ `:J`
79
+ ${l}
80
+ export interface ${u} {}
81
+ `,t)}t=q(J`
82
+ /**
83
+ * ${s.name} variation for ${a} Slice
84
+ *
85
+ * - **API ID**: \`${s.id}\`
86
+ * - **Description**: ${s.description||`*None*`}
87
+ * - **Documentation**: ${Nt}
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=Y(i,`Variation`),c=Ct(o);r.push(s),r.push(...o),t=q(J`
91
+ /**
92
+ * Slice variation for *${a}*
93
+ */
94
+ type ${s} = ${o.length>0?c:`never`}
95
+ `,t),t=q(J`
96
+ /**
97
+ * ${a} Shared Slice
98
+ *
99
+ * - **API ID**: \`${e.model.id}\`
100
+ * - **Description**: ${e.model.description||`*None*`}
101
+ * - **Documentation**: ${Nt}
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=Kt([e.model,e.fieldConfigs]);e.cache.set(t,l)}return l}const Yt=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 Xt(e={}){let t=e.fieldConfigs||{},n=e.cache??!0,r=``,i=e.typesProvider||`@prismicio/types`,a=`prismic`;r=K(`import type * as prismic from "${i}";`,r),(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace)&&i!==`@prismicio/client`&&(a=`prismicClient`,r=K(`import type * as ${a} from "@prismicio/client";`,r)),r=q(`type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };`,r),r=q(`
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=qt({model:a,localeIDs:e.localeIDs,fieldConfigs:t,cache:n?Yt:void 0});for(let e of s.auxiliaryTypes)r=q(e.code,r);r=q(s.code,r),i.push(s.name),o.push(s.name),o.push(...s.contentTypeNames)}if(e.customTypeModels.length>0){let e=`AllDocumentTypes`;r=q(`export type ${e} = ${Ct(i)};`,r),o.push(e)}}if(e.sharedSliceModels)for(let i of e.sharedSliceModels){let e=Jt({model:i,fieldConfigs:t,cache:n?Yt:void 0});for(let t of e.auxiliaryTypes)r=q(t.code,r);r=q(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=q(`interface CreateClient {
148
+ (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client<AllDocumentTypes>;
149
+ }`,t),t=q(`interface CreateWriteClient {
150
+ (repositoryNameOrEndpoint: string, options: ${a}.WriteClientConfig): ${a}.WriteClient<AllDocumentTypes>;
151
+ }`,t),t=q(`interface CreateMigration {
152
+ (): ${a}.Migration<AllDocumentTypes>;
153
+ }`,t)):(t=q(`interface CreateClient {
154
+ (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client;
155
+ }`,t),t=q(`interface CreateWriteClient {
156
+ (repositoryNameOrEndpoint: string, options?: ${a}.WriteClientConfig): ${a}.WriteClient;
157
+ }`,t),t=q(`interface CreateMigration {
158
+ (): ${a}.Migration;
159
+ }`,t))),e.clientIntegration.includeContentNamespace&&(t=q(J`
160
+ namespace Content {
161
+ export type {
162
+ ${o.join(`,
163
+ `)}
164
+ }
165
+ }
166
+ `,t)),r=q(J`
167
+ declare module "@prismicio/client" {
168
+ ${t}
169
+ }
170
+ `,r)}return r}var Zt=/* @__PURE__ */ Be(import.meta.url);function Qt(e){let t=Pe(e);return t.length>1&&t[t.length-1]===Re&&(t=t.substring(0,t.length-1)),t}const $t=/[\\/]/g;function en(e,t){return e.replace($t,t)}const tn=/^[a-z]:[\\/]$/i;function nn(e){return e===`/`||tn.test(e)}function rn(e,t){let{resolvePaths:n,normalizePath:r,pathSeparator:i}=t,a=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return n&&(e=Le(e)),(r||a)&&(e=Qt(e)),e===`.`?``:en(e[e.length-1]===i?e:e+i,i)}function an(e,t){return t+e}function on(e,t){return function(n,r){return r.startsWith(e)?r.slice(e.length)+n:en(Ie(e,r),t.pathSeparator)+t.pathSeparator+n}}function sn(e){return e}function cn(e,t,n){return t+e+n}function ln(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?on(e,t):r?an:sn}function un(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function dn(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}const fn=(e,t)=>{t.push(e||`.`)},pn=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},mn=()=>{};function hn(e,t){let{includeDirs:n,filters:r,relativePaths:i}=t;return n?i?r&&r.length?dn(e):un(e):r&&r.length?pn:fn:mn}const gn=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},_n=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},vn=(e,t,n,r)=>{n.files++},yn=(e,t)=>{t.push(e)},bn=()=>{};function xn(e){let{excludeFiles:t,filters:n,onlyCounts:r}=e;return t?bn:n&&n.length?r?gn:_n:r?vn:yn}const Sn=e=>e,Cn=()=>[``].slice(0,0);function wn(e){return e.group?Cn:Sn}const Tn=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},En=()=>{};function Dn(e){return e.group?Tn:En}const On=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()&&jn(e,s,t))return r.dequeue(null,t);n(o,s),r.dequeue(null,t)})})},kn=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()&&jn(e,r,t))return;n(a,r)}catch(e){if(!a)throw e}};function An(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?kn:On}function jn(e,t,n){if(n.options.useRealPaths)return Mn(t,n);let r=Me(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=Me(r)}return n.symlinks.set(e,t),i>1}function Mn(e,t){return t.visited.includes(e+t.options.pathSeparator)}const Nn=e=>e.counts,Pn=e=>e.groups,Fn=e=>e.paths,In=e=>e.paths.slice(0,e.options.maxFiles),Ln=(e,t,n)=>(Vn(t,n,e.counts,e.options.suppressErrors),null),Rn=(e,t,n)=>(Vn(t,n,e.paths,e.options.suppressErrors),null),zn=(e,t,n)=>(Vn(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),Bn=(e,t,n)=>(Vn(t,n,e.groups,e.options.suppressErrors),null);function Vn(e,t,n,r){t(e&&!r?e:null,n)}function Hn(e,t){let{onlyCounts:n,group:r,maxFiles:i}=e;return n?t?Nn:Ln:r?t?Pn:Bn:i?t?In:zn:t?Fn:Rn}const Un={withFileTypes:!0},Wn=(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||`.`,Un,(t,a=[])=>{i(a,n,r),e.queue.dequeue(e.options.suppressErrors?null:t,e)})},Gn=(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||`.`,Un)}catch(t){if(!e.options.suppressErrors)throw t}i(o,n,r)};function Kn(e){return e?Gn:Wn}var qn=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))}},Jn=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}},Yn=class{aborted=!1;abort(){this.aborted=!0}},Xn=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=Hn(t,this.isSynchronous),this.root=rn(e,t),this.state={root:nn(this.root)?this.root:this.root.slice(0,-1),paths:[``].slice(0,0),groups:[],counts:new Jn,options:t,queue:new qn((e,t)=>this.callbackInvoker(t,e,n)),symlinks:/* @__PURE__ */ new Map,visited:[``].slice(0,0),controller:new Yn,fs:t.fs||we},this.joinPath=ln(this.root,t),this.pushDirectory=hn(this.root,t),this.pushFile=xn(t),this.getArray=wn(t),this.groupFiles=Dn(t),this.resolveSymlink=An(t,this.isSynchronous),this.walkDirectory=Kn(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=cn(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=an(l.name,t);this.resolveSymlink(e,this.state,(t,r)=>{if(t.isDirectory()){if(r=rn(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=je(r),n=rn(Me(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 Zn(e,t){return new Promise((n,r)=>{Qn(e,t,(e,t)=>{if(e)return r(e);n(t)})})}function Qn(e,t,n){new Xn(e,t,n).start()}function $n(e,t){return new Xn(e,t).start()}var er=class{constructor(e,t){this.root=e,this.options=t}withPromise(){return Zn(this.root,this.options)}withCallback(e){Qn(this.root,this.options,e)}sync(){return $n(this.root,this.options)}};let tr=null;
173
+ /* c8 ignore next 6 */
174
+ try{Zt.resolve(`picomatch`),tr=Zt(`picomatch`)}catch{}var nr=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Re,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 er(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 er(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||tr;
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}},rr=/* @__PURE__ */ tt(((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}}})),ir=/* @__PURE__ */ tt((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=rr();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}})),ar=/* @__PURE__ */ tt(((e,t)=>{let n=ir(),{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:_}=rr(),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,I=0,L,R,z={value:``,depth:0,isGlob:!1},B=()=>E>=b,V=()=>T.charCodeAt(E+1),H=()=>(L=R,T.charCodeAt(++E));for(;E<b;){R=H();let e;if(R===a)M=z.backslashes=!0,R=H(),R===u&&(j=!0);else{if(j===!0||R===u){for(I++;B()!==!0&&(R=H());)if(R===a)M=z.backslashes=!0,H();else if(R===u)I++;else{if(j!==!0&&R===s&&(R=H())===s||j!==!0&&R===o){if(te=z.isBrace=!0,k=z.isGlob=!0,F=!0,x===!0)continue;break}if(R===h&&(I--,I===0)){j=!1,te=z.isBrace=!0,F=!0;break}}if(x===!0)continue;break}if(R===l){if(S.push(E),C.push(z),z={value:``,depth:0,isGlob:!1},F===!0)continue;if(L===s&&E===D+1){D+=2;continue}O=E+1}else{if(y.noext!==!0&&(R===p||R===i||R===r||R===m||R===c)&&V()===d){if(k=z.isGlob=!0,A=z.isExtglob=!0,F=!0,R===c&&E===D&&(P=!0),x===!0){let e=0;for(;B()!==!0&&(R=H());)if(R===a)M=z.backslashes=!0,H();else if(R===d)e++;else if(R===g&&--e===0){F=!0;break}continue}break}if(R===r){if(L===r&&(re=z.isGlobstar=!0),k=z.isGlob=!0,F=!0,x===!0)continue;break}if(R===m){if(k=z.isGlob=!0,F=!0,x===!0)continue;break}if(R===f){for(;B()!==!0&&(e=H());)if(e===a)M=z.backslashes=!0,H();else if(e===_){ne=z.isBracket=!0,k=z.isGlob=!0,F=!0;break}if(x===!0)continue;break}if(y.nonegate!==!0&&R===c&&E===D)N=z.negated=!0,D++;else{if(y.noparen!==!0&&R===d){if(k=z.isGlob=!0,x===!0){let e=1;for(;B()!==!0&&(R=H());)if(R===a)M=z.backslashes=!0,H();else if(R===d)e++;else if(R===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 U=T,ie=``,ae=``;D>0&&(ie=T.slice(0,D),T=T.slice(D),O-=D),U&&k===!0&&O>0?(U=T.slice(0,O),ae=T.slice(O)):k===!0?(U=``,ae=T):U=T,U&&U!==``&&U!==`/`&&U!==T&&v(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),y.unescape===!0&&(ae&&=n.removeBackslashes(ae),U&&M===!0&&(U=n.removeBackslashes(U)));let W={prefix:ie,input:e,start:D,base:U,glob:ae,isBrace:te,isBracket:ne,isGlob:k,isExtglob:A,isGlobstar:re,negated:N,negatedExtglob:P};if(y.tokens===!0&&(W.maxDepth=0,v(R)||C.push(z),W.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=ie):C[n].value=a,ee(C[n]),W.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]),W.maxDepth+=C[C.length-1].depth),W.slashes=S,W.parts=w}return W}})),or=/* @__PURE__ */ tt(((e,t)=>{let n=rr(),r=ir(),{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=[],I=[],L=m,R,z=()=>N.index===p-1,B=N.peek=(t=1)=>e[N.index+t],V=N.advance=()=>e[++N.index]||``,H=()=>e.slice(N.index+1),U=(e=``,t=0)=>{N.consumed+=e,N.index+=t},ie=e=>{N.output+=e.output==null?e.value:e.output,U(e.value)},ae=()=>{let e=1;for(;B()===`!`&&(B(2)!==`(`||B(3)===`?`);)V(),N.start++,e++;return e%2!=0&&(N.negated=!0,N.start++,!0)},W=e=>{N[e]++,I.push(e)},oe=e=>{N[e]--,I.pop()},G=e=>{if(L.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,-L.output.length),L.type=`star`,L.value=`*`,L.output=M,N.output+=L.output)}P.length&&e.type!==`paren`&&(P[P.length-1].inner+=e.value),(e.value||e.output)&&ie(e),L&&L.type===`text`&&e.type===`text`?(L.output=(L.output||L.value)+e.value,L.value+=e.value):(e.prev=L,h.push(e),L=e)},se=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=L,n.parens=N.parens,n.output=N.output,n.startIndex=N.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;W(`parens`),G({type:e,value:t,output:N.output?``:C}),G({type:`paren`,extglob:!0,value:V(),output:r}),P.push(n)},ce=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,G({type:`paren`,extglob:!0,value:R,output:``}),oe(`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||z()||/^\)+$/.test(H()))&&(s=n.close=`)$))${e}`),n.inner.includes(`*`)&&(c=H())&&/^\.[^\\/.]+$/.test(c)&&(s=n.close=`)${y(c,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(N.negatedExtglob=!0)}G({type:`paren`,extglob:!0,value:R,output:s}),oe(`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(;!z();){if(R=V(),R===`\0`)continue;if(R===`\\`){let e=B();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){R+=`\\`,G({type:`text`,value:R});continue}let t=/^\\+/.exec(H()),n=0;if(t&&t[0].length>2&&(n=t[0].length,N.index+=n,n%2!=0&&(R+=`\\`)),d.unescape===!0?R=V():R+=V(),N.brackets===0){G({type:`text`,value:R});continue}}if(N.brackets>0&&(R!==`]`||L.value===`[`||L.value===`[^`)){if(d.posix!==!1&&R===`:`){let e=L.value.slice(1);if(e.includes(`[`)&&(L.posix=!0,e.includes(`:`))){let e=L.value.lastIndexOf(`[`),t=L.value.slice(0,e),n=L.value.slice(e+2),r=a[n];if(r){L.value=t+r,N.backtrack=!0,V(),!m.output&&h.indexOf(L)===1&&(m.output=C);continue}}}(R===`[`&&B()!==`:`||R===`-`&&B()===`]`)&&(R=`\\${R}`),R===`]`&&(L.value===`[`||L.value===`[^`)&&(R=`\\${R}`),d.posix===!0&&R===`!`&&L.value===`[`&&(R=`^`),L.value+=R,ie({value:R});continue}if(N.quotes===1&&R!==`"`){R=r.escapeRegex(R),L.value+=R,ie({value:R});continue}if(R===`"`){N.quotes=N.quotes===1?0:1,d.keepQuotes===!0&&G({type:`text`,value:R});continue}if(R===`(`){W(`parens`),G({type:`paren`,value:R});continue}if(R===`)`){if(N.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=P[P.length-1];if(e&&N.parens===e.parens+1){ce(P.pop());continue}G({type:`paren`,value:R,output:N.parens?`)`:`\\)`}),oe(`parens`);continue}if(R===`[`){if(d.nobracket===!0||!H().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));R=`\\${R}`}else W(`brackets`);G({type:`bracket`,value:R});continue}if(R===`]`){if(d.nobracket===!0||L&&L.type===`bracket`&&L.value.length===1){G({type:`text`,value:R,output:`\\${R}`});continue}if(N.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));G({type:`text`,value:R,output:`\\${R}`});continue}oe(`brackets`);let e=L.value.slice(1);if(L.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(R=`/${R}`),L.value+=R,ie({value:R}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(L.value);if(N.output=N.output.slice(0,-L.value.length),d.literalBrackets===!0){N.output+=t,L.value=t;continue}L.value=`(${g}${t}|${L.value})`,N.output+=L.value;continue}if(R===`{`&&d.nobrace!==!0){W(`braces`);let e={type:`brace`,value:R,output:`(`,outputIndex:N.output.length,tokensIndex:N.tokens.length};F.push(e),G(e);continue}if(R===`}`){let e=F[F.length-1];if(d.nobrace===!0||!e){G({type:`text`,value:R,output:R});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=`\\{`,R=t=`\\}`,N.output=n;for(let e of r)N.output+=e.output||e.value}G({type:`brace`,value:R,output:t}),oe(`braces`),F.pop();continue}if(R===`|`){P.length>0&&P[P.length-1].conditions++,G({type:`text`,value:R});continue}if(R===`,`){let e=R,t=F[F.length-1];t&&I[I.length-1]===`braces`&&(t.comma=!0,e=`|`),G({type:`comma`,value:R,output:e});continue}if(R===`/`){if(L.type===`dot`&&N.index===N.start+1){N.start=N.index+1,N.consumed=``,N.output=``,h.pop(),L=m;continue}G({type:`slash`,value:R,output:S});continue}if(R===`.`){if(N.braces>0&&L.type===`dot`){L.value===`.`&&(L.output=b);let e=F[F.length-1];L.type=`dots`,L.output+=R,L.value+=R,e.dots=!0;continue}if(N.braces+N.parens===0&&L.type!==`bos`&&L.type!==`slash`){G({type:`text`,value:R,output:b});continue}G({type:`dot`,value:R,output:b});continue}if(R===`?`){if(!(L&&L.value===`(`)&&d.noextglob!==!0&&B()===`(`&&B(2)!==`?`){se(`qmark`,R);continue}if(L&&L.type===`paren`){let e=B(),t=R;(L.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(H()))&&(t=`\\${R}`),G({type:`text`,value:R,output:t});continue}if(d.dot!==!0&&(L.type===`slash`||L.type===`bos`)){G({type:`qmark`,value:R,output:te});continue}G({type:`qmark`,value:R,output:O});continue}if(R===`!`){if(d.noextglob!==!0&&B()===`(`&&(B(2)!==`?`||!/[!=<:]/.test(B(3)))){se(`negate`,R);continue}if(d.nonegate!==!0&&N.index===0){ae();continue}}if(R===`+`){if(d.noextglob!==!0&&B()===`(`&&B(2)!==`?`){se(`plus`,R);continue}if(L&&L.value===`(`||d.regex===!1){G({type:`plus`,value:R,output:x});continue}if(L&&(L.type===`bracket`||L.type===`paren`||L.type===`brace`)||N.parens>0){G({type:`plus`,value:R});continue}G({type:`plus`,value:x});continue}if(R===`@`){if(d.noextglob!==!0&&B()===`(`&&B(2)!==`?`){G({type:`at`,extglob:!0,value:R,output:``});continue}G({type:`text`,value:R});continue}if(R!==`*`){(R===`$`||R===`^`)&&(R=`\\${R}`);let e=o.exec(H());e&&(R+=e[0],N.index+=e[0].length),G({type:`text`,value:R});continue}if(L&&(L.type===`globstar`||L.star===!0)){L.type=`star`,L.star=!0,L.value+=R,L.output=M,N.backtrack=!0,N.globstar=!0,U(R);continue}let t=H();if(d.noextglob!==!0&&/^\([^?]/.test(t)){se(`star`,R);continue}if(L.type===`star`){if(d.noglobstar===!0){U(R);continue}let n=L.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]!==`/`)){G({type:`star`,value:R,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){G({type:`star`,value:R,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[N.index+4];if(n&&n!==`/`)break;t=t.slice(3),U(`/**`,3)}let c=z()||N.parens>0&&t===`)`.repeat(N.parens)&&!P.some(e=>e.type===`negate`);if(n.type===`bos`&&z()){L.type=`globstar`,L.value+=R,L.output=A(d),N.output=L.output,N.globstar=!0,U(R);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&c){N.output=N.output.slice(0,-(n.output+L.output).length),n.output=`(?:${n.output}`,L.type=`globstar`,L.output=A(d)+(d.strictSlashes?`)`:`|$)`),L.value+=R,N.globstar=!0,N.output+=n.output+L.output,U(R);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+L.output).length),n.output=`(?:${n.output}`,L.type=`globstar`,L.output=`${A(d)}${S}|${S}${e})`,L.value+=R,N.output+=n.output+L.output,N.globstar=!0,U(R+V()),G({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){L.type=`globstar`,L.value+=R,L.output=`(?:^|${S}|${A(d)}${S})`,N.output=L.output,N.globstar=!0,U(R+V()),G({type:`slash`,value:`/`,output:``});continue}N.output=N.output.slice(0,-L.output.length),L.type=`globstar`,L.output=A(d),L.value+=R,N.output+=L.output,N.globstar=!0,U(R);continue}let n={type:`star`,value:R,output:M};d.bash===!0?(n.output=`.*?`,(L.type===`bos`||L.type===`slash`)&&(n.output=re+n.output),G(n)):L&&(L.type===`bracket`||L.type===`paren`)&&d.regex===!0?(n.output=R,G(n)):((N.index===N.start||L.type===`slash`||L.type===`dot`)&&(L.type===`dot`?(N.output+=E,L.output+=E):d.dot===!0?(N.output+=D,L.output+=D):(N.output+=re,L.output+=re),B()!==`*`&&(N.output+=C,L.output+=C)),G(n))}for(;N.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));N.output=r.escapeLast(N.output,`[`),oe(`brackets`)}for(;N.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));N.output=r.escapeLast(N.output,`(`),oe(`parens`)}for(;N.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));N.output=r.escapeLast(N.output,`{`),oe(`braces`)}if(d.strictSlashes!==!0&&(L.type===`star`||L.type===`bracket`)&&G({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})),sr=/* @__PURE__ */ tt(((e,t)=>{let n=ar(),r=or(),i=ir(),a=rr(),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})),cr=/* @__PURE__ */ rt((/* @__PURE__ */ tt(((e,t)=>{let n=sr(),r=ir();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 lr=Array.isArray,ur=/\\/g,dr=/^[A-Za-z]:$/,fr=process.platform===`win32`,pr=/^(\/?\.\.)+$/;function mr(e,t={}){let n=e.length,r=Array(n),i=Array(n),a,o;for(a=0;a<n;a++){let n=xr(e[a]);r[a]=n;let s=n.length,c=Array(s);for(o=0;o<s;o++)c[o]=(0,cr.default)(n[o],t);i[a]=c}return e=>{let s=e.split(`/`);if(s[0]===`..`&&pr.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 hr=/^[A-Z]:\/$/i,gr=fr?e=>hr.test(e):e=>e===`/`;function _r(e,t,n){if(e===t||t.startsWith(`${e}/`)){if(n){let t=e.length+ +!gr(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=>Fe.relative(e,t)||`.`:n=>Fe.relative(e,`${t}/${n}`)||`.`}function vr(e,t){if(t.startsWith(`${e}/`)){let n=t.slice(e.length+1);return e=>`${n}/${e}`}return n=>{let r=Fe.relative(e,`${t}/${n}`);return n[n.length-1]===`/`&&r!==``?`${r}/`:r||`.`}}function yr(e){return e.replace(dr,e=>`${e}/`)}const br={parts:!0};function xr(e){let t=cr.default.scan(e,br);return t.parts?.length?t.parts:[e]}const Sr=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Cr=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,wr=fr?e=>e.replace(Cr,`\\$&`):e=>e.replace(Sr,`\\$&`);function Tr(e,t){if(t?.caseSensitiveMatch===!1)return!0;let n=cr.default.scan(e);return n.isGlob||n.negated}function Er(...e){console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString(`es`)}]`,...e)}function Dr(e){return typeof e==`string`?[e]:e??[]}const Or=/^(\/?\.\.)+/,kr=/\\(?=[()[\]{}!*+?@|])/g;function Ar(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=wr(i);a=Ne(a.replace(kr,``))?Fe.relative(o,a):Fe.normalize(a);let s=Or.exec(a)?.[0],c=xr(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=Fe.join(i,s.slice(t*3));l[0]!==`.`&&n.root.length>l.length&&(n.root=yr(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]||Tr(t))break;e.push(t)}n.depthOffset=e.length,n.commonPath=e,n.root=yr(e.length>0?Fe.join(i,...e):i)}return a}function jr(e,t,n){let r=[],i=[];for(let t of e.ignore)t&&(t[0]!==`!`||t[1]===`(`)&&i.push(Ar(t,e,n,!0));for(let a of t)a&&(a[0]!==`!`||a[1]===`(`?r.push(Ar(a,e,n,!1)):(a[1]!==`!`||a[2]===`(`)&&i.push(Ar(a.slice(1),e,n,!0)));return{match:r,ignore:i}}function Mr(e,t){let n=e.cwd,r={root:n,depthOffset:0},i=jr(e,t,r);e.debug&&Er(`internal processing patterns:`,i);let{absolute:a,caseSensitiveMatch:o,debug:s,dot:c,followSymbolicLinks:l,onlyDirectories:u}=e,d=r.root.replace(ur,``),f={dot:c,nobrace:e.braceExpansion===!1,nocase:!o,noextglob:e.extglob===!1,noglobstar:e.globstar===!1,posix:!0},p=(0,cr.default)(i.match,f),m=(0,cr.default)(i.ignore,f),h=mr(i.match,f),g=_r(n,d,a),_=a?g:_r(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 nr({filters:[s?(e,t)=>{let n=g(e,t),r=p(n)&&!m(n);return r&&Er(`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 Er(`${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&&Er(`internal properties:`,{...r,root:d}),[y,n!==d&&!a&&vr(n,d)]}function Nr(e,t){if(t)for(let n=e.length-1;n>=0;n--)e[n]=t(e[n]);return e}const Pr={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Fr(e){let t=Object.assign({},e);for(let e in Pr)t[e]===void 0&&Object.assign(t,{[e]:Pr[e]});return t.cwd=(t.cwd instanceof URL?ze(t.cwd):Le(t.cwd||process.cwd())).replace(ur,`/`),t.ignore=Dr(t.ignore),t.fs&&={readdir:t.fs.readdir||Te,readdirSync:t.fs.readdirSync||Ee,realpath:t.fs.realpath||De,realpathSync:t.fs.realpathSync||Oe,stat:t.fs.stat||ke,statSync:t.fs.statSync||Ae},t.debug&&Er(`globbing with options:`,t),t}function Ir(e,t={}){if(e&&t?.patterns)throw Error(`Cannot pass patterns as both an argument and an option`);let n=lr(e)||typeof e==`string`,r=Dr((n?e:e.patterns)??`**/*`),i=Fr(n?t:e);return r.length>0?Mr(i,r):[]}async function Lr(e,t){let[n,r]=Ir(e,t);return n?Nr(await n.withPromise(),r):[]}// @__NO_SIDE_EFFECTS__
181
+ function Rr(e){return R(m,e)}const zr=`prismic.io`,Br=P({PROD:C(),PRISMIC_SENTRY_DSN:c(y(),`https://e1886b1775bd397cd1afc60bfd2ebfc8@o146123.ingest.us.sentry.io/4510445143588864`),PRISMIC_SENTRY_ENVIRONMENT:l(x()),PRISMIC_SENTRY_ENABLED:l(C()),PRISMIC_TELEMETRY_ENABLED:l(C()),PRISMIC_HOST:l(x()),PRISMIC_TOKEN:l(x()),PRISMIC_DOCS_HOST:l(x()),PRISMIC_CONFIG_DIR:l(x()),PRISMIC_TYPE_BUILDER_ENABLED:l(C()),PRISMIC_SYNC_POLL_MS:l((/* @__PURE__ */ Rr()).check(M(100))),PRISMIC_AUTH0_DOMAIN:l(x()),PRISMIC_AUTH0_CLIENT_ID:l(x()),PRISMIC_AGENT_WAIT_MS:a(l((/* @__PURE__ */ Rr()).check(M(1))),void 0)}),Vr=I(Br,{...process.env,PROD:`true`});function Hr(e,t){if(t)return A(_e(t));if(process.platform===`win32`){let t=process.env.APPDATA;if(t)return new URL(`${e}/`,A(_e(t)))}if(process.platform!==`darwin`){let t=process.env.XDG_CONFIG_HOME;if(t)return new URL(`${e}/`,A(_e(t)))}let n=A(_e(Ve()));return new URL(`.config/${e}/`,n)}const X=Hr(`prismic`,Vr.PRISMIC_CONFIG_DIR),Ur=new URL(`credentials.json`,X),Wr=new URL(`credentials.enc`,X),Gr=new URL(`credentials.lock`,X),Kr=new URL(`login.lock`,X),qr=new URL(`update-notifier.json`,X),Jr=new URL(`analytics.json`,X),Yr=1e4,Xr={"User-Agent":`prismic-cli/${e} (${process.platform})`},Zr=P({auth0Domain:x(),clientId:x(),deviceCode:x(),userCode:x(),verificationUri:x(),verificationUriComplete:l(x()),expiresAt:u(),intervalMs:u(),startedAt:u()}),Qr=P({device_code:x(),user_code:x(),verification_uri:x(),verification_uri_complete:l(x()),expires_in:u(),interval:l(u())});async function $r(e,t){let r=new URL(`oauth/device/code`,ai(t.auth0Domain)),i=await n(r,{method:`POST`,body:new URLSearchParams({client_id:t.clientId,...e}),headers:Xr,signal:AbortSignal.timeout(Yr),schema:Qr}).catch(e=>{let t=oi(e)??(si(e)?`unavailable`:void 0);throw t?new di(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 ei=P({access_token:x(),refresh_token:x(),expires_in:u()});async function ti(e,t){let{signal:r,onUpdate:i}=t,a=e,o=a.intervalMs;for(;;){if(r?.throwIfAborted(),Date.now()>=a.expiresAt)throw new di(`expired`);try{let e=new URL(`oauth/token`,ai(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:Xr,signal:AbortSignal.timeout(Yr),schema:ei});return{accessToken:t.access_token,refreshToken:t.refresh_token,expiresAt:Date.now()+t.expires_in*1e3}}catch(e){let t=ui(e),n=li(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=oi(e);if(n)throw new di(n,e);if(!si(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 We(e,void 0,{signal:r}).catch(()=>r?.throwIfAborted())}}const ni=P({access_token:x(),refresh_token:l(x()),expires_in:u()});async function ri(e,t){let r=new URL(`oauth/token`,ai(t.auth0Domain)),i=await n(r,{method:`POST`,body:new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:t.clientId}),headers:Xr,signal:AbortSignal.timeout(Yr),schema:ni}).catch(e=>{let t=li(e)?.error;if(t!==`invalid_grant`&&t!==`access_denied`)throw new di(si(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 ii(e,t){let r=new URL(`oauth/revoke`,ai(t.auth0Domain));await n(r,{method:`POST`,body:new URLSearchParams({client_id:t.clientId,token:e}),headers:Xr,signal:AbortSignal.timeout(Yr)}).catch(e=>{throw new di(si(e)?`unavailable`:`misconfigured`,e)})}function ai(e){return new URL(/^https?:\/\//.test(e)?e:`https://${e}/`)}function oi(e){if(e instanceof i){let t=li(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 si(e)?void 0:`misconfigured`}if(e instanceof E)return`misconfigured`}function si(e){return e instanceof i?e.status===429||e.status>=500:e instanceof v||e instanceof DOMException&&e.name===`TimeoutError`}const ci=P({error:x(),error_description:l(x())});function li(e){if(e instanceof i)return k(ci,e.body).data}function ui(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 di=class extends Error{name=`DeviceFlowError`;reason;detail;constructor(e,t){let n=t===void 0?void 0:fi(t);super(n?`${e} (${n})`:e),this.reason=e,this.detail=n}};function fi(e){return e instanceof i?li(e)?.error??`HTTP ${e.status}`:e instanceof DOMException&&e.name===`TimeoutError`?`timeout`:e instanceof v?`network error`:`unexpected response`}const pi=[36,51];var mi=class extends Error{name=`KeyringError`;reason;constructor(e,t){super(`Keychain error: ${e}`,t),this.reason=e}};const hi={async get(e,t,n){return(await gi([`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 gi([`-i`],`add-generic-password -U -s ${e} -a ${t} -w ${n}\n`,r)},async delete(e,t,n){await gi([`delete-generic-password`,`-s`,e,`-a`,t],void 0,n)}};function gi(e,t,n){return new Promise((r,i)=>{let a=Je(`/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 mi(e.name===`AbortError`?`timeout`:`unavailable`,{cause:e}))}),a.on(`close`,e=>{e===0?r(o):e===44?r(void 0):i(new mi(pi.includes(e??0)?`locked`:`rejected`))}),a.stdin.end(t)})}const _i={async get(e,t,n){return await vi(e,t,n,(e,t)=>e.getPassword(t))??void 0},async set(e,t,n,r){await vi(e,t,r,(e,t)=>e.setPassword(n,t))},async delete(e,t,n){await vi(e,t,n,(e,t)=>e.deleteCredential(t))}};async function vi(e,t,n,r){let i;try{({AsyncEntry:i}=await import(`@napi-rs/keyring`))}catch(e){throw new mi(`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 mi(`timeout`,{cause:e});let t=e instanceof Error?e.message:``;throw/locked/i.test(t)?new mi(`locked`,{cause:e}):new mi(process.platform===`linux`?`unavailable`:`rejected`,{cause:e})}}const yi=process.platform===`darwin`?hi:_i;async function bi(e,t){let{timeoutMs:n}=t,r={id:Ce(),pid:process.pid,hostname:He()},i=Date.now()+n,a=25;for(;!await Si(e,r);)if(!await Ci(e)){if(Date.now()>=i)throw new xi(`Timed out waiting for the lock at ${ge(e)}.`);await We(a*(.5+Math.random())),a=Math.min(a*2,500)}let o=!1,s=async()=>!o&&(await wi(e))?.id===r.id,c=setInterval(async()=>{if(!await s())return;let t=/* @__PURE__ */ new Date;await pe(Ti(e),t,t).catch(()=>{})},2e3);return c.unref(),{isHeld:s,async release(){clearInterval(c);let t=await s();o=!0,t&&await de(e,{recursive:!0,force:!0})}}}var xi=class extends Error{name=`LockTimeoutError`};async function Si(e,t){try{await G(e)}catch(e){if(e.code===`EEXIST`)return!1;throw e}try{return await me(Ti(e),JSON.stringify(t),{flag:`wx`}),!0}catch(e){let{code:t}=e;if(t===`EEXIST`||t===`ENOENT`)return!1;throw e}}async function Ci(e){let t=await wi(e),n=await fe(Ti(e)).catch(()=>fe(e)).catch(()=>void 0);if(!n)return!0;let r=Date.now()-n.mtimeMs,i=r>1e4,a=!t&&r>1e3,o=t?.hostname===He()&&!Ei(t.pid);if(!i&&!a&&!o)return!1;let s=new URL(`${e.href}.stale-${Ce()}`);try{await ue(e,s)}catch{return!1}let c=await wi(s);if(c&&c.id!==t?.id)try{return await ue(s,e),!1}catch{}return await de(s,{recursive:!0,force:!0}),!0}async function wi(e){try{return JSON.parse(await ce(Ti(e),`utf8`))}catch{return}}function Ti(e){return new URL(`${e.href}/owner.json`)}function Ei(e){try{return process.kill(e,0),!0}catch(e){return e.code===`EPERM`}}const Di=`prismic-cli`,Oi=`cli:${xe(`sha256`).update(ge(X)).digest(`hex`).slice(0,16)}`,ki=5e3,Ai=3e4,ji=Buffer.from([1]),Mi=P({host:x(),auth0Domain:x(),clientId:x(),accessToken:l(x()),refreshToken:l(x()),expiresAt:l(u()),pendingLogin:l(r(Zr,{host:x()}))}),Ni=d([`wsl`,`secret-service-missing`,`locked`,`write-rejected`,`timeout`,`module-missing`]),Pi=d([`keyring`,`file`]),Fi=P({version:l(t()),host:a(l(x()),void 0),store:a(l(Pi),void 0),storeReason:a(l(Ni),void 0),expiresAt:a(l(u()),void 0)});let Ii,Li=!1;async function Ri(){let e=aa(await ia(Ur)),{version:t,store:n,storeReason:r}=k(Fi,e).data??{};if(t===void 0)return{};if(t!==2)throw new Z("Your Prismic login was saved by a newer version of the CLI. Update the CLI, or run `prismic login` again.");if(!n)throw Zi();let i=k(Mi,n===`file`?e:aa(await Yi()));if(!i.success)throw Zi();return{login:{store:n,storeReason:r,session:i.data}}}async function zi(){let e=aa(await ia(Ur).catch(()=>void 0));return k(Fi,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(Ue()))return{store:`file`,storeReason:`wsl`};try{if(Ii=void 0,!await qi(ki)){let t=Se(32);await Qi(e),await yi.set(Di,Oi,t.toString(`base64`),{timeoutMs:ki}),Ii=t}return{store:`keyring`}}catch(e){if(!(e instanceof mi))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 na(e,[[Wr,$i(JSON.stringify(i),await Ji())],[Ur,N({version:2,host:t,expiresAt:r,store:n,auth0Domain:o,clientId:s})]])}else a=await na(e,[[Ur,N({version:2,store:n,storeReason:r,...i})]]),await ra(e,Wr);a||Li||(Li=!0,console.warn(`Can't make ${ge(Ur)} 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(Wr);t?await na(e,[[Ur,N({host:t})]]):await ra(e,Ur),await ra(e,Wr),r&&(Ii=void 0,await Qi(e),await yi.delete(Di,Oi,{timeoutMs:Ai}).catch(e=>{if(!(e instanceof mi))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(Gr,{timeoutMs:3e4}).catch(e=>{throw e instanceof xi?new Z(`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(Kr,e)}async function Ki(e,t){try{return await ta(),await bi(e,t)}catch(e){let t=e.code;throw t!==`EACCES`&&t!==`EPERM`&&t!==`EROFS`?e:new Z(`Can't write to ${ge(X).replace(/[/\\]$/,``)}. Set PRISMIC_CONFIG_DIR to a private folder outside your project.`,{cause:e})}}var Z=class extends Error{name=`CredentialsError`};async function qi(e){if(Ii)return Ii;let t=await yi.get(Di,Oi,{timeoutMs:e}),n=t?Buffer.from(t,`base64`):void 0;return n?.length===32&&(Ii=n),Ii}async function Ji(){let e=await qi(Ai).catch(e=>{throw e instanceof mi?new Z(`Can't read your Prismic key because ${Xi[e.reason]??`the keychain isn't available. Try again`}, or run \`prismic login\` again.`,{cause:e}):e});if(!e)throw Zi();return e}async function Yi(){let e=await ia(Wr),t=Ii!==void 0,n=ea(e,await Ji());return n||!t?n:(Ii=void 0,ea(e,await Ji()))}const Xi={locked:`the keychain is locked in this session. Unlock it and try again`,timeout:`the keychain didn't respond. Try again`};function Zi(){return new Z("Your Prismic login can't be decrypted. Run `prismic login` again.")}async function Qi(e){if(!await e.isHeld())throw new Z(`Another Prismic command took over the login while this one stalled. Run the command again.`)}function $i(e,t){let n=Se(12),r=ye(`aes-256-gcm`,t,n);r.setAAD(ji);let i=Buffer.concat([r.update(e,`utf8`),r.final()]);return Buffer.concat([ji,n,r.getAuthTag(),i])}function ea(e,t){if(!(!e||e.length<29||e[0]!==ji[0]))try{let n=be(`aes-256-gcm`,t,e.subarray(1,13));return n.setAAD(ji),n.setAuthTag(e.subarray(13,29)),Buffer.concat([n.update(e.subarray(29)),n.final()]).toString(`utf8`)}catch{return}}async function ta(){await G(X,{recursive:!0,mode:448}),process.platform!==`win32`&&(await fe(X)).mode&63&&await W(X,448)}async function na(e,t){let n=!0;for(let[r,i]of t){let t=new URL(`${r.href}.${Ce()}.tmp`);try{let n=await se(t,`wx`,384);try{await n.writeFile(i),await n.sync()}finally{await n.close()}await Qi(e),await ue(t,r)}catch(e){throw await de(t,{force:!0}),e}if(process.platform===`win32`)continue;let a=await oe(r);((a.mode&511)!=384||a.uid!==process.getuid?.())&&(n=!1)}return n}async function ra(e,t){await Qi(e),await de(t,{force:!0})}async function ia(e){let t=t=>new Z(`Refusing to read ${ge(e)} because ${t}. Delete it and run \`prismic login\` again.`),n;try{if(process.platform===`win32`&&(await oe(e)).isSymbolicLink())throw t(`it's a symbolic link`);n=await se(e,Ge.O_RDONLY|(Ge.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 Z(`Can't read ${ge(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 aa(e){try{return e&&JSON.parse(e.toString())}catch{return}}function oa(){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`&&Ke(`/opt/.devin`))return`devin`;if(process.env.IS_SANDBOX===`yes`)return`unknown-sandbox`}function sa(e){let t=process.platform===`darwin`?`open`:process.platform===`win32`?`start ""`:`xdg-open`;qe(`${t} "${e.toString()}"`)}const ca=kt.withOptions({alignValues:!0});function la(e,...t){if(typeof e==`string`)return ca(e);let n=Array.from(e);return ca(Object.assign(n,{raw:n}),...t)}function ua(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}function da(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 fa=oa()!==void 0,pa={"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 ma(e,t){return async function(){let{positionals:n={},options:r={}}=e,i;try{i=ae({args:process.argv.slice(1+e.name.split(` `).length),options:{...r,...pa,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={...ga(e.name,e.agents),USAGE:` ${[e.name,...t.map(e=>`<${e}>`),`[options]`].join(` `)}`};t.length>0&&(i.ARGUMENTS=da(Object.entries(n).map(([e,t])=>[` <${e}>`,t.description+(t.required?` (required)`:``)]))),i.OPTIONS=da(_a(r)),console.info(va(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 ha(e){return async function(){let{positionals:[t]}=ae({args:process.argv.slice(1+e.name.split(` `).length),options:{...pa,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={...ga(e.name),USAGE:` ${e.name} <command> [options]`,COMMANDS:da(Object.entries(e.commands).filter(([,e])=>!e.hidden).map(([e,t])=>[` ${e}`,t.description])),OPTIONS:da(_a({}))};console.info(va(e.description,n,e.name,e.sections))}}function ga(e,t){if(!fa)return{};let n=la`
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${la(t)}`:n).replace(/^(?=.)/gm,` `)}}function _a(e){let t=fa?{...e,...pa}: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 va(e,t,n,r={}){let i=[la(e)];for(let[e,n]of Object.entries(t))i.push(``,e,n);for(let[e,t]of Object.entries(r))i.push(``,e,...la(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 ya(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 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.`)}var Q=class extends Error{name=`CommandError`};const xa=h([P({type:s(`USER`),email:x(),shortId:x()}),P({type:s(`Machine2Machine`),domain:x(),appName:x()})]);async function Sa(e,t){let r=new URL(`validate`,Ca(t.host));return n(r,{headers:e?{Authorization:`Bearer ${e}`}:void 0,schema:xa})}function Ca(e){return new URL(`https://auth.${e}/`)}const wa=P({email:x(),shortId:x(),intercomHash:x()}),Ta=P({domain:x(),name:l(x()),role:l(h([x(),S(x(),x())]))});async function Ea(e){let t=new URL(`user/profile`,Oa(e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:wa,unknownErrorMessage:`Failed to load your profile`})}async function Da(e){let t=new URL(`user/repositories`,Oa(e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:P({repositories:g(Ta)}),unknownErrorMessage:`Failed to load your repositories`})}function Oa(e){return new URL(`https://api.internal.${e}/`)}const ka=P({name:l(x()),starter:o(P({id:x(),revision:x(),framework:x(),deploymentUrl:O()})),framework:l(x()),quotas:l(P({sliceMachineEnabled:V()}))});async function Aa(e){let t=new URL(``,Fa(e.host));return t.searchParams.set(`repository`,e.repo),n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`,repository:e.repo},onUnauthorized:e.onUnauthorized,schema:ka,notFoundMessage:`Repository not found: ${e.repo}`})}async function ja(e,t){let r=new URL(`type-builder`,Fa(t.host));r.searchParams.set(`repository`,t.repo),await n(r,{method:`PATCH`,json:{framework:e},headers:{Authorization:`Bearer ${await t.getToken()}`,repository:t.repo},onUnauthorized:t.onUnauthorized,notFoundMessage:`Repository not found: ${t.repo}`})}const Ma=P({completedSteps:g(x())});async function Na(e){let t=new URL(`onboarding`,Fa(e.host));return t.searchParams.set(`repository`,e.repo),n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:Ma})}async function Pa(e,t){let r=new URL(`onboarding/${encodeURIComponent(e)}/toggle`,Fa(t.host));return r.searchParams.set(`repository`,t.repo),n(r,{method:`PATCH`,headers:{Authorization:`Bearer ${await t.getToken()}`},onUnauthorized:t.onUnauthorized,schema:Ma})}function Fa(e){return new URL(`https://api.internal.${e}/repository/`)}async function Ia(e){let t=new URL(`customtypes`,za(e.host));return e.releaseId&&t.searchParams.set(`release`,e.releaseId),n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`,repository:e.repo},onUnauthorized:e.onUnauthorized,notFoundMessage:`Repository not found: ${e.repo}`})}async function La(e){let t=new URL(`slices`,za(e.host));return e.releaseId&&t.searchParams.set(`release`,e.releaseId),n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`,repository:e.repo},onUnauthorized:e.onUnauthorized,notFoundMessage:`Repository not found: ${e.repo}`})}async function Ra(e,t){let r=new URL(`bulk-update`,za(t.host));t.releaseId&&r.searchParams.set(`release`,t.releaseId),await n(r,{method:`POST`,json:{changes:e},headers:{Authorization:`Bearer ${await t.getToken()}`,repository:t.repo},onUnauthorized:t.onUnauthorized,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to update models`})}function za(e){return new URL(`https://customtypes.${e}/`)}const Ba=P({values:P({url:x(),fields:S(x(),x())}),imgixEndpoint:x()}),Va={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function Ha(e,t){let r=new URL(`delete`,Ka(t.host));r.searchParams.set(`repository`,t.repo),await n(r,{method:`POST`,json:{sliceId:e},headers:{Authorization:`Bearer ${await t.getToken()}`,repository:t.repo},onUnauthorized:t.onUnauthorized})}async function Ua(e,t){let{sliceId:r,variationId:i,repo:a}=t,o=e.type;if(!(o in Va))throw new Ga(o);let s=await Wa(t),c=Va[o],l=`${a}/shared-slices/${r}/${i}/${xe(`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 Wa(e){let t=new URL(`presigned-url`,Ka(e.host));return t.searchParams.set(`repository`,e.repo),n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`,repository:e.repo},onUnauthorized:e.onUnauthorized,schema:Ba})}var Ga=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){let t=Object.keys(Va);super(`Unsupported file type: ${e||`unknown`}. Supported: ${t.join(`, `)}`)}};function Ka(e){return new URL(`https://api.internal.${e}/screenshot/`)}const qa=P({id:x(),label:x(),customName:b(x()),isMaster:V()});async function Ja(e){let t=new URL(`repository/locales`,Za(e.host));return t.searchParams.set(`repository`,e.repo),n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:P({results:g(qa)}),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load locales`})}async function Ya(e,t){let r=new URL(`repository/locales`,Za(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:qa,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to save locale`})}async function Xa(e,t){let r=new URL(`repository/locales/${encodeURIComponent(e)}`,Za(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 Za(e){return new URL(`https://api.internal.${e}/locale/`)}const Qa=P({id:x(),label:x(),url:x()});async function $a(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:P({results:g(Qa)}),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load previews`})}async function eo(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 to(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 no=P({kind:d([`prod`,`stage`,`dev`]),name:x(),domain:x(),users:g(P({id:x()}))});async function ro(e){let t=new URL(`core/environments`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:P({results:g(no)}),notFoundMessage:`Repository not found: ${e.repo}`})}async function io(e){let t=new URL(`core/repository`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:P({simulator_url:l(x())}),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load simulator URL`})}async function ao(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 oo(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:P({total:u()}),notFoundMessage:`Repository not found: ${t.repo}`})}async function so(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:ee({id:x()}),notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to create a release`})}async function co(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 lo=P({documentsPublished:V(),documentsUnpublished:V(),releasesCreated:V(),releasesUpdated:V(),tagsCreated:V(),tagsDeleted:V()}),uo=Object.keys(lo.shape),fo=P({config:r(lo,{_id:x(),url:x(),active:V(),name:b(x()),secret:b(x()),headers:S(x(),x())})});async function po(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:g(fo),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load webhooks`})}async function mo(e,t){let r=_o({...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 ho(e,t,r){let i=_o(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 go(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 _o(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 vo=P({id:x(),scope:x(),token:x(),created_at:P({$date:u()})}),yo=P({id:x(),name:x(),wroom_auths:g(vo)}),bo=P({app_name:x(),token:x(),timestamp:u()}),xo=P({max_tokens:u(),tokens:g(bo)});async function So(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:g(yo),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load OAuth apps`})}async function Co(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:yo,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to create OAuth app`})}async function wo(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:vo,notFoundMessage:`Repository not found: ${r.repo}`,unknownErrorMessage:`Failed to create token`})}async function To(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 Eo(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:xo,notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load write tokens`})}async function Do(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:bo,notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to create write token`})}async function Oo(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 ko(e){let t=new URL(`syncState`,$(e.repo,e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:P({repository:P({api_access:x()})}),notFoundMessage:`Repository not found: ${e.repo}`,unknownErrorMessage:`Failed to load repository access`})}async function Ao(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 jo(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:P({repository:P({name:x()})}),notFoundMessage:`Repository not found: ${t.repo}`,unknownErrorMessage:`Failed to set repository name`})}function $(e,t){return new URL(`https://${e}.${t}/`)}async function Mo(e){let t=new URL(`app/dashboard/repositories/${encodeURIComponent(e.domain)}/exists`,Po(e.host));return n(t,{headers:{Authorization:`Bearer ${await e.getToken()}`},onUnauthorized:e.onUnauthorized,schema:V()})}async function No(e){let{domain:t,name:r,framework:i,agent:a,host:o}=e,s=new URL(`app/dashboard/repositories`,Po(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 Po(e){return new URL(`https://${e}/`)}const Fo=P({path:x(),title:x(),description:l(x())}),Io=P({path:x(),title:x(),description:l(x()),anchors:g(P({slug:x(),excerpt:x()}))});async function Lo(e){let t=new URL(`api/index/`,Bo(e.host));return n(t,{schema:g(Fo),unknownErrorMessage:`Failed to fetch documentation index`})}async function Ro(e,t){let r=new URL(`api/index/${e}`,Bo(t.host));return n(r,{schema:Io,notFoundMessage:`Documentation page not found: ${e}`,unknownErrorMessage:`Failed to fetch documentation index`})}async function zo(e,t){let r=new URL(e,Bo(t.host));return n(r,{headers:{Accept:`text/markdown`,...t.headers},schema:x(),notFoundMessage:`Page not found: ${e}`,unknownErrorMessage:`Failed to fetch documentation page`})}function Bo(e=`prismic.io`){return new URL(`https://${e}/docs/`)}const Vo=ee({exp:l(u()),type:l(x())});function Ho(e){try{let[,t]=e.split(`.`);if(!t)return;let n=JSON.parse(Buffer.from(t,`base64url`).toString());return I(Vo,n)}catch{return}}const Uo=P({anonymousId:x(),userId:l(x())}),Wo=!Vr.PRISMIC_TOKEN;let Go=!1,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is;async function as(e){let{host:t,repo:n}=e;n&&(Ko=n),Zo=e.userIntent,Qo=e.taskId,$o=e.store,es=e.storeReason;let r=t===`prismic.io`?`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`:`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`;qo=oa(),Jo=us(e.loggedIn),{runtime:Yo,runtimeProvider:Xo}=ds();let i=await ms();rs=i??{anonymousId:crypto.randomUUID()},i||await hs(rs),ie({writeKey:r,anonymousId:rs.anonymousId,userId:ss()})}function os(e){H({userId:e.shortId,intercomHash:e.intercomHash}),Wo&&!Go&&rs&&(rs.userId=e.shortId,hs(rs))}function ss(){return Wo?rs?.userId:void 0}function cs(){if(!rs)return{};let e=ss();return{"Prismic-Anonymous-Id":rs.anonymousId,...e?{"Prismic-User-Id":e}:{}}}async function ls(){Go=!0;let e=await ms();e?.userId&&await hs({anonymousId:e.anonymousId})}function us(e){if(!Vr.PRISMIC_TOKEN)return e?`login`:`none`;let t=Ho(Vr.PRISMIC_TOKEN);return t?t.type===`machine2machine`?`write-token`:`user-token`:`unknown-token`}function ds(){let e=fs();if(e)return{runtime:`cloud`,runtimeProvider:e};let t=ps();return t||process.env.CI?{runtime:`ci`,runtimeProvider:t}:Ke(`/.dockerenv`)||Ke(`/run/.containerenv`)||process.env.KUBERNETES_SERVICE_HOST?{runtime:`container`}:process.platform!==`linux`||process.env.WSL_DISTRO_NAME?{runtime:`local`}:{runtime:`unknown`}}function fs(){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(Ke(`/opt/.devin`))return`devin`}function ps(){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 ms(){return w(Jr,{schema:Uo}).catch(()=>void 0)}async function hs(e){await _(Jr,N(e)).catch(()=>{})}function gs(e,t={}){let{watch:n}=t;is={type:e,watch:n},U(`Prismic CLI Start`,{properties:{commandType:e,fullCommand:process.argv.join(` `),repository:Ko,watch:n,agent:qo,auth:Jo,runtime:Yo,runtimeProvider:Xo,userIntent:Zo,taskId:Qo},groupId:Ko?{Repository:Ko}:void 0})}function _s(e={}){if(!is)return;let{type:t,watch:n}=is;is=void 0;let{error:r}=e,i=r?r instanceof Error?r.message:String(r):void 0;U(`Prismic CLI End`,{properties:{commandType:t,fullCommand:process.argv.join(` `),success:!process.exitCode,repository:Ko,watch:n,error:i?.slice(0,512),agent:qo,auth:Jo,store:$o,storeReason:es,loginResult:ts?.result,loginResumed:ts?.resumed,loginDurationS:ts?.durationS,revoked:ns,runtime:Yo,runtimeProvider:Xo,userIntent:Zo,taskId:Qo},groupId:Ko?{Repository:Ko}:void 0})}function vs(e){let{result:t,resumed:n,startedAt:r}=e;ts={result:t,resumed:n,durationS:Math.round((Date.now()-r)/1e3)},e.store&&({store:$o,storeReason:es}=e)}function ys(e){ns=e.revoked}const bs={expired:`expired`,declined:`declined`,"email-unverified":`email-unverified`,"invalid-grant":`error`,misconfigured:`error`,unavailable:`error`};function xs(e){return e instanceof di?bs[e.reason]:`error`}const Ss=P({telemetry:V()});async function Cs(){try{return!(await ws(Ve())||await ws(process.cwd()))}catch{return!0}}async function ws(e){return(await w(new URL(`.prismicrc`,A(_e(e))),{schema:Ss}).catch(()=>void 0))?.telemetry===!1}const Ts=3e5,Es=1e3,Ds={audience:`prismic.io`,scope:`openid profile email offline_access`},Os=new URL(`.prismic`,A(_e(Ve())));let ks,As=!1,js,Ms;async function Ns(){return Vr.PRISMIC_TOKEN||Fs()}async function Ps(){return Vr.PRISMIC_HOST?Vr.PRISMIC_HOST:(Ms??=zi().then(e=>e.host),await Ms||`prismic.io`)}async function Fs(e={}){let{forceRefresh:t=!1}=e,n=(await Ri()).login?.session;if(!n?.refreshToken||n.host!==await Ps())return;let r=Ls(n,Ts);if(r&&!t)return r;ks??=Wi(async e=>{let{login:t}=await Ri();return Is(e,t,n.accessToken,{canRetry:!0})}).finally(()=>ks=void 0);try{return await ks}catch(e){let r=Ls(n);if((e instanceof di||e instanceof Z)&&r&&!t)return r;throw e}}async function Is(e,t,n,r){let i=t?.session;if(!t||!i?.refreshToken||i.host!==await Ps())return;let a=Ls(i,Ts);if(a&&a!==n)return a;let{refreshToken:o,auth0Domain:s,clientId:c,host:l}=i,u=await ri(o,i);if(u)return await Hi(e,{...t,session:{...i,...u}}),u.accessToken;let d=(await Ri()).login;if(r.canRetry&&d?.session.refreshToken!==o&&await e.isHeld())return Is(e,d,n,{canRetry:!1});await Hi(e,{...t,session:{host:l,auth0Domain:s,clientId:c,pendingLogin:i.pendingLogin}}),As=!0}function Ls(e,t=0){let{accessToken:n,expiresAt:r}=e;if(n&&r&&r-t>Date.now())return n}async function Rs(e,t){if(Vr.PRISMIC_TOKEN||process.env.CI)return;let n=await Ns();if(n&&t.get(`Authorization`)!==`Bearer ${n}`)return e({headers:{Authorization:`Bearer ${n}`}});if(js||await zs(n))return js??=Bs().finally(()=>js=void 0),e({headers:{Authorization:`Bearer ${await js}`}})}async function zs(e){try{return await Sa(e,{host:await Ps()}),!1}catch(e){return e instanceof p||e instanceof z}}async function Bs(e={}){return await Fs({forceRefresh:!0})||(console.error(As?`Your login expired.`:`You are not logged in.`),Vs(e))}async function Vs(e={}){let{browser:t=!1}=e,n=await Ps(),r=Hs(n);if(!r)throw new Q(`Login isn't available for ${n}. Use PRISMIC_TOKEN.`);let i=oa()===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 Ri().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 Xs(a.pending,void 0);let{resumed:e,startedAt:t,saved:n}=a;vs({result:n?`success`:`cancelled`,resumed:e,startedAt:t,store:n?.store,storeReason:n?.storeReason}),await Us(n?`Logged in to Prismic.`:`Login cancelled.`,130)});let s;try{s=await Ws(a,{browser:t&&i})}catch(e){throw vs({result:xs(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 vs({result:`wait-limit`,resumed:c,startedAt:l}),Us(`Waiting for approval. After the user approves, run the same command again. It continues this login.`,1);if(s.status===`logged-out`)throw vs({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&&vs({result:`success`,resumed:c,startedAt:l,store:f,storeReason:p}),console.error(`Logged in to Prismic as ${d}`),u}function Hs(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 Us(e,t){process.exitCode=t,_s({error:e}),await new Promise(t=>process.stderr.write(`${e}\n`,t)),process.exit()}async function Ws(e,t){let n=await Gs(e);if(!n)return{status:`wait-limit`};let r;try{let n=await Ks(e);if(n.status===`logged-out`)return n;if(n.status===`saved`)r=n;else{let{pending:i}=n;i.deviceCode!==e.shown?.deviceCode&&Js(i);let a=i.verificationUriComplete??i.verificationUri;t.browser&&/^https:\/\/[\w\-.:/?=&~+]+$/.test(a)&&URL.canParse(a)&&sa(new URL(a));let o=await Ys(e,i);if(`status`in o)return o;let s=await Zs(e,i,o);if(!s)return{status:`logged-out`};r=s}}finally{await n.release()}await ls();let{email:i}=await Ea({getToken:async()=>r.token,host:e.host});return{...r,status:`logged-in`,email:i}}async function Gs(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 xi))throw n;if(Date.now()>=e.deadline)return;if(Date.now()>=t)throw new di(`expired`)}e.waited=!0;let r=(await Ri().catch(()=>void 0))?.login?.session;e.shown=r&&qs(r,e),e.shown?Js(e.shown):await We(Es)}}async function Ks(e){return Wi(async t=>{let n=await Ri().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&&Ls(a.session);if(e.waited&&o&&o!==e.tokenBefore)return{status:`saved`,token:o,store:a.store,storeReason:a.storeReason};let s={...await $r(Ds,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 Js(e){let{userCode:t,verificationUri:n,verificationUriComplete:r}=e,i=Math.max(1,Math.ceil((e.expiresAt-Date.now())/6e4));console.error(la`
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 Ys(e,t){let n=new AbortController,r=setInterval(async()=>{let r=await Ri().catch(()=>void 0);e.cancelled||r&&r.login?.session.pendingLogin?.deviceCode!==t.deviceCode&&n.abort()},Es),i=Number.isFinite(e.deadline)?AbortSignal.timeout(Math.max(0,e.deadline-Date.now())):void 0;try{return await ti(t,{signal:i?AbortSignal.any([i,n.signal]):n.signal,onUpdate:n=>Xs(t,{...n,host:e.host})})}catch(e){if(e instanceof di)throw await Xs(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 Xs(e,t){await Wi(async n=>{let r=(await Ri()).login;r?.session.pendingLogin?.deviceCode===e.deviceCode&&await Hi(n,{...r,session:{...r.session,pendingLogin:t}})}).catch(()=>{})}async function Zs(e,t,n){return Wi(async r=>{let i=await Ri().catch(()=>void 0);if(i&&i.login?.session.pendingLogin?.deviceCode!==t.deviceCode){await ii(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 ii(s.refreshToken,s).catch(()=>{}),e.saved})}async function Qs(){let e;try{e=await ce(Os,`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 de(Os,{force:!0})}catch{}}function $s(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 ec(e){return e.insert.length+e.update.length+e.delete.length>0}const tc=[`Slices`,`UID`,`Choice`];function nc(e,t,n){if(t in e)throw new _c(t);e[t]=n}function rc(e,t){let n=e[t];if(!n)throw new vc(t);return n}function ic(e,t,n){let r=new Map(n.map(e=>[e.id,e])),i=r.get(t);if(!i)throw new bc(`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 bc(`Field "${e}" does not exist on type "${n}".`);let c=o.filter(Boolean);if(c.length===0){if(tc.includes(s.type)||e===`uid`)throw new bc(`Field "${e}" cannot be fetched from a content relationship.`);if(s.type===`Group`)throw new bc(`Field "${e}" is a group. Select specific subfields.`);return e}if(c.length!==o.length)throw new bc(`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 bc(`Content relationships cannot be nested more than once.`);let t=s.config?.customtypes;if(!t||t.length!==1)throw new bc(`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 bc(`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 bc(`Field "${e}" is not a group or content relationship field.`)})};return a(e,Object.assign({},...Object.values(i.json)),i.id,!0)}function ac(e,t,n){let r;if(n){if(r=t.json[n],!r)throw new xc(n,t.id)}else{let[n]=e.split(`.`);if(r=Object.values(t.json).find(e=>n in e),!r)throw new vc(n)}return hc(e,r)}function oc(e,t,n,r=!1){let i=t.variations.find(e=>e.id===n);if(!i)throw new Sc(n,t.id);if(r){if(!i.items||Object.keys(i.items).length===0)throw new Cc(n,t.id);return hc(e,i.items)}return i.primary??={},hc(e,i.primary)}async function sc(e){let[t,n]=await Promise.all([Ia(e),La(e)]);return{customTypes:t,slices:n}}async function cc({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 Ra(i,n)}function lc(e,t,n={}){let{treatNonCanonicalAsChanged:r=!1}=n;return{customTypes:$s(e.customTypes,t.customTypes,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(uc(e))===JSON.stringify(r?t:uc(t))}),slices:$s(e.slices,t.slices,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(dc(e))===JSON.stringify(r?t:dc(t))})}}function uc(e){return{...mc(e),json:Object.fromEntries(Object.entries(e.json).map(([e,t])=>[e,fc(t)]))}}function dc(e){return{...mc(e),variations:e.variations.map(e=>{let t=mc(e);return e.primary&&(t.primary=fc(e.primary)),e.items&&(t.items=fc(e.items)),t})}}function fc(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=mc(t);return t.type===`Group`&&t.config?.fields&&n.type===`Group`&&n.config?.fields&&(n.config.fields=fc(t.config.fields)),t.type===`Slices`&&t.config?.choices&&n.type===`Slices`&&n.config?.choices&&(n.config.choices=pc(t.config.choices)),[e,n]}))}function pc(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=mc(t);return t.type===`Slice`&&n.type===`Slice`&&(t[`non-repeat`]&&(n[`non-repeat`]=fc(t[`non-repeat`])),t.repeat&&(n.repeat=fc(t.repeat))),[e,n]}))}function mc(e){return Array.isArray(e)?e.map(mc):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,mc(t)]))}function hc(e,t){let[n,...r]=e.split(`.`);if(r.length===0)return{fields:t,fieldId:n};let i=rc(t,n);if(i.type!==`Group`)throw new yc(n);return i.config??={},i.config.fields??={},hc(r.join(`.`),i.config.fields)}function gc(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 _c=class extends Error{name=`FieldExistsError`;constructor(e){super(`Field "${e}" already exists.`)}},vc=class extends Error{name=`FieldNotFoundError`;constructor(e){super(`Field "${e}" does not exist.`)}},yc=class extends Error{name=`UnsupportedNestedFieldError`;constructor(e){super(`Field "${e}" does not support nested fields.`)}},bc=class extends Error{name=`FieldSelectionError`},xc=class extends Error{name=`TabNotFoundError`;constructor(e,t){super(`Tab "${e}" does not exist on type "${t}".`)}},Sc=class extends Error{name=`SliceVariationNotFoundError`;constructor(e,t){super(`Variation "${e}" does not exist on slice "${t}".`)}},Cc=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 wc=`prismic.config.json`,Tc=P({type:x(),path:x(),uid:l(x()),lang:l(x()),resolvers:l(S(x(),x()))}),Ec=P({repositoryName:x(),documentAPIEndpoint:l(O()),libraries:l(g(x())),routes:l(g(Tc))});async function Dc(e){let t=await Nc();return await me(t,N(e)),t}async function Oc(){let e=await jc();try{return await w(e,{schema:Ec})}catch{throw new kc}}var kc=class extends Error{name=`InvalidPrismicConfigError`;message=`${wc} is invalid. Run \`prismic init\` to re-create a config.`};async function Ac(e){let t=await jc(),n={...await Oc(),...e};return await me(t,N(n)),n}async function jc(){let e=await ne(wc,{stop:`package.json`});if(!e)throw new Mc;return e}var Mc=class extends Error{name=`MissingPrismicConfigError`;message=`Could not find a ${wc} file. Run \`prismic init\` to create a config.`};async function Nc(){try{let e=await F();return new URL(wc,e)}catch(e){throw e instanceof L?new Pc({cause:e}):e}}var Pc=class extends Error{name=`UnknownProjectRootError`;constructor(e){super(`Could not find your project root.`,e)}};async function Fc(e){let{routes:t=[]}=await Oc();if(t.some(t=>t.type===e.id))return;let n=zc(e),r={type:e.id,path:n};await Ac({routes:[...t,r].sort((e,t)=>e.type.localeCompare(t.type))})}async function Ic(e){e.format===`page`?await Fc(e):await Lc(e.id)}async function Lc(e){let{routes:t=[]}=await Oc(),n=t.filter(t=>t.type!==e);t.length!==n.length&&await Ac({routes:n})}function Rc(e,t){return e.find(e=>e.type===t&&!e.uid&&!/[?*+]/.test(e.path))}function zc(e){let{id:t,repeatable:n}=e,r=t.replaceAll(`_`,`-`).toLowerCase();return n?t===`page`?`/:uid`:`/${r}/:uid`:t===`homepage`?`/`:`/${r}`}const Bc=`slicemachine.config.json`,Vc=P({repositoryName:x(),libraries:l(g(x()))});async function Hc(){let e=await Gc();try{return await w(e,{schema:Vc})}catch{throw new Uc}}var Uc=class extends Error{name=`InvalidLegacySliceMachineConfigError`;message=`${Bc} is invalid.`};async function Wc(){let e=await Gc();await de(e)}async function Gc(){let e=await ne(Bc,{stop:`package.json`});if(!e)throw new Kc;return e}var Kc=class extends Error{name=`MissingLegacySliceMachineConfigError`;message=`Could not find a ${Bc} file.`};async function qc(){let e;try{e=await jc()}catch(t){if(t instanceof Mc)e=await Nc();else throw t}let t=new URL(`.`,e);return A(_e(await le(ge(t))))}async function Jc(){try{return(await Oc()).repositoryName}catch(e){if(e instanceof Mc)try{return(await Hc()).repositoryName}catch{}throw e}}async function Yc(){let e=(await Oc()).libraries;if(!e||e.length<1)return;let t=await qc();return e.map(e=>A(new URL(e.replace(/^\//,``),t)))}async function Xc(){let e=await qc();return j(new URL(`tsconfig.json`,e))}const Zc=[`next`,`nuxt`,`sveltekit`];async function Qc(){let{dependencies:e,devDependencies:t,peerDependencies:n}=await re(),r={...e,...t,...n};if(`next`in r){let{NextJsAdapter:e}=await import(`./nextjs-qKZ1AVbz.mjs`);return new e}if(`nuxt`in r){let{NuxtAdapter:e}=await import(`./nuxt-CgFKCGoT.mjs`);return new e}if(`@sveltejs/kit`in r){if(await T(`@sveltejs/kit`)<3){let{SvelteKit2Adapter:e}=await import(`./sveltekit2-Cu2gr60a.mjs`);return new e}let{SvelteKitAdapter:e}=await import(`./sveltekit-Dpra9SUv.mjs`);return new e}throw new $c}var $c=class extends Error{name=`NoSupportedFrameworkError`;message=`No supported framework found. Run this command in a Next.js, Nuxt, or SvelteKit project.`},el=class extends Error{name=`ModelExistsError`},tl=class extends Error{name=`SliceNotFoundError`;constructor(e){super(`Slice "${e}" does not exist. Run \`prismic slice list\` to see available IDs.`)}},nl=class extends Error{name=`CustomTypeNotFoundError`;constructor(e){super(`Type "${e}" does not exist. Run \`prismic type list\` to see available IDs.`)}};async function rl(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=f(await qc(),i?.directory??n),o=i?` (id: ${i.model.id})`:``;throw new el(`A ${e} already exists at ${a}${he}${o}.`)}async function il(){return await(await Qc()).getEnvironment()??await Jc()}async function al(e){let t=await Lr(`**/*.{js,jsx,mjs,ts,tsx,mts,svelte}`,{cwd:ge(await qc()),absolute:!0,ignore:`**/{node_modules,build,dist,out}/**`});for(let n of t)try{if((await ce(n,`utf8`)).includes(e))return!0}catch{}return!1}async function ol(e,t){await j(e)||await _(e,t)}async function sl(){return await Xc()?`ts`:`js`}var cl=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 Jc(),getToken:Ns,host:await Ps()};(await io(t)).simulator_url||await ao(this.localSimulatorUrl,t),(await $a(t)).results.length===0&&await eo(this.localPreviewConfig,t)}async getSliceLibraries(){return await Yc()??[await this.getDefaultSliceLibrary()]}async getSlices(){return ul(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=gc((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 tl(e)}async createSlice(e){let[t]=await this.getSliceLibraries(),n=A(new URL(pt(e.name),A(t)));await rl(`slice`,e.id,n,await this.getSlices()),await _(new URL(`model.json`,n),N(dc(e))),await this.createSliceIndexFile(t),await this.createSliceComponent(e,n)}async updateSlice(e){let t=await this.getSlice(e.id);await _(t.modelPath,N(dc(e))),await this.createSliceIndexFile(t.library)}async deleteSlice(e){let t=await this.getSlice(e);await de(t.directory,{recursive:!0}),await this.createSliceIndexFile(t.library)}async getCustomTypeLibraries(){return[new URL(`customtypes/`,await qc())]}async getCustomTypes(){return ul(await this.getCustomTypeLibraries(),`*/index.json`)}async getCustomType(e){let t=(await this.getCustomTypes()).find(t=>t.model.id===e);if(!t)throw new nl(e);return t}async createCustomType(e){let[t]=await this.getCustomTypeLibraries(),n=A(new URL(e.id,A(t)));if(await rl(`type`,e.id,n,await this.getCustomTypes()),await _(new URL(`index.json`,n),N(uc(e))),e.format!==`page`)return[];await Fc(e);let r=await qc();return(await this.writePageFiles(e)).map(({path:t})=>`Skipped ${f(r,t)} (already exists). Run \`prismic gen page ${e.id}\` to get the code.`)}async writePageFiles(e){let{routes:t=[]}=await Oc(),n=(Rc(t,e.id)?.path??zc(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,N(uc(e))),await Ic(e)}async deleteCustomType(e){let t=await this.getCustomType(e);await de(t.directory,{recursive:!0}),await Lc(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=Xt({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 ll();if(await j(e))return(await te(e))[this.environmentEnvVarName]||void 0}async setEnvironment(e){await B(await ll(),this.environmentEnvVarName,e)}async unsetEnvironment(){await D(await ll(),this.environmentEnvVarName)}};async function ll(){return new URL(`.env.local`,await qc())}async function ul(e,t){let n=[];for(let r of e){let e=await Lr(t,{absolute:!0,cwd:r}),i=await Promise.all(e.map(async e=>{let t=_e(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{as as $,ua as $t,Sc as A,Na as At,ac as B,jo as Bt,Oc as C,Lo as Ct,vc as D,ro as Dt,_c as E,oo as Et,dc as F,Ea as Ft,Ps as G,Ya as Gt,cc as H,Pa as Ht,lc as I,Da as It,Rs as J,ma as Jt,Ns as K,Sa as Kt,gc as L,po as Lt,yc as M,Aa as Mt,nc as N,ko as Nt,bc as O,Ja as Ot,uc as P,io as Pt,ss as Q,la as Qt,sc as R,Eo as Rt,Jc as S,ja as St,Ac as T,Ro as Tt,ec as U,ho as Ut,oc as V,ao as Vt,Qs as W,Ua as Wt,ls as X,ya as Xt,Bs as Y,ha as Yt,cs as Z,ba as Zt,Xc as _,ht as _n,to as _t,$c as a,Ri as an,Ga as at,Rc as b,go as bt,il as c,di as cn,Mo as ct,ol as d,qr as dn,so as dt,da as en,Cs as et,Uc as f,zr as fn,No as ft,zc as g,pt as gn,To as gt,Pc as h,mt as hn,Xa as ht,el as i,Ui as in,os as it,xc as j,$a as jt,Cc as k,So as kt,Qc as l,ii as ln,Co as lt,Mc as m,ft as mn,Do as mt,nl as n,oa as nn,_s as nt,tl as o,zi as on,uo as ot,kc as p,Vr as pn,mo as pt,Vs as q,Q as qt,Zc as r,Z as rn,gs as rt,al as s,Wi as sn,eo as st,cl as t,sa as tn,ys as tt,sl as u,X as un,wo as ut,Dc as v,co as vt,Hc as w,zo as wt,qc as x,Oo as xt,Wc as y,Ha as yt,ic as z,Ao as zt};