prismic 1.3.0-pr.83.8a0d09f → 1.3.0-pr.83.cb98dcb

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.
Files changed (2) hide show
  1. package/dist/index.mjs +28 -24
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,U as g,V as ee,_ as te,c as ne,d as re,f as ie,g as ae,h as oe,i as se,j as ce,k as _,l as le,m as ue,o as de,q as fe,r as pe,s as v,t as me,u as he,w as ge,z as _e}from"./string-7SUyskTf.mjs";import*as ve from"node:util";import{parseArgs as ye,promisify as be}from"node:util";import{readFile as xe,rm as Se,writeFile as Ce}from"node:fs/promises";import{pathToFileURL as we}from"node:url";import{createHash as Te,randomUUID as Ee}from"node:crypto";import{dirname as De,join as Oe,posix as ke,sep as Ae}from"node:path";import{exec as je,execFile as Me,spawn as Ne}from"node:child_process";import{Readable as Pe}from"node:stream";import{createInterface as Fe}from"node:readline";import*as Ie from"node:http";import{createServer as Le}from"node:http";import*as y from"node:os";import{homedir as Re}from"node:os";import{setTimeout as ze}from"node:timers/promises";import{isMainThread as Be,threadId as Ve}from"worker_threads";import*as He from"node:diagnostics_channel";import{subscribe as Ue}from"node:diagnostics_channel";import{createReadStream as We,existsSync as Ge,readFile as Ke,readFileSync as qe,readdir as Je}from"node:fs";import{Worker as Ye}from"node:worker_threads";import*as Xe from"node:https";import{createGzip as Ze}from"node:zlib";import*as Qe from"node:net";import*as $e from"node:tls";import{AsyncLocalStorage as et}from"node:async_hooks";var tt=`prismic`,nt=`1.3.0-pr.83.8a0d09f`;async function b(e,t={}){let{credentials:n,...r}=t,i=new Headers(t.headers);if(i.has(`Accept`)||i.set(`Accept`,`application/json`),i.has(`User-Agent`)||i.set(`User-Agent`,`prismic-cli`),n){let e=[];for(let t in n)e.push(`${t}=${n[t]??``}`);i.set(`Cookie`,e.join(`; `))}!i.has(`Content-Type`)&&t.body&&i.set(`Content-Type`,`application/json`),t.body instanceof FormData&&i.delete(`Content-Type`);let a=i.get(`Content-Type`)===`application/json`?JSON.stringify(t.body):t.body,o=await fetch(e,{...r,body:a,headers:i}),s=await o.clone().json().catch(()=>o.clone().text());if(o.ok)return t.schema?ee(t.schema,s):s;throw o.status===401?new ot(o):o.status===403?new at(o):o.status===404?new it(o):new x(o)}var rt=class extends Error{name=`RequestError`;response;constructor(e){super(`fetch failed: ${e.url}`),this.response=e}async text(){return this.response.clone().text()}async json(){return this.response.clone().json()}get status(){return this.response.status}get statusText(){return this.response.statusText}},x=class extends rt{name=`UnknownRequestError`},it=class extends rt{name=`NotFoundRequestError`},at=class extends rt{name=`ForbiddenRequestError`},ot=class extends rt{name=`UnauthorizedRequestError`};async function st(e,t){let{host:n}=t,r=ct(n),i=new URL(`refreshtoken`,r);return i.searchParams.set(`token`,e),await b(i,{schema:m()})}function ct(e){return new URL(`https://auth.${e}/`)}const lt=`prismic.io`,S=ee(a({MODE:m(),DEV:_e(),PROD:_e(),TEST:_e(),PRISMIC_SENTRY_DSN:f(u(),`https://e1886b1775bd397cd1afc60bfd2ebfc8@o146123.ingest.us.sentry.io/4510445143588864`),PRISMIC_SENTRY_ENVIRONMENT:c(m()),PRISMIC_SENTRY_ENABLED:c(_e()),PRISMIC_HOST:c(m())}),{...process.env,MODE:`production`,DEV:`false`,PROD:`true`,TEST:`false`}),ut=new URL(`.prismic`,i(we(Re()))),dt=a({token:c(m().check(t(1))),host:c(m().check(t(1)))});async function C(){return(await mt())?.token}async function w(){return S.PRISMIC_HOST?S.PRISMIC_HOST:(await mt())?.host??lt}async function ft(){let e=await C();if(!e)return;let t=await w(),n=await st(e,{host:t});return await ht({token:n,host:t}),n}async function pt(){if(!await ge(ut))return!0;try{return await Se(ut,{force:!0}),!0}catch{return!1}}async function mt(){try{let e=await xe(ut,`utf-8`);return ee(dt,JSON.parse(e))}catch{return}}async function ht(e){await Ce(ut,n(e))}async function gt(e){let t=await w(),n=`https://${t}`;return new Promise((r,i)=>{let a=Le((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 ht({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 _t(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)})}async function _t(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}const vt=a({email:m(),shortId:m(),intercomHash:m(),repositories:_(a({domain:m(),name:c(m()),role:c(m())}))});async function yt(e){let{token:t,host:n}=e,r=bt(n);return await b(new URL(`profile`,r),{credentials:{"prismic-auth":t},schema:vt})}function bt(e){return new URL(`https://user-service.${e}/`)}function T(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=ye({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(xt(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new D(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new D(`Missing required option: --${e}`);await t(s)}}function xt(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[me(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=Math.max(...a.map(e=>`<${e}>`.length));for(let t in r){let n=`<${t}>`.padEnd(e),i=r[t],a=i.description+(i.required?` (required)`:``);o.push(` ${n} ${a}`)}}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=Math.max(...c.map(e=>e.left.length));for(let e of c){let t=e.left.padEnd(l);o.push(` ${t} ${e.description}`)}if(n)for(let e in n){let t=me(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,G as o,H as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,U as g,V as ee,_ as te,c as ne,d as re,f as ie,g as ae,h as oe,i as se,j as ce,k as _,l as le,m as ue,o as de,q as fe,r as pe,s as v,t as me,u as he,w as ge,z as _e}from"./string-7SUyskTf.mjs";import*as ve from"node:util";import{parseArgs as ye,promisify as be}from"node:util";import{readFile as xe,rm as Se,writeFile as Ce}from"node:fs/promises";import{pathToFileURL as we}from"node:url";import{createHash as Te,randomUUID as Ee}from"node:crypto";import{dirname as De,join as Oe,posix as ke,sep as Ae}from"node:path";import{exec as je,execFile as Me,spawn as Ne}from"node:child_process";import{Readable as Pe}from"node:stream";import{createInterface as Fe}from"node:readline";import*as Ie from"node:http";import{createServer as Le}from"node:http";import*as y from"node:os";import{homedir as Re}from"node:os";import{setTimeout as ze}from"node:timers/promises";import{isMainThread as Be,threadId as Ve}from"worker_threads";import*as He from"node:diagnostics_channel";import{subscribe as Ue}from"node:diagnostics_channel";import{createReadStream as We,existsSync as Ge,readFile as Ke,readFileSync as qe,readdir as Je}from"node:fs";import{Worker as Ye}from"node:worker_threads";import*as Xe from"node:https";import{createGzip as Ze}from"node:zlib";import*as Qe from"node:net";import*as $e from"node:tls";import{AsyncLocalStorage as et}from"node:async_hooks";var tt=`prismic`,nt=`1.3.0-pr.83.cb98dcb`;async function b(e,t={}){let{credentials:n,...r}=t,i=new Headers(t.headers);if(i.has(`Accept`)||i.set(`Accept`,`application/json`),i.has(`User-Agent`)||i.set(`User-Agent`,`prismic-cli`),n){let e=[];for(let t in n)e.push(`${t}=${n[t]??``}`);i.set(`Cookie`,e.join(`; `))}!i.has(`Content-Type`)&&t.body&&i.set(`Content-Type`,`application/json`),t.body instanceof FormData&&i.delete(`Content-Type`);let a=i.get(`Content-Type`)===`application/json`?JSON.stringify(t.body):t.body,o=await fetch(e,{...r,body:a,headers:i}),s=await o.clone().json().catch(()=>o.clone().text());if(o.ok)return t.schema?ee(t.schema,s):s;throw o.status===401?new ot(o):o.status===403?new at(o):o.status===404?new it(o):new x(o)}var rt=class extends Error{name=`RequestError`;response;constructor(e){super(`fetch failed: ${e.url}`),this.response=e}async text(){return this.response.clone().text()}async json(){return this.response.clone().json()}get status(){return this.response.status}get statusText(){return this.response.statusText}},x=class extends rt{name=`UnknownRequestError`},it=class extends rt{name=`NotFoundRequestError`},at=class extends rt{name=`ForbiddenRequestError`},ot=class extends rt{name=`UnauthorizedRequestError`};async function st(e,t){let{host:n}=t,r=ct(n),i=new URL(`refreshtoken`,r);return i.searchParams.set(`token`,e),await b(i,{schema:m()})}function ct(e){return new URL(`https://auth.${e}/`)}const lt=`prismic.io`,S=ee(a({MODE:m(),DEV:_e(),PROD:_e(),TEST:_e(),PRISMIC_SENTRY_DSN:f(u(),`https://e1886b1775bd397cd1afc60bfd2ebfc8@o146123.ingest.us.sentry.io/4510445143588864`),PRISMIC_SENTRY_ENVIRONMENT:c(m()),PRISMIC_SENTRY_ENABLED:c(_e()),PRISMIC_HOST:c(m())}),{...process.env,MODE:`production`,DEV:`false`,PROD:`true`,TEST:`false`}),ut=new URL(`.prismic`,i(we(Re()))),dt=a({token:c(m().check(t(1))),host:c(m().check(t(1)))});async function C(){return(await mt())?.token}async function w(){return S.PRISMIC_HOST?S.PRISMIC_HOST:(await mt())?.host??lt}async function ft(){let e=await C();if(!e)return;let t=await w(),n=await st(e,{host:t});return await ht({token:n,host:t}),n}async function pt(){if(!await ge(ut))return!0;try{return await Se(ut,{force:!0}),!0}catch{return!1}}async function mt(){try{let e=await xe(ut,`utf-8`);return ee(dt,JSON.parse(e))}catch{return}}async function ht(e){await Ce(ut,n(e))}async function gt(e){let t=await w(),n=`https://${t}`;return new Promise((r,i)=>{let a=Le((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 ht({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 _t(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)})}async function _t(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}const vt=a({email:m(),shortId:m(),intercomHash:m(),repositories:_(a({domain:m(),name:c(m()),role:c(m())}))});async function yt(e){let{token:t,host:n}=e,r=bt(n);return await b(new URL(`profile`,r),{credentials:{"prismic-auth":t},schema:vt})}function bt(e){return new URL(`https://user-service.${e}/`)}function T(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=ye({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(xt(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new D(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new D(`Missing required option: --${e}`);await t(s)}}function xt(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[me(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=Math.max(...a.map(e=>`<${e}>`.length));for(let t in r){let n=`<${t}>`.padEnd(e),i=r[t],a=i.description+(i.required?` (required)`:``);o.push(` ${n} ${a}`)}}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=Math.max(...c.map(e=>e.left.length));for(let e of c){let t=e.left.padEnd(l);o.push(` ${t} ${e.description}`)}if(n)for(let e in n){let t=me(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
4
  `)}function E(e){let{name:t,description:n,commands:r}=e,i=t.split(` `).length;return async function(){let{positionals:[a]}=ye({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 D(`Unknown command: ${a}`);console.info(St({name:t,description:n,commands:r}))}}function St(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.keys(r),o=Math.max(...a.map(e=>e.length));for(let e of a){let t=e.padEnd(o),n=r[e].description;i.push(` ${t} ${n}`)}return 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
5
  `)}var D=class extends Error{name=`CommandError`},Ct=T({name:`prismic gen setup`,description:`
@@ -50,26 +50,30 @@ await Promise.allSettled([
50
50
 
51
51
  By default, this command reads the repository from prismic.config.json at the
52
52
  project root.
53
- `,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 v()}=t,i=await C(),a=await w(),o=await un({repo:r,token:i,host:a}),s=o.find(e=>e.id===n);if(!s)throw new D(`Locale "${n}" not found. Available locales: ${o.map(e=>e.id).join(`, `)}`);if(s.isMaster)throw new D(`Locale "${n}" is already the master.`);try{await dn({id:s.id,isMaster:!0,customName:s.customName??void 0},{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),vn=E({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:mn,description:`Add a locale`},list:{handler:hn,description:`List locales`},remove:{handler:gn,description:`Remove a locale`},"set-master":{handler:_n,description:`Set the master locale`}}}),yn=T({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 gt({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}`),bn(e))}});console.info(`Logged in to Prismic as ${n}`)});function bn(e){je(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var xn=T({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await pt())console.info(`Logged out of Prismic`);else throw new D(`Logout failed. You can log out manually by deleting the file.`)}),Sn=T({name:`prismic custom-type create`,description:`Create a new custom type.`,positionals:{name:{description:`Name of the custom type`,required:!0}},options:{single:{type:`boolean`,short:`s`,description:`Allow only one of this type`},id:{type:`string`,description:`Custom ID for the custom type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{single:r=!1,id:i=o(n),repo:a=await v()}=t,s={id:i,label:n,repeatable:!r,status:!0,format:`custom`,json:{Main:{}}},c=await C(),l=await w();try{await Dt(s,{repo:a,host:l,token:c})}catch(e){throw e instanceof x?new D(`Failed to create custom type: ${await e.text()}`):e}console.info(`Created custom type "${n}" (id: "${i}")`)}),Cn=T({name:`prismic custom-type list`,description:`List all custom types.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:r=await v()}=e,i=(await O({repo:r,token:await C(),host:await w()})).filter(e=>e.format!==`page`);if(t){console.info(n(i));return}if(i.length===0){console.info(`No custom types found.`);return}for(let e of i){let t=e.label||`(no name)`;console.info(`${t} (id: ${e.id})`)}}),wn=T({name:`prismic custom-type remove`,description:`Remove a custom type.`,positionals:{name:{description:`Name of the custom type`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t,i=await C(),a=await w(),o=(await O({repo:r,token:i,host:a})).find(e=>e.label===n);if(!o)throw new D(`Custom type not found: ${n}`);if(o.format===`page`)throw new D(`"${n}" is not a custom type. Use \`prismic page-type remove\` instead.`);try{await kt(o.id,{repo:r,host:a,token:i})}catch(e){throw e instanceof x?new D(`Failed to remove custom type: ${await e.text()}`):e}console.info(`Custom type removed: "${n}" (id: ${o.id})`)}),Tn=T({name:`prismic custom-type view`,description:`View details of a custom type.`,positionals:{name:{description:`Name of the custom 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[r]=e,{json:i,repo:a=await v()}=t,o=(await O({repo:a,token:await C(),host:await w()})).find(e=>e.label===r);if(!o)throw new D(`Custom type not found: ${r}`);if(o.format===`page`)throw new D(`"${r}" is not a custom type. Use \`prismic page-type view\` instead.`);if(i){console.info(n(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.label||`(no name)`}`),console.info(`Repeatable: ${o.repeatable}`);let s=Object.keys(o.json).join(`, `)||`(none)`;console.info(`Tabs: ${s}`)}),En=E({name:`prismic custom-type`,description:`Manage custom types.`,commands:{create:{handler:Sn,description:`Create a new custom type`},remove:{handler:wn,description:`Remove a custom type`},list:{handler:Cn,description:`List custom types`},view:{handler:Tn,description:`View a custom type`}}});const j={"to-slice":{type:`string`,description:`Name of the target slice`},"to-page-type":{type:`string`,description:`Name of the target page type`},"to-custom-type":{type:`string`,description:`Name of the target custom type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Custom type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`}},Dn={"from-slice":{type:`string`,description:`Name of the source slice`},"from-page-type":{type:`string`,description:`Name of the source page type`},"from-custom-type":{type:`string`,description:`Name of the source custom type`},variation:j.variation,tab:j.tab,repo:j.repo};async function M(e,t){let n=e[`to-slice`]??e[`from-slice`],r=e[`to-page-type`]??e[`from-page-type`],i=e[`to-custom-type`]??e[`from-custom-type`],a=[n,r,i].filter(Boolean).length;if(a===0)throw new D(`Specify a target with --to-slice, --to-page-type, or --to-custom-type.`);if(a>1)throw new D(`Only one of --to-slice, --to-page-type, or --to-custom-type can be specified.`);if(n){if(`tab`in e)throw new D(`--tab is only valid for page types or custom types.`);let r=e.variation??`default`,i=(await k(t)).find(e=>e.name===n);if(!i)throw new D(`Slice not found: ${n}`);let a=structuredClone(i),o=a.variations?.find(e=>e.id===r);if(!o)throw new D(`Variation "${r}" not found. Available: ${i.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return o.primary??={},[o.primary,async()=>{try{await jt(a,t)}catch(e){throw e instanceof x?new D(`Failed to update slice: ${await e.text()}`):e}},`slice`]}let o=r??i,s=r?`Page type`:`Custom type`;if(`variation`in e)throw new D(`--variation is only valid for slices.`);let c=e.tab??`Main`,l=(await O(t)).find(e=>e.label===o?r?e.format===`page`:e.format!==`page`:!1);if(!l)throw new D(`${s} not found: ${o}`);let u=structuredClone(l),d=u.json[c];if(!d)throw new D(`Tab "${c}" not found. Available: ${Object.keys(l.json).join(`, `)||`(none)`}`);return[d,async()=>{try{await Ot(u,t)}catch(e){if(e instanceof x){let t=await e.text();throw new D(`Failed to update ${s.toLowerCase()}: ${t}`)}throw e}},`customType`]}function N(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 D(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new D(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}var On=T({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[c,l]=await M(t,{repo:s,token:await C(),host:await w()}),[u,d]=N(c,n),f={type:`Boolean`,config:{label:r??g(d),default_value:i,placeholder_true:a,placeholder_false:o}};if(d in u)throw new D(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),kn=T({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[o,s]=await M(t,{repo:a,token:await C(),host:await w()}),[c,l]=N(o,n),u={type:`Color`,config:{label:r??g(l),placeholder:i}};if(l in c)throw new D(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),An=T({name:`prismic field add content-relationship`,description:`Add a content relationship field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Allowed tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,repo:o=await v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`Link`,config:{label:r??g(u),select:`document`,tags:i,customtypes:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),jn=T({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`Date`,config:{label:r??g(u),placeholder:i,default:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Mn=T({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[o,s]=await M(t,{repo:a,token:await C(),host:await w()}),[c,l]=N(o,n),u={type:`Embed`,config:{label:r??g(l),placeholder:i}};if(l in c)throw new D(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),Nn=T({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await v()}=t,[a,o]=await M(t,{repo:i,token:await C(),host:await w()}),[s,c]=N(a,n),l={type:`GeoPoint`,config:{label:r??g(c)}};if(c in s)throw new D(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),Pn=T({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await v()}=t,[a,o]=await M(t,{repo:i,token:await C(),host:await w()}),[s,c]=N(a,n),l={type:`Group`,config:{label:r??g(c)}};if(c in s)throw new D(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),Fn=T({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[o,s]=await M(t,{repo:a,token:await C(),host:await w()}),[c,l]=N(o,n),u={type:`Image`,config:{label:r??g(l),placeholder:i}};if(l in c)throw new D(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),In=T({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`IntegrationFields`,config:{label:r??g(u),placeholder:i,catalog:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Ln=T({name:`prismic field add link`,description:`Add a link field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`},"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,{label:r,"allow-target-blank":i,"allow-text":a,repeatable:o,variant:s,repo:c=await v()}=t,[l,u]=await M(t,{repo:c,token:await C(),host:await w()}),[d,f]=N(l,n),p={type:`Link`,config:{label:r??g(f),allowTargetBlank:i,allowText:a,repeat:o,variants:s}};if(f in d)throw new D(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),Rn=T({name:`prismic field add link-to-media`,description:`Add a link to media field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`},"allow-text":{type:`boolean`,description:`Allow custom link text`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,"allow-text":i,variant:a,repo:o=await v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`Link`,config:{label:r??g(u),select:`media`,allowText:i,variants:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),zn=T({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,o=Bn(t.min,`min`),s=Bn(t.max,`max`),c=Bn(t.step,`step`),[l,u]=await M(t,{repo:a,token:await C(),host:await w()}),[d,f]=N(l,n),p={type:`Number`,config:{label:r??g(f),placeholder:i,min:o,max:s,step:c}};if(f in d)throw new D(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)});function Bn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new D(`--${t} must be a valid number, got "${e}"`);return n}var Vn=T({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
53
+ `,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 v()}=t,i=await C(),a=await w(),o=await un({repo:r,token:i,host:a}),s=o.find(e=>e.id===n);if(!s)throw new D(`Locale "${n}" not found. Available locales: ${o.map(e=>e.id).join(`, `)}`);if(s.isMaster)throw new D(`Locale "${n}" is already the master.`);try{await dn({id:s.id,isMaster:!0,customName:s.customName??void 0},{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),vn=E({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:mn,description:`Add a locale`},list:{handler:hn,description:`List locales`},remove:{handler:gn,description:`Remove a locale`},"set-master":{handler:_n,description:`Set the master locale`}}}),yn=T({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 gt({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}`),bn(e))}});console.info(`Logged in to Prismic as ${n}`)});function bn(e){je(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var xn=T({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await pt())console.info(`Logged out of Prismic`);else throw new D(`Logout failed. You can log out manually by deleting the file.`)}),Sn=T({name:`prismic custom-type create`,description:`Create a new custom type.`,positionals:{name:{description:`Name of the custom type`,required:!0}},options:{single:{type:`boolean`,short:`s`,description:`Allow only one of this type`},id:{type:`string`,description:`Custom ID for the custom type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{single:r=!1,id:i=o(n),repo:a=await v()}=t,s={id:i,label:n,repeatable:!r,status:!0,format:`custom`,json:{Main:{}}},c=await C(),l=await w();try{await Dt(s,{repo:a,host:l,token:c})}catch(e){throw e instanceof x?new D(`Failed to create custom type: ${await e.text()}`):e}console.info(`Created custom type "${n}" (id: "${i}")`)}),Cn=T({name:`prismic custom-type list`,description:`List all custom types.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:r=await v()}=e,i=(await O({repo:r,token:await C(),host:await w()})).filter(e=>e.format!==`page`);if(t){console.info(n(i));return}if(i.length===0){console.info(`No custom types found.`);return}for(let e of i){let t=e.label||`(no name)`;console.info(`${t} (id: ${e.id})`)}}),wn=T({name:`prismic custom-type remove`,description:`Remove a custom type.`,positionals:{name:{description:`Name of the custom type`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t,i=await C(),a=await w(),o=(await O({repo:r,token:i,host:a})).find(e=>e.label===n);if(!o)throw new D(`Custom type not found: ${n}`);if(o.format===`page`)throw new D(`"${n}" is not a custom type. Use \`prismic page-type remove\` instead.`);try{await kt(o.id,{repo:r,host:a,token:i})}catch(e){throw e instanceof x?new D(`Failed to remove custom type: ${await e.text()}`):e}console.info(`Custom type removed: "${n}" (id: ${o.id})`)}),Tn=T({name:`prismic custom-type view`,description:`View details of a custom type.`,positionals:{name:{description:`Name of the custom 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[r]=e,{json:i,repo:a=await v()}=t,o=(await O({repo:a,token:await C(),host:await w()})).find(e=>e.label===r);if(!o)throw new D(`Custom type not found: ${r}`);if(o.format===`page`)throw new D(`"${r}" is not a custom type. Use \`prismic page-type view\` instead.`);if(i){console.info(n(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.label||`(no name)`}`),console.info(`Repeatable: ${o.repeatable}`);let s=Object.keys(o.json).join(`, `)||`(none)`;console.info(`Tabs: ${s}`)}),En=E({name:`prismic custom-type`,description:`Manage custom types.`,commands:{create:{handler:Sn,description:`Create a new custom type`},remove:{handler:wn,description:`Remove a custom type`},list:{handler:Cn,description:`List custom types`},view:{handler:Tn,description:`View a custom type`}}});const j={"to-slice":{type:`string`,description:`Name of the target slice`},"to-page-type":{type:`string`,description:`Name of the target page type`},"to-custom-type":{type:`string`,description:`Name of the target custom type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Custom type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`}},Dn={"from-slice":{type:`string`,description:`Name of the source slice`},"from-page-type":{type:`string`,description:`Name of the source page type`},"from-custom-type":{type:`string`,description:`Name of the source custom type`},variation:j.variation,tab:j.tab,repo:j.repo};async function On(e,t,n){let{"from-slice":r,"from-page-type":i,"from-custom-type":a,variation:o=`default`}=t,s=[r,i,a].filter(Boolean).length;if(s===0)throw new D(`Specify a target with --from-slice, --from-page-type, or --from-custom-type.`);if(s>1)throw new D(`Only one of --from-slice, --from-page-type, or --from-custom-type can be specified.`);if(r){let t=(await k(n)).find(e=>e.name===r);if(!t)throw new D(`Slice not found: ${r}`);let i=t.variations.find(e=>e.id===o);if(!i)throw new D(`Variation "${i}" not found. Available: ${t.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return i.primary??={},N(i.primary,e),[i.primary,()=>jt(t,n),`slice`]}let c=i||a,l=i?`Page type`:`Custom type`,u=(await O(n)).find(e=>e.label===c?i?e.format===`page`:e.format!==`page`:!1);if(!u)throw new D(`${l} not found: ${c}`);let d;for(let t in u.json)e in u.json[t]&&(d=u.json[t]);if(!d)throw new D(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(u.json)))||`(none)`}`);return N(d,e),[d,()=>Ot(u,n),`customType`]}async function M(e,t){let n=e[`to-slice`]??e[`from-slice`],r=e[`to-page-type`]??e[`from-page-type`],i=e[`to-custom-type`]??e[`from-custom-type`],a=[n,r,i].filter(Boolean).length;if(a===0)throw new D(`Specify a target with --to-slice, --to-page-type, or --to-custom-type.`);if(a>1)throw new D(`Only one of --to-slice, --to-page-type, or --to-custom-type can be specified.`);if(n){if(`tab`in e)throw new D(`--tab is only valid for page types or custom types.`);let r=e.variation??`default`,i=(await k(t)).find(e=>e.name===n);if(!i)throw new D(`Slice not found: ${n}`);let a=structuredClone(i),o=a.variations?.find(e=>e.id===r);if(!o)throw new D(`Variation "${r}" not found. Available: ${i.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return o.primary??={},[o.primary,async()=>{try{await jt(a,t)}catch(e){throw e instanceof x?new D(`Failed to update slice: ${await e.text()}`):e}},`slice`]}let o=r??i,s=r?`Page type`:`Custom type`;if(`variation`in e)throw new D(`--variation is only valid for slices.`);let c=e.tab??`Main`,l=(await O(t)).find(e=>e.label===o?r?e.format===`page`:e.format!==`page`:!1);if(!l)throw new D(`${s} not found: ${o}`);let u=structuredClone(l),d=u.json[c];if(!d)throw new D(`Tab "${c}" not found. Available: ${Object.keys(l.json).join(`, `)||`(none)`}`);return[d,async()=>{try{await Ot(u,t)}catch(e){if(e instanceof x){let t=await e.text();throw new D(`Failed to update ${s.toLowerCase()}: ${t}`)}throw e}},`customType`]}function N(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 D(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new D(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}var kn=T({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[c,l]=await M(t,{repo:s,token:await C(),host:await w()}),[u,d]=N(c,n),f={type:`Boolean`,config:{label:r??g(d),default_value:i,placeholder_true:a,placeholder_false:o}};if(d in u)throw new D(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),An=T({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[o,s]=await M(t,{repo:a,token:await C(),host:await w()}),[c,l]=N(o,n),u={type:`Color`,config:{label:r??g(l),placeholder:i}};if(l in c)throw new D(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),jn=T({name:`prismic field add content-relationship`,description:`Add a content relationship field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Allowed tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,repo:o=await v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`Link`,config:{label:r??g(u),select:`document`,tags:i,customtypes:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Mn=T({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`Date`,config:{label:r??g(u),placeholder:i,default:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Nn=T({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[o,s]=await M(t,{repo:a,token:await C(),host:await w()}),[c,l]=N(o,n),u={type:`Embed`,config:{label:r??g(l),placeholder:i}};if(l in c)throw new D(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),Pn=T({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await v()}=t,[a,o]=await M(t,{repo:i,token:await C(),host:await w()}),[s,c]=N(a,n),l={type:`GeoPoint`,config:{label:r??g(c)}};if(c in s)throw new D(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),Fn=T({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await v()}=t,[a,o]=await M(t,{repo:i,token:await C(),host:await w()}),[s,c]=N(a,n),l={type:`Group`,config:{label:r??g(c)}};if(c in s)throw new D(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),In=T({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[o,s]=await M(t,{repo:a,token:await C(),host:await w()}),[c,l]=N(o,n),u={type:`Image`,config:{label:r??g(l),placeholder:i}};if(l in c)throw new D(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),Ln=T({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`IntegrationFields`,config:{label:r??g(u),placeholder:i,catalog:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Rn=T({name:`prismic field add link`,description:`Add a link field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`},"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,{label:r,"allow-target-blank":i,"allow-text":a,repeatable:o,variant:s,repo:c=await v()}=t,[l,u]=await M(t,{repo:c,token:await C(),host:await w()}),[d,f]=N(l,n),p={type:`Link`,config:{label:r??g(f),allowTargetBlank:i,allowText:a,repeat:o,variants:s}};if(f in d)throw new D(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),zn=T({name:`prismic field add link-to-media`,description:`Add a link to media field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`},"allow-text":{type:`boolean`,description:`Allow custom link text`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,"allow-text":i,variant:a,repo:o=await v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`Link`,config:{label:r??g(u),select:`media`,allowText:i,variants:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Bn=T({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,o=Vn(t.min,`min`),s=Vn(t.max,`max`),c=Vn(t.step,`step`),[l,u]=await M(t,{repo:a,token:await C(),host:await w()}),[d,f]=N(l,n),p={type:`Number`,config:{label:r??g(f),placeholder:i,min:o,max:s,step:c}};if(f in d)throw new D(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)});function Vn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new D(`--${t} must be a valid number, got "${e}"`);return n}var Hn=T({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
54
54
  heading1, heading2, heading3, heading4, heading5, heading6,
55
55
  paragraph, strong, em, preformatted, hyperlink, image, embed,
56
56
  list-item, o-list-item, rtl
57
- `},positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[l,u]=await M(t,{repo:c,token:await C(),host:await w()}),[d,f]=N(l,n),p={type:`StructuredText`,config:{label:r??g(f),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:s}};if(f in d)throw new D(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),Hn=T({name:`prismic field add select`,description:`Add a select field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[c,l]=await M(t,{repo:s,token:await C(),host:await w()}),[u,d]=N(c,n),f={type:`Select`,config:{label:r??g(d),placeholder:i,default_value:a,options:o}};if(d in u)throw new D(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),Un=T({name:`prismic field add table`,description:`Add a table field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await v()}=t,[a,o]=await M(t,{repo:i,token:await C(),host:await w()}),[s,c]=N(a,n),l={type:`Table`,config:{label:r??g(c)}};if(c in s)throw new D(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),Wn=T({name:`prismic field add text`,description:`Add a text field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[o,s]=await M(t,{repo:a,token:await C(),host:await w()}),[c,l]=N(o,n),u={type:`Text`,config:{label:r??g(l),placeholder:i}};if(l in c)throw new D(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),Gn=T({name:`prismic field add timestamp`,description:`Add a timestamp field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`Timestamp`,config:{label:r??g(u),placeholder:i,default:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),Kn=T({name:`prismic field add uid`,description:`Add a UID field to a custom type.`,options:{"to-page-type":{type:`string`,description:`Name of the target page type`},"to-custom-type":{type:`string`,description:`Name of the target custom type`},tab:{type:`string`,description:`Custom 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 v()}=e,[i,a]=await M(e,{repo:r,token:await C(),host:await w()}),o={type:`UID`,config:{label:t,placeholder:n}};if(`uid`in i)throw new D(`Field "uid" already exists.`);i.uid=o,await a(),console.info(`Field added: uid`)}),qn=E({name:`prismic field add`,description:`Add a field to a slice or custom type.`,commands:{boolean:{handler:On,description:`Add a boolean field`},color:{handler:kn,description:`Add a color field`},"content-relationship":{handler:An,description:`Add a content relationship field`},date:{handler:jn,description:`Add a date field`},embed:{handler:Mn,description:`Add an embed field`},geopoint:{handler:Nn,description:`Add a geopoint field`},group:{handler:Pn,description:`Add a group field`},image:{handler:Fn,description:`Add an image field`},integration:{handler:In,description:`Add an integration field`},link:{handler:Ln,description:`Add a link field`},"link-to-media":{handler:Rn,description:`Add a link to media field`},number:{handler:zn,description:`Add a number field`},"rich-text":{handler:Vn,description:`Add a rich text field`},select:{handler:Hn,description:`Add a select field`},table:{handler:Un,description:`Add a table field`},text:{handler:Wn,description:`Add a text field`},timestamp:{handler:Gn,description:`Add a timestamp field`},uid:{handler:Kn,description:`Add a UID field`}}}),Jn=T({name:`prismic field list`,description:`List fields in a slice or custom type.`,options:{...Dn,json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{repo:t=await v()}=e,[r]=await M(e,{repo:t,token:await C(),host:await w()}),i=Object.entries(r).map(([e,t])=>({id:e,type:t.type,label:t.config?.label||void 0}));if(e.json){console.info(n(i));return}if(i.length===0){console.info(`No fields found.`);return}for(let e of i){let t=e.label?` ${e.label}`:``;console.info(`${e.id} ${e.type}${t}`)}}),Yn=T({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Dn},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t,[i,a]=await M(t,{repo:r,token:await C(),host:await w()}),[o,s]=N(i,n);if(!(s in o))throw new D(`Field "${n}" does not exist.`);delete o[s],await a(),console.info(`Field removed: ${n}`)}),Xn=E({name:`prismic field`,description:`Manage fields in slices and custom types.`,commands:{add:{handler:qn,description:`Add a field`},list:{handler:Jn,description:`List fields`},remove:{handler:Yn,description:`Remove a field`}}}),Zn=T({name:`prismic page-type create`,description:`Create a new page type.`,positionals:{name:{description:`Name of the page type`,required:!0}},options:{single:{type:`boolean`,short:`s`,description:`Allow only page one of this type`},id:{type:`string`,description:`Custom ID for the page type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{single:r=!1,id:i=o(n),repo:a=await v()}=t,s={id:i,label:n,repeatable:!r,status:!0,format:`page`,json:{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:[]}}}}},c=await C(),l=await w();try{await Dt(s,{repo:a,host:l,token:c})}catch(e){throw e instanceof x?new D(`Failed to create page type: ${await e.text()}`):e}console.info(`Created page type "${n}" (id: "${i}")`)}),Qn=T({name:`prismic page-type list`,description:`List all page types.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:r=await v()}=e,i=(await O({repo:r,token:await C(),host:await w()})).filter(e=>e.format===`page`);if(t){console.info(n(i));return}if(i.length===0){console.info(`No page types found.`);return}for(let e of i){let t=e.label||`(no name)`;console.info(`${t} (id: ${e.id})`)}}),$n=T({name:`prismic page-type remove`,description:`Remove a page type.`,positionals:{name:{description:`Name of the page type`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t,i=await C(),a=await w(),o=(await O({repo:r,token:i,host:a})).find(e=>e.label===n);if(!o)throw new D(`Page type not found: ${n}`);if(o.format!==`page`)throw new D(`"${n}" is not a page type. Use \`prismic custom-type remove\` instead.`);try{await kt(o.id,{repo:r,host:a,token:i})}catch(e){throw e instanceof x?new D(`Failed to create page type: ${await e.text()}`):e}console.info(`Page type removed: "${n}" (id: ${o.id})`)}),er=T({name:`prismic page-type view`,description:`View details of a page type.`,positionals:{name:{description:`Name of the page 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[r]=e,{json:i,repo:a=await v()}=t,o=(await O({repo:a,token:await C(),host:await w()})).find(e=>e.label===r);if(!o)throw new D(`Page type not found: ${r}`);if(o.format!==`page`)throw new D(`"${r}" is not a page type. Use \`prismic custom-type view\` instead.`);if(i){console.info(n(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.label||`(no name)`}`),console.info(`Repeatable: ${o.repeatable}`);let s=Object.keys(o.json).join(`, `)||`(none)`;console.info(`Tabs: ${s}`)}),tr=E({name:`prismic page-type`,description:`Manage page types.`,commands:{create:{handler:Zn,description:`Create a new page type`},remove:{handler:$n,description:`Remove a page type`},list:{handler:Qn,description:`List page types`},view:{handler:er,description:`View a page type`}}});const nr=a({results:_(a({id:m(),label:m(),url:m()}))});async function rr(e){let{repo:t,token:n,host:r}=e;return(await b(new URL(`core/repository/preview_configs`,lr(t,r)),{credentials:{"prismic-auth":n},schema:nr})).results}async function ir(e,t){let{repo:n,token:r,host:i}=t;await b(new URL(`previews/new`,lr(n,i)),{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}async function ar(e,t){let{repo:n,token:r,host:i}=t;await b(new URL(`previews/delete/${e}`,lr(n,i)),{method:`POST`,body:{},credentials:{"prismic-auth":r}})}const or=a({simulator_url:c(m())});async function sr(e){let{repo:t,token:n,host:r}=e;return(await b(new URL(`core/repository`,lr(t,r)),{credentials:{"prismic-auth":n},schema:or})).simulator_url}async function cr(e,t){let{repo:n,token:r,host:i}=t;await b(new URL(`core/repository`,lr(n,i)),{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}function lr(e,t){return new URL(`https://${e}.${t}/`)}var ur=T({name:`prismic preview add`,description:`
57
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[l,u]=await M(t,{repo:c,token:await C(),host:await w()}),[d,f]=N(l,n),p={type:`StructuredText`,config:{label:r??g(f),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:s}};if(f in d)throw new D(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),Un=T({name:`prismic field add select`,description:`Add a select field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[c,l]=await M(t,{repo:s,token:await C(),host:await w()}),[u,d]=N(c,n),f={type:`Select`,config:{label:r??g(d),placeholder:i,default_value:a,options:o}};if(d in u)throw new D(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),Wn=T({name:`prismic field add table`,description:`Add a table field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await v()}=t,[a,o]=await M(t,{repo:i,token:await C(),host:await w()}),[s,c]=N(a,n),l={type:`Table`,config:{label:r??g(c)}};if(c in s)throw new D(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),Gn=T({name:`prismic field add text`,description:`Add a text field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[o,s]=await M(t,{repo:a,token:await C(),host:await w()}),[c,l]=N(o,n),u={type:`Text`,config:{label:r??g(l),placeholder:i}};if(l in c)throw new D(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),Kn=T({name:`prismic field add timestamp`,description:`Add a timestamp field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...j,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 v()}=t,[s,c]=await M(t,{repo:o,token:await C(),host:await w()}),[l,u]=N(s,n),d={type:`Timestamp`,config:{label:r??g(u),placeholder:i,default:a}};if(u in l)throw new D(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),qn=T({name:`prismic field add uid`,description:`Add a UID field to a custom type.`,options:{"to-page-type":{type:`string`,description:`Name of the target page type`},"to-custom-type":{type:`string`,description:`Name of the target custom type`},tab:{type:`string`,description:`Custom 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 v()}=e,[i,a]=await M(e,{repo:r,token:await C(),host:await w()}),o={type:`UID`,config:{label:t,placeholder:n}};if(`uid`in i)throw new D(`Field "uid" already exists.`);i.uid=o,await a(),console.info(`Field added: uid`)}),Jn=E({name:`prismic field add`,description:`Add a field to a slice or custom type.`,commands:{boolean:{handler:kn,description:`Add a boolean field`},color:{handler:An,description:`Add a color field`},"content-relationship":{handler:jn,description:`Add a content relationship field`},date:{handler:Mn,description:`Add a date field`},embed:{handler:Nn,description:`Add an embed field`},geopoint:{handler:Pn,description:`Add a geopoint field`},group:{handler:Fn,description:`Add a group field`},image:{handler:In,description:`Add an image field`},integration:{handler:Ln,description:`Add an integration field`},link:{handler:Rn,description:`Add a link field`},"link-to-media":{handler:zn,description:`Add a link to media field`},number:{handler:Bn,description:`Add a number field`},"rich-text":{handler:Hn,description:`Add a rich text field`},select:{handler:Un,description:`Add a select field`},table:{handler:Wn,description:`Add a table field`},text:{handler:Gn,description:`Add a text field`},timestamp:{handler:Kn,description:`Add a timestamp field`},uid:{handler:qn,description:`Add a UID field`}}});const Yn={name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
58
+ Options vary by field type. Only options matching the field's
59
+ type will be applied. See \`prismic field add <type> --help\`
60
+ for type-specific option details.
61
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...Dn,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/link-to-media)`},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)`},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)`}}};var Xn=T(Yn,async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t,[i,a]=await On(n,t,{repo:r,token:await C(),host:await w()}),[o,s]=N(i,n),c=o[s];switch(c.config??={},`label`in t&&(c.config.label=t.label),`placeholder`in t&&`placeholder`in c.config&&(c.config.placeholder=t.placeholder),c.type){case`Boolean`:if(`default-value`in t){let e=t[`default-value`];if(e!==`true`&&e!==`false`)throw new D(`--default-value for boolean fields must be "true" or "false"`);c.config.default_value=e===`true`}`true-label`in t&&(c.config.placeholder_true=t[`true-label`]),`false-label`in t&&(c.config.placeholder_false=t[`false-label`]);break;case`Number`:`min`in t&&(c.config.min=Zn(t.min,`min`)),`max`in t&&(c.config.max=Zn(t.max,`max`)),`step`in t&&(c.config.step=Zn(t.step,`step`));break;case`Select`:`default-value`in t&&(c.config.default_value=t[`default-value`]),`option`in t&&(c.config.options=t.option);break;case`Date`:case`Timestamp`:`default`in t&&(c.config.default=t.default);break;case`IntegrationFields`:`catalog`in t&&(c.config.catalog=t.catalog);break;case`StructuredText`:if(`allow-target-blank`in t&&(c.config.allowTargetBlank=t[`allow-target-blank`]),`single`in t){let e=`allow`in t?t.allow:c.config.multi??c.config.single;delete c.config.multi,c.config.single=e}else `allow`in t&&(`single`in Yn?Yn.single=t.allow:c.config.multi=t.allow);break;case`Link`:c.config.select===`document`?(`tag`in t&&(c.config.tags=t.tag),`custom-type`in t&&(c.config.customtypes=t[`custom-type`])):c.config.select===`media`?(`allow-text`in t&&(c.config.allowText=t[`allow-text`]),`variant`in t&&(c.config.variants=t.variant)):(`allow-target-blank`in t&&(c.config.allowTargetBlank=t[`allow-target-blank`]),`allow-text`in t&&(c.config.allowText=t[`allow-text`]),`repeatable`in t&&(c.config.repeat=t.repeatable),`variant`in t&&(c.config.variants=t.variant));break}await a(),console.info(`Field updated: ${n}`)});function Zn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new D(`--${t} must be a valid number, got "${e}"`);return n}var Qn=T({name:`prismic field list`,description:`List fields in a slice or custom type.`,options:{...Dn,json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{repo:t=await v()}=e,[r]=await M(e,{repo:t,token:await C(),host:await w()}),i=Object.entries(r).map(([e,t])=>({id:e,type:t.type,label:t.config?.label||void 0}));if(e.json){console.info(n(i));return}if(i.length===0){console.info(`No fields found.`);return}for(let e of i){let t=e.label?` ${e.label}`:``;console.info(`${e.id} ${e.type}${t}`)}}),$n=T({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Dn},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t,[i,a]=await On(n,t,{repo:r,token:await C(),host:await w()}),[o,s]=N(i,n);if(!(s in o))throw new D(`Field "${n}" does not exist.`);delete o[s],await a(),console.info(`Field removed: ${n}`)}),er=E({name:`prismic field`,description:`Manage fields in slices and custom types.`,commands:{add:{handler:Jn,description:`Add a field`},edit:{handler:Xn,description:`Edit a field`},list:{handler:Qn,description:`List fields`},remove:{handler:$n,description:`Remove a field`}}}),tr=T({name:`prismic page-type create`,description:`Create a new page type.`,positionals:{name:{description:`Name of the page type`,required:!0}},options:{single:{type:`boolean`,short:`s`,description:`Allow only page one of this type`},id:{type:`string`,description:`Custom ID for the page type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{single:r=!1,id:i=o(n),repo:a=await v()}=t,s={id:i,label:n,repeatable:!r,status:!0,format:`page`,json:{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:[]}}}}},c=await C(),l=await w();try{await Dt(s,{repo:a,host:l,token:c})}catch(e){throw e instanceof x?new D(`Failed to create page type: ${await e.text()}`):e}console.info(`Created page type "${n}" (id: "${i}")`)}),nr=T({name:`prismic page-type list`,description:`List all page types.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:r=await v()}=e,i=(await O({repo:r,token:await C(),host:await w()})).filter(e=>e.format===`page`);if(t){console.info(n(i));return}if(i.length===0){console.info(`No page types found.`);return}for(let e of i){let t=e.label||`(no name)`;console.info(`${t} (id: ${e.id})`)}}),rr=T({name:`prismic page-type remove`,description:`Remove a page type.`,positionals:{name:{description:`Name of the page type`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t,i=await C(),a=await w(),o=(await O({repo:r,token:i,host:a})).find(e=>e.label===n);if(!o)throw new D(`Page type not found: ${n}`);if(o.format!==`page`)throw new D(`"${n}" is not a page type. Use \`prismic custom-type remove\` instead.`);try{await kt(o.id,{repo:r,host:a,token:i})}catch(e){throw e instanceof x?new D(`Failed to create page type: ${await e.text()}`):e}console.info(`Page type removed: "${n}" (id: ${o.id})`)}),ir=T({name:`prismic page-type view`,description:`View details of a page type.`,positionals:{name:{description:`Name of the page 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[r]=e,{json:i,repo:a=await v()}=t,o=(await O({repo:a,token:await C(),host:await w()})).find(e=>e.label===r);if(!o)throw new D(`Page type not found: ${r}`);if(o.format!==`page`)throw new D(`"${r}" is not a page type. Use \`prismic custom-type view\` instead.`);if(i){console.info(n(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.label||`(no name)`}`),console.info(`Repeatable: ${o.repeatable}`);let s=Object.keys(o.json).join(`, `)||`(none)`;console.info(`Tabs: ${s}`)}),ar=E({name:`prismic page-type`,description:`Manage page types.`,commands:{create:{handler:tr,description:`Create a new page type`},remove:{handler:rr,description:`Remove a page type`},list:{handler:nr,description:`List page types`},view:{handler:ir,description:`View a page type`}}});const or=a({results:_(a({id:m(),label:m(),url:m()}))});async function sr(e){let{repo:t,token:n,host:r}=e;return(await b(new URL(`core/repository/preview_configs`,pr(t,r)),{credentials:{"prismic-auth":n},schema:or})).results}async function cr(e,t){let{repo:n,token:r,host:i}=t;await b(new URL(`previews/new`,pr(n,i)),{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}async function lr(e,t){let{repo:n,token:r,host:i}=t;await b(new URL(`previews/delete/${e}`,pr(n,i)),{method:`POST`,body:{},credentials:{"prismic-auth":r}})}const ur=a({simulator_url:c(m())});async function dr(e){let{repo:t,token:n,host:r}=e;return(await b(new URL(`core/repository`,pr(t,r)),{credentials:{"prismic-auth":n},schema:ur})).simulator_url}async function fr(e,t){let{repo:n,token:r,host:i}=t;await b(new URL(`core/repository`,pr(n,i)),{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}function pr(e,t){return new URL(`https://${e}.${t}/`)}var mr=T({name:`prismic preview add`,description:`
58
62
  Add a preview configuration to a Prismic repository.
59
63
 
60
64
  By default, this command reads the repository from prismic.config.json at the
61
65
  project root.
62
- `,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 v(),name:i}=t,a;try{a=new URL(n)}catch{throw new D(`Invalid URL: ${n}`)}let o=i||a.hostname,s=`${a.protocol}//${a.host}`,c=a.pathname===`/`?void 0:a.pathname,l=await C(),u=await w();try{await ir({name:o,websiteURL:s,resolverPath:c},{repo:r,token:l,host:u})}catch(e){throw e instanceof x?new D(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${n}`)}),dr=T({name:`prismic preview list`,description:`
66
+ `,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 v(),name:i}=t,a;try{a=new URL(n)}catch{throw new D(`Invalid URL: ${n}`)}let o=i||a.hostname,s=`${a.protocol}//${a.host}`,c=a.pathname===`/`?void 0:a.pathname,l=await C(),u=await w();try{await cr({name:o,websiteURL:s,resolverPath:c},{repo:r,token:l,host:u})}catch(e){throw e instanceof x?new D(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${n}`)}),hr=T({name:`prismic preview list`,description:`
63
67
  List all preview configurations in a Prismic repository.
64
68
 
65
69
  By default, this command reads the repository from prismic.config.json at the
66
70
  project root.
67
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await v(),json:r}=e,i=await C(),a=await w(),[o,s]=await Promise.all([rr({repo:t,token:i,host:a}),sr({repo:t,token:i,host:a})]);if(r){console.info(n({previews:o,simulatorUrl:s??null}));return}if(o.length===0&&!s){console.info(`No preview configurations found.`);return}for(let e of o)console.info(`${e.url} ${e.label}`);s&&console.info(`\nSimulator: ${s}`)}),fr=T({name:`prismic preview remove`,description:`
71
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await v(),json:r}=e,i=await C(),a=await w(),[o,s]=await Promise.all([sr({repo:t,token:i,host:a}),dr({repo:t,token:i,host:a})]);if(r){console.info(n({previews:o,simulatorUrl:s??null}));return}if(o.length===0&&!s){console.info(`No preview configurations found.`);return}for(let e of o)console.info(`${e.url} ${e.label}`);s&&console.info(`\nSimulator: ${s}`)}),gr=T({name:`prismic preview remove`,description:`
68
72
  Remove a preview configuration from a Prismic repository.
69
73
 
70
74
  By default, this command reads the repository from prismic.config.json at the
71
75
  project root.
72
- `,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 v()}=t,i=await C(),a=await w(),o=(await rr({repo:r,token:i,host:a})).find(e=>e.url===n);if(!o)throw new D(`Preview not found: ${n}`);try{await ar(o.id,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),pr=T({name:`prismic preview set-simulator`,description:`
76
+ `,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 v()}=t,i=await C(),a=await w(),o=(await sr({repo:r,token:i,host:a})).find(e=>e.url===n);if(!o)throw new D(`Preview not found: ${n}`);try{await lr(o.id,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),_r=T({name:`prismic preview set-simulator`,description:`
73
77
  Set the slice simulator URL for a Prismic repository.
74
78
 
75
79
  If the URL pathname does not end with /slice-simulator, it is appended
@@ -77,37 +81,37 @@ await Promise.allSettled([
77
81
 
78
82
  By default, this command reads the repository from prismic.config.json at the
79
83
  project root.
80
- `,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 v()}=t,i;try{i=new URL(n)}catch{throw new D(`Invalid URL: ${n}`)}i.pathname.endsWith(`/slice-simulator`)||(i.pathname=i.pathname.replace(/\/+$/,``)+`/slice-simulator`);let a=i.toString(),o=await C(),s=await w();try{await cr(a,{repo:r,token:o,host:s})}catch(e){throw e instanceof x?new D(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${a}`)}),mr=E({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:ur,description:`Add a preview configuration`},list:{handler:dr,description:`List preview configurations`},remove:{handler:fr,description:`Remove a preview configuration`},"set-simulator":{handler:pr,description:`Set the slice simulator URL`}}});const hr=a({documentsPublished:e(),documentsUnpublished:e(),releasesCreated:e(),releasesUpdated:e(),tagsCreated:e(),tagsDeleted:e()}),gr=Object.keys(hr.shape),_r=a({config:ce(hr,{_id:m(),url:m(),active:e(),name:d(m()),secret:d(m()),headers:l(m(),m())})});async function vr(e){let{repo:t,token:n,host:r}=e,i=P(t,r);return await b(new URL(`app/settings/webhooks`,i),{credentials:{"prismic-auth":n},schema:_(_r)})}async function yr(e,t){let{repo:n,token:r,host:i}=t,a=P(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()),await b(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}async function br(e,t,n){let{repo:r,token:i,host:a}=n,o=P(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()),await b(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}async function xr(e,t){let{repo:n,token:r,host:i}=t,a=P(n,i);await b(new URL(`app/settings/webhooks/${e}/delete`,a),{method:`POST`,credentials:{"prismic-auth":r}})}const Sr=a({id:m(),scope:m(),token:m(),created_at:a({$date:p()})}),Cr=a({id:m(),name:m(),wroom_auths:_(Sr)}),wr=a({app_name:m(),token:m(),timestamp:p()}),Tr=a({max_tokens:p(),tokens:_(wr)});async function Er(e){return await b(new URL(`settings/security/contentapi`,P(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:_(Cr)})}async function Dr(e,t){return await b(new URL(`settings/security/oauthapp`,P(t.repo,t.host)),{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Cr})}async function Or(e,t,n){return await b(new URL(`settings/security/authorizations`,P(n.repo,n.host)),{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:Sr})}async function kr(e,t){await b(new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,P(t.repo,t.host)),{method:`DELETE`,credentials:{"prismic-auth":t.token}})}async function Ar(e){return await b(new URL(`settings/security/customtypesapi`,P(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:Tr})}async function jr(e,t){return await b(new URL(`settings/security/token`,P(t.repo,t.host)),{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:wr})}async function Mr(e,t){await b(new URL(`settings/security/token/${encodeURIComponent(e)}`,P(t.repo,t.host)),{method:`DELETE`,credentials:{"prismic-auth":t.token}})}async function Nr(t){let{domain:n,token:r,host:i}=t;return await b(new URL(`app/dashboard/repositories/${n}/exists`,Br(i)),{credentials:{"prismic-auth":r},schema:e()})}async function Pr(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await b(new URL(`app/dashboard/repositories`,Br(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const Fr=a({repository:a({api_access:m()})});async function Ir(e){let{repo:t,token:n,host:r}=e;return(await b(new URL(`syncState`,P(t,r)),{credentials:{"prismic-auth":n},schema:Fr})).repository.api_access}async function Lr(e,t){let{repo:n,token:r,host:i}=t;await b(new URL(`settings/security/apiaccess`,P(n,i)),{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}const Rr=a({repository:a({name:m()})});async function zr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,P(n,i)),o=new FormData;return o.set(`displayname`,e),(await b(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:Rr})).repository.name}function Br(e){return new URL(`https://${e}/`)}function P(e,t){return new URL(`https://${e}.${t}/`)}var Vr=T({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 C(),r=await w(),i=await Hr({token:n,host:r});if(!i)throw new D(`Failed to create a repository. Please try again.`);let a=(await se().catch(()=>void 0))?.id??`other`;try{await Pr({domain:i,name:t??i,framework:a,token:n,host:r})}catch(e){throw e instanceof x?new D(`Failed to create repository: ${await e.text()}`):e}console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function Hr(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 Nr({domain:e,token:t,host:n})){r=e;break}}return r}var Ur=T({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,r=await C(),i=await w(),a;try{a=await yt({token:r,host:i})}catch(e){throw e instanceof x?new D(`Failed to list repositories: ${await e.text()}`):e}let o=a.repositories;if(t){console.info(n(o.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${i}/`}))));return}if(o.length===0){console.info(`No repositories found.`);return}for(let e of o){let t=e.name||`(no name)`,n=e.role?` ${e.role}`:``;console.info(`${e.domain} ${t}${n}`)}});const Wr=[`private`,`public`,`open`];var Gr=T({name:`prismic repo set-api-access`,description:`
84
+ `,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 v()}=t,i;try{i=new URL(n)}catch{throw new D(`Invalid URL: ${n}`)}i.pathname.endsWith(`/slice-simulator`)||(i.pathname=i.pathname.replace(/\/+$/,``)+`/slice-simulator`);let a=i.toString(),o=await C(),s=await w();try{await fr(a,{repo:r,token:o,host:s})}catch(e){throw e instanceof x?new D(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${a}`)}),vr=E({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:mr,description:`Add a preview configuration`},list:{handler:hr,description:`List preview configurations`},remove:{handler:gr,description:`Remove a preview configuration`},"set-simulator":{handler:_r,description:`Set the slice simulator URL`}}});const yr=a({documentsPublished:e(),documentsUnpublished:e(),releasesCreated:e(),releasesUpdated:e(),tagsCreated:e(),tagsDeleted:e()}),br=Object.keys(yr.shape),xr=a({config:ce(yr,{_id:m(),url:m(),active:e(),name:d(m()),secret:d(m()),headers:l(m(),m())})});async function Sr(e){let{repo:t,token:n,host:r}=e,i=P(t,r);return await b(new URL(`app/settings/webhooks`,i),{credentials:{"prismic-auth":n},schema:_(xr)})}async function Cr(e,t){let{repo:n,token:r,host:i}=t,a=P(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()),await b(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}async function wr(e,t,n){let{repo:r,token:i,host:a}=n,o=P(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()),await b(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}async function Tr(e,t){let{repo:n,token:r,host:i}=t,a=P(n,i);await b(new URL(`app/settings/webhooks/${e}/delete`,a),{method:`POST`,credentials:{"prismic-auth":r}})}const Er=a({id:m(),scope:m(),token:m(),created_at:a({$date:p()})}),Dr=a({id:m(),name:m(),wroom_auths:_(Er)}),Or=a({app_name:m(),token:m(),timestamp:p()}),kr=a({max_tokens:p(),tokens:_(Or)});async function Ar(e){return await b(new URL(`settings/security/contentapi`,P(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:_(Dr)})}async function jr(e,t){return await b(new URL(`settings/security/oauthapp`,P(t.repo,t.host)),{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Dr})}async function Mr(e,t,n){return await b(new URL(`settings/security/authorizations`,P(n.repo,n.host)),{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:Er})}async function Nr(e,t){await b(new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,P(t.repo,t.host)),{method:`DELETE`,credentials:{"prismic-auth":t.token}})}async function Pr(e){return await b(new URL(`settings/security/customtypesapi`,P(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:kr})}async function Fr(e,t){return await b(new URL(`settings/security/token`,P(t.repo,t.host)),{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Or})}async function Ir(e,t){await b(new URL(`settings/security/token/${encodeURIComponent(e)}`,P(t.repo,t.host)),{method:`DELETE`,credentials:{"prismic-auth":t.token}})}async function Lr(t){let{domain:n,token:r,host:i}=t;return await b(new URL(`app/dashboard/repositories/${n}/exists`,Wr(i)),{credentials:{"prismic-auth":r},schema:e()})}async function Rr(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await b(new URL(`app/dashboard/repositories`,Wr(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const zr=a({repository:a({api_access:m()})});async function Br(e){let{repo:t,token:n,host:r}=e;return(await b(new URL(`syncState`,P(t,r)),{credentials:{"prismic-auth":n},schema:zr})).repository.api_access}async function Vr(e,t){let{repo:n,token:r,host:i}=t;await b(new URL(`settings/security/apiaccess`,P(n,i)),{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}const Hr=a({repository:a({name:m()})});async function Ur(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,P(n,i)),o=new FormData;return o.set(`displayname`,e),(await b(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:Hr})).repository.name}function Wr(e){return new URL(`https://${e}/`)}function P(e,t){return new URL(`https://${e}.${t}/`)}var Gr=T({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 C(),r=await w(),i=await Kr({token:n,host:r});if(!i)throw new D(`Failed to create a repository. Please try again.`);let a=(await se().catch(()=>void 0))?.id??`other`;try{await Rr({domain:i,name:t??i,framework:a,token:n,host:r})}catch(e){throw e instanceof x?new D(`Failed to create repository: ${await e.text()}`):e}console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function Kr(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 Lr({domain:e,token:t,host:n})){r=e;break}}return r}var qr=T({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,r=await C(),i=await w(),a;try{a=await yt({token:r,host:i})}catch(e){throw e instanceof x?new D(`Failed to list repositories: ${await e.text()}`):e}let o=a.repositories;if(t){console.info(n(o.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${i}/`}))));return}if(o.length===0){console.info(`No repositories found.`);return}for(let e of o){let t=e.name||`(no name)`,n=e.role?` ${e.role}`:``;console.info(`${e.domain} ${t}${n}`)}});const Jr=[`private`,`public`,`open`];var Yr=T({name:`prismic repo set-api-access`,description:`
81
85
  Set the Content API access level of a Prismic repository.
82
86
 
83
87
  By default, this command reads the repository from prismic.config.json at the
84
88
  project root.
85
- `,positionals:{level:{description:`Access level (${Wr.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t;if(!Wr.includes(n))throw new D(`Invalid access level: ${n}. Must be one of: ${Wr.join(`, `)}`);let i=await C(),a=await w();try{await Lr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),Kr=T({name:`prismic repo set-name`,description:`
89
+ `,positionals:{level:{description:`Access level (${Jr.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v()}=t;if(!Jr.includes(n))throw new D(`Invalid access level: ${n}. Must be one of: ${Jr.join(`, `)}`);let i=await C(),a=await w();try{await Vr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),Xr=T({name:`prismic repo set-name`,description:`
86
90
  Set the display name of a Prismic repository.
87
91
 
88
92
  By default, this command reads the repository from prismic.config.json at the
89
93
  project root.
90
- `,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 v()}=t,i=await C(),a=await w(),o;try{o=await zr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${o}`)}),qr=T({name:`prismic repo view`,description:`
94
+ `,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 v()}=t,i=await C(),a=await w(),o;try{o=await Ur(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${o}`)}),Zr=T({name:`prismic repo view`,description:`
91
95
  View details of a Prismic repository.
92
96
 
93
97
  By default, this command reads the repository from prismic.config.json at the
94
98
  project root.
95
- `,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 v(),web:r,json:i}=e,a=await C(),o=await w(),s=`https://${t}.${o}/`;if(r){Et(new URL(s)),console.info(`Opening ${s}`);return}let c,l;try{[c,l]=await Promise.all([yt({token:a,host:o}),Ir({repo:t,token:a,host:o})])}catch(e){throw e instanceof x?new D(`Failed to fetch repository details: ${await e.text()}`):e}let u=c.repositories.find(e=>e.domain===t);if(!u)throw new D(`Repository not found: ${t}`);if(i){console.info(n({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}`)}),Jr=E({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:Vr,description:`Create a new repository`},list:{handler:Ur,description:`List repositories`},view:{handler:qr,description:`View repository details`},"set-name":{handler:Kr,description:`Set repository display name`},"set-api-access":{handler:Gr,description:`Set Content API access level`}}}),Yr=T({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:`Name of the slice`},id:{type:`string`,description:`Custom ID for the variation`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,id:i=s(n),repo:a=await v()}=t,o=await C(),c=await w(),l=(await k({repo:a,token:o,host:c})).find(e=>e.name===r);if(!l)throw new D(`Slice not found: ${r}`);if(l.variations.some(e=>e.id===i))throw new D(`Variation "${i}" already exists in slice "${r}".`);let u={...l,variations:[...l.variations,{id:i,name:n,description:n,docURL:``,imageUrl:``,version:``,primary:{}}]};try{await jt(u,{repo:a,host:c,token:o})}catch(e){throw e instanceof x?new D(`Failed to add variation: ${await e.text()}`):e}console.info(`Added variation "${n}" (id: "${i}") to slice "${r}"`)}),Xr=T({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`Name of the page type or custom 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 v()}=t,o={repo:a,token:await C(),host:await w()},s=(await k(o)).find(e=>e.name===n);if(!s)throw new D(`Slice not found: ${n}`);let c=(await O(o)).find(e=>e.label===r);if(!c)throw new D(`Type not found: ${r}`);let l=Object.assign({},...Object.values(c.json))[i];if(!l||l.type!==`Slices`)throw new D(`Slice zone "${i}" not found in "${r}".`);if(l.config??={},l.config.choices??={},s.id in l.config.choices)throw new D(`Slice "${s.id}" is already connected to "${r}" in slice zone "${i}".`);l.config.choices[s.id]={type:`SharedSlice`};try{await Ot(c,o)}catch(e){throw e instanceof x?new D(`Failed to connect slice: ${await e.text()}`):e}console.info(`Connected slice "${n}" to "${r}"`)}),Zr=T({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=o(n),repo:i=await v()}=t,a={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},s=await C(),c=await w();try{await At(a,{repo:i,host:c,token:s})}catch(e){throw e instanceof x?new D(`Failed to create slice: ${await e.text()}`):e}console.info(`Created slice "${n}" (id: "${r}")`)}),Qr=T({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the page type or custom 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 v()}=t,o={repo:a,token:await C(),host:await w()},s=(await k(o)).find(e=>e.name===n);if(!s)throw new D(`Slice not found: ${n}`);let c=(await O(o)).find(e=>e.label===r);if(!c)throw new D(`Type not found: ${r}`);let l=Object.assign({},...Object.values(c.json))[i];if(!l||l.type!==`Slices`)throw new D(`Slice zone "${i}" not found in "${r}".`);if(!l.config?.choices||!(s.id in l.config.choices))throw new D(`Slice "${s.id}" is not connected to "${r}" in slice zone "${i}".`);delete l.config.choices[s.id];try{await Ot(c,o)}catch(e){throw e instanceof x?new D(`Failed to disconnect slice: ${await e.text()}`):e}console.info(`Disconnected slice "${n}" from "${r}"`)}),$r=T({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:r=await v()}=e,i=await k({repo:r,token:await C(),host:await w()});if(t){console.info(n(i));return}if(i.length===0){console.info(`No slices found.`);return}for(let e of i)console.info(`${e.name} (id: ${e.id})`)}),ei=T({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{name:{description:`Name 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 v()}=t,i=await C(),a=await w(),o=(await k({repo:r,token:i,host:a})).find(e=>e.name===n);if(!o)throw new D(`Slice not found: ${n}`);try{await Mt(o.id,{repo:r,host:a,token:i})}catch(e){throw e instanceof x?new D(`Failed to remove slice: ${await e.text()}`):e}console.info(`Slice removed: "${n}" (id: ${o.id})`)}),ti=T({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,repo:i=await v()}=t,a=await C(),o=await w(),s=(await k({repo:i,token:a,host:o})).find(e=>e.name===r);if(!s)throw new D(`Slice not found: ${r}`);let c=s.variations.find(e=>e.name===n);if(!c)throw new D(`Variation "${n}" not found in slice "${r}".`);let l={...s,variations:s.variations.filter(e=>e.id!==c.id)};try{await jt(l,{repo:i,host:o,token:a})}catch(e){throw e instanceof x?new D(`Failed to remove variation: ${await e.text()}`):e}console.info(`Removed variation "${n}" from slice "${r}"`)}),ni=T({name:`prismic slice view`,description:`View details of a slice.`,positionals:{name:{description:`Name 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[r]=e,{json:i,repo:a=await v()}=t,o=(await k({repo:a,token:await C(),host:await w()})).find(e=>e.name===r);if(!o)throw new D(`Slice not found: ${r}`);if(i){console.info(n(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.name}`);let s=o.variations?.map(e=>e.id).join(`, `)||`(none)`;console.info(`Variations: ${s}`)}),ri=E({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Zr,description:`Create a new slice`},remove:{handler:ei,description:`Remove a slice`},list:{handler:$r,description:`List slices`},view:{handler:ni,description:`View a slice`},connect:{handler:Xr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:Qr,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Yr,description:`Add a variation to a slice`},"remove-variation":{handler:ti,description:`Remove a variation from a slice`}}});const ii=`Prismic CLI`;var ai=T({name:`prismic token create`,description:`
99
+ `,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 v(),web:r,json:i}=e,a=await C(),o=await w(),s=`https://${t}.${o}/`;if(r){Et(new URL(s)),console.info(`Opening ${s}`);return}let c,l;try{[c,l]=await Promise.all([yt({token:a,host:o}),Br({repo:t,token:a,host:o})])}catch(e){throw e instanceof x?new D(`Failed to fetch repository details: ${await e.text()}`):e}let u=c.repositories.find(e=>e.domain===t);if(!u)throw new D(`Repository not found: ${t}`);if(i){console.info(n({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=E({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:Gr,description:`Create a new repository`},list:{handler:qr,description:`List repositories`},view:{handler:Zr,description:`View repository details`},"set-name":{handler:Xr,description:`Set repository display name`},"set-api-access":{handler:Yr,description:`Set Content API access level`}}}),$r=T({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:`Name of the slice`},id:{type:`string`,description:`Custom ID for the variation`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,id:i=s(n),repo:a=await v()}=t,o=await C(),c=await w(),l=(await k({repo:a,token:o,host:c})).find(e=>e.name===r);if(!l)throw new D(`Slice not found: ${r}`);if(l.variations.some(e=>e.id===i))throw new D(`Variation "${i}" already exists in slice "${r}".`);let u={...l,variations:[...l.variations,{id:i,name:n,description:n,docURL:``,imageUrl:``,version:``,primary:{}}]};try{await jt(u,{repo:a,host:c,token:o})}catch(e){throw e instanceof x?new D(`Failed to add variation: ${await e.text()}`):e}console.info(`Added variation "${n}" (id: "${i}") to slice "${r}"`)}),ei=T({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`Name of the page type or custom 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 v()}=t,o={repo:a,token:await C(),host:await w()},s=(await k(o)).find(e=>e.name===n);if(!s)throw new D(`Slice not found: ${n}`);let c=(await O(o)).find(e=>e.label===r);if(!c)throw new D(`Type not found: ${r}`);let l=Object.assign({},...Object.values(c.json))[i];if(!l||l.type!==`Slices`)throw new D(`Slice zone "${i}" not found in "${r}".`);if(l.config??={},l.config.choices??={},s.id in l.config.choices)throw new D(`Slice "${s.id}" is already connected to "${r}" in slice zone "${i}".`);l.config.choices[s.id]={type:`SharedSlice`};try{await Ot(c,o)}catch(e){throw e instanceof x?new D(`Failed to connect slice: ${await e.text()}`):e}console.info(`Connected slice "${n}" to "${r}"`)}),ti=T({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=o(n),repo:i=await v()}=t,a={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},s=await C(),c=await w();try{await At(a,{repo:i,host:c,token:s})}catch(e){throw e instanceof x?new D(`Failed to create slice: ${await e.text()}`):e}console.info(`Created slice "${n}" (id: "${r}")`)}),ni=T({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the page type or custom 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 v()}=t,o={repo:a,token:await C(),host:await w()},s=(await k(o)).find(e=>e.name===n);if(!s)throw new D(`Slice not found: ${n}`);let c=(await O(o)).find(e=>e.label===r);if(!c)throw new D(`Type not found: ${r}`);let l=Object.assign({},...Object.values(c.json))[i];if(!l||l.type!==`Slices`)throw new D(`Slice zone "${i}" not found in "${r}".`);if(!l.config?.choices||!(s.id in l.config.choices))throw new D(`Slice "${s.id}" is not connected to "${r}" in slice zone "${i}".`);delete l.config.choices[s.id];try{await Ot(c,o)}catch(e){throw e instanceof x?new D(`Failed to disconnect slice: ${await e.text()}`):e}console.info(`Disconnected slice "${n}" from "${r}"`)}),ri=T({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:r=await v()}=e,i=await k({repo:r,token:await C(),host:await w()});if(t){console.info(n(i));return}if(i.length===0){console.info(`No slices found.`);return}for(let e of i)console.info(`${e.name} (id: ${e.id})`)}),ii=T({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{name:{description:`Name 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 v()}=t,i=await C(),a=await w(),o=(await k({repo:r,token:i,host:a})).find(e=>e.name===n);if(!o)throw new D(`Slice not found: ${n}`);try{await Mt(o.id,{repo:r,host:a,token:i})}catch(e){throw e instanceof x?new D(`Failed to remove slice: ${await e.text()}`):e}console.info(`Slice removed: "${n}" (id: ${o.id})`)}),ai=T({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,repo:i=await v()}=t,a=await C(),o=await w(),s=(await k({repo:i,token:a,host:o})).find(e=>e.name===r);if(!s)throw new D(`Slice not found: ${r}`);let c=s.variations.find(e=>e.name===n);if(!c)throw new D(`Variation "${n}" not found in slice "${r}".`);let l={...s,variations:s.variations.filter(e=>e.id!==c.id)};try{await jt(l,{repo:i,host:o,token:a})}catch(e){throw e instanceof x?new D(`Failed to remove variation: ${await e.text()}`):e}console.info(`Removed variation "${n}" from slice "${r}"`)}),oi=T({name:`prismic slice view`,description:`View details of a slice.`,positionals:{name:{description:`Name 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[r]=e,{json:i,repo:a=await v()}=t,o=(await k({repo:a,token:await C(),host:await w()})).find(e=>e.name===r);if(!o)throw new D(`Slice not found: ${r}`);if(i){console.info(n(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.name}`);let s=o.variations?.map(e=>e.id).join(`, `)||`(none)`;console.info(`Variations: ${s}`)}),si=E({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:ti,description:`Create a new slice`},remove:{handler:ii,description:`Remove a slice`},list:{handler:ri,description:`List slices`},view:{handler:oi,description:`View a slice`},connect:{handler:ei,description:`Connect a slice to a type's slice zone`},disconnect:{handler:ni,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:$r,description:`Add a variation to a slice`},"remove-variation":{handler:ai,description:`Remove a variation from a slice`}}});const ci=`Prismic CLI`;var li=T({name:`prismic token create`,description:`
96
100
  Create a new API token for a Prismic repository.
97
101
 
98
102
  By default, this command reads the repository from prismic.config.json at the
99
103
  project root.
100
- `,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 v(),write:n,"allow-releases":r}=e;if(n&&r)throw new D(`--allow-releases is only valid for access tokens (not with --write)`);let i=await C(),a=await w();if(n){let e=await jr(ii,{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===ii);n||=await Dr(ii,{repo:t,token:i,host:a});let o=await Or(n.id,e,{repo:t,token:i,host:a});console.info(`Token created: ${o.token}`)}}),oi=T({name:`prismic token delete`,description:`
104
+ `,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 v(),write:n,"allow-releases":r}=e;if(n&&r)throw new D(`--allow-releases is only valid for access tokens (not with --write)`);let i=await C(),a=await w();if(n){let e=await Fr(ci,{repo:t,token:i,host:a});console.info(`Token created: ${e.token}`)}else{let e=r?`master+releases`:`master`,n=(await Ar({repo:t,token:i,host:a})).find(e=>e.name===ci);n||=await jr(ci,{repo:t,token:i,host:a});let o=await Mr(n.id,e,{repo:t,token:i,host:a});console.info(`Token created: ${o.token}`)}}),ui=T({name:`prismic token delete`,description:`
101
105
  Delete a token from a Prismic repository.
102
106
 
103
107
  By default, this command reads the repository from prismic.config.json at the
104
108
  project root.
105
- `,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 v()}=t,i=await C(),a=await w(),[o,s]=await Promise.all([Er({repo:r,token:i,host:a}),Ar({repo:r,token:i,host:a})]),c=o.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(c){await kr(c.id,{repo:r,token:i,host:a}),console.info(`Token deleted`);return}let l=s.tokens.find(e=>e.token===n);if(l){await Mr(l.token,{repo:r,token:i,host:a}),console.info(`Token deleted`);return}throw new D(`Token not found: ${n}`)}),si=E({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:T({name:`prismic token list`,description:`
109
+ `,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 v()}=t,i=await C(),a=await w(),[o,s]=await Promise.all([Ar({repo:r,token:i,host:a}),Pr({repo:r,token:i,host:a})]),c=o.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(c){await Nr(c.id,{repo:r,token:i,host:a}),console.info(`Token deleted`);return}let l=s.tokens.find(e=>e.token===n);if(l){await Ir(l.token,{repo:r,token:i,host:a}),console.info(`Token deleted`);return}throw new D(`Token not found: ${n}`)}),di=E({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:T({name:`prismic token list`,description:`
106
110
  List all API tokens for a Prismic repository.
107
111
 
108
112
  By default, this command reads the repository from prismic.config.json at the
109
113
  project root.
110
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await v(),json:r}=e,i=await C(),a=await w(),[o,s]=await Promise.all([Er({repo:t,token:i,host:a}),Ar({repo:t,token:i,host:a})]),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(r){console.info(n({accessTokens:c,writeTokens:l}));return}if(c.length>0){console.info(`ACCESS TOKENS`);for(let e of c)console.info(` ${e.name} ${e.scope} ${e.token} ${e.createdAt}`)}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),l.length>0){console.info(`WRITE TOKENS`);for(let e of l){let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];console.info(` ${e.app_name} ${e.token} ${t}`)}}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:ai,description:`Create a new token`},delete:{handler:oi,description:`Delete a token`}}}),ci=T({name:`prismic webhook create`,description:`
114
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await v(),json:r}=e,i=await C(),a=await w(),[o,s]=await Promise.all([Ar({repo:t,token:i,host:a}),Pr({repo:t,token:i,host:a})]),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(r){console.info(n({accessTokens:c,writeTokens:l}));return}if(c.length>0){console.info(`ACCESS TOKENS`);for(let e of c)console.info(` ${e.name} ${e.scope} ${e.token} ${e.createdAt}`)}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),l.length>0){console.info(`WRITE TOKENS`);for(let e of l){let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];console.info(` ${e.app_name} ${e.token} ${t}`)}}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:li,description:`Create a new token`},delete:{handler:ui,description:`Delete a token`}}}),fi=T({name:`prismic webhook create`,description:`
111
115
  Create a new webhook in a Prismic repository.
112
116
 
113
117
  By default, this command reads the repository from prismic.config.json at the
@@ -121,27 +125,27 @@ await Promise.allSettled([
121
125
  tagsDeleted When a tag is deleted
122
126
 
123
127
  If no triggers specified, all are enabled.
124
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v(),name:i,secret:a,trigger:o=[]}=t;for(let e of o)if(!gr.includes(e))throw new D(`Invalid trigger: ${e}\nValid triggers: ${gr.join(`, `)}`);let s=await C(),c=await w(),l=!(o.length>0);try{await yr({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 x?new D(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`)}),li=T({name:`prismic webhook disable`,description:`
128
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v(),name:i,secret:a,trigger:o=[]}=t;for(let e of o)if(!br.includes(e))throw new D(`Invalid trigger: ${e}\nValid triggers: ${br.join(`, `)}`);let s=await C(),c=await w(),l=!(o.length>0);try{await Cr({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 x?new D(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`)}),pi=T({name:`prismic webhook disable`,description:`
125
129
  Disable a webhook in a Prismic repository.
126
130
 
127
131
  By default, this command reads the repository from prismic.config.json at the
128
132
  project root.
129
- `,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 v()}=t,i=await C(),a=await w(),o=(await vr({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new D(`Webhook not found: ${n}`);if(!o.config.active){console.info(`Webhook already disabled: ${n}`);return}let s=o.config._id,c=structuredClone(o.config);c.active=!1;try{await br(s,c,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),ui=T({name:`prismic webhook enable`,description:`
133
+ `,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 v()}=t,i=await C(),a=await w(),o=(await Sr({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new D(`Webhook not found: ${n}`);if(!o.config.active){console.info(`Webhook already disabled: ${n}`);return}let s=o.config._id,c=structuredClone(o.config);c.active=!1;try{await wr(s,c,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),mi=T({name:`prismic webhook enable`,description:`
130
134
  Enable a webhook in a Prismic repository.
131
135
 
132
136
  By default, this command reads the repository from prismic.config.json at the
133
137
  project root.
134
- `,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 v()}=t,i=await C(),a=await w(),o=(await vr({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new D(`Webhook not found: ${n}`);if(o.config.active){console.info(`Webhook already enabled: ${n}`);return}let s=o.config._id,c=structuredClone(o.config);c.active=!0;try{await br(s,c,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),di=T({name:`prismic webhook list`,description:`
138
+ `,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 v()}=t,i=await C(),a=await w(),o=(await Sr({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new D(`Webhook not found: ${n}`);if(o.config.active){console.info(`Webhook already enabled: ${n}`);return}let s=o.config._id,c=structuredClone(o.config);c.active=!0;try{await wr(s,c,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),hi=T({name:`prismic webhook list`,description:`
135
139
  List all webhooks in a Prismic repository.
136
140
 
137
141
  By default, this command reads the repository from prismic.config.json at the
138
142
  project root.
139
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await v(),json:r}=e,i=await vr({repo:t,token:await C(),host:await w()});if(r){console.info(n(i.map(e=>e.config)));return}if(i.length===0){console.info(`No webhooks configured.`);return}for(let e of i){let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;console.info(`${e.config.url}${n} [${t}]`)}}),fi=T({name:`prismic webhook remove`,description:`
143
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await v(),json:r}=e,i=await Sr({repo:t,token:await C(),host:await w()});if(r){console.info(n(i.map(e=>e.config)));return}if(i.length===0){console.info(`No webhooks configured.`);return}for(let e of i){let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;console.info(`${e.config.url}${n} [${t}]`)}}),gi=T({name:`prismic webhook remove`,description:`
140
144
  Delete a webhook from a Prismic repository.
141
145
 
142
146
  By default, this command reads the repository from prismic.config.json at the
143
147
  project root.
144
- `,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 v()}=t,i=await C(),a=await w(),o=(await vr({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new D(`Webhook not found: ${n}`);let s=o.config._id;try{await xr(s,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),pi=T({name:`prismic webhook set-triggers`,description:`
148
+ `,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 v()}=t,i=await C(),a=await w(),o=(await Sr({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new D(`Webhook not found: ${n}`);let s=o.config._id;try{await Tr(s,{repo:r,token:i,host:a})}catch(e){throw e instanceof x?new D(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),_i=T({name:`prismic webhook set-triggers`,description:`
145
149
  Update which events trigger a webhook.
146
150
 
147
151
  By default, this command reads the repository from prismic.config.json at the
@@ -153,14 +157,14 @@ await Promise.allSettled([
153
157
  releasesUpdated When a release is edited or deleted
154
158
  tagsCreated When a tag is created
155
159
  tagsDeleted When a tag is deleted
156
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v(),trigger:i=[]}=t;for(let e of i)if(!gr.includes(e))throw new D(`Invalid trigger: ${e}\nValid triggers: ${gr.join(`, `)}`);let a=await C(),o=await w(),s=(await vr({repo:r,token:a,host:o})).find(e=>e.config.url===n);if(!s)throw new D(`Webhook not found: ${n}`);let c=s.config._id;try{await br(c,{...s.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 x?new D(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${i.join(`, `)}`)}),mi=T({name:`prismic webhook view`,description:`
160
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await v(),trigger:i=[]}=t;for(let e of i)if(!br.includes(e))throw new D(`Invalid trigger: ${e}\nValid triggers: ${br.join(`, `)}`);let a=await C(),o=await w(),s=(await Sr({repo:r,token:a,host:o})).find(e=>e.config.url===n);if(!s)throw new D(`Webhook not found: ${n}`);let c=s.config._id;try{await wr(c,{...s.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 x?new D(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${i.join(`, `)}`)}),vi=T({name:`prismic webhook view`,description:`
157
161
  View details of a webhook in a Prismic repository.
158
162
 
159
163
  By default, this command reads the repository from prismic.config.json at the
160
164
  project root.
161
- `,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 v()}=t,i=(await vr({repo:r,token:await C(),host:await w()})).find(e=>e.config.url===n);if(!i)throw new D(`Webhook not found: ${n}`);let{config:a}=i;console.info(`URL: ${a.url}`),console.info(`Name: ${a.name||`(none)`}`),console.info(`Status: ${a.active?`enabled`:`disabled`}`),console.info(`Secret: ${a.secret?`(set)`:`(none)`}`);let o=[];for(let e of gr)a[e]&&o.push(e);if(console.info(`Triggers: ${o.length>0?o.join(`, `):`(none)`}`),Object.keys(a.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(a.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),hi=E({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:di,description:`List all webhooks`},create:{handler:ci,description:`Create a new webhook`},view:{handler:mi,description:`View webhook details`},remove:{handler:fi,description:`Delete a webhook`},enable:{handler:ui,description:`Enable a webhook`},disable:{handler:li,description:`Disable a webhook`},"set-triggers":{handler:pi,description:`Update webhook triggers`}}}),gi=T({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await yt({token:await C(),host:await w()});console.info(e.email)});const F=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,I=globalThis,L=`10.42.0`;function R(){return _i(I),I}function _i(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||L,t[L]=t[L]||{}}function vi(e,t,n=I){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[L]=r[L]||{};return i[e]||(i[e]=t())}const yi=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],bi={};function z(e){if(!(`console`in I))return e();let t=I.console,n={},r=Object.keys(bi);r.forEach(e=>{let r=bi[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function xi(){Oi().enabled=!0}function Si(){Oi().enabled=!1}function Ci(){return Oi().enabled}function wi(...e){Di(`log`,...e)}function Ti(...e){Di(`warn`,...e)}function Ei(...e){Di(`error`,...e)}function Di(e,...t){F&&Ci()&&z(()=>{I.console[e](`Sentry Logger [${e}]:`,...t)})}function Oi(){return F?vi(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const B={enable:xi,disable:Si,isEnabled:Ci,log:wi,warn:Ti,error:Ei},ki=/\(error: (.*)\)/,Ai=/captureMessage|captureException/;function ji(...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(`
162
- `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=ki.test(n)?n.replace(ki,`$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 Ni(i.slice(r))}}function Mi(e){return Array.isArray(e)?ji(...e):e}function Ni(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Pi(t).function||``)&&t.pop(),t.reverse(),Ai.test(Pi(t).function||``)&&(t.pop(),Ai.test(Pi(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Pi(t).filename,function:e.function||`?`}))}function Pi(e){return e[e.length-1]||{}}const Fi=`<anonymous>`;function Ii(e){try{return!e||typeof e!=`function`?Fi:e.name||Fi}catch{return Fi}}function Li(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function Ri(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const zi={},Bi={};function Vi(e,t){zi[e]=zi[e]||[],zi[e].push(t)}function Hi(e,t){if(!Bi[e]){Bi[e]=!0;try{t()}catch(t){F&&B.error(`Error while instrumenting ${e}`,t)}}}function Ui(e,t){let n=e&&zi[e];if(n)for(let r of n)try{r(t)}catch(t){F&&B.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Ii(r)}\nError:`,t)}}let Wi=null;function Gi(e){let t=`error`;Vi(t,e),Hi(t,Ki)}function Ki(){Wi=I.onerror,I.onerror=function(e,t,n,r,i){return Ui(`error`,{column:r,error:i,line:n,msg:e,url:t}),Wi?Wi.apply(this,arguments):!1},I.onerror.__SENTRY_INSTRUMENTED__=!0}let qi=null;function Ji(e){let t=`unhandledrejection`;Vi(t,e),Hi(t,Yi)}function Yi(){qi=I.onunhandledrejection,I.onunhandledrejection=function(e){return Ui(`unhandledrejection`,e),qi?qi.apply(this,arguments):!0},I.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Xi=Object.prototype.toString;function Zi(e){switch(Xi.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return V(e,Error)}}function Qi(e,t){return Xi.call(e)===`[object ${t}]`}function $i(e){return Qi(e,`ErrorEvent`)}function ea(e){return Qi(e,`String`)}function ta(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function na(e){return e===null||ta(e)||typeof e!=`object`&&typeof e!=`function`}function ra(e){return Qi(e,`Object`)}function ia(e){return typeof Event<`u`&&V(e,Event)}function aa(e){return typeof Element<`u`&&V(e,Element)}function oa(e){return Qi(e,`RegExp`)}function sa(e){return!!(e?.then&&typeof e.then==`function`)}function ca(e){return ra(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function V(e,t){try{return e instanceof t}catch{return!1}}function la(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const ua=I;function da(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=fa(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 fa(e,t){let n=e,r=[];if(!n?.tagName)return``;if(ua.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&&ea(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 pa(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&ha(i,r);try{e[t]=i}catch{F&&B.log(`Failed to replace method "${t}" in object`,e)}}function ma(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{F&&B.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function ha(e,t){try{e.prototype=t.prototype=t.prototype||{},ma(e,`__sentry_original__`,t)}catch{}}function ga(e){return e.__sentry_original__}function _a(e){if(Zi(e))return{message:e.message,name:e.name,stack:e.stack,...ya(e)};if(ia(e)){let t={type:e.type,target:va(e.target),currentTarget:va(e.currentTarget),...ya(e)};return typeof CustomEvent<`u`&&V(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function va(e){try{return aa(e)?da(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function ya(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 ba(e){let t=Object.keys(_a(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let xa;function Sa(e){if(xa!==void 0)return xa?xa(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=I;return t in n&&typeof n[t]==`function`?(xa=n[t],xa(e)):(xa=null,e())}function H(){return Sa(()=>Math.random())}function Ca(){return Sa(()=>Date.now())}function wa(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Ta(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 Ea(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{la(r)?n.push(Li(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function Da(e,t,n=!1){return ea(e)?oa(t)?t.test(e):ea(t)?n?e===t:e.includes(t):!1:!1}function Oa(e,t=[],n=!1){return t.some(t=>Da(e,t,n))}function ka(){let e=I;return e.crypto||e.msCrypto}let Aa;function ja(){return H()*16}function U(e=ka()){try{if(e?.randomUUID)return Sa(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Aa||=`10000000100040008000100000000000`,Aa.replace(/[018]/g,e=>(e^(ja()&15)>>e/4).toString(16))}function Ma(e){return e.exception?.values?.[0]}function Na(e){let{message:t,event_id:n}=e;if(t)return t;let r=Ma(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Pa(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 Fa(e,t){let n=Ma(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 Ia=/^(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 La(e){return parseInt(e||``,10)}function Ra(e){let t=e.match(Ia)||[],n=La(t[1]),r=La(t[2]),i=La(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 za(e){if(Ba(e))return!0;try{ma(e,`__sentry_captured__`,!0)}catch{}return!1}function Ba(e){try{return e.__sentry_captured__}catch{}}const Va=1e3;function Ha(){return Ca()/Va}function Ua(){let{performance:e}=I;if(!e?.now||!e.timeOrigin)return Ha;let t=e.timeOrigin;return()=>(t+Sa(()=>e.now()))/Va}let Wa;function Ga(){return(Wa??=Ua())()}function Ka(e){let t=Ga(),n={sid:U(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Ya(n)};return e&&qa(n,e),n}function qa(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||Ga(),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 Ja(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),qa(e,n)}function Ya(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 Xa(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]=Xa(r[e],t[e],n-1));return r}function Za(){return U()}function Qa(){return U().substring(16)}const $a=`_sentrySpan`;function eo(e,t){t?ma(e,$a,t):delete e[$a]}function to(e){return e[$a]}var no=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:Za(),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,eo(t,to(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&&qa(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():ra(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,eo(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Za(),sampleRand:H()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:Ha(),...e,message:e.message?wa(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:to(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Xa(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 F&&B.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 F&&B.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):(F&&B.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 ro(){return vi(`defaultCurrentScope`,()=>new no)}function io(){return vi(`defaultIsolationScope`,()=>new no)}var ao=class{constructor(e,t){let n;n=e||new no;let r;r=t||new no,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 sa(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 oo(){let e=_i(R());return e.stack=e.stack||new ao(ro(),io())}function so(e){return oo().withScope(e)}function co(e,t){let n=oo();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function lo(e){return oo().withScope(()=>e(oo().getIsolationScope()))}function uo(){return{withIsolationScope:lo,withScope:so,withSetScope:co,withSetIsolationScope:(e,t)=>lo(t),getCurrentScope:()=>oo().getScope(),getIsolationScope:()=>oo().getIsolationScope()}}function fo(e){let t=_i(R());t.acs=e}function W(e){let t=_i(e);return t.acs?t.acs:uo()}function G(){return W(R()).getCurrentScope()}function K(){return W(R()).getIsolationScope()}function po(){return vi(`globalScope`,()=>new no)}function mo(...e){let t=W(R());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function ho(...e){let t=W(R());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||Qa()};return n&&(i.parent_span_id=n),i}const _o=`sentry.profile_id`,vo=`sentry.exclusive_time`;function yo(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function bo(e){let t=e;return{scope:t._sentryScope,isolationScope:yo(t._sentryIsolationScope)}}const xo=/^sentry-/;function So(e){let t=wo(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 Co(e){if(e)return Eo(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function wo(e){if(!(!e||!ea(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=To(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):To(e)}function To(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 Eo(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?(F&&B.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const Do=/^o(\d+)\./,Oo=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function ko(e){return e===`http`||e===`https`}function Ao(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 jo(e){let t=Oo.exec(e);if(!t){z(()=>{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 Mo({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Mo(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function No(e){if(!F)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(B.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?ko(r)?t&&isNaN(parseInt(t,10))?(B.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(B.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(B.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Po(e){return e.match(Do)?.[1]}function Fo(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Po(n)),r}function Io(e){let t=typeof e==`string`?jo(e):Mo(e);if(!(!t||!No(t)))return t}function Lo(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 Ro=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function zo(e){if(!e)return;let t=e.match(Ro);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 Bo(e,t){let n=zo(e),r=So(t);if(!n?.traceId)return{traceId:Za(),sampleRand:H()};let i=Uo(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 Vo(e=Za(),t=Qa(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function Ho(e=Za(),t=Qa(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function Uo(e,t){let n=Lo(t?.sample_rand);if(n!==void 0)return n;let r=Lo(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?H()*r:r+H()*(1-r):H()}function Wo(e,t){let n=Fo(e);return t&&n&&t!==n?(B.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)?(B.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 Go=!1;function Ko(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Qo(e).parent_span_id,a=bo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Qa():t,trace_id:n}}function qo(e){let{traceId:t,spanId:n}=e.spanContext();return Vo(t,n,ts(e))}function Jo(e){let{traceId:t,spanId:n}=e.spanContext();return Ho(t,n,ts(e))}function Yo(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 Xo(e){return typeof e==`number`?Zo(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Zo(e.getTime()):Ga()}function Zo(e){return e>9999999999?e/1e3:e}function Qo(e){if(es(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if($o(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:Xo(i),timestamp:Xo(o)||void 0,status:ns(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:Yo(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function $o(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function es(e){return typeof e.getSpanJSON==`function`}function ts(e){let{traceFlags:t}=e.spanContext();return t===1}function ns(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function rs(e){return e._sentryRootSpan||e}function is(){let e=W(R());return e.getActiveSpan?e.getActiveSpan():to(G())}function as(){Go||=(z(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let os=!1;function ss(){if(os)return;function e(){let e=is(),t=e&&rs(e);if(t){let e=`internal_error`;F&&B.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,os=!0,Gi(e),Ji(e)}function cs(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||q()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function ls(e){B.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function us(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(fs(n)){if(Da(e.description,n))return F&&ls(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?Da(e.description,n.name):!0,r=n.op?e.op&&Da(e.op,n.op):!0;if(t&&r)return F&&ls(e),!0}return!1}function ds(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 fs(e){return typeof e==`string`||e instanceof RegExp}const ps=`production`;function ms(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||ps,release:n.release,public_key:r,trace_id:e,org_id:Fo(t)};return t.emit(`createDsc`,i),i}function hs(e,t){let n=t.getPropagationContext();return n.dsc||ms(n.traceId,e)}function gs(e){let t=q();if(!t)return{};let n=rs(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&&So(l);if(u)return s(u);let d=ms(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),cs()&&(d.sampled=String(ts(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??bo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function J(e,t=100,n=1/0){try{return vs(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function _s(e,t=3,n=100*1024){let r=J(e,t);return Ss(r)>n?_s(e,t-1,n):r}function vs(e,t,n=1/0,r=1/0,i=Cs()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=ys(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 vs(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=_a(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]=vs(e,t,c-1,r,i),d++}return o(t),u}function ys(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(la(t))return Li(t);if(ca(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Ii(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=bs(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function bs(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function xs(e){return~-encodeURI(e).split(/%..|./).length}function Ss(e){return xs(JSON.stringify(e))}function Cs(){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 ws(e,t=[]){return[e,t]}function Ts(e,t){let[n,r]=e;return[n,[...r,t]]}function Es(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 Ds(e,t){return Es(e,(e,n)=>t.includes(n))}function Os(e){let t=_i(I);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function ks(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Os(r),e]:r.push(typeof e==`string`?Os(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:As(r)}function As(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 js(e){let t=typeof e.data==`string`?Os(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Ms={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 Ns(e){return Ms[e]}function Ps(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Fs(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:Ao(r)},...i&&{trace:i}}}function Is(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 Ls(e,t,n,r){let i=Ps(n);return ws({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Ao(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Rs(e,t,n,r){let i=Ps(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Is(e,n?.sdk);let o=Fs(e,i,r,t);return delete e.sdkProcessingMetadata,ws(o,[[{type:a},e]])}const zs=`__SENTRY_SUPPRESS_TRACING__`,Bs=(e,t)=>{let n=W(R());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=q(),o=So(i);return a&&!Wo(a,o?.org_id)?Us(t):mo(e=>{let n=Bo(r,i);return e.setPropagationContext(n),eo(e,void 0),t()})};function Vs(e,t){let n=Ws();return n.withActiveSpan?n.withActiveSpan(e,t):mo(n=>(eo(n,e||void 0),t(n)))}function Hs(e){let t=Ws();return t.suppressTracing?t.suppressTracing(e):mo(t=>{t.setSDKProcessingMetadata({[zs]:!0});let n=e();return t.setSDKProcessingMetadata({[zs]:void 0}),n})}function Us(e){return mo(t=>(t.setPropagationContext({traceId:Za(),sampleRand:H()}),F&&B.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),Vs(null,e)))}function Ws(){return W(R())}function Gs(e){return new qs(t=>{t(e)})}function Ks(e){return new qs((t,n)=>{n(e)})}var qs=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(sa(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 Js(e,t,n,r=0){try{let i=Ys(t,n,e,r);return sa(i)?i:Gs(i)}catch(e){return Ks(e)}}function Ys(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return F&&a===null&&B.log(`Event processor "${i.id||`?`}" dropped event`),sa(a)?a.then(e=>Ys(e,t,n,r+1)):Ys(a,t,n,r+1)}let Xs,Zs,Qs,Y;function $s(e){let t=I._sentryDebugIds,n=I._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Y&&r.length===Zs&&i.length===Qs)return Y;Zs=r.length,Qs=i.length,Y={},Xs||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Xs?.[r];if(i&&Y&&t)Y[i[0]]=t,Xs&&(Xs[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&&Xs){Y[i]=t,Xs[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Y}function ec(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;ic(e,t),r&&sc(e,r),cc(e,n),ac(e,i),oc(e,a)}function tc(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;nc(e,`extra`,n),nc(e,`tags`,r),nc(e,`attributes`,i),nc(e,`user`,a),nc(e,`contexts`,o),e.sdkProcessingMetadata=Xa(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 nc(e,t,n){e[t]=Xa(e[t],n,1)}function rc(e,t){let n=po().getScopeData();return e&&tc(n,e.getScopeData()),t&&tc(n,t.getScopeData()),n}function ic(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 ac(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function oc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function sc(e,t){e.contexts={trace:Ko(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:gs(t),...e.sdkProcessingMetadata};let n=Qo(rs(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function cc(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 lc(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||Ha()},l=n.integrations||e.integrations.map(e=>e.name);uc(c,e),pc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&dc(c,e.stackParser);let u=hc(r,n.captureContext);n.mechanism&&Fa(c,n.mechanism);let d=i?i.getEventProcessors():[],f=rc(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),ec(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Gs(c):Js(m,c,n)).then(e=>(e&&fc(e),typeof o==`number`&&o>0?mc(e,o,s):e))}function uc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||ps,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=wa(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=wa(e.value,a)})}function dc(e,t){let n=$s(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function fc(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 pc(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function mc(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 hc(e,t){if(!t)return e;let n=e?e.clone():new no;return n.update(t),n}function gc(e){if(e)return _c(e)||yc(e)?{captureContext:e}:e}function _c(e){return e instanceof no||typeof e==`function`}const vc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function yc(e){return Object.keys(e).some(e=>vc.includes(e))}function bc(e,t){return G().captureException(e,gc(t))}function xc(e,t){K().setContext(e,t)}function Sc(e,t){K().setTag(e,t)}function Cc(e){K().setUser(e)}async function wc(e){let t=q();return t?t.flush(e):(F&&B.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function Tc(){let e=q();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Ec(e){let t=K(),{user:n}=rc(t,G()),{userAgent:r}=I.navigator||{},i=Ka({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&qa(a,{status:`exited`}),Dc(),t.setSession(i),i}function Dc(){let e=K(),t=G().getSession()||e.getSession();t&&Ja(t),Oc(),e.setSession()}function Oc(){let e=K(),t=q(),n=e.getSession();n&&t&&t.captureSession(n)}function kc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Ac(e){return`${kc(e)}${e.projectId}/envelope/`}function jc(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 Mc(e,t,n){return t||`${Ac(e)}?${jc(e,n)}`}const Nc=[];function Pc(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 Fc(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 Pc(r)}function Ic(e,t){let n={};return t.forEach(t=>{t&&Rc(e,t,n)}),n}function Lc(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Rc(e,t,n){if(n[t.name]){F&&B.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Nc.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),Nc.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)}F&&B.log(`Integration installed: ${t.name}`)}function X(e){return e}function zc(e,t){return t?mo(t,()=>{let n=is(),r=n?Ko(n):go(t);return[n?gs(n):hs(e,t),r]}):[void 0,void 0]}function Bc(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function Vc(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Ao(r)),ws(i,[Bc(e)])}function Hc(e,t){let n=t??Uc(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Vc(n,r._metadata,r.tunnel,e.getDsn());Wc().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Uc(e){return Wc().get(e)}function Wc(){return vi(`clientToLogBufferMap`,()=>new WeakMap)}function Gc(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function Kc(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Ao(r)),ws(i,[Gc(e)])}function qc(e,t){let n=t??Jc(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Kc(n,r._metadata,r.tunnel,e.getDsn());Yc().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Jc(e){return Yc().get(e)}function Yc(){return vi(`clientToMetricBufferMap`,()=>new WeakMap)}function Xc(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const Zc=Symbol.for(`SentryBufferFullError`);function Qc(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Ks(Zc);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Gs(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Xc(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function $c(e,t=Ca()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function el(e,t){return e[t]||e.all||0}function tl(e,t,n=Ca()){return el(e,t)>n}function nl(e,{statusCode:t,headers:n},r=Ca()){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+$c(o,r):t===429&&(i.all=r+60*1e3);return i}function rl(e,t,n=Qc(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Es(i,(t,n)=>{let i=Ns(n);tl(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=ws(i[0],a),s=t=>{if(Ds(o,[`client_report`])){F&&B.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Es(o,(n,r)=>{e.recordDroppedEvent(t,Ns(r))})};return n.add(()=>t({body:ks(o)}).then(e=>e.statusCode===413?(F&&B.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(F&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&B.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=nl(r,e),e),e=>{throw s(`network_error`),F&&B.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===Zc)return F&&B.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function il(e,t,n){let r=[{type:`client_report`},{timestamp:n||Ha(),discarded_events:e}];return ws(t?{dsn:t}:{},[r])}function al(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 ol(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?.[_o],exclusive_time:o?.[vo],measurements:e.measurements,is_segment:!0}}function sl(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&&{[_o]:e.profile_id},...e.exclusive_time&&{[vo]:e.exclusive_time}}}},measurements:e.measurements}}const cl=`Not capturing exception because it's already been captured.`,ll=`Discarded session because of missing or non-string release`,ul=Symbol.for(`SentryInternalError`),dl=Symbol.for(`SentryDoNotSendEventError`);function fl(e){return{message:e,[ul]:!0}}function pl(e){return{message:e,[dl]:!0}}function ml(e){return!!e&&typeof e==`object`&&ul in e}function hl(e){return!!e&&typeof e==`object`&&dl 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=Xc(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var _l=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Qc(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=Io(e.dsn):F&&B.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Mc(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`,wl,Hc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&gl(this,`afterCaptureMetric`,`flushMetrics`,Cl,qc)}captureException(e,t,n){let r=U();if(za(e))return F&&B.log(cl),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=ta(e)?e:String(e),o=na(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&&za(t.originalException))return F&&B.log(cl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=vl(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),qa(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){Hc(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];Rc(this,e,this._integrations),t||Lc(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Rs(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=Ts(n,js(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=ps}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){F&&B.warn(ll);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){F&&B.warn(ll);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Ls(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}`;F&&B.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 F&&B.error(`Error while sending envelope:`,e),{}}return F&&B.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Ic(this,e),Lc(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)&&(qa(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),lc(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:hs(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=G(),r=K()){return F&&xl(e)&&B.log(`Captured error event \`${al(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{F&&(hl(e)?B.log(e.message):ml(e)?B.warn(e.message):B.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Sl(e),s=xl(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Lo(a);if(s&&typeof l==`number`&&H()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Ks(pl(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=vl(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),pl("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:yl(bl(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 pl(`${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 hl(e)||ml(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),fl(`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===Zc&&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(){F&&B.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){F&&B.log(`No outcomes to send`);return}if(!this._dsn){F&&B.log(`No dsn provided, will not send outcomes`);return}F&&B.log(`Sending outcomes:`,e);let t=il(e,this._options.tunnel&&Ao(this._dsn));this.sendEnvelope(t)}};function vl(e){return e===`replay_event`?`replay`:e||`error`}function yl(e,t){let n=`${t} must return \`null\` or a valid event.`;if(sa(e))return e.then(e=>{if(!ra(e)&&e!==null)throw fl(n);return e},e=>{throw fl(`${t} rejected with ${e}`)});if(!ra(e)&&e!==null)throw fl(n);return e}function bl(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(Sl(c)){if(o||s){let t=ol(c);if(s?.length&&us(t,s))return null;if(o){let e=o(t);e?c=Xa(n,sl(e)):as()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&us(e,s)){ds(n,e);continue}if(o){let n=o(e);n?t.push(n):(as(),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 Sl(e){return e.type===`transaction`}function Cl(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Tl(e.attributes)}function wl(e){let t=0;return e.message&&(t+=e.message.length*2),t+Tl(e.attributes)}function Tl(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*El(e[0]):na(e)?t+=El(e):t+=100}),t}function El(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Dl(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=Ao(i)),t&&(a.trace=t),ws(a,[Ol(e)])}function Ol(e){return[{type:`check_in`},e]}function kl(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 Al(e,t){return e(t.stack||``,1)}function jl(e){return Zi(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Ml(e){return jl(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Nl(e,t){let n={type:t.name||t.constructor.name,value:Ml(t)},r=Al(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Pl(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function Fl(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=ba(e);if($i(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Il(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Il(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Ll(e,t,n,r){if(Zi(n))return[n,void 0];if(t.synthetic=!0,ra(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:_s(n,t)},a=Pl(n);if(a)return[a,i];let o=Fl(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 Rl(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Ll(e,i,n,r),s={exception:{values:[Nl(t,a)]}};return o&&(s.extra=o),Pa(s,void 0,void 0),Fa(s,i),{...s,event_id:r?.event_id}}function zl(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Al(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},Fa(a,{synthetic:!0}))}if(ta(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 Bl=class extends _l{constructor(e){ss(),kl(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=Rl(this,this._options.stackParser,e,t);return n.level=`error`,Gs(n)}eventFromMessage(e,t=`info`,n){return Gs(zl(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return Vl(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&Vl(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:U();if(!this._isEnabled())return F&&B.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]=zc(this,n);l&&(s.contexts={trace:l});let u=Dl(s,c,this.getSdkMetadata(),o,this.getDsn());return F&&B.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){F&&B.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=Qc(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 Vl(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 Hl=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),Ul=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function Wl(e,t){let n=String(e).toLowerCase();return Hl.has(n)?!1:Ul.has(n)?!0:t?.strict?null:!!e}function Gl(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 Kl(e){return e.split(/[?#]/,1)[0]}function ql(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Jl(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:L})),i.version=L)}function Yl(e={}){let t=e.client||q();if(!Tc()||!t)return{};let n=W(R());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||G(),i=e.span||is(),a=i?qo(i):Xl(r),o=Co(i?gs(i):hs(t,r));if(!Ro.test(a))return B.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?Jo(i):Zl(r)),s}function Xl(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Vo(t,r,n)}function Zl(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ho(t,r,n)}const Ql=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function $l(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return F&&!r&&B.log(Ql,e),r;let i=Oa(e,t);return n?.set(e,i),F&&!i&&B.log(Ql,e),i}function eu(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function tu(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=nu({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:ru(i),headers:eu(t),cookies:s,data:o}}function nu({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function ru(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function iu(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:Ha(),...e},s=i?z(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let au;const ou=new WeakMap,su=X((()=>({name:`FunctionToString`,setupOnce(){au=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=ga(this),n=ou.has(q())&&t!==void 0?t:this;return au.apply(n,e)}}catch{}},setup(e){ou.set(e,!0)}}))),cu=[/^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$/],lu=X((e={})=>{let t;return{name:`EventFilters`,setup(n){t=uu(e,n.getOptions())},processEvent(n,r,i){return t||=uu(e,i.getOptions()),du(n,t)?null:n}}});function uu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:cu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function du(e,t){if(e.type){if(e.type===`transaction`&&pu(e,t.ignoreTransactions))return F&&B.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Na(e)}`),!0}else{if(fu(e,t.ignoreErrors))return F&&B.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Na(e)}`),!0;if(vu(e))return F&&B.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Na(e)}`),!0;if(mu(e,t.denyUrls))return F&&B.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Na(e)}.\nUrl: ${_u(e)}`),!0;if(!hu(e,t.allowUrls))return F&&B.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Na(e)}.\nUrl: ${_u(e)}`),!0}return!1}function fu(e,t){return t?.length?al(e).some(e=>Oa(e,t)):!1}function pu(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Oa(n,t):!1}function mu(e,t){if(!t?.length)return!1;let n=_u(e);return n?Oa(n,t):!1}function hu(e,t){if(!t?.length)return!0;let n=_u(e);return n?Oa(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 _u(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 F&&B.error(`Cannot extract url for event ${Na(e)}`),null}}function vu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function yu(e,t,n,r,i,a){if(!i.exception?.values||!a||!V(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=bu(e,t,r,a.originalException,n,i.exception.values,o,0))}function bu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(V(r[i],Error)){Su(o,s,r);let a=e(t,r[i]),l=c.length;Cu(a,i,l,s),c=bu(e,t,n,r[i],i,[a,...c],a,l)}return xu(r)&&r.errors.forEach((a,l)=>{if(V(a,Error)){Su(o,s,r);let u=e(t,a),d=c.length;Cu(u,`errors[${l}]`,d,s),c=bu(e,t,n,a,i,[u,...c],u,d)}}),c}function xu(e){return Array.isArray(e.errors)}function Su(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...xu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Cu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const wu=X(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){yu(Nl,i.getOptions().stackParser,n,t,e,r)}}}));function Tu(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 Eu=[`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 Du(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Eu.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Ou(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&ku(e))||null}function Ou(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function ku(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 Au={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},ju=X(((e={})=>{let t={...Au,...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&&Mu(e,a,{ipAddress:o},s),e}}}));function Mu(e,t,n,r){if(e.request={...e.request,...Nu(t,r)},r.ip){let r=t.headers&&Du(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Nu(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||Eu.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?Tu(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Pu(e){let t=`console`;Vi(t,e),Hi(t,Fu)}function Fu(){`console`in I&&yi.forEach(function(e){e in I.console&&pa(I.console,e,function(t){return bi[e]=t,function(...t){Ui(`console`,{args:t,level:e}),bi[e]?.apply(I.console,t)}})})}function Iu(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const Lu=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Ru(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Lu.exec(t);return n?n.slice(1):[]}function zu(e){let t=Ru(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const Bu=X((e={})=>{let t=new Set(e.levels||yi);return{name:`Console`,setup(e){Pu(({args:n,level:r})=>{q()!==e||!t.has(r)||Vu(r,n)})}}});function Vu(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Iu(e),message:Hu(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Hu(e)}`:`Assertion failed`,n.data.arguments=e}else return;iu(n,{input:t,level:e})}function Hu(e){return`util`in I&&typeof I.util.format==`function`?I.util.format(...e):Ea(e,` `)}function Uu(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function Wu(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 Gu(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=Ri(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?Ju(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:qu(o[3]),colno:qu(o[4]),in_app:Wu(s||``,c)}}if(i.match(t))return{filename:i}}}function Ku(e){return[90,Gu(e)]}function qu(e){return parseInt(e||``,10)||void 0}function Ju(e){try{return decodeURI(e)}catch{return}}var Yu=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 Xu=class extends Bl{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||y.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};Jl(n,`node-light`,[`node-core`]),B.log(`Initializing Sentry: process: ${process.pid}, thread: ${Be?`main`:`worker-${Ve}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Hc(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&&B.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const Zu=X((e={})=>({name:`ChildProcess`,setup(){He.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&Qu(t.process,e)}),He.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&$u(t.worker,e)})}}));function Qu(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&&iu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,iu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function $u(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?iu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):bc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const ed=be(Ke),td=be(Je),nd=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=rd(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 id()),n.app&&(e.app=od()),n.device&&(e.device=sd(n.device)),n.culture){let t=ad();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=md()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function rd(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=y.freemem()),e}async function id(){let e=y.platform();switch(e){case`darwin`:return dd();case`linux`:return pd();default:return{name:cd[e]||e,version:y.release()}}}function ad(){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 od(){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 sd(e){let t={},n;try{n=y.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=y.arch(),(e===!0||e.memory)&&(t.memory_size=y.totalmem(),t.free_memory=y.freemem()),e===!0||e.cpu){let e=y.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const cd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},ld=[{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`]}],ud={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 dd(){let e={kernel_version:y.release(),name:`Mac OS X`,version:`10.${Number(y.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Me(`/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 fd(e){return e.split(` `)[0].toLowerCase()}async function pd(){let e={kernel_version:y.release(),name:`Linux`};try{let t=await td(`/etc`),n=ld.find(e=>t.includes(e.name));if(!n)return e;let r=(await ed(Oe(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(fd(e))>=0)||i[0],e.version=ud[fd(e.name)]?.(r)}catch{}return e}function md(){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 hd=new Yu(10),gd=new Yu(20);function _d(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function vd(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function yd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function bd(e,t){let n=hd.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=kd(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=kd(r,t)),n++}return a}function Sd(e,t,n){return new Promise((r,i)=>{let a=We(e),o=Fe({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&&B.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]=Ta(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 Cd(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`||vd(i)||yd(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=>bd(e,t)))continue;let o=_d(hd,e,{});i.push(Sd(e,a,o))}if(await Promise.all(i).catch(()=>{Z&&B.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&&wd(n.stacktrace.frames,t,hd);return e}function wd(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;Ed(r.lineno,r,t,e)}}function Td(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Ed(e,t,n,r){if(t.lineno===void 0||r===void 0){Z&&B.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=Dd(e,n);i<e;i++){let e=r[i];if(e===void 0){Td(t),Z&&B.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){Td(t),Z&&B.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=Od(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 Dd(e,t){return Math.max(1,e-t)}function Od(e,t){return e+t}function kd(e,t){return[Dd(e,t),Od(e,t)]}const Ad=X(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return Cd(e,t)}}})),jd=Ra(process.versions.node),Md=jd.major;jd.minor;let Nd;async function Pd(){if(Nd===void 0)try{Nd=!!(await import(`node:inspector`)).url()}catch{Nd=!1}return Nd}const Fd=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Id(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 Ld(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function Rd(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Ld(e)&&Ld(t)}function zd(...e){B.log(`[LocalVariables]`,...e)}const Bd=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||!Rd(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&Fd in n.originalException&&Array.isArray(n.originalException[Fd])){for(let r of e.exception?.values||[])t(r,n.originalException[Fd]);n.originalException[Fd]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new Ye(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=>{zd(`Worker error`,e)}),t.once(`exit`,e=>{zd(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await Pd()){B.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:B.isEnabled()};r().then(()=>{try{i(n)}catch(e){B.error(`Failed to start worker`,e)}},e=>{B.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function Vd(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function Hd(e,t){if(t!==void 0)return Vd(e(t,1))}function Ud(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 Wd=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}=Ud(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 Gd=X(((e={},t)=>{let n=new Yu(20),r,i=!1;function a(t){let r=Vd(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||!Rd(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(Md<18){B.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Pd()){B.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Wd.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=Hd(e,i.description);if(c==null){s();return}let{add:l,next:u}=Ud(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=Id(e.maxExceptionsPerSecond||50,()=>{B.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{B.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){B.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]}}})),Kd=(e={})=>jd.major<19?Gd(e):Bd(e);function qd(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let Jd;const Yd=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,Xd=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...ef()},e},getModules:ef}));function Zd(){try{return fe.cache?Object.keys(fe.cache):[]}catch{return[]}}function Qd(){return{...Yd,...nf(),...qd()?$d():{}}}function $d(){let e=fe.main?.paths||[],t=Zd(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=De(t),!i||t===i||r.has(t))return;if(e.indexOf(i)<0)return a();let o=Oe(t,`package.json`);if(r.add(t),!Ge(o))return a();try{let e=JSON.parse(qe(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function ef(){return Jd||=Qd(),Jd}function tf(){try{let e=Oe(process.cwd(),`package.json`);return JSON.parse(qe(e,`utf8`))}catch{return{}}}function nf(){let e=tf();return{...e.dependencies,...e.devDependencies}}function rf(e){z(()=>{console.error(e)});let t=q();if(t===void 0){Z&&B.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&&B.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Z&&B.error(e)})}const af=X((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){Be&&global.process.on(`uncaughtException`,of(e,t))}}});function of(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=rf;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&&B.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),rf(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,q()===e&&bc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const sf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],cf=X(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...sf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,ff(e,t))}}}));function lf(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 uf(e,t){let n=e.name===void 0||Da(t.name,e.name,!0),r=e.message===void 0||Da(t.message,e.message);return n&&r}function df(e,t){let n=lf(t);return e.some(e=>uf(e,n))}function ff(e,t){return function(n,r){if(q()!==e||df(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>Vs(a,e):e=>e())(()=>{bc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),pf(n,t.mode)}}function pf(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`?z(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(z(()=>{console.warn(n)}),rf(e))}const mf=X(()=>({name:`ProcessSession`,setupOnce(){Ec(),process.on(`beforeExit`,()=>{K().getSession()?.status!==`ok`&&Dc()})}})),hf=`Spotlight`,gf=X(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:hf,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&B.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}_f(e,t)}}}));function _f(e,t){let n=vf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){B.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=ks(e);Hs(()=>{let e=Ie.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++,B.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function vf(e){try{return new URL(`${e}`)}catch{B.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function yf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:ve.getSystemErrorMap().has(e.errno)}const bf=X((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!yf(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 Sf(e=process.argv[1]?zu(process.argv[1]):process.cwd(),t=Ae===`\\`){let n=t?xf(e):e;return e=>{if(!e)return;let r=t?xf(e):e,{dir:i,base:a,ext:o}=ke.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 Cf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(I.SENTRY_RELEASE?.id)return I.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 wf=ji(Ku(Sf())),$=Symbol(`AgentBaseInternalState`);var Tf=class extends Ie.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(`
163
- `).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 Ie.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 Ef(...e){B.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function Df(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(),Ef(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),Ef(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
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 v()}=t,i=(await Sr({repo:r,token:await C(),host:await w()})).find(e=>e.config.url===n);if(!i)throw new D(`Webhook not found: ${n}`);let{config:a}=i;console.info(`URL: ${a.url}`),console.info(`Name: ${a.name||`(none)`}`),console.info(`Status: ${a.active?`enabled`:`disabled`}`),console.info(`Secret: ${a.secret?`(set)`:`(none)`}`);let o=[];for(let e of br)a[e]&&o.push(e);if(console.info(`Triggers: ${o.length>0?o.join(`, `):`(none)`}`),Object.keys(a.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(a.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),yi=E({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:hi,description:`List all webhooks`},create:{handler:fi,description:`Create a new webhook`},view:{handler:vi,description:`View webhook details`},remove:{handler:gi,description:`Delete a webhook`},enable:{handler:mi,description:`Enable a webhook`},disable:{handler:pi,description:`Disable a webhook`},"set-triggers":{handler:_i,description:`Update webhook triggers`}}}),bi=T({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await yt({token:await C(),host:await w()});console.info(e.email)});const F=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,I=globalThis,L=`10.42.0`;function R(){return xi(I),I}function xi(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||L,t[L]=t[L]||{}}function Si(e,t,n=I){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[L]=r[L]||{};return i[e]||(i[e]=t())}const Ci=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],wi={};function z(e){if(!(`console`in I))return e();let t=I.console,n={},r=Object.keys(wi);r.forEach(e=>{let r=wi[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Ti(){Mi().enabled=!0}function Ei(){Mi().enabled=!1}function Di(){return Mi().enabled}function Oi(...e){ji(`log`,...e)}function ki(...e){ji(`warn`,...e)}function Ai(...e){ji(`error`,...e)}function ji(e,...t){F&&Di()&&z(()=>{I.console[e](`Sentry Logger [${e}]:`,...t)})}function Mi(){return F?Si(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const B={enable:Ti,disable:Ei,isEnabled:Di,log:Oi,warn:ki,error:Ai},Ni=/\(error: (.*)\)/,Pi=/captureMessage|captureException/;function Fi(...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(`
166
+ `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Ni.test(n)?n.replace(Ni,`$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 Li(i.slice(r))}}function Ii(e){return Array.isArray(e)?Fi(...e):e}function Li(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Ri(t).function||``)&&t.pop(),t.reverse(),Pi.test(Ri(t).function||``)&&(t.pop(),Pi.test(Ri(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Ri(t).filename,function:e.function||`?`}))}function Ri(e){return e[e.length-1]||{}}const zi=`<anonymous>`;function Bi(e){try{return!e||typeof e!=`function`?zi:e.name||zi}catch{return zi}}function Vi(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function Hi(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const Ui={},Wi={};function Gi(e,t){Ui[e]=Ui[e]||[],Ui[e].push(t)}function Ki(e,t){if(!Wi[e]){Wi[e]=!0;try{t()}catch(t){F&&B.error(`Error while instrumenting ${e}`,t)}}}function qi(e,t){let n=e&&Ui[e];if(n)for(let r of n)try{r(t)}catch(t){F&&B.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Bi(r)}\nError:`,t)}}let Ji=null;function Yi(e){let t=`error`;Gi(t,e),Ki(t,Xi)}function Xi(){Ji=I.onerror,I.onerror=function(e,t,n,r,i){return qi(`error`,{column:r,error:i,line:n,msg:e,url:t}),Ji?Ji.apply(this,arguments):!1},I.onerror.__SENTRY_INSTRUMENTED__=!0}let Zi=null;function Qi(e){let t=`unhandledrejection`;Gi(t,e),Ki(t,$i)}function $i(){Zi=I.onunhandledrejection,I.onunhandledrejection=function(e){return qi(`unhandledrejection`,e),Zi?Zi.apply(this,arguments):!0},I.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const ea=Object.prototype.toString;function ta(e){switch(ea.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return V(e,Error)}}function na(e,t){return ea.call(e)===`[object ${t}]`}function ra(e){return na(e,`ErrorEvent`)}function ia(e){return na(e,`String`)}function aa(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function oa(e){return e===null||aa(e)||typeof e!=`object`&&typeof e!=`function`}function sa(e){return na(e,`Object`)}function ca(e){return typeof Event<`u`&&V(e,Event)}function la(e){return typeof Element<`u`&&V(e,Element)}function ua(e){return na(e,`RegExp`)}function da(e){return!!(e?.then&&typeof e.then==`function`)}function fa(e){return sa(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function V(e,t){try{return e instanceof t}catch{return!1}}function pa(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const ma=I;function ha(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=ga(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 ga(e,t){let n=e,r=[];if(!n?.tagName)return``;if(ma.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&&ia(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 _a(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&ya(i,r);try{e[t]=i}catch{F&&B.log(`Failed to replace method "${t}" in object`,e)}}function va(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{F&&B.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function ya(e,t){try{e.prototype=t.prototype=t.prototype||{},va(e,`__sentry_original__`,t)}catch{}}function ba(e){return e.__sentry_original__}function xa(e){if(ta(e))return{message:e.message,name:e.name,stack:e.stack,...Ca(e)};if(ca(e)){let t={type:e.type,target:Sa(e.target),currentTarget:Sa(e.currentTarget),...Ca(e)};return typeof CustomEvent<`u`&&V(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Sa(e){try{return la(e)?ha(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Ca(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 wa(e){let t=Object.keys(xa(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let Ta;function Ea(e){if(Ta!==void 0)return Ta?Ta(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=I;return t in n&&typeof n[t]==`function`?(Ta=n[t],Ta(e)):(Ta=null,e())}function H(){return Ea(()=>Math.random())}function Da(){return Ea(()=>Date.now())}function Oa(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function ka(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 Aa(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{pa(r)?n.push(Vi(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function ja(e,t,n=!1){return ia(e)?ua(t)?t.test(e):ia(t)?n?e===t:e.includes(t):!1:!1}function Ma(e,t=[],n=!1){return t.some(t=>ja(e,t,n))}function Na(){let e=I;return e.crypto||e.msCrypto}let Pa;function Fa(){return H()*16}function U(e=Na()){try{if(e?.randomUUID)return Ea(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Pa||=`10000000100040008000100000000000`,Pa.replace(/[018]/g,e=>(e^(Fa()&15)>>e/4).toString(16))}function Ia(e){return e.exception?.values?.[0]}function La(e){let{message:t,event_id:n}=e;if(t)return t;let r=Ia(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Ra(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 za(e,t){let n=Ia(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 Ba=/^(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 Va(e){return parseInt(e||``,10)}function Ha(e){let t=e.match(Ba)||[],n=Va(t[1]),r=Va(t[2]),i=Va(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 Ua(e){if(Wa(e))return!0;try{va(e,`__sentry_captured__`,!0)}catch{}return!1}function Wa(e){try{return e.__sentry_captured__}catch{}}const Ga=1e3;function Ka(){return Da()/Ga}function qa(){let{performance:e}=I;if(!e?.now||!e.timeOrigin)return Ka;let t=e.timeOrigin;return()=>(t+Ea(()=>e.now()))/Ga}let Ja;function Ya(){return(Ja??=qa())()}function Xa(e){let t=Ya(),n={sid:U(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>$a(n)};return e&&Za(n,e),n}function Za(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||Ya(),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 Qa(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),Za(e,n)}function $a(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 to(){return U()}function no(){return U().substring(16)}const ro=`_sentrySpan`;function io(e,t){t?va(e,ro,t):delete e[ro]}function ao(e){return e[ro]}var oo=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:to(),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,io(t,ao(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&&Za(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():sa(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,io(this,void 0),this._attachments=[],this.setPropagationContext({traceId:to(),sampleRand:H()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:Ka(),...e,message:e.message?Oa(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:ao(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 F&&B.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 F&&B.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):(F&&B.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 so(){return Si(`defaultCurrentScope`,()=>new oo)}function co(){return Si(`defaultIsolationScope`,()=>new oo)}var lo=class{constructor(e,t){let n;n=e||new oo;let r;r=t||new oo,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 da(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 uo(){let e=xi(R());return e.stack=e.stack||new lo(so(),co())}function fo(e){return uo().withScope(e)}function po(e,t){let n=uo();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function mo(e){return uo().withScope(()=>e(uo().getIsolationScope()))}function ho(){return{withIsolationScope:mo,withScope:fo,withSetScope:po,withSetIsolationScope:(e,t)=>mo(t),getCurrentScope:()=>uo().getScope(),getIsolationScope:()=>uo().getIsolationScope()}}function go(e){let t=xi(R());t.acs=e}function W(e){let t=xi(e);return t.acs?t.acs:ho()}function G(){return W(R()).getCurrentScope()}function K(){return W(R()).getIsolationScope()}function _o(){return Si(`globalScope`,()=>new oo)}function vo(...e){let t=W(R());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function yo(...e){let t=W(R());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 bo(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||no()};return n&&(i.parent_span_id=n),i}const xo=`sentry.profile_id`,So=`sentry.exclusive_time`;function Co(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function wo(e){let t=e;return{scope:t._sentryScope,isolationScope:Co(t._sentryIsolationScope)}}const To=/^sentry-/;function Eo(e){let t=Oo(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(To)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Do(e){if(e)return Ao(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function Oo(e){if(!(!e||!ia(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=ko(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):ko(e)}function ko(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 Ao(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?(F&&B.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const jo=/^o(\d+)\./,Mo=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function No(e){return e===`http`||e===`https`}function Po(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 Fo(e){let t=Mo.exec(e);if(!t){z(()=>{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 Io({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Io(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Lo(e){if(!F)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(B.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?No(r)?t&&isNaN(parseInt(t,10))?(B.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(B.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(B.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Ro(e){return e.match(jo)?.[1]}function zo(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Ro(n)),r}function Bo(e){let t=typeof e==`string`?Fo(e):Io(e);if(!(!t||!Lo(t)))return t}function Vo(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 Ho=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Uo(e){if(!e)return;let t=e.match(Ho);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 Wo(e,t){let n=Uo(e),r=Eo(t);if(!n?.traceId)return{traceId:to(),sampleRand:H()};let i=qo(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 Go(e=to(),t=no(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function Ko(e=to(),t=no(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function qo(e,t){let n=Vo(t?.sample_rand);if(n!==void 0)return n;let r=Vo(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?H()*r:r+H()*(1-r):H()}function Jo(e,t){let n=zo(e);return t&&n&&t!==n?(B.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)?(B.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 Yo=!1;function Xo(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:ns(e).parent_span_id,a=wo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||no():t,trace_id:n}}function Zo(e){let{traceId:t,spanId:n}=e.spanContext();return Go(t,n,as(e))}function Qo(e){let{traceId:t,spanId:n}=e.spanContext();return Ko(t,n,as(e))}function $o(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 es(e){return typeof e==`number`?ts(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ts(e.getTime()):Ya()}function ts(e){return e>9999999999?e/1e3:e}function ns(e){if(is(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(rs(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:es(i),timestamp:es(o)||void 0,status:os(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:$o(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function rs(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function is(e){return typeof e.getSpanJSON==`function`}function as(e){let{traceFlags:t}=e.spanContext();return t===1}function os(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function ss(e){return e._sentryRootSpan||e}function cs(){let e=W(R());return e.getActiveSpan?e.getActiveSpan():ao(G())}function ls(){Yo||=(z(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let us=!1;function ds(){if(us)return;function e(){let e=cs(),t=e&&ss(e);if(t){let e=`internal_error`;F&&B.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,us=!0,Yi(e),Qi(e)}function fs(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||q()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function ps(e){B.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ms(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(gs(n)){if(ja(e.description,n))return F&&ps(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?ja(e.description,n.name):!0,r=n.op?e.op&&ja(e.op,n.op):!0;if(t&&r)return F&&ps(e),!0}return!1}function hs(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 gs(e){return typeof e==`string`||e instanceof RegExp}const _s=`production`;function vs(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||_s,release:n.release,public_key:r,trace_id:e,org_id:zo(t)};return t.emit(`createDsc`,i),i}function ys(e,t){let n=t.getPropagationContext();return n.dsc||vs(n.traceId,e)}function bs(e){let t=q();if(!t)return{};let n=ss(e),r=ns(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&&Eo(l);if(u)return s(u);let d=vs(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),fs()&&(d.sampled=String(as(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??wo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function J(e,t=100,n=1/0){try{return Ss(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function xs(e,t=3,n=100*1024){let r=J(e,t);return Es(r)>n?xs(e,t-1,n):r}function Ss(e,t,n=1/0,r=1/0,i=Ds()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Cs(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 Ss(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=xa(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]=Ss(e,t,c-1,r,i),d++}return o(t),u}function Cs(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(pa(t))return Vi(t);if(fa(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Bi(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=ws(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function ws(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Ts(e){return~-encodeURI(e).split(/%..|./).length}function Es(e){return Ts(JSON.stringify(e))}function Ds(){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 Os(e,t=[]){return[e,t]}function ks(e,t){let[n,r]=e;return[n,[...r,t]]}function As(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 js(e,t){return As(e,(e,n)=>t.includes(n))}function Ms(e){let t=xi(I);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Ns(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Ms(r),e]:r.push(typeof e==`string`?Ms(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:Ps(r)}function Ps(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 Fs(e){let t=typeof e.data==`string`?Ms(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Is={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 Ls(e){return Is[e]}function Rs(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function zs(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:Po(r)},...i&&{trace:i}}}function Bs(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 Vs(e,t,n,r){let i=Rs(n);return Os({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Po(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Hs(e,t,n,r){let i=Rs(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Bs(e,n?.sdk);let o=zs(e,i,r,t);return delete e.sdkProcessingMetadata,Os(o,[[{type:a},e]])}const Us=`__SENTRY_SUPPRESS_TRACING__`,Ws=(e,t)=>{let n=W(R());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=q(),o=Eo(i);return a&&!Jo(a,o?.org_id)?qs(t):vo(e=>{let n=Wo(r,i);return e.setPropagationContext(n),io(e,void 0),t()})};function Gs(e,t){let n=Js();return n.withActiveSpan?n.withActiveSpan(e,t):vo(n=>(io(n,e||void 0),t(n)))}function Ks(e){let t=Js();return t.suppressTracing?t.suppressTracing(e):vo(t=>{t.setSDKProcessingMetadata({[Us]:!0});let n=e();return t.setSDKProcessingMetadata({[Us]:void 0}),n})}function qs(e){return vo(t=>(t.setPropagationContext({traceId:to(),sampleRand:H()}),F&&B.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),Gs(null,e)))}function Js(){return W(R())}function Ys(e){return new Zs(t=>{t(e)})}function Xs(e){return new Zs((t,n)=>{n(e)})}var Zs=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(da(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 Qs(e,t,n,r=0){try{let i=$s(t,n,e,r);return da(i)?i:Ys(i)}catch(e){return Xs(e)}}function $s(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return F&&a===null&&B.log(`Event processor "${i.id||`?`}" dropped event`),da(a)?a.then(e=>$s(e,t,n,r+1)):$s(a,t,n,r+1)}let ec,tc,nc,Y;function rc(e){let t=I._sentryDebugIds,n=I._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Y&&r.length===tc&&i.length===nc)return Y;tc=r.length,nc=i.length,Y={},ec||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=ec?.[r];if(i&&Y&&t)Y[i[0]]=t,ec&&(ec[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&&ec){Y[i]=t,ec[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Y}function ic(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;cc(e,t),r&&dc(e,r),fc(e,n),lc(e,i),uc(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;oc(e,`extra`,n),oc(e,`tags`,r),oc(e,`attributes`,i),oc(e,`user`,a),oc(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 oc(e,t,n){e[t]=eo(e[t],n,1)}function sc(e,t){let n=_o().getScopeData();return e&&ac(n,e.getScopeData()),t&&ac(n,t.getScopeData()),n}function cc(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 lc(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function uc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function dc(e,t){e.contexts={trace:Xo(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:bs(t),...e.sdkProcessingMetadata};let n=ns(ss(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function fc(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 pc(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||Ka()},l=n.integrations||e.integrations.map(e=>e.name);mc(c,e),_c(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&hc(c,e.stackParser);let u=yc(r,n.captureContext);n.mechanism&&za(c,n.mechanism);let d=i?i.getEventProcessors():[],f=sc(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),ic(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Ys(c):Qs(m,c,n)).then(e=>(e&&gc(e),typeof o==`number`&&o>0?vc(e,o,s):e))}function mc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||_s,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Oa(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Oa(e.value,a)})}function hc(e,t){let n=rc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function gc(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 _c(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function vc(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 yc(e,t){if(!t)return e;let n=e?e.clone():new oo;return n.update(t),n}function bc(e){if(e)return xc(e)||Cc(e)?{captureContext:e}:e}function xc(e){return e instanceof oo||typeof e==`function`}const Sc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Cc(e){return Object.keys(e).some(e=>Sc.includes(e))}function wc(e,t){return G().captureException(e,bc(t))}function Tc(e,t){K().setContext(e,t)}function Ec(e,t){K().setTag(e,t)}function Dc(e){K().setUser(e)}async function Oc(e){let t=q();return t?t.flush(e):(F&&B.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function kc(){let e=q();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Ac(e){let t=K(),{user:n}=sc(t,G()),{userAgent:r}=I.navigator||{},i=Xa({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&Za(a,{status:`exited`}),jc(),t.setSession(i),i}function jc(){let e=K(),t=G().getSession()||e.getSession();t&&Qa(t),Mc(),e.setSession()}function Mc(){let e=K(),t=q(),n=e.getSession();n&&t&&t.captureSession(n)}function Nc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Pc(e){return`${Nc(e)}${e.projectId}/envelope/`}function Fc(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 Ic(e,t,n){return t||`${Pc(e)}?${Fc(e,n)}`}const Lc=[];function Rc(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 zc(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 Rc(r)}function Bc(e,t){let n={};return t.forEach(t=>{t&&Hc(e,t,n)}),n}function Vc(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Hc(e,t,n){if(n[t.name]){F&&B.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Lc.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),Lc.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)}F&&B.log(`Integration installed: ${t.name}`)}function X(e){return e}function Uc(e,t){return t?vo(t,()=>{let n=cs(),r=n?Xo(n):bo(t);return[n?bs(n):ys(e,t),r]}):[void 0,void 0]}function Wc(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function Gc(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Po(r)),Os(i,[Wc(e)])}function Kc(e,t){let n=t??qc(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Gc(n,r._metadata,r.tunnel,e.getDsn());Jc().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function qc(e){return Jc().get(e)}function Jc(){return Si(`clientToLogBufferMap`,()=>new WeakMap)}function Yc(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function Xc(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Po(r)),Os(i,[Yc(e)])}function Zc(e,t){let n=t??Qc(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Xc(n,r._metadata,r.tunnel,e.getDsn());$c().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Qc(e){return $c().get(e)}function $c(){return Si(`clientToMetricBufferMap`,()=>new WeakMap)}function el(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const tl=Symbol.for(`SentryBufferFullError`);function nl(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Xs(tl);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Ys(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>el(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function rl(e,t=Da()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function il(e,t){return e[t]||e.all||0}function al(e,t,n=Da()){return il(e,t)>n}function ol(e,{statusCode:t,headers:n},r=Da()){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+rl(o,r):t===429&&(i.all=r+60*1e3);return i}function sl(e,t,n=nl(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(As(i,(t,n)=>{let i=Ls(n);al(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=Os(i[0],a),s=t=>{if(js(o,[`client_report`])){F&&B.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}As(o,(n,r)=>{e.recordDroppedEvent(t,Ls(r))})};return n.add(()=>t({body:Ns(o)}).then(e=>e.statusCode===413?(F&&B.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(F&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&B.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=ol(r,e),e),e=>{throw s(`network_error`),F&&B.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===tl)return F&&B.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function cl(e,t,n){let r=[{type:`client_report`},{timestamp:n||Ka(),discarded_events:e}];return Os(t?{dsn:t}:{},[r])}function ll(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 ul(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?.[xo],exclusive_time:o?.[So],measurements:e.measurements,is_segment:!0}}function dl(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&&{[xo]:e.profile_id},...e.exclusive_time&&{[So]:e.exclusive_time}}}},measurements:e.measurements}}const fl=`Not capturing exception because it's already been captured.`,pl=`Discarded session because of missing or non-string release`,ml=Symbol.for(`SentryInternalError`),hl=Symbol.for(`SentryDoNotSendEventError`);function gl(e){return{message:e,[ml]:!0}}function _l(e){return{message:e,[hl]:!0}}function vl(e){return!!e&&typeof e==`object`&&ml in e}function yl(e){return!!e&&typeof e==`object`&&hl in e}function bl(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=el(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var xl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=nl(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=Bo(e.dsn):F&&B.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Ic(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&&bl(this,`afterCaptureLog`,`flushLogs`,Ol,Kc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&bl(this,`afterCaptureMetric`,`flushMetrics`,Dl,Zc)}captureException(e,t,n){let r=U();if(Ua(e))return F&&B.log(fl),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=aa(e)?e:String(e),o=oa(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&&Ua(t.originalException))return F&&B.log(fl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Sl(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),Za(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){Kc(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];Hc(this,e,this._integrations),t||Vc(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Hs(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=ks(n,Fs(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=_s}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){F&&B.warn(pl);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){F&&B.warn(pl);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Vs(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}`;F&&B.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 F&&B.error(`Error while sending envelope:`,e),{}}return F&&B.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Bc(this,e),Vc(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)&&(Za(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),pc(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:bo(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ys(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=G(),r=K()){return F&&Tl(e)&&B.log(`Captured error event \`${ll(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{F&&(yl(e)?B.log(e.message):vl(e)?B.warn(e.message):B.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=El(e),s=Tl(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Vo(a);if(s&&typeof l==`number`&&H()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Xs(_l(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=Sl(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),_l("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:Cl(wl(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 _l(`${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 yl(e)||vl(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),gl(`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===tl&&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(){F&&B.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){F&&B.log(`No outcomes to send`);return}if(!this._dsn){F&&B.log(`No dsn provided, will not send outcomes`);return}F&&B.log(`Sending outcomes:`,e);let t=cl(e,this._options.tunnel&&Po(this._dsn));this.sendEnvelope(t)}};function Sl(e){return e===`replay_event`?`replay`:e||`error`}function Cl(e,t){let n=`${t} must return \`null\` or a valid event.`;if(da(e))return e.then(e=>{if(!sa(e)&&e!==null)throw gl(n);return e},e=>{throw gl(`${t} rejected with ${e}`)});if(!sa(e)&&e!==null)throw gl(n);return e}function wl(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(Tl(c)&&i)return i(c,r);if(El(c)){if(o||s){let t=ul(c);if(s?.length&&ms(t,s))return null;if(o){let e=o(t);e?c=eo(n,dl(e)):ls()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&ms(e,s)){hs(n,e);continue}if(o){let n=o(e);n?t.push(n):(ls(),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 Tl(e){return e.type===void 0}function El(e){return e.type===`transaction`}function Dl(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+kl(e.attributes)}function Ol(e){let t=0;return e.message&&(t+=e.message.length*2),t+kl(e.attributes)}function kl(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Al(e[0]):oa(e)?t+=Al(e):t+=100}),t}function Al(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function jl(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=Po(i)),t&&(a.trace=t),Os(a,[Ml(e)])}function Ml(e){return[{type:`check_in`},e]}function Nl(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 Pl(e,t){return e(t.stack||``,1)}function Fl(e){return ta(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Il(e){return Fl(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Ll(e,t){let n={type:t.name||t.constructor.name,value:Il(t)},r=Pl(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Rl(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function zl(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=wa(e);if(ra(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Bl(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Bl(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Vl(e,t,n,r){if(ta(n))return[n,void 0];if(t.synthetic=!0,sa(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:xs(n,t)},a=Rl(n);if(a)return[a,i];let o=zl(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 Hl(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Vl(e,i,n,r),s={exception:{values:[Ll(t,a)]}};return o&&(s.extra=o),Ra(s,void 0,void 0),za(s,i),{...s,event_id:r?.event_id}}function Ul(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Pl(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},za(a,{synthetic:!0}))}if(aa(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 Wl=class extends xl{constructor(e){ds(),Nl(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=Hl(this,this._options.stackParser,e,t);return n.level=`error`,Ys(n)}eventFromMessage(e,t=`info`,n){return Ys(Ul(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return Gl(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&Gl(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:U();if(!this._isEnabled())return F&&B.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]=Uc(this,n);l&&(s.contexts={trace:l});let u=jl(s,c,this.getSdkMetadata(),o,this.getDsn());return F&&B.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){F&&B.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=nl(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 Gl(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 Kl=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),ql=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function Jl(e,t){let n=String(e).toLowerCase();return Kl.has(n)?!1:ql.has(n)?!0:t?.strict?null:!!e}function Yl(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 Xl(e){return e.split(/[?#]/,1)[0]}function Zl(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Ql(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:L})),i.version=L)}function $l(e={}){let t=e.client||q();if(!kc()||!t)return{};let n=W(R());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||G(),i=e.span||cs(),a=i?Zo(i):eu(r),o=Do(i?bs(i):ys(t,r));if(!Ho.test(a))return B.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?Qo(i):tu(r)),s}function eu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Go(t,r,n)}function tu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ko(t,r,n)}const nu=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function ru(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return F&&!r&&B.log(nu,e),r;let i=Ma(e,t);return n?.set(e,i),F&&!i&&B.log(nu,e),i}function iu(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=ou({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:su(i),headers:iu(t),cookies:s,data:o}}function ou({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function su(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function cu(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:Ka(),...e},s=i?z(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let lu;const uu=new WeakMap,du=X((()=>({name:`FunctionToString`,setupOnce(){lu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=ba(this),n=uu.has(q())&&t!==void 0?t:this;return lu.apply(n,e)}}catch{}},setup(e){uu.set(e,!0)}}))),fu=[/^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$/],pu=X((e={})=>{let t;return{name:`EventFilters`,setup(n){t=mu(e,n.getOptions())},processEvent(n,r,i){return t||=mu(e,i.getOptions()),hu(n,t)?null:n}}});function mu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:fu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function hu(e,t){if(e.type){if(e.type===`transaction`&&_u(e,t.ignoreTransactions))return F&&B.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${La(e)}`),!0}else{if(gu(e,t.ignoreErrors))return F&&B.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${La(e)}`),!0;if(Su(e))return F&&B.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${La(e)}`),!0;if(vu(e,t.denyUrls))return F&&B.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${La(e)}.\nUrl: ${xu(e)}`),!0;if(!yu(e,t.allowUrls))return F&&B.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${La(e)}.\nUrl: ${xu(e)}`),!0}return!1}function gu(e,t){return t?.length?ll(e).some(e=>Ma(e,t)):!1}function _u(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Ma(n,t):!1}function vu(e,t){if(!t?.length)return!1;let n=xu(e);return n?Ma(n,t):!1}function yu(e,t){if(!t?.length)return!0;let n=xu(e);return n?Ma(n,t):!0}function bu(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 xu(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?bu(t):null}catch{return F&&B.error(`Cannot extract url for event ${La(e)}`),null}}function Su(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Cu(e,t,n,r,i,a){if(!i.exception?.values||!a||!V(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=wu(e,t,r,a.originalException,n,i.exception.values,o,0))}function wu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(V(r[i],Error)){Eu(o,s,r);let a=e(t,r[i]),l=c.length;Du(a,i,l,s),c=wu(e,t,n,r[i],i,[a,...c],a,l)}return Tu(r)&&r.errors.forEach((a,l)=>{if(V(a,Error)){Eu(o,s,r);let u=e(t,a),d=c.length;Du(u,`errors[${l}]`,d,s),c=wu(e,t,n,a,i,[u,...c],u,d)}}),c}function Tu(e){return Array.isArray(e.errors)}function Eu(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...Tu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Du(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const Ou=X(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){Cu(Ll,i.getOptions().stackParser,n,t,e,r)}}}));function ku(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 Au=[`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 ju(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Au.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Mu(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Nu(e))||null}function Mu(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Nu(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 Pu={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Fu=X(((e={})=>{let t={...Pu,...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&&Iu(e,a,{ipAddress:o},s),e}}}));function Iu(e,t,n,r){if(e.request={...e.request,...Lu(t,r)},r.ip){let r=t.headers&&ju(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Lu(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||Au.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?ku(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Ru(e){let t=`console`;Gi(t,e),Ki(t,zu)}function zu(){`console`in I&&Ci.forEach(function(e){e in I.console&&_a(I.console,e,function(t){return wi[e]=t,function(...t){qi(`console`,{args:t,level:e}),wi[e]?.apply(I.console,t)}})})}function Bu(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const Vu=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Hu(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Vu.exec(t);return n?n.slice(1):[]}function Uu(e){let t=Hu(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const Wu=X((e={})=>{let t=new Set(e.levels||Ci);return{name:`Console`,setup(e){Ru(({args:n,level:r})=>{q()!==e||!t.has(r)||Gu(r,n)})}}});function Gu(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Bu(e),message:Ku(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Ku(e)}`:`Assertion failed`,n.data.arguments=e}else return;cu(n,{input:t,level:e})}function Ku(e){return`util`in I&&typeof I.util.format==`function`?I.util.format(...e):Aa(e,` `)}function qu(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function Ju(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 Yu(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=Hi(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?Qu(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:Zu(o[3]),colno:Zu(o[4]),in_app:Ju(s||``,c)}}if(i.match(t))return{filename:i}}}function Xu(e){return[90,Yu(e)]}function Zu(e){return parseInt(e||``,10)||void 0}function Qu(e){try{return decodeURI(e)}catch{return}}var $u=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 ed=class extends Wl{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||y.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};Ql(n,`node-light`,[`node-core`]),B.log(`Initializing Sentry: process: ${process.pid}, thread: ${Be?`main`:`worker-${Ve}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Kc(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&&B.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const td=X((e={})=>({name:`ChildProcess`,setup(){He.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&nd(t.process,e)}),He.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&rd(t.worker,e)})}}));function nd(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&&cu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,cu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function rd(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?cu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):wc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const id=be(Ke),ad=be(Je),od=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=sd(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 cd()),n.app&&(e.app=ud()),n.device&&(e.device=dd(n.device)),n.culture){let t=ld();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=vd()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function sd(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=y.freemem()),e}async function cd(){let e=y.platform();switch(e){case`darwin`:return hd();case`linux`:return _d();default:return{name:fd[e]||e,version:y.release()}}}function ld(){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 ud(){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 dd(e){let t={},n;try{n=y.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=y.arch(),(e===!0||e.memory)&&(t.memory_size=y.totalmem(),t.free_memory=y.freemem()),e===!0||e.cpu){let e=y.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const fd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},pd=[{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`]}],md={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 hd(){let e={kernel_version:y.release(),name:`Mac OS X`,version:`10.${Number(y.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Me(`/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 gd(e){return e.split(` `)[0].toLowerCase()}async function _d(){let e={kernel_version:y.release(),name:`Linux`};try{let t=await ad(`/etc`),n=pd.find(e=>t.includes(e.name));if(!n)return e;let r=(await id(Oe(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(gd(e))>=0)||i[0],e.version=md[gd(e.name)]?.(r)}catch{}return e}function vd(){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 yd=new $u(10),bd=new $u(20);function xd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function Sd(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function Cd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function wd(e,t){let n=yd.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 Td(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=Nd(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=Nd(r,t)),n++}return a}function Ed(e,t,n){return new Promise((r,i)=>{let a=We(e),o=Fe({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){bd.set(e,1),Z&&B.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]=ka(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 Dd(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`||Sd(i)||Cd(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(bd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=Td(r,t);if(a.every(t=>wd(e,t)))continue;let o=xd(yd,e,{});i.push(Ed(e,a,o))}if(await Promise.all(i).catch(()=>{Z&&B.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&&Od(n.stacktrace.frames,t,yd);return e}function Od(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;Ad(r.lineno,r,t,e)}}function kd(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Ad(e,t,n,r){if(t.lineno===void 0||r===void 0){Z&&B.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=jd(e,n);i<e;i++){let e=r[i];if(e===void 0){kd(t),Z&&B.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){kd(t),Z&&B.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=Md(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 jd(e,t){return Math.max(1,e-t)}function Md(e,t){return e+t}function Nd(e,t){return[jd(e,t),Md(e,t)]}const Pd=X(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return Dd(e,t)}}})),Fd=Ha(process.versions.node),Id=Fd.major;Fd.minor;let Ld;async function Rd(){if(Ld===void 0)try{Ld=!!(await import(`node:inspector`)).url()}catch{Ld=!1}return Ld}const zd=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Bd(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 Vd(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function Hd(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Vd(e)&&Vd(t)}function Ud(...e){B.log(`[LocalVariables]`,...e)}const Wd=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||!Hd(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&zd in n.originalException&&Array.isArray(n.originalException[zd])){for(let r of e.exception?.values||[])t(r,n.originalException[zd]);n.originalException[zd]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new Ye(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=>{Ud(`Worker error`,e)}),t.once(`exit`,e=>{Ud(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await Rd()){B.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:B.isEnabled()};r().then(()=>{try{i(n)}catch(e){B.error(`Failed to start worker`,e)}},e=>{B.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function Gd(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function Kd(e,t){if(t!==void 0)return Gd(e(t,1))}function qd(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 Jd=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}=qd(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 Yd=X(((e={},t)=>{let n=new $u(20),r,i=!1;function a(t){let r=Gd(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||!Hd(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(Id<18){B.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Rd()){B.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Jd.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=Kd(e,i.description);if(c==null){s();return}let{add:l,next:u}=qd(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=Bd(e.maxExceptionsPerSecond||50,()=>{B.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{B.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){B.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]}}})),Xd=(e={})=>Fd.major<19?Yd(e):Wd(e);function Zd(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let Qd;const $d=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,ef=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...af()},e},getModules:af}));function tf(){try{return fe.cache?Object.keys(fe.cache):[]}catch{return[]}}function nf(){return{...$d,...sf(),...Zd()?rf():{}}}function rf(){let e=fe.main?.paths||[],t=tf(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=De(t),!i||t===i||r.has(t))return;if(e.indexOf(i)<0)return a();let o=Oe(t,`package.json`);if(r.add(t),!Ge(o))return a();try{let e=JSON.parse(qe(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function af(){return Qd||=nf(),Qd}function of(){try{let e=Oe(process.cwd(),`package.json`);return JSON.parse(qe(e,`utf8`))}catch{return{}}}function sf(){let e=of();return{...e.dependencies,...e.devDependencies}}function cf(e){z(()=>{console.error(e)});let t=q();if(t===void 0){Z&&B.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&&B.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Z&&B.error(e)})}const lf=X((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){Be&&global.process.on(`uncaughtException`,uf(e,t))}}});function uf(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=cf;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&&B.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),cf(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,q()===e&&wc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const df=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],ff=X(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...df,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,gf(e,t))}}}));function pf(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 mf(e,t){let n=e.name===void 0||ja(t.name,e.name,!0),r=e.message===void 0||ja(t.message,e.message);return n&&r}function hf(e,t){let n=pf(t);return e.some(e=>mf(e,n))}function gf(e,t){return function(n,r){if(q()!==e||hf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>Gs(a,e):e=>e())(()=>{wc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),_f(n,t.mode)}}function _f(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`?z(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(z(()=>{console.warn(n)}),cf(e))}const vf=X(()=>({name:`ProcessSession`,setupOnce(){Ac(),process.on(`beforeExit`,()=>{K().getSession()?.status!==`ok`&&jc()})}})),yf=`Spotlight`,bf=X(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:yf,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&B.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}xf(e,t)}}}));function xf(e,t){let n=Sf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){B.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=Ns(e);Ks(()=>{let e=Ie.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++,B.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Sf(e){try{return new URL(`${e}`)}catch{B.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function Cf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:ve.getSystemErrorMap().has(e.errno)}const wf=X((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!Cf(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 Tf(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function Ef(e=process.argv[1]?Uu(process.argv[1]):process.cwd(),t=Ae===`\\`){let n=t?Tf(e):e;return e=>{if(!e)return;let r=t?Tf(e):e,{dir:i,base:a,ext:o}=ke.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 Df(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(I.SENTRY_RELEASE?.id)return I.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 Of=Fi(Xu(Ef())),$=Symbol(`AgentBaseInternalState`);var kf=class extends Ie.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(`
167
+ `).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 Ie.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 Af(...e){B.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function jf(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(),Af(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),Af(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
164
168
  \r
165
- `);if(l===-1){Ef(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
166
- `),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}Ef(`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 Of(...e){B.log(`[https-proxy-agent]`,...e)}var kf=class extends Tf{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??{},Of(`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?jf(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:`){Of("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=$e.connect({...this.connectOpts,servername:e&&Qe.isIP(e)?void 0:e})}else Of("Creating `net.Socket`: %o",this.connectOpts),r=Qe.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=Qe.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=Df(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`,Af),t.secureEndpoint){Of(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return $e.connect({...jf(t,`host`,`path`,`port`),socket:r,servername:Qe.isIP(e)?void 0:e})}return r}r.destroy();let u=new Qe.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Of(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};kf.__initStatic();function Af(e){e.resume()}function jf(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function Mf(e){return new Pe({read(){this.push(e),this.push(null)}})}function Nf(e){let t;try{t=new URL(e.url)}catch{return z(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),rl(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=Pf(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?Xe:Ie,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new kf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return rl(e,Ff(e,e.httpModule??i,o))}function Pf(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function Ff(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)=>{Hs(()=>{let d=Mf(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(Ze()));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 If(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=Wl(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 Lf(){let e=new et;function t(){return e.getStore()||{scope:ro(),isolationScope:io()}}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()))}fo({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function Rf(e,t,n,r){let i=0,a=[];Z&&B.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&&B.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&&B.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Z&&B.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&&B.error(r,`Error building captured request body`,e)}})}catch(e){Z&&B.error(r,`Error patching request to capture body`,e)}}function zf(e,t){if(!e)return t;let n=wo(e),r=wo(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Eo(i)}const Bf=`@sentry/instrumentation-http`;function Vf(e,t){let n=Uf(e),r=t?.statusCode,i=Uu(r);iu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Hf(e,t){let n=Gf(e),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=$l(n,r,t)?Yl({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&&B.log(Bf,`Added sentry-trace header to outgoing request`)}catch(e){Z&&B.error(Bf,`Failed to add sentry-trace header to outgoing request:`,Zi(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Z&&B.log(Bf,`Added traceparent header to outgoing request`)}catch(e){Z&&B.error(Bf,`Failed to add traceparent header to outgoing request:`,Zi(e)?e.message:`Unknown error`)}if(s){let t=zf(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Z&&B.log(Bf,`Added baggage header to outgoing request`)}catch(e){Z&&B.error(Bf,`Failed to add baggage header to outgoing request:`,Zi(e)?e.message:`Unknown error`)}}}function Uf(e){try{let t=e.getHeader(`host`)||e.host,n=Gl(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:ql(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 Wf(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Gf(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const Kf=`Http`,qf=new WeakSet,Jf=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Yu(100),r=new WeakMap;return{name:Kf,setupOnce(){Ue(`http.server.request.start`,(e=>{Yf(e.server,t)})),Ue(`http.client.request.created`,(e=>{Xf(e.request,t,n,r)})),Ue(`http.client.response.finish`,(e=>{let n=e;Zf(n.request,n.response,t,r)})),Ue(`http.client.request.error`,(e=>{Zf(e.request,void 0,t,r)}))}}});function Yf(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(qf.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!G().getClient())return e.apply(r,i);Z&&B.log(Kf,`Handling incoming request`);let a=K().clone(),o=i[1],s=tu(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&Rf(o,a,n,Kf),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${Kl(l)}`;return a.setTransactionName(u),ho(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return Bs({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(G().getPropagationContext().propagationSpanId=Qa(),e.apply(r,i)))})}});qf.add(i),e.emit=i}function Xf(e,t,n,r){let i=Qf(e,t);r.set(e,i),!i&&Hf(e,n)}function Zf(e,t,n,r){n.breadcrumbs&&((r.get(e)??Qf(e,n))||Vf(e,t))}function Qf(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}`,Wf(e)):!1}const $f=`sentry-trace`,ep=`baggage`,tp=/baggage: (.*)\r\n/;function np(e,t){let n=ap(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=$l(n,r,t)?Yl({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($f)&&t.push($f,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===ep);if(s&&n===-1)t.push(ep,s);else if(s){let e=t[n+1],r=zf(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${$f}:`)&&(e.headers+=`${$f}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(tp)?.[1];if(s&&!n)e.headers+=`${ep}: ${s}\r\n`;else if(s){let t=zf(n,s);t&&(e.headers=e.headers.replace(tp,`baggage: ${t}\r\n`))}}}function rp(e,t){let n=ip(e),r=t.statusCode,i=Uu(r);iu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function ip(e){try{let t=Gl(ap(e.origin,e.path)),n={url:ql(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 ap(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 op=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Yu(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){Ue(`undici:request:create`,(e=>{sp(e.request,t,n,r)})),Ue(`undici:request:headers`,(e=>{let n=e;cp(n.request,n.response,t,r)}))}}});function sp(e,t,n,r){let i=lp(e,t);r.set(e,i),!i&&np(e,n)}function cp(e,t,n,r){n.breadcrumbs&&(r.get(e)||rp(e,t))}function lp(e,t){if(G().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(ap(e.origin,e.path)):!1}function up(){return[lu(),su(),wu(),ju(),bf(),Bu(),Jf(),op(),af(),cf(),Ad(),Kd(),nd(),Zu(),mf(),Xd()]}function dp(e={}){return fp(e,up)}function fp(e={},t){let n=pp(e,t);n.debug===!0&&(Z?B.enable():z(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Lf(),G().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===hf)&&n.integrations.push(gf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Jl(n,`node-light`,[`node-core`]);let r=new Xu(n);return G().setClient(r),r.init(),B.log(`SDK initialized from ${qd()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),gp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function pp(e,t){let n=mp(e.release),r=If(e.spotlight),i=hp(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??Nf,stackParser:Mi(e.stackParser||wf),release:n,tracesSampleRate:i,spotlight:r,debug:Wl(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:Fc({defaultIntegrations:s,integrations:o})}}function mp(e){if(e!==void 0)return e;let t=Cf();if(t!==void 0)return t}function hp(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(Wl(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Bo(e,t);G().setPropagationContext(n)}}function _p(){return S.PRISMIC_SENTRY_ENABLED??S.PROD}function vp(){if(S.PRISMIC_SENTRY_ENVIRONMENT)return S.PRISMIC_SENTRY_ENVIRONMENT;let e=nt.match(/-(.+?)\./);return e?e[1]:`production`}function yp(){try{if(!_p())return;dp({dsn:S.PRISMIC_SENTRY_DSN,release:nt,environment:vp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),xc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function bp(e){try{if(!_p())return;bc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await wc()}catch{}}const xp=Cc,Sp=Sc,Cp=xc,wp=[`login`,`logout`,`whoami`,`sync`],Tp=[`login`,`logout`],Ep=E({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,commands:{init:{handler:cn,description:`Initialize a Prismic project`},gen:{handler:Tt,description:`Generate files from local models`},sync:{handler:en,description:`Sync types and slices from Prismic`},locale:{handler:vn,description:`Manage locales`},repo:{handler:Jr,description:`Manage repositories`},"custom-type":{handler:En,description:`Manage custom types`},field:{handler:Xn,description:`Manage fields`},"page-type":{handler:tr,description:`Manage page types`},slice:{handler:ri,description:`Manage slices`},preview:{handler:mr,description:`Manage preview configurations`},token:{handler:si,description:`Manage API tokens`},webhook:{handler:hi,description:`Manage webhooks`},login:{handler:yn,description:`Log in to Prismic`},logout:{handler:xn,description:`Log out of Prismic`},whoami:{handler:gi,description:`Show the currently logged in user`}}});await Dp();async function Dp(){let{positionals:[e],values:{version:t,help:n,repo:r=await ne()}}=ye({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(nt);return}if(typeof r!=`string`&&(r=``),!n){yp(),await Ht(),r&&(Kt(r),Sp(`repository`,r),Cp(`Repository Data`,{name:r}));try{Sp(`framework`,(await se()).id)}catch{}e&&!Tp.includes(e)&&ft().then(async e=>{if(!e)return;let t=await yt({token:e,host:await w()});Gt({shortId:t.shortId,intercomHash:t.intercomHash}),xp({id:t.shortId})}).catch(()=>{}),e&&!wp.includes(e)&&Ut(e)}try{await Ep(),e&&!wp.includes(e)&&Wt(e)}catch(t){if(process.exitCode=1,wp.includes(e)||Wt(e,{error:t}),t instanceof D||t instanceof pe){console.error(t.message);return}if(t instanceof ot||t instanceof at){console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof he){console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof re){console.error(`${t.message} Run \`prismic init\` to create a config.`);return}throw await bp(t),t}}export{};
169
+ `);if(l===-1){Af(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
170
+ `),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}Af(`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 Mf(...e){B.log(`[https-proxy-agent]`,...e)}var Nf=class extends kf{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??{},Mf(`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?Ff(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:`){Mf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=$e.connect({...this.connectOpts,servername:e&&Qe.isIP(e)?void 0:e})}else Mf("Creating `net.Socket`: %o",this.connectOpts),r=Qe.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=Qe.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=jf(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`,Pf),t.secureEndpoint){Mf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return $e.connect({...Ff(t,`host`,`path`,`port`),socket:r,servername:Qe.isIP(e)?void 0:e})}return r}r.destroy();let u=new Qe.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Mf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Nf.__initStatic();function Pf(e){e.resume()}function Ff(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function If(e){return new Pe({read(){this.push(e),this.push(null)}})}function Lf(e){let t;try{t=new URL(e.url)}catch{return z(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),sl(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=Rf(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?Xe:Ie,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Nf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return sl(e,zf(e,e.httpModule??i,o))}function Rf(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function zf(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)=>{Ks(()=>{let d=If(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(Ze()));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 Bf(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=Jl(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 Vf(){let e=new et;function t(){return e.getStore()||{scope:so(),isolationScope:co()}}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()))}go({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function Hf(e,t,n,r){let i=0,a=[];Z&&B.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&&B.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&&B.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Z&&B.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&&B.error(r,`Error building captured request body`,e)}})}catch(e){Z&&B.error(r,`Error patching request to capture body`,e)}}function Uf(e,t){if(!e)return t;let n=Oo(e),r=Oo(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Ao(i)}const Wf=`@sentry/instrumentation-http`;function Gf(e,t){let n=qf(e),r=t?.statusCode,i=qu(r);cu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Kf(e,t){let n=Yf(e),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=ru(n,r,t)?$l({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&&B.log(Wf,`Added sentry-trace header to outgoing request`)}catch(e){Z&&B.error(Wf,`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&&B.log(Wf,`Added traceparent header to outgoing request`)}catch(e){Z&&B.error(Wf,`Failed to add traceparent header to outgoing request:`,ta(e)?e.message:`Unknown error`)}if(s){let t=Uf(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Z&&B.log(Wf,`Added baggage header to outgoing request`)}catch(e){Z&&B.error(Wf,`Failed to add baggage header to outgoing request:`,ta(e)?e.message:`Unknown error`)}}}function qf(e){try{let t=e.getHeader(`host`)||e.host,n=Yl(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Zl(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 Jf(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Yf(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const Xf=`Http`,Zf=new WeakSet,Qf=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new $u(100),r=new WeakMap;return{name:Xf,setupOnce(){Ue(`http.server.request.start`,(e=>{$f(e.server,t)})),Ue(`http.client.request.created`,(e=>{ep(e.request,t,n,r)})),Ue(`http.client.response.finish`,(e=>{let n=e;tp(n.request,n.response,t,r)})),Ue(`http.client.request.error`,(e=>{tp(e.request,void 0,t,r)}))}}});function $f(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(Zf.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!G().getClient())return e.apply(r,i);Z&&B.log(Xf,`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)&&Hf(o,a,n,Xf),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${Xl(l)}`;return a.setTransactionName(u),yo(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return Ws({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(G().getPropagationContext().propagationSpanId=no(),e.apply(r,i)))})}});Zf.add(i),e.emit=i}function ep(e,t,n,r){let i=np(e,t);r.set(e,i),!i&&Kf(e,n)}function tp(e,t,n,r){n.breadcrumbs&&((r.get(e)??np(e,n))||Gf(e,t))}function np(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}`,Jf(e)):!1}const rp=`sentry-trace`,ip=`baggage`,ap=/baggage: (.*)\r\n/;function op(e,t){let n=lp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=ru(n,r,t)?$l({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(rp)&&t.push(rp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===ip);if(s&&n===-1)t.push(ip,s);else if(s){let e=t[n+1],r=Uf(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${rp}:`)&&(e.headers+=`${rp}: ${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+=`${ip}: ${s}\r\n`;else if(s){let t=Uf(n,s);t&&(e.headers=e.headers.replace(ap,`baggage: ${t}\r\n`))}}}function sp(e,t){let n=cp(e),r=t.statusCode,i=qu(r);cu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function cp(e){try{let t=Yl(lp(e.origin,e.path)),n={url:Zl(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 lp(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 up=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new $u(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){Ue(`undici:request:create`,(e=>{dp(e.request,t,n,r)})),Ue(`undici:request:headers`,(e=>{let n=e;fp(n.request,n.response,t,r)}))}}});function dp(e,t,n,r){let i=pp(e,t);r.set(e,i),!i&&op(e,n)}function fp(e,t,n,r){n.breadcrumbs&&(r.get(e)||sp(e,t))}function pp(e,t){if(G().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(lp(e.origin,e.path)):!1}function mp(){return[pu(),du(),Ou(),Fu(),wf(),Wu(),Qf(),up(),lf(),ff(),Pd(),Xd(),od(),td(),vf(),ef()]}function hp(e={}){return gp(e,mp)}function gp(e={},t){let n=_p(e,t);n.debug===!0&&(Z?B.enable():z(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Vf(),G().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===yf)&&n.integrations.push(bf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Ql(n,`node-light`,[`node-core`]);let r=new ed(n);return G().setClient(r),r.init(),B.log(`SDK initialized from ${Zd()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),bp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function _p(e,t){let n=vp(e.release),r=Bf(e.spotlight),i=yp(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??Lf,stackParser:Ii(e.stackParser||Of),release:n,tracesSampleRate:i,spotlight:r,debug:Jl(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:zc({defaultIntegrations:s,integrations:o})}}function vp(e){if(e!==void 0)return e;let t=Df();if(t!==void 0)return t}function yp(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 bp(){if(Jl(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Wo(e,t);G().setPropagationContext(n)}}function xp(){return S.PRISMIC_SENTRY_ENABLED??S.PROD}function Sp(){if(S.PRISMIC_SENTRY_ENVIRONMENT)return S.PRISMIC_SENTRY_ENVIRONMENT;let e=nt.match(/-(.+?)\./);return e?e[1]:`production`}function Cp(){try{if(!xp())return;hp({dsn:S.PRISMIC_SENTRY_DSN,release:nt,environment:Sp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),Tc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function wp(e){try{if(!xp())return;wc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await Oc()}catch{}}const Tp=Dc,Ep=Ec,Dp=Tc,Op=[`login`,`logout`,`whoami`,`sync`],kp=[`login`,`logout`],Ap=E({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,commands:{init:{handler:cn,description:`Initialize a Prismic project`},gen:{handler:Tt,description:`Generate files from local models`},sync:{handler:en,description:`Sync types and slices from Prismic`},locale:{handler:vn,description:`Manage locales`},repo:{handler:Qr,description:`Manage repositories`},"custom-type":{handler:En,description:`Manage custom types`},field:{handler:er,description:`Manage fields`},"page-type":{handler:ar,description:`Manage page types`},slice:{handler:si,description:`Manage slices`},preview:{handler:vr,description:`Manage preview configurations`},token:{handler:di,description:`Manage API tokens`},webhook:{handler:yi,description:`Manage webhooks`},login:{handler:yn,description:`Log in to Prismic`},logout:{handler:xn,description:`Log out of Prismic`},whoami:{handler:bi,description:`Show the currently logged in user`}}});await jp();async function jp(){let{positionals:[e],values:{version:t,help:n,repo:r=await ne()}}=ye({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(nt);return}if(typeof r!=`string`&&(r=``),!n){Cp(),await Ht(),r&&(Kt(r),Ep(`repository`,r),Dp(`Repository Data`,{name:r}));try{Ep(`framework`,(await se()).id)}catch{}e&&!kp.includes(e)&&ft().then(async e=>{if(!e)return;let t=await yt({token:e,host:await w()});Gt({shortId:t.shortId,intercomHash:t.intercomHash}),Tp({id:t.shortId})}).catch(()=>{}),e&&!Op.includes(e)&&Ut(e)}try{await Ap(),e&&!Op.includes(e)&&Wt(e)}catch(t){if(process.exitCode=1,Op.includes(e)||Wt(e,{error:t}),t instanceof D||t instanceof pe){console.error(t.message);return}if(t instanceof ot||t instanceof at){console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof he){console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof re){console.error(`${t.message} Run \`prismic init\` to create a config.`);return}throw await wp(t),t}}export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismic",
3
- "version": "1.3.0-pr.83.8a0d09f",
3
+ "version": "1.3.0-pr.83.cb98dcb",
4
4
  "description": "Prismic's official command line tool",
5
5
  "keywords": [
6
6
  "prismic",