prismic 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,24 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import{$ as e,A as t,B as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,Q as g,R as ee,T as te,U as ne,V as re,W as ie,X as _,Y as ae,Z as v,_ as y,a as b,at as x,b as oe,c as se,ct as ce,dt as S,et as le,f as ue,g as de,h as fe,ht as pe,i as me,it as C,j as w,k as he,l as ge,lt as _e,m as ve,n as T,nt as ye,o as be,ot as xe,pt as Se,q as Ce,rt as we,s as Te,st as E,t as Ee,tt as De,u as Oe,ut as ke,v as Ae,y as je,z as Me}from"./string-Bw3SHvrb.mjs";import*as Ne from"node:util";import{parseArgs as Pe,promisify as Fe}from"node:util";import{readFile as Ie,rm as Le}from"node:fs/promises";import{fileURLToPath as Re,pathToFileURL as ze}from"node:url";import{createHash as Be,randomUUID as Ve}from"node:crypto";import{dirname as He,join as Ue,posix as We,sep as Ge}from"node:path";import{exec as Ke,execFile as qe,spawn as Je}from"node:child_process";import{Readable as Ye}from"node:stream";import{createInterface as Xe}from"node:readline";import*as Ze from"node:http";import{createServer as Qe}from"node:http";import*as D from"node:os";import{homedir as $e}from"node:os";import{setTimeout as et}from"node:timers/promises";import{isMainThread as tt,threadId as nt}from"worker_threads";import*as rt from"node:diagnostics_channel";import{subscribe as it}from"node:diagnostics_channel";import{createReadStream as at,existsSync as ot,readFile as st,readFileSync as ct,readdir as lt}from"node:fs";import{Worker as ut}from"node:worker_threads";import*as dt from"node:https";import{createGzip as ft}from"node:zlib";import*as pt from"node:net";import*as mt from"node:tls";import{AsyncLocalStorage as ht}from"node:async_hooks";var gt=`prismic`,_t=`1.6.0`;async function vt(e,t){let{host:n}=t,r=yt(n),i=new URL(`refreshtoken`,r);return i.searchParams.set(`token`,e),await v(i,{schema:E()})}function yt(e){return new URL(`https://auth.${e}/`)}function bt(e,t){if(t)return o(ze(t));if(process.platform===`win32`){let t=process.env.APPDATA;if(t)return new URL(`${e}/`,o(ze(t)))}if(process.platform!==`darwin`){let t=process.env.XDG_CONFIG_HOME;if(t)return new URL(`${e}/`,o(ze(t)))}let n=o(ze($e()));return new URL(`.config/${e}/`,n)}const xt=bt(`prismic`,w.PRISMIC_CONFIG_DIR),St=new URL(`credentials.json`,xt),Ct=new URL(`update-notifier.json`,xt),wt=De({token:x(E().check(ce(1))),host:x(E().check(ce(1)))});async function O(){return(await Dt())?.token}async function k(){return w.PRISMIC_HOST?w.PRISMIC_HOST:(await Dt())?.host||t}async function Tt(){let e=await O();if(!e)return;let t=await k(),n=await vt(e,{host:t});return await Ot({token:n,host:t}),n}async function Et(){if(!await r(St))return!0;try{return await Le(St,{force:!0}),!0}catch{return!1}}async function Dt(){try{let e=await Ie(St,`utf-8`);return _e(wt,JSON.parse(e))}catch{return}}async function Ot(e){await he(St,i(e))}async function kt(e){let t=await k(),n=`https://${t}`;return new Promise((r,i)=>{let a=Qe((e,i)=>{if(e.method===`OPTIONS`){i.writeHead(204,{"Access-Control-Allow-Origin":n,"Access-Control-Allow-Methods":`POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`}),i.end();return}if(e.method===`POST`){let s=``;e.on(`data`,e=>{s+=e.toString()}),e.on(`end`,async()=>{try{let{cookies:e,email:c}=JSON.parse(s),l=e.find(e=>e.startsWith(`prismic-auth=`))?.split(`;`)[0]?.replace(/^prismic-auth=/,``);if(!l){i.writeHead(400,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}));return}await Ot({token:l,host:t}),i.writeHead(200,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),i.end(JSON.stringify({success:!0})),clearTimeout(o),a.close(),r({email:c})}catch{i.writeHead(400,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}))}});return}i.writeHead(404),i.end()}),o=setTimeout(()=>{a.close(),i(Error(`Login timed out. Please try again.`))},18e4),s=async()=>{let n=a.address();if(!n||typeof n==`string`){clearTimeout(o),a.close(),i(Error(`Failed to start login server`));return}let r=await Mt(t,n.port);e?.onReady?.(r)};a.on(`error`,e=>{e.code===`EADDRINUSE`&&a.listening===!1?a.listen(0,`0.0.0.0`,s):(clearTimeout(o),i(e))}),a.listen(5555,`0.0.0.0`,s)})}const At=new URL(`.prismic`,o(ze($e())));async function jt(){let e;try{e=await Ie(At,`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 Le(At,{force:!0})}catch{}}async function Mt(e,t){let n=new URL(`dashboard/cli/login`,`https://${e}/`);return n.searchParams.set(`source`,`prismic-cli`),n.searchParams.set(`port`,t.toString()),n}function A(e,t){return async function(){let{positionals:n={},options:r={}}=e,i=e.name.split(` `).length,a=process.argv.slice(1+i),o=Object.keys(n).length>0,s=Pe({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(Nt(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new M(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new M(`Missing required option: --${e}`);await t(s)}}function Nt(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[Ee(t)];o.push(``),o.push(`USAGE`);let s=` ${e.name}`;if(a.length>0&&(s+=` `+a.map(e=>`<${e}>`).join(` `)),s+=` [options]`,o.push(s),a.length>0){o.push(``),o.push(`ARGUMENTS`);let e=[];for(let t in r){let n=r[t],i=n.description+(n.required?` (required)`:``);e.push([` <${t}>`,i])}o.push(T(e))}o.push(``),o.push(`OPTIONS`);let c=[];if(i){let e=Object.keys(i);for(let t of e){let e=i[t],n=`${e.short?`-${e.short}, `:` `}--${t}${e.type===`string`?` string`:``}`,r=e.description+(e.required?` (required)`:``);c.push({left:n,description:r})}}c.push({left:`-h, --help`,description:`Show help for command`});let l=c.map(e=>[` ${e.left}`,e.description]);if(o.push(T(l)),n)for(let e in n){let t=Ee(n[e]);o.push(``),o.push(e);for(let e of t.split(`
2
+ import{A as e,B as t,C as n,D as r,E as i,F as a,I as o,M as s,N as c,O as l,P as u,R as d,S as f,T as p,_ as m,a as h,b as g,c as _,f as ee,g as te,h as ne,i as re,j as ie,k as ae,l as oe,m as se,n as v,o as ce,s as le,t as ue,u as de,v as fe,w as y,y as pe}from"./string-Cm7AZ7LW.mjs";import{n as me,t as he}from"./package-DZQ0fS1u.mjs";import{c as ge,d as _e,f as b,g as ve,i as ye,l as x,n as be,o as xe,r as S,s as Se,u as Ce}from"./schemas-BDdFIiZQ.mjs";import{a as we,c as Te,d as Ee,f as C,l as De,p as w,t as T,u as E}from"./json-CCpSnNgM.mjs";import{a as Oe}from"./packageJson-CfpsZ9YS.mjs";import{n as ke,t as Ae}from"./env-LvTyEV-S.mjs";import{a as je,c as Me,i as D,n as Ne,r as O,s as Pe,t as Fe}from"./auth-CFvQoAjM.mjs";import{a as Ie,i as k,n as Le,r as Re,t as ze}from"./segment-4X9XW3DX.mjs";import{t as Be}from"./update-notifier-C2AFlvX2.mjs";import*as Ve from"node:util";import{parseArgs as He,promisify as Ue}from"node:util";import{pathToFileURL as We}from"node:url";import{createHash as Ge}from"node:crypto";import{dirname as Ke,join as qe,posix as Je,sep as Ye}from"node:path";import{exec as Xe,execFile as Ze}from"node:child_process";import{Readable as Qe}from"node:stream";import{createInterface as $e}from"node:readline";import*as et from"node:http";import*as A from"node:os";import{setTimeout as tt}from"node:timers/promises";import{isMainThread as nt,threadId as rt}from"worker_threads";import*as it from"node:diagnostics_channel";import{subscribe as at}from"node:diagnostics_channel";import{createReadStream as ot,existsSync as st,readFile as ct,readFileSync as lt,readdir as ut}from"node:fs";import{Worker as dt}from"node:worker_threads";import*as ft from"node:https";import{createGzip as pt}from"node:zlib";import*as mt from"node:net";import*as ht from"node:tls";import{AsyncLocalStorage as gt}from"node:async_hooks";function j(e,t){return async function(){let{positionals:n={},options:r={}}=e,i=e.name.split(` `).length,a=process.argv.slice(1+i),o=Object.keys(n).length>0,s=He({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(_t(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new N(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new N(`Missing required option: --${e}`);await t(s)}}function _t(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[ue(t)];o.push(``),o.push(`USAGE`);let s=` ${e.name}`;if(a.length>0&&(s+=` `+a.map(e=>`<${e}>`).join(` `)),s+=` [options]`,o.push(s),a.length>0){o.push(``),o.push(`ARGUMENTS`);let e=[];for(let t in r){let n=r[t],i=n.description+(n.required?` (required)`:``);e.push([` <${t}>`,i])}o.push(v(e))}o.push(``),o.push(`OPTIONS`);let c=[];if(i){let e=Object.keys(i);for(let t of e){let e=i[t],n=`${e.short?`-${e.short}, `:` `}--${t}${e.type===`string`?` string`:``}`,r=e.description+(e.required?` (required)`:``);c.push({left:n,description:r})}}c.push({left:`-h, --help`,description:`Show help for command`});let l=c.map(e=>[` ${e.left}`,e.description]);if(o.push(v(l)),n)for(let e in n){let t=ue(n[e]);o.push(``),o.push(e);for(let e of t.split(`
3
3
  `))o.push(e?` ${e}`:``)}o.push(``),o.push(`LEARN MORE`);let u=e.name.split(` `)[0];return o.push(` Use \`${u} <command> --help\` for more information about a command.`),o.join(`
4
- `)}function j(e){let{name:t,description:n,commands:r}=e,i=t.split(` `).length;return async function(){let{positionals:[a]}=Pe({args:process.argv.slice(1+i),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1}),o=a?e.commands[a]:void 0;if(o){await o.handler();return}if(a)throw new M(`Unknown command: ${a}`);console.info(Pt({name:t,description:n,commands:r}))}}function Pt(e){let{name:t,description:n,commands:r}=e,i=[n];i.push(``),i.push(`USAGE`),i.push(` ${t} <command> [options]`),i.push(``),i.push(`COMMANDS`);let a=Object.entries(r).map(([e,t])=>[` ${e}`,t.description]);return i.push(T(a)),i.push(``),i.push(`OPTIONS`),i.push(` -h, --help Show help for command`),i.push(``),i.push(`LEARN MORE`),i.push(` Use \`${t} <command> --help\` for more information about a command.`),i.join(`
5
- `)}var M=class extends Error{name=`CommandError`},Ft=A({name:`prismic type add-tab`,description:`Add a tab to a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"with-slice-zone":i,repo:a=await y()}=t,o=await b(),c=await O(),l=await k(),u=await h(r,{repo:a,token:c,host:l});if(n in u.json)throw new M(`Tab "${n}" already exists in "${r}".`);u.json[n]=i?{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}:{};try{await s(u,{repo:a,host:l,token:c})}catch(e){throw e instanceof _?new M(`Failed to add tab: ${await e.text()}`):e}try{await o.updateCustomType(u)}catch{await o.createCustomType(u)}await o.generateTypes(),console.info(`Added tab "${n}" to "${r}"`)}),It=A({name:`prismic type create`,description:`Create a new content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{format:{type:`string`,short:`f`,description:`Type format: "custom" (default) or "page"`},single:{type:`boolean`,short:`s`,description:`Allow only one document of this type`},id:{type:`string`,description:`Custom ID for the content type`},repo:{type:`string`,short:`r`,description:`Repository domain`}},sections:{FORMATS:`
6
- custom A non-page type (e.g. settings, navigation, author, blog
7
- category). This is the default.
8
- page A page type with a URL (e.g. homepage, blog post, landing
9
- page). Includes a slice zone and SEO & Metadata tab by
10
- default, and configures a route in prismic.config.json.
11
- `}},async({positionals:e,values:t})=>{let[n]=e,{format:r=`custom`,single:i=!1,id:a=Se(n),repo:o=await y()}=t;if(r!==`custom`&&r!==`page`)throw new M(`Invalid format: "${r}". Use "custom" or "page".`);let s={id:a,label:n,repeatable:!i,status:!0,format:r,json:r===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}}},c=await b(),l=await O(),u=await k();try{await ee(s,{repo:o,host:u,token:l})}catch(e){throw e instanceof _?new M(`Failed to create type: ${await e.text()}`):e}await c.createCustomType(s),await c.generateTypes(),console.info(`Created type "${n}" (id: "${a}", format: "${r}")`)}),Lt=A({name:`prismic type edit`,description:`Edit a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the type`},format:{type:`string`,short:`f`,description:`Type format: "custom" or "page"`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t;if(`format`in t&&t.format!==`custom`&&t.format!==`page`)throw new M(`Invalid format: "${t.format}". Use "custom" or "page".`);let i=await b(),a=await O(),o=await k(),c=await h(n,{repo:r,token:a,host:o});`name`in t&&(c.label=t.name),`format`in t&&(c.format=t.format);try{await s(c,{repo:r,host:o,token:a})}catch(e){throw e instanceof _?new M(`Failed to update type: ${await e.text()}`):e}try{await i.updateCustomType(c)}catch{await i.createCustomType(c)}await i.generateTypes(),console.info(`Type updated: "${c.label}" (id: ${c.id})`)}),Rt=A({name:`prismic type edit-tab`,description:`Edit a tab of a content type.`,positionals:{name:{description:`Current name of the tab`,required:!0}},options:{"from-type":{type:`string`,required:!0,description:`ID of the content type`},name:{type:`string`,short:`n`,description:`New name for the tab`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},"without-slice-zone":{type:`boolean`,description:`Remove the slice zone from the tab`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-type":r,repo:i=await y()}=t,a=await b(),o=await O(),c=await k(),l=await h(r,{repo:i,token:o,host:c});if(!(n in l.json))throw new M(`Tab "${n}" not found in "${r}".`);if(`with-slice-zone`in t&&`without-slice-zone`in t)throw new M(`Cannot use --with-slice-zone and --without-slice-zone together.`);if(`with-slice-zone`in t){let e=l.json[n];if(Object.values(e).some(e=>e.type===`Slices`))throw new M(`Tab "${n}" already has a slice zone.`);e.slices={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}if(`without-slice-zone`in t){let e=l.json[n],t=Object.entries(e).find(([,e])=>e.type===`Slices`);if(!t)throw new M(`Tab "${n}" does not have a slice zone.`);let[r,i]=t,a=i.type===`Slices`?i.config?.choices??{}:{};if(Object.keys(a).length>0)throw new M(`Cannot remove slice zone from "${n}": disconnect all slices first.`);delete e[r]}if(`name`in t){if(t.name in l.json)throw new M(`Tab "${t.name}" already exists in "${r}".`);let e={};for(let[r,i]of Object.entries(l.json))e[r===n?t.name:r]=i;l.json=e}try{await s(l,{repo:i,host:c,token:o})}catch(e){throw e instanceof _?new M(`Failed to update tab: ${await e.text()}`):e}try{await a.updateCustomType(l)}catch{await a.createCustomType(l)}await a.generateTypes(),console.info(`Tab updated: "${n}" in "${r}"`)}),zt=A({name:`prismic type list`,description:`List all content types.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:n=await y()}=e,r=await a({repo:n,token:await O(),host:await k()});if(t){console.info(i(r));return}if(r.length===0){console.info(`No types found.`);return}let o=r.map(e=>[e.label||`(no name)`,e.id,e.format??``]);console.info(T(o,{headers:[`NAME`,`ID`,`FORMAT`]}))}),Bt=A({name:`prismic type remove`,description:`Remove a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{repo:i=await y()}=t,a=await b(),o=await O(),s=await k(),c=await h(r,{repo:i,token:o,host:s});try{await n(c.id,{repo:i,host:s,token:o})}catch(e){if(e instanceof _){let t=await e.text();throw t.includes(`associated documents`)?new M(`Type "${r}" has documents. Delete its documents before removing the type.`):new M(`Failed to remove type: ${t}`)}throw e}try{await a.deleteCustomType(c.id)}catch{}await a.generateTypes(),console.info(`Type removed: ${r}`)}),Vt=A({name:`prismic type remove-tab`,description:`Remove a tab from a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,repo:i=await y()}=t,a=await b(),o=await O(),c=await k(),l=await h(r,{repo:i,token:o,host:c});if(!(n in l.json))throw new M(`Tab "${n}" not found in "${r}".`);if(Object.keys(l.json).length<=1)throw new M(`Cannot remove the last tab from "${r}".`);delete l.json[n];try{await s(l,{repo:i,host:c,token:o})}catch(e){throw e instanceof _?new M(`Failed to remove tab: ${await e.text()}`):e}try{await a.updateCustomType(l)}catch{await a.createCustomType(l)}await a.generateTypes(),console.info(`Removed tab "${n}" from "${r}"`)}),Ht=A({name:`prismic type view`,description:`View details of a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r,repo:a=await y()}=t,o=await h(n,{repo:a,token:await O(),host:await k()});if(r){console.info(i(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.label||`(no name)`}`),console.info(`Format: ${o.format}`),console.info(`Repeatable: ${o.repeatable}`);for(let[e,t]of Object.entries(o.json)){console.info(``),console.info(`${e}:`);let n=Object.entries(t);if(n.length===0)console.info(` (no fields)`);else{let e=n.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(T(e))}}}),Ut=j({name:`prismic type`,description:`Manage content types.`,commands:{create:{handler:It,description:`Create a new content type`},edit:{handler:Lt,description:`Edit a content type`},remove:{handler:Bt,description:`Remove a content type`},list:{handler:zt,description:`List content types`},view:{handler:Ht,description:`View a content type`},"add-tab":{handler:Ft,description:`Add a tab to a content type`},"edit-tab":{handler:Rt,description:`Edit a tab of a content type`},"remove-tab":{handler:Vt,description:`Remove a tab from a content type`}}});const Wt=C({path:E(),title:E(),description:x(E())}),Gt=C({path:E(),title:E(),description:x(E()),anchors:g(C({slug:E(),excerpt:E()}))});async function Kt(){return await v(new URL(`api/index/`,Yt()),{schema:g(Wt)})}async function qt(e){let t=new URL(`api/index/${e}`,Yt());try{return await v(t,{schema:Gt})}catch(t){throw t instanceof l&&(t.message=`Documentation page not found: ${e}`),t}}async function Jt(e){let t=new URL(e,Yt());try{return await v(t,{headers:{Accept:`text/markdown`},schema:E()})}catch(t){throw t instanceof l&&(t.message=`Page not found: ${e}`),t}}function Yt(){let e=w.PRISMIC_DOCS_HOST??t;return new URL(`https://${e}/docs/`)}var Xt=A({name:`prismic docs list`,description:`
4
+ `)}function M(e){let{name:t,description:n,commands:r}=e,i=t.split(` `).length;return async function(){let{positionals:[a]}=He({args:process.argv.slice(1+i),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1}),o=a?e.commands[a]:void 0;if(o){await o.handler();return}if(a)throw new N(`Unknown command: ${a}`);console.info(vt({name:t,description:n,commands:r}))}}function vt(e){let{name:t,description:n,commands:r}=e,i=[n];i.push(``),i.push(`USAGE`),i.push(` ${t} <command> [options]`),i.push(``),i.push(`COMMANDS`);let a=Object.entries(r).map(([e,t])=>[` ${e}`,t.description]);return i.push(v(a)),i.push(``),i.push(`OPTIONS`),i.push(` -h, --help Show help for command`),i.push(``),i.push(`LEARN MORE`),i.push(` Use \`${t} <command> --help\` for more information about a command.`),i.join(`
5
+ `)}var N=class extends Error{name=`CommandError`};const yt=x({path:b(),title:b(),description:Ce(b())}),bt=x({path:b(),title:b(),description:Ce(b()),anchors:be(x({slug:b(),excerpt:b()}))});async function xt(){return await w(new URL(`api/index/`,wt()),{schema:be(yt)})}async function St(e){let t=new URL(`api/index/${e}`,wt());try{return await w(t,{schema:bt})}catch(t){throw t instanceof E&&(t.message=`Documentation page not found: ${e}`),t}}async function Ct(e){let t=new URL(e,wt());try{return await w(t,{headers:{Accept:`text/markdown`},schema:b()})}catch(t){throw t instanceof E&&(t.message=`Page not found: ${e}`),t}}function wt(){let e=ke.PRISMIC_DOCS_HOST??Ae;return new URL(`https://${e}/docs/`)}var Tt=j({name:`prismic docs list`,description:`
12
6
  List available documentation pages.
13
7
 
14
8
  With a path argument, list the anchors within that page.
15
- `,positionals:{path:{description:`Documentation path to list anchors for`,required:!1}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t;if(n){let e;try{e=await qt(n)}catch(e){throw e instanceof _?new M(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.anchors.sort((e,t)=>e.slug.localeCompare(t.slug)),r){console.info(i(e));return}if(e.anchors.length===0){console.info(`(no anchors)`);return}let t=e.anchors.map(e=>[`${n}#${e.slug}`,e.excerpt]);console.info(T(t,{headers:[`PATH`,`EXCERPT`]}))}else{let e;try{e=await Kt()}catch(e){throw e instanceof _?new M(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.sort((e,t)=>e.path.localeCompare(t.path)),r){console.info(i(e));return}if(e.length===0){console.info(`No documentation pages found.`);return}let t=e.map(e=>[e.path,e.title,e.description??``]);console.info(T(t,{headers:[`PATH`,`TITLE`,`DESCRIPTION`]}))}});const Zt=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,Qt=Object.hasOwnProperty;var $t=class{constructor(){this.occurrences,this.reset()}slug(e,t){let n=this,r=en(e,t===!0),i=r;for(;Qt.call(n.occurrences,r);)n.occurrences[i]++,r=i+`-`+n.occurrences[i];return n.occurrences[r]=0,r}reset(){this.occurrences=Object.create(null)}};function en(e,t){return typeof e==`string`?(t||(e=e.toLowerCase()),e.replace(Zt,``).replace(/ /g,`-`)):``}var tn=A({name:`prismic docs view`,description:`
9
+ `,positionals:{path:{description:`Documentation path to list anchors for`,required:!1}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t;if(n){let e;try{e=await St(n)}catch(e){throw e instanceof C?new N(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.anchors.sort((e,t)=>e.slug.localeCompare(t.slug)),r){console.info(T(e));return}if(e.anchors.length===0){console.info(`(no anchors)`);return}let t=e.anchors.map(e=>[`${n}#${e.slug}`,e.excerpt]);console.info(v(t,{headers:[`PATH`,`EXCERPT`]}))}else{let e;try{e=await xt()}catch(e){throw e instanceof C?new N(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.sort((e,t)=>e.path.localeCompare(t.path)),r){console.info(T(e));return}if(e.length===0){console.info(`No documentation pages found.`);return}let t=e.map(e=>[e.path,e.title,e.description??``]);console.info(v(t,{headers:[`PATH`,`TITLE`,`DESCRIPTION`]}))}});const Et=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,Dt=Object.hasOwnProperty;var Ot=class{constructor(){this.occurrences,this.reset()}slug(e,t){let n=this,r=kt(e,t===!0),i=r;for(;Dt.call(n.occurrences,r);)n.occurrences[i]++,r=i+`-`+n.occurrences[i];return n.occurrences[r]=0,r}reset(){this.occurrences=Object.create(null)}};function kt(e,t){return typeof e==`string`?(t||(e=e.toLowerCase()),e.replace(Et,``).replace(/ /g,`-`)):``}var At=j({name:`prismic docs view`,description:`
16
10
  View a documentation page as Markdown.
17
11
 
18
12
  Append #anchor to the path to view only the section under that heading.
19
- `,positionals:{path:{description:`Documentation path, optionally with #anchor (e.g., setup#install)`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,a=n.indexOf(`#`),o=a>=0?n.slice(0,a):n,s=a>=0?n.slice(a+1):void 0,c;try{c=await Jt(o)}catch(e){throw e instanceof _?new M(`Failed to fetch page: ${await e.text()}`):e}if(s){let e=nn(c,s);if(!e)throw new M(`Anchor not found: #${s}`);c=e}if(r){console.info(i({path:o,anchor:s,content:c}));return}console.info(c)});function nn(e,t){let n=e.split(`
20
- `),r=new $t,i,a,o,s;for(let e=0;e<n.length;e++){let c=n[e],l=c.match(/^(?<fence>`{3,}|~{3,})/)?.groups?.fence;if(i){l?.startsWith(i)&&(i=void 0);continue}else if(l){i=l;continue}let u=c.match(/^(?<level>#{1,6})\s+(?<text>.*)/);if(u?.groups?.level&&u?.groups?.text){if(a!==void 0&&s!==void 0&&u.groups.level.length<=s){o=e;break}r.slug(u.groups.text)===t&&(a=e,s=u.groups.level.length)}}if(a!==void 0)return n.slice(a,o).join(`
21
- `).trim()}var rn=j({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:Xt,description:`List available documentation pages`},view:{handler:tn,description:`View a documentation page`}}});const N={"to-slice":{type:`string`,description:`ID of the target slice`},"to-type":{type:`string`,description:`ID of the target content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`}},an={"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:N.variation,repo:N.repo};async function on(e,t,n){let r=await b(),{"from-slice":i,"from-type":a,variation:o=`default`}=t,l=[i,a].filter(Boolean).length;if(l===0)throw new M(`Specify a target with --from-slice or --from-type.`);if(l>1)throw new M(`Only one of --from-slice or --from-type can be specified.`);if(i){let t=await c(i,n),a=t.variations.find(e=>e.id===o);if(!a)throw new M(`Variation "${o}" not found. Available: ${t.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return a.primary??={},F(a.primary,e),[a.primary,async()=>{await ne(t,n);try{await r.updateSlice(t)}catch{await r.createSlice(t)}await r.generateTypes()},`slice`]}let u=await h(a,n),d=e.includes(`.`)?e.split(`.`)[0]:e,f;for(let e in u.json)d in u.json[e]&&(f=u.json[e]);if(!f)throw new M(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(u.json))).join(`, `)||`(none)`}`);return F(f,e),[f,async()=>{await s(u,n);try{await r.updateCustomType(u)}catch{await r.createCustomType(u)}await r.generateTypes()},`customType`]}async function sn(e,t,n,r){let i=await b(),{"from-slice":a,"from-type":o,variation:l=`default`}=n,u=[a,o].filter(Boolean).length;if(u===0)throw new M(`Specify a target with --from-slice or --from-type.`);if(u>1)throw new M(`Only one of --from-slice or --from-type can be specified.`);if(a){let e=await c(a,r),t=e.variations.find(e=>e.id===l);if(!t)throw new M(`Variation "${l}" not found. Available: ${e.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return t.primary??={},[t.primary,t.primary,async()=>{await ne(e,r);try{await i.updateSlice(e)}catch{await i.createSlice(e)}await i.generateTypes()},`slice`]}let d=await h(o,r),f=e.includes(`.`)?e.split(`.`)[0]:e,p=t.includes(`.`)?t.split(`.`)[0]:t,m,g;for(let e in d.json){let t=d.json[e];f in t&&(m=t),p in t&&(g=t)}let ee=Object.keys(Object.assign({},...Object.values(d.json))).join(`, `)||`(none)`;if(!m)throw new M(`Field "${e}" not found. Available: ${ee}`);if(!g)throw new M(`Field "${t}" not found. Available: ${ee}`);return[m,g,async()=>{await s(d,r);try{await i.updateCustomType(d)}catch{await i.createCustomType(d)}await i.generateTypes()},`customType`]}async function P(e,t){let n=await b(),r=e[`to-slice`]??e[`from-slice`],i=e[`to-type`]??e[`from-type`],a=[r,i].filter(Boolean).length;if(a===0)throw new M(`Specify a target with --to-slice or --to-type.`);if(a>1)throw new M(`Only one of --to-slice or --to-type can be specified.`);if(r){if(`tab`in e)throw new M(`--tab is only valid for content types.`);let i=e.variation??`default`,a=await c(r,t),o=structuredClone(a),s=o.variations?.find(e=>e.id===i);if(!s)throw new M(`Variation "${i}" not found. Available: ${a.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return s.primary??={},[s.primary,async()=>{try{await ne(o,t)}catch(e){throw e instanceof _?new M(`Failed to update slice: ${await e.text()}`):e}try{await n.updateSlice(o)}catch{await n.createSlice(o)}await n.generateTypes()},`slice`]}if(`variation`in e)throw new M(`--variation is only valid for slices.`);let o=e.tab??`Main`,l=await h(i,t),u=structuredClone(l),d=u.json[o];if(!d)throw new M(`Tab "${o}" not found. Available: ${Object.keys(l.json).join(`, `)||`(none)`}`);return[d,async()=>{try{await s(u,t)}catch(e){throw e instanceof _?new M(`Failed to update type: ${await e.text()}`):e}try{await n.updateCustomType(u)}catch{await n.createCustomType(u)}await n.generateTypes()},`customType`]}function F(e,t){if(!t.includes(`.`))return[e,t];let n=t.split(`.`),r=n.pop();if(!r)throw Error(`This is a bug. We cannot continue.`);let i=e;for(let e of n){let t=i[e];if(!t)throw new M(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new M(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}const cn=[`Slices`,`UID`,`Choice`];async function ln(e,t,n){return un(e,Object.assign({},...Object.values(t.json)),t.id,n,1)}async function un(e,t,n,r,i){let a=[],o=new Map;for(let r of e){let e=r.indexOf(`.`);if(e===-1)dn(r,t,n),a.push(r);else{let t=r.slice(0,e),n=r.slice(e+1);o.has(t)||o.set(t,[]),o.get(t).push(n)}}for(let[e,s]of o){let o=t[e];if(!o)throw new M(`Field "${e}" not found on type "${n}".`);if(o.type===`Group`){let t=await un(s,o.config?.fields??{},n,r,i);a.push({id:e,fields:t})}else if(o.type===`Link`&&o.config?.select===`document`){if(i<=0)throw new M(`Cannot nest deeper than --field group.cr.group.leaf.`);let t=o.config?.customtypes;if(!t||t.length!==1)throw new M(`Field "${e}" must be restricted to a single custom type to select fields from it.`);let n=typeof t[0]==`string`?t[0]:t[0].id,c=await h(n,r),l=await un(s,Object.assign({},...Object.values(c.json)),n,r,i-1);a.push({id:e,customtypes:[{id:n,fields:l}]})}else throw new M(`Field "${e}" is not a group or content relationship field.`)}return a}function dn(e,t,n){if(!(e in t))throw new M(`Field "${e}" not found on type "${n}".`);if(cn.includes(t[e].type)||e===`uid`)throw new M(`Field "${e}" cannot be fetched from a content relationship.`);if(t[e].type===`Group`)throw new M(`Field "${e}" is a group. Select specific sub-fields with --field ${e}.<sub-field>.`)}var fn=A({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},"default-value":{type:`boolean`,description:`Default value`},"true-label":{type:`string`,description:`Label for true value`},"false-label":{type:`string`,description:`Label for false value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,"default-value":i,"true-label":a,"false-label":o,repo:s=await y()}=t,[c,l]=await P(t,{repo:s,token:await O(),host:await k()}),[u,d]=F(c,n),f={type:`Boolean`,config:{label:r??S(d),default_value:i,placeholder_true:a,placeholder_false:o}};if(d in u)throw new M(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),pn=A({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await y()}=t,[o,s]=await P(t,{repo:a,token:await O(),host:await k()}),[c,l]=F(o,n),u={type:`Color`,config:{label:r??S(l),placeholder:i}};if(l in c)throw new M(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),mn=A({name:`prismic field add content-relationship`,description:`
13
+ `,positionals:{path:{description:`Documentation path, optionally with #anchor (e.g., setup#install)`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,i=n.indexOf(`#`),a=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1):void 0,s;try{s=await Ct(a)}catch(e){throw e instanceof C?new N(`Failed to fetch page: ${await e.text()}`):e}if(o){let e=jt(s,o);if(!e)throw new N(`Anchor not found: #${o}`);s=e}if(r){console.info(T({path:a,anchor:o,content:s}));return}console.info(s)});function jt(e,t){let n=e.split(`
14
+ `),r=new Ot,i,a,o,s;for(let e=0;e<n.length;e++){let c=n[e],l=c.match(/^(?<fence>`{3,}|~{3,})/)?.groups?.fence;if(i){l?.startsWith(i)&&(i=void 0);continue}else if(l){i=l;continue}let u=c.match(/^(?<level>#{1,6})\s+(?<text>.*)/);if(u?.groups?.level&&u?.groups?.text){if(a!==void 0&&s!==void 0&&u.groups.level.length<=s){o=e;break}r.slug(u.groups.text)===t&&(a=e,s=u.groups.level.length)}}if(a!==void 0)return n.slice(a,o).join(`
15
+ `).trim()}var Mt=M({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:Tt,description:`List available documentation pages`},view:{handler:At,description:`View a documentation page`}}});const P={"to-slice":{type:`string`,description:`ID of the target slice`},"to-type":{type:`string`,description:`ID of the target content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`}},Nt={"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:P.variation,repo:P.repo};async function Pt(e,t,n){let r=await h(),{"from-slice":a,"from-type":o,variation:l=`default`}=t,u=[a,o].filter(Boolean).length;if(u===0)throw new N(`Specify a target with --from-slice or --from-type.`);if(u>1)throw new N(`Only one of --from-slice or --from-type can be specified.`);if(a){let t=await i(a,n),o=t.variations.find(e=>e.id===l);if(!o)throw new N(`Variation "${l}" not found. Available: ${t.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return o.primary??={},I(o.primary,e),[o.primary,async()=>{await c(t,n);try{await r.updateSlice(t)}catch{await r.createSlice(t)}await r.generateTypes()},`slice`]}let d=await y(o,n),f=e.includes(`.`)?e.split(`.`)[0]:e,p;for(let e in d.json)f in d.json[e]&&(p=d.json[e]);if(!p)throw new N(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(d.json))).join(`, `)||`(none)`}`);return I(p,e),[p,async()=>{await s(d,n);try{await r.updateCustomType(d)}catch{await r.createCustomType(d)}await r.generateTypes()},`customType`]}async function Ft(e,t,n,r){let a=await h(),{"from-slice":o,"from-type":l,variation:u=`default`}=n,d=[o,l].filter(Boolean).length;if(d===0)throw new N(`Specify a target with --from-slice or --from-type.`);if(d>1)throw new N(`Only one of --from-slice or --from-type can be specified.`);if(o){let e=await i(o,r),t=e.variations.find(e=>e.id===u);if(!t)throw new N(`Variation "${u}" not found. Available: ${e.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return t.primary??={},[t.primary,t.primary,async()=>{await c(e,r);try{await a.updateSlice(e)}catch{await a.createSlice(e)}await a.generateTypes()},`slice`]}let f=await y(l,r),p=e.includes(`.`)?e.split(`.`)[0]:e,m=t.includes(`.`)?t.split(`.`)[0]:t,g,_;for(let e in f.json){let t=f.json[e];p in t&&(g=t),m in t&&(_=t)}let ee=Object.keys(Object.assign({},...Object.values(f.json))).join(`, `)||`(none)`;if(!g)throw new N(`Field "${e}" not found. Available: ${ee}`);if(!_)throw new N(`Field "${t}" not found. Available: ${ee}`);return[g,_,async()=>{await s(f,r);try{await a.updateCustomType(f)}catch{await a.createCustomType(f)}await a.generateTypes()},`customType`]}async function F(e,t){let n=await h(),r=e[`to-slice`]??e[`from-slice`],a=e[`to-type`]??e[`from-type`],o=[r,a].filter(Boolean).length;if(o===0)throw new N(`Specify a target with --to-slice or --to-type.`);if(o>1)throw new N(`Only one of --to-slice or --to-type can be specified.`);if(r){if(`tab`in e)throw new N(`--tab is only valid for content types.`);let a=e.variation??`default`,o=await i(r,t),s=structuredClone(o),l=s.variations?.find(e=>e.id===a);if(!l)throw new N(`Variation "${a}" not found. Available: ${o.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return l.primary??={},[l.primary,async()=>{try{await c(s,t)}catch(e){throw e instanceof C?new N(`Failed to update slice: ${await e.text()}`):e}try{await n.updateSlice(s)}catch{await n.createSlice(s)}await n.generateTypes()},`slice`]}if(`variation`in e)throw new N(`--variation is only valid for slices.`);let l=e.tab??`Main`,u=await y(a,t),d=structuredClone(u),f=d.json[l];if(!f)throw new N(`Tab "${l}" not found. Available: ${Object.keys(u.json).join(`, `)||`(none)`}`);return[f,async()=>{try{await s(d,t)}catch(e){throw e instanceof C?new N(`Failed to update type: ${await e.text()}`):e}try{await n.updateCustomType(d)}catch{await n.createCustomType(d)}await n.generateTypes()},`customType`]}function I(e,t){if(!t.includes(`.`))return[e,t];let n=t.split(`.`),r=n.pop();if(!r)throw Error(`This is a bug. We cannot continue.`);let i=e;for(let e of n){let t=i[e];if(!t)throw new N(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new N(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}const It=[`Slices`,`UID`,`Choice`];async function Lt(e,t,n){return Rt(e,Object.assign({},...Object.values(t.json)),t.id,n,1)}async function Rt(e,t,n,r,i){let a=[],o=new Map;for(let r of e){let e=r.indexOf(`.`);if(e===-1)zt(r,t,n),a.push(r);else{let t=r.slice(0,e),n=r.slice(e+1);o.has(t)||o.set(t,[]),o.get(t).push(n)}}for(let[e,s]of o){let o=t[e];if(!o)throw new N(`Field "${e}" not found on type "${n}".`);if(o.type===`Group`){let t=await Rt(s,o.config?.fields??{},n,r,i);a.push({id:e,fields:t})}else if(o.type===`Link`&&o.config?.select===`document`){if(i<=0)throw new N(`Cannot nest deeper than --field group.cr.group.leaf.`);let t=o.config?.customtypes;if(!t||t.length!==1)throw new N(`Field "${e}" must be restricted to a single custom type to select fields from it.`);let n=typeof t[0]==`string`?t[0]:t[0].id,c=await y(n,r),l=await Rt(s,Object.assign({},...Object.values(c.json)),n,r,i-1);a.push({id:e,customtypes:[{id:n,fields:l}]})}else throw new N(`Field "${e}" is not a group or content relationship field.`)}return a}function zt(e,t,n){if(!(e in t))throw new N(`Field "${e}" not found on type "${n}".`);if(It.includes(t[e].type)||e===`uid`)throw new N(`Field "${e}" cannot be fetched from a content relationship.`);if(t[e].type===`Group`)throw new N(`Field "${e}" is a group. Select specific sub-fields with --field ${e}.<sub-field>.`)}var Bt=j({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},"default-value":{type:`boolean`,description:`Default value`},"true-label":{type:`string`,description:`Label for true value`},"false-label":{type:`string`,description:`Label for false value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,"default-value":i,"true-label":a,"false-label":s,repo:c=await m()}=t,[l,u]=await F(t,{repo:c,token:await D(),host:await O()}),[d,f]=I(l,n),p={type:`Boolean`,config:{label:r??o(f),default_value:i,placeholder_true:a,placeholder_false:s}};if(f in d)throw new N(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),Vt=j({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await m()}=t,[s,c]=await F(t,{repo:a,token:await D(),host:await O()}),[l,u]=I(s,n),d={type:`Color`,config:{label:r??o(u),placeholder:i}};if(u in l)throw new N(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Ht=j({name:`prismic field add content-relationship`,description:`
22
16
  Add a content relationship field to a slice or custom type.
23
17
 
24
18
  Content relationships fetch and display data from related documents
@@ -29,61 +23,61 @@ import{$ as e,A as t,B as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K a
29
23
  Use --custom-type and --tag to restrict which documents can be
30
24
  selected. These filters define exactly which documents are queryable
31
25
  through this field. If neither is specified, all documents are allowed.
32
- `,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Restrict to documents with this tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Restrict to documents of this type (can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (can be repeated, requires one --custom-type)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,field:o,repo:s=await y()}=t;if(o&&(!a||a.length!==1))throw new M(`--field requires exactly one --custom-type.`);let c=await O(),l=await k(),[u,d]=await P(t,{repo:s,token:c,host:l}),[f,p]=F(u,n),m=a;if(o&&a){let e=await ln(o,await h(a[0],{repo:s,token:c,host:l}),{repo:s,token:c,host:l});m=[{id:a[0],fields:e}]}let g={type:`Link`,config:{label:r??S(p),select:`document`,tags:i,customtypes:m}};if(p in f)throw new M(`Field "${n}" already exists.`);f[p]=g,await d(),console.info(`Field added: ${n}`)}),hn=A({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},default:{type:`string`,description:`Default value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,default:a,repo:o=await y()}=t,[s,c]=await P(t,{repo:o,token:await O(),host:await k()}),[l,u]=F(s,n),d={type:`Date`,config:{label:r??S(u),placeholder:i,default:a}};if(u in l)throw new M(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),gn=A({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await y()}=t,[o,s]=await P(t,{repo:a,token:await O(),host:await k()}),[c,l]=F(o,n),u={type:`Embed`,config:{label:r??S(l),placeholder:i}};if(l in c)throw new M(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),_n=A({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await y()}=t,[a,o]=await P(t,{repo:i,token:await O(),host:await k()}),[s,c]=F(a,n),l={type:`GeoPoint`,config:{label:r??S(c)}};if(c in s)throw new M(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),vn=A({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await y()}=t,[a,o]=await P(t,{repo:i,token:await O(),host:await k()}),[s,c]=F(a,n),l={type:`Group`,config:{label:r??S(c)}};if(c in s)throw new M(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),yn=A({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await y()}=t,[o,s]=await P(t,{repo:a,token:await O(),host:await k()}),[c,l]=F(o,n),u={type:`Image`,config:{label:r??S(l),placeholder:i}};if(l in c)throw new M(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),bn=A({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},catalog:{type:`string`,description:`Integration catalog ID`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,catalog:a,repo:o=await y()}=t,[s,c]=await P(t,{repo:o,token:await O(),host:await k()}),[l,u]=F(s,n),d={type:`IntegrationFields`,config:{label:r??S(u),placeholder:i,catalog:a}};if(u in l)throw new M(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),xn=A({name:`prismic field add link`,description:`Add a link field to a slice or custom type. Use for navigational links to URLs, documents, or media. For data-level relations between documents, use content-relationship instead.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},allow:{type:`string`,description:`Restrict to a link type: document, media, or web`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab`},"allow-text":{type:`boolean`,description:`Allow custom link text`},repeatable:{type:`boolean`,description:`Allow multiple links`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,r=[`document`,`media`,`web`],{label:i,allow:a,"allow-target-blank":o,"allow-text":s,repeatable:c,variant:l,repo:u=await y()}=t;if(a&&!r.includes(a))throw new M(`--allow must be one of: ${r.join(`, `)}`);let d=a,[f,p]=await P(t,{repo:u,token:await O(),host:await k()}),[m,h]=F(f,n),g={type:`Link`,config:{label:i??S(h),select:d,allowTargetBlank:o,allowText:s,repeat:c,variants:l}};if(h in m)throw new M(`Field "${n}" already exists.`);m[h]=g,await p(),console.info(`Field added: ${n}`)}),Sn=A({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},min:{type:`string`,description:`Minimum value`},max:{type:`string`,description:`Maximum value`},step:{type:`string`,description:`Step increment`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await y()}=t,o=Cn(t.min,`min`),s=Cn(t.max,`max`),c=Cn(t.step,`step`),[l,u]=await P(t,{repo:a,token:await O(),host:await k()}),[d,f]=F(l,n),p={type:`Number`,config:{label:r??S(f),placeholder:i,min:o,max:s,step:c}};if(f in d)throw new M(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)});function Cn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new M(`--${t} must be a valid number, got "${e}"`);return n}var wn=A({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
26
+ `,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Restrict to documents with this tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Restrict to documents of this type (can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (can be repeated, requires one --custom-type)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,field:s,repo:c=await m()}=t;if(s&&(!a||a.length!==1))throw new N(`--field requires exactly one --custom-type.`);let l=await D(),u=await O(),[d,f]=await F(t,{repo:c,token:l,host:u}),[p,h]=I(d,n),g=a;if(s&&a){let e=await Lt(s,await y(a[0],{repo:c,token:l,host:u}),{repo:c,token:l,host:u});g=[{id:a[0],fields:e}]}let _={type:`Link`,config:{label:r??o(h),select:`document`,tags:i,customtypes:g}};if(h in p)throw new N(`Field "${n}" already exists.`);p[h]=_,await f(),console.info(`Field added: ${n}`)}),Ut=j({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},default:{type:`string`,description:`Default value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,default:a,repo:s=await m()}=t,[c,l]=await F(t,{repo:s,token:await D(),host:await O()}),[u,d]=I(c,n),f={type:`Date`,config:{label:r??o(d),placeholder:i,default:a}};if(d in u)throw new N(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),Wt=j({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await m()}=t,[s,c]=await F(t,{repo:a,token:await D(),host:await O()}),[l,u]=I(s,n),d={type:`Embed`,config:{label:r??o(u),placeholder:i}};if(u in l)throw new N(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Gt=j({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await m()}=t,[a,s]=await F(t,{repo:i,token:await D(),host:await O()}),[c,l]=I(a,n),u={type:`GeoPoint`,config:{label:r??o(l)}};if(l in c)throw new N(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),Kt=j({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await m()}=t,[a,s]=await F(t,{repo:i,token:await D(),host:await O()}),[c,l]=I(a,n),u={type:`Group`,config:{label:r??o(l)}};if(l in c)throw new N(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),qt=j({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await m()}=t,[s,c]=await F(t,{repo:a,token:await D(),host:await O()}),[l,u]=I(s,n),d={type:`Image`,config:{label:r??o(u),placeholder:i}};if(u in l)throw new N(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Jt=j({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},catalog:{type:`string`,description:`Integration catalog ID`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,catalog:a,repo:s=await m()}=t,[c,l]=await F(t,{repo:s,token:await D(),host:await O()}),[u,d]=I(c,n),f={type:`IntegrationFields`,config:{label:r??o(d),placeholder:i,catalog:a}};if(d in u)throw new N(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),Yt=j({name:`prismic field add link`,description:`Add a link field to a slice or custom type. Use for navigational links to URLs, documents, or media. For data-level relations between documents, use content-relationship instead.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},allow:{type:`string`,description:`Restrict to a link type: document, media, or web`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab`},"allow-text":{type:`boolean`,description:`Allow custom link text`},repeatable:{type:`boolean`,description:`Allow multiple links`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,r=[`document`,`media`,`web`],{label:i,allow:a,"allow-target-blank":s,"allow-text":c,repeatable:l,variant:u,repo:d=await m()}=t;if(a&&!r.includes(a))throw new N(`--allow must be one of: ${r.join(`, `)}`);let f=a,[p,h]=await F(t,{repo:d,token:await D(),host:await O()}),[g,_]=I(p,n),ee={type:`Link`,config:{label:i??o(_),select:f,allowTargetBlank:s,allowText:c,repeat:l,variants:u}};if(_ in g)throw new N(`Field "${n}" already exists.`);g[_]=ee,await h(),console.info(`Field added: ${n}`)}),Xt=j({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},min:{type:`string`,description:`Minimum value`},max:{type:`string`,description:`Maximum value`},step:{type:`string`,description:`Step increment`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await m()}=t,s=Zt(t.min,`min`),c=Zt(t.max,`max`),l=Zt(t.step,`step`),[u,d]=await F(t,{repo:a,token:await D(),host:await O()}),[f,p]=I(u,n),h={type:`Number`,config:{label:r??o(p),placeholder:i,min:s,max:c,step:l}};if(p in f)throw new N(`Field "${n}" already exists.`);f[p]=h,await d(),console.info(`Field added: ${n}`)});function Zt(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new N(`--${t} must be a valid number, got "${e}"`);return n}var Qt=j({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
33
27
  heading1, heading2, heading3, heading4, heading5, heading6,
34
28
  paragraph, strong, em, preformatted, hyperlink, image, embed,
35
29
  list-item, o-list-item, rtl
36
- `},positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},allow:{type:`string`,description:`Comma-separated allowed block types (e.g. heading1,heading2,paragraph)`},single:{type:`boolean`,description:`Restrict to a single block`},"allow-target-blank":{type:`boolean`,description:`Allow opening links in new tab`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,allow:a=`paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl`,single:o,"allow-target-blank":s,repo:c=await y()}=t,[l,u]=await P(t,{repo:c,token:await O(),host:await k()}),[d,f]=F(l,n),p={type:`StructuredText`,config:{label:r??S(f),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:s}};if(f in d)throw new M(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),Tn=A({name:`prismic field add select`,description:`Add a select field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default selected value`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,"default-value":a,option:o,repo:s=await y()}=t,[c,l]=await P(t,{repo:s,token:await O(),host:await k()}),[u,d]=F(c,n),f={type:`Select`,config:{label:r??S(d),placeholder:i,default_value:a,options:o}};if(d in u)throw new M(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),En=A({name:`prismic field add table`,description:`Add a table field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await y()}=t,[a,o]=await P(t,{repo:i,token:await O(),host:await k()}),[s,c]=F(a,n),l={type:`Table`,config:{label:r??S(c)}};if(c in s)throw new M(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),Dn=A({name:`prismic field add text`,description:`Add a text field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await y()}=t,[o,s]=await P(t,{repo:a,token:await O(),host:await k()}),[c,l]=F(o,n),u={type:`Text`,config:{label:r??S(l),placeholder:i}};if(l in c)throw new M(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),On=A({name:`prismic field add timestamp`,description:`Add a timestamp field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...N,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},default:{type:`string`,description:`Default value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,default:a,repo:o=await y()}=t,[s,c]=await P(t,{repo:o,token:await O(),host:await k()}),[l,u]=F(s,n),d={type:`Timestamp`,config:{label:r??S(u),placeholder:i,default:a}};if(u in l)throw new M(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),kn=A({name:`prismic field add uid`,description:`Add a UID field to a content type.`,options:{"to-type":{type:`string`,description:`Name of the target content type`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`},label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({values:e})=>{let{label:t=`UID`,placeholder:n,repo:r=await y()}=e,[i,a]=await P(e,{repo:r,token:await O(),host:await k()}),o={type:`UID`,config:{label:t,placeholder:n}};if(`uid`in i)throw new M(`Field "uid" already exists.`);i.uid=o,await a(),console.info(`Field added: uid`)}),An=j({name:`prismic field add`,description:`Add a field to a slice or custom type.`,commands:{boolean:{handler:fn,description:`Add a boolean field`},color:{handler:pn,description:`Add a color field`},"content-relationship":{handler:mn,description:`Add a content relationship field for fetching data from related documents (not for navigation -- use link)`},date:{handler:hn,description:`Add a date field`},embed:{handler:gn,description:`Add an embed field`},geopoint:{handler:_n,description:`Add a geopoint field`},group:{handler:vn,description:`Add a group field`},image:{handler:yn,description:`Add an image field`},integration:{handler:bn,description:`Add an integration field`},link:{handler:xn,description:`Add a link field for URLs, documents, or media (navigational)`},number:{handler:Sn,description:`Add a number field`},"rich-text":{handler:wn,description:`Add a rich text field`},select:{handler:Tn,description:`Add a select field`},table:{handler:En,description:`Add a table field`},text:{handler:Dn,description:`Add a text field`},timestamp:{handler:On,description:`Add a timestamp field`},uid:{handler:kn,description:`Add a UID field`}}}),jn=A({name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
30
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},allow:{type:`string`,description:`Comma-separated allowed block types (e.g. heading1,heading2,paragraph)`},single:{type:`boolean`,description:`Restrict to a single block`},"allow-target-blank":{type:`boolean`,description:`Allow opening links in new tab`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,allow:a=`paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl`,single:s,"allow-target-blank":c,repo:l=await m()}=t,[u,d]=await F(t,{repo:l,token:await D(),host:await O()}),[f,p]=I(u,n),h={type:`StructuredText`,config:{label:r??o(p),placeholder:i,...s?{single:a}:{multi:a},allowTargetBlank:c}};if(p in f)throw new N(`Field "${n}" already exists.`);f[p]=h,await d(),console.info(`Field added: ${n}`)}),$t=j({name:`prismic field add select`,description:`Add a select field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default selected value`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,"default-value":a,option:s,repo:c=await m()}=t,[l,u]=await F(t,{repo:c,token:await D(),host:await O()}),[d,f]=I(l,n),p={type:`Select`,config:{label:r??o(f),placeholder:i,default_value:a,options:s}};if(f in d)throw new N(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),en=j({name:`prismic field add table`,description:`Add a table field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await m()}=t,[a,s]=await F(t,{repo:i,token:await D(),host:await O()}),[c,l]=I(a,n),u={type:`Table`,config:{label:r??o(l)}};if(l in c)throw new N(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),tn=j({name:`prismic field add text`,description:`Add a text field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await m()}=t,[s,c]=await F(t,{repo:a,token:await D(),host:await O()}),[l,u]=I(s,n),d={type:`Text`,config:{label:r??o(u),placeholder:i}};if(u in l)throw new N(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),nn=j({name:`prismic field add timestamp`,description:`Add a timestamp field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...P,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},default:{type:`string`,description:`Default value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,default:a,repo:s=await m()}=t,[c,l]=await F(t,{repo:s,token:await D(),host:await O()}),[u,d]=I(c,n),f={type:`Timestamp`,config:{label:r??o(d),placeholder:i,default:a}};if(d in u)throw new N(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),rn=j({name:`prismic field add uid`,description:`Add a UID field to a content type.`,options:{"to-type":{type:`string`,description:`Name of the target content type`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`},label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({values:e})=>{let{label:t=`UID`,placeholder:n,repo:r=await m()}=e,[i,a]=await F(e,{repo:r,token:await D(),host:await O()}),o={type:`UID`,config:{label:t,placeholder:n}};if(`uid`in i)throw new N(`Field "uid" already exists.`);i.uid=o,await a(),console.info(`Field added: uid`)}),an=M({name:`prismic field add`,description:`Add a field to a slice or custom type.`,commands:{boolean:{handler:Bt,description:`Add a boolean field`},color:{handler:Vt,description:`Add a color field`},"content-relationship":{handler:Ht,description:`Add a content relationship field for fetching data from related documents (not for navigation -- use link)`},date:{handler:Ut,description:`Add a date field`},embed:{handler:Wt,description:`Add an embed field`},geopoint:{handler:Gt,description:`Add a geopoint field`},group:{handler:Kt,description:`Add a group field`},image:{handler:qt,description:`Add an image field`},integration:{handler:Jt,description:`Add an integration field`},link:{handler:Yt,description:`Add a link field for URLs, documents, or media (navigational)`},number:{handler:Xt,description:`Add a number field`},"rich-text":{handler:Qt,description:`Add a rich text field`},select:{handler:$t,description:`Add a select field`},table:{handler:en,description:`Add a table field`},text:{handler:tn,description:`Add a text field`},timestamp:{handler:nn,description:`Add a timestamp field`},uid:{handler:rn,description:`Add a UID field`}}}),on=j({name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
37
31
  Options vary by field type. Only options matching the field's
38
32
  type will be applied. See \`prismic field add <type> --help\`
39
33
  for type-specific option details.
40
- `},positionals:{id:{description:`Field ID`,required:!0}},options:{...an,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default value (boolean: true/false, select: option value)`},"true-label":{type:`string`,description:`Label for true value (boolean)`},"false-label":{type:`string`,description:`Label for false value (boolean)`},default:{type:`string`,description:`Default value (date/timestamp)`},min:{type:`string`,description:`Minimum value (number)`},max:{type:`string`,description:`Maximum value (number)`},step:{type:`string`,description:`Step increment (number)`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab (link/rich-text)`},"allow-text":{type:`boolean`,description:`Allow custom link text (link)`},repeatable:{type:`boolean`,description:`Allow multiple links (link)`},variant:{type:`string`,multiple:!0,description:`Allowed variant (link/link-to-media, can be repeated)`},tag:{type:`string`,multiple:!0,description:`Allowed tag (content-relationship, can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (content-relationship, can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (content-relationship, can be repeated)`},allow:{type:`string`,description:`Comma-separated allowed block types (rich-text)`},single:{type:`boolean`,description:`Restrict to a single block (rich-text)`},catalog:{type:`string`,description:`Integration catalog ID (integration)`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),[o,s]=await on(n,t,{repo:r,token:i,host:a}),[c,l]=F(o,n),u=c[l];if(!u)throw new M(`Field "${n}" does not exist.`);switch(u.config??={},`label`in t&&(u.config.label=t.label),`placeholder`in t&&(u.config.placeholder=t.placeholder),u.type){case`Boolean`:if(`default-value`in t){let e=t[`default-value`];if(e!==`true`&&e!==`false`)throw new M(`--default-value for boolean fields must be "true" or "false"`);u.config.default_value=e===`true`}`true-label`in t&&(u.config.placeholder_true=t[`true-label`]),`false-label`in t&&(u.config.placeholder_false=t[`false-label`]);break;case`Number`:`min`in t&&(u.config.min=Mn(t.min,`min`)),`max`in t&&(u.config.max=Mn(t.max,`max`)),`step`in t&&(u.config.step=Mn(t.step,`step`));break;case`Select`:`default-value`in t&&(u.config.default_value=t[`default-value`]),`option`in t&&(u.config.options=t.option);break;case`Date`:case`Timestamp`:`default`in t&&(u.config.default=t.default);break;case`IntegrationFields`:`catalog`in t&&(u.config.catalog=t.catalog);break;case`StructuredText`:if(`allow-target-blank`in t&&(u.config.allowTargetBlank=t[`allow-target-blank`]),`single`in t){let e=`allow`in t?t.allow:u.config.multi??u.config.single;delete u.config.multi,u.config.single=e}else `allow`in t&&(`single`in u.config?u.config.single=t.allow:u.config.multi=t.allow);break;case`Link`:if(`allow-target-blank`in t&&(u.config.allowTargetBlank=t[`allow-target-blank`]),`allow-text`in t&&(u.config.allowText=t[`allow-text`]),`repeatable`in t&&(u.config.repeat=t.repeatable),`variant`in t&&(u.config.variants=t.variant),`tag`in t&&(u.config.tags=t.tag),`field`in t){let e=`custom-type`in t?t[`custom-type`]:u.config.customtypes;if(!e||e.length===0)throw new M(`--field requires the field to be restricted to a custom type. Use --custom-type to specify one.`);if(e.length>1)throw new M(`--field requires the field to be restricted to a single custom type.`);let n=typeof e[0]==`string`?e[0]:e[0].id,o=await h(n,{repo:r,token:i,host:a}),s=await ln(t.field,o,{repo:r,token:i,host:a});u.config.customtypes=[{id:n,fields:s}]}else `custom-type`in t&&(u.config.customtypes=t[`custom-type`]);break}await s(),console.info(`Field updated: ${n}`)});function Mn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new M(`--${t} must be a valid number, got "${e}"`);return n}var Nn=A({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:an},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,[i,a]=await on(n,t,{repo:r,token:await O(),host:await k()}),[o,s]=F(i,n);if(!(s in o))throw new M(`Field "${n}" does not exist.`);delete o[s],await a(),console.info(`Field removed: ${n}`)}),Pn=A({name:`prismic field reorder`,description:`Reorder a field in a slice or custom type.`,positionals:{id:{description:`Field ID to move`,required:!0}},options:{before:{type:`string`,description:`Place field before this field ID`},after:{type:`string`,description:`Place field after this field ID`},"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{before:r,after:i,repo:a=await y()}=t;if(!r&&!i)throw new M(`Specify --before or --after.`);if(r&&i)throw new M(`Only one of --before or --after can be specified.`);let o=r??i,s=r?`before`:`after`;if(n===o)throw new M(`Cannot reorder "${n}" relative to itself.`);let c=n.lastIndexOf(`.`),l=o.lastIndexOf(`.`);if((c===-1?``:n.slice(0,c))!==(l===-1?``:o.slice(0,l)))throw new M(`Cannot reorder "${n}" relative to "${o}": fields must be in the same container.`);let[u,d,f]=await sn(n,o,t,{repo:a,token:await O(),host:await k()}),[p,m]=F(u,n),[h,g]=F(d,o);if(!(m in p))throw new M(`Field "${n}" does not exist.`);if(!(g in h))throw new M(`Field "${o}" does not exist.`);let ee=p[m];delete p[m];let te=Object.entries(h);for(let e of Object.keys(h))delete h[e];for(let[e,t]of te)s===`before`&&e===g&&(h[m]=ee),h[e]=t,s===`after`&&e===g&&(h[m]=ee);await f(),console.info(`Field reordered: ${n}`)}),Fn=A({name:`prismic field view`,description:`View details of a field in a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...an,json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,[a]=await on(n,t,{repo:r,token:await O(),host:await k()}),[o,s]=F(a,n),c=o[s];if(!c)throw new M(`Field "${n}" does not exist.`);if(t.json){console.info(i({id:s,...c}));return}if(console.info(`Type: ${c.type}`),c.config){for(let[e,t]of Object.entries(c.config))if(t!==void 0)if(e===`fields`&&typeof t==`object`&&t){let e=Object.keys(t).join(`, `)||`(none)`;console.info(`Fields: ${e}`)}else Array.isArray(t)?console.info(`${S(e)}: ${t.join(`, `)}`):console.info(`${S(e)}: ${t}`)}}),In=j({name:`prismic field`,description:`Manage fields in slices and content types.`,commands:{add:{handler:An,description:`Add a field`},edit:{handler:jn,description:`Edit a field`},remove:{handler:Nn,description:`Remove a field`},reorder:{handler:Pn,description:`Reorder a field`},view:{handler:Fn,description:`View details of a field`}}}),Ln=A({name:`prismic gen setup`,description:`
34
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...Nt,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default value (boolean: true/false, select: option value)`},"true-label":{type:`string`,description:`Label for true value (boolean)`},"false-label":{type:`string`,description:`Label for false value (boolean)`},default:{type:`string`,description:`Default value (date/timestamp)`},min:{type:`string`,description:`Minimum value (number)`},max:{type:`string`,description:`Maximum value (number)`},step:{type:`string`,description:`Step increment (number)`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab (link/rich-text)`},"allow-text":{type:`boolean`,description:`Allow custom link text (link)`},repeatable:{type:`boolean`,description:`Allow multiple links (link)`},variant:{type:`string`,multiple:!0,description:`Allowed variant (link/link-to-media, can be repeated)`},tag:{type:`string`,multiple:!0,description:`Allowed tag (content-relationship, can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (content-relationship, can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (content-relationship, can be repeated)`},allow:{type:`string`,description:`Comma-separated allowed block types (rich-text)`},single:{type:`boolean`,description:`Restrict to a single block (rich-text)`},catalog:{type:`string`,description:`Integration catalog ID (integration)`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),[o,s]=await Pt(n,t,{repo:r,token:i,host:a}),[c,l]=I(o,n),u=c[l];if(!u)throw new N(`Field "${n}" does not exist.`);switch(u.config??={},`label`in t&&(u.config.label=t.label),`placeholder`in t&&(u.config.placeholder=t.placeholder),u.type){case`Boolean`:if(`default-value`in t){let e=t[`default-value`];if(e!==`true`&&e!==`false`)throw new N(`--default-value for boolean fields must be "true" or "false"`);u.config.default_value=e===`true`}`true-label`in t&&(u.config.placeholder_true=t[`true-label`]),`false-label`in t&&(u.config.placeholder_false=t[`false-label`]);break;case`Number`:`min`in t&&(u.config.min=sn(t.min,`min`)),`max`in t&&(u.config.max=sn(t.max,`max`)),`step`in t&&(u.config.step=sn(t.step,`step`));break;case`Select`:`default-value`in t&&(u.config.default_value=t[`default-value`]),`option`in t&&(u.config.options=t.option);break;case`Date`:case`Timestamp`:`default`in t&&(u.config.default=t.default);break;case`IntegrationFields`:`catalog`in t&&(u.config.catalog=t.catalog);break;case`StructuredText`:if(`allow-target-blank`in t&&(u.config.allowTargetBlank=t[`allow-target-blank`]),`single`in t){let e=`allow`in t?t.allow:u.config.multi??u.config.single;delete u.config.multi,u.config.single=e}else `allow`in t&&(`single`in u.config?u.config.single=t.allow:u.config.multi=t.allow);break;case`Link`:if(`allow-target-blank`in t&&(u.config.allowTargetBlank=t[`allow-target-blank`]),`allow-text`in t&&(u.config.allowText=t[`allow-text`]),`repeatable`in t&&(u.config.repeat=t.repeatable),`variant`in t&&(u.config.variants=t.variant),`tag`in t&&(u.config.tags=t.tag),`field`in t){let e=`custom-type`in t?t[`custom-type`]:u.config.customtypes;if(!e||e.length===0)throw new N(`--field requires the field to be restricted to a custom type. Use --custom-type to specify one.`);if(e.length>1)throw new N(`--field requires the field to be restricted to a single custom type.`);let n=typeof e[0]==`string`?e[0]:e[0].id,o=await y(n,{repo:r,token:i,host:a}),s=await Lt(t.field,o,{repo:r,token:i,host:a});u.config.customtypes=[{id:n,fields:s}]}else `custom-type`in t&&(u.config.customtypes=t[`custom-type`]);break}await s(),console.info(`Field updated: ${n}`)});function sn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new N(`--${t} must be a valid number, got "${e}"`);return n}var cn=j({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Nt},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,[i,a]=await Pt(n,t,{repo:r,token:await D(),host:await O()}),[o,s]=I(i,n);if(!(s in o))throw new N(`Field "${n}" does not exist.`);delete o[s],await a(),console.info(`Field removed: ${n}`)}),ln=j({name:`prismic field reorder`,description:`Reorder a field in a slice or custom type.`,positionals:{id:{description:`Field ID to move`,required:!0}},options:{before:{type:`string`,description:`Place field before this field ID`},after:{type:`string`,description:`Place field after this field ID`},"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{before:r,after:i,repo:a=await m()}=t;if(!r&&!i)throw new N(`Specify --before or --after.`);if(r&&i)throw new N(`Only one of --before or --after can be specified.`);let o=r??i,s=r?`before`:`after`;if(n===o)throw new N(`Cannot reorder "${n}" relative to itself.`);let c=n.lastIndexOf(`.`),l=o.lastIndexOf(`.`);if((c===-1?``:n.slice(0,c))!==(l===-1?``:o.slice(0,l)))throw new N(`Cannot reorder "${n}" relative to "${o}": fields must be in the same container.`);let[u,d,f]=await Ft(n,o,t,{repo:a,token:await D(),host:await O()}),[p,h]=I(u,n),[g,_]=I(d,o);if(!(h in p))throw new N(`Field "${n}" does not exist.`);if(!(_ in g))throw new N(`Field "${o}" does not exist.`);let ee=p[h];delete p[h];let te=Object.entries(g);for(let e of Object.keys(g))delete g[e];for(let[e,t]of te)s===`before`&&e===_&&(g[h]=ee),g[e]=t,s===`after`&&e===_&&(g[h]=ee);await f(),console.info(`Field reordered: ${n}`)}),un=j({name:`prismic field view`,description:`View details of a field in a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...Nt,json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,[i]=await Pt(n,t,{repo:r,token:await D(),host:await O()}),[a,s]=I(i,n),c=a[s];if(!c)throw new N(`Field "${n}" does not exist.`);if(t.json){console.info(T({id:s,...c}));return}if(console.info(`Type: ${c.type}`),c.config){for(let[e,t]of Object.entries(c.config))if(t!==void 0)if(e===`fields`&&typeof t==`object`&&t){let e=Object.keys(t).join(`, `)||`(none)`;console.info(`Fields: ${e}`)}else Array.isArray(t)?console.info(`${o(e)}: ${t.join(`, `)}`):console.info(`${o(e)}: ${t}`)}}),dn=M({name:`prismic field`,description:`Manage fields in slices and content types.`,commands:{add:{handler:an,description:`Add a field`},edit:{handler:on,description:`Edit a field`},remove:{handler:cn,description:`Remove a field`},reorder:{handler:ln,description:`Reorder a field`},view:{handler:un,description:`View details of a field`}}}),fn=j({name:`prismic gen setup`,description:`
41
35
  Generate framework-specific setup files for a Prismic project.
42
36
 
43
37
  Installs dependencies, creates the Prismic client file, slice simulator
44
38
  page, preview routes, and other files required by the detected framework.
45
39
  Skips files that already exist.
46
- `,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await b()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await te()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),Rn=A({name:`prismic gen types`,description:`Generate TypeScript types for slices and content types.`},async()=>{let e=await(await b()).generateTypes(),t=u(await de(),e);console.info(`Generated types at ${t}`)}),zn=j({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:Ln,description:`Generate framework-specific Prismic setup`},types:{handler:Rn,description:`Generate TypeScript types from local models`}}});function Bn(e){Ke(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var Vn=A({name:`prismic init`,description:`
40
+ `,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await h()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await Oe()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),pn=j({name:`prismic gen types`,description:`Generate TypeScript types for slices and content types.`},async()=>{let e=await(await h()).generateTypes(),t=Te(await te(),e);console.info(`Generated types at ${t}`)}),mn=M({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:fn,description:`Generate framework-specific Prismic setup`},types:{handler:pn,description:`Generate TypeScript types from local models`}}});function hn(e){Xe(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var gn=j({name:`prismic init`,description:`
47
41
  Initialize a Prismic project by creating a prismic.config.json file.
48
42
 
49
43
  Detects the project framework, installs dependencies, and syncs models
50
44
  from Prismic. If a slicemachine.config.json exists, it will be migrated.
51
- `,options:{repo:{type:`string`,short:`r`,description:`Repository name`},"no-browser":{type:`boolean`,description:`Skip opening the browser automatically during login`}}},async({values:e})=>{let{repo:n,"no-browser":r}=e;try{throw await Ae(),new M(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof se))throw e}let i;try{i=await je()}catch(e){e instanceof be&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let a=n??i?.repositoryName;if(!a)throw new M(`Missing required flag: --repo`);let o=await O(),s=await k(),c;try{c=await f({token:o,host:s})}catch(e){if(e instanceof ae||e instanceof Ce){console.info(`Not logged in. Starting login...`);let{email:e}=await kt({onReady:e=>{r?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),Bn(e))}});console.info(`Logged in as ${e}`),o=await O(),c=await f({token:o,host:s})}else throw e}if(!c.repositories.find(e=>e.domain===a))throw new M(`Repository "${a}" not found in your account. Check the name or request access to the repository.`);if(!await ue(a,{token:o,host:s}))throw new ge;let l=await b();try{await ve({repositoryName:a,documentAPIEndpoint:s===t?void 0:`https://${a}.cdn.${s}/api/v2/`,libraries:i?.libraries,routes:[]})}catch(e){throw e instanceof Oe?new M(`Could not find a package.json file. Run this command from a project directory.`):new M(`Failed to create prismic.config.json.`)}if(i){try{await fe()}catch{}console.info(`Migrated slicemachine.config.json to prismic.config.json`)}await l.initProject();try{console.info(`Installing dependencies...`),await te()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}await l.syncModels({repo:a,token:o,host:s}),console.info(`\nInitialized Prismic for repository "${a}".`)});const Hn=C({id:E(),label:E(),customName:ye(E()),isMaster:e()});async function Un(e){let{repo:t,token:n,host:r}=e,i=new URL(`repository/locales`,Kn(r));i.searchParams.set(`repository`,t);try{return(await v(i,{headers:{Authorization:`Bearer ${n}`},schema:C({results:g(Hn)})})).results}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${t}`),e}}async function Wn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,Kn(i));a.searchParams.set(`repository`,n);try{return await v(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:Hn})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${n}`),e}}async function Gn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,Kn(i));a.searchParams.set(`repository`,n),await v(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function Kn(e){return new URL(`https://api.internal.${e}/locale/`)}var qn=A({name:`prismic locale add`,description:`
45
+ `,options:{repo:{type:`string`,short:`r`,description:`Repository name`},"no-browser":{type:`boolean`,description:`Skip opening the browser automatically during login`}}},async({values:e})=>{let{repo:t,"no-browser":n}=e;try{throw await fe(),new N(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof _))throw e}let r;try{r=await pe()}catch(e){e instanceof ce&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let i=t??r?.repositoryName;if(!i)throw new N(`Missing required flag: --repo`);let a=await D(),o=await O(),s;try{s=await f({token:a,host:o})}catch(e){if(e instanceof Ee||e instanceof De){console.info(`Not logged in. Starting login...`);let{email:e}=await Ne({onReady:e=>{n?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),hn(e))}});console.info(`Logged in as ${e}`),a=await D(),s=await f({token:a,host:o})}else throw e}if(!s.repositories.find(e=>e.domain===i))throw new N(`Repository "${i}" not found in your account. Check the name or request access to the repository.`);if(!await ee(i,{token:a,host:o}))throw new oe;let c=await h();try{await se({repositoryName:i,documentAPIEndpoint:o===Ae?void 0:`https://${i}.cdn.${o}/api/v2/`,libraries:r?.libraries,routes:[]})}catch(e){throw e instanceof de?new N(`Could not find a package.json file. Run this command from a project directory.`):new N(`Failed to create prismic.config.json.`)}if(r){try{await ne()}catch{}console.info(`Migrated slicemachine.config.json to prismic.config.json`)}await c.initProject();try{console.info(`Installing dependencies...`),await Oe()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}await c.syncModels({repo:i,token:a,host:o}),console.info(`\nInitialized Prismic for repository "${i}".`)});const _n=x({id:b(),label:b(),customName:Se(b()),isMaster:S()});async function vn(e){let{repo:t,token:n,host:r}=e,i=new URL(`repository/locales`,xn(r));i.searchParams.set(`repository`,t);try{return(await w(i,{headers:{Authorization:`Bearer ${n}`},schema:x({results:be(_n)})})).results}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function yn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,xn(i));a.searchParams.set(`repository`,n);try{return await w(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:_n})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function bn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,xn(i));a.searchParams.set(`repository`,n),await w(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function xn(e){return new URL(`https://api.internal.${e}/locale/`)}var Sn=j({name:`prismic locale add`,description:`
52
46
  Add a locale to a Prismic repository.
53
47
 
54
48
  By default, this command reads the repository from prismic.config.json at the
55
49
  project root.
56
- `,positionals:{code:{description:`Locale code (e.g. fr-fr, es-es)`,required:!0}},options:{master:{type:`boolean`,description:`Set as the master locale`},name:{type:`string`,short:`n`,description:`Custom display name (for custom locales)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y(),master:i=!1,name:a}=t,o=await O(),s=await k();try{await Wn({id:n,isMaster:i,customName:a},{repo:r,token:o,host:s})}catch(e){throw e instanceof _?new M(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${n}`)}),Jn=A({name:`prismic locale list`,description:`
50
+ `,positionals:{code:{description:`Locale code (e.g. fr-fr, es-es)`,required:!0}},options:{master:{type:`boolean`,description:`Set as the master locale`},name:{type:`string`,short:`n`,description:`Custom display name (for custom locales)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m(),master:i=!1,name:a}=t,o=await D(),s=await O();try{await yn({id:n,isMaster:i,customName:a},{repo:r,token:o,host:s})}catch(e){throw e instanceof C?new N(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${n}`)}),Cn=j({name:`prismic locale list`,description:`
57
51
  List all locales in a Prismic repository.
58
52
 
59
53
  By default, this command reads the repository from prismic.config.json at the
60
54
  project root.
61
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await y(),json:n}=e,r=await O(),a=await k(),o;try{o=await Un({repo:t,token:r,host:a})}catch(e){throw e instanceof _?new M(`Failed to list locales: ${await e.text()}`):e}if(n){console.info(i(o));return}if(o.length===0){console.info(`No locales found.`);return}let s=o.map(e=>{let t=e.isMaster?` (master)`:``;return[e.id,`${e.label}${t}`]});console.info(T(s,{headers:[`ID`,`LABEL`]}))}),Yn=A({name:`prismic locale remove`,description:`
55
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await m(),json:n}=e,r=await D(),i=await O(),a;try{a=await vn({repo:t,token:r,host:i})}catch(e){throw e instanceof C?new N(`Failed to list locales: ${await e.text()}`):e}if(n){console.info(T(a));return}if(a.length===0){console.info(`No locales found.`);return}let o=a.map(e=>{let t=e.isMaster?` (master)`:``;return[e.id,`${e.label}${t}`]});console.info(v(o,{headers:[`ID`,`LABEL`]}))}),wn=j({name:`prismic locale remove`,description:`
62
56
  Remove a locale from a Prismic repository.
63
57
 
64
58
  By default, this command reads the repository from prismic.config.json at the
65
59
  project root.
66
- `,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k();try{await Gn(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${n}`)}),Xn=A({name:`prismic locale set-master`,description:`
60
+ `,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O();try{await bn(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${n}`)}),Tn=j({name:`prismic locale set-master`,description:`
67
61
  Set the master locale for a Prismic repository.
68
62
 
69
63
  By default, this command reads the repository from prismic.config.json at the
70
64
  project root.
71
- `,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),o;try{o=await Un({repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to set master locale: ${await e.text()}`):e}let s=o.find(e=>e.id===n);if(!s)throw new M(`Locale "${n}" not found. Available locales: ${o.map(e=>e.id).join(`, `)}`);if(s.isMaster)throw new M(`Locale "${n}" is already the master.`);try{await Wn({id:s.id,isMaster:!0,customName:s.customName??void 0},{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),Zn=j({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:qn,description:`Add a locale`},list:{handler:Jn,description:`List locales`},remove:{handler:Yn,description:`Remove a locale`},"set-master":{handler:Xn,description:`Set the master locale`}}}),Qn=A({name:`prismic login`,description:`Log in to Prismic via browser.`,options:{"no-browser":{type:`boolean`,description:`Skip opening the browser automatically`}}},async({values:e})=>{let{"no-browser":t}=e,{email:n}=await kt({onReady:e=>{t?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),$n(e))}});console.info(`Logged in to Prismic as ${n}`)});function $n(e){Ke(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var er=A({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await Et())console.info(`Logged out of Prismic`);else throw new M(`Logout failed. You can log out manually by deleting the file.`)});const tr=C({results:g(C({id:E(),label:E(),url:E()}))});async function nr(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/repository/preview_configs`,cr(t,r));try{return(await v(i,{credentials:{"prismic-auth":n},schema:tr})).results}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${t}`),e}}async function rr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`previews/new`,cr(n,i));try{await v(a,{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${n}`),e}}async function ir(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`previews/delete/${e}`,cr(n,i));try{await v(a,{method:`POST`,body:{},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof l&&(e.message=`Preview not found`),e}}const ar=C({simulator_url:x(E())});async function or(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/repository`,cr(t,r));try{return(await v(i,{credentials:{"prismic-auth":n},schema:ar})).simulator_url}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${t}`),e}}async function sr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`core/repository`,cr(n,i));try{await v(a,{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${n}`),e}}function cr(e,t){return new URL(`https://${e}.${t}/`)}var lr=A({name:`prismic preview add`,description:`
65
+ `,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),o;try{o=await vn({repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to set master locale: ${await e.text()}`):e}let s=o.find(e=>e.id===n);if(!s)throw new N(`Locale "${n}" not found. Available locales: ${o.map(e=>e.id).join(`, `)}`);if(s.isMaster)throw new N(`Locale "${n}" is already the master.`);try{await yn({id:s.id,isMaster:!0,customName:s.customName??void 0},{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),En=M({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:Sn,description:`Add a locale`},list:{handler:Cn,description:`List locales`},remove:{handler:wn,description:`Remove a locale`},"set-master":{handler:Tn,description:`Set the master locale`}}}),Dn=j({name:`prismic login`,description:`Log in to Prismic via browser.`,options:{"no-browser":{type:`boolean`,description:`Skip opening the browser automatically`}}},async({values:e})=>{let{"no-browser":t}=e,{email:n}=await Ne({onReady:e=>{t?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),On(e))}});console.info(`Logged in to Prismic as ${n}`)});function On(e){Xe(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var kn=j({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await je())console.info(`Logged out of Prismic`);else throw new N(`Logout failed. You can log out manually by deleting the file.`)});const An=x({results:be(x({id:b(),label:b(),url:b()}))});async function jn(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/repository/preview_configs`,Ln(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:An})).results}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function Mn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`previews/new`,Ln(n,i));try{await w(a,{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function Nn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`previews/delete/${e}`,Ln(n,i));try{await w(a,{method:`POST`,body:{},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Preview not found`),e}}const Pn=x({simulator_url:Ce(b())});async function Fn(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/repository`,Ln(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:Pn})).simulator_url}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function In(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`core/repository`,Ln(n,i));try{await w(a,{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}function Ln(e,t){return new URL(`https://${e}.${t}/`)}var Rn=j({name:`prismic preview add`,description:`
72
66
  Add a preview configuration to a Prismic repository.
73
67
 
74
68
  By default, this command reads the repository from prismic.config.json at the
75
69
  project root.
76
- `,positionals:{url:{description:`Preview URL (e.g. https://example.com/api/preview)`,required:!0}},options:{name:{type:`string`,short:`n`,description:`Display name (defaults to hostname)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y(),name:i}=t,a;try{a=new URL(n)}catch{throw new M(`Invalid URL: ${n}`)}let o=i||a.hostname,s=`${a.protocol}//${a.host}`,c=a.pathname===`/`?void 0:a.pathname,l=await O(),u=await k();try{await rr({name:o,websiteURL:s,resolverPath:c},{repo:r,token:l,host:u})}catch(e){throw e instanceof _?new M(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${n}`)}),ur=A({name:`prismic preview list`,description:`
70
+ `,positionals:{url:{description:`Preview URL (e.g. https://example.com/api/preview)`,required:!0}},options:{name:{type:`string`,short:`n`,description:`Display name (defaults to hostname)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m(),name:i}=t,a;try{a=new URL(n)}catch{throw new N(`Invalid URL: ${n}`)}let o=i||a.hostname,s=`${a.protocol}//${a.host}`,c=a.pathname===`/`?void 0:a.pathname,l=await D(),u=await O();try{await Mn({name:o,websiteURL:s,resolverPath:c},{repo:r,token:l,host:u})}catch(e){throw e instanceof C?new N(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${n}`)}),zn=j({name:`prismic preview list`,description:`
77
71
  List all preview configurations in a Prismic repository.
78
72
 
79
73
  By default, this command reads the repository from prismic.config.json at the
80
74
  project root.
81
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await y(),json:n}=e,r=await O(),a=await k(),o,s;try{[o,s]=await Promise.all([nr({repo:t,token:r,host:a}),or({repo:t,token:r,host:a})])}catch(e){throw e instanceof _?new M(`Failed to list previews: ${await e.text()}`):e}if(n){console.info(i({previews:o,simulatorUrl:s??null}));return}if(o.length===0&&!s){console.info(`No preview configurations found.`);return}if(o.length>0){let e=o.map(e=>[e.url,e.label]);console.info(T(e,{headers:[`URL`,`NAME`]}))}s&&(o.length>0&&console.info(``),console.info(`Simulator: ${s}`))}),dr=A({name:`prismic preview remove`,description:`
75
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await m(),json:n}=e,r=await D(),i=await O(),a,o;try{[a,o]=await Promise.all([jn({repo:t,token:r,host:i}),Fn({repo:t,token:r,host:i})])}catch(e){throw e instanceof C?new N(`Failed to list previews: ${await e.text()}`):e}if(n){console.info(T({previews:a,simulatorUrl:o??null}));return}if(a.length===0&&!o){console.info(`No preview configurations found.`);return}if(a.length>0){let e=a.map(e=>[e.url,e.label]);console.info(v(e,{headers:[`URL`,`NAME`]}))}o&&(a.length>0&&console.info(``),console.info(`Simulator: ${o}`))}),Bn=j({name:`prismic preview remove`,description:`
82
76
  Remove a preview configuration from a Prismic repository.
83
77
 
84
78
  By default, this command reads the repository from prismic.config.json at the
85
79
  project root.
86
- `,positionals:{url:{description:`Preview URL to remove`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),o;try{o=await nr({repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to remove preview: ${await e.text()}`):e}let s=o.find(e=>e.url===n);if(!s)throw new M(`Preview not found: ${n}`);try{await ir(s.id,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),fr=A({name:`prismic preview set-simulator`,description:`
80
+ `,positionals:{url:{description:`Preview URL to remove`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),o;try{o=await jn({repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to remove preview: ${await e.text()}`):e}let s=o.find(e=>e.url===n);if(!s)throw new N(`Preview not found: ${n}`);try{await Nn(s.id,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),Vn=j({name:`prismic preview set-simulator`,description:`
87
81
  Set the slice simulator URL for a Prismic repository.
88
82
 
89
83
  If the URL pathname does not end with /slice-simulator, it is appended
@@ -91,54 +85,53 @@ import{$ as e,A as t,B as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K a
91
85
 
92
86
  By default, this command reads the repository from prismic.config.json at the
93
87
  project root.
94
- `,positionals:{url:{description:`Simulator URL (e.g. https://example.com/slice-simulator)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i;try{i=new URL(n)}catch{throw new M(`Invalid URL: ${n}`)}i.pathname.endsWith(`/slice-simulator`)||(i.pathname=i.pathname.replace(/\/+$/,``)+`/slice-simulator`);let a=i.toString(),o=await O(),s=await k();try{await sr(a,{repo:r,token:o,host:s})}catch(e){throw e instanceof _?new M(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${a}`)}),pr=j({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:lr,description:`Add a preview configuration`},list:{handler:ur,description:`List preview configurations`},remove:{handler:dr,description:`Remove a preview configuration`},"set-simulator":{handler:fr,description:`Set the slice simulator URL`}}});const mr=C({documentsPublished:e(),documentsUnpublished:e(),releasesCreated:e(),releasesUpdated:e(),tagsCreated:e(),tagsDeleted:e()}),hr=Object.keys(mr.shape),gr=C({config:le(mr,{_id:E(),url:E(),active:e(),name:ye(E()),secret:ye(E()),headers:xe(E(),E())})});async function _r(e){let{repo:t,token:n,host:r}=e,i=I(t,r),a=new URL(`app/settings/webhooks`,i);try{return await v(a,{credentials:{"prismic-auth":n},schema:g(gr)})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${t}`),e}}async function vr(e,t){let{repo:n,token:r,host:i}=t,a=I(n,i),o=new URL(`app/settings/webhooks/create`,a),s=new FormData;s.set(`url`,e.url),s.set(`name`,e.name??``),s.set(`secret`,e.secret??``),s.set(`headers`,JSON.stringify({})),s.set(`active`,`on`),s.set(`documentsPublished`,e.documentsPublished.toString()),s.set(`documentsUnpublished`,e.documentsUnpublished.toString()),s.set(`releasesCreated`,e.releasesCreated.toString()),s.set(`releasesUpdated`,e.releasesUpdated.toString()),s.set(`tagsCreated`,e.tagsCreated.toString()),s.set(`tagsDeleted`,e.tagsDeleted.toString());try{await v(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${n}`),e}}async function yr(e,t,n){let{repo:r,token:i,host:a}=n,o=I(r,a),s=new URL(`app/settings/webhooks/${e}`,o),c=new FormData;c.set(`url`,t.url),c.set(`name`,t.name??``),c.set(`secret`,t.secret??``),c.set(`headers`,JSON.stringify(t.headers??{})),c.set(`active`,t.active?`on`:`off`),c.set(`documentsPublished`,t.documentsPublished.toString()),c.set(`documentsUnpublished`,t.documentsUnpublished.toString()),c.set(`releasesCreated`,t.releasesCreated.toString()),c.set(`releasesUpdated`,t.releasesUpdated.toString()),c.set(`tagsCreated`,t.tagsCreated.toString()),c.set(`tagsDeleted`,t.tagsDeleted.toString());try{await v(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}catch(e){throw e instanceof l&&(e.message=`Webhook not found`),e}}async function br(e,t){let{repo:n,token:r,host:i}=t,a=I(n,i),o=new URL(`app/settings/webhooks/${e}/delete`,a);try{await v(o,{method:`POST`,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof l&&(e.message=`Webhook not found`),e}}const xr=C({id:E(),scope:E(),token:E(),created_at:C({$date:we()})}),Sr=C({id:E(),name:E(),wroom_auths:g(xr)}),Cr=C({app_name:E(),token:E(),timestamp:we()}),wr=C({max_tokens:we(),tokens:g(Cr)});async function Tr(e){let t=new URL(`settings/security/contentapi`,I(e.repo,e.host));try{return await v(t,{credentials:{"prismic-auth":e.token},schema:g(Sr)})}catch(t){throw t instanceof l&&(t.message=`Repository not found: ${e.repo}`),t}}async function Er(e,t){let n=new URL(`settings/security/oauthapp`,I(t.repo,t.host));try{return await v(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Sr})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${t.repo}`),e}}async function Dr(e,t,n){let r=new URL(`settings/security/authorizations`,I(n.repo,n.host));try{return await v(r,{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:xr})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${n.repo}`),e}}async function Or(e,t){let n=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,I(t.repo,t.host));try{await v(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(e){throw e instanceof l&&(e.message=`Token not found`),e}}async function kr(e){let t=new URL(`settings/security/customtypesapi`,I(e.repo,e.host));try{return await v(t,{credentials:{"prismic-auth":e.token},schema:wr})}catch(t){throw t instanceof l&&(t.message=`Repository not found: ${e.repo}`),t}}async function Ar(e,t){let n=new URL(`settings/security/token`,I(t.repo,t.host));try{return await v(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Cr})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${t.repo}`),e}}async function jr(e,t){let n=new URL(`settings/security/token/${encodeURIComponent(e)}`,I(t.repo,t.host));try{await v(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(t){throw t instanceof l&&(t.message=`Token not found: ${e}`),t}}async function Mr(t){let{domain:n,token:r,host:i}=t;return await v(new URL(`app/dashboard/repositories/${n}/exists`,zr(i)),{credentials:{"prismic-auth":r},schema:e()})}async function Nr(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await v(new URL(`app/dashboard/repositories`,zr(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const Pr=C({repository:C({api_access:E()})});async function Fr(e){let{repo:t,token:n,host:r}=e,i=new URL(`syncState`,I(t,r));try{return(await v(i,{credentials:{"prismic-auth":n},schema:Pr})).repository.api_access}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${t}`),e}}async function Ir(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`settings/security/apiaccess`,I(n,i));try{await v(a,{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${n}`),e}}const Lr=C({repository:C({name:E()})});async function Rr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,I(n,i)),o=new FormData;o.set(`displayname`,e);try{return(await v(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:Lr})).repository.name}catch(e){throw e instanceof l&&(e.message=`Repository not found: ${n}`),e}}function zr(e){return new URL(`https://${e}/`)}function I(e,t){return new URL(`https://${e}.${t}/`)}var Br=A({name:`prismic repo create`,description:`Create a new Prismic repository.`,options:{name:{type:`string`,short:`n`,description:`Display name for the repository`}}},async({values:e})=>{let{name:t}=e,n=await O(),r=await k(),i=await Vr({token:n,host:r});if(!i)throw new M(`Failed to create a repository. Please try again.`);let a=(await b().catch(()=>void 0))?.id??`other`;try{await Nr({domain:i,name:t??i,framework:a,token:n,host:r})}catch(e){throw e instanceof _?new M(`Failed to create repository: ${await e.text()}`):e}console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function Vr(e){let{token:t,host:n}=e,r;for(let e=0;e<5;e++){let e=crypto.randomUUID().replace(/-/g,``).slice(0,8);if(await Mr({domain:e,token:t,host:n})){r=e;break}}return r}var Hr=A({name:`prismic repo list`,description:`List all Prismic repositories associated with your account.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await O(),r=await k(),a;try{a=await f({token:n,host:r})}catch(e){throw e instanceof _?new M(`Failed to list repositories: ${await e.text()}`):e}let o=a.repositories;if(t){console.info(i(o.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${r}/`}))));return}if(o.length===0){console.info(`No repositories found.`);return}let s=o.map(e=>{let t=e.name||`(no name)`;return[e.domain,t,e.role??``]});console.info(T(s,{headers:[`DOMAIN`,`NAME`,`ROLE`]}))});const Ur=[`private`,`public`,`open`];var Wr=A({name:`prismic repo set-api-access`,description:`
88
+ `,positionals:{url:{description:`Simulator URL (e.g. https://example.com/slice-simulator)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i;try{i=new URL(n)}catch{throw new N(`Invalid URL: ${n}`)}i.pathname.endsWith(`/slice-simulator`)||(i.pathname=i.pathname.replace(/\/+$/,``)+`/slice-simulator`);let a=i.toString(),o=await D(),s=await O();try{await In(a,{repo:r,token:o,host:s})}catch(e){throw e instanceof C?new N(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${a}`)}),Hn=M({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:Rn,description:`Add a preview configuration`},list:{handler:zn,description:`List preview configurations`},remove:{handler:Bn,description:`Remove a preview configuration`},"set-simulator":{handler:Vn,description:`Set the slice simulator URL`}}});const Un=x({documentsPublished:S(),documentsUnpublished:S(),releasesCreated:S(),releasesUpdated:S(),tagsCreated:S(),tagsDeleted:S()}),Wn=Object.keys(Un.shape),Gn=x({config:ye(Un,{_id:b(),url:b(),active:S(),name:Se(b()),secret:Se(b()),headers:_e(b(),b())})});async function Kn(e){let{repo:t,token:n,host:r}=e,i=L(t,r),a=new URL(`app/settings/webhooks`,i);try{return await w(a,{credentials:{"prismic-auth":n},schema:be(Gn)})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function qn(e,t){let{repo:n,token:r,host:i}=t,a=L(n,i),o=new URL(`app/settings/webhooks/create`,a),s=new FormData;s.set(`url`,e.url),s.set(`name`,e.name??``),s.set(`secret`,e.secret??``),s.set(`headers`,JSON.stringify({})),s.set(`active`,`on`),s.set(`documentsPublished`,e.documentsPublished.toString()),s.set(`documentsUnpublished`,e.documentsUnpublished.toString()),s.set(`releasesCreated`,e.releasesCreated.toString()),s.set(`releasesUpdated`,e.releasesUpdated.toString()),s.set(`tagsCreated`,e.tagsCreated.toString()),s.set(`tagsDeleted`,e.tagsDeleted.toString());try{await w(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function Jn(e,t,n){let{repo:r,token:i,host:a}=n,o=L(r,a),s=new URL(`app/settings/webhooks/${e}`,o),c=new FormData;c.set(`url`,t.url),c.set(`name`,t.name??``),c.set(`secret`,t.secret??``),c.set(`headers`,JSON.stringify(t.headers??{})),c.set(`active`,t.active?`on`:`off`),c.set(`documentsPublished`,t.documentsPublished.toString()),c.set(`documentsUnpublished`,t.documentsUnpublished.toString()),c.set(`releasesCreated`,t.releasesCreated.toString()),c.set(`releasesUpdated`,t.releasesUpdated.toString()),c.set(`tagsCreated`,t.tagsCreated.toString()),c.set(`tagsDeleted`,t.tagsDeleted.toString());try{await w(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}catch(e){throw e instanceof E&&(e.message=`Webhook not found`),e}}async function Yn(e,t){let{repo:n,token:r,host:i}=t,a=L(n,i),o=new URL(`app/settings/webhooks/${e}/delete`,a);try{await w(o,{method:`POST`,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Webhook not found`),e}}const Xn=x({id:b(),scope:b(),token:b(),created_at:x({$date:ge()})}),Zn=x({id:b(),name:b(),wroom_auths:be(Xn)}),Qn=x({app_name:b(),token:b(),timestamp:ge()}),$n=x({max_tokens:ge(),tokens:be(Qn)});async function er(e){let t=new URL(`settings/security/contentapi`,L(e.repo,e.host));try{return await w(t,{credentials:{"prismic-auth":e.token},schema:be(Zn)})}catch(t){throw t instanceof E&&(t.message=`Repository not found: ${e.repo}`),t}}async function tr(e,t){let n=new URL(`settings/security/oauthapp`,L(t.repo,t.host));try{return await w(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Zn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t.repo}`),e}}async function nr(e,t,n){let r=new URL(`settings/security/authorizations`,L(n.repo,n.host));try{return await w(r,{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:Xn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n.repo}`),e}}async function rr(e,t){let n=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,L(t.repo,t.host));try{await w(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(e){throw e instanceof E&&(e.message=`Token not found`),e}}async function ir(e){let t=new URL(`settings/security/customtypesapi`,L(e.repo,e.host));try{return await w(t,{credentials:{"prismic-auth":e.token},schema:$n})}catch(t){throw t instanceof E&&(t.message=`Repository not found: ${e.repo}`),t}}async function ar(e,t){let n=new URL(`settings/security/token`,L(t.repo,t.host));try{return await w(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Qn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t.repo}`),e}}async function or(e,t){let n=new URL(`settings/security/token/${encodeURIComponent(e)}`,L(t.repo,t.host));try{await w(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(t){throw t instanceof E&&(t.message=`Token not found: ${e}`),t}}async function sr(e){let{domain:t,token:n,host:r}=e;return await w(new URL(`app/dashboard/repositories/${t}/exists`,mr(r)),{credentials:{"prismic-auth":n},schema:S()})}async function cr(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await w(new URL(`app/dashboard/repositories`,mr(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const lr=x({repository:x({api_access:b()})});async function ur(e){let{repo:t,token:n,host:r}=e,i=new URL(`syncState`,L(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:lr})).repository.api_access}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function dr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`settings/security/apiaccess`,L(n,i));try{await w(a,{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}const fr=x({repository:x({name:b()})});async function pr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,L(n,i)),o=new FormData;o.set(`displayname`,e);try{return(await w(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:fr})).repository.name}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}function mr(e){return new URL(`https://${e}/`)}function L(e,t){return new URL(`https://${e}.${t}/`)}var hr=j({name:`prismic repo create`,description:`Create a new Prismic repository.`,options:{name:{type:`string`,short:`n`,description:`Display name for the repository`}}},async({values:e})=>{let{name:t}=e,n=await D(),r=await O(),i=await gr({token:n,host:r});if(!i)throw new N(`Failed to create a repository. Please try again.`);let a=(await h().catch(()=>void 0))?.id??`other`;try{await cr({domain:i,name:t??i,framework:a,token:n,host:r})}catch(e){throw e instanceof C?new N(`Failed to create repository: ${await e.text()}`):e}console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function gr(e){let{token:t,host:n}=e,r;for(let e=0;e<5;e++){let e=crypto.randomUUID().replace(/-/g,``).slice(0,8);if(await sr({domain:e,token:t,host:n})){r=e;break}}return r}var _r=j({name:`prismic repo list`,description:`List all Prismic repositories associated with your account.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await D(),r=await O(),i;try{i=await f({token:n,host:r})}catch(e){throw e instanceof C?new N(`Failed to list repositories: ${await e.text()}`):e}let a=i.repositories;if(t){console.info(T(a.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${r}/`}))));return}if(a.length===0){console.info(`No repositories found.`);return}let o=a.map(e=>{let t=e.name||`(no name)`;return[e.domain,t,e.role??``]});console.info(v(o,{headers:[`DOMAIN`,`NAME`,`ROLE`]}))});const vr=[`private`,`public`,`open`];var yr=j({name:`prismic repo set-api-access`,description:`
95
89
  Set the Content API access level of a Prismic repository.
96
90
 
97
91
  By default, this command reads the repository from prismic.config.json at the
98
92
  project root.
99
- `,positionals:{level:{description:`Access level (${Ur.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t;if(!Ur.includes(n))throw new M(`Invalid access level: ${n}. Must be one of: ${Ur.join(`, `)}`);let i=await O(),a=await k();try{await Ir(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),Gr=A({name:`prismic repo set-name`,description:`
93
+ `,positionals:{level:{description:`Access level (${vr.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t;if(!vr.includes(n))throw new N(`Invalid access level: ${n}. Must be one of: ${vr.join(`, `)}`);let i=await D(),a=await O();try{await dr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),br=j({name:`prismic repo set-name`,description:`
100
94
  Set the display name of a Prismic repository.
101
95
 
102
96
  By default, this command reads the repository from prismic.config.json at the
103
97
  project root.
104
- `,positionals:{name:{description:`Display name for the repository`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),o;try{o=await Rr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${o}`)}),Kr=A({name:`prismic repo view`,description:`
98
+ `,positionals:{name:{description:`Display name for the repository`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),o;try{o=await pr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${o}`)}),xr=j({name:`prismic repo view`,description:`
105
99
  View details of a Prismic repository.
106
100
 
107
101
  By default, this command reads the repository from prismic.config.json at the
108
102
  project root.
109
- `,options:{web:{type:`boolean`,short:`w`,description:`Open repository in browser`},json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await y(),web:n,json:r}=e,a=await O(),o=await k(),s=`https://${t}.${o}/`;if(n){Bn(new URL(s)),console.info(`Opening ${s}`);return}let c,l;try{[c,l]=await Promise.all([f({token:a,host:o}),Fr({repo:t,token:a,host:o})])}catch(e){throw e instanceof _?new M(`Failed to fetch repository details: ${await e.text()}`):e}let u=c.repositories.find(e=>e.domain===t);if(!u)throw new M(`Repository not found: ${t}`);if(r){console.info(i({domain:u.domain,name:u.name??null,url:s,apiAccess:l}));return}let d=u.name||`(no name)`;console.info(`Name: ${d}`),console.info(`URL: ${s}`),console.info(`Content API: ${l}`)}),qr=j({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:Br,description:`Create a new repository`},list:{handler:Hr,description:`List repositories`},view:{handler:Kr,description:`View repository details`},"set-name":{handler:Gr,description:`Set repository display name`},"set-api-access":{handler:Wr,description:`Set Content API access level`}}}),Jr=A({name:`prismic slice add-variation`,description:`Add a variation to a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the slice`},id:{type:`string`,description:`Custom ID for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,id:i=ke(n),screenshot:a,repo:o=await y()}=t,s=await b(),l=await O(),u=await k(),d=await c(r,{repo:o,token:l,host:u});if(d.variations.some(e=>e.id===i))throw new M(`Variation "${i}" already exists in slice "${r}".`);let f=``;if(a){let e=await m(/^https?:\/\//i.test(a)?new URL(a):ze(a)),t;try{t=await ie(e,{sliceId:d.id,variationId:i,repo:o,token:l,host:u})}catch(e){throw e instanceof p?new M(e.message):e}f=t.toString()}let h={...d,variations:[...d.variations,{id:i,name:n,description:n,docURL:``,imageUrl:f,version:``,primary:{}}]};try{await ne(h,{repo:o,host:u,token:l})}catch(e){throw e instanceof _?new M(`Failed to add variation: ${await e.text()}`):e}try{await s.updateSlice(h)}catch{await s.createSlice(h)}await s.generateTypes(),console.info(`Added variation "${n}" (id: "${i}") to slice "${r}"`)}),Yr=A({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"slice-zone":i=`slices`,repo:a=await y()}=t,o=await b(),l={repo:a,token:await O(),host:await k()},u=await c(n,l),d=await h(r,l),f=Object.assign({},...Object.values(d.json))[i];if(!f||f.type!==`Slices`)throw new M(`Slice zone "${i}" not found in "${r}".`);if(f.config??={},f.config.choices??={},u.id in f.config.choices)throw new M(`Slice "${u.id}" is already connected to "${r}" in slice zone "${i}".`);f.config.choices[u.id]={type:`SharedSlice`};try{await s(d,l)}catch(e){throw e instanceof _?new M(`Failed to connect slice: ${await e.text()}`):e}try{await o.updateCustomType(d)}catch{await o.createCustomType(d)}await o.generateTypes(),console.info(`Connected slice "${n}" to "${r}"`)}),Xr=A({name:`prismic slice create`,description:`Create a new slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{id:{type:`string`,description:`Custom ID for the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{id:r=Se(n),repo:i=await y()}=t,a={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},o=await b(),s=await O(),c=await k();try{await Me(a,{repo:i,host:c,token:s})}catch(e){throw e instanceof _?new M(`Failed to create slice: ${await e.text()}`):e}await o.createSlice(a),await o.generateTypes(),console.info(`Created slice "${n}" (id: "${r}")`)}),Zr=A({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,"slice-zone":i=`slices`,repo:a=await y()}=t,o=await b(),l={repo:a,token:await O(),host:await k()},u=await c(n,l),d=await h(r,l),f=Object.assign({},...Object.values(d.json))[i];if(!f||f.type!==`Slices`)throw new M(`Slice zone "${i}" not found in "${r}".`);if(!f.config?.choices||!(u.id in f.config.choices))throw new M(`Slice "${u.id}" is not connected to "${r}" in slice zone "${i}".`);delete f.config.choices[u.id];try{await s(d,l)}catch(e){throw e instanceof _?new M(`Failed to disconnect slice: ${await e.text()}`):e}try{await o.updateCustomType(d)}catch{await o.createCustomType(d)}await o.generateTypes(),console.info(`Disconnected slice "${n}" from "${r}"`)}),Qr=A({name:`prismic slice edit`,description:`Edit a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await b(),a=await O(),o=await k(),s={...await c(n,{repo:r,token:a,host:o})};`name`in t&&(s.name=t.name);try{await ne(s,{repo:r,host:o,token:a})}catch(e){throw e instanceof _?new M(`Failed to update slice: ${await e.text()}`):e}try{await i.updateSlice(s)}catch{await i.createSlice(s)}await i.generateTypes(),console.info(`Slice updated: "${s.name}" (id: ${s.id})`)}),$r=A({name:`prismic slice edit-variation`,description:`Edit a variation of a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{"from-slice":{type:`string`,required:!0,description:`ID of the slice`},name:{type:`string`,short:`n`,description:`New name for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-slice":r,screenshot:i,repo:a=await y()}=t,o=await b(),s=await O(),l=await k(),u=await c(r,{repo:a,token:s,host:l}),d=u.variations.find(e=>e.id===n);if(!d)throw new M(`Variation "${n}" not found in slice "${r}".`);if(`name`in t&&(d.name=t.name),i){let e=await m(/^https?:\/\//i.test(i)?new URL(i):ze(i)),t;try{t=await ie(e,{sliceId:u.id,variationId:d.id,repo:a,token:s,host:l})}catch(e){throw e instanceof p?new M(e.message):e}d.imageUrl=t.toString()}try{await ne(u,{repo:a,host:l,token:s})}catch(e){throw e instanceof _?new M(`Failed to update variation: ${await e.text()}`):e}try{await o.updateSlice(u)}catch{await o.createSlice(u)}await o.generateTypes(),console.info(`Variation updated: "${n}" in slice "${r}"`)}),ei=A({name:`prismic slice list`,description:`List all slices.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:n=await y()}=e,r=await d({repo:n,token:await O(),host:await k()});if(t){console.info(i(r));return}if(r.length===0){console.info(`No slices found.`);return}let a=r.map(e=>[e.name,e.id]);console.info(T(a,{headers:[`NAME`,`ID`]}))}),ti=A({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await b(),a=await O(),o=await k(),s=await c(n,{repo:r,token:a,host:o});try{await re(s.id,{repo:r,host:o,token:a})}catch(e){throw e instanceof _?new M(`Failed to remove slice: ${await e.text()}`):e}try{await i.deleteSlice(s.id)}catch{}await i.generateTypes(),console.info(`Slice removed: ${n}`)}),ni=A({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,repo:i=await y()}=t,a=await b(),o=await O(),s=await k(),l=await c(r,{repo:i,token:o,host:s}),u=l.variations.find(e=>e.id===n);if(!u)throw new M(`Variation "${n}" not found in slice "${r}".`);let d={...l,variations:l.variations.filter(e=>e.id!==u.id)};try{await ne(d,{repo:i,host:s,token:o})}catch(e){throw e instanceof _?new M(`Failed to remove variation: ${await e.text()}`):e}try{await a.updateSlice(d)}catch{await a.createSlice(d)}await a.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),ri=A({name:`prismic slice view`,description:`View details of a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r,repo:a=await y()}=t,o=await c(n,{repo:a,token:await O(),host:await k()});if(r){console.info(i(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.name}`);for(let e of o.variations??[]){console.info(``),console.info(`${e.id}:`);let t=Object.entries(e.primary??{});if(t.length===0)console.info(` (no fields)`);else{let e=t.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(T(e))}}}),ii=j({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Xr,description:`Create a new slice`},edit:{handler:Qr,description:`Edit a slice`},remove:{handler:ti,description:`Remove a slice`},list:{handler:ei,description:`List slices`},view:{handler:ri,description:`View a slice`},connect:{handler:Yr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:Zr,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Jr,description:`Add a variation to a slice`},"edit-variation":{handler:$r,description:`Edit a variation of a slice`},"remove-variation":{handler:ni,description:`Remove a variation from a slice`}}});const ai=process.env.PRISMIC_ENV&&process.env.PRISMIC_ENV!==`production`?`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`:`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`;let oi=!1,si=``,ci=``,li,ui;const di={app:{name:gt,version:_t}},fi=[],pi=[];async function mi(){try{if(w.TEST||(oi=await Si(),!oi))return;si=Ve(),ci=`Basic ${btoa(ai+`:`)}`,process.on(`exit`,bi)}catch{oi=!1}}function hi(e,t={}){if(!oi)return;let{repository:n=ui,watch:r}=t,i={commandType:e,fullCommand:process.argv.join(` `)};n&&(i.repository=n),r!==void 0&&(i.watch=r),fi.push({event:`Prismic CLI Start`,properties:i,context:yi(n)})}function gi(e,t={}){if(!oi)return;let{success:n=!process.exitCode,error:r,repository:i=ui,watch:a}=t,o={commandType:e,fullCommand:process.argv.join(` `),success:n};i&&(o.repository=i),a!==void 0&&(o.watch=a),r!==void 0&&(o.error=(r instanceof Error?r.message:String(r)).slice(0,512)),fi.push({event:`Prismic CLI End`,properties:o,context:yi(i)})}function _i(e){oi&&(li=e.shortId,pi.push({userId:li,anonymousId:si,integrations:{Intercom:{user_hash:e.intercomHash}},context:di,timestamp:new Date().toISOString()}))}function vi(e){ui=e}function yi(e){let t={...di};return e&&(t.groupId={Repository:e}),t}function bi(){if(!(fi.length===0&&pi.length===0)){try{let e=Buffer.from(JSON.stringify({trackUrl:`https://api.segment.io/v1/track`,identifyUrl:`https://api.segment.io/v1/identify`,authorization:ci,trackEvents:fi.map(e=>({...li?{userId:li}:{},anonymousId:si,event:e.event,properties:{nodeVersion:process.versions.node,...e.properties},context:e.context,timestamp:new Date().toISOString()})),identifyEvents:pi})).toString(`base64`);Je(process.execPath,[`--input-type=module`,`-e`,xi,e],{detached:!0,stdio:`ignore`}).unref()}catch{}fi.length=0,pi.length=0}}const xi=`
110
- const {trackUrl, identifyUrl, authorization, trackEvents, identifyEvents} = JSON.parse(Buffer.from(process.argv[1], "base64"));
111
- const h = {"Content-Type": "application/json", Authorization: authorization};
112
- await Promise.allSettled([
113
- ...trackEvents.map(e => fetch(trackUrl, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})),
114
- ...identifyEvents.map(e => fetch(identifyUrl, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})),
115
- ]);
116
- `;async function Si(){try{return!((await Ci(Ue($e(),`.prismicrc`)))?.telemetry===!1||(await Ci(Ue(process.cwd(),`.prismicrc`)))?.telemetry===!1)}catch{return!0}}async function Ci(e){try{let t=await Ie(e,`utf8`);return JSON.parse(t)}catch{return}}const wi=w.TEST?500:5e3,Ti=6e4;var Ei=A({name:`prismic sync`,description:`
103
+ `,options:{web:{type:`boolean`,short:`w`,description:`Open repository in browser`},json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await m(),web:n,json:r}=e,i=await D(),a=await O(),o=`https://${t}.${a}/`;if(n){hn(new URL(o)),console.info(`Opening ${o}`);return}let s,c;try{[s,c]=await Promise.all([f({token:i,host:a}),ur({repo:t,token:i,host:a})])}catch(e){throw e instanceof C?new N(`Failed to fetch repository details: ${await e.text()}`):e}let l=s.repositories.find(e=>e.domain===t);if(!l)throw new N(`Repository not found: ${t}`);if(r){console.info(T({domain:l.domain,name:l.name??null,url:o,apiAccess:c}));return}let u=l.name||`(no name)`;console.info(`Name: ${u}`),console.info(`URL: ${o}`),console.info(`Content API: ${c}`)}),Sr=M({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:hr,description:`Create a new repository`},list:{handler:_r,description:`List repositories`},view:{handler:xr,description:`View repository details`},"set-name":{handler:br,description:`Set repository display name`},"set-api-access":{handler:yr,description:`Set Content API access level`}}}),Cr=j({name:`prismic slice add-variation`,description:`Add a variation to a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the slice`},id:{type:`string`,description:`Custom ID for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{to:o,id:s=a(r),screenshot:l,repo:d=await m()}=t,f=await h(),p=await D(),g=await O(),_=await i(o,{repo:d,token:p,host:g});if(_.variations.some(e=>e.id===s))throw new N(`Variation "${s}" already exists in slice "${o}".`);let ee=``;if(l){let e=await we(/^https?:\/\//i.test(l)?new URL(l):We(l)),t;try{t=await u(e,{sliceId:_.id,variationId:s,repo:d,token:p,host:g})}catch(e){throw e instanceof n?new N(e.message):e}ee=t.toString()}let te={..._,variations:[..._.variations,{id:s,name:r,description:r,docURL:``,imageUrl:ee,version:``,primary:{}}]};try{await c(te,{repo:d,host:g,token:p})}catch(e){throw e instanceof C?new N(`Failed to add variation: ${await e.text()}`):e}try{await f.updateSlice(te)}catch{await f.createSlice(te)}await f.generateTypes(),console.info(`Added variation "${r}" (id: "${s}") to slice "${o}"`)}),wr=j({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"slice-zone":a=`slices`,repo:o=await m()}=t,c=await h(),l={repo:o,token:await D(),host:await O()},u=await i(n,l),d=await y(r,l),f=Object.assign({},...Object.values(d.json))[a];if(!f||f.type!==`Slices`)throw new N(`Slice zone "${a}" not found in "${r}".`);if(f.config??={},f.config.choices??={},u.id in f.config.choices)throw new N(`Slice "${u.id}" is already connected to "${r}" in slice zone "${a}".`);f.config.choices[u.id]={type:`SharedSlice`};try{await s(d,l)}catch(e){throw e instanceof C?new N(`Failed to connect slice: ${await e.text()}`):e}try{await c.updateCustomType(d)}catch{await c.createCustomType(d)}await c.generateTypes(),console.info(`Connected slice "${n}" to "${r}"`)}),Tr=j({name:`prismic slice create`,description:`Create a new slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{id:{type:`string`,description:`Custom ID for the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{id:r=d(n),repo:i=await m()}=t,a={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},o=await h(),s=await D(),c=await O();try{await ae(a,{repo:i,host:c,token:s})}catch(e){throw e instanceof C?new N(`Failed to create slice: ${await e.text()}`):e}await o.createSlice(a),await o.generateTypes(),console.info(`Created slice "${n}" (id: "${r}")`)}),Er=j({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,"slice-zone":a=`slices`,repo:o=await m()}=t,c=await h(),l={repo:o,token:await D(),host:await O()},u=await i(n,l),d=await y(r,l),f=Object.assign({},...Object.values(d.json))[a];if(!f||f.type!==`Slices`)throw new N(`Slice zone "${a}" not found in "${r}".`);if(!f.config?.choices||!(u.id in f.config.choices))throw new N(`Slice "${u.id}" is not connected to "${r}" in slice zone "${a}".`);delete f.config.choices[u.id];try{await s(d,l)}catch(e){throw e instanceof C?new N(`Failed to disconnect slice: ${await e.text()}`):e}try{await c.updateCustomType(d)}catch{await c.createCustomType(d)}await c.generateTypes(),console.info(`Disconnected slice "${n}" from "${r}"`)}),Dr=j({name:`prismic slice edit`,description:`Edit a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,a=await h(),o=await D(),s=await O(),l={...await i(n,{repo:r,token:o,host:s})};`name`in t&&(l.name=t.name);try{await c(l,{repo:r,host:s,token:o})}catch(e){throw e instanceof C?new N(`Failed to update slice: ${await e.text()}`):e}try{await a.updateSlice(l)}catch{await a.createSlice(l)}await a.generateTypes(),console.info(`Slice updated: "${l.name}" (id: ${l.id})`)}),Or=j({name:`prismic slice edit-variation`,description:`Edit a variation of a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{"from-slice":{type:`string`,required:!0,description:`ID of the slice`},name:{type:`string`,short:`n`,description:`New name for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{"from-slice":a,screenshot:o,repo:s=await m()}=t,l=await h(),d=await D(),f=await O(),p=await i(a,{repo:s,token:d,host:f}),g=p.variations.find(e=>e.id===r);if(!g)throw new N(`Variation "${r}" not found in slice "${a}".`);if(`name`in t&&(g.name=t.name),o){let e=await we(/^https?:\/\//i.test(o)?new URL(o):We(o)),t;try{t=await u(e,{sliceId:p.id,variationId:g.id,repo:s,token:d,host:f})}catch(e){throw e instanceof n?new N(e.message):e}g.imageUrl=t.toString()}try{await c(p,{repo:s,host:f,token:d})}catch(e){throw e instanceof C?new N(`Failed to update variation: ${await e.text()}`):e}try{await l.updateSlice(p)}catch{await l.createSlice(p)}await l.generateTypes(),console.info(`Variation updated: "${r}" in slice "${a}"`)}),kr=j({name:`prismic slice list`,description:`List all slices.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:n=await m()}=e,i=await r({repo:n,token:await D(),host:await O()});if(t){console.info(T(i));return}if(i.length===0){console.info(`No slices found.`);return}let a=i.map(e=>[e.name,e.id]);console.info(v(a,{headers:[`NAME`,`ID`]}))}),Ar=j({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,a=await h(),o=await D(),s=await O(),c=await i(n,{repo:r,token:o,host:s});try{await ie(c.id,{repo:r,host:s,token:o})}catch(e){throw e instanceof C?new N(`Failed to remove slice: ${await e.text()}`):e}try{await a.deleteSlice(c.id)}catch{}await a.generateTypes(),console.info(`Slice removed: ${n}`)}),jr=j({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,repo:a=await m()}=t,o=await h(),s=await D(),l=await O(),u=await i(r,{repo:a,token:s,host:l}),d=u.variations.find(e=>e.id===n);if(!d)throw new N(`Variation "${n}" not found in slice "${r}".`);let f={...u,variations:u.variations.filter(e=>e.id!==d.id)};try{await c(f,{repo:a,host:l,token:s})}catch(e){throw e instanceof C?new N(`Failed to remove variation: ${await e.text()}`):e}try{await o.updateSlice(f)}catch{await o.createSlice(f)}await o.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),Mr=j({name:`prismic slice view`,description:`View details of a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r,repo:a=await m()}=t,o=await i(n,{repo:a,token:await D(),host:await O()});if(r){console.info(T(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.name}`);for(let e of o.variations??[]){console.info(``),console.info(`${e.id}:`);let t=Object.entries(e.primary??{});if(t.length===0)console.info(` (no fields)`);else{let e=t.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(v(e))}}}),Nr=M({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Tr,description:`Create a new slice`},edit:{handler:Dr,description:`Edit a slice`},remove:{handler:Ar,description:`Remove a slice`},list:{handler:kr,description:`List slices`},view:{handler:Mr,description:`View a slice`},connect:{handler:wr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:Er,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Cr,description:`Add a variation to a slice`},"edit-variation":{handler:Or,description:`Edit a variation of a slice`},"remove-variation":{handler:jr,description:`Remove a variation from a slice`}}});const Pr=ke.TEST?500:5e3,Fr=6e4;var Ir=j({name:`prismic sync`,description:`
117
104
  Sync content types and slices from Prismic to local files.
118
105
 
119
106
  Remote models are the source of truth. Local files are created, updated,
120
107
  or deleted to match.
121
- `,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},watch:{type:`boolean`,short:`w`,description:`Watch for changes and sync continuously`}}},async({values:e})=>{let{repo:t=await y(),watch:n}=e;if(!await ue(t,{token:await O(),host:await k()}))throw new ge;let r=await b();if(console.info(`Syncing from repository: ${t}`),hi(`sync`,{watch:n}),n)await Di(t,r);else{let e=await O(),i=await k();await r.syncModels({repo:t,token:e,host:i}),gi(`sync`,{watch:n}),console.info(`Sync complete`)}});async function Di(e,t){let n=await O(),r=await k(),i=await d({repo:e,token:n,host:r}),o=await a({repo:e,token:n,host:r});await t.syncModels({repo:e,token:n,host:r}),console.info(Ee`
108
+ `,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},watch:{type:`boolean`,short:`w`,description:`Watch for changes and sync continuously`}}},async({values:e})=>{let{repo:t=await m(),watch:n}=e;if(!await ee(t,{token:await D(),host:await O()}))throw new oe;let r=await h();if(console.info(`Syncing from repository: ${t}`),Ie(`sync`,{watch:n}),n)await Lr(t,r);else{let e=await D(),i=await O();await r.syncModels({repo:t,token:e,host:i}),k(`sync`,{watch:n}),console.info(`Sync complete`)}});async function Lr(e,t){let n=await D(),i=await O(),a=await r({repo:e,token:n,host:i}),o=await p({repo:e,token:n,host:i});await t.syncModels({repo:e,token:n,host:i}),console.info(ue`
122
109
  Initial sync completed!
123
110
 
124
- Watching for changes (polling every ${wi/1e3}s),
111
+ Watching for changes (polling every ${Pr/1e3}s),
125
112
  Press Ctrl+C to stop\n
126
- `);let s=Ai(i),c=Ai(o),l=0;for(process.on(`SIGINT`,Oi),process.on(`SIGTERM`,Oi),process.on(`SIGHUP`,Oi),process.on(`SIGQUIT`,Oi),process.platform===`win32`&&process.on(`SIGBREAK`,Oi);;){await et(ki(l));try{let i=Ai(await d({repo:e,token:n,host:r})),o=i!==s,u=Ai(await a({repo:e,token:n,host:r})),f=u!==c;if(o||f){let a=[];o&&(await t.syncSlices({repo:e,token:n,host:r,generateTypes:!1}),s=i,a.push(`slices`)),f&&(await t.syncCustomTypes({repo:e,token:n,host:r,generateTypes:!1}),c=u,a.push(`custom types`)),await t.generateTypes();let l=new Date().toLocaleTimeString();console.info(`[${l}] Changes detected in ${a.join(` and `)}`)}l=0}catch(e){l++;let t=e instanceof Error?e.message:`Unknown error`,n=Math.min(wi*2**(l-1),Ti);if(console.error(`Error checking for changes: ${t}. Retrying in ${n/1e3}s...`),l>=10)throw Error(`Too many consecutive errors (10), stopping watch.`)}}}function Oi(){console.info(`Watch stopped. Goodbye!`),gi(`sync`,{watch:!0}),process.exit(0)}function ki(e){return e===0?wi:Math.min(wi*2**(e-1),Ti)}function Ai(e){return Be(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const ji=`Prismic CLI`;var Mi=A({name:`prismic token create`,description:`
113
+ `);let s=Br(a),c=Br(o),l=0;for(process.on(`SIGINT`,Rr),process.on(`SIGTERM`,Rr),process.on(`SIGHUP`,Rr),process.on(`SIGQUIT`,Rr),process.platform===`win32`&&process.on(`SIGBREAK`,Rr);;){await tt(zr(l));try{let a=Br(await r({repo:e,token:n,host:i})),o=a!==s,u=Br(await p({repo:e,token:n,host:i})),d=u!==c;if(o||d){let r=[];o&&(await t.syncSlices({repo:e,token:n,host:i,generateTypes:!1}),s=a,r.push(`slices`)),d&&(await t.syncCustomTypes({repo:e,token:n,host:i,generateTypes:!1}),c=u,r.push(`custom types`)),await t.generateTypes();let l=new Date().toLocaleTimeString();console.info(`[${l}] Changes detected in ${r.join(` and `)}`)}l=0}catch(e){l++;let t=e instanceof Error?e.message:`Unknown error`,n=Math.min(Pr*2**(l-1),Fr);if(console.error(`Error checking for changes: ${t}. Retrying in ${n/1e3}s...`),l>=10)throw Error(`Too many consecutive errors (10), stopping watch.`)}}}function Rr(){console.info(`Watch stopped. Goodbye!`),k(`sync`,{watch:!0}),process.exit(0)}function zr(e){return e===0?Pr:Math.min(Pr*2**(e-1),Fr)}function Br(e){return Ge(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const Vr=`Prismic CLI`;var Hr=j({name:`prismic token create`,description:`
127
114
  Create a new API token for a Prismic repository.
128
115
 
129
116
  By default, this command reads the repository from prismic.config.json at the
130
117
  project root.
131
- `,options:{write:{type:`boolean`,description:`Create a write token`},"allow-releases":{type:`boolean`,description:`Allow access to releases (read tokens only)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await y(),write:n,"allow-releases":r}=e;if(n&&r)throw new M(`--allow-releases is only valid for access tokens (not with --write)`);let i=await O(),a=await k();try{if(n){let e=await Ar(ji,{repo:t,token:i,host:a});console.info(`Token created: ${e.token}`)}else{let e=r?`master+releases`:`master`,n=(await Tr({repo:t,token:i,host:a})).find(e=>e.name===ji);n||=await Er(ji,{repo:t,token:i,host:a});let o=await Dr(n.id,e,{repo:t,token:i,host:a});console.info(`Token created: ${o.token}`)}}catch(e){throw e instanceof _?new M(`Failed to create token: ${await e.text()}`):e}}),Ni=A({name:`prismic token delete`,description:`
118
+ `,options:{write:{type:`boolean`,description:`Create a write token`},"allow-releases":{type:`boolean`,description:`Allow access to releases (read tokens only)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await m(),write:n,"allow-releases":r}=e;if(n&&r)throw new N(`--allow-releases is only valid for access tokens (not with --write)`);let i=await D(),a=await O();try{if(n){let e=await ar(Vr,{repo:t,token:i,host:a});console.info(`Token created: ${e.token}`)}else{let e=r?`master+releases`:`master`,n=(await er({repo:t,token:i,host:a})).find(e=>e.name===Vr);n||=await tr(Vr,{repo:t,token:i,host:a});let o=await nr(n.id,e,{repo:t,token:i,host:a});console.info(`Token created: ${o.token}`)}}catch(e){throw e instanceof C?new N(`Failed to create token: ${await e.text()}`):e}}),Ur=j({name:`prismic token delete`,description:`
132
119
  Delete a token from a Prismic repository.
133
120
 
134
121
  By default, this command reads the repository from prismic.config.json at the
135
122
  project root.
136
- `,positionals:{token:{description:`Token value`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),o,s;try{[o,s]=await Promise.all([Tr({repo:r,token:i,host:a}),kr({repo:r,token:i,host:a})])}catch(e){throw e instanceof _?new M(`Failed to delete token: ${await e.text()}`):e}let c=o.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(c){try{await Or(c.id,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}let l=s.tokens.find(e=>e.token===n);if(l){try{await jr(l.token,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}throw new M(`Token not found: ${n}`)}),Pi=j({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:A({name:`prismic token list`,description:`
123
+ `,positionals:{token:{description:`Token value`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),o,s;try{[o,s]=await Promise.all([er({repo:r,token:i,host:a}),ir({repo:r,token:i,host:a})])}catch(e){throw e instanceof C?new N(`Failed to delete token: ${await e.text()}`):e}let c=o.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(c){try{await rr(c.id,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}let l=s.tokens.find(e=>e.token===n);if(l){try{await or(l.token,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}throw new N(`Token not found: ${n}`)}),Wr=M({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:j({name:`prismic token list`,description:`
137
124
  List all API tokens for a Prismic repository.
138
125
 
139
126
  By default, this command reads the repository from prismic.config.json at the
140
127
  project root.
141
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await y(),json:n}=e,r=await O(),a=await k(),o,s;try{[o,s]=await Promise.all([Tr({repo:t,token:r,host:a}),kr({repo:t,token:r,host:a})])}catch(e){throw e instanceof _?new M(`Failed to list tokens: ${await e.text()}`):e}let c=o.flatMap(e=>e.wroom_auths.map(t=>({name:e.name,scope:t.scope,token:t.token,createdAt:new Date(t.created_at.$date).toISOString().split(`T`)[0]}))),l=s.tokens;if(n){console.info(i({accessTokens:c,writeTokens:l}));return}if(c.length>0){console.info(`ACCESS TOKENS`);let e=c.map(e=>[` ${e.name}`,e.scope,e.token,e.createdAt]);console.info(T(e))}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),l.length>0){console.info(`WRITE TOKENS`);let e=l.map(e=>{let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];return[` ${e.app_name}`,e.token,t]});console.info(T(e))}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:Mi,description:`Create a new token`},delete:{handler:Ni,description:`Delete a token`}}}),Fi=A({name:`prismic webhook create`,description:`
128
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await m(),json:n}=e,r=await D(),i=await O(),a,o;try{[a,o]=await Promise.all([er({repo:t,token:r,host:i}),ir({repo:t,token:r,host:i})])}catch(e){throw e instanceof C?new N(`Failed to list tokens: ${await e.text()}`):e}let s=a.flatMap(e=>e.wroom_auths.map(t=>({name:e.name,scope:t.scope,token:t.token,createdAt:new Date(t.created_at.$date).toISOString().split(`T`)[0]}))),c=o.tokens;if(n){console.info(T({accessTokens:s,writeTokens:c}));return}if(s.length>0){console.info(`ACCESS TOKENS`);let e=s.map(e=>[` ${e.name}`,e.scope,e.token,e.createdAt]);console.info(v(e))}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),c.length>0){console.info(`WRITE TOKENS`);let e=c.map(e=>{let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];return[` ${e.app_name}`,e.token,t]});console.info(v(e))}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:Hr,description:`Create a new token`},delete:{handler:Ur,description:`Delete a token`}}}),Gr=j({name:`prismic type add-tab`,description:`Add a tab to a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"with-slice-zone":i,repo:a=await m()}=t,o=await h(),c=await D(),l=await O(),u=await y(r,{repo:a,token:c,host:l});if(n in u.json)throw new N(`Tab "${n}" already exists in "${r}".`);u.json[n]=i?{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}:{};try{await s(u,{repo:a,host:l,token:c})}catch(e){throw e instanceof C?new N(`Failed to add tab: ${await e.text()}`):e}try{await o.updateCustomType(u)}catch{await o.createCustomType(u)}await o.generateTypes(),console.info(`Added tab "${n}" to "${r}"`)}),Kr=j({name:`prismic type create`,description:`Create a new content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{format:{type:`string`,short:`f`,description:`Type format: "custom" (default) or "page"`},single:{type:`boolean`,short:`s`,description:`Allow only one document of this type`},id:{type:`string`,description:`Custom ID for the content type`},repo:{type:`string`,short:`r`,description:`Repository domain`}},sections:{FORMATS:`
129
+ custom A non-page type (e.g. settings, navigation, author, blog
130
+ category). This is the default.
131
+ page A page type with a URL (e.g. homepage, blog post, landing
132
+ page). Includes a slice zone and SEO & Metadata tab by
133
+ default, and configures a route in prismic.config.json.
134
+ `}},async({positionals:e,values:t})=>{let[n]=e,{format:r=`custom`,single:i=!1,id:a=d(n),repo:o=await m()}=t;if(r!==`custom`&&r!==`page`)throw new N(`Invalid format: "${r}". Use "custom" or "page".`);let s={id:a,label:n,repeatable:!i,status:!0,format:r,json:r===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}}},c=await h(),u=await D(),f=await O();try{await l(s,{repo:o,host:f,token:u})}catch(e){throw e instanceof C?new N(`Failed to create type: ${await e.text()}`):e}await c.createCustomType(s),await c.generateTypes(),console.info(`Created type "${n}" (id: "${a}", format: "${r}")`)}),qr=j({name:`prismic type edit`,description:`Edit a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the type`},format:{type:`string`,short:`f`,description:`Type format: "custom" or "page"`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t;if(`format`in t&&t.format!==`custom`&&t.format!==`page`)throw new N(`Invalid format: "${t.format}". Use "custom" or "page".`);let i=await h(),a=await D(),o=await O(),c=await y(n,{repo:r,token:a,host:o});`name`in t&&(c.label=t.name),`format`in t&&(c.format=t.format);try{await s(c,{repo:r,host:o,token:a})}catch(e){throw e instanceof C?new N(`Failed to update type: ${await e.text()}`):e}try{await i.updateCustomType(c)}catch{await i.createCustomType(c)}await i.generateTypes(),console.info(`Type updated: "${c.label}" (id: ${c.id})`)}),Jr=j({name:`prismic type edit-tab`,description:`Edit a tab of a content type.`,positionals:{name:{description:`Current name of the tab`,required:!0}},options:{"from-type":{type:`string`,required:!0,description:`ID of the content type`},name:{type:`string`,short:`n`,description:`New name for the tab`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},"without-slice-zone":{type:`boolean`,description:`Remove the slice zone from the tab`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-type":r,repo:i=await m()}=t,a=await h(),o=await D(),c=await O(),l=await y(r,{repo:i,token:o,host:c});if(!(n in l.json))throw new N(`Tab "${n}" not found in "${r}".`);if(`with-slice-zone`in t&&`without-slice-zone`in t)throw new N(`Cannot use --with-slice-zone and --without-slice-zone together.`);if(`with-slice-zone`in t){let e=l.json[n];if(Object.values(e).some(e=>e.type===`Slices`))throw new N(`Tab "${n}" already has a slice zone.`);e.slices={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}if(`without-slice-zone`in t){let e=l.json[n],t=Object.entries(e).find(([,e])=>e.type===`Slices`);if(!t)throw new N(`Tab "${n}" does not have a slice zone.`);let[r,i]=t,a=i.type===`Slices`?i.config?.choices??{}:{};if(Object.keys(a).length>0)throw new N(`Cannot remove slice zone from "${n}": disconnect all slices first.`);delete e[r]}if(`name`in t){if(t.name in l.json)throw new N(`Tab "${t.name}" already exists in "${r}".`);let e={};for(let[r,i]of Object.entries(l.json))e[r===n?t.name:r]=i;l.json=e}try{await s(l,{repo:i,host:c,token:o})}catch(e){throw e instanceof C?new N(`Failed to update tab: ${await e.text()}`):e}try{await a.updateCustomType(l)}catch{await a.createCustomType(l)}await a.generateTypes(),console.info(`Tab updated: "${n}" in "${r}"`)}),Yr=j({name:`prismic type list`,description:`List all content types.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:n=await m()}=e,r=await p({repo:n,token:await D(),host:await O()});if(t){console.info(T(r));return}if(r.length===0){console.info(`No types found.`);return}let i=r.map(e=>[e.label||`(no name)`,e.id,e.format??``]);console.info(v(i,{headers:[`NAME`,`ID`,`FORMAT`]}))}),Xr=j({name:`prismic type remove`,description:`Remove a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:t,values:n})=>{let[r]=t,{repo:i=await m()}=n,a=await h(),o=await D(),s=await O(),c=await y(r,{repo:i,token:o,host:s});try{await e(c.id,{repo:i,host:s,token:o})}catch(e){if(e instanceof C){let t=await e.text();throw t.includes(`associated documents`)?new N(`Type "${r}" has documents. Delete its documents before removing the type.`):new N(`Failed to remove type: ${t}`)}throw e}try{await a.deleteCustomType(c.id)}catch{}await a.generateTypes(),console.info(`Type removed: ${r}`)}),Zr=j({name:`prismic type remove-tab`,description:`Remove a tab from a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,repo:i=await m()}=t,a=await h(),o=await D(),c=await O(),l=await y(r,{repo:i,token:o,host:c});if(!(n in l.json))throw new N(`Tab "${n}" not found in "${r}".`);if(Object.keys(l.json).length<=1)throw new N(`Cannot remove the last tab from "${r}".`);delete l.json[n];try{await s(l,{repo:i,host:c,token:o})}catch(e){throw e instanceof C?new N(`Failed to remove tab: ${await e.text()}`):e}try{await a.updateCustomType(l)}catch{await a.createCustomType(l)}await a.generateTypes(),console.info(`Removed tab "${n}" from "${r}"`)}),Qr=j({name:`prismic type view`,description:`View details of a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r,repo:i=await m()}=t,a=await y(n,{repo:i,token:await D(),host:await O()});if(r){console.info(T(a));return}console.info(`ID: ${a.id}`),console.info(`Name: ${a.label||`(no name)`}`),console.info(`Format: ${a.format}`),console.info(`Repeatable: ${a.repeatable}`);for(let[e,t]of Object.entries(a.json)){console.info(``),console.info(`${e}:`);let n=Object.entries(t);if(n.length===0)console.info(` (no fields)`);else{let e=n.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(v(e))}}}),$r=M({name:`prismic type`,description:`Manage content types.`,commands:{create:{handler:Kr,description:`Create a new content type`},edit:{handler:qr,description:`Edit a content type`},remove:{handler:Xr,description:`Remove a content type`},list:{handler:Yr,description:`List content types`},view:{handler:Qr,description:`View a content type`},"add-tab":{handler:Gr,description:`Add a tab to a content type`},"edit-tab":{handler:Jr,description:`Edit a tab of a content type`},"remove-tab":{handler:Zr,description:`Remove a tab from a content type`}}}),ei=j({name:`prismic webhook create`,description:`
142
135
  Create a new webhook in a Prismic repository.
143
136
 
144
137
  By default, this command reads the repository from prismic.config.json at the
@@ -152,27 +145,27 @@ await Promise.allSettled([
152
145
  tagsDeleted When a tag is deleted
153
146
 
154
147
  If no triggers specified, all are enabled.
155
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y(),name:i,secret:a,trigger:o=[]}=t;for(let e of o)if(!hr.includes(e))throw new M(`Invalid trigger: ${e}\nValid triggers: ${hr.join(`, `)}`);let s=await O(),c=await k(),l=!(o.length>0);try{await vr({url:n,name:i??null,secret:a??null,documentsPublished:o.includes(`documentsPublished`)||l,documentsUnpublished:o.includes(`documentsUnpublished`)||l,releasesCreated:o.includes(`releasesCreated`)||l,releasesUpdated:o.includes(`releasesUpdated`)||l,tagsCreated:o.includes(`tagsCreated`)||l,tagsDeleted:o.includes(`tagsDeleted`)||l},{repo:r,token:s,host:c})}catch(e){throw e instanceof _?new M(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`)}),Ii=A({name:`prismic webhook disable`,description:`
148
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m(),name:i,secret:a,trigger:o=[]}=t;for(let e of o)if(!Wn.includes(e))throw new N(`Invalid trigger: ${e}\nValid triggers: ${Wn.join(`, `)}`);let s=await D(),c=await O(),l=!(o.length>0);try{await qn({url:n,name:i??null,secret:a??null,documentsPublished:o.includes(`documentsPublished`)||l,documentsUnpublished:o.includes(`documentsUnpublished`)||l,releasesCreated:o.includes(`releasesCreated`)||l,releasesUpdated:o.includes(`releasesUpdated`)||l,tagsCreated:o.includes(`tagsCreated`)||l,tagsDeleted:o.includes(`tagsDeleted`)||l},{repo:r,token:s,host:c})}catch(e){throw e instanceof C?new N(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`)}),ti=j({name:`prismic webhook disable`,description:`
156
149
  Disable a webhook in a Prismic repository.
157
150
 
158
151
  By default, this command reads the repository from prismic.config.json at the
159
152
  project root.
160
- `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),o;try{o=await _r({repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to disable webhook: ${await e.text()}`):e}let s=o.find(e=>e.config.url===n);if(!s)throw new M(`Webhook not found: ${n}`);if(!s.config.active){console.info(`Webhook already disabled: ${n}`);return}let c=s.config._id,l=structuredClone(s.config);l.active=!1;try{await yr(c,l,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),Li=A({name:`prismic webhook enable`,description:`
153
+ `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),o;try{o=await Kn({repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to disable webhook: ${await e.text()}`):e}let s=o.find(e=>e.config.url===n);if(!s)throw new N(`Webhook not found: ${n}`);if(!s.config.active){console.info(`Webhook already disabled: ${n}`);return}let c=s.config._id,l=structuredClone(s.config);l.active=!1;try{await Jn(c,l,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),ni=j({name:`prismic webhook enable`,description:`
161
154
  Enable a webhook in a Prismic repository.
162
155
 
163
156
  By default, this command reads the repository from prismic.config.json at the
164
157
  project root.
165
- `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),o;try{o=await _r({repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to enable webhook: ${await e.text()}`):e}let s=o.find(e=>e.config.url===n);if(!s)throw new M(`Webhook not found: ${n}`);if(s.config.active){console.info(`Webhook already enabled: ${n}`);return}let c=s.config._id,l=structuredClone(s.config);l.active=!0;try{await yr(c,l,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),Ri=A({name:`prismic webhook list`,description:`
158
+ `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),o;try{o=await Kn({repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to enable webhook: ${await e.text()}`):e}let s=o.find(e=>e.config.url===n);if(!s)throw new N(`Webhook not found: ${n}`);if(s.config.active){console.info(`Webhook already enabled: ${n}`);return}let c=s.config._id,l=structuredClone(s.config);l.active=!0;try{await Jn(c,l,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),ri=j({name:`prismic webhook list`,description:`
166
159
  List all webhooks in a Prismic repository.
167
160
 
168
161
  By default, this command reads the repository from prismic.config.json at the
169
162
  project root.
170
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await y(),json:n}=e,r=await O(),a=await k(),o;try{o=await _r({repo:t,token:r,host:a})}catch(e){throw e instanceof _?new M(`Failed to list webhooks: ${await e.text()}`):e}if(n){console.info(i(o.map(e=>e.config)));return}if(o.length===0){console.info(`No webhooks configured.`);return}let s=o.map(e=>{let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;return[`${e.config.url}${n}`,`[${t}]`]});console.info(T(s,{headers:[`URL`,`STATUS`]}))}),zi=A({name:`prismic webhook remove`,description:`
163
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await m(),json:n}=e,r=await D(),i=await O(),a;try{a=await Kn({repo:t,token:r,host:i})}catch(e){throw e instanceof C?new N(`Failed to list webhooks: ${await e.text()}`):e}if(n){console.info(T(a.map(e=>e.config)));return}if(a.length===0){console.info(`No webhooks configured.`);return}let o=a.map(e=>{let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;return[`${e.config.url}${n}`,`[${t}]`]});console.info(v(o,{headers:[`URL`,`STATUS`]}))}),ii=j({name:`prismic webhook remove`,description:`
171
164
  Delete a webhook from a Prismic repository.
172
165
 
173
166
  By default, this command reads the repository from prismic.config.json at the
174
167
  project root.
175
- `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),o;try{o=await _r({repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to remove webhook: ${await e.text()}`):e}let s=o.find(e=>e.config.url===n);if(!s)throw new M(`Webhook not found: ${n}`);let c=s.config._id;try{await br(c,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),Bi=A({name:`prismic webhook set-triggers`,description:`
168
+ `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),o;try{o=await Kn({repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to remove webhook: ${await e.text()}`):e}let s=o.find(e=>e.config.url===n);if(!s)throw new N(`Webhook not found: ${n}`);let c=s.config._id;try{await Yn(c,{repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),ai=j({name:`prismic webhook set-triggers`,description:`
176
169
  Update which events trigger a webhook.
177
170
 
178
171
  By default, this command reads the repository from prismic.config.json at the
@@ -184,30 +177,17 @@ await Promise.allSettled([
184
177
  releasesUpdated When a release is edited or deleted
185
178
  tagsCreated When a tag is created
186
179
  tagsDeleted When a tag is deleted
187
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y(),trigger:i=[]}=t;for(let e of i)if(!hr.includes(e))throw new M(`Invalid trigger: ${e}\nValid triggers: ${hr.join(`, `)}`);let a=await O(),o=await k(),s;try{s=await _r({repo:r,token:a,host:o})}catch(e){throw e instanceof _?new M(`Failed to update webhook triggers: ${await e.text()}`):e}let c=s.find(e=>e.config.url===n);if(!c)throw new M(`Webhook not found: ${n}`);let l=c.config._id;try{await yr(l,{...c.config,documentsPublished:i.includes(`documentsPublished`),documentsUnpublished:i.includes(`documentsUnpublished`),releasesCreated:i.includes(`releasesCreated`),releasesUpdated:i.includes(`releasesUpdated`),tagsCreated:i.includes(`tagsCreated`),tagsDeleted:i.includes(`tagsDeleted`)},{repo:r,token:a,host:o})}catch(e){throw e instanceof _?new M(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${i.join(`, `)}`)}),Vi=A({name:`prismic webhook view`,description:`
180
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m(),trigger:i=[]}=t;for(let e of i)if(!Wn.includes(e))throw new N(`Invalid trigger: ${e}\nValid triggers: ${Wn.join(`, `)}`);let a=await D(),o=await O(),s;try{s=await Kn({repo:r,token:a,host:o})}catch(e){throw e instanceof C?new N(`Failed to update webhook triggers: ${await e.text()}`):e}let c=s.find(e=>e.config.url===n);if(!c)throw new N(`Webhook not found: ${n}`);let l=c.config._id;try{await Jn(l,{...c.config,documentsPublished:i.includes(`documentsPublished`),documentsUnpublished:i.includes(`documentsUnpublished`),releasesCreated:i.includes(`releasesCreated`),releasesUpdated:i.includes(`releasesUpdated`),tagsCreated:i.includes(`tagsCreated`),tagsDeleted:i.includes(`tagsDeleted`)},{repo:r,token:a,host:o})}catch(e){throw e instanceof C?new N(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${i.join(`, `)}`)}),oi=j({name:`prismic webhook view`,description:`
188
181
  View details of a webhook in a Prismic repository.
189
182
 
190
183
  By default, this command reads the repository from prismic.config.json at the
191
184
  project root.
192
- `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await y()}=t,i=await O(),a=await k(),o;try{o=await _r({repo:r,token:i,host:a})}catch(e){throw e instanceof _?new M(`Failed to fetch webhook details: ${await e.text()}`):e}let s=o.find(e=>e.config.url===n);if(!s)throw new M(`Webhook not found: ${n}`);let{config:c}=s;console.info(`URL: ${c.url}`),console.info(`Name: ${c.name||`(none)`}`),console.info(`Status: ${c.active?`enabled`:`disabled`}`),console.info(`Secret: ${c.secret?`(set)`:`(none)`}`);let l=[];for(let e of hr)c[e]&&l.push(e);if(console.info(`Triggers: ${l.length>0?l.join(`, `):`(none)`}`),Object.keys(c.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(c.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),Hi=j({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:Ri,description:`List all webhooks`},create:{handler:Fi,description:`Create a new webhook`},view:{handler:Vi,description:`View webhook details`},remove:{handler:zi,description:`Delete a webhook`},enable:{handler:Li,description:`Enable a webhook`},disable:{handler:Ii,description:`Disable a webhook`},"set-triggers":{handler:Bi,description:`Update webhook triggers`}}}),Ui=A({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await f({token:await O(),host:await k()});console.info(e.email)});const L=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,R=globalThis,Wi=`10.42.0`;function z(){return Gi(R),R}function Gi(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Wi,t[Wi]=t[Wi]||{}}function Ki(e,t,n=R){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[Wi]=r[Wi]||{};return i[e]||(i[e]=t())}const qi=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Ji={};function B(e){if(!(`console`in R))return e();let t=R.console,n={},r=Object.keys(Ji);r.forEach(e=>{let r=Ji[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Yi(){na().enabled=!0}function Xi(){na().enabled=!1}function Zi(){return na().enabled}function Qi(...e){ta(`log`,...e)}function $i(...e){ta(`warn`,...e)}function ea(...e){ta(`error`,...e)}function ta(e,...t){L&&Zi()&&B(()=>{R.console[e](`Sentry Logger [${e}]:`,...t)})}function na(){return L?Ki(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const V={enable:Yi,disable:Xi,isEnabled:Zi,log:Qi,warn:$i,error:ea},ra=/\(error: (.*)\)/,ia=/captureMessage|captureException/;function aa(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
193
- `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=ra.test(n)?n.replace(ra,`$1`):n;if(!o.match(/\S*Error: /)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=50+r)break}}return sa(i.slice(r))}}function oa(e){return Array.isArray(e)?aa(...e):e}function sa(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(ca(t).function||``)&&t.pop(),t.reverse(),ia.test(ca(t).function||``)&&(t.pop(),ia.test(ca(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||ca(t).filename,function:e.function||`?`}))}function ca(e){return e[e.length-1]||{}}const la=`<anonymous>`;function ua(e){try{return!e||typeof e!=`function`?la:e.name||la}catch{return la}}function da(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function fa(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const pa={},ma={};function ha(e,t){pa[e]=pa[e]||[],pa[e].push(t)}function ga(e,t){if(!ma[e]){ma[e]=!0;try{t()}catch(t){L&&V.error(`Error while instrumenting ${e}`,t)}}}function _a(e,t){let n=e&&pa[e];if(n)for(let r of n)try{r(t)}catch(t){L&&V.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${ua(r)}\nError:`,t)}}let va=null;function ya(e){let t=`error`;ha(t,e),ga(t,ba)}function ba(){va=R.onerror,R.onerror=function(e,t,n,r,i){return _a(`error`,{column:r,error:i,line:n,msg:e,url:t}),va?va.apply(this,arguments):!1},R.onerror.__SENTRY_INSTRUMENTED__=!0}let xa=null;function Sa(e){let t=`unhandledrejection`;ha(t,e),ga(t,Ca)}function Ca(){xa=R.onunhandledrejection,R.onunhandledrejection=function(e){return _a(`unhandledrejection`,e),xa?xa.apply(this,arguments):!0},R.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const wa=Object.prototype.toString;function Ta(e){switch(wa.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return La(e,Error)}}function Ea(e,t){return wa.call(e)===`[object ${t}]`}function Da(e){return Ea(e,`ErrorEvent`)}function Oa(e){return Ea(e,`String`)}function ka(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function Aa(e){return e===null||ka(e)||typeof e!=`object`&&typeof e!=`function`}function ja(e){return Ea(e,`Object`)}function Ma(e){return typeof Event<`u`&&La(e,Event)}function Na(e){return typeof Element<`u`&&La(e,Element)}function Pa(e){return Ea(e,`RegExp`)}function Fa(e){return!!(e?.then&&typeof e.then==`function`)}function Ia(e){return ja(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function La(e,t){try{return e instanceof t}catch{return!1}}function Ra(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const za=R;function Ba(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=[],i=0,a=0,o,s=Array.isArray(t)?t:t.keyAttrs,c=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&i++<5&&(o=Va(n,s),!(o===`html`||i>1&&a+r.length*3+o.length>=c));)r.push(o),a+=o.length,n=n.parentNode;return r.reverse().join(` > `)}catch{return`<unknown>`}}function Va(e,t){let n=e,r=[];if(!n?.tagName)return``;if(za.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let i=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let e=n.className;if(e&&Oa(e)){let t=e.split(/\s+/);for(let e of t)r.push(`.${e}`)}}for(let e of[`aria-label`,`type`,`name`,`title`,`alt`]){let t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join(``)}function Ha(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Wa(i,r);try{e[t]=i}catch{L&&V.log(`Failed to replace method "${t}" in object`,e)}}function Ua(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{L&&V.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Wa(e,t){try{e.prototype=t.prototype=t.prototype||{},Ua(e,`__sentry_original__`,t)}catch{}}function Ga(e){return e.__sentry_original__}function Ka(e){if(Ta(e))return{message:e.message,name:e.name,stack:e.stack,...Ja(e)};if(Ma(e)){let t={type:e.type,target:qa(e.target),currentTarget:qa(e.currentTarget),...Ja(e)};return typeof CustomEvent<`u`&&La(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function qa(e){try{return Na(e)?Ba(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Ja(e){if(typeof e==`object`&&e){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function Ya(e){let t=Object.keys(Ka(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let Xa;function Za(e){if(Xa!==void 0)return Xa?Xa(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=R;return t in n&&typeof n[t]==`function`?(Xa=n[t],Xa(e)):(Xa=null,e())}function H(){return Za(()=>Math.random())}function Qa(){return Za(()=>Date.now())}function $a(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function eo(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,r);return a>r-5&&(a=r),a===r&&(i=Math.max(a-140,0)),n=n.slice(i,a),i>0&&(n=`'{snip} ${n}`),a<r&&(n+=` {snip}`),n}function to(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{Ra(r)?n.push(da(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function no(e,t,n=!1){return Oa(e)?Pa(t)?t.test(e):Oa(t)?n?e===t:e.includes(t):!1:!1}function ro(e,t=[],n=!1){return t.some(t=>no(e,t,n))}function io(){let e=R;return e.crypto||e.msCrypto}let ao;function oo(){return H()*16}function U(e=io()){try{if(e?.randomUUID)return Za(()=>e.randomUUID()).replace(/-/g,``)}catch{}return ao||=`10000000100040008000100000000000`,ao.replace(/[018]/g,e=>(e^(oo()&15)>>e/4).toString(16))}function so(e){return e.exception?.values?.[0]}function co(e){let{message:t,event_id:n}=e;if(t)return t;let r=so(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function lo(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function uo(e,t){let n=so(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}const fo=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function po(e){return parseInt(e||``,10)}function mo(e){let t=e.match(fo)||[],n=po(t[1]),r=po(t[2]),i=po(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:t[4]}}function ho(e){if(go(e))return!0;try{Ua(e,`__sentry_captured__`,!0)}catch{}return!1}function go(e){try{return e.__sentry_captured__}catch{}}const _o=1e3;function vo(){return Qa()/_o}function yo(){let{performance:e}=R;if(!e?.now||!e.timeOrigin)return vo;let t=e.timeOrigin;return()=>(t+Za(()=>e.now()))/_o}let bo;function xo(){return(bo??=yo())()}function So(e){let t=xo(),n={sid:U(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>To(n)};return e&&Co(n,e),n}function Co(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||xo(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:U()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function wo(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),Co(e,n)}function To(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Eo(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=Eo(r[e],t[e],n-1));return r}function Do(){return U()}function Oo(){return U().substring(16)}const ko=`_sentrySpan`;function Ao(e,t){t?Ua(e,ko,t):delete e[ko]}function jo(e){return e[ko]}var Mo=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Do(),sampleRand:H()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Ao(t,jo(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Co(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof e?n.getScopeData():ja(n)?t:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Ao(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Do(),sampleRand:H()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:vo(),...e,message:e.message?$a(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:jo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Eo(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||U();if(!this._client)return L&&V.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n?.event_id||U();if(!this._client)return L&&V.warn(`No client configured on scope - will not capture message!`),r;let i=n?.syntheticException??Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=e.event_id||t?.event_id||U();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(L&&V.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function No(){return Ki(`defaultCurrentScope`,()=>new Mo)}function Po(){return Ki(`defaultIsolationScope`,()=>new Mo)}var Fo=class{constructor(e,t){let n;n=e||new Mo;let r;r=t||new Mo,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return Fa(n)?n.then(e=>(this._popScope(),e),e=>{throw this._popScope(),e}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Io(){let e=Gi(z());return e.stack=e.stack||new Fo(No(),Po())}function Lo(e){return Io().withScope(e)}function Ro(e,t){let n=Io();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function zo(e){return Io().withScope(()=>e(Io().getIsolationScope()))}function Bo(){return{withIsolationScope:zo,withScope:Lo,withSetScope:Ro,withSetIsolationScope:(e,t)=>zo(t),getCurrentScope:()=>Io().getScope(),getIsolationScope:()=>Io().getIsolationScope()}}function Vo(e){let t=Gi(z());t.acs=e}function W(e){let t=Gi(e);return t.acs?t.acs:Bo()}function G(){return W(z()).getCurrentScope()}function K(){return W(z()).getIsolationScope()}function Ho(){return Ki(`globalScope`,()=>new Mo)}function Uo(...e){let t=W(z());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Wo(...e){let t=W(z());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function q(){return G().getClient()}function Go(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Oo()};return n&&(i.parent_span_id=n),i}const Ko=`sentry.profile_id`,qo=`sentry.exclusive_time`;function Jo(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function Yo(e){let t=e;return{scope:t._sentryScope,isolationScope:Jo(t._sentryIsolationScope)}}const Xo=/^sentry-/;function Zo(e){let t=$o(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(Xo)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Qo(e){if(e)return ts(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function $o(e){if(!(!e||!Oa(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=es(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):es(e)}function es(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}function ts(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((e,[t,n],r)=>{let i=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,a=r===0?i:`${e},${i}`;return a.length>8192?(L&&V.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const ns=/^o(\d+)\./,rs=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function is(e){return e===`http`||e===`https`}function as(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function os(e){let t=rs.exec(e);if(!t){B(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,s=``]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return ss({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function ss(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function cs(e){if(!L)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(V.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?is(r)?t&&isNaN(parseInt(t,10))?(V.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(V.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(V.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function ls(e){return e.match(ns)?.[1]}function us(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=ls(n)),r}function ds(e){let t=typeof e==`string`?os(e):ss(e);if(!(!t||!cs(t)))return t}function fs(e){if(typeof e==`boolean`)return Number(e);let t=typeof e==`string`?parseFloat(e):e;if(!(typeof t!=`number`||isNaN(t)||t<0||t>1))return t}const ps=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function ms(e){if(!e)return;let t=e.match(ps);if(!t)return;let n;return t[3]===`1`?n=!0:t[3]===`0`&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function hs(e,t){let n=ms(e),r=Zo(t);if(!n?.traceId)return{traceId:Do(),sampleRand:H()};let i=vs(n,r);r&&(r.sample_rand=i.toString());let{traceId:a,parentSpanId:o,parentSampled:s}=n;return{traceId:a,parentSpanId:o,sampled:s,dsc:r||{},sampleRand:i}}function gs(e=Do(),t=Oo(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function _s(e=Do(),t=Oo(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function vs(e,t){let n=fs(t?.sample_rand);if(n!==void 0)return n;let r=fs(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?H()*r:r+H()*(1-r):H()}function ys(e,t){let n=us(e);return t&&n&&t!==n?(V.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):e.getOptions().strictTraceContinuation&&(t&&!n||!t&&n)?(V.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${n})`),!1):!0}let bs=!1;function xs(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Ds(e).parent_span_id,a=Yo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Oo():t,trace_id:n}}function Ss(e){let{traceId:t,spanId:n}=e.spanContext();return gs(t,n,As(e))}function Cs(e){let{traceId:t,spanId:n}=e.spanContext();return _s(t,n,As(e))}function ws(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function Ts(e){return typeof e==`number`?Es(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Es(e.getTime()):xo()}function Es(e){return e>9999999999?e/1e3:e}function Ds(e){if(ks(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Os(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0,start_timestamp:Ts(i),timestamp:Ts(o)||void 0,status:js(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:ws(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Os(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function ks(e){return typeof e.getSpanJSON==`function`}function As(e){let{traceFlags:t}=e.spanContext();return t===1}function js(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function Ms(e){return e._sentryRootSpan||e}function Ns(){let e=W(z());return e.getActiveSpan?e.getActiveSpan():jo(G())}function Ps(){bs||=(B(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let Fs=!1;function Is(){if(Fs)return;function e(){let e=Ns(),t=e&&Ms(e);if(t){let e=`internal_error`;L&&V.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,Fs=!0,ya(e),Sa(e)}function Ls(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||q()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Rs(e){V.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function zs(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(Vs(n)){if(no(e.description,n))return L&&Rs(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?no(e.description,n.name):!0,r=n.op?e.op&&no(e.op,n.op):!0;if(t&&r)return L&&Rs(e),!0}return!1}function Bs(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function Vs(e){return typeof e==`string`||e instanceof RegExp}const Hs=`production`;function Us(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Hs,release:n.release,public_key:r,trace_id:e,org_id:us(t)};return t.emit(`createDsc`,i),i}function Ws(e,t){let n=t.getPropagationContext();return n.dsc||Us(n.traceId,e)}function Gs(e){let t=q();if(!t)return{};let n=Ms(e),r=Ds(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n._frozenDsc;if(c)return s(c);let l=a?.get(`sentry.dsc`),u=l&&Zo(l);if(u)return s(u);let d=Us(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),Ls()&&(d.sampled=String(As(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??Yo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function J(e,t=100,n=1/0){try{return qs(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Ks(e,t=3,n=100*1024){let r=J(e,t);return Zs(r)>n?Ks(e,t-1,n):r}function qs(e,t,n=1/0,r=1/0,i=Qs()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Js(e,t);if(!s.startsWith(`[object `))return s;if(t.__sentry_skip_normalization__)return t;let c=typeof t.__sentry_override_normalization_depth__==`number`?t.__sentry_override_normalization_depth__:n;if(c===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let l=t;if(l&&typeof l.toJSON==`function`)try{return qs(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Ka(t);for(let e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(d>=r){u[e]=`[MaxProperties ~]`;break}let t=f[e];u[e]=qs(e,t,c-1,r,i),d++}return o(t),u}function Js(e,t){try{if(e===`domain`&&t&&typeof t==`object`&&t._events)return`[Domain]`;if(e===`domainEmitter`)return`[DomainEmitter]`;if(typeof global<`u`&&t===global)return`[Global]`;if(typeof window<`u`&&t===window)return`[Window]`;if(typeof document<`u`&&t===document)return`[Document]`;if(Ra(t))return da(t);if(Ia(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${ua(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=Ys(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function Ys(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Xs(e){return~-encodeURI(e).split(/%..|./).length}function Zs(e){return Xs(JSON.stringify(e))}function Qs(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}function $s(e,t=[]){return[e,t]}function ec(e,t){let[n,r]=e;return[n,[...r,t]]}function tc(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function nc(e,t){return tc(e,(e,n)=>t.includes(n))}function rc(e){let t=Gi(R);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function ic(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[rc(r),e]:r.push(typeof e==`string`?rc(e):e)}for(let e of n){let[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(J(n))}i(e)}}return typeof r==`string`?r:ac(r)}function ac(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function oc(e){let t=typeof e.data==`string`?rc(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const sc={session:`session`,sessions:`session`,attachment:`attachment`,transaction:`transaction`,event:`error`,client_report:`internal`,user_report:`default`,profile:`profile`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,feedback:`feedback`,span:`span`,raw_security:`security`,log:`log_item`,metric:`metric`,trace_metric:`metric`};function cc(e){return sc[e]}function lc(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function uc(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:as(r)},...i&&{trace:i}}}function dc(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function fc(e,t,n,r){let i=lc(n);return $s({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:as(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function pc(e,t,n,r){let i=lc(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;dc(e,n?.sdk);let o=uc(e,i,r,t);return delete e.sdkProcessingMetadata,$s(o,[[{type:a},e]])}const mc=`__SENTRY_SUPPRESS_TRACING__`,hc=(e,t)=>{let n=W(z());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=q(),o=Zo(i);return a&&!ys(a,o?.org_id)?vc(t):Uo(e=>{let n=hs(r,i);return e.setPropagationContext(n),Ao(e,void 0),t()})};function gc(e,t){let n=yc();return n.withActiveSpan?n.withActiveSpan(e,t):Uo(n=>(Ao(n,e||void 0),t(n)))}function _c(e){let t=yc();return t.suppressTracing?t.suppressTracing(e):Uo(t=>{t.setSDKProcessingMetadata({[mc]:!0});let n=e();return t.setSDKProcessingMetadata({[mc]:void 0}),n})}function vc(e){return Uo(t=>(t.setPropagationContext({traceId:Do(),sampleRand:H()}),L&&V.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),gc(null,e)))}function yc(){return W(z())}function bc(e){return new Sc(t=>{t(e)})}function xc(e){return new Sc((t,n)=>{n(e)})}var Sc=class e{constructor(e){this._state=0,this._handlers=[],this._runExecutor(e)}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}_executeHandlers(){if(this._state===0)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===1&&e[1](this._value),this._state===2&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===0){if(Fa(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}};function Cc(e,t,n,r=0){try{let i=wc(t,n,e,r);return Fa(i)?i:bc(i)}catch(e){return xc(e)}}function wc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return L&&a===null&&V.log(`Event processor "${i.id||`?`}" dropped event`),Fa(a)?a.then(e=>wc(e,t,n,r+1)):wc(a,t,n,r+1)}let Tc,Ec,Dc,Y;function Oc(e){let t=R._sentryDebugIds,n=R._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Y&&r.length===Ec&&i.length===Dc)return Y;Ec=r.length,Dc=i.length,Y={},Tc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Tc?.[r];if(i&&Y&&t)Y[i[0]]=t,Tc&&(Tc[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&Y&&Tc){Y[i]=t,Tc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Y}function kc(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Nc(e,t),r&&Ic(e,r),Lc(e,n),Pc(e,i),Fc(e,a)}function Ac(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;jc(e,`extra`,n),jc(e,`tags`,r),jc(e,`attributes`,i),jc(e,`user`,a),jc(e,`contexts`,o),e.sdkProcessingMetadata=Eo(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function jc(e,t,n){e[t]=Eo(e[t],n,1)}function Mc(e,t){let n=Ho().getScopeData();return e&&Ac(n,e.getScopeData()),t&&Ac(n,t.getScopeData()),n}function Nc(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function Pc(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Fc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Ic(e,t){e.contexts={trace:xs(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Gs(t),...e.sdkProcessingMetadata};let n=Ds(Ms(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Lc(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function Rc(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||U(),timestamp:t.timestamp||vo()},l=n.integrations||e.integrations.map(e=>e.name);zc(c,e),Hc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Bc(c,e.stackParser);let u=Wc(r,n.captureContext);n.mechanism&&uo(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Mc(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),kc(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?bc(c):Cc(m,c,n)).then(e=>(e&&Vc(e),typeof o==`number`&&o>0?Uc(e,o,s):e))}function zc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||Hs,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=$a(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=$a(e.value,a)})}function Bc(e,t){let n=Oc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Vc(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function Hc(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Uc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:J(e.data,t,n)}}))},...e.user&&{user:J(e.user,t,n)},...e.contexts&&{contexts:J(e.contexts,t,n)},...e.extra&&{extra:J(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=J(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:J(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=J(e.contexts.flags,3,n)),r}function Wc(e,t){if(!t)return e;let n=e?e.clone():new Mo;return n.update(t),n}function Gc(e){if(e)return Kc(e)||Jc(e)?{captureContext:e}:e}function Kc(e){return e instanceof Mo||typeof e==`function`}const qc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Jc(e){return Object.keys(e).some(e=>qc.includes(e))}function Yc(e,t){return G().captureException(e,Gc(t))}function Xc(e,t){K().setContext(e,t)}function Zc(e,t){K().setTag(e,t)}function Qc(e){K().setUser(e)}async function $c(e){let t=q();return t?t.flush(e):(L&&V.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function el(){let e=q();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function tl(e){let t=K(),{user:n}=Mc(t,G()),{userAgent:r}=R.navigator||{},i=So({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&Co(a,{status:`exited`}),nl(),t.setSession(i),i}function nl(){let e=K(),t=G().getSession()||e.getSession();t&&wo(t),rl(),e.setSession()}function rl(){let e=K(),t=q(),n=e.getSession();n&&t&&t.captureSession(n)}function il(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function al(e){return`${il(e)}${e.projectId}/envelope/`}function ol(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function sl(e,t,n){return t||`${al(e)}?${ol(e,n)}`}const cl=[];function ll(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function ul(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return ll(r)}function dl(e,t){let n={};return t.forEach(t=>{t&&pl(e,t,n)}),n}function fl(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function pl(e,t,n){if(n[t.name]){L&&V.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!cl.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),cl.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}L&&V.log(`Integration installed: ${t.name}`)}function X(e){return e}function ml(e,t){return t?Uo(t,()=>{let n=Ns(),r=n?xs(n):Go(t);return[n?Gs(n):Ws(e,t),r]}):[void 0,void 0]}function hl(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function gl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=as(r)),$s(i,[hl(e)])}function _l(e,t){let n=t??vl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=gl(n,r._metadata,r.tunnel,e.getDsn());yl().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function vl(e){return yl().get(e)}function yl(){return Ki(`clientToLogBufferMap`,()=>new WeakMap)}function bl(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function xl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=as(r)),$s(i,[bl(e)])}function Sl(e,t){let n=t??Cl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=xl(n,r._metadata,r.tunnel,e.getDsn());wl().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Cl(e){return wl().get(e)}function wl(){return Ki(`clientToMetricBufferMap`,()=>new WeakMap)}function Tl(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const El=Symbol.for(`SentryBufferFullError`);function Dl(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return xc(El);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return bc(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Tl(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function Ol(e,t=Qa()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function kl(e,t){return e[t]||e.all||0}function Al(e,t,n=Qa()){return kl(e,t)>n}function jl(e,{statusCode:t,headers:n},r=Qa()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+Ol(o,r):t===429&&(i.all=r+60*1e3);return i}function Ml(e,t,n=Dl(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(tc(i,(t,n)=>{let i=cc(n);Al(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=$s(i[0],a),s=t=>{if(nc(o,[`client_report`])){L&&V.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}tc(o,(n,r)=>{e.recordDroppedEvent(t,cc(r))})};return n.add(()=>t({body:ic(o)}).then(e=>e.statusCode===413?(L&&V.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(L&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&V.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=jl(r,e),e),e=>{throw s(`network_error`),L&&V.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===El)return L&&V.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Nl(e,t,n){let r=[{type:`client_report`},{timestamp:n||vo(),discarded_events:e}];return $s(t?{dsn:t}:{},[r])}function Pl(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function Fl(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[Ko],exclusive_time:o?.[qo],measurements:e.measurements,is_segment:!0}}function Il(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[Ko]:e.profile_id},...e.exclusive_time&&{[qo]:e.exclusive_time}}}},measurements:e.measurements}}const Ll=`Not capturing exception because it's already been captured.`,Rl=`Discarded session because of missing or non-string release`,zl=Symbol.for(`SentryInternalError`),Bl=Symbol.for(`SentryDoNotSendEventError`);function Vl(e){return{message:e,[zl]:!0}}function Hl(e){return{message:e,[Bl]:!0}}function Ul(e){return!!e&&typeof e==`object`&&zl in e}function Wl(e){return!!e&&typeof e==`object`&&Bl in e}function Gl(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{a+=r(t),a>=8e5?i(e):s||(s=!0,o=Tl(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var Kl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Dl(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=ds(e.dsn):L&&V.warn(`No DSN provided, client will not send events.`),this._dsn){let t=sl(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&Gl(this,`afterCaptureLog`,`flushLogs`,$l,_l),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Gl(this,`afterCaptureMetric`,`flushMetrics`,Ql,Sl)}captureException(e,t,n){let r=U();if(ho(e))return L&&V.log(Ll),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:U(),...n},a=ka(e)?e:String(e),o=Aa(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=U();if(t?.originalException&&ho(t.originalException))return L&&V.log(Ll),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=ql(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),Co(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(!t)return!0;this.emit(`flush`);let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){_l(this);let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let t=this._integrations[e.name];pl(this,e,this._integrations),t||fl(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=pc(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=ec(n,oc(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=Hs}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){L&&V.warn(Rl);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){L&&V.warn(Rl);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=fc(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;L&&V.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return L&&V.error(`Error while sending envelope:`,e),{}}return L&&V.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=dl(this,e),fl(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(Co(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a?.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Rc(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:Go(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ws(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=G(),r=K()){return L&&Xl(e)&&V.log(`Captured error event \`${Pl(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{L&&(Wl(e)?V.log(e.message):Ul(e)?V.warn(e.message):V.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Zl(e),s=Xl(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:fs(a);if(s&&typeof l==`number`&&H()>l)return this.recordDroppedEvent(`sample_rate`,`error`),xc(Hl(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=ql(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Hl("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:Jl(Yl(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Hl(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw Wl(e)||Ul(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Vl(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===El&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){L&&V.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){L&&V.log(`No outcomes to send`);return}if(!this._dsn){L&&V.log(`No dsn provided, will not send outcomes`);return}L&&V.log(`Sending outcomes:`,e);let t=Nl(e,this._options.tunnel&&as(this._dsn));this.sendEnvelope(t)}};function ql(e){return e===`replay_event`?`replay`:e||`error`}function Jl(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Fa(e))return e.then(e=>{if(!ja(e)&&e!==null)throw Vl(n);return e},e=>{throw Vl(`${t} rejected with ${e}`)});if(!ja(e)&&e!==null)throw Vl(n);return e}function Yl(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(Xl(c)&&i)return i(c,r);if(Zl(c)){if(o||s){let t=Fl(c);if(s?.length&&zs(t,s))return null;if(o){let e=o(t);e?c=Eo(n,Il(e)):Ps()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&zs(e,s)){Bs(n,e);continue}if(o){let n=o(e);n?t.push(n):(Ps(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function Xl(e){return e.type===void 0}function Zl(e){return e.type===`transaction`}function Ql(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+eu(e.attributes)}function $l(e){let t=0;return e.message&&(t+=e.message.length*2),t+eu(e.attributes)}function eu(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*tu(e[0]):Aa(e)?t+=tu(e):t+=100}),t}function tu(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function nu(e,t,n,r,i){let a={sent_at:new Date().toISOString()};return n?.sdk&&(a.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(a.dsn=as(i)),t&&(a.trace=t),$s(a,[ru(e)])}function ru(e){return[{type:`check_in`},e]}function iu(e){let t=e._metadata?.sdk,n=t?.name&&t?.version?`${t?.name}/${t?.version}`:void 0;e.transportOptions={...e.transportOptions,headers:{...n&&{"user-agent":n},...e.transportOptions?.headers}}}function au(e,t){return e(t.stack||``,1)}function ou(e){return Ta(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function su(e){return ou(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function cu(e,t){let n={type:t.name||t.constructor.name,value:su(t)},r=au(e,t);return r.length&&(n.stacktrace={frames:r}),n}function lu(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function uu(e){if(`name`in e&&typeof e.name==`string`){let t=`'${e.name}' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message '${e.message}'`),t}else if(`message`in e&&typeof e.message==`string`)return e.message;let t=Ya(e);if(Da(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=du(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function du(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function fu(e,t,n,r){if(Ta(n))return[n,void 0];if(t.synthetic=!0,ja(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:Ks(n,t)},a=lu(n);if(a)return[a,i];let o=uu(n),s=r?.syntheticException||Error(o);return s.message=o,[s,i]}let i=r?.syntheticException||Error(n);return i.message=`${n}`,[i,void 0]}function pu(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=fu(e,i,n,r),s={exception:{values:[cu(t,a)]}};return o&&(s.extra=o),lo(s,void 0,void 0),uo(s,i),{...s,event_id:r?.event_id}}function mu(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=au(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},uo(a,{synthetic:!0}))}if(ka(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return a.logentry={message:e,params:n},a}return a.message=t,a}var hu=class extends Kl{constructor(e){Is(),iu(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=pu(this,this._options.stackParser,e,t);return n.level=`error`,bc(n)}eventFromMessage(e,t=`info`,n){return bc(mu(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return gu(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&gu(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:U();if(!this._isEnabled())return L&&V.warn(`SDK not enabled, will not capture check-in.`),r;let{release:i,environment:a,tunnel:o}=this.getOptions(),s={check_in_id:r,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};`duration`in e&&(s.duration=e.duration),t&&(s.monitor_config={schedule:t.schedule,checkin_margin:t.checkinMargin,max_runtime:t.maxRuntime,timezone:t.timezone,failure_issue_threshold:t.failureIssueThreshold,recovery_threshold:t.recoveryThreshold});let[c,l]=ml(this,n);l&&(s.contexts={trace:l});let u=nu(s,c,this.getSdkMetadata(),o,this.getDsn());return L&&V.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){L&&V.log(`Disposing client...`);for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Dl(64)}_prepareEvent(e,t,n,r){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,t,n,r)}_setUpMetricsProcessing(){this.on(`processMetric`,e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function gu(e){let t=K().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const _u=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),vu=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function yu(e,t){let n=String(e).toLowerCase();return _u.has(n)?!1:vu.has(n)?!0:t?.strict?null:!!e}function bu(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||``,r=t[8]||``;return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function xu(e){return e.split(/[?#]/,1)[0]}function Su(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Cu(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:Wi})),i.version=Wi)}function wu(e={}){let t=e.client||q();if(!el()||!t)return{};let n=W(z());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||G(),i=e.span||Ns(),a=i?Ss(i):Tu(r),o=Qo(i?Gs(i):Ws(t,r));if(!ps.test(a))return V.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?Cs(i):Eu(r)),s}function Tu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return gs(t,r,n)}function Eu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return _s(t,r,n)}const Du=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Ou(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return L&&!r&&V.log(Du,e),r;let i=ro(e,t);return n?.set(e,i),L&&!i&&V.log(Du,e),i}function ku(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Au(e){let t=e.headers||{},n=(typeof t[`x-forwarded-host`]==`string`?t[`x-forwarded-host`]:void 0)||(typeof t.host==`string`?t.host:void 0),r=(typeof t[`x-forwarded-proto`]==`string`?t[`x-forwarded-proto`]:void 0)||e.protocol||(e.socket?.encrypted?`https`:`http`),i=e.url||``,a=ju({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Mu(i),headers:ku(t),cookies:s,data:o}}function ju({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Mu(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function Nu(e,t){let n=q(),r=K();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:vo(),...e},s=i?B(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let Pu;const Fu=new WeakMap,Iu=X((()=>({name:`FunctionToString`,setupOnce(){Pu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Ga(this),n=Fu.has(q())&&t!==void 0?t:this;return Pu.apply(n,e)}}catch{}},setup(e){Fu.set(e,!0)}}))),Lu=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,`vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)`,`Can't find variable: _AutofillCallbackHandler`,/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Ru=X((e={})=>{let t;return{name:`EventFilters`,setup(n){t=zu(e,n.getOptions())},processEvent(n,r,i){return t||=zu(e,i.getOptions()),Bu(n,t)?null:n}}});function zu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Lu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Bu(e,t){if(e.type){if(e.type===`transaction`&&Hu(e,t.ignoreTransactions))return L&&V.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${co(e)}`),!0}else{if(Vu(e,t.ignoreErrors))return L&&V.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${co(e)}`),!0;if(qu(e))return L&&V.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${co(e)}`),!0;if(Uu(e,t.denyUrls))return L&&V.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${co(e)}.\nUrl: ${Ku(e)}`),!0;if(!Wu(e,t.allowUrls))return L&&V.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${co(e)}.\nUrl: ${Ku(e)}`),!0}return!1}function Vu(e,t){return t?.length?Pl(e).some(e=>ro(e,t)):!1}function Hu(e,t){if(!t?.length)return!1;let n=e.transaction;return n?ro(n,t):!1}function Uu(e,t){if(!t?.length)return!1;let n=Ku(e);return n?ro(n,t):!1}function Wu(e,t){if(!t?.length)return!0;let n=Ku(e);return n?ro(n,t):!0}function Gu(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function Ku(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Gu(t):null}catch{return L&&V.error(`Cannot extract url for event ${co(e)}`),null}}function qu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Ju(e,t,n,r,i,a){if(!i.exception?.values||!a||!La(a.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=Yu(e,t,r,a.originalException,n,i.exception.values,o,0))}function Yu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(La(r[i],Error)){Zu(o,s,r);let a=e(t,r[i]),l=c.length;Qu(a,i,l,s),c=Yu(e,t,n,r[i],i,[a,...c],a,l)}return Xu(r)&&r.errors.forEach((a,l)=>{if(La(a,Error)){Zu(o,s,r);let u=e(t,a),d=c.length;Qu(u,`errors[${l}]`,d,s),c=Yu(e,t,n,a,i,[u,...c],u,d)}}),c}function Xu(e){return Array.isArray(e.errors)}function Zu(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...Xu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Qu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const $u=X(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){Ju(cu,i.getOptions().stackParser,n,t,e,r)}}}));function ed(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf(`=`,n);if(r===-1)break;let i=e.indexOf(`;`,n);if(i===-1)i=e.length;else if(i<r){n=e.lastIndexOf(`;`,r-1)+1;continue}let a=e.slice(n,r).trim();if(t[a]===void 0){let n=e.slice(r+1,i).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));try{t[a]=n.indexOf(`%`)===-1?n:decodeURIComponent(n)}catch{t[a]=n}}n=i+1}return t}const td=[`X-Client-IP`,`X-Forwarded-For`,`Fly-Client-IP`,`CF-Connecting-IP`,`Fastly-Client-Ip`,`True-Client-Ip`,`X-Real-IP`,`X-Cluster-Client-IP`,`X-Forwarded`,`Forwarded-For`,`Forwarded`,`X-Vercel-Forwarded-For`];function nd(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return td.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?rd(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&id(e))||null}function rd(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function id(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}const ad={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},od=X(((e={})=>{let t={...ad,...e.include};return{name:`RequestData`,processEvent(e,n,r){let{sdkProcessingMetadata:i={}}=e,{normalizedRequest:a,ipAddress:o}=i,s={...t,ip:t.ip??r.getOptions().sendDefaultPii};return a&&sd(e,a,{ipAddress:o},s),e}}}));function sd(e,t,n,r){if(e.request={...e.request,...cd(t,r)},r.ip){let r=t.headers&&nd(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function cd(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||td.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?ed(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function ld(e){let t=`console`;ha(t,e),ga(t,ud)}function ud(){`console`in R&&qi.forEach(function(e){e in R.console&&Ha(R.console,e,function(t){return Ji[e]=t,function(...t){_a(`console`,{args:t,level:e}),Ji[e]?.apply(R.console,t)}})})}function dd(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const fd=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function pd(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=fd.exec(t);return n?n.slice(1):[]}function md(e){let t=pd(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const hd=X((e={})=>{let t=new Set(e.levels||qi);return{name:`Console`,setup(e){ld(({args:n,level:r})=>{q()!==e||!t.has(r)||gd(r,n)})}}});function gd(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:dd(e),message:_d(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${_d(e)}`:`Assertion failed`,n.data.arguments=e}else return;Nu(n,{input:t,level:e})}function _d(e){return`util`in R&&typeof R.util.format==`function`?R.util.format(...e):to(e,` `)}function vd(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function yd(e,t=!1){return!(t||e&&!e.startsWith(`/`)&&!e.match(/^[A-Z]:/)&&!e.startsWith(`.`)&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes(`node_modules/`)}function bd(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let a=i.match(r);if(a)return{filename:`<data:${a[2]}>`,function:a[1]};let o=i.match(n);if(o){let t,n,r,i,a;if(o[1]){r=o[1];let e=r.lastIndexOf(`.`);if(r[e-1]===`.`&&e--,e>0){t=r.slice(0,e),n=r.slice(e+1);let i=t.indexOf(`.Module`);i>0&&(r=r.slice(i+1),t=t.slice(0,i))}i=void 0}n&&(i=t,a=n),n===`<anonymous>`&&(a=void 0,r=void 0),r===void 0&&(a||=`?`,r=i?`${i}.${a}`:a);let s=fa(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?Cd(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:Sd(o[3]),colno:Sd(o[4]),in_app:yd(s||``,c)}}if(i.match(t))return{filename:i}}}function xd(e){return[90,bd(e)]}function Sd(e){return parseInt(e||``,10)||void 0}function Cd(e){try{return decodeURI(e)}catch{return}}var wd=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let t=this._cache.get(e);if(t!==void 0)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){if(this._cache.size>=this._maxSize){let e=this._cache.keys().next().value;this._cache.delete(e)}this._cache.set(e,t)}remove(e){let t=this._cache.get(e);return t&&this._cache.delete(e),t}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(t=>e.push(t)),e}};const Z=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var Td=class extends hu{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||D.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};Cu(n,`node-light`,[`node-core`]),V.log(`Initializing Sentry: process: ${process.pid}, thread: ${tt?`main`:`worker-${nt}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{_l(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener))}async flush(e){return this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){return this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off(`beforeExit`,this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off(`beforeExit`,this._logOnExitFlushListener),super.close(e)}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{Z&&V.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const Ed=X((e={})=>({name:`ChildProcess`,setup(){rt.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&Dd(t.process,e)}),rt.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&Od(t.worker,e)})}}));function Dd(e,t){let n=!1,r;e.on(`spawn`,()=>{if(e.spawnfile===`/usr/bin/sw_vers`){n=!0;return}r={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(r.spawnargs=e.spawnargs)}).on(`exit`,e=>{n||(n=!0,e!==null&&e!==0&&Nu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Nu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function Od(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Nu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):Yc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const kd=Fe(st),Ad=Fe(lt),jd=X(((e={})=>{let t,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e};async function r(e){t===void 0&&(t=i());let n=Md(await t);return e.contexts={...e.contexts,app:{...n.app,...e.contexts?.app},os:{...n.os,...e.contexts?.os},device:{...n.device,...e.contexts?.device},culture:{...n.culture,...e.contexts?.culture},cloud_resource:{...n.cloud_resource,...e.contexts?.cloud_resource}},e}async function i(){let e={};if(n.os&&(e.os=await Nd()),n.app&&(e.app=Fd()),n.device&&(e.device=Id(n.device)),n.culture){let t=Pd();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=Ud()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function Md(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory==`function`){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=D.freemem()),e}async function Nd(){let e=D.platform();switch(e){case`darwin`:return Bd();case`linux`:return Hd();default:return{name:Ld[e]||e,version:D.release()}}}function Pd(){try{if(typeof process.versions.icu!=`string`)return;let e=new Date(9e8);if(new Intl.DateTimeFormat(`es`,{month:`long`}).format(e)===`enero`){let e=Intl.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone}}}catch{}}function Fd(){let e=process.memoryUsage().rss,t={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory==`function`){let e=process.availableMemory?.();e!=null&&(t.free_memory=e)}return t}function Id(e){let t={},n;try{n=D.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=D.arch(),(e===!0||e.memory)&&(t.memory_size=D.totalmem(),t.free_memory=D.freemem()),e===!0||e.cpu){let e=D.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const Ld={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},Rd=[{name:`fedora-release`,distros:[`Fedora`]},{name:`redhat-release`,distros:[`Red Hat Linux`,`Centos`]},{name:`redhat_version`,distros:[`Red Hat Linux`]},{name:`SuSE-release`,distros:[`SUSE Linux`]},{name:`lsb-release`,distros:[`Ubuntu Linux`,`Arch Linux`]},{name:`debian_version`,distros:[`Debian`]},{name:`debian_release`,distros:[`Debian`]},{name:`arch-release`,distros:[`Arch Linux`]},{name:`gentoo-release`,distros:[`Gentoo Linux`]},{name:`novell-release`,distros:[`SUSE Linux`]},{name:`alpine-release`,distros:[`Alpine Linux`]}],zd={alpine:e=>e,arch:e=>Q(/distrib_release=(.*)/,e),centos:e=>Q(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Q(/release (..)/,e),mint:e=>Q(/distrib_release=(.*)/,e),red:e=>Q(/release ([^ ]+)/,e),suse:e=>Q(/VERSION = (.*)\n/,e),ubuntu:e=>Q(/distrib_release=(.*)/,e)};function Q(e,t){let n=e.exec(t);return n?n[1]:void 0}async function Bd(){let e={kernel_version:D.release(),name:`Mac OS X`,version:`10.${Number(D.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{qe(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Q(/^ProductName:\s+(.*)$/m,t),e.version=Q(/^ProductVersion:\s+(.*)$/m,t),e.build=Q(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Vd(e){return e.split(` `)[0].toLowerCase()}async function Hd(){let e={kernel_version:D.release(),name:`Linux`};try{let t=await Ad(`/etc`),n=Rd.find(e=>t.includes(e.name));if(!n)return e;let r=(await kd(Ue(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(Vd(e))>=0)||i[0],e.version=zd[Vd(e.name)]?.(r)}catch{}return e}function Ud(){if(process.env.VERCEL)return{"cloud.provider":`vercel`,"cloud.region":process.env.VERCEL_REGION};if(process.env.AWS_REGION)return{"cloud.provider":`aws`,"cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV};if(process.env.GCP_PROJECT)return{"cloud.provider":`gcp`};if(process.env.ALIYUN_REGION_ID)return{"cloud.provider":`alibaba_cloud`,"cloud.region":process.env.ALIYUN_REGION_ID};if(process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME)return{"cloud.provider":`azure`,"cloud.region":process.env.REGION_NAME};if(process.env.IBM_CLOUD_REGION)return{"cloud.provider":`ibm_cloud`,"cloud.region":process.env.IBM_CLOUD_REGION};if(process.env.TENCENTCLOUD_REGION)return{"cloud.provider":`tencent_cloud`,"cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE};if(process.env.NETLIFY)return{"cloud.provider":`netlify`};if(process.env.FLY_REGION)return{"cloud.provider":`fly.io`,"cloud.region":process.env.FLY_REGION};if(process.env.DYNO)return{"cloud.provider":`heroku`}}const Wd=new wd(10),Gd=new wd(20);function Kd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function qd(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function Jd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function Yd(e,t){let n=Wd.get(e);if(n===void 0)return!1;for(let e=t[0];e<=t[1];e++)if(n[e]===void 0)return!1;return!0}function Xd(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=af(r,t),a=[];for(;;){if(n===e.length-1){a.push(i);break}let r=e[n+1];if(typeof r!=`number`)break;r<=i[1]?i[1]=r+t:(a.push(i),i=af(r,t)),n++}return a}function Zd(e,t,n){return new Promise((r,i)=>{let a=at(e),o=Xe({input:a});function s(){a.destroy(),r()}let c=0,l=0,u=t[l];if(u===void 0){s();return}let d=u[0],f=u[1];function p(t){Gd.set(e,1),Z&&V.error(`Failed to read file: ${e}. Error: ${t}`),o.close(),o.removeAllListeners(),s()}a.on(`error`,p),o.on(`error`,p),o.on(`close`,s),o.on(`line`,e=>{if(c++,!(c<d)&&(n[c]=eo(e,0),c>=f)){if(l===t.length-1){o.close(),o.removeAllListeners();return}l++;let e=t[l];if(e===void 0){o.close(),o.removeAllListeners();return}d=e[0],f=e[1]}})})}async function Qd(e,t){let n={};if(t>0&&e.exception?.values){for(let t of e.exception.values)if(t.stacktrace?.frames?.length)for(let e=t.stacktrace.frames.length-1;e>=0;e--){let r=t.stacktrace.frames[e],i=r?.filename;!r||typeof i!=`string`||typeof r.lineno!=`number`||qd(i)||Jd(r)||(n[i]||(n[i]=[]),n[i].push(r.lineno))}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let e of r){if(Gd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=Xd(r,t);if(a.every(t=>Yd(e,t)))continue;let o=Kd(Wd,e,{});i.push(Zd(e,a,o))}if(await Promise.all(i).catch(()=>{Z&&V.log(`Failed to read one or more source files and resolve context lines`)}),t>0&&e.exception?.values)for(let n of e.exception.values)n.stacktrace?.frames&&n.stacktrace.frames.length>0&&$d(n.stacktrace.frames,t,Wd);return e}function $d(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno==`number`){let e=n.get(r.filename);if(e===void 0)continue;tf(r.lineno,r,t,e)}}function ef(e){delete e.pre_context,delete e.context_line,delete e.post_context}function tf(e,t,n,r){if(t.lineno===void 0||r===void 0){Z&&V.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=nf(e,n);i<e;i++){let e=r[i];if(e===void 0){ef(t),Z&&V.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){ef(t),Z&&V.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=rf(e,n);t.post_context=[];for(let n=e+1;n<=i;n++){let e=r[n];if(e===void 0)break;t.post_context.push(e)}}function nf(e,t){return Math.max(1,e-t)}function rf(e,t){return e+t}function af(e,t){return[nf(e,t),rf(e,t)]}const of=X(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return Qd(e,t)}}})),sf=mo(process.versions.node),cf=sf.major;sf.minor;let lf;async function uf(){if(lf===void 0)try{lf=!!(await import(`node:inspector`)).url()}catch{lf=!1}return lf}const df=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function ff(e,t,n){let r=0,i=5,a=0;return setInterval(()=>{a===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),a=i):(--a,a===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function pf(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function mf(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||pf(e)&&pf(t)}function hf(...e){V.log(`[LocalVariables]`,...e)}const gf=X(((e={})=>{function t(t,n){let r=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<r.length;t++){let i=r.length-t-1,a=n[t],o=r[i];if(!o||!a)break;a.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!mf(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&df in n.originalException&&Array.isArray(n.originalException[df])){for(let r of e.exception?.values||[])t(r,n.originalException[df]);n.originalException[df]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new ut(new URL(`data:application/javascript;base64,LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQyLjAgKDA3YzkxOTApIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{hf(`Worker error`,e)}),t.once(`exit`,e=>{hf(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await uf()){V.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:V.isEnabled()};r().then(()=>{try{i(n)}catch(e){V.error(`Failed to start worker`,e)}},e=>{V.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function _f(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function vf(e,t){if(t!==void 0)return _f(e(t,1))}function yf(e){let t=[],n=!1;function r(r){t=[],!n&&(n=!0,e(r))}t.push(r);function i(e){t.push(e)}function a(e){let n=t.pop()||r;try{n(e)}catch{r(e)}}return{add:i,next:a}}var bf=class e{constructor(e){this._session=e}static async create(t){return t||new e(new(await(import(`node:inspector`))).Session)}configureAndConnect(e,t){this._session.connect(),this._session.on(`Debugger.paused`,t=>{e(t,()=>{this._session.post(`Debugger.resume`)})}),this._session.post(`Debugger.enable`),this._session.post(`Debugger.setPauseOnExceptions`,{state:t?`all`:`uncaught`})}setPauseOnExceptions(e){this._session.post(`Debugger.setPauseOnExceptions`,{state:e?`all`:`uncaught`})}getLocalVariables(e,t){this._getProperties(e,e=>{let{add:n,next:r}=yf(t);for(let t of e)if(t.value?.objectId&&t.value.className===`Array`){let e=t.value.objectId;n(n=>this._unrollArray(e,t.name,n,r))}else if(t.value?.objectId&&t.value.className===`Object`){let e=t.value.objectId;n(n=>this._unrollObject(e,t.name,n,r))}else t.value&&n(e=>this._unrollOther(t,e,r));r({})})}_getProperties(e,t){this._session.post(`Runtime.getProperties`,{objectId:e,ownProperties:!0},(e,n)=>{t(e?[]:n.result)})}_unrollArray(e,t,n,r){this._getProperties(e,e=>{n[t]=e.filter(e=>e.name!==`length`&&!isNaN(parseInt(e.name,10))).sort((e,t)=>parseInt(e.name,10)-parseInt(t.name,10)).map(e=>e.value?.value),r(n)})}_unrollObject(e,t,n,r){this._getProperties(e,e=>{n[t]=e.map(e=>[e.name,e.value?.value]).reduce((e,[t,n])=>(e[t]=n,e),{}),r(n)})}_unrollOther(e,t,n){e.value&&(`value`in e.value?e.value.value===void 0||e.value.value===null?t[e.name]=`<${e.value.value}>`:t[e.name]=e.value.value:`description`in e.value&&e.value.type!==`function`?t[e.name]=`<${e.value.description}>`:e.value.type===`undefined`&&(t[e.name]=`<undefined>`)),n(t)}};const xf=X(((e={},t)=>{let n=new wd(20),r,i=!1;function a(t){let r=_f(t.stacktrace?.frames);if(r===void 0)return;let i=n.remove(r);if(i===void 0)return;let a=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<a.length;t++){let n=a.length-t-1,r=i[t],o=a[n];if(!o||!r)break;r.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!mf(o.function,r.function)||(o.vars=r.vars)}}function o(e){for(let t of e.exception?.values||[])a(t);return e}let s;async function c(){let a=q()?.getOptions();if(a?.includeLocalVariables){if(cf<18){V.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await uf()){V.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await bf.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=vf(e,i.description);if(c==null){s();return}let{add:l,next:u}=yf(e=>{n.set(c,e),s()});for(let e=0;e<Math.min(a.length,5);e++){let{scopeChain:t,functionName:n,this:r}=a[e],i=t.find(e=>e.type===`local`),s=r.className===`global`||!r.className?n:`${r.className}.${n}`;if(i?.object.objectId===void 0)l(t=>{t[e]={function:s},u(t)});else{let t=i.object.objectId;l(n=>o.getLocalVariables(t,t=>{n[e]={function:s,vars:t},u(n)}))}}u([])},c=e.captureAllExceptions!==!1;o.configureAndConnect((e,t)=>s(a.stackParser,e,t),c),c&&(r=ff(e.maxExceptionsPerSecond||50,()=>{V.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{V.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){V.log("The `LocalVariables` integration failed to start.",e)}}}return{name:`LocalVariables`,setupOnce(){s=c()},async processEvent(e){return await s,i?o(e):e},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}})),Sf=(e={})=>sf.major<19?xf(e):gf(e);function Cf(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let wf;const Tf=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,Ef=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...Af()},e},getModules:Af}));function Df(){try{return pe.cache?Object.keys(pe.cache):[]}catch{return[]}}function Of(){return{...Tf,...Mf(),...Cf()?kf():{}}}function kf(){let e=pe.main?.paths||[],t=Df(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=He(t),!i||t===i||r.has(t))return;if(e.indexOf(i)<0)return a();let o=Ue(t,`package.json`);if(r.add(t),!ot(o))return a();try{let e=JSON.parse(ct(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function Af(){return wf||=Of(),wf}function jf(){try{let e=Ue(process.cwd(),`package.json`);return JSON.parse(ct(e,`utf8`))}catch{return{}}}function Mf(){let e=jf();return{...e.dependencies,...e.devDependencies}}function Nf(e){B(()=>{console.error(e)});let t=q();if(t===void 0){Z&&V.warn(`No NodeClient was defined, we are exiting the process now.`),global.process.exit(1);return}let n=t.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:2e3;t.close(r).then(e=>{e||Z&&V.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Z&&V.error(e)})}const Pf=X((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){tt&&global.process.on(`uncaughtException`,Ff(e,t))}}});function Ff(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=Nf;t.onFatalError?c=t.onFatalError:o.onFatalError&&(c=o.onFatalError);let l=global.process.listeners(`uncaughtException`).filter(e=>e.name!==`domainUncaughtExceptionClear`&&e.tag!==`sentry_tracingErrorCallback`&&e._errorHandler!==!0).length===0,u=t.exitEvenIfOtherHandlersAreRegistered||l;n?u&&(i?(Z&&V.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),Nf(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,q()===e&&Yc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const If=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Lf=X(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...If,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,Vf(e,t))}}}));function Rf(e){if(typeof e!=`object`||!e)return{name:``,message:String(e??``)};let t=e;return{name:typeof t.name==`string`?t.name:``,message:typeof t.message==`string`?t.message:String(e)}}function zf(e,t){let n=e.name===void 0||no(t.name,e.name,!0),r=e.message===void 0||no(t.message,e.message);return n&&r}function Bf(e,t){let n=Rf(t);return e.some(e=>zf(e,n))}function Vf(e,t){return function(n,r){if(q()!==e||Bf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>gc(a,e):e=>e())(()=>{Yc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),Hf(n,t.mode)}}function Hf(e,t){let n=`This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:`;t===`warn`?B(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(B(()=>{console.warn(n)}),Nf(e))}const Uf=X(()=>({name:`ProcessSession`,setupOnce(){tl(),process.on(`beforeExit`,()=>{K().getSession()?.status!==`ok`&&nl()})}})),Wf=`Spotlight`,Gf=X(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:Wf,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&V.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}Kf(e,t)}}}));function Kf(e,t){let n=qf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){V.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=ic(e);_c(()=>{let e=Ze.request({method:`POST`,path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":`application/x-sentry-envelope`}},e=>{e.statusCode&&e.statusCode>=200&&e.statusCode<400&&(r=0),e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`)});e.on(`error`,()=>{r++,V.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function qf(e){try{return new URL(`${e}`)}catch{V.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function Jf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Ne.getSystemErrorMap().has(e.errno)}const Yf=X((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!Jf(n.originalException))return t;let i=n.originalException,a={...i};!r.getOptions().sendDefaultPii&&e.includePaths!==!0&&(delete a.path,delete a.dest),t.contexts={...t.contexts,node_system_error:a};for(let e of t.exception?.values||[])e.value&&(i.path&&e.value.includes(i.path)&&(e.value=e.value.replace(`'${i.path}'`,``).trim()),i.dest&&e.value.includes(i.dest)&&(e.value=e.value.replace(`'${i.dest}'`,``).trim()));return t}}));function Xf(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function Zf(e=process.argv[1]?md(process.argv[1]):process.cwd(),t=Ge===`\\`){let n=t?Xf(e):e;return e=>{if(!e)return;let r=t?Xf(e):e,{dir:i,base:a,ext:o}=We.parse(r);(o===`.js`||o===`.mjs`||o===`.cjs`)&&(a=a.slice(0,o.length*-1));let s=decodeURIComponent(a);i||=`.`;let c=i.lastIndexOf(`/node_modules`);if(c>-1)return`${i.slice(c+14).replace(/\//g,`.`)}:${s}`;if(i.startsWith(n)){let e=i.slice(n.length+1).replace(/\//g,`.`);return e?`${e}:${s}`:s}return s}}function Qf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(R.SENTRY_RELEASE?.id)return R.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||n||r||e}const $f=aa(xd(Zf())),$=Symbol(`AgentBaseInternalState`);var ep=class extends Ze.Agent{constructor(e){super(e),this[$]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==`boolean`)return e.secureEndpoint;if(typeof e.protocol==`string`)return e.protocol===`https:`}let{stack:t}=Error();return typeof t==`string`?t.split(`
194
- `).some(e=>e.indexOf(`(https.js:`)!==-1||e.indexOf(`node:https:`)!==-1):!1}createSocket(e,t,n){let r={...t,secureEndpoint:this.isSecureEndpoint(t)};Promise.resolve().then(()=>this.connect(e,r)).then(i=>{if(i instanceof Ze.Agent)return i.addRequest(e,r);this[$].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[$].currentSocket;if(this[$].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[$].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[$]&&(this[$].defaultPort=e)}get protocol(){return this[$].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[$]&&(this[$].protocol=e)}};function tp(...e){V.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function np(e){return new Promise((t,n)=>{let r=0,i=[];function a(){let t=e.read();t?l(t):e.once(`readable`,a)}function o(){e.removeListener(`end`,s),e.removeListener(`error`,c),e.removeListener(`readable`,a)}function s(){o(),tp(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),tp(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
185
+ `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await m()}=t,i=await D(),a=await O(),o;try{o=await Kn({repo:r,token:i,host:a})}catch(e){throw e instanceof C?new N(`Failed to fetch webhook details: ${await e.text()}`):e}let s=o.find(e=>e.config.url===n);if(!s)throw new N(`Webhook not found: ${n}`);let{config:c}=s;console.info(`URL: ${c.url}`),console.info(`Name: ${c.name||`(none)`}`),console.info(`Status: ${c.active?`enabled`:`disabled`}`),console.info(`Secret: ${c.secret?`(set)`:`(none)`}`);let l=[];for(let e of Wn)c[e]&&l.push(e);if(console.info(`Triggers: ${l.length>0?l.join(`, `):`(none)`}`),Object.keys(c.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(c.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),si=M({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:ri,description:`List all webhooks`},create:{handler:ei,description:`Create a new webhook`},view:{handler:oi,description:`View webhook details`},remove:{handler:ii,description:`Delete a webhook`},enable:{handler:ni,description:`Enable a webhook`},disable:{handler:ti,description:`Disable a webhook`},"set-triggers":{handler:ai,description:`Update webhook triggers`}}}),ci=j({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await f({token:await D(),host:await O()});console.info(e.email)});const R=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,z=globalThis,li=`10.42.0`;function B(){return ui(z),z}function ui(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||li,t[li]=t[li]||{}}function di(e,t,n=z){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[li]=r[li]||{};return i[e]||(i[e]=t())}const fi=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],pi={};function V(e){if(!(`console`in z))return e();let t=z.console,n={},r=Object.keys(pi);r.forEach(e=>{let r=pi[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function mi(){xi().enabled=!0}function hi(){xi().enabled=!1}function gi(){return xi().enabled}function _i(...e){bi(`log`,...e)}function vi(...e){bi(`warn`,...e)}function yi(...e){bi(`error`,...e)}function bi(e,...t){R&&gi()&&V(()=>{z.console[e](`Sentry Logger [${e}]:`,...t)})}function xi(){return R?di(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const H={enable:mi,disable:hi,isEnabled:gi,log:_i,warn:vi,error:yi},Si=/\(error: (.*)\)/,Ci=/captureMessage|captureException/;function wi(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
186
+ `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Si.test(n)?n.replace(Si,`$1`):n;if(!o.match(/\S*Error: /)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=50+r)break}}return Ei(i.slice(r))}}function Ti(e){return Array.isArray(e)?wi(...e):e}function Ei(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Di(t).function||``)&&t.pop(),t.reverse(),Ci.test(Di(t).function||``)&&(t.pop(),Ci.test(Di(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Di(t).filename,function:e.function||`?`}))}function Di(e){return e[e.length-1]||{}}const Oi=`<anonymous>`;function ki(e){try{return!e||typeof e!=`function`?Oi:e.name||Oi}catch{return Oi}}function Ai(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function ji(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const Mi={},Ni={};function Pi(e,t){Mi[e]=Mi[e]||[],Mi[e].push(t)}function Fi(e,t){if(!Ni[e]){Ni[e]=!0;try{t()}catch(t){R&&H.error(`Error while instrumenting ${e}`,t)}}}function Ii(e,t){let n=e&&Mi[e];if(n)for(let r of n)try{r(t)}catch(t){R&&H.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${ki(r)}\nError:`,t)}}let Li=null;function Ri(e){let t=`error`;Pi(t,e),Fi(t,zi)}function zi(){Li=z.onerror,z.onerror=function(e,t,n,r,i){return Ii(`error`,{column:r,error:i,line:n,msg:e,url:t}),Li?Li.apply(this,arguments):!1},z.onerror.__SENTRY_INSTRUMENTED__=!0}let Bi=null;function Vi(e){let t=`unhandledrejection`;Pi(t,e),Fi(t,Hi)}function Hi(){Bi=z.onunhandledrejection,z.onunhandledrejection=function(e){return Ii(`unhandledrejection`,e),Bi?Bi.apply(this,arguments):!0},z.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Ui=Object.prototype.toString;function Wi(e){switch(Ui.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return na(e,Error)}}function Gi(e,t){return Ui.call(e)===`[object ${t}]`}function Ki(e){return Gi(e,`ErrorEvent`)}function qi(e){return Gi(e,`String`)}function Ji(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function Yi(e){return e===null||Ji(e)||typeof e!=`object`&&typeof e!=`function`}function Xi(e){return Gi(e,`Object`)}function Zi(e){return typeof Event<`u`&&na(e,Event)}function Qi(e){return typeof Element<`u`&&na(e,Element)}function $i(e){return Gi(e,`RegExp`)}function ea(e){return!!(e?.then&&typeof e.then==`function`)}function ta(e){return Xi(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function na(e,t){try{return e instanceof t}catch{return!1}}function ra(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const ia=z;function aa(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=[],i=0,a=0,o,s=Array.isArray(t)?t:t.keyAttrs,c=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&i++<5&&(o=oa(n,s),!(o===`html`||i>1&&a+r.length*3+o.length>=c));)r.push(o),a+=o.length,n=n.parentNode;return r.reverse().join(` > `)}catch{return`<unknown>`}}function oa(e,t){let n=e,r=[];if(!n?.tagName)return``;if(ia.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let i=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let e=n.className;if(e&&qi(e)){let t=e.split(/\s+/);for(let e of t)r.push(`.${e}`)}}for(let e of[`aria-label`,`type`,`name`,`title`,`alt`]){let t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join(``)}function sa(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&la(i,r);try{e[t]=i}catch{R&&H.log(`Failed to replace method "${t}" in object`,e)}}function ca(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{R&&H.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function la(e,t){try{e.prototype=t.prototype=t.prototype||{},ca(e,`__sentry_original__`,t)}catch{}}function ua(e){return e.__sentry_original__}function da(e){if(Wi(e))return{message:e.message,name:e.name,stack:e.stack,...pa(e)};if(Zi(e)){let t={type:e.type,target:fa(e.target),currentTarget:fa(e.currentTarget),...pa(e)};return typeof CustomEvent<`u`&&na(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function fa(e){try{return Qi(e)?aa(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function pa(e){if(typeof e==`object`&&e){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function ma(e){let t=Object.keys(da(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let ha;function ga(e){if(ha!==void 0)return ha?ha(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=z;return t in n&&typeof n[t]==`function`?(ha=n[t],ha(e)):(ha=null,e())}function U(){return ga(()=>Math.random())}function _a(){return ga(()=>Date.now())}function va(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function ya(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,r);return a>r-5&&(a=r),a===r&&(i=Math.max(a-140,0)),n=n.slice(i,a),i>0&&(n=`'{snip} ${n}`),a<r&&(n+=` {snip}`),n}function ba(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{ra(r)?n.push(Ai(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function xa(e,t,n=!1){return qi(e)?$i(t)?t.test(e):qi(t)?n?e===t:e.includes(t):!1:!1}function Sa(e,t=[],n=!1){return t.some(t=>xa(e,t,n))}function Ca(){let e=z;return e.crypto||e.msCrypto}let wa;function Ta(){return U()*16}function W(e=Ca()){try{if(e?.randomUUID)return ga(()=>e.randomUUID()).replace(/-/g,``)}catch{}return wa||=`10000000100040008000100000000000`,wa.replace(/[018]/g,e=>(e^(Ta()&15)>>e/4).toString(16))}function Ea(e){return e.exception?.values?.[0]}function Da(e){let{message:t,event_id:n}=e;if(t)return t;let r=Ea(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Oa(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function ka(e,t){let n=Ea(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}const Aa=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function ja(e){return parseInt(e||``,10)}function Ma(e){let t=e.match(Aa)||[],n=ja(t[1]),r=ja(t[2]),i=ja(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:t[4]}}function Na(e){if(Pa(e))return!0;try{ca(e,`__sentry_captured__`,!0)}catch{}return!1}function Pa(e){try{return e.__sentry_captured__}catch{}}const Fa=1e3;function Ia(){return _a()/Fa}function La(){let{performance:e}=z;if(!e?.now||!e.timeOrigin)return Ia;let t=e.timeOrigin;return()=>(t+ga(()=>e.now()))/Fa}let Ra;function za(){return(Ra??=La())()}function Ba(e){let t=za(),n={sid:W(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Ua(n)};return e&&Va(n,e),n}function Va(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||za(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:W()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Ha(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),Va(e,n)}function Ua(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Wa(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=Wa(r[e],t[e],n-1));return r}function Ga(){return W()}function Ka(){return W().substring(16)}const qa=`_sentrySpan`;function Ja(e,t){t?ca(e,qa,t):delete e[qa]}function Ya(e){return e[qa]}var Xa=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ga(),sampleRand:U()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Ja(t,Ya(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Va(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof e?n.getScopeData():Xi(n)?t:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Ja(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ga(),sampleRand:U()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:Ia(),...e,message:e.message?va(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Ya(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Wa(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||W();if(!this._client)return R&&H.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n?.event_id||W();if(!this._client)return R&&H.warn(`No client configured on scope - will not capture message!`),r;let i=n?.syntheticException??Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=e.event_id||t?.event_id||W();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(R&&H.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function Za(){return di(`defaultCurrentScope`,()=>new Xa)}function Qa(){return di(`defaultIsolationScope`,()=>new Xa)}var $a=class{constructor(e,t){let n;n=e||new Xa;let r;r=t||new Xa,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return ea(n)?n.then(e=>(this._popScope(),e),e=>{throw this._popScope(),e}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function eo(){let e=ui(B());return e.stack=e.stack||new $a(Za(),Qa())}function to(e){return eo().withScope(e)}function no(e,t){let n=eo();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function ro(e){return eo().withScope(()=>e(eo().getIsolationScope()))}function io(){return{withIsolationScope:ro,withScope:to,withSetScope:no,withSetIsolationScope:(e,t)=>ro(t),getCurrentScope:()=>eo().getScope(),getIsolationScope:()=>eo().getIsolationScope()}}function ao(e){let t=ui(B());t.acs=e}function oo(e){let t=ui(e);return t.acs?t.acs:io()}function G(){return oo(B()).getCurrentScope()}function K(){return oo(B()).getIsolationScope()}function so(){return di(`globalScope`,()=>new Xa)}function co(...e){let t=oo(B());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function lo(...e){let t=oo(B());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function q(){return G().getClient()}function uo(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Ka()};return n&&(i.parent_span_id=n),i}const fo=`sentry.profile_id`,po=`sentry.exclusive_time`;function mo(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function ho(e){let t=e;return{scope:t._sentryScope,isolationScope:mo(t._sentryIsolationScope)}}const go=/^sentry-/;function _o(e){let t=yo(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(go)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function vo(e){if(e)return xo(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function yo(e){if(!(!e||!qi(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=bo(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):bo(e)}function bo(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}function xo(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((e,[t,n],r)=>{let i=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,a=r===0?i:`${e},${i}`;return a.length>8192?(R&&H.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const So=/^o(\d+)\./,Co=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function wo(e){return e===`http`||e===`https`}function To(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function Eo(e){let t=Co.exec(e);if(!t){V(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,s=``]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return Do({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Do(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Oo(e){if(!R)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(H.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?wo(r)?t&&isNaN(parseInt(t,10))?(H.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(H.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(H.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function ko(e){return e.match(So)?.[1]}function Ao(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=ko(n)),r}function jo(e){let t=typeof e==`string`?Eo(e):Do(e);if(!(!t||!Oo(t)))return t}function Mo(e){if(typeof e==`boolean`)return Number(e);let t=typeof e==`string`?parseFloat(e):e;if(!(typeof t!=`number`||isNaN(t)||t<0||t>1))return t}const No=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Po(e){if(!e)return;let t=e.match(No);if(!t)return;let n;return t[3]===`1`?n=!0:t[3]===`0`&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Fo(e,t){let n=Po(e),r=_o(t);if(!n?.traceId)return{traceId:Ga(),sampleRand:U()};let i=Ro(n,r);r&&(r.sample_rand=i.toString());let{traceId:a,parentSpanId:o,parentSampled:s}=n;return{traceId:a,parentSpanId:o,sampled:s,dsc:r||{},sampleRand:i}}function Io(e=Ga(),t=Ka(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function Lo(e=Ga(),t=Ka(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function Ro(e,t){let n=Mo(t?.sample_rand);if(n!==void 0)return n;let r=Mo(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?U()*r:r+U()*(1-r):U()}function zo(e,t){let n=Ao(e);return t&&n&&t!==n?(H.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):e.getOptions().strictTraceContinuation&&(t&&!n||!t&&n)?(H.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${n})`),!1):!0}let Bo=!1;function Vo(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:qo(e).parent_span_id,a=ho(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Ka():t,trace_id:n}}function Ho(e){let{traceId:t,spanId:n}=e.spanContext();return Io(t,n,Xo(e))}function Uo(e){let{traceId:t,spanId:n}=e.spanContext();return Lo(t,n,Xo(e))}function Wo(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function Go(e){return typeof e==`number`?Ko(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Ko(e.getTime()):za()}function Ko(e){return e>9999999999?e/1e3:e}function qo(e){if(Yo(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Jo(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0,start_timestamp:Go(i),timestamp:Go(o)||void 0,status:Zo(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:Wo(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Jo(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Yo(e){return typeof e.getSpanJSON==`function`}function Xo(e){let{traceFlags:t}=e.spanContext();return t===1}function Zo(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function Qo(e){return e._sentryRootSpan||e}function $o(){let e=oo(B());return e.getActiveSpan?e.getActiveSpan():Ya(G())}function es(){Bo||=(V(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let ts=!1;function ns(){if(ts)return;function e(){let e=$o(),t=e&&Qo(e);if(t){let e=`internal_error`;R&&H.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,ts=!0,Ri(e),Vi(e)}function rs(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||q()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function is(e){H.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function as(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(ss(n)){if(xa(e.description,n))return R&&is(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?xa(e.description,n.name):!0,r=n.op?e.op&&xa(e.op,n.op):!0;if(t&&r)return R&&is(e),!0}return!1}function os(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function ss(e){return typeof e==`string`||e instanceof RegExp}const cs=`production`;function ls(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||cs,release:n.release,public_key:r,trace_id:e,org_id:Ao(t)};return t.emit(`createDsc`,i),i}function us(e,t){let n=t.getPropagationContext();return n.dsc||ls(n.traceId,e)}function ds(e){let t=q();if(!t)return{};let n=Qo(e),r=qo(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n._frozenDsc;if(c)return s(c);let l=a?.get(`sentry.dsc`),u=l&&_o(l);if(u)return s(u);let d=ls(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),rs()&&(d.sampled=String(Xo(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??ho(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function J(e,t=100,n=1/0){try{return ps(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function fs(e,t=3,n=100*1024){let r=J(e,t);return _s(r)>n?fs(e,t-1,n):r}function ps(e,t,n=1/0,r=1/0,i=vs()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=ms(e,t);if(!s.startsWith(`[object `))return s;if(t.__sentry_skip_normalization__)return t;let c=typeof t.__sentry_override_normalization_depth__==`number`?t.__sentry_override_normalization_depth__:n;if(c===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let l=t;if(l&&typeof l.toJSON==`function`)try{return ps(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=da(t);for(let e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(d>=r){u[e]=`[MaxProperties ~]`;break}let t=f[e];u[e]=ps(e,t,c-1,r,i),d++}return o(t),u}function ms(e,t){try{if(e===`domain`&&t&&typeof t==`object`&&t._events)return`[Domain]`;if(e===`domainEmitter`)return`[DomainEmitter]`;if(typeof global<`u`&&t===global)return`[Global]`;if(typeof window<`u`&&t===window)return`[Window]`;if(typeof document<`u`&&t===document)return`[Document]`;if(ra(t))return Ai(t);if(ta(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${ki(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=hs(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function hs(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function gs(e){return~-encodeURI(e).split(/%..|./).length}function _s(e){return gs(JSON.stringify(e))}function vs(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}function ys(e,t=[]){return[e,t]}function bs(e,t){let[n,r]=e;return[n,[...r,t]]}function xs(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function Ss(e,t){return xs(e,(e,n)=>t.includes(n))}function Cs(e){let t=ui(z);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function ws(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Cs(r),e]:r.push(typeof e==`string`?Cs(e):e)}for(let e of n){let[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(J(n))}i(e)}}return typeof r==`string`?r:Ts(r)}function Ts(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Es(e){let t=typeof e.data==`string`?Cs(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Ds={session:`session`,sessions:`session`,attachment:`attachment`,transaction:`transaction`,event:`error`,client_report:`internal`,user_report:`default`,profile:`profile`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,feedback:`feedback`,span:`span`,raw_security:`security`,log:`log_item`,metric:`metric`,trace_metric:`metric`};function Os(e){return Ds[e]}function ks(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function As(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:To(r)},...i&&{trace:i}}}function js(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function Ms(e,t,n,r){let i=ks(n);return ys({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:To(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Ns(e,t,n,r){let i=ks(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;js(e,n?.sdk);let o=As(e,i,r,t);return delete e.sdkProcessingMetadata,ys(o,[[{type:a},e]])}const Ps=`__SENTRY_SUPPRESS_TRACING__`,Fs=(e,t)=>{let n=oo(B());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=q(),o=_o(i);return a&&!zo(a,o?.org_id)?Rs(t):co(e=>{let n=Fo(r,i);return e.setPropagationContext(n),Ja(e,void 0),t()})};function Is(e,t){let n=zs();return n.withActiveSpan?n.withActiveSpan(e,t):co(n=>(Ja(n,e||void 0),t(n)))}function Ls(e){let t=zs();return t.suppressTracing?t.suppressTracing(e):co(t=>{t.setSDKProcessingMetadata({[Ps]:!0});let n=e();return t.setSDKProcessingMetadata({[Ps]:void 0}),n})}function Rs(e){return co(t=>(t.setPropagationContext({traceId:Ga(),sampleRand:U()}),R&&H.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),Is(null,e)))}function zs(){return oo(B())}function Bs(e){return new Hs(t=>{t(e)})}function Vs(e){return new Hs((t,n)=>{n(e)})}var Hs=class e{constructor(e){this._state=0,this._handlers=[],this._runExecutor(e)}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}_executeHandlers(){if(this._state===0)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===1&&e[1](this._value),this._state===2&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===0){if(ea(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}};function Us(e,t,n,r=0){try{let i=Ws(t,n,e,r);return ea(i)?i:Bs(i)}catch(e){return Vs(e)}}function Ws(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return R&&a===null&&H.log(`Event processor "${i.id||`?`}" dropped event`),ea(a)?a.then(e=>Ws(e,t,n,r+1)):Ws(a,t,n,r+1)}let Gs,Ks,qs,Js;function Ys(e){let t=z._sentryDebugIds,n=z._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Js&&r.length===Ks&&i.length===qs)return Js;Ks=r.length,qs=i.length,Js={},Gs||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Gs?.[r];if(i&&Js&&t)Js[i[0]]=t,Gs&&(Gs[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&Js&&Gs){Js[i]=t,Gs[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Js}function Xs(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;ec(e,t),r&&rc(e,r),ic(e,n),tc(e,i),nc(e,a)}function Zs(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;Qs(e,`extra`,n),Qs(e,`tags`,r),Qs(e,`attributes`,i),Qs(e,`user`,a),Qs(e,`contexts`,o),e.sdkProcessingMetadata=Wa(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function Qs(e,t,n){e[t]=Wa(e[t],n,1)}function $s(e,t){let n=so().getScopeData();return e&&Zs(n,e.getScopeData()),t&&Zs(n,t.getScopeData()),n}function ec(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function tc(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function nc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function rc(e,t){e.contexts={trace:Vo(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ds(t),...e.sdkProcessingMetadata};let n=qo(Qo(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function ic(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function ac(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||W(),timestamp:t.timestamp||Ia()},l=n.integrations||e.integrations.map(e=>e.name);oc(c,e),lc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&sc(c,e.stackParser);let u=dc(r,n.captureContext);n.mechanism&&ka(c,n.mechanism);let d=i?i.getEventProcessors():[],f=$s(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Xs(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Bs(c):Us(m,c,n)).then(e=>(e&&cc(e),typeof o==`number`&&o>0?uc(e,o,s):e))}function oc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||cs,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=va(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=va(e.value,a)})}function sc(e,t){let n=Ys(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function cc(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function lc(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function uc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:J(e.data,t,n)}}))},...e.user&&{user:J(e.user,t,n)},...e.contexts&&{contexts:J(e.contexts,t,n)},...e.extra&&{extra:J(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=J(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:J(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=J(e.contexts.flags,3,n)),r}function dc(e,t){if(!t)return e;let n=e?e.clone():new Xa;return n.update(t),n}function fc(e){if(e)return pc(e)||hc(e)?{captureContext:e}:e}function pc(e){return e instanceof Xa||typeof e==`function`}const mc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function hc(e){return Object.keys(e).some(e=>mc.includes(e))}function gc(e,t){return G().captureException(e,fc(t))}function _c(e,t){K().setContext(e,t)}function vc(e,t){K().setTag(e,t)}function yc(e){K().setUser(e)}async function bc(e){let t=q();return t?t.flush(e):(R&&H.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function xc(){let e=q();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Sc(e){let t=K(),{user:n}=$s(t,G()),{userAgent:r}=z.navigator||{},i=Ba({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&Va(a,{status:`exited`}),Cc(),t.setSession(i),i}function Cc(){let e=K(),t=G().getSession()||e.getSession();t&&Ha(t),wc(),e.setSession()}function wc(){let e=K(),t=q(),n=e.getSession();n&&t&&t.captureSession(n)}function Tc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Ec(e){return`${Tc(e)}${e.projectId}/envelope/`}function Dc(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function Oc(e,t,n){return t||`${Ec(e)}?${Dc(e,n)}`}const kc=[];function Ac(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function jc(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return Ac(r)}function Mc(e,t){let n={};return t.forEach(t=>{t&&Pc(e,t,n)}),n}function Nc(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Pc(e,t,n){if(n[t.name]){R&&H.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!kc.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),kc.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}R&&H.log(`Integration installed: ${t.name}`)}function Y(e){return e}function Fc(e,t){return t?co(t,()=>{let n=$o(),r=n?Vo(n):uo(t);return[n?ds(n):us(e,t),r]}):[void 0,void 0]}function Ic(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function Lc(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=To(r)),ys(i,[Ic(e)])}function Rc(e,t){let n=t??zc(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Lc(n,r._metadata,r.tunnel,e.getDsn());Bc().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function zc(e){return Bc().get(e)}function Bc(){return di(`clientToLogBufferMap`,()=>new WeakMap)}function Vc(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function Hc(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=To(r)),ys(i,[Vc(e)])}function Uc(e,t){let n=t??Wc(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Hc(n,r._metadata,r.tunnel,e.getDsn());Gc().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Wc(e){return Gc().get(e)}function Gc(){return di(`clientToMetricBufferMap`,()=>new WeakMap)}function Kc(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const qc=Symbol.for(`SentryBufferFullError`);function Jc(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Vs(qc);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Bs(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Kc(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function Yc(e,t=_a()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function Xc(e,t){return e[t]||e.all||0}function Zc(e,t,n=_a()){return Xc(e,t)>n}function Qc(e,{statusCode:t,headers:n},r=_a()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+Yc(o,r):t===429&&(i.all=r+60*1e3);return i}function $c(e,t,n=Jc(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(xs(i,(t,n)=>{let i=Os(n);Zc(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=ys(i[0],a),s=t=>{if(Ss(o,[`client_report`])){R&&H.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}xs(o,(n,r)=>{e.recordDroppedEvent(t,Os(r))})};return n.add(()=>t({body:ws(o)}).then(e=>e.statusCode===413?(R&&H.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(R&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&H.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Qc(r,e),e),e=>{throw s(`network_error`),R&&H.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===qc)return R&&H.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function el(e,t,n){let r=[{type:`client_report`},{timestamp:n||Ia(),discarded_events:e}];return ys(t?{dsn:t}:{},[r])}function tl(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function nl(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[fo],exclusive_time:o?.[po],measurements:e.measurements,is_segment:!0}}function rl(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[fo]:e.profile_id},...e.exclusive_time&&{[po]:e.exclusive_time}}}},measurements:e.measurements}}const il=`Not capturing exception because it's already been captured.`,al=`Discarded session because of missing or non-string release`,ol=Symbol.for(`SentryInternalError`),sl=Symbol.for(`SentryDoNotSendEventError`);function cl(e){return{message:e,[ol]:!0}}function ll(e){return{message:e,[sl]:!0}}function ul(e){return!!e&&typeof e==`object`&&ol in e}function dl(e){return!!e&&typeof e==`object`&&sl in e}function fl(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{a+=r(t),a>=8e5?i(e):s||(s=!0,o=Kc(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var pl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Jc(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=jo(e.dsn):R&&H.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Oc(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&fl(this,`afterCaptureLog`,`flushLogs`,bl,Rc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&fl(this,`afterCaptureMetric`,`flushMetrics`,yl,Uc)}captureException(e,t,n){let r=W();if(Na(e))return R&&H.log(il),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:W(),...n},a=Ji(e)?e:String(e),o=Yi(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=W();if(t?.originalException&&Na(t.originalException))return R&&H.log(il),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=ml(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),Va(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(!t)return!0;this.emit(`flush`);let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){Rc(this);let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let t=this._integrations[e.name];Pc(this,e,this._integrations),t||Nc(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Ns(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=bs(n,Es(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=cs}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){R&&H.warn(al);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){R&&H.warn(al);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Ms(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;R&&H.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return R&&H.error(`Error while sending envelope:`,e),{}}return R&&H.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Mc(this,e),Nc(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(Va(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a?.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),ac(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:uo(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:us(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=G(),r=K()){return R&&_l(e)&&H.log(`Captured error event \`${tl(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{R&&(dl(e)?H.log(e.message):ul(e)?H.warn(e.message):H.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=vl(e),s=_l(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Mo(a);if(s&&typeof l==`number`&&U()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Vs(ll(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=ml(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),ll("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:hl(gl(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw ll(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw dl(e)||ul(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),cl(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===qc&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){R&&H.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){R&&H.log(`No outcomes to send`);return}if(!this._dsn){R&&H.log(`No dsn provided, will not send outcomes`);return}R&&H.log(`Sending outcomes:`,e);let t=el(e,this._options.tunnel&&To(this._dsn));this.sendEnvelope(t)}};function ml(e){return e===`replay_event`?`replay`:e||`error`}function hl(e,t){let n=`${t} must return \`null\` or a valid event.`;if(ea(e))return e.then(e=>{if(!Xi(e)&&e!==null)throw cl(n);return e},e=>{throw cl(`${t} rejected with ${e}`)});if(!Xi(e)&&e!==null)throw cl(n);return e}function gl(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(_l(c)&&i)return i(c,r);if(vl(c)){if(o||s){let t=nl(c);if(s?.length&&as(t,s))return null;if(o){let e=o(t);e?c=Wa(n,rl(e)):es()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&as(e,s)){os(n,e);continue}if(o){let n=o(e);n?t.push(n):(es(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function _l(e){return e.type===void 0}function vl(e){return e.type===`transaction`}function yl(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+xl(e.attributes)}function bl(e){let t=0;return e.message&&(t+=e.message.length*2),t+xl(e.attributes)}function xl(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Sl(e[0]):Yi(e)?t+=Sl(e):t+=100}),t}function Sl(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Cl(e,t,n,r,i){let a={sent_at:new Date().toISOString()};return n?.sdk&&(a.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(a.dsn=To(i)),t&&(a.trace=t),ys(a,[wl(e)])}function wl(e){return[{type:`check_in`},e]}function Tl(e){let t=e._metadata?.sdk,n=t?.name&&t?.version?`${t?.name}/${t?.version}`:void 0;e.transportOptions={...e.transportOptions,headers:{...n&&{"user-agent":n},...e.transportOptions?.headers}}}function El(e,t){return e(t.stack||``,1)}function Dl(e){return Wi(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Ol(e){return Dl(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function kl(e,t){let n={type:t.name||t.constructor.name,value:Ol(t)},r=El(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Al(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function jl(e){if(`name`in e&&typeof e.name==`string`){let t=`'${e.name}' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message '${e.message}'`),t}else if(`message`in e&&typeof e.message==`string`)return e.message;let t=ma(e);if(Ki(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Ml(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Ml(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Nl(e,t,n,r){if(Wi(n))return[n,void 0];if(t.synthetic=!0,Xi(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:fs(n,t)},a=Al(n);if(a)return[a,i];let o=jl(n),s=r?.syntheticException||Error(o);return s.message=o,[s,i]}let i=r?.syntheticException||Error(n);return i.message=`${n}`,[i,void 0]}function Pl(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Nl(e,i,n,r),s={exception:{values:[kl(t,a)]}};return o&&(s.extra=o),Oa(s,void 0,void 0),ka(s,i),{...s,event_id:r?.event_id}}function Fl(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=El(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},ka(a,{synthetic:!0}))}if(Ji(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return a.logentry={message:e,params:n},a}return a.message=t,a}var Il=class extends pl{constructor(e){ns(),Tl(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=Pl(this,this._options.stackParser,e,t);return n.level=`error`,Bs(n)}eventFromMessage(e,t=`info`,n){return Bs(Fl(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return Ll(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&Ll(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:W();if(!this._isEnabled())return R&&H.warn(`SDK not enabled, will not capture check-in.`),r;let{release:i,environment:a,tunnel:o}=this.getOptions(),s={check_in_id:r,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};`duration`in e&&(s.duration=e.duration),t&&(s.monitor_config={schedule:t.schedule,checkin_margin:t.checkinMargin,max_runtime:t.maxRuntime,timezone:t.timezone,failure_issue_threshold:t.failureIssueThreshold,recovery_threshold:t.recoveryThreshold});let[c,l]=Fc(this,n);l&&(s.contexts={trace:l});let u=Cl(s,c,this.getSdkMetadata(),o,this.getDsn());return R&&H.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){R&&H.log(`Disposing client...`);for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Jc(64)}_prepareEvent(e,t,n,r){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,t,n,r)}_setUpMetricsProcessing(){this.on(`processMetric`,e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function Ll(e){let t=K().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const Rl=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),zl=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function Bl(e,t){let n=String(e).toLowerCase();return Rl.has(n)?!1:zl.has(n)?!0:t?.strict?null:!!e}function Vl(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||``,r=t[8]||``;return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function Hl(e){return e.split(/[?#]/,1)[0]}function Ul(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Wl(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:li})),i.version=li)}function Gl(e={}){let t=e.client||q();if(!xc()||!t)return{};let n=oo(B());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||G(),i=e.span||$o(),a=i?Ho(i):Kl(r),o=vo(i?ds(i):us(t,r));if(!No.test(a))return H.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?Uo(i):ql(r)),s}function Kl(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Io(t,r,n)}function ql(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Lo(t,r,n)}const Jl=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Yl(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return R&&!r&&H.log(Jl,e),r;let i=Sa(e,t);return n?.set(e,i),R&&!i&&H.log(Jl,e),i}function Xl(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Zl(e){let t=e.headers||{},n=(typeof t[`x-forwarded-host`]==`string`?t[`x-forwarded-host`]:void 0)||(typeof t.host==`string`?t.host:void 0),r=(typeof t[`x-forwarded-proto`]==`string`?t[`x-forwarded-proto`]:void 0)||e.protocol||(e.socket?.encrypted?`https`:`http`),i=e.url||``,a=Ql({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:$l(i),headers:Xl(t),cookies:s,data:o}}function Ql({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function $l(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function eu(e,t){let n=q(),r=K();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:Ia(),...e},s=i?V(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let tu;const nu=new WeakMap,ru=Y((()=>({name:`FunctionToString`,setupOnce(){tu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=ua(this),n=nu.has(q())&&t!==void 0?t:this;return tu.apply(n,e)}}catch{}},setup(e){nu.set(e,!0)}}))),iu=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,`vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)`,`Can't find variable: _AutofillCallbackHandler`,/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],au=Y((e={})=>{let t;return{name:`EventFilters`,setup(n){t=ou(e,n.getOptions())},processEvent(n,r,i){return t||=ou(e,i.getOptions()),su(n,t)?null:n}}});function ou(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:iu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function su(e,t){if(e.type){if(e.type===`transaction`&&lu(e,t.ignoreTransactions))return R&&H.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Da(e)}`),!0}else{if(cu(e,t.ignoreErrors))return R&&H.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Da(e)}`),!0;if(mu(e))return R&&H.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Da(e)}`),!0;if(uu(e,t.denyUrls))return R&&H.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Da(e)}.\nUrl: ${pu(e)}`),!0;if(!du(e,t.allowUrls))return R&&H.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Da(e)}.\nUrl: ${pu(e)}`),!0}return!1}function cu(e,t){return t?.length?tl(e).some(e=>Sa(e,t)):!1}function lu(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Sa(n,t):!1}function uu(e,t){if(!t?.length)return!1;let n=pu(e);return n?Sa(n,t):!1}function du(e,t){if(!t?.length)return!0;let n=pu(e);return n?Sa(n,t):!0}function fu(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function pu(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?fu(t):null}catch{return R&&H.error(`Cannot extract url for event ${Da(e)}`),null}}function mu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function hu(e,t,n,r,i,a){if(!i.exception?.values||!a||!na(a.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=gu(e,t,r,a.originalException,n,i.exception.values,o,0))}function gu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(na(r[i],Error)){vu(o,s,r);let a=e(t,r[i]),l=c.length;yu(a,i,l,s),c=gu(e,t,n,r[i],i,[a,...c],a,l)}return _u(r)&&r.errors.forEach((a,l)=>{if(na(a,Error)){vu(o,s,r);let u=e(t,a),d=c.length;yu(u,`errors[${l}]`,d,s),c=gu(e,t,n,a,i,[u,...c],u,d)}}),c}function _u(e){return Array.isArray(e.errors)}function vu(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,..._u(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function yu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const bu=Y(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){hu(kl,i.getOptions().stackParser,n,t,e,r)}}}));function xu(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf(`=`,n);if(r===-1)break;let i=e.indexOf(`;`,n);if(i===-1)i=e.length;else if(i<r){n=e.lastIndexOf(`;`,r-1)+1;continue}let a=e.slice(n,r).trim();if(t[a]===void 0){let n=e.slice(r+1,i).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));try{t[a]=n.indexOf(`%`)===-1?n:decodeURIComponent(n)}catch{t[a]=n}}n=i+1}return t}const Su=[`X-Client-IP`,`X-Forwarded-For`,`Fly-Client-IP`,`CF-Connecting-IP`,`Fastly-Client-Ip`,`True-Client-Ip`,`X-Real-IP`,`X-Cluster-Client-IP`,`X-Forwarded`,`Forwarded-For`,`Forwarded`,`X-Vercel-Forwarded-For`];function Cu(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Su.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?wu(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Tu(e))||null}function wu(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Tu(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}const Eu={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Du=Y(((e={})=>{let t={...Eu,...e.include};return{name:`RequestData`,processEvent(e,n,r){let{sdkProcessingMetadata:i={}}=e,{normalizedRequest:a,ipAddress:o}=i,s={...t,ip:t.ip??r.getOptions().sendDefaultPii};return a&&Ou(e,a,{ipAddress:o},s),e}}}));function Ou(e,t,n,r){if(e.request={...e.request,...ku(t,r)},r.ip){let r=t.headers&&Cu(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function ku(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||Su.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?xu(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Au(e){let t=`console`;Pi(t,e),Fi(t,ju)}function ju(){`console`in z&&fi.forEach(function(e){e in z.console&&sa(z.console,e,function(t){return pi[e]=t,function(...t){Ii(`console`,{args:t,level:e}),pi[e]?.apply(z.console,t)}})})}function Mu(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const Nu=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Pu(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Nu.exec(t);return n?n.slice(1):[]}function Fu(e){let t=Pu(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const Iu=Y((e={})=>{let t=new Set(e.levels||fi);return{name:`Console`,setup(e){Au(({args:n,level:r})=>{q()!==e||!t.has(r)||Lu(r,n)})}}});function Lu(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Mu(e),message:Ru(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Ru(e)}`:`Assertion failed`,n.data.arguments=e}else return;eu(n,{input:t,level:e})}function Ru(e){return`util`in z&&typeof z.util.format==`function`?z.util.format(...e):ba(e,` `)}function zu(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function Bu(e,t=!1){return!(t||e&&!e.startsWith(`/`)&&!e.match(/^[A-Z]:/)&&!e.startsWith(`.`)&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes(`node_modules/`)}function Vu(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let a=i.match(r);if(a)return{filename:`<data:${a[2]}>`,function:a[1]};let o=i.match(n);if(o){let t,n,r,i,a;if(o[1]){r=o[1];let e=r.lastIndexOf(`.`);if(r[e-1]===`.`&&e--,e>0){t=r.slice(0,e),n=r.slice(e+1);let i=t.indexOf(`.Module`);i>0&&(r=r.slice(i+1),t=t.slice(0,i))}i=void 0}n&&(i=t,a=n),n===`<anonymous>`&&(a=void 0,r=void 0),r===void 0&&(a||=`?`,r=i?`${i}.${a}`:a);let s=ji(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?Wu(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:Uu(o[3]),colno:Uu(o[4]),in_app:Bu(s||``,c)}}if(i.match(t))return{filename:i}}}function Hu(e){return[90,Vu(e)]}function Uu(e){return parseInt(e||``,10)||void 0}function Wu(e){try{return decodeURI(e)}catch{return}}var Gu=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let t=this._cache.get(e);if(t!==void 0)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){if(this._cache.size>=this._maxSize){let e=this._cache.keys().next().value;this._cache.delete(e)}this._cache.set(e,t)}remove(e){let t=this._cache.get(e);return t&&this._cache.delete(e),t}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(t=>e.push(t)),e}};const X=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var Ku=class extends Il{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||A.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};Wl(n,`node-light`,[`node-core`]),H.log(`Initializing Sentry: process: ${process.pid}, thread: ${nt?`main`:`worker-${rt}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Rc(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener))}async flush(e){return this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){return this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off(`beforeExit`,this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off(`beforeExit`,this._logOnExitFlushListener),super.close(e)}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{X&&H.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const qu=Y((e={})=>({name:`ChildProcess`,setup(){it.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&Ju(t.process,e)}),it.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&Yu(t.worker,e)})}}));function Ju(e,t){let n=!1,r;e.on(`spawn`,()=>{if(e.spawnfile===`/usr/bin/sw_vers`){n=!0;return}r={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(r.spawnargs=e.spawnargs)}).on(`exit`,e=>{n||(n=!0,e!==null&&e!==0&&eu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,eu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function Yu(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?eu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):gc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const Xu=Ue(ct),Zu=Ue(ut),Qu=Y(((e={})=>{let t,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e};async function r(e){t===void 0&&(t=i());let n=$u(await t);return e.contexts={...e.contexts,app:{...n.app,...e.contexts?.app},os:{...n.os,...e.contexts?.os},device:{...n.device,...e.contexts?.device},culture:{...n.culture,...e.contexts?.culture},cloud_resource:{...n.cloud_resource,...e.contexts?.cloud_resource}},e}async function i(){let e={};if(n.os&&(e.os=await ed()),n.app&&(e.app=nd()),n.device&&(e.device=rd(n.device)),n.culture){let t=td();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=ud()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function $u(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory==`function`){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=A.freemem()),e}async function ed(){let e=A.platform();switch(e){case`darwin`:return sd();case`linux`:return ld();default:return{name:id[e]||e,version:A.release()}}}function td(){try{if(typeof process.versions.icu!=`string`)return;let e=new Date(9e8);if(new Intl.DateTimeFormat(`es`,{month:`long`}).format(e)===`enero`){let e=Intl.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone}}}catch{}}function nd(){let e=process.memoryUsage().rss,t={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory==`function`){let e=process.availableMemory?.();e!=null&&(t.free_memory=e)}return t}function rd(e){let t={},n;try{n=A.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=A.arch(),(e===!0||e.memory)&&(t.memory_size=A.totalmem(),t.free_memory=A.freemem()),e===!0||e.cpu){let e=A.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const id={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},ad=[{name:`fedora-release`,distros:[`Fedora`]},{name:`redhat-release`,distros:[`Red Hat Linux`,`Centos`]},{name:`redhat_version`,distros:[`Red Hat Linux`]},{name:`SuSE-release`,distros:[`SUSE Linux`]},{name:`lsb-release`,distros:[`Ubuntu Linux`,`Arch Linux`]},{name:`debian_version`,distros:[`Debian`]},{name:`debian_release`,distros:[`Debian`]},{name:`arch-release`,distros:[`Arch Linux`]},{name:`gentoo-release`,distros:[`Gentoo Linux`]},{name:`novell-release`,distros:[`SUSE Linux`]},{name:`alpine-release`,distros:[`Alpine Linux`]}],od={alpine:e=>e,arch:e=>Z(/distrib_release=(.*)/,e),centos:e=>Z(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Z(/release (..)/,e),mint:e=>Z(/distrib_release=(.*)/,e),red:e=>Z(/release ([^ ]+)/,e),suse:e=>Z(/VERSION = (.*)\n/,e),ubuntu:e=>Z(/distrib_release=(.*)/,e)};function Z(e,t){let n=e.exec(t);return n?n[1]:void 0}async function sd(){let e={kernel_version:A.release(),name:`Mac OS X`,version:`10.${Number(A.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Ze(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Z(/^ProductName:\s+(.*)$/m,t),e.version=Z(/^ProductVersion:\s+(.*)$/m,t),e.build=Z(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function cd(e){return e.split(` `)[0].toLowerCase()}async function ld(){let e={kernel_version:A.release(),name:`Linux`};try{let t=await Zu(`/etc`),n=ad.find(e=>t.includes(e.name));if(!n)return e;let r=(await Xu(qe(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(cd(e))>=0)||i[0],e.version=od[cd(e.name)]?.(r)}catch{}return e}function ud(){if(process.env.VERCEL)return{"cloud.provider":`vercel`,"cloud.region":process.env.VERCEL_REGION};if(process.env.AWS_REGION)return{"cloud.provider":`aws`,"cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV};if(process.env.GCP_PROJECT)return{"cloud.provider":`gcp`};if(process.env.ALIYUN_REGION_ID)return{"cloud.provider":`alibaba_cloud`,"cloud.region":process.env.ALIYUN_REGION_ID};if(process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME)return{"cloud.provider":`azure`,"cloud.region":process.env.REGION_NAME};if(process.env.IBM_CLOUD_REGION)return{"cloud.provider":`ibm_cloud`,"cloud.region":process.env.IBM_CLOUD_REGION};if(process.env.TENCENTCLOUD_REGION)return{"cloud.provider":`tencent_cloud`,"cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE};if(process.env.NETLIFY)return{"cloud.provider":`netlify`};if(process.env.FLY_REGION)return{"cloud.provider":`fly.io`,"cloud.region":process.env.FLY_REGION};if(process.env.DYNO)return{"cloud.provider":`heroku`}}const dd=new Gu(10),fd=new Gu(20);function pd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function md(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function hd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function gd(e,t){let n=dd.get(e);if(n===void 0)return!1;for(let e=t[0];e<=t[1];e++)if(n[e]===void 0)return!1;return!0}function _d(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=Td(r,t),a=[];for(;;){if(n===e.length-1){a.push(i);break}let r=e[n+1];if(typeof r!=`number`)break;r<=i[1]?i[1]=r+t:(a.push(i),i=Td(r,t)),n++}return a}function vd(e,t,n){return new Promise((r,i)=>{let a=ot(e),o=$e({input:a});function s(){a.destroy(),r()}let c=0,l=0,u=t[l];if(u===void 0){s();return}let d=u[0],f=u[1];function p(t){fd.set(e,1),X&&H.error(`Failed to read file: ${e}. Error: ${t}`),o.close(),o.removeAllListeners(),s()}a.on(`error`,p),o.on(`error`,p),o.on(`close`,s),o.on(`line`,e=>{if(c++,!(c<d)&&(n[c]=ya(e,0),c>=f)){if(l===t.length-1){o.close(),o.removeAllListeners();return}l++;let e=t[l];if(e===void 0){o.close(),o.removeAllListeners();return}d=e[0],f=e[1]}})})}async function yd(e,t){let n={};if(t>0&&e.exception?.values){for(let t of e.exception.values)if(t.stacktrace?.frames?.length)for(let e=t.stacktrace.frames.length-1;e>=0;e--){let r=t.stacktrace.frames[e],i=r?.filename;!r||typeof i!=`string`||typeof r.lineno!=`number`||md(i)||hd(r)||(n[i]||(n[i]=[]),n[i].push(r.lineno))}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let e of r){if(fd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=_d(r,t);if(a.every(t=>gd(e,t)))continue;let o=pd(dd,e,{});i.push(vd(e,a,o))}if(await Promise.all(i).catch(()=>{X&&H.log(`Failed to read one or more source files and resolve context lines`)}),t>0&&e.exception?.values)for(let n of e.exception.values)n.stacktrace?.frames&&n.stacktrace.frames.length>0&&bd(n.stacktrace.frames,t,dd);return e}function bd(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno==`number`){let e=n.get(r.filename);if(e===void 0)continue;Sd(r.lineno,r,t,e)}}function xd(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Sd(e,t,n,r){if(t.lineno===void 0||r===void 0){X&&H.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=Cd(e,n);i<e;i++){let e=r[i];if(e===void 0){xd(t),X&&H.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){xd(t),X&&H.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=wd(e,n);t.post_context=[];for(let n=e+1;n<=i;n++){let e=r[n];if(e===void 0)break;t.post_context.push(e)}}function Cd(e,t){return Math.max(1,e-t)}function wd(e,t){return e+t}function Td(e,t){return[Cd(e,t),wd(e,t)]}const Ed=Y(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return yd(e,t)}}})),Dd=Ma(process.versions.node),Od=Dd.major;Dd.minor;let kd;async function Ad(){if(kd===void 0)try{kd=!!(await import(`node:inspector`)).url()}catch{kd=!1}return kd}const jd=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Md(e,t,n){let r=0,i=5,a=0;return setInterval(()=>{a===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),a=i):(--a,a===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function Nd(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function Pd(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Nd(e)&&Nd(t)}function Fd(...e){H.log(`[LocalVariables]`,...e)}const Id=Y(((e={})=>{function t(t,n){let r=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<r.length;t++){let i=r.length-t-1,a=n[t],o=r[i];if(!o||!a)break;a.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!Pd(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&jd in n.originalException&&Array.isArray(n.originalException[jd])){for(let r of e.exception?.values||[])t(r,n.originalException[jd]);n.originalException[jd]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new dt(new URL(`data:application/javascript;base64,LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQyLjAgKDA3YzkxOTApIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{Fd(`Worker error`,e)}),t.once(`exit`,e=>{Fd(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await Ad()){H.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:H.isEnabled()};r().then(()=>{try{i(n)}catch(e){H.error(`Failed to start worker`,e)}},e=>{H.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function Ld(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function Rd(e,t){if(t!==void 0)return Ld(e(t,1))}function zd(e){let t=[],n=!1;function r(r){t=[],!n&&(n=!0,e(r))}t.push(r);function i(e){t.push(e)}function a(e){let n=t.pop()||r;try{n(e)}catch{r(e)}}return{add:i,next:a}}var Bd=class e{constructor(e){this._session=e}static async create(t){return t||new e(new(await(import(`node:inspector`))).Session)}configureAndConnect(e,t){this._session.connect(),this._session.on(`Debugger.paused`,t=>{e(t,()=>{this._session.post(`Debugger.resume`)})}),this._session.post(`Debugger.enable`),this._session.post(`Debugger.setPauseOnExceptions`,{state:t?`all`:`uncaught`})}setPauseOnExceptions(e){this._session.post(`Debugger.setPauseOnExceptions`,{state:e?`all`:`uncaught`})}getLocalVariables(e,t){this._getProperties(e,e=>{let{add:n,next:r}=zd(t);for(let t of e)if(t.value?.objectId&&t.value.className===`Array`){let e=t.value.objectId;n(n=>this._unrollArray(e,t.name,n,r))}else if(t.value?.objectId&&t.value.className===`Object`){let e=t.value.objectId;n(n=>this._unrollObject(e,t.name,n,r))}else t.value&&n(e=>this._unrollOther(t,e,r));r({})})}_getProperties(e,t){this._session.post(`Runtime.getProperties`,{objectId:e,ownProperties:!0},(e,n)=>{t(e?[]:n.result)})}_unrollArray(e,t,n,r){this._getProperties(e,e=>{n[t]=e.filter(e=>e.name!==`length`&&!isNaN(parseInt(e.name,10))).sort((e,t)=>parseInt(e.name,10)-parseInt(t.name,10)).map(e=>e.value?.value),r(n)})}_unrollObject(e,t,n,r){this._getProperties(e,e=>{n[t]=e.map(e=>[e.name,e.value?.value]).reduce((e,[t,n])=>(e[t]=n,e),{}),r(n)})}_unrollOther(e,t,n){e.value&&(`value`in e.value?e.value.value===void 0||e.value.value===null?t[e.name]=`<${e.value.value}>`:t[e.name]=e.value.value:`description`in e.value&&e.value.type!==`function`?t[e.name]=`<${e.value.description}>`:e.value.type===`undefined`&&(t[e.name]=`<undefined>`)),n(t)}};const Vd=Y(((e={},t)=>{let n=new Gu(20),r,i=!1;function a(t){let r=Ld(t.stacktrace?.frames);if(r===void 0)return;let i=n.remove(r);if(i===void 0)return;let a=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<a.length;t++){let n=a.length-t-1,r=i[t],o=a[n];if(!o||!r)break;r.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!Pd(o.function,r.function)||(o.vars=r.vars)}}function o(e){for(let t of e.exception?.values||[])a(t);return e}let s;async function c(){let a=q()?.getOptions();if(a?.includeLocalVariables){if(Od<18){H.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Ad()){H.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Bd.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=Rd(e,i.description);if(c==null){s();return}let{add:l,next:u}=zd(e=>{n.set(c,e),s()});for(let e=0;e<Math.min(a.length,5);e++){let{scopeChain:t,functionName:n,this:r}=a[e],i=t.find(e=>e.type===`local`),s=r.className===`global`||!r.className?n:`${r.className}.${n}`;if(i?.object.objectId===void 0)l(t=>{t[e]={function:s},u(t)});else{let t=i.object.objectId;l(n=>o.getLocalVariables(t,t=>{n[e]={function:s,vars:t},u(n)}))}}u([])},c=e.captureAllExceptions!==!1;o.configureAndConnect((e,t)=>s(a.stackParser,e,t),c),c&&(r=Md(e.maxExceptionsPerSecond||50,()=>{H.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{H.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){H.log("The `LocalVariables` integration failed to start.",e)}}}return{name:`LocalVariables`,setupOnce(){s=c()},async processEvent(e){return await s,i?o(e):e},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}})),Hd=(e={})=>Dd.major<19?Vd(e):Id(e);function Ud(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let Wd;const Gd=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,Kd=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...Xd()},e},getModules:Xd}));function qd(){try{return t.cache?Object.keys(t.cache):[]}catch{return[]}}function Jd(){return{...Gd,...Qd(),...Ud()?Yd():{}}}function Yd(){let e=t.main?.paths||[],n=qd(),r={},i=new Set;return n.forEach(t=>{let n=t,a=()=>{let t=n;if(n=Ke(t),!n||t===n||i.has(t))return;if(e.indexOf(n)<0)return a();let o=qe(t,`package.json`);if(i.add(t),!st(o))return a();try{let e=JSON.parse(lt(o,`utf8`));r[e.name]=e.version}catch{}};a()}),r}function Xd(){return Wd||=Jd(),Wd}function Zd(){try{let e=qe(process.cwd(),`package.json`);return JSON.parse(lt(e,`utf8`))}catch{return{}}}function Qd(){let e=Zd();return{...e.dependencies,...e.devDependencies}}function $d(e){V(()=>{console.error(e)});let t=q();if(t===void 0){X&&H.warn(`No NodeClient was defined, we are exiting the process now.`),global.process.exit(1);return}let n=t.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:2e3;t.close(r).then(e=>{e||X&&H.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{X&&H.error(e)})}const ef=Y((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){nt&&global.process.on(`uncaughtException`,tf(e,t))}}});function tf(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=$d;t.onFatalError?c=t.onFatalError:o.onFatalError&&(c=o.onFatalError);let l=global.process.listeners(`uncaughtException`).filter(e=>e.name!==`domainUncaughtExceptionClear`&&e.tag!==`sentry_tracingErrorCallback`&&e._errorHandler!==!0).length===0,u=t.exitEvenIfOtherHandlersAreRegistered||l;n?u&&(i?(X&&H.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),$d(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,q()===e&&gc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const nf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],rf=Y(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...nf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,cf(e,t))}}}));function af(e){if(typeof e!=`object`||!e)return{name:``,message:String(e??``)};let t=e;return{name:typeof t.name==`string`?t.name:``,message:typeof t.message==`string`?t.message:String(e)}}function of(e,t){let n=e.name===void 0||xa(t.name,e.name,!0),r=e.message===void 0||xa(t.message,e.message);return n&&r}function sf(e,t){let n=af(t);return e.some(e=>of(e,n))}function cf(e,t){return function(n,r){if(q()!==e||sf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>Is(a,e):e=>e())(()=>{gc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),lf(n,t.mode)}}function lf(e,t){let n=`This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:`;t===`warn`?V(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(V(()=>{console.warn(n)}),$d(e))}const uf=Y(()=>({name:`ProcessSession`,setupOnce(){Sc(),process.on(`beforeExit`,()=>{K().getSession()?.status!==`ok`&&Cc()})}})),df=`Spotlight`,ff=Y(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:df,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&H.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}pf(e,t)}}}));function pf(e,t){let n=mf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){H.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=ws(e);Ls(()=>{let e=et.request({method:`POST`,path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":`application/x-sentry-envelope`}},e=>{e.statusCode&&e.statusCode>=200&&e.statusCode<400&&(r=0),e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`)});e.on(`error`,()=>{r++,H.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function mf(e){try{return new URL(`${e}`)}catch{H.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function hf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Ve.getSystemErrorMap().has(e.errno)}const gf=Y((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!hf(n.originalException))return t;let i=n.originalException,a={...i};!r.getOptions().sendDefaultPii&&e.includePaths!==!0&&(delete a.path,delete a.dest),t.contexts={...t.contexts,node_system_error:a};for(let e of t.exception?.values||[])e.value&&(i.path&&e.value.includes(i.path)&&(e.value=e.value.replace(`'${i.path}'`,``).trim()),i.dest&&e.value.includes(i.dest)&&(e.value=e.value.replace(`'${i.dest}'`,``).trim()));return t}}));function _f(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function vf(e=process.argv[1]?Fu(process.argv[1]):process.cwd(),t=Ye===`\\`){let n=t?_f(e):e;return e=>{if(!e)return;let r=t?_f(e):e,{dir:i,base:a,ext:o}=Je.parse(r);(o===`.js`||o===`.mjs`||o===`.cjs`)&&(a=a.slice(0,o.length*-1));let s=decodeURIComponent(a);i||=`.`;let c=i.lastIndexOf(`/node_modules`);if(c>-1)return`${i.slice(c+14).replace(/\//g,`.`)}:${s}`;if(i.startsWith(n)){let e=i.slice(n.length+1).replace(/\//g,`.`);return e?`${e}:${s}`:s}return s}}function yf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(z.SENTRY_RELEASE?.id)return z.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||n||r||e}const bf=wi(Hu(vf())),Q=Symbol(`AgentBaseInternalState`);var xf=class extends et.Agent{constructor(e){super(e),this[Q]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==`boolean`)return e.secureEndpoint;if(typeof e.protocol==`string`)return e.protocol===`https:`}let{stack:t}=Error();return typeof t==`string`?t.split(`
187
+ `).some(e=>e.indexOf(`(https.js:`)!==-1||e.indexOf(`node:https:`)!==-1):!1}createSocket(e,t,n){let r={...t,secureEndpoint:this.isSecureEndpoint(t)};Promise.resolve().then(()=>this.connect(e,r)).then(i=>{if(i instanceof et.Agent)return i.addRequest(e,r);this[Q].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[Q].currentSocket;if(this[Q].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[Q].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[Q]&&(this[Q].defaultPort=e)}get protocol(){return this[Q].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[Q]&&(this[Q].protocol=e)}};function Sf(...e){H.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function Cf(e){return new Promise((t,n)=>{let r=0,i=[];function a(){let t=e.read();t?l(t):e.once(`readable`,a)}function o(){e.removeListener(`end`,s),e.removeListener(`error`,c),e.removeListener(`readable`,a)}function s(){o(),Sf(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),Sf(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
195
188
  \r
196
- `);if(l===-1){tp(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
197
- `),d=u.shift();if(!d)return e.destroy(),n(Error(`No header received from proxy CONNECT response`));let f=d.split(` `),p=+(f[1]||0),m=f.slice(2).join(` `),h={};for(let t of u){if(!t)continue;let r=t.indexOf(`:`);if(r===-1)return e.destroy(),n(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,r).toLowerCase(),a=t.slice(r+1).trimStart(),o=h[i];typeof o==`string`?h[i]=[o,a]:Array.isArray(o)?o.push(a):h[i]=a}tp(`got proxy server response: %o %o`,d,h),o(),t({connect:{statusCode:p,statusText:m,headers:h},buffered:c})}e.on(`error`,c),e.on(`end`,s),a()})}function rp(...e){V.log(`[https-proxy-agent]`,...e)}var ip=class extends ep{static __initStatic(){this.protocols=[`http`,`https`]}constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},rp(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?op(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;if(n.protocol===`https:`){rp("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=mt.connect({...this.connectOpts,servername:e&&pt.isIP(e)?void 0:e})}else rp("Creating `net.Socket`: %o",this.connectOpts),r=pt.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=pt.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r\n`;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r\n`;let s=np(r);r.write(`${o}\r\n`);let{connect:c,buffered:l}=await s;if(e.emit(`proxyConnect`,c),this.emit(`proxyConnect`,c,e),c.statusCode===200){if(e.once(`socket`,ap),t.secureEndpoint){rp(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return mt.connect({...op(t,`host`,`path`,`port`),socket:r,servername:pt.isIP(e)?void 0:e})}return r}r.destroy();let u=new pt.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{rp(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};ip.__initStatic();function ap(e){e.resume()}function op(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function sp(e){return new Ye({read(){this.push(e),this.push(null)}})}function cp(e){let t;try{t=new URL(e.url)}catch{return B(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),Ml(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=lp(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?dt:Ze,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new ip(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return Ml(e,up(e,e.httpModule??i,o))}function lp(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function up(e,t,n){let{hostname:r,pathname:i,port:a,protocol:o,search:s}=new URL(e.url);return function(c){return new Promise((l,u)=>{_c(()=>{let d=sp(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(ft()));let p=r.startsWith(`[`),m=t.request({method:`POST`,agent:n,headers:f,hostname:p?r.slice(1,-1):r,path:`${i}${s}`,port:a,protocol:o,ca:e.caCerts},e=>{e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`);let t=e.headers[`retry-after`]??null,n=e.headers[`x-sentry-rate-limits`]??null;l({statusCode:e.statusCode,headers:{"retry-after":t,"x-sentry-rate-limits":Array.isArray(n)?n[0]||null:n}})});m.on(`error`,u),d.pipe(m)})})}}function dp(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=yu(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?n??!0:t??n}function fp(){let e=new ht;function t(){return e.getStore()||{scope:No(),isolationScope:Po()}}function n(n){let r=t().scope.clone(),i=t().isolationScope;return e.run({scope:r,isolationScope:i},()=>n(r))}function r(n,r){let i=t().isolationScope.clone();return e.run({scope:n,isolationScope:i},()=>r(n))}function i(n){let r=t().scope.clone(),i=t().isolationScope.clone();return e.run({scope:r,isolationScope:i},()=>n(i))}function a(n,r){let i=t().scope.clone();return e.run({scope:i,isolationScope:n},()=>r(n))}function o(e){return n(t=>(t.setSDKProcessingMetadata({__SENTRY_SUPPRESS_TRACING__:!0}),e()))}Vo({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function pp(e,t,n,r){let i=0,a=[];Z&&V.log(r,`Patching request.on`);let o=new WeakMap,s=n===`small`?1e3:n===`medium`?1e4:1048576;try{e.on=new Proxy(e.on,{apply:(e,t,n)=>{let[c,l,...u]=n;if(c===`data`){Z&&V.log(r,`Handling request.on("data") with maximum body size of ${s}b`);let n=new Proxy(l,{apply:(e,t,n)=>{try{let e=n[0],t=Buffer.from(e);i<s?(a.push(t),i+=t.byteLength):Z&&V.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Z&&V.error(r,`Encountered error while storing body chunk.`)}return Reflect.apply(e,t,n)}});return o.set(l,n),Reflect.apply(e,t,[c,n,...u])}return Reflect.apply(e,t,n)}}),e.off=new Proxy(e.off,{apply:(e,t,n)=>{let[,r]=n,i=o.get(r);if(i){o.delete(r);let a=n.slice();return a[1]=i,Reflect.apply(e,t,a)}return Reflect.apply(e,t,n)}}),e.on(`end`,()=>{try{let e=Buffer.concat(a).toString(`utf-8`);if(e){let n=Buffer.byteLength(e,`utf-8`)>s?`${Buffer.from(e).subarray(0,s-3).toString(`utf-8`)}...`:e;t.setSDKProcessingMetadata({normalizedRequest:{data:n}})}}catch(e){Z&&V.error(r,`Error building captured request body`,e)}})}catch(e){Z&&V.error(r,`Error patching request to capture body`,e)}}function mp(e,t){if(!e)return t;let n=$o(e),r=$o(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),ts(i)}const hp=`@sentry/instrumentation-http`;function gp(e,t){let n=vp(e),r=t?.statusCode,i=vd(r);Nu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function _p(e,t){let n=bp(e),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=Ou(n,r,t)?wu({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(o&&!e.getHeader(`sentry-trace`))try{e.setHeader(`sentry-trace`,o),Z&&V.log(hp,`Added sentry-trace header to outgoing request`)}catch(e){Z&&V.error(hp,`Failed to add sentry-trace header to outgoing request:`,Ta(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Z&&V.log(hp,`Added traceparent header to outgoing request`)}catch(e){Z&&V.error(hp,`Failed to add traceparent header to outgoing request:`,Ta(e)?e.message:`Unknown error`)}if(s){let t=mp(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Z&&V.log(hp,`Added baggage header to outgoing request`)}catch(e){Z&&V.error(hp,`Failed to add baggage header to outgoing request:`,Ta(e)?e.message:`Unknown error`)}}}function vp(e){try{let t=e.getHeader(`host`)||e.host,n=bu(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Su(n),"http.method":e.method||`GET`};return n.search&&(r[`http.query`]=n.search),n.hash&&(r[`http.fragment`]=n.hash),r}catch{return{}}}function yp(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function bp(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const xp=`Http`,Sp=new WeakSet,Cp=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new wd(100),r=new WeakMap;return{name:xp,setupOnce(){it(`http.server.request.start`,(e=>{wp(e.server,t)})),it(`http.client.request.created`,(e=>{Tp(e.request,t,n,r)})),it(`http.client.response.finish`,(e=>{let n=e;Ep(n.request,n.response,t,r)})),it(`http.client.request.error`,(e=>{Ep(e.request,void 0,t,r)}))}}});function wp(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(Sp.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!G().getClient())return e.apply(r,i);Z&&V.log(xp,`Handling incoming request`);let a=K().clone(),o=i[1],s=Au(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&pp(o,a,n,xp),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${xu(l)}`;return a.setTransactionName(u),Wo(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return hc({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(G().getPropagationContext().propagationSpanId=Oo(),e.apply(r,i)))})}});Sp.add(i),e.emit=i}function Tp(e,t,n,r){let i=Dp(e,t);r.set(e,i),!i&&_p(e,n)}function Ep(e,t,n,r){n.breadcrumbs&&((r.get(e)??Dp(e,n))||gp(e,t))}function Dp(e,t){if(G().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,yp(e)):!1}const Op=`sentry-trace`,kp=`baggage`,Ap=/baggage: (.*)\r\n/;function jp(e,t){let n=Pp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=Ou(n,r,t)?wu({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(Array.isArray(e.headers)){let t=e.headers;o&&!t.includes(Op)&&t.push(Op,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===kp);if(s&&n===-1)t.push(kp,s);else if(s){let e=t[n+1],r=mp(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Op}:`)&&(e.headers+=`${Op}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(Ap)?.[1];if(s&&!n)e.headers+=`${kp}: ${s}\r\n`;else if(s){let t=mp(n,s);t&&(e.headers=e.headers.replace(Ap,`baggage: ${t}\r\n`))}}}function Mp(e,t){let n=Np(e),r=t.statusCode,i=vd(r);Nu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Np(e){try{let t=bu(Pp(e.origin,e.path)),n={url:Su(t),"http.method":e.method||`GET`};return t.search&&(n[`http.query`]=t.search),t.hash&&(n[`http.fragment`]=t.hash),n}catch{return{}}}function Pp(e,t=`/`){try{return new URL(t,e).toString()}catch{let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}}const Fp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new wd(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){it(`undici:request:create`,(e=>{Ip(e.request,t,n,r)})),it(`undici:request:headers`,(e=>{let n=e;Lp(n.request,n.response,t,r)}))}}});function Ip(e,t,n,r){let i=Rp(e,t);r.set(e,i),!i&&jp(e,n)}function Lp(e,t,n,r){n.breadcrumbs&&(r.get(e)||Mp(e,t))}function Rp(e,t){if(G().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(Pp(e.origin,e.path)):!1}function zp(){return[Ru(),Iu(),$u(),od(),Yf(),hd(),Cp(),Fp(),Pf(),Lf(),of(),Sf(),jd(),Ed(),Uf(),Ef()]}function Bp(e={}){return Vp(e,zp)}function Vp(e={},t){let n=Hp(e,t);n.debug===!0&&(Z?V.enable():B(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),fp(),G().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===Wf)&&n.integrations.push(Gf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Cu(n,`node-light`,[`node-core`]);let r=new Td(n);return G().setClient(r),r.init(),V.log(`SDK initialized from ${Cf()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),Gp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function Hp(e,t){let n=Up(e.release),r=dp(e.spotlight),i=Wp(e.tracesSampleRate),a={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??cp,stackParser:oa(e.stackParser||$f),release:n,tracesSampleRate:i,spotlight:r,debug:yu(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:ul({defaultIntegrations:s,integrations:o})}}function Up(e){if(e!==void 0)return e;let t=Qf();if(t!==void 0)return t}function Wp(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let n=parseFloat(t);return isFinite(n)?n:void 0}function Gp(){if(yu(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=hs(e,t);G().setPropagationContext(n)}}function Kp(){return w.PRISMIC_SENTRY_ENABLED??w.PROD}function qp(){if(w.PRISMIC_SENTRY_ENVIRONMENT)return w.PRISMIC_SENTRY_ENVIRONMENT;let e=_t.match(/-(.+?)\./);return e?e[1]:`production`}function Jp(){try{if(!Kp())return;Bp({dsn:w.PRISMIC_SENTRY_DSN,release:_t,environment:qp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),Xc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function Yp(e){try{if(!Kp())return;Yc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await $c()}catch{}}const Xp=Qc,Zp=Zc,Qp=Xc,$p=De({latestKnownVersion:x(E()),lastUpdateCheckAt:x(we())});async function em(e){try{if(tm())return;let t=await nm(e.statePath),n=_t;if(t?.latestKnownVersion&&rm(t.latestKnownVersion,n)){let r=`Update available: ${n} → ${t.latestKnownVersion}. Run \`npx ${e.npmPackageName}@latest --version\` to update.`;process.on(`exit`,()=>{try{console.error(`\n${r}`)}catch{}})}(!t?.lastUpdateCheckAt||Date.now()-t.lastUpdateCheckAt>864e5)&&process.on(`exit`,()=>{im(e.npmPackageName,e.statePath)})}catch{}}function tm(){return process.env.NO_UPDATE_NOTIFIER===`0`?!1:!!(process.env.NO_UPDATE_NOTIFIER===`1`||process.env.CI||!process.stderr.isTTY)}async function nm(e){try{let t=await Ie(e,`utf-8`);return _e($p,JSON.parse(t))}catch{return}}function rm(e,t){if(e.includes(`-`)||t.includes(`-`))return!1;let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);if(n.length!==3||r.length!==3||n.some(e=>!Number.isFinite(e))||r.some(e=>!Number.isFinite(e)))return!1;for(let e=0;e<3;e++){if(n[e]>r[e])return!0;if(n[e]<r[e])return!1}return!1}function im(e,t){try{let n=Buffer.from(JSON.stringify({npmPackageName:e,statePath:Re(t),timeoutMs:2e3})).toString(`base64`);Je(process.execPath,[`--input-type=module`,`-e`,am,n],{detached:!0,stdio:`ignore`}).unref()}catch{}}const am=`
198
- const {npmPackageName, statePath, timeoutMs} = JSON.parse(Buffer.from(process.argv[1], "base64").toString());
199
- try {
200
- const url = \`https://registry.npmjs.org/\${npmPackageName}/latest\`;
201
- const res = await fetch(url, {signal: AbortSignal.timeout(timeoutMs)});
202
- if (!res.ok) process.exit(0);
203
- const {version} = await res.json();
204
- if (typeof version !== "string") process.exit(0);
205
- const fs = await import("node:fs/promises");
206
- const {dirname} = await import("node:path");
207
- await fs.mkdir(dirname(statePath), {recursive: true});
208
- await fs.writeFile(statePath, JSON.stringify({latestKnownVersion: version, lastUpdateCheckAt: Date.now()}, null, 2));
209
- } catch {}
210
- `,om=[`login`,`logout`,`whoami`,`sync`,`docs`],sm=[`login`,`logout`],cm=j({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,commands:{init:{handler:Vn,description:`Initialize a Prismic project`},docs:{handler:rn,description:`Browse Prismic documentation`},gen:{handler:zn,description:`Generate files from local models`},sync:{handler:Ei,description:`Sync types and slices from Prismic`},locale:{handler:Zn,description:`Manage locales`},repo:{handler:qr,description:`Manage repositories`},type:{handler:Ut,description:`Manage content types`},field:{handler:In,description:`Manage fields`},slice:{handler:ii,description:`Manage slices`},preview:{handler:pr,description:`Manage preview configurations`},token:{handler:Pi,description:`Manage API tokens`},webhook:{handler:Hi,description:`Manage webhooks`},login:{handler:Qn,description:`Log in to Prismic`},logout:{handler:er,description:`Log out of Prismic`},whoami:{handler:Ui,description:`Show the currently logged in user`}}});await lm();async function lm(){await em({npmPackageName:gt,statePath:Ct}),jt().catch(()=>{});let{positionals:[e],values:{version:t,help:n,repo:r=await oe()}}=Pe({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(_t);return}if(typeof r!=`string`&&(r=``),!n){Jp(),await mi(),r&&(vi(r),Zp(`repository`,r),Qp(`Repository Data`,{name:r}));try{Zp(`framework`,(await b()).id)}catch{}e&&!sm.includes(e)&&Tt().then(async e=>{if(!e)return;let t=await f({token:e,host:await k()});_i({shortId:t.shortId,intercomHash:t.intercomHash}),Xp({id:t.shortId})}).catch(()=>{}),e&&!om.includes(e)&&hi(e)}try{await cm(),e&&!om.includes(e)&&gi(e)}catch(t){if(process.exitCode=1,om.includes(e)||gi(e,{error:t}),t instanceof M||t instanceof me){console.error(t.message);return}if(t instanceof ae||t instanceof Ce){console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof l){console.error(t.message||`Not found. Verify the repository and any specified identifiers exist.`);return}if(t instanceof Te){console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof se){console.error(`${t.message} Run \`prismic init\` to create a config.`);return}if(t instanceof ge){console.error(Ee`
189
+ `);if(l===-1){Sf(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
190
+ `),d=u.shift();if(!d)return e.destroy(),n(Error(`No header received from proxy CONNECT response`));let f=d.split(` `),p=+(f[1]||0),m=f.slice(2).join(` `),h={};for(let t of u){if(!t)continue;let r=t.indexOf(`:`);if(r===-1)return e.destroy(),n(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,r).toLowerCase(),a=t.slice(r+1).trimStart(),o=h[i];typeof o==`string`?h[i]=[o,a]:Array.isArray(o)?o.push(a):h[i]=a}Sf(`got proxy server response: %o %o`,d,h),o(),t({connect:{statusCode:p,statusText:m,headers:h},buffered:c})}e.on(`error`,c),e.on(`end`,s),a()})}function wf(...e){H.log(`[https-proxy-agent]`,...e)}var Tf=class extends xf{static __initStatic(){this.protocols=[`http`,`https`]}constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},wf(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?Df(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;if(n.protocol===`https:`){wf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=ht.connect({...this.connectOpts,servername:e&&mt.isIP(e)?void 0:e})}else wf("Creating `net.Socket`: %o",this.connectOpts),r=mt.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=mt.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r\n`;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r\n`;let s=Cf(r);r.write(`${o}\r\n`);let{connect:c,buffered:l}=await s;if(e.emit(`proxyConnect`,c),this.emit(`proxyConnect`,c,e),c.statusCode===200){if(e.once(`socket`,Ef),t.secureEndpoint){wf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return ht.connect({...Df(t,`host`,`path`,`port`),socket:r,servername:mt.isIP(e)?void 0:e})}return r}r.destroy();let u=new mt.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{wf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Tf.__initStatic();function Ef(e){e.resume()}function Df(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function Of(e){return new Qe({read(){this.push(e),this.push(null)}})}function kf(e){let t;try{t=new URL(e.url)}catch{return V(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),$c(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=Af(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?ft:et,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Tf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return $c(e,jf(e,e.httpModule??i,o))}function Af(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function jf(e,t,n){let{hostname:r,pathname:i,port:a,protocol:o,search:s}=new URL(e.url);return function(c){return new Promise((l,u)=>{Ls(()=>{let d=Of(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(pt()));let p=r.startsWith(`[`),m=t.request({method:`POST`,agent:n,headers:f,hostname:p?r.slice(1,-1):r,path:`${i}${s}`,port:a,protocol:o,ca:e.caCerts},e=>{e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`);let t=e.headers[`retry-after`]??null,n=e.headers[`x-sentry-rate-limits`]??null;l({statusCode:e.statusCode,headers:{"retry-after":t,"x-sentry-rate-limits":Array.isArray(n)?n[0]||null:n}})});m.on(`error`,u),d.pipe(m)})})}}function Mf(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=Bl(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?n??!0:t??n}function Nf(){let e=new gt;function t(){return e.getStore()||{scope:Za(),isolationScope:Qa()}}function n(n){let r=t().scope.clone(),i=t().isolationScope;return e.run({scope:r,isolationScope:i},()=>n(r))}function r(n,r){let i=t().isolationScope.clone();return e.run({scope:n,isolationScope:i},()=>r(n))}function i(n){let r=t().scope.clone(),i=t().isolationScope.clone();return e.run({scope:r,isolationScope:i},()=>n(i))}function a(n,r){let i=t().scope.clone();return e.run({scope:i,isolationScope:n},()=>r(n))}function o(e){return n(t=>(t.setSDKProcessingMetadata({__SENTRY_SUPPRESS_TRACING__:!0}),e()))}ao({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function Pf(e,t,n,r){let i=0,a=[];X&&H.log(r,`Patching request.on`);let o=new WeakMap,s=n===`small`?1e3:n===`medium`?1e4:1048576;try{e.on=new Proxy(e.on,{apply:(e,t,n)=>{let[c,l,...u]=n;if(c===`data`){X&&H.log(r,`Handling request.on("data") with maximum body size of ${s}b`);let n=new Proxy(l,{apply:(e,t,n)=>{try{let e=n[0],t=Buffer.from(e);i<s?(a.push(t),i+=t.byteLength):X&&H.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{X&&H.error(r,`Encountered error while storing body chunk.`)}return Reflect.apply(e,t,n)}});return o.set(l,n),Reflect.apply(e,t,[c,n,...u])}return Reflect.apply(e,t,n)}}),e.off=new Proxy(e.off,{apply:(e,t,n)=>{let[,r]=n,i=o.get(r);if(i){o.delete(r);let a=n.slice();return a[1]=i,Reflect.apply(e,t,a)}return Reflect.apply(e,t,n)}}),e.on(`end`,()=>{try{let e=Buffer.concat(a).toString(`utf-8`);if(e){let n=Buffer.byteLength(e,`utf-8`)>s?`${Buffer.from(e).subarray(0,s-3).toString(`utf-8`)}...`:e;t.setSDKProcessingMetadata({normalizedRequest:{data:n}})}}catch(e){X&&H.error(r,`Error building captured request body`,e)}})}catch(e){X&&H.error(r,`Error patching request to capture body`,e)}}function Ff(e,t){if(!e)return t;let n=yo(e),r=yo(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),xo(i)}const If=`@sentry/instrumentation-http`;function Lf(e,t){let n=zf(e),r=t?.statusCode,i=zu(r);eu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Rf(e,t){let n=Vf(e),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=Yl(n,r,t)?Gl({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(o&&!e.getHeader(`sentry-trace`))try{e.setHeader(`sentry-trace`,o),X&&H.log(If,`Added sentry-trace header to outgoing request`)}catch(e){X&&H.error(If,`Failed to add sentry-trace header to outgoing request:`,Wi(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),X&&H.log(If,`Added traceparent header to outgoing request`)}catch(e){X&&H.error(If,`Failed to add traceparent header to outgoing request:`,Wi(e)?e.message:`Unknown error`)}if(s){let t=Ff(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),X&&H.log(If,`Added baggage header to outgoing request`)}catch(e){X&&H.error(If,`Failed to add baggage header to outgoing request:`,Wi(e)?e.message:`Unknown error`)}}}function zf(e){try{let t=e.getHeader(`host`)||e.host,n=Vl(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Ul(n),"http.method":e.method||`GET`};return n.search&&(r[`http.query`]=n.search),n.hash&&(r[`http.fragment`]=n.hash),r}catch{return{}}}function Bf(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Vf(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const Hf=`Http`,Uf=new WeakSet,Wf=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Gu(100),r=new WeakMap;return{name:Hf,setupOnce(){at(`http.server.request.start`,(e=>{Gf(e.server,t)})),at(`http.client.request.created`,(e=>{Kf(e.request,t,n,r)})),at(`http.client.response.finish`,(e=>{let n=e;qf(n.request,n.response,t,r)})),at(`http.client.request.error`,(e=>{qf(e.request,void 0,t,r)}))}}});function Gf(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(Uf.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!G().getClient())return e.apply(r,i);X&&H.log(Hf,`Handling incoming request`);let a=K().clone(),o=i[1],s=Zl(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&Pf(o,a,n,Hf),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${Hl(l)}`;return a.setTransactionName(u),lo(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return Fs({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(G().getPropagationContext().propagationSpanId=Ka(),e.apply(r,i)))})}});Uf.add(i),e.emit=i}function Kf(e,t,n,r){let i=Jf(e,t);r.set(e,i),!i&&Rf(e,n)}function qf(e,t,n,r){n.breadcrumbs&&((r.get(e)??Jf(e,n))||Lf(e,t))}function Jf(e,t){if(G().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,Bf(e)):!1}const Yf=`sentry-trace`,Xf=`baggage`,Zf=/baggage: (.*)\r\n/;function Qf(e,t){let n=tp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=Yl(n,r,t)?Gl({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(Array.isArray(e.headers)){let t=e.headers;o&&!t.includes(Yf)&&t.push(Yf,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===Xf);if(s&&n===-1)t.push(Xf,s);else if(s){let e=t[n+1],r=Ff(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Yf}:`)&&(e.headers+=`${Yf}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(Zf)?.[1];if(s&&!n)e.headers+=`${Xf}: ${s}\r\n`;else if(s){let t=Ff(n,s);t&&(e.headers=e.headers.replace(Zf,`baggage: ${t}\r\n`))}}}function $f(e,t){let n=ep(e),r=t.statusCode,i=zu(r);eu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function ep(e){try{let t=Vl(tp(e.origin,e.path)),n={url:Ul(t),"http.method":e.method||`GET`};return t.search&&(n[`http.query`]=t.search),t.hash&&(n[`http.fragment`]=t.hash),n}catch{return{}}}function tp(e,t=`/`){try{return new URL(t,e).toString()}catch{let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}}const np=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Gu(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){at(`undici:request:create`,(e=>{rp(e.request,t,n,r)})),at(`undici:request:headers`,(e=>{let n=e;ip(n.request,n.response,t,r)}))}}});function rp(e,t,n,r){let i=ap(e,t);r.set(e,i),!i&&Qf(e,n)}function ip(e,t,n,r){n.breadcrumbs&&(r.get(e)||$f(e,t))}function ap(e,t){if(G().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(tp(e.origin,e.path)):!1}function op(){return[au(),ru(),bu(),Du(),gf(),Iu(),Wf(),np(),ef(),rf(),Ed(),Hd(),Qu(),qu(),uf(),Kd()]}function sp(e={}){return cp(e,op)}function cp(e={},t){let n=lp(e,t);n.debug===!0&&(X?H.enable():V(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Nf(),G().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===df)&&n.integrations.push(ff({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Wl(n,`node-light`,[`node-core`]);let r=new Ku(n);return G().setClient(r),r.init(),H.log(`SDK initialized from ${Ud()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),fp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function lp(e,t){let n=up(e.release),r=Mf(e.spotlight),i=dp(e.tracesSampleRate),a={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??kf,stackParser:Ti(e.stackParser||bf),release:n,tracesSampleRate:i,spotlight:r,debug:Bl(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:jc({defaultIntegrations:s,integrations:o})}}function up(e){if(e!==void 0)return e;let t=yf();if(t!==void 0)return t}function dp(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let n=parseFloat(t);return isFinite(n)?n:void 0}function fp(){if(Bl(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Fo(e,t);G().setPropagationContext(n)}}function pp(){return ke.PRISMIC_SENTRY_ENABLED??ke.PROD}function mp(){if(ke.PRISMIC_SENTRY_ENVIRONMENT)return ke.PRISMIC_SENTRY_ENVIRONMENT;let e=me.match(/-(.+?)\./);return e?e[1]:`production`}function hp(){try{if(!pp())return;sp({dsn:ke.PRISMIC_SENTRY_DSN,release:me,environment:mp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),_c(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function gp(e){try{if(!pp())return;gc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await bc()}catch{}}const _p=yc,vp=vc,yp=_c,bp=xe({exp:Ce(ge())});function xp(e){try{let[,t]=e.split(`.`);return t?ve(bp,JSON.parse(Buffer.from(t,`base64url`).toString())):void 0}catch{return}}const $=[`login`,`logout`,`whoami`,`sync`,`docs`],Sp=M({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,commands:{init:{handler:gn,description:`Initialize a Prismic project`},docs:{handler:Mt,description:`Browse Prismic documentation`},gen:{handler:mn,description:`Generate files from local models`},sync:{handler:Ir,description:`Sync types and slices from Prismic`},locale:{handler:En,description:`Manage locales`},repo:{handler:Sr,description:`Manage repositories`},type:{handler:$r,description:`Manage content types`},field:{handler:dn,description:`Manage fields`},slice:{handler:Nr,description:`Manage slices`},preview:{handler:Hn,description:`Manage preview configurations`},token:{handler:Wr,description:`Manage API tokens`},webhook:{handler:si,description:`Manage webhooks`},login:{handler:Dn,description:`Log in to Prismic`},logout:{handler:kn,description:`Log out of Prismic`},whoami:{handler:ci,description:`Show the currently logged in user`}}});await Cp();async function Cp(){await Be({npmPackageName:he,statePath:Me}),Fe().catch(()=>{});let{positionals:[e],values:{version:t,help:n,repo:r=await g()}}=He({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(me);return}if(typeof r!=`string`&&(r=``),!n){hp(),await ze(),r&&(Re(r),vp(`repository`,r),yp(`Repository Data`,{name:r}));try{vp(`framework`,(await h()).id)}catch{}let t=await D();if(t){let e=await O(),n=xp(t)?.exp,r=Date.now()/1e3;(!n||n-r<=3600)&&process.on(`exit`,()=>Pe()),(!n||n>r)&&f({token:t,host:e}).then(e=>{Le({shortId:e.shortId,intercomHash:e.intercomHash}),_p({id:e.shortId})}).catch(()=>{})}e&&!$.includes(e)&&Ie(e)}try{await Sp(),e&&!$.includes(e)&&k(e)}catch(t){if(process.exitCode=1,t instanceof N){$.includes(e)||k(e),console.error(t.message);return}if(t instanceof re){$.includes(e)||k(e,{error:t}),console.error(t.message);return}if(t instanceof Ee||t instanceof De){$.includes(e)||k(e,{error:t}),console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof E){$.includes(e)||k(e),console.error(t.message||`Not found. Verify the repository and any specified identifiers exist.`);return}if(t instanceof le){$.includes(e)||k(e),console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof _){$.includes(e)||k(e),console.error(`${t.message} Run \`prismic init\` to create a config.`);return}if(t instanceof oe){$.includes(e)||k(e),console.error(ue`
211
191
  This command requires the Type Builder in your repository.
212
192
 
213
193
  As of March 2026, the Type Builder is rolling out incrementally as Slice
@@ -215,4 +195,4 @@ try {
215
195
  Slice Machine until your repository can upgrade.
216
196
 
217
197
  Learn more at https://prismic.io/docs/type-builder
218
- `);return}throw await Yp(t),t}}export{};
198
+ `);return}throw $.includes(e)||k(e,{error:t}),await gp(t),t}}export{};