prismic 1.7.2 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-hgWfYVlQ.mjs +1 -0
- package/dist/{builders-hKD4IrLX-BqINnD6K.mjs → builders-hKD4IrLX-OKUYHMsz.mjs} +1 -1
- package/dist/core-DvI8OCsA.mjs +173 -0
- package/dist/index.mjs +55 -55
- package/dist/{nextjs-Cu_nlHvI.mjs → nextjs-qunlKbpH.mjs} +48 -48
- package/dist/nuxt-SaF4IAMg.mjs +90 -0
- package/dist/package-C8ZHSYR2.mjs +1 -0
- package/dist/{segment-BUye5-zL.mjs → segment-CusldEBw.mjs} +1 -1
- package/dist/subprocesses/refreshToken.mjs +1 -1
- package/dist/subprocesses/sendSegmentEvents.mjs +1 -1
- package/dist/subprocesses/updateVersionState.mjs +1 -1
- package/dist/{sveltekit-Bd2ybfqb.mjs → sveltekit-CiHFqDi2.mjs} +33 -33
- package/dist/{update-notifier-Co6-YCDF.mjs → update-notifier-CG7Szvo5.mjs} +1 -1
- package/package.json +1 -1
- package/dist/auth-ZyLmjkK2.mjs +0 -1
- package/dist/env-7YOoWh9b.mjs +0 -1
- package/dist/nuxt-noEyCWYu.mjs +0 -90
- package/dist/package-fv3JT9Fa.mjs +0 -1
- package/dist/string-suKEaYgy.mjs +0 -173
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{A as e,C as t,E as n,F as r,M as i,N as a,O as o,S as s,T as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,j as _,k as v,m as y,n as b,o as x,p as S,r as ee,s as C,t as te,u as ne,v as re,w as ie,x as ae}from"./core-DvI8OCsA.mjs";import{n as oe,t as se}from"./package-C8ZHSYR2.mjs";import{C as ce,D as le,M as ue,O as w,S as de,T as fe,_ as pe,a as T,f as me,i as E,l as he,m as ge,n as D,o as O,p as _e,r as ve,s as ye,t as be,u as xe,v as Se,w as k,x as Ce,y as we}from"./request-BX9m6W7p.mjs";import{a as Te,s as Ee}from"./packageJson-XOWTfdbI.mjs";import{a as De,c as Oe,d as ke,i as A,l as Ae,n as je,r as j,s as Me,t as Ne}from"./auth-hgWfYVlQ.mjs";import{i as Pe,r as Fe,t as Ie}from"./segment-CusldEBw.mjs";import{t as Le}from"./update-notifier-CG7Szvo5.mjs";import*as Re from"node:util";import{parseArgs as ze,promisify as Be}from"node:util";import{realpath as Ve}from"node:fs/promises";import{fileURLToPath as He,pathToFileURL as Ue}from"node:url";import{createHash as We}from"node:crypto";import{dirname as Ge,join as Ke,posix as qe,sep as Je}from"node:path";import{exec as Ye,execFile as Xe}from"node:child_process";import{Readable as Ze}from"node:stream";import{createInterface as Qe}from"node:readline";import*as $e from"node:http";import*as M from"node:os";import{homedir as et}from"node:os";import{setTimeout as tt}from"node:timers/promises";import{isMainThread as nt,threadId as rt}from"worker_threads";import*as it from"node:diagnostics_channel";import{subscribe as at}from"node:diagnostics_channel";import{createReadStream as ot,existsSync as st,readFile as ct,readFileSync as lt,readdir as ut}from"node:fs";import{Worker as dt}from"node:worker_threads";import*as ft from"node:https";import{createGzip as pt}from"node:zlib";import*as mt from"node:net";import*as ht from"node:tls";import{AsyncLocalStorage as gt}from"node:async_hooks";function N(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=ze({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(_t(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new F(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new F(`Missing required option: --${e}`);await t(s)}}function _t(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[C(t)];o.push(``),o.push(`USAGE`);let s=` ${e.name}`;if(a.length>0&&(s+=` `+a.map(e=>`<${e}>`).join(` `)),s+=` [options]`,o.push(s),a.length>0){o.push(``),o.push(`ARGUMENTS`);let e=[];for(let t in r){let n=r[t],i=n.description+(n.required?` (required)`:``);e.push([` <${t}>`,i])}o.push(d(e))}o.push(``),o.push(`OPTIONS`);let c=[];if(i){let e=Object.keys(i);for(let t of e){let e=i[t],n=`${e.short?`-${e.short}, `:` `}--${t}${e.type===`string`?` string`:``}`,r=e.description+(e.required?` (required)`:``);c.push({left:n,description:r})}}c.push({left:`-h, --help`,description:`Show help for command`});let l=c.map(e=>[` ${e.left}`,e.description]);if(o.push(d(l)),n)for(let e in n){let t=C(n[e]);o.push(``),o.push(e);for(let e of t.split(`
|
|
3
3
|
`))o.push(e?` ${e}`:``)}o.push(``),o.push(`LEARN MORE`);let u=e.name.split(` `)[0];return o.push(` Use \`${u} <command> --help\` for more information about a command.`),o.join(`
|
|
4
|
-
`)}function
|
|
4
|
+
`)}function P(e){let t=e.name.split(` `).length;return async function(){let{positionals:[n]}=ze({args:process.argv.slice(1+t),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1}),r=n?e.commands[n]:void 0;if(r){await r.handler();return}if(n)throw new F(`Unknown command: ${n}`);console.info(vt(e))}}function vt(e){let{name:t,description:n,sections:r,commands:i}=e,a=[n];a.push(``),a.push(`USAGE`),a.push(` ${t} <command> [options]`),a.push(``),a.push(`COMMANDS`);let o=Object.entries(i).map(([e,t])=>[` ${e}`,t.description]);if(a.push(d(o)),a.push(``),a.push(`OPTIONS`),a.push(` -h, --help Show help for command`),r)for(let e in r){let t=C(r[e]);a.push(``),a.push(e);for(let e of t.split(`
|
|
5
5
|
`))a.push(e?` ${e}`:``)}return a.push(``),a.push(`LEARN MORE`),a.push(` Use \`${t} <command> --help\` for more information about a command.`),a.join(`
|
|
6
|
-
`)}var
|
|
6
|
+
`)}var F=class extends Error{name=`CommandError`};const yt=k({path:w(),title:w(),description:fe(w())}),bt=k({path:w(),title:w(),description:fe(w()),anchors:pe(k({slug:w(),excerpt:w()}))});async function xt(){return await T(new URL(`api/index/`,wt()),{schema:pe(yt)})}async function St(e){let t=new URL(`api/index/${e}`,wt());try{return await T(t,{schema:bt})}catch(t){throw t instanceof D&&(t.message=`Documentation page not found: ${e}`),t}}async function Ct(e){let t=new URL(e,wt());try{return await T(t,{headers:{Accept:`text/markdown`},schema:w()})}catch(t){throw t instanceof D&&(t.message=`Page not found: ${e}`),t}}function wt(){let e=ke.PRISMIC_DOCS_HOST??Ae;return new URL(`https://${e}/docs/`)}var Tt=N({name:`prismic docs list`,description:`
|
|
7
7
|
List available documentation pages.
|
|
8
8
|
|
|
9
9
|
With a path argument, list the anchors within that page.
|
|
10
|
-
`,positionals:{path:{description:`Documentation path to list anchors for`,required:!1}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t;if(n){let e;try{e=await
|
|
10
|
+
`,positionals:{path:{description:`Documentation path to list anchors for`,required:!1}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t;if(n){let e;try{e=await St(n)}catch(e){throw e instanceof E?new F(`Failed to fetch documentation index: ${await e.text()}`):e}if(r){console.info(O(e));return}if(e.anchors.length===0){console.info(`(no anchors)`);return}let t=e.anchors.map(e=>[`${n}#${e.slug}`,e.excerpt]);console.info(d(t,{headers:[`PATH`,`EXCERPT`]}))}else{let e;try{e=await xt()}catch(e){throw e instanceof E?new F(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.sort((e,t)=>e.path.localeCompare(t.path)),r){console.info(O(e));return}if(e.length===0){console.info(`No documentation pages found.`);return}let t=e.map(e=>[e.path,e.title,e.description??``]);console.info(d(t,{headers:[`PATH`,`TITLE`,`DESCRIPTION`]}))}});const Et=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,Dt=Object.hasOwnProperty;var Ot=class{constructor(){this.occurrences,this.reset()}slug(e,t){let n=this,r=kt(e,t===!0),i=r;for(;Dt.call(n.occurrences,r);)n.occurrences[i]++,r=i+`-`+n.occurrences[i];return n.occurrences[r]=0,r}reset(){this.occurrences=Object.create(null)}};function kt(e,t){return typeof e==`string`?(t||(e=e.toLowerCase()),e.replace(Et,``).replace(/ /g,`-`)):``}var At=N({name:`prismic docs view`,description:`
|
|
11
11
|
View a documentation page as Markdown.
|
|
12
12
|
|
|
13
13
|
Append #anchor to the path to view only the section under that heading.
|
|
14
|
-
`,positionals:{path:{description:`Documentation path, optionally with #anchor (e.g., setup#install)`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,i=n.indexOf(`#`),a=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1):void 0,s;try{s=await
|
|
15
|
-
`),r=new
|
|
16
|
-
`).trim()}var
|
|
14
|
+
`,positionals:{path:{description:`Documentation path, optionally with #anchor (e.g., setup#install)`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,i=n.indexOf(`#`),a=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1):void 0,s;try{s=await Ct(a)}catch(e){throw e instanceof E?new F(`Failed to fetch page: ${await e.text()}`):e}if(o){let e=jt(s,o);if(!e)throw new F(`Anchor not found: #${o}`);s=e}if(r){console.info(O({path:a,anchor:o,content:s}));return}console.info(s)});function jt(e,t){let n=e.split(`
|
|
15
|
+
`),r=new Ot,i,a,o,s;for(let e=0;e<n.length;e++){let c=n[e],l=c.match(/^(?<fence>`{3,}|~{3,})/)?.groups?.fence;if(i){l?.startsWith(i)&&(i=void 0);continue}else if(l){i=l;continue}let u=c.match(/^(?<level>#{1,6})\s+(?<text>.*)/);if(u?.groups?.level&&u?.groups?.text){if(a!==void 0&&s!==void 0&&u.groups.level.length<=s){o=e;break}r.slug(u.groups.text)===t&&(a=e,s=u.groups.level.length)}}if(a!==void 0)return n.slice(a,o).join(`
|
|
16
|
+
`).trim()}var Mt=P({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:Tt,description:`List available documentation pages`},view:{handler:At,description:`View a documentation page`}}});function I(e){let t=Nt(e);return`variations`in t&&(t.variations=t.variations.map(e=>Nt(e))),t}function Nt(e){return Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)))}const L={"to-slice":{type:`string`,description:`ID of the target slice`},"to-type":{type:`string`,description:`ID of the target content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Content type tab name (default: "Main")`}},Pt={"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:L.variation};async function Ft(e,t){let n=await f(),{"from-slice":r,"from-type":i,variation:a=`default`}=t,o=[r,i].filter(Boolean).length;if(o===0)throw new F(`Specify a target with --from-slice or --from-type.`);if(o>1)throw new F(`Only one of --from-slice or --from-type can be specified.`);if(r){let t=await n.getSlice(r),i=t.model.variations.find(e=>e.id===a);if(!i)throw new F(`Variation "${a}" not found. Available: ${t.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return i.primary??={},z(i.primary,e),[i.primary,async()=>{await n.updateSlice(t.model),await n.generateTypes()},`slice`]}let s=await n.getCustomType(i),c=e.includes(`.`)?e.split(`.`)[0]:e,l;for(let e in s.model.json)c in s.model.json[e]&&(l=s.model.json[e]);if(!l)throw new F(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(s.model.json))).join(`, `)||`(none)`}`);return z(l,e),[l,async()=>{await n.updateCustomType(s.model),await n.generateTypes()},`customType`]}async function It(e,t,n){let r=await f(),{"from-slice":i,"from-type":a,variation:o=`default`}=n,s=[i,a].filter(Boolean).length;if(s===0)throw new F(`Specify a target with --from-slice or --from-type.`);if(s>1)throw new F(`Only one of --from-slice or --from-type can be specified.`);if(i){let e=await r.getSlice(i),t=e.model.variations.find(e=>e.id===o);if(!t)throw new F(`Variation "${o}" not found. Available: ${e.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return t.primary??={},[t.primary,t.primary,async()=>{await r.updateSlice(e.model),await r.generateTypes()},`slice`]}let c=await r.getCustomType(a),l=e.includes(`.`)?e.split(`.`)[0]:e,u=t.includes(`.`)?t.split(`.`)[0]:t,d,p;for(let e in c.model.json){let t=c.model.json[e];l in t&&(d=t),u in t&&(p=t)}let m=Object.keys(Object.assign({},...Object.values(c.model.json))).join(`, `)||`(none)`;if(!d)throw new F(`Field "${e}" not found. Available: ${m}`);if(!p)throw new F(`Field "${t}" not found. Available: ${m}`);return[d,p,async()=>{await r.updateCustomType(c.model),await r.generateTypes()},`customType`]}async function R(e){let t=await f(),n=e[`to-slice`]??e[`from-slice`],r=e[`to-type`]??e[`from-type`],i=[n,r].filter(Boolean).length;if(i===0)throw new F(`Specify a target with --to-slice or --to-type.`);if(i>1)throw new F(`Only one of --to-slice or --to-type can be specified.`);if(n){if(`tab`in e)throw new F(`--tab is only valid for content types.`);let r=e.variation??`default`,i=await t.getSlice(n),a=i.model.variations?.find(e=>e.id===r);if(!a)throw new F(`Variation "${r}" not found. Available: ${i.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return a.primary??={},[a.primary,async()=>{await t.updateSlice(i.model),await t.generateTypes()},`slice`]}if(`variation`in e)throw new F(`--variation is only valid for slices.`);let a=e.tab??`Main`,o=await t.getCustomType(r),s=o.model.json[a];if(!s)throw new F(`Tab "${a}" not found. Available: ${Object.keys(o.model.json).join(`, `)||`(none)`}`);return[s,async()=>{await t.updateCustomType(o.model),await t.generateTypes()},`customType`]}function z(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 F(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new F(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}const Lt=[`Slices`,`UID`,`Choice`];async function Rt(e,t){let n=await f(),r=await n.getCustomType(t);return zt(e,Object.assign({},...Object.values(r.model.json)),r.model.id,n,1)}async function zt(e,t,n,r,i){let a=[],o=new Map;for(let r of e){let e=r.indexOf(`.`);if(e===-1)Bt(r,t,n),a.push(r);else{let t=r.slice(0,e),n=r.slice(e+1);o.has(t)||o.set(t,[]),o.get(t).push(n)}}for(let[e,s]of o){let o=t[e];if(!o)throw new F(`Field "${e}" not found on type "${n}".`);if(o.type===`Group`){let t=await zt(s,o.config?.fields??{},n,r,i);a.push({id:e,fields:t})}else if(o.type===`Link`&&o.config?.select===`document`){if(i<=0)throw new F(`Cannot nest deeper than --field group.cr.group.leaf.`);let t=o.config?.customtypes;if(!t||t.length!==1)throw new F(`Field "${e}" must be restricted to a single custom type to select fields from it.`);let n=typeof t[0]==`string`?t[0]:t[0].id,c=await r.getCustomType(n),l=await zt(s,Object.assign({},...Object.values(c.model.json)),n,r,i-1);a.push({id:e,customtypes:[{id:n,fields:l}]})}else throw new F(`Field "${e}" is not a group or content relationship field.`)}return a}function Bt(e,t,n){if(!(e in t))throw new F(`Field "${e}" not found on type "${n}".`);if(Lt.includes(t[e].type)||e===`uid`)throw new F(`Field "${e}" cannot be fetched from a content relationship.`);if(t[e].type===`Group`)throw new F(`Field "${e}" is a group. Select specific sub-fields with --field ${e}.<sub-field>.`)}function B(e){let{modelKind:t,targetId:n}=e;return t===`slice`?`Run \`prismic slice view ${n}\` to view the updated slice.`:`Run \`prismic type view ${n}\` to view the updated type.`}var Vt=N({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,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}=t,[s,c,l]=await R(t),[u,d]=z(s,n),f={type:`Boolean`,config:{label:r??_(d),default_value:i,placeholder_true:a,placeholder_false:o}};if(d in u)throw new F(`Field "${n}" already exists.`);u[d]=f,await c(),console.info(`Field added: ${n}`);let p=t[`to-slice`]??t[`to-type`];console.info(B({targetId:p,modelKind:l}))}),Ht=N({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await R(t),[c,l]=z(a,n),u={type:`Color`,config:{label:r??_(l),placeholder:i}};if(l in c)throw new F(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(B({targetId:d,modelKind:s}))}),Ut=N({name:`prismic field add content-relationship`,description:`
|
|
17
17
|
Add a content relationship field to a slice or custom type.
|
|
18
18
|
|
|
19
19
|
Content relationships fetch and display data from related documents
|
|
@@ -42,7 +42,7 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
42
42
|
|
|
43
43
|
Fetch fields from the related document:
|
|
44
44
|
prismic field add content-relationship author --to-type blog_post --custom-type author --field name --field bio
|
|
45
|
-
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...
|
|
45
|
+
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Restrict to documents with this tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Restrict to documents of this type (can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (can be repeated, requires one --custom-type)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,field:o}=t;if(o&&(!a||a.length!==1))throw new F(`--field requires exactly one --custom-type.`);let[s,c,l]=await R(t),[u,d]=z(s,n),f=a;if(o&&a){let e=await Rt(o,a[0]);f=[{id:a[0],fields:e}]}let p={type:`Link`,config:{label:r??_(d),select:`document`,tags:i,customtypes:f}};if(d in u)throw new F(`Field "${n}" already exists.`);u[d]=p,await c(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(B({targetId:m,modelKind:l}))}),Wt=N({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,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}=t,[o,s,c]=await R(t),[l,u]=z(o,n),d={type:`Date`,config:{label:r??_(u),placeholder:i,default:a}};if(u in l)throw new F(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(B({targetId:f,modelKind:c}))}),Gt=N({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await R(t),[c,l]=z(a,n),u={type:`Embed`,config:{label:r??_(l),placeholder:i}};if(l in c)throw new F(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(B({targetId:d,modelKind:s}))}),Kt=N({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await R(t),[s,c]=z(i,n),l={type:`GeoPoint`,config:{label:r??_(c)}};if(c in s)throw new F(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(B({targetId:u,modelKind:o}))}),qt=N({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await R(t),[s,c]=z(i,n),l={type:`Group`,config:{label:r??_(c)}};if(c in s)throw new F(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(B({targetId:u,modelKind:o}))}),Jt=N({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await R(t),[c,l]=z(a,n),u={type:`Image`,config:{label:r??_(l),placeholder:i}};if(l in c)throw new F(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(B({targetId:d,modelKind:s}))}),Yt=N({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,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}=t,[o,s,c]=await R(t),[l,u]=z(o,n),d={type:`IntegrationFields`,config:{label:r??_(u),placeholder:i,catalog:a}};if(u in l)throw new F(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(B({targetId:f,modelKind:c}))}),Xt=N({name:`prismic field add link`,description:`Add a link field to a slice or custom type. Use for navigational links to URLs, documents, or media. For data-level relations between documents, use content-relationship instead.`,sections:{EXAMPLES:`
|
|
46
46
|
Add a link that opens in a new tab:
|
|
47
47
|
prismic field add link cta --to-type landing_page --allow-target-blank
|
|
48
48
|
|
|
@@ -51,7 +51,7 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
51
51
|
|
|
52
52
|
Add a repeatable link with custom text:
|
|
53
53
|
prismic field add link nav_item --to-type navigation --repeatable --allow-text
|
|
54
|
-
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...
|
|
54
|
+
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`},allow:{type:`string`,description:`Restrict to a link type: document, media, or web`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab`},"allow-text":{type:`boolean`,description:`Allow custom link text`},repeatable:{type:`boolean`,description:`Allow multiple links`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,r=[`document`,`media`,`web`],{label:i,allow:a,"allow-target-blank":o,"allow-text":s,repeatable:c,variant:l}=t;if(a&&!r.includes(a))throw new F(`--allow must be one of: ${r.join(`, `)}`);let u=a,[d,f,p]=await R(t),[m,h]=z(d,n),g={type:`Link`,config:{label:i??_(h),select:u,allowTargetBlank:o,allowText:s,repeat:c,variants:l}};if(h in m)throw new F(`Field "${n}" already exists.`);m[h]=g,await f(),console.info(`Field added: ${n}`);let v=t[`to-slice`]??t[`to-type`];console.info(B({targetId:v,modelKind:p}))}),Zt=N({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,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}=t,a=Qt(t.min,`min`),o=Qt(t.max,`max`),s=Qt(t.step,`step`),[c,l,u]=await R(t),[d,f]=z(c,n),p={type:`Number`,config:{label:r??_(f),placeholder:i,min:a,max:o,step:s}};if(f in d)throw new F(`Field "${n}" already exists.`);d[f]=p,await l(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(B({targetId:m,modelKind:u}))});function Qt(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new F(`--${t} must be a valid number, got "${e}"`);return n}var $t=N({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
|
|
55
55
|
heading1, heading2, heading3, heading4, heading5, heading6,
|
|
56
56
|
paragraph, strong, em, preformatted, hyperlink, image, embed,
|
|
57
57
|
list-item, o-list-item, rtl
|
|
@@ -61,19 +61,19 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
61
61
|
|
|
62
62
|
Add a body field with only headings and paragraphs:
|
|
63
63
|
prismic field add rich-text body --to-type blog_post --allow heading1,heading2,paragraph,strong,em,hyperlink
|
|
64
|
-
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...
|
|
64
|
+
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...L,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}=t,[c,l,u]=await R(t),[d,f]=z(c,n),p={type:`StructuredText`,config:{label:r??_(f),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:s}};if(f in d)throw new F(`Field "${n}" already exists.`);d[f]=p,await l(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(B({targetId:m,modelKind:u}))}),en=N({name:`prismic field add select`,description:`Add a select field to a slice or custom type.`,sections:{EXAMPLES:`
|
|
65
65
|
Add a select with options:
|
|
66
66
|
prismic field add select theme --to-type landing_page --option light --option dark --option brand
|
|
67
67
|
|
|
68
68
|
With a default value:
|
|
69
69
|
prismic field add select layout --to-type landing_page --option full --option centered --option sidebar --default-value full
|
|
70
|
-
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...
|
|
70
|
+
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...L,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}=t,[s,c,l]=await R(t),[u,d]=z(s,n),f={type:`Select`,config:{label:r??_(d),placeholder:i,default_value:a,options:o}};if(d in u)throw new F(`Field "${n}" already exists.`);u[d]=f,await c(),console.info(`Field added: ${n}`);let p=t[`to-slice`]??t[`to-type`];console.info(B({targetId:p,modelKind:l}))}),tn=N({name:`prismic field add table`,description:`Add a table field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await R(t),[s,c]=z(i,n),l={type:`Table`,config:{label:r??_(c)}};if(c in s)throw new F(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(B({targetId:u,modelKind:o}))}),nn=N({name:`prismic field add text`,description:`Add a text field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await R(t),[c,l]=z(a,n),u={type:`Text`,config:{label:r??_(l),placeholder:i}};if(l in c)throw new F(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(B({targetId:d,modelKind:s}))}),rn=N({name:`prismic field add timestamp`,description:`Add a timestamp field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...L,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}=t,[o,s,c]=await R(t),[l,u]=z(o,n),d={type:`Timestamp`,config:{label:r??_(u),placeholder:i,default:a}};if(u in l)throw new F(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(B({targetId:f,modelKind:c}))}),an=N({name:`prismic field add uid`,description:`Add a UID field to a content type.`,options:{"to-type":{type:`string`,description:`Name of the target content type`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({values:e})=>{let{label:t=`UID`,placeholder:n}=e,[r,i,a]=await R(e),o={type:`UID`,config:{label:t,placeholder:n}};if(`uid`in r)throw new F(`Field "uid" already exists.`);r.uid=o,await i(),console.info(`Field added: uid`);let s=e[`to-type`];console.info(B({targetId:s,modelKind:a}))}),on=P({name:`prismic field add`,description:`Add a field to a slice or custom type.`,sections:{"GROUP FIELDS":`
|
|
71
71
|
To add a field inside a group, use dot notation for the field ID:
|
|
72
72
|
|
|
73
73
|
prismic field add text my_group.description --to-type blog_post
|
|
74
74
|
|
|
75
75
|
The group must already exist. Only one level of nesting is supported.
|
|
76
|
-
`},commands:{boolean:{handler:
|
|
76
|
+
`},commands:{boolean:{handler:Vt,description:`Add a boolean field`},color:{handler:Ht,description:`Add a color field`},"content-relationship":{handler:Ut,description:`Add a content relationship field for fetching data from related documents (not for navigation -- use link)`},date:{handler:Wt,description:`Add a date field`},embed:{handler:Gt,description:`Add an embed field`},geopoint:{handler:Kt,description:`Add a geopoint field`},group:{handler:qt,description:`Add a group field`},image:{handler:Jt,description:`Add an image field`},integration:{handler:Yt,description:`Add an integration field`},link:{handler:Xt,description:`Add a link field for URLs, documents, or media (navigational)`},number:{handler:Zt,description:`Add a number field`},"rich-text":{handler:$t,description:`Add a rich text field`},select:{handler:en,description:`Add a select field`},table:{handler:tn,description:`Add a table field`},text:{handler:nn,description:`Add a text field`},timestamp:{handler:rn,description:`Add a timestamp field`},uid:{handler:an,description:`Add a UID field`}}}),sn=N({name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
|
|
77
77
|
Options vary by field type. Only options matching the field's
|
|
78
78
|
type will be applied. See \`prismic field add <type> --help\`
|
|
79
79
|
for type-specific option details.
|
|
@@ -86,13 +86,13 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
86
86
|
|
|
87
87
|
Restrict a rich text field to a single block:
|
|
88
88
|
prismic field edit subtitle --from-type blog_post --single
|
|
89
|
-
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...
|
|
89
|
+
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...Pt,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default value (boolean: true/false, select: option value)`},"true-label":{type:`string`,description:`Label for true value (boolean)`},"false-label":{type:`string`,description:`Label for false value (boolean)`},default:{type:`string`,description:`Default value (date/timestamp)`},min:{type:`string`,description:`Minimum value (number)`},max:{type:`string`,description:`Maximum value (number)`},step:{type:`string`,description:`Step increment (number)`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab (link/rich-text)`},"allow-text":{type:`boolean`,description:`Allow custom link text (link)`},repeatable:{type:`boolean`,description:`Allow multiple links (link)`},variant:{type:`string`,multiple:!0,description:`Allowed variant (link/link-to-media, can be repeated)`},tag:{type:`string`,multiple:!0,description:`Allowed tag (content-relationship, can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (content-relationship, can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (content-relationship, can be repeated)`},allow:{type:`string`,description:`Comma-separated allowed block types (rich-text)`},single:{type:`boolean`,description:`Restrict to a single block (rich-text)`},catalog:{type:`string`,description:`Integration catalog ID (integration)`}}},async({positionals:e,values:t})=>{let[n]=e,[r,i]=await Ft(n,t),[a,o]=z(r,n),s=a[o];if(!s)throw new F(`Field "${n}" does not exist.`);switch(s.config??={},`label`in t&&(s.config.label=t.label),`placeholder`in t&&(s.config.placeholder=t.placeholder),s.type){case`Boolean`:if(`default-value`in t){let e=t[`default-value`];if(e!==`true`&&e!==`false`)throw new F(`--default-value for boolean fields must be "true" or "false"`);s.config.default_value=e===`true`}`true-label`in t&&(s.config.placeholder_true=t[`true-label`]),`false-label`in t&&(s.config.placeholder_false=t[`false-label`]);break;case`Number`:`min`in t&&(s.config.min=cn(t.min,`min`)),`max`in t&&(s.config.max=cn(t.max,`max`)),`step`in t&&(s.config.step=cn(t.step,`step`));break;case`Select`:`default-value`in t&&(s.config.default_value=t[`default-value`]),`option`in t&&(s.config.options=t.option);break;case`Date`:case`Timestamp`:`default`in t&&(s.config.default=t.default);break;case`IntegrationFields`:`catalog`in t&&(s.config.catalog=t.catalog);break;case`StructuredText`:if(`allow-target-blank`in t&&(s.config.allowTargetBlank=t[`allow-target-blank`]),`single`in t){let e=`allow`in t?t.allow:s.config.multi??s.config.single;delete s.config.multi,s.config.single=e}else `allow`in t&&(`single`in s.config?s.config.single=t.allow:s.config.multi=t.allow);break;case`Link`:if(`allow-target-blank`in t&&(s.config.allowTargetBlank=t[`allow-target-blank`]),`allow-text`in t&&(s.config.allowText=t[`allow-text`]),`repeatable`in t&&(s.config.repeat=t.repeatable),`variant`in t&&(s.config.variants=t.variant),`tag`in t&&(s.config.tags=t.tag),`field`in t){let e=`custom-type`in t?t[`custom-type`]:s.config.customtypes;if(!e||e.length===0)throw new F(`--field requires the field to be restricted to a custom type. Use --custom-type to specify one.`);if(e.length>1)throw new F(`--field requires the field to be restricted to a single custom type.`);let n=typeof e[0]==`string`?e[0]:e[0].id,r=await Rt(t.field,n);s.config.customtypes=[{id:n,fields:r}]}else `custom-type`in t&&(s.config.customtypes=t[`custom-type`]);break}await i(),console.info(`Field updated: ${n}`)});function cn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new F(`--${t} must be a valid number, got "${e}"`);return n}var ln=N({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Pt},async({positionals:e,values:t})=>{let[n]=e,[r,i]=await Ft(n,t),[a,o]=z(r,n);if(!(o in a))throw new F(`Field "${n}" does not exist.`);delete a[o],await i(),console.info(`Field removed: ${n}`)}),un=N({name:`prismic field reorder`,description:`Reorder a field in a slice or custom type.`,positionals:{id:{description:`Field ID to move`,required:!0}},options:{before:{type:`string`,description:`Place field before this field ID`},after:{type:`string`,description:`Place field after this field ID`},"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`}}},async({positionals:e,values:t})=>{let[n]=e,{before:r,after:i}=t;if(!r&&!i)throw new F(`Specify --before or --after.`);if(r&&i)throw new F(`Only one of --before or --after can be specified.`);let a=r??i,o=r?`before`:`after`;if(n===a)throw new F(`Cannot reorder "${n}" relative to itself.`);let s=n.lastIndexOf(`.`),c=a.lastIndexOf(`.`);if((s===-1?``:n.slice(0,s))!==(c===-1?``:a.slice(0,c)))throw new F(`Cannot reorder "${n}" relative to "${a}": fields must be in the same container.`);let[l,u,d]=await It(n,a,t),[f,p]=z(l,n),[m,h]=z(u,a);if(!(p in f))throw new F(`Field "${n}" does not exist.`);if(!(h in m))throw new F(`Field "${a}" does not exist.`);let g=f[p];delete f[p];let _=Object.entries(m);for(let e of Object.keys(m))delete m[e];for(let[e,t]of _)o===`before`&&e===h&&(m[p]=g),m[e]=t,o===`after`&&e===h&&(m[p]=g);await d(),console.info(`Field reordered: ${n}`)}),dn=N({name:`prismic field view`,description:`View details of a field in a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...Pt,json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,[r]=await Ft(n,t),[i,a]=z(r,n),o=i[a];if(!o)throw new F(`Field "${n}" does not exist.`);if(t.json){console.info(O({id:a,...o}));return}if(console.info(`Type: ${o.type}`),o.config){for(let[e,t]of Object.entries(o.config))if(t!==void 0)if(e===`fields`&&typeof t==`object`&&t){let e=Object.keys(t).join(`, `)||`(none)`;console.info(`Fields: ${e}`)}else Array.isArray(t)?console.info(`${_(e)}: ${t.join(`, `)}`):console.info(`${_(e)}: ${t}`)}}),fn=P({name:`prismic field`,description:`Manage fields in slices and content types.`,commands:{add:{handler:on,description:`Add a field`},edit:{handler:sn,description:`Edit a field`},remove:{handler:ln,description:`Remove a field`},reorder:{handler:un,description:`Reorder a field`},view:{handler:dn,description:`View details of a field`}}}),pn=N({name:`prismic gen setup`,description:`
|
|
90
90
|
Generate framework-specific setup files for a Prismic project.
|
|
91
91
|
|
|
92
92
|
Installs dependencies, creates the Prismic client file, slice simulator
|
|
93
93
|
page, preview routes, and other files required by the detected framework.
|
|
94
94
|
Skips files that already exist.
|
|
95
|
-
`,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await o()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await ye()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),sn=M({name:`prismic gen types`,description:`Generate TypeScript types for slices and content types.`},async()=>{let e=await(await o()).generateTypes(),t=fe(await u(),e);console.info(`Generated types at ${t}`)}),cn=N({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:on,description:`Generate framework-specific Prismic setup`},types:{handler:sn,description:`Generate TypeScript types from local models`}}});async function ln(e){let{repo:t,token:n,host:r}=e,i=xn(r),a=new URL(`customtypes`,i);try{return await C(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${t}`),e}}async function un(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await C(new URL(`customtypes/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function dn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await C(new URL(`customtypes/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function fn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await C(new URL(`customtypes/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}async function pn(e){let{repo:t,token:n,host:r}=e,i=xn(r),a=new URL(`slices`,i);try{return await C(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${t}`),e}}async function mn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await C(new URL(`slices/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function hn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await C(new URL(`slices/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function gn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await C(new URL(`slices/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}const _n=O({values:O({url:x(),fields:ae(x(),x())}),imgixEndpoint:x()}),vn={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function yn(e,t){let{sliceId:n,variationId:r,repo:i,token:a,host:o}=t,s=e.type;if(!(s in vn))throw new bn(s);let c=await C(new URL(`create`,Sn(o)),{headers:{Repository:i,Authorization:`Bearer ${a}`},schema:_n}),l=vn[s],u=`${i}/shared-slices/${n}/${r}/${Le(`md5`).update(new Uint8Array(await e.arrayBuffer())).digest(`hex`)}${l}`,d=new FormData;for(let[e,t]of Object.entries(c.values.fields))d.append(e,t);d.append(`key`,u),d.append(`Content-Type`,s),d.append(`file`,e),await C(c.values.url,{method:`POST`,body:d});let f=new URL(u,le(c.imgixEndpoint));return f.searchParams.set(`auto`,`compress,format`),f}var bn=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){super(`Unsupported file type: ${e||`unknown`}. Supported: ${Object.keys(vn).join(`, `)}`)}};function xn(e){return new URL(`https://customtypes.${e}/`)}function Sn(e){return new URL(`https://acl-provider.${e}/`)}function Cn(e){He(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start ""`:`xdg-open`} "${e.toString()}"`)}function B(e,t,n){let{getKey:r,equals:i=(e,t)=>JSON.stringify(e)===JSON.stringify(t)}=n,a={insert:[],update:[],delete:[]};for(let n of e){let e=t.find(e=>r(e)===r(n));e?i(n,e)||a.update.push(n):a.insert.push(n)}for(let n of t)e.some(e=>r(e)===r(n))||a.delete.push(n);return a}const wn=O({documentsPublished:D(),documentsUnpublished:D(),releasesCreated:D(),releasesUpdated:D(),tagsCreated:D(),tagsDeleted:D()}),Tn=Object.keys(wn.shape),En=O({config:ve(wn,{_id:x(),url:x(),active:D(),name:se(x()),secret:se(x()),headers:ae(x(),x())})});async function Dn(e){let{repo:t,token:n,host:r}=e,i=V(t,r),a=new URL(`app/settings/webhooks`,i);try{return await C(a,{credentials:{"prismic-auth":n},schema:S(En)})}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${t}`),e}}async function On(e,t){let{repo:n,token:r,host:i}=t,a=V(n,i),o=new URL(`app/settings/webhooks/create`,a),s=new FormData;s.set(`url`,e.url),s.set(`name`,e.name??``),s.set(`secret`,e.secret??``),s.set(`headers`,JSON.stringify({})),s.set(`active`,`on`),s.set(`documentsPublished`,e.documentsPublished.toString()),s.set(`documentsUnpublished`,e.documentsUnpublished.toString()),s.set(`releasesCreated`,e.releasesCreated.toString()),s.set(`releasesUpdated`,e.releasesUpdated.toString()),s.set(`tagsCreated`,e.tagsCreated.toString()),s.set(`tagsDeleted`,e.tagsDeleted.toString());try{await C(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${n}`),e}}async function kn(e,t,n){let{repo:r,token:i,host:a}=n,o=V(r,a),s=new URL(`app/settings/webhooks/${e}`,o),c=new FormData;c.set(`url`,t.url),c.set(`name`,t.name??``),c.set(`secret`,t.secret??``),c.set(`headers`,JSON.stringify(t.headers??{})),c.set(`active`,t.active?`on`:`off`),c.set(`documentsPublished`,t.documentsPublished.toString()),c.set(`documentsUnpublished`,t.documentsUnpublished.toString()),c.set(`releasesCreated`,t.releasesCreated.toString()),c.set(`releasesUpdated`,t.releasesUpdated.toString()),c.set(`tagsCreated`,t.tagsCreated.toString()),c.set(`tagsDeleted`,t.tagsDeleted.toString());try{await C(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}catch(e){throw e instanceof T&&(e.message=`Webhook not found`),e}}async function An(e,t){let{repo:n,token:r,host:i}=t,a=V(n,i),o=new URL(`app/settings/webhooks/${e}/delete`,a);try{await C(o,{method:`POST`,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof T&&(e.message=`Webhook not found`),e}}const jn=O({id:x(),scope:x(),token:x(),created_at:O({$date:ie()})}),Mn=O({id:x(),name:x(),wroom_auths:S(jn)}),Nn=O({app_name:x(),token:x(),timestamp:ie()}),Pn=O({max_tokens:ie(),tokens:S(Nn)});async function Fn(e){let t=new URL(`settings/security/contentapi`,V(e.repo,e.host));try{return await C(t,{credentials:{"prismic-auth":e.token},schema:S(Mn)})}catch(t){throw t instanceof T&&(t.message=`Repository not found: ${e.repo}`),t}}async function In(e,t){let n=new URL(`settings/security/oauthapp`,V(t.repo,t.host));try{return await C(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Mn})}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${t.repo}`),e}}async function Ln(e,t,n){let r=new URL(`settings/security/authorizations`,V(n.repo,n.host));try{return await C(r,{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:jn})}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${n.repo}`),e}}async function Rn(e,t){let n=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await C(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(e){throw e instanceof T&&(e.message=`Token not found`),e}}async function zn(e){let t=new URL(`settings/security/customtypesapi`,V(e.repo,e.host));try{return await C(t,{credentials:{"prismic-auth":e.token},schema:Pn})}catch(t){throw t instanceof T&&(t.message=`Repository not found: ${e.repo}`),t}}async function Bn(e,t){let n=new URL(`settings/security/token`,V(t.repo,t.host));try{return await C(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Nn})}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${t.repo}`),e}}async function Vn(e,t){let n=new URL(`settings/security/token/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await C(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(t){throw t instanceof T&&(t.message=`Token not found: ${e}`),t}}async function Hn(e){let{domain:t,token:n,host:r}=e;return await C(new URL(`app/dashboard/repositories/${t}/exists`,Yn(r)),{credentials:{"prismic-auth":n},schema:D()})}async function Un(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await C(new URL(`app/dashboard/repositories`,Yn(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const Wn=O({repository:O({api_access:x()})});async function Gn(e){let{repo:t,token:n,host:r}=e,i=new URL(`syncState`,V(t,r));try{return(await C(i,{credentials:{"prismic-auth":n},schema:Wn})).repository.api_access}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${t}`),e}}async function Kn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`settings/security/apiaccess`,V(n,i));try{await C(a,{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${n}`),e}}const qn=O({repository:O({name:x()})});async function Jn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,V(n,i)),o=new FormData;o.set(`displayname`,e);try{return(await C(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:qn})).repository.name}catch(e){throw e instanceof T&&(e.message=`Repository not found: ${n}`),e}}function Yn(e){return new URL(`https://${e}/`)}function V(e,t){return new URL(`https://${e}.${t}/`)}var Xn=M({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 k(),r=await A(),i=await Zn({name:t,token:n,host:r});console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function Zn(e){let{name:t,token:n,host:r}=e,i=await Qn({token:n,host:r});if(!i)throw new P(`Failed to create a repository. Please try again.`);let a=(await o().catch(()=>void 0))?.id??`other`;try{await Un({domain:i,name:t??i,framework:a,token:n,host:r})}catch(e){throw e instanceof w?new P(`Failed to create repository: ${await e.text()}`):e}return i}async function Qn(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 Hn({domain:e,token:t,host:n})){r=e;break}}return r}var $n=M({name:`prismic init`,description:`
|
|
95
|
+
`,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await f()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await Te()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),mn=N({name:`prismic gen types`,description:`Generate TypeScript types for slices and content types.`},async()=>{let e=await(await f()).generateTypes(),t=ge(await s(),e);console.info(`Generated types at ${t}`)}),hn=P({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:pn,description:`Generate framework-specific Prismic setup`},types:{handler:mn,description:`Generate TypeScript types from local models`}}});async function gn(e){let{repo:t,token:n,host:r}=e,i=On(r),a=new URL(`customtypes`,i);try{return await T(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function _n(e,t){let{repo:n,token:r,host:i}=t,a=On(i);await T(new URL(`customtypes/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function vn(e,t){let{repo:n,token:r,host:i}=t,a=On(i);await T(new URL(`customtypes/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function yn(e,t){let{repo:n,token:r,host:i}=t,a=On(i);await T(new URL(`customtypes/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}async function bn(e){let{repo:t,token:n,host:r}=e,i=On(r),a=new URL(`slices`,i);try{return await T(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function xn(e,t){let{repo:n,token:r,host:i}=t,a=On(i);await T(new URL(`slices/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function Sn(e,t){let{repo:n,token:r,host:i}=t,a=On(i);await T(new URL(`slices/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function Cn(e,t){let{repo:n,token:r,host:i}=t,a=On(i);await T(new URL(`slices/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}const wn=k({values:k({url:w(),fields:le(w(),w())}),imgixEndpoint:w()}),Tn={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function En(e,t){let{sliceId:n,variationId:r,repo:i,token:a,host:o}=t,s=e.type;if(!(s in Tn))throw new Dn(s);let c=await T(new URL(`create`,kn(o)),{headers:{Repository:i,Authorization:`Bearer ${a}`},schema:wn}),l=Tn[s],u=`${i}/shared-slices/${n}/${r}/${We(`md5`).update(new Uint8Array(await e.arrayBuffer())).digest(`hex`)}${l}`,d=new FormData;for(let[e,t]of Object.entries(c.values.fields))d.append(e,t);d.append(`key`,u),d.append(`Content-Type`,s),d.append(`file`,e),await T(c.values.url,{method:`POST`,body:d});let f=new URL(u,me(c.imgixEndpoint));return f.searchParams.set(`auto`,`compress,format`),f}var Dn=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){super(`Unsupported file type: ${e||`unknown`}. Supported: ${Object.keys(Tn).join(`, `)}`)}};function On(e){return new URL(`https://customtypes.${e}/`)}function kn(e){return new URL(`https://acl-provider.${e}/`)}function An(e){Ye(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start ""`:`xdg-open`} "${e.toString()}"`)}function jn(e,t,n){let{getKey:r,equals:i=(e,t)=>JSON.stringify(e)===JSON.stringify(t)}=n,a={insert:[],update:[],delete:[]};for(let n of e){let e=t.find(e=>r(e)===r(n));e?i(n,e)||a.update.push(n):a.insert.push(n)}for(let n of t)e.some(e=>r(e)===r(n))||a.delete.push(n);return a}const Mn=k({documentsPublished:Se(),documentsUnpublished:Se(),releasesCreated:Se(),releasesUpdated:Se(),tagsCreated:Se(),tagsDeleted:Se()}),Nn=Object.keys(Mn.shape),Pn=k({config:we(Mn,{_id:w(),url:w(),active:Se(),name:de(w()),secret:de(w()),headers:le(w(),w())})});async function Fn(e){let{repo:t,token:n,host:r}=e,i=V(t,r),a=new URL(`app/settings/webhooks`,i);try{return await T(a,{credentials:{"prismic-auth":n},schema:pe(Pn)})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function In(e,t){let{repo:n,token:r,host:i}=t,a=V(n,i),o=new URL(`app/settings/webhooks/create`,a),s=new FormData;s.set(`url`,e.url),s.set(`name`,e.name??``),s.set(`secret`,e.secret??``),s.set(`headers`,JSON.stringify({})),s.set(`active`,`on`),s.set(`documentsPublished`,e.documentsPublished.toString()),s.set(`documentsUnpublished`,e.documentsUnpublished.toString()),s.set(`releasesCreated`,e.releasesCreated.toString()),s.set(`releasesUpdated`,e.releasesUpdated.toString()),s.set(`tagsCreated`,e.tagsCreated.toString()),s.set(`tagsDeleted`,e.tagsDeleted.toString());try{await T(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}async function Ln(e,t,n){let{repo:r,token:i,host:a}=n,o=V(r,a),s=new URL(`app/settings/webhooks/${e}`,o),c=new FormData;c.set(`url`,t.url),c.set(`name`,t.name??``),c.set(`secret`,t.secret??``),c.set(`headers`,JSON.stringify(t.headers??{})),c.set(`active`,t.active?`on`:`off`),c.set(`documentsPublished`,t.documentsPublished.toString()),c.set(`documentsUnpublished`,t.documentsUnpublished.toString()),c.set(`releasesCreated`,t.releasesCreated.toString()),c.set(`releasesUpdated`,t.releasesUpdated.toString()),c.set(`tagsCreated`,t.tagsCreated.toString()),c.set(`tagsDeleted`,t.tagsDeleted.toString());try{await T(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}catch(e){throw e instanceof D&&(e.message=`Webhook not found`),e}}async function Rn(e,t){let{repo:n,token:r,host:i}=t,a=V(n,i),o=new URL(`app/settings/webhooks/${e}/delete`,a);try{await T(o,{method:`POST`,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Webhook not found`),e}}const zn=k({id:w(),scope:w(),token:w(),created_at:k({$date:ce()})}),Bn=k({id:w(),name:w(),wroom_auths:pe(zn)}),Vn=k({app_name:w(),token:w(),timestamp:ce()}),Hn=k({max_tokens:ce(),tokens:pe(Vn)});async function Un(e){let t=new URL(`settings/security/contentapi`,V(e.repo,e.host));try{return await T(t,{credentials:{"prismic-auth":e.token},schema:pe(Bn)})}catch(t){throw t instanceof D&&(t.message=`Repository not found: ${e.repo}`),t}}async function Wn(e,t){let n=new URL(`settings/security/oauthapp`,V(t.repo,t.host));try{return await T(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Bn})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t.repo}`),e}}async function Gn(e,t,n){let r=new URL(`settings/security/authorizations`,V(n.repo,n.host));try{return await T(r,{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:zn})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n.repo}`),e}}async function Kn(e,t){let n=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await T(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(e){throw e instanceof D&&(e.message=`Token not found`),e}}async function qn(e){let t=new URL(`settings/security/customtypesapi`,V(e.repo,e.host));try{return await T(t,{credentials:{"prismic-auth":e.token},schema:Hn})}catch(t){throw t instanceof D&&(t.message=`Repository not found: ${e.repo}`),t}}async function Jn(e,t){let n=new URL(`settings/security/token`,V(t.repo,t.host));try{return await T(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Vn})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t.repo}`),e}}async function Yn(e,t){let n=new URL(`settings/security/token/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await T(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(t){throw t instanceof D&&(t.message=`Token not found: ${e}`),t}}async function Xn(e){let{domain:t,token:n,host:r}=e;return await T(new URL(`app/dashboard/repositories/${t}/exists`,rr(r)),{credentials:{"prismic-auth":n},schema:Se()})}async function Zn(e){let{domain:t,name:n,framework:r,agent:i,token:a,host:o}=e,s=new URL(`app/dashboard/repositories`,rr(o));s.searchParams.set(`app`,`cli`),i&&s.searchParams.set(`agent`,i),await T(s,{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":a}})}const Qn=k({repository:k({api_access:w()})});async function $n(e){let{repo:t,token:n,host:r}=e,i=new URL(`syncState`,V(t,r));try{return(await T(i,{credentials:{"prismic-auth":n},schema:Qn})).repository.api_access}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function er(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`settings/security/apiaccess`,V(n,i));try{await T(a,{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}const tr=k({repository:k({name:w()})});async function nr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,V(n,i)),o=new FormData;o.set(`displayname`,e);try{return(await T(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:tr})).repository.name}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}function rr(e){return new URL(`https://${e}/`)}function V(e,t){return new URL(`https://${e}.${t}/`)}async function ir(){if(process.env.AI_AGENT)return process.env.AI_AGENT.toLowerCase();if(process.env.CLAUDE_CODE_IS_COWORK===`1`||process.env.CLAUDE_CODE_IS_COWORK===`true`)return`claude-cowork`;if(process.env.CLAUDECODE===`1`||process.env.CLAUDE_CODE)return`claude-code`;if(process.env.CODEX_CI===`1`||process.env.CODEX_SANDBOX||process.env.CODEX_THREAD_ID)return`codex`;if(process.env.CURSOR_AGENT===`1`||process.env.CURSOR_EXTENSION_HOST_ROLE===`agent-exec`)return`cursor`;if(process.env.CLINE_ACTIVE===`true`)return`cline`;if(process.env.ANTIGRAVITY_AGENT)return`antigravity`;if(process.env.AUGMENT_AGENT===`1`)return`augment`;if(process.env.OPENCODE_CLIENT===`1`)return`opencode`;if(process.env.GEMINI_CLI===`1`)return`gemini-cli`;if(process.env.TRAE_AI_SHELL_ID)return`trae`;if(process.env.REPL_ID)return`replit`;if(process.env.COPILOT_MODEL||process.env.COPILOT_ALLOW_ALL||process.env.COPILOT_GITHUB_TOKEN)return`github-copilot`;let e=process.env.AGENT?.toLowerCase();if(e===`goose`||e===`amp`)return e;if(process.platform===`linux`&&await ye(new URL(`file:///opt/.devin`)))return`devin`;if(process.env.IS_SANDBOX===`yes`)return`unknown-sandbox`}var ar=N({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 A(),r=await j(),i=await or({name:t,token:n,host:r});console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function or(e){let{name:t,token:n,host:r}=e,i=await sr({token:n,host:r});if(!i)throw new F(`Failed to create a repository. Please try again.`);let a=(await f().catch(()=>void 0))?.id??`other`,o=await ir();try{await Zn({domain:i,name:t??i,framework:a,agent:o,token:n,host:r})}catch(e){throw e instanceof E?new F(`Failed to create repository: ${await e.text()}`):e}return await v({repo:i,token:n,host:r,stepIds:[`createPrismicProject`]}),i}async function sr(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 Xn({domain:e,token:t,host:n})){r=e;break}}return r}var cr=N({name:`prismic init`,description:`
|
|
96
96
|
Initialize a new Prismic project by creating a repository and
|
|
97
97
|
prismic.config.json file. Detects the project framework, installs
|
|
98
98
|
dependencies, and syncs models from Prismic.
|
|
@@ -100,42 +100,42 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
100
100
|
Use --repo to connect to an existing repository instead. If a
|
|
101
101
|
slicemachine.config.json exists, its repository and settings will be
|
|
102
102
|
migrated.
|
|
103
|
-
`,options:{repo:{type:`string`,short:`r`,description:`Repository name`},"no-browser":{type:`boolean`,description:`Skip opening the browser automatically during login`}}},async({values:e})=>{let{repo:t,"no-browser":n}=e;try{throw await
|
|
103
|
+
`,options:{repo:{type:`string`,short:`r`,description:`Repository name`},"no-browser":{type:`boolean`,description:`Skip opening the browser automatically during login`}}},async({values:e})=>{let{repo:t,"no-browser":n}=e;try{throw await ie(),new F(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof y))throw e}let r;try{r=await c()}catch(e){e instanceof p&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let i=await A(),a=await j(),s;try{s=await o({token:i,host:a})}catch(e){if(e instanceof ve||e instanceof be){console.info(`Not logged in. Starting login...`);let{email:e}=await je({onReady:e=>{n?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),An(e))}});console.info(`Logged in as ${e}`),i=await A(),s=await o({token:i,host:a})}else throw e}let l=(t??r?.repositoryName)?.toLowerCase();if(l){if(!s.repositories.some(e=>e.domain===l))throw new F(`Repository "${l}" not found in your account. Check the name or request access to the repository.`);if(!await re(l,{token:i,host:a}))throw new h}let d=await f();l||(l=await or({token:i,host:a}),console.info(`Created repository: ${l}`));try{let e=a===Ae?void 0:`https://${l}.cdn.${a}/api/v2/`;await u({repositoryName:l,documentAPIEndpoint:e,libraries:r?.libraries,routes:[]})}catch(e){throw e instanceof m?new F(`Could not find a package.json file. Run this command from a project directory.`):new F(`Failed to create prismic.config.json.`)}if(r){try{await ae()}catch{}console.info(`Migrated slicemachine.config.json to prismic.config.json`)}await d.initProject();try{console.info(`Installing dependencies...`),await Te()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}let[g,_,v,b]=await Promise.all([gn({repo:l,token:i,host:a}),bn({repo:l,token:i,host:a}),d.getCustomTypes(),d.getSlices()]),x=v.map(e=>e.model),S=jn(_,b.map(e=>e.model),{getKey:e=>e.id});for(let e of S.update)await d.updateSlice(e);for(let e of S.delete)await d.deleteSlice(e.id);for(let e of S.insert)await d.createSlice(e);let ee=jn(g,x,{getKey:e=>e.id});for(let e of ee.update)await d.updateCustomType(e);for(let e of ee.delete)await d.deleteCustomType(e.id);for(let e of ee.insert)await d.createCustomType(e);await d.generateTypes(),console.info(`\nInitialized Prismic for repository "${l}".`),console.info("Run `prismic type create <name>` to create a content type."),console.info("Run `prismic sync` to sync models from Prismic.")});const lr=k({id:w(),label:w(),customName:de(w()),isMaster:Se()});async function ur(e){let{repo:t,token:n,host:r}=e,i=new URL(`repository/locales`,pr(r));i.searchParams.set(`repository`,t);try{return(await T(i,{headers:{Authorization:`Bearer ${n}`},schema:k({results:pe(lr)})})).results}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function dr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,pr(i));a.searchParams.set(`repository`,n);try{return await T(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:lr})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}async function fr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,pr(i));a.searchParams.set(`repository`,n),await T(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function pr(e){return new URL(`https://api.internal.${e}/locale/`)}async function H(e,t){let{repo:n,token:r,host:i}=t,[a,s]=await Promise.all([o({token:r,host:i}),b({repo:n,token:r,host:i})]),c=s.filter(e=>(e.kind===`prod`||e.kind===`stage`)&&e.users.some(e=>e.id===a.shortId)),l=c.find(t=>t.domain===e);if(l)return l.domain;throw new mr(e,c,n)}var mr=class extends Error{name=`InvalidEnvironmentError`;repo;env;availableEnvironments;constructor(e,t,n){super(),this.repo=n,this.env=e,this.availableEnvironments=t}},hr=N({name:`prismic locale add`,description:`
|
|
104
104
|
Add a locale to a Prismic repository.
|
|
105
105
|
|
|
106
106
|
By default, this command reads the repository from prismic.config.json at the
|
|
107
107
|
project root.
|
|
108
|
-
`,positionals:{code:{description:`Locale code (e.g. fr-fr, es-es)`,required:!0}},options:{master:{type:`boolean`,description:`Set as the master locale`},name:{type:`string`,short:`n`,description:`Custom display name (for custom locales)`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
108
|
+
`,positionals:{code:{description:`Locale code (e.g. fr-fr, es-es)`,required:!0}},options:{master:{type:`boolean`,description:`Set as the master locale`},name:{type:`string`,short:`n`,description:`Custom display name (for custom locales)`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a,master:o=!1,name:s}=n,c=await A(),l=await j(),u=a?await H(a,{repo:i,token:c,host:l}):i;try{await dr({id:r,isMaster:o,customName:s},{repo:u,token:c,host:l})}catch(e){throw e instanceof E?new F(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${r}`)}),gr=N({name:`prismic locale list`,description:`
|
|
109
109
|
List all locales in a Prismic repository.
|
|
110
110
|
|
|
111
111
|
By default, this command reads the repository from prismic.config.json at the
|
|
112
112
|
project root.
|
|
113
|
-
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:
|
|
113
|
+
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:n=await t(),env:r,json:i}=e,a=await A(),o=await j(),s=r?await H(r,{repo:n,token:a,host:o}):n,c;try{c=await ur({repo:s,token:a,host:o})}catch(e){throw e instanceof E?new F(`Failed to list locales: ${await e.text()}`):e}if(i){console.info(O(c));return}if(c.length===0){console.info(`No locales found.`);return}let l=c.map(e=>{let t=e.isMaster?` (master)`:``;return[e.id,`${e.label}${t}`]});console.info(d(l,{headers:[`ID`,`LABEL`]}))}),_r=N({name:`prismic locale remove`,description:`
|
|
114
114
|
Remove a locale from a Prismic repository.
|
|
115
115
|
|
|
116
116
|
By default, this command reads the repository from prismic.config.json at the
|
|
117
117
|
project root.
|
|
118
|
-
`,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
118
|
+
`,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o=await A(),s=await j(),c=a?await H(a,{repo:i,token:o,host:s}):i;try{await fr(r,{repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${r}`)}),vr=N({name:`prismic locale set-master`,description:`
|
|
119
119
|
Set the master locale for a Prismic repository.
|
|
120
120
|
|
|
121
121
|
By default, this command reads the repository from prismic.config.json at the
|
|
122
122
|
project root.
|
|
123
|
-
`,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
123
|
+
`,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o=await A(),s=await j(),c=a?await H(a,{repo:i,token:o,host:s}):i,l;try{l=await ur({repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to set master locale: ${await e.text()}`):e}let u=l.find(e=>e.id===r);if(!u)throw new F(`Locale "${r}" not found. Available locales: ${l.map(e=>e.id).join(`, `)}`);if(u.isMaster)throw new F(`Locale "${r}" is already the master.`);try{await dr({id:u.id,isMaster:!0,customName:u.customName??void 0},{repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${r}`)}),yr=P({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:hr,description:`Add a locale`},list:{handler:gr,description:`List locales`},remove:{handler:_r,description:`Remove a locale`},"set-master":{handler:vr,description:`Set the master locale`}}}),br=N({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 je({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}`),An(e))}});console.info(`Logged in to Prismic as ${n}`)}),xr=N({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await De())console.info(`Logged out of Prismic`);else throw new F(`Logout failed. You can log out manually by deleting the file.`)}),Sr=N({name:`prismic preview add`,description:`
|
|
124
124
|
Add a preview configuration to a Prismic repository.
|
|
125
125
|
|
|
126
126
|
By default, this command reads the repository from prismic.config.json at the
|
|
127
127
|
project root.
|
|
128
|
-
`,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
128
|
+
`,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a,name:o}=n,s;try{s=new URL(r)}catch{throw new F(`Invalid URL: ${r}`)}let c=o||s.hostname,l=`${s.protocol}//${s.host}`,u=s.pathname===`/`?void 0:s.pathname,d=await A(),f=await j(),p=a?await H(a,{repo:i,token:d,host:f}):i;try{await te({name:c,websiteURL:l,resolverPath:u},{repo:p,token:d,host:f})}catch(e){throw e instanceof E?new F(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${r}`),console.info("Run `prismic preview set-simulator <url>` to set the slice simulator URL.")}),Cr=N({name:`prismic preview list`,description:`
|
|
129
129
|
List all preview configurations in a Prismic repository.
|
|
130
130
|
|
|
131
131
|
By default, this command reads the repository from prismic.config.json at the
|
|
132
132
|
project root.
|
|
133
|
-
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:
|
|
133
|
+
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:n=await t(),env:r,json:i}=e,a=await A(),o=await j(),s=r?await H(r,{repo:n,token:a,host:o}):n,c,l;try{[c,l]=await Promise.all([ee({repo:s,token:a,host:o}),g({repo:s,token:a,host:o})])}catch(e){throw e instanceof E?new F(`Failed to list previews: ${await e.text()}`):e}if(i){console.info(O({previews:c,simulatorUrl:l??null}));return}if(c.length===0&&!l){console.info(`No preview configurations found.`);return}if(c.length>0){let e=c.map(e=>[e.url,e.label]);console.info(d(e,{headers:[`URL`,`NAME`]}))}l&&(c.length>0&&console.info(``),console.info(`Simulator: ${l}`))}),wr=N({name:`prismic preview remove`,description:`
|
|
134
134
|
Remove a preview configuration from a Prismic repository.
|
|
135
135
|
|
|
136
136
|
By default, this command reads the repository from prismic.config.json at the
|
|
137
137
|
project root.
|
|
138
|
-
`,positionals:{url:{description:`Preview URL to remove`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
138
|
+
`,positionals:{url:{description:`Preview URL to remove`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o=await A(),s=await j(),c=a?await H(a,{repo:i,token:o,host:s}):i,u;try{u=await ee({repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to remove preview: ${await e.text()}`):e}let d=u.find(e=>e.url===r);if(!d)throw new F(`Preview not found: ${r}`);try{await l(d.id,{repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${r}`)}),Tr=N({name:`prismic preview set-simulator`,description:`
|
|
139
139
|
Set the slice simulator URL for a Prismic repository.
|
|
140
140
|
|
|
141
141
|
If the URL pathname does not end with /slice-simulator, it is appended
|
|
@@ -143,13 +143,13 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
143
143
|
|
|
144
144
|
By default, this command reads the repository from prismic.config.json at the
|
|
145
145
|
project root.
|
|
146
|
-
`,positionals:{url:{description:`Simulator URL (e.g. https://example.com/slice-simulator)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
147
|
-
`)){if(r.length<4)continue;let t=r.slice(3),i=t.indexOf(` -> `);i!==-1&&(t=t.slice(i+4)),n.push(new URL(t,e))}return n}catch{return[]}}var
|
|
146
|
+
`,positionals:{url:{description:`Simulator URL (e.g. https://example.com/slice-simulator)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o;try{o=new URL(r)}catch{throw new F(`Invalid URL: ${r}`)}o.pathname.endsWith(`/slice-simulator`)||(o.pathname=o.pathname.replace(/\/+$/,``)+`/slice-simulator`);let s=o.toString(),c=await A(),l=await j(),u=a?await H(a,{repo:i,token:c,host:l}):i;try{await x(s,{repo:u,token:c,host:l})}catch(e){throw e instanceof E?new F(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${s}`)}),Er=P({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:Sr,description:`Add a preview configuration`},list:{handler:Cr,description:`List preview configurations`},remove:{handler:wr,description:`Remove a preview configuration`},"set-simulator":{handler:Tr,description:`Set the slice simulator URL`}}});async function Dr(e){try{let{stdout:t}=await Ee(`git`,[`rev-parse`,`--show-toplevel`],{nodeOptions:{cwd:He(e)},throwOnError:!0}),n=t.trim();return n?me(Ue(await Ve(n))):void 0}catch{return}}async function Or(e){try{let{stdout:t}=await Ee(`git`,[`status`,`--porcelain`,`--untracked-files=all`],{nodeOptions:{cwd:He(e)},throwOnError:!0}),n=[];for(let r of t.split(`
|
|
147
|
+
`)){if(r.length<4)continue;let t=r.slice(3),i=t.indexOf(` -> `);i!==-1&&(t=t.slice(i+4)),n.push(new URL(t,e))}return n}catch{return[]}}var kr=N({name:`prismic pull`,description:`
|
|
148
148
|
Pull content types and slices from Prismic to local files.
|
|
149
149
|
|
|
150
150
|
Remote models are the source of truth. Local files are created, updated,
|
|
151
151
|
or deleted to match.
|
|
152
|
-
`,options:{force:{type:`boolean`,short:`f`,description:`Overwrite local changes`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{force:
|
|
152
|
+
`,options:{force:{type:`boolean`,short:`f`,description:`Overwrite local changes`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{force:n=!1,repo:r=await t(),env:i}=e,a=await A(),o=await j(),c=await f(),l=await s(),u=i?await H(i,{repo:r,token:a,host:o}):r;console.info(`Pulling from repository: ${r}${i?` (env: ${i})`:``}`);let[d,p,m]=await Promise.all([Dr(l),c.getCustomTypeLibraries(),c.getSliceLibraries()]);if(!n&&d){let e=(await Or(d)).filter(e=>e.pathname.endsWith(`/model.json`)&&m.some(t=>_e(t,e))||e.pathname.endsWith(`/index.json`)&&p.some(t=>_e(t,e))).map(e=>ge(l,e));if(e.length>0)throw new F(`
|
|
153
153
|
Local model files have uncommitted changes. Commit them first so a
|
|
154
154
|
pull won't silently discard your edits:
|
|
155
155
|
|
|
@@ -160,7 +160,7 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
160
160
|
Other options:
|
|
161
161
|
prismic push --force Keep local edits, overwrite remote
|
|
162
162
|
prismic pull --force Discard local edits, adopt remote
|
|
163
|
-
`)}let[h,g,
|
|
163
|
+
`)}let[h,g,_,y]=await Promise.all([c.getCustomTypes(),c.getSlices(),gn({repo:u,token:a,host:o}),bn({repo:u,token:a,host:o})]),b=jn(_,h.map(e=>e.model),{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(I(e))===JSON.stringify(I(t))}),x=jn(y,g.map(e=>e.model),{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(I(e))===JSON.stringify(I(t))});if(!n&&!d){let e=new Set([...b.update,...b.delete].map(e=>e.id)),t=new Set([...x.update,...x.delete].map(e=>e.id)),n=[...h.filter(t=>e.has(t.model.id)),...g.filter(e=>t.has(e.model.id))].map(e=>ge(l,e.modelPath));if(n.length>0)throw new F(`
|
|
164
164
|
Pull would modify or delete local model files:
|
|
165
165
|
${n.join(`
|
|
166
166
|
`)}
|
|
@@ -168,12 +168,12 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
168
168
|
This project isn't in a git repo, so changes can't be tracked. Choose one:
|
|
169
169
|
prismic pull --force Discard local files, adopt remote
|
|
170
170
|
prismic push --force Keep local files, overwrite remote
|
|
171
|
-
`)}for(let e of
|
|
171
|
+
`)}for(let e of b.insert)await c.createCustomType(e);for(let e of b.update)await c.updateCustomType(e);for(let e of b.delete)await c.deleteCustomType(e.id);for(let e of x.insert)await c.createSlice(e);for(let e of x.update)await c.updateSlice(e);for(let e of x.delete)await c.deleteSlice(e.id);await c.generateTypes(),await v({repo:r,token:a,host:o,stepIds:[`connectPrismic`]});let S=b.insert.length+b.update.length,ee=x.insert.length+x.update.length,C=b.delete.length+x.delete.length;if(S===0&&ee===0&&C===0){console.info(`Already up to date.`);return}console.info(`Inserted ${b.insert.length}, updated ${b.update.length}, deleted ${b.delete.length} types`),console.info(`Inserted ${x.insert.length}, updated ${x.update.length}, deleted ${x.delete.length} slices`)}),Ar=N({name:`prismic push`,description:`
|
|
172
172
|
Push local content types and slices to Prismic.
|
|
173
173
|
|
|
174
174
|
Local models are the source of truth. Remote models are created,
|
|
175
175
|
updated, or deleted to match.
|
|
176
|
-
`,options:{force:{type:`boolean`,short:`f`,description:`Skip safety checks`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{force:
|
|
176
|
+
`,options:{force:{type:`boolean`,short:`f`,description:`Skip safety checks`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{force:n=!1,repo:r=await t(),env:a}=e,o=await A(),c=await j(),l=await f(),u=await s(),d=a?await H(a,{repo:r,token:o,host:c}):r;console.info(`Pushing to repository: ${r}${a?` (env: ${a})`:``}`);let[p,m,h]=await Promise.all([Dr(u),l.getCustomTypeLibraries(),l.getSliceLibraries()]);if(!n&&p){let e=(await Or(p)).filter(e=>e.pathname.endsWith(`/model.json`)&&h.some(t=>_e(t,e))||e.pathname.endsWith(`/index.json`)&&m.some(t=>_e(t,e))).map(e=>ge(u,e));if(e.length>0)throw new F(`
|
|
177
177
|
Local model files have uncommitted changes. Commit them, then push:
|
|
178
178
|
|
|
179
179
|
git add ${e.join(` `)}
|
|
@@ -181,39 +181,39 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
181
181
|
prismic push
|
|
182
182
|
|
|
183
183
|
Or skip the safety check with \`prismic push --force\`.
|
|
184
|
-
`)}let[g,
|
|
184
|
+
`)}let[g,_,y,b]=await Promise.all([l.getCustomTypes(),l.getSlices(),gn({repo:d,token:o,host:c}),bn({repo:d,token:o,host:c})]),x=jn(g.map(e=>e.model),y,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(I(e))===JSON.stringify(I(t))}),S=jn(_.map(e=>e.model),b,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(I(e))===JSON.stringify(I(t))});if(!n){let e=me(m[0]),t=me(h[0]),n=[...x.delete.map(t=>ge(u,new URL(`${t.id}/index.json`,e))),...S.delete.map(e=>ge(u,new URL(`${i(e.name)}/model.json`,t)))];if(n.length>0)throw new F(`
|
|
185
185
|
Push would delete remote models. Re-run with --force to proceed.
|
|
186
186
|
|
|
187
187
|
Models that would be deleted:
|
|
188
188
|
${n.join(`
|
|
189
189
|
`)}
|
|
190
|
-
`)}for(let e of
|
|
190
|
+
`)}for(let e of x.insert)await _n(e,{repo:d,token:o,host:c});for(let e of x.update)await vn(e,{repo:d,token:o,host:c});for(let e of x.delete.map(e=>e.id))await yn(e,{repo:d,token:o,host:c});for(let e of S.insert)await xn(e,{repo:d,token:o,host:c});for(let e of S.update)await Sn(e,{repo:d,token:o,host:c});for(let e of S.delete.map(e=>e.id))await Cn(e,{repo:d,token:o,host:c});let ee=[];S.insert.length>0&&ee.push(`createSlice`),x.insert.some(e=>e.format===`page`)&&ee.push(`createPageType`),ee.length>0&&await v({repo:r,token:o,host:c,stepIds:ee});let C=x.insert.length+x.update.length,te=S.insert.length+S.update.length,ne=x.delete.length+S.delete.length;C===0&&te===0&&ne===0?console.info(`Already up to date.`):(console.info(`Pushed ${C} type(s), ${te} slice(s).`),ne>0&&console.info(`Deleted ${ne} model(s).`))}),jr=N({name:`prismic repo list`,description:`List all Prismic repositories associated with your account.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await A(),r=await j(),i;try{i=await o({token:n,host:r})}catch(e){throw e instanceof E?new F(`Failed to list repositories: ${await e.text()}`):e}let a=i.repositories;if(t){console.info(O(a.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${r}/`}))));return}if(a.length===0){console.info(`No repositories found.`);return}let s=a.map(e=>{let t=e.name||`(no name)`;return[e.domain,t,e.role??``]});console.info(d(s,{headers:[`DOMAIN`,`NAME`,`ROLE`]}))});const Mr=[`private`,`public`,`open`];var Nr=N({name:`prismic repo set-api-access`,description:`
|
|
191
191
|
Set the Content API access level of a Prismic repository.
|
|
192
192
|
|
|
193
193
|
By default, this command reads the repository from prismic.config.json at the
|
|
194
194
|
project root.
|
|
195
|
-
`,positionals:{level:{description:`Access level (${
|
|
195
|
+
`,positionals:{level:{description:`Access level (${Mr.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t()}=n;if(!Mr.includes(r))throw new F(`Invalid access level: ${r}. Must be one of: ${Mr.join(`, `)}`);let a=await A(),o=await j();try{await er(r,{repo:i,token:a,host:o})}catch(e){throw e instanceof E?new F(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${r}`)}),Pr=N({name:`prismic repo set-name`,description:`
|
|
196
196
|
Set the display name of a Prismic repository.
|
|
197
197
|
|
|
198
198
|
By default, this command reads the repository from prismic.config.json at the
|
|
199
199
|
project root.
|
|
200
|
-
`,positionals:{name:{description:`Display name for the repository`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:
|
|
200
|
+
`,positionals:{name:{description:`Display name for the repository`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t()}=n,a=await A(),o=await j(),s;try{s=await nr(r,{repo:i,token:a,host:o})}catch(e){throw e instanceof E?new F(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${s}`)}),Fr=N({name:`prismic repo view`,description:`
|
|
201
201
|
View details of a Prismic repository.
|
|
202
202
|
|
|
203
203
|
By default, this command reads the repository from prismic.config.json at the
|
|
204
204
|
project root.
|
|
205
|
-
`,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:
|
|
205
|
+
`,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:n=await t(),web:r,json:i}=e,a=await A(),s=await j(),c=`https://${n}.${s}/`;if(r){An(new URL(c)),console.info(`Opening ${c}`);return}let l,u;try{[l,u]=await Promise.all([o({token:a,host:s}),$n({repo:n,token:a,host:s})])}catch(e){throw e instanceof E?new F(`Failed to fetch repository details: ${await e.text()}`):e}let d=l.repositories.find(e=>e.domain===n);if(!d)throw new F(`Repository not found: ${n}`);if(i){console.info(O({domain:d.domain,name:d.name??null,url:c,apiAccess:u}));return}let f=d.name||`(no name)`;console.info(`Name: ${f}`),console.info(`URL: ${c}`),console.info(`Content API: ${u}`)}),Ir=P({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:ar,description:`Create a new repository`},list:{handler:jr,description:`List repositories`},view:{handler:Fr,description:`View repository details`},"set-name":{handler:Pr,description:`Set repository display name`},"set-api-access":{handler:Nr,description:`Set Content API access level`}}}),Lr=N({name:`prismic slice add-variation`,description:`Add a variation to a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the slice`},id:{type:`string`,description:`Custom ID for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`}}},async({positionals:n,values:r})=>{let[i]=n,{to:a,id:o=e(i),screenshot:s}=r,c=await f(),{model:l}=await c.getSlice(a);if(l.variations.some(e=>e.id===o))throw new F(`Variation "${o}" already exists in slice "${a}".`);let u=``;if(s){let e=await t(),n=await A(),r=await j(),i=await xe(/^https?:\/\//i.test(s)?new URL(s):Ue(s)),a;try{a=await En(i,{sliceId:l.id,variationId:o,repo:e,token:n,host:r})}catch(e){throw e instanceof Dn?new F(e.message):e}u=a.toString()}l.variations=[...l.variations,{id:o,name:i,description:i,docURL:``,imageUrl:u,version:``,primary:{}}],await c.updateSlice(l),await c.generateTypes(),console.info(`Added variation "${i}" (id: "${o}") to slice "${a}"`)}),Rr=N({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,sections:{EXAMPLES:`
|
|
206
206
|
Connect a slice to a type's default slice zone:
|
|
207
207
|
prismic slice connect hero --to blog_post
|
|
208
208
|
|
|
209
209
|
Connect to a named slice zone:
|
|
210
210
|
prismic slice connect hero --to blog_post --slice-zone page_slices
|
|
211
|
-
`},positionals:{id:{description:`ID of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"slice-zone":i=`slices`}=t,a=await
|
|
211
|
+
`},positionals:{id:{description:`ID of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"slice-zone":i=`slices`}=t,a=await f(),{model:o}=await a.getSlice(n),{model:s}=await a.getCustomType(r),c=Object.assign({},...Object.values(s.json))[i];if(!c||c.type!==`Slices`)throw new F(`Slice zone "${i}" not found in "${r}".`);if(c.config??={},c.config.choices??={},o.id in c.config.choices)throw new F(`Slice "${o.id}" is already connected to "${r}" in slice zone "${i}".`);c.config.choices[o.id]={type:`SharedSlice`},await a.updateCustomType(s),await a.generateTypes(),console.info(`Connected slice "${n}" to "${r}"`)}),zr=N({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`}}},async({positionals:e,values:t})=>{let[n]=e,{id:r=a(n)}=t,i={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},o=await f();await o.createSlice(i),await o.generateTypes(),console.info(`Created slice "${n}" (id: "${r}")`),console.info(`Run \`prismic field add <type> --to-slice ${r}\` to add fields.`),console.info(`Run \`prismic slice connect ${r} --to <type>\` to connect the slice to a type.`)}),Br=N({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,"slice-zone":i=`slices`}=t,a=await f(),{model:o}=await a.getSlice(n),{model:s}=await a.getCustomType(r),c=Object.assign({},...Object.values(s.json))[i];if(!c||c.type!==`Slices`)throw new F(`Slice zone "${i}" not found in "${r}".`);if(!c.config?.choices||!(o.id in c.config.choices))throw new F(`Slice "${o.id}" is not connected to "${r}" in slice zone "${i}".`);delete c.config.choices[o.id],await a.updateCustomType(s),await a.generateTypes(),console.info(`Disconnected slice "${n}" from "${r}"`)}),Vr=N({name:`prismic slice edit`,description:`Edit a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the slice`}}},async({positionals:e,values:t})=>{let[n]=e,r=await f(),{model:i}=await r.getSlice(n);`name`in t&&(i.name=t.name),await r.updateSlice(i),await r.generateTypes(),console.info(`Slice updated: "${i.name}" (id: ${i.id})`)}),Hr=N({name:`prismic slice edit-variation`,description:`Edit a variation of a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{"from-slice":{type:`string`,required:!0,description:`ID of the slice`},name:{type:`string`,short:`n`,description:`New name for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`}}},async({positionals:e,values:n})=>{let[r]=e,{"from-slice":i,screenshot:a}=n,o=await f(),{model:s}=await o.getSlice(i),c=s.variations.find(e=>e.id===r);if(!c)throw new F(`Variation "${r}" not found in slice "${i}".`);if(`name`in n&&(c.name=n.name),a){let e=await t(),n=await A(),r=await j(),i=await xe(/^https?:\/\//i.test(a)?new URL(a):Ue(a)),o;try{o=await En(i,{sliceId:s.id,variationId:c.id,repo:e,token:n,host:r})}catch(e){throw e instanceof Dn?new F(e.message):e}c.imageUrl=o.toString()}await o.updateSlice(s),await o.generateTypes(),console.info(`Variation updated: "${r}" in slice "${i}"`)}),Ur=N({name:`prismic slice list`,description:`List all slices.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await(await f()).getSlices();if(t){console.info(O(n.map(e=>e.model)));return}if(n.length===0){console.info(`No slices found.`);return}let r=n.map(({model:e})=>[e.name,e.id]);console.info(d(r,{headers:[`NAME`,`ID`]}))}),Wr=N({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}}},async({positionals:e})=>{let[t]=e,n=await f(),{model:r}=await n.getSlice(t);await n.deleteSlice(r.id),await n.generateTypes(),console.info(`Slice removed: ${t}`)}),Gr=N({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the slice`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r}=t,i=await f(),{model:a}=await i.getSlice(r),o=a.variations.find(e=>e.id===n);if(!o)throw new F(`Variation "${n}" not found in slice "${r}".`);a.variations=a.variations.filter(e=>e.id!==o.id),await i.updateSlice(a),await i.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),Kr=N({name:`prismic slice view`,description:`View details of a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,{model:i}=await(await f()).getSlice(n);if(r){console.info(O(i));return}console.info(`ID: ${i.id}`),console.info(`Name: ${i.name}`);for(let e of i.variations??[]){console.info(``),console.info(`${e.id}:`);let t=Object.entries(e.primary??{});if(t.length===0)console.info(` (no fields)`);else{let e=t.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(d(e))}}}),qr=P({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:zr,description:`Create a new slice`},edit:{handler:Vr,description:`Edit a slice`},remove:{handler:Wr,description:`Remove a slice`},list:{handler:Ur,description:`List slices`},view:{handler:Kr,description:`View a slice`},connect:{handler:Rr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:Br,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Lr,description:`Add a variation to a slice`},"edit-variation":{handler:Hr,description:`Edit a variation of a slice`},"remove-variation":{handler:Gr,description:`Remove a variation from a slice`}}}),Jr=N({name:`prismic status`,description:`
|
|
212
212
|
Show local vs remote model differences.
|
|
213
213
|
|
|
214
214
|
Reports what would be pushed to or pulled from Prismic, plus any local
|
|
215
215
|
model files with uncommitted git changes that would block pull and push.
|
|
216
|
-
`,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:
|
|
216
|
+
`,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:n=await t(),env:r}=e,i=await A(),a=await j(),c=await f(),l=await s(),[u,d,p,m,h]=await Promise.all([Dr(l),c.getCustomTypeLibraries(),c.getSliceLibraries(),c.getCustomTypes(),c.getSlices()]),g=n,_,v,y;if(i){r&&(g=await H(r,{repo:n,token:i,host:a}));let[e,t,s]=await Promise.all([o({token:i,host:a}),gn({repo:g,token:i,host:a}),bn({repo:g,token:i,host:a})]);_=e.email,v=jn(m.map(e=>e.model),t,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(I(e))===JSON.stringify(I(t))}),y=jn(h.map(e=>e.model),s,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(I(e))===JSON.stringify(I(t))})}let b=[];u&&(b=(await Or(u)).filter(e=>e.pathname.endsWith(`/model.json`)&&p.some(t=>_e(t,e))||e.pathname.endsWith(`/index.json`)&&d.some(t=>_e(t,e))).map(e=>ge(l,e))),console.info(`Repository: ${n}`),r&&console.info(`Environment: ${r}`),_?console.info(`Authenticated as: ${_}`):console.info("Not logged in — log in with `prismic login` to compare with remote.");let x=v!==void 0&&y!==void 0&&v.insert.length===0&&v.update.length===0&&v.delete.length===0&&y.insert.length===0&&y.update.length===0&&y.delete.length===0;if(x&&b.length===0){console.info(``),console.info(`Already up to date.`);return}if(v&&y){let e=[],t=[...v.insert.map(e=>` ${e.id} (custom type)`),...y.insert.map(e=>` ${e.id} (slice)`)];t.length>0&&e.push([`Local-only:`,...t]);let n=[...v.delete.map(e=>` ${e.id} (custom type)`),...y.delete.map(e=>` ${e.id} (slice)`)];n.length>0&&e.push([`Remote-only:`,...n]);let r=[...v.update.map(e=>` ${e.id} (custom type)`),...y.update.map(e=>` ${e.id} (slice)`)];r.length>0&&e.push([`Differ:`,...r]);for(let t of e){console.info(``);for(let e of t)console.info(e)}}if(b.length>0&&(console.info(``),console.info(C`
|
|
217
217
|
Pull and push won't run while these model files have uncommitted git changes:
|
|
218
218
|
${b.join(`
|
|
219
219
|
`)}
|
|
@@ -223,27 +223,27 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
|
|
|
223
223
|
git commit -m "Update Prismic models"
|
|
224
224
|
|
|
225
225
|
Or override with \`prismic push --force\` (keep local) or \`prismic pull --force\` (discard local).
|
|
226
|
-
`)),v&&y&&!
|
|
226
|
+
`)),v&&y&&!x){let e=v.insert.length+y.insert.length,t=v.update.length+y.update.length,n=v.delete.length+y.delete.length;console.info(``),console.info(`Next:`),console.info(` prismic push — would create ${e}, update ${t}, delete ${n}`),console.info(` prismic pull — would create ${n}, update ${t}, delete ${e}`)}});let Yr,Xr;async function Zr(e){if(ke.TEST)return;let{host:t}=e;if(!await ni())return;let n=t===Ae?`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`:`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`;Xr=await ir(),await Ie({writeKey:n})}function Qr(e){Yr=e}function $r(e){Pe({userId:e.shortId,intercomHash:e.intercomHash})}function ei(e,t={}){let{watch:n}=t;Fe(`Prismic CLI Start`,{properties:{commandType:e,fullCommand:process.argv.join(` `),repository:Yr,watch:n,agent:Xr},groupId:Yr?{Repository:Yr}:void 0})}function U(e,t={}){let{watch:n,success:r=!process.exitCode,error:i}=t,a=i?i instanceof Error?i.message:String(i):void 0;Fe(`Prismic CLI End`,{properties:{commandType:e,fullCommand:process.argv.join(` `),success:r,repository:Yr,watch:n,error:a?.slice(0,512),agent:Xr},groupId:Yr?{Repository:Yr}:void 0})}const ti=k({telemetry:Se()});async function ni(){try{return!((await he(new URL(`.prismicrc`,me(Ue(et()))),{schema:ti}).catch(()=>({telemetry:!0}))).telemetry===!1||(await he(new URL(`.prismicrc`,me(Ue(process.cwd()))),{schema:ti}).catch(()=>({telemetry:!0}))).telemetry===!1)}catch{return!0}}const ri=ke.TEST?500:5e3;var ii=N({name:`prismic sync`,description:`
|
|
227
227
|
Watch Prismic and continuously pull changes to local files.
|
|
228
228
|
|
|
229
229
|
For one-time pulls, use \`prismic pull\`.
|
|
230
|
-
`,options:{watch:{type:`boolean`,short:`w`,description:`Watch for changes and sync continuously`,required:!0},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:
|
|
231
|
-
Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`Watching repository: ${
|
|
230
|
+
`,options:{watch:{type:`boolean`,short:`w`,description:`Watch for changes and sync continuously`,required:!0},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:n=await t(),env:r}=e,i=await A(),a=await j(),o=await f(),s=r?await H(r,{repo:n,token:i,host:a}):n;ei(`sync`,{watch:!0}),process.on(`SIGINT`,()=>{console.info(`
|
|
231
|
+
Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`Watching repository: ${n}${r?` (env: ${r})`:``} (polling every ${ri/1e3}s, Ctrl+C to stop)`);let c=``,l=0;for(;;){try{let[e,t]=await Promise.all([gn({repo:s,token:i,host:a}),bn({repo:s,token:i,host:a})]),r=ai({remoteCustomTypes:e,remoteSlices:t});if(r!==c){let s=c===``,[l,u]=await Promise.all([o.getCustomTypes(),o.getSlices()]),d=l.map(e=>e.model),f=u.map(e=>e.model),p=[],m=jn(t,f,{getKey:e=>e.id});if(m.insert.length+m.update.length+m.delete.length>0){for(let e of m.update)await o.updateSlice(e);for(let e of m.delete)await o.deleteSlice(e.id);for(let e of m.insert)await o.createSlice(e);p.push(`slices`)}let h=jn(e,d,{getKey:e=>e.id});if(h.insert.length+h.update.length+h.delete.length>0){for(let e of h.update)await o.updateCustomType(e);for(let e of h.delete)await o.deleteCustomType(e.id);for(let e of h.insert)await o.createCustomType(e);p.push(`custom types`)}if(await o.generateTypes(),c=r,s)await v({repo:n,token:i,host:a,stepIds:[`connectPrismic`]}),console.info(`Initial sync complete.`);else{let e=new Date().toLocaleTimeString();console.info(`[${e}] Changes detected in ${p.join(` and `)}`)}}l=0}catch(e){l++;let t=e instanceof Error?e.message:`Unknown error`;if(console.error(`Error checking for changes: ${t}`),l>=5)throw Error(`Too many consecutive errors (5), stopping watch.`)}await tt(ri)}});function ai(e){return We(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const oi=`Prismic CLI`;var si=N({name:`prismic token create`,description:`
|
|
232
232
|
Create a new API token for a Prismic repository.
|
|
233
233
|
|
|
234
234
|
By default, this command reads the repository from prismic.config.json at the
|
|
235
235
|
project root.
|
|
236
|
-
`,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:
|
|
236
|
+
`,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:n=await t(),env:r,write:i,"allow-releases":a}=e;if(i&&a)throw new F(`--allow-releases is only valid for access tokens (not with --write)`);let o=await A(),s=await j(),c=r?await H(r,{repo:n,token:o,host:s}):n,l;try{if(i)l=(await Jn(oi,{repo:c,token:o,host:s})).token;else{let e=a?`master+releases`:`master`,t=(await Un({repo:c,token:o,host:s})).find(e=>e.name===oi);t||=await Wn(oi,{repo:c,token:o,host:s}),l=(await Gn(t.id,e,{repo:c,token:o,host:s})).token}}catch(e){throw e instanceof E?new F(`Failed to create token: ${await e.text()}`):e}console.info(`Token created: ${l}`);let u=i?`PRISMIC_WRITE_TOKEN`:`PRISMIC_ACCESS_TOKEN`;console.info(`Add it to your .env file: ${u}=${l}`)}),ci=N({name:`prismic token delete`,description:`
|
|
237
237
|
Delete a token from a Prismic repository.
|
|
238
238
|
|
|
239
239
|
By default, this command reads the repository from prismic.config.json at the
|
|
240
240
|
project root.
|
|
241
|
-
`,positionals:{token:{description:`Token value`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
241
|
+
`,positionals:{token:{description:`Token value`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o=await A(),s=await j(),c=a?await H(a,{repo:i,token:o,host:s}):i,l,u;try{[l,u]=await Promise.all([Un({repo:c,token:o,host:s}),qn({repo:c,token:o,host:s})])}catch(e){throw e instanceof E?new F(`Failed to delete token: ${await e.text()}`):e}let d=l.flatMap(e=>e.wroom_auths).find(e=>e.token===r);if(d){try{await Kn(d.id,{repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}let f=u.tokens.find(e=>e.token===r);if(f){try{await Yn(f.token,{repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}throw new F(`Token not found: ${r}`)}),li=P({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:N({name:`prismic token list`,description:`
|
|
242
242
|
List all API tokens for a Prismic repository.
|
|
243
243
|
|
|
244
244
|
By default, this command reads the repository from prismic.config.json at the
|
|
245
245
|
project root.
|
|
246
|
-
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:
|
|
246
|
+
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:n=await t(),env:r,json:i}=e,a=await A(),o=await j(),s=r?await H(r,{repo:n,token:a,host:o}):n,c,l;try{[c,l]=await Promise.all([Un({repo:s,token:a,host:o}),qn({repo:s,token:a,host:o})])}catch(e){throw e instanceof E?new F(`Failed to list tokens: ${await e.text()}`):e}let u=c.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]}))),f=l.tokens;if(i){console.info(O({accessTokens:u,writeTokens:f}));return}if(u.length>0){console.info(`ACCESS TOKENS`);let e=u.map(e=>[` ${e.name}`,e.scope,e.token,e.createdAt]);console.info(d(e))}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),f.length>0){console.info(`WRITE TOKENS`);let e=f.map(e=>{let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];return[` ${e.app_name}`,e.token,t]});console.info(d(e))}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:si,description:`Create a new token`},delete:{handler:ci,description:`Delete a token`}}}),ui=N({name:`prismic type add-tab`,description:`Add a tab to a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"with-slice-zone":i}=t,a=await f(),{model:o}=await a.getCustomType(r);if(n in o.json)throw new F(`Tab "${n}" already exists in "${r}".`);o.json[n]=i?{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}:{},await a.updateCustomType(o),await a.generateTypes(),console.info(`Added tab "${n}" to "${r}"`)}),di=N({name:`prismic type create`,description:`Create a new content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{format:{type:`string`,short:`f`,description:`Type format: "custom" (default) or "page"`},single:{type:`boolean`,short:`s`,description:`Allow only one document of this type`},id:{type:`string`,description:`Custom ID for the content type`}},sections:{FORMATS:`
|
|
247
247
|
custom A non-page type (e.g. settings, navigation, author, blog
|
|
248
248
|
category). This is the default.
|
|
249
249
|
page A page type with a URL (e.g. homepage, blog post, landing
|
|
@@ -258,7 +258,7 @@ Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
|
|
|
258
258
|
|
|
259
259
|
Create with a custom ID:
|
|
260
260
|
prismic type create "Landing Page" --format page --id landing
|
|
261
|
-
`}},async({positionals:e,values:
|
|
261
|
+
`}},async({positionals:e,values:t})=>{let[n]=e,{format:r=`custom`,single:i=!1,id:o=a(n)}=t;if(r!==`custom`&&r!==`page`)throw new F(`Invalid format: "${r}". Use "custom" or "page".`);let s=r===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}};i||(s.Main={uid:{type:`UID`,config:{label:`UID`}},...s.Main});let c={id:o,label:n,repeatable:!i,status:!0,format:r,json:s},l=await f();await l.createCustomType(c),await l.generateTypes(),console.info(`Created type "${n}" (id: "${o}", format: "${r}")`),console.info(`Run \`prismic field add <type> --to-type ${o}\` to add fields.`),console.info(`Run \`prismic type view ${o}\` to view the type.`)}),fi=N({name:`prismic type edit`,description:`Edit a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the type`},format:{type:`string`,short:`f`,description:`Type format: "custom" or "page"`}}},async({positionals:e,values:t})=>{let[n]=e;if(`format`in t&&t.format!==`custom`&&t.format!==`page`)throw new F(`Invalid format: "${t.format}". Use "custom" or "page".`);let r=await f(),{model:i}=await r.getCustomType(n);`name`in t&&(i.label=t.name),`format`in t&&(i.format=t.format),await r.updateCustomType(i),await r.generateTypes(),console.info(`Type updated: "${i.label}" (id: ${i.id})`)}),pi=N({name:`prismic type edit-tab`,description:`Edit a tab of a content type.`,positionals:{name:{description:`Current name of the tab`,required:!0}},options:{"from-type":{type:`string`,required:!0,description:`ID of the content type`},name:{type:`string`,short:`n`,description:`New name for the tab`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},"without-slice-zone":{type:`boolean`,description:`Remove the slice zone from the tab`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-type":r}=t,i=await f(),{model:a}=await i.getCustomType(r);if(!(n in a.json))throw new F(`Tab "${n}" not found in "${r}".`);if(`with-slice-zone`in t&&`without-slice-zone`in t)throw new F(`Cannot use --with-slice-zone and --without-slice-zone together.`);if(`with-slice-zone`in t){let e=a.json[n];if(Object.values(e).some(e=>e.type===`Slices`))throw new F(`Tab "${n}" already has a slice zone.`);e.slices={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}if(`without-slice-zone`in t){let e=a.json[n],t=Object.entries(e).find(([,e])=>e.type===`Slices`);if(!t)throw new F(`Tab "${n}" does not have a slice zone.`);let[r,i]=t,o=i.type===`Slices`?i.config?.choices??{}:{};if(Object.keys(o).length>0)throw new F(`Cannot remove slice zone from "${n}": disconnect all slices first.`);delete e[r]}if(`name`in t){if(t.name in a.json)throw new F(`Tab "${t.name}" already exists in "${r}".`);let e={};for(let[r,i]of Object.entries(a.json))e[r===n?t.name:r]=i;a.json=e}await i.updateCustomType(a),await i.generateTypes(),console.info(`Tab updated: "${n}" in "${r}"`)}),mi=N({name:`prismic type list`,description:`List all content types.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await(await f()).getCustomTypes();if(t){console.info(O(n.map(e=>e.model)));return}if(n.length===0){console.info(`No types found.`);return}let r=n.map(({model:e})=>[e.label||`(no name)`,e.id,e.format??``]);console.info(d(r,{headers:[`NAME`,`ID`,`FORMAT`]}))}),hi=N({name:`prismic type remove`,description:`Remove a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}}},async({positionals:e})=>{let[t]=e,n=await f(),{model:r}=await n.getCustomType(t);await n.deleteCustomType(r.id),await n.generateTypes(),console.info(`Type removed: ${t}`)}),gi=N({name:`prismic type remove-tab`,description:`Remove a tab from a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r}=t,i=await f(),{model:a}=await i.getCustomType(r);if(!(n in a.json))throw new F(`Tab "${n}" not found in "${r}".`);if(Object.keys(a.json).length<=1)throw new F(`Cannot remove the last tab from "${r}".`);delete a.json[n],await i.updateCustomType(a),await i.generateTypes(),console.info(`Removed tab "${n}" from "${r}"`)}),_i=N({name:`prismic type view`,description:`View details of a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,{model:i}=await(await f()).getCustomType(n);if(r){console.info(O(i));return}console.info(`ID: ${i.id}`),console.info(`Name: ${i.label||`(no name)`}`),console.info(`Format: ${i.format}`),console.info(`Repeatable: ${i.repeatable}`);for(let[e,t]of Object.entries(i.json)){console.info(``),console.info(`${e}:`);let n=Object.entries(t);if(n.length===0)console.info(` (no fields)`);else{let e=n.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(d(e))}}}),vi=P({name:`prismic type`,description:`Manage content types.`,commands:{create:{handler:di,description:`Create a new content type`},edit:{handler:fi,description:`Edit a content type`},remove:{handler:hi,description:`Remove a content type`},list:{handler:mi,description:`List content types`},view:{handler:_i,description:`View a content type`},"add-tab":{handler:ui,description:`Add a tab to a content type`},"edit-tab":{handler:pi,description:`Edit a tab of a content type`},"remove-tab":{handler:gi,description:`Remove a tab from a content type`}}}),yi=N({name:`prismic webhook create`,description:`
|
|
262
262
|
Create a new webhook in a Prismic repository.
|
|
263
263
|
|
|
264
264
|
By default, this command reads the repository from prismic.config.json at the
|
|
@@ -281,27 +281,27 @@ Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
|
|
|
281
281
|
|
|
282
282
|
Create a named webhook with a secret:
|
|
283
283
|
prismic webhook create https://example.com/webhook --name "Deploy" --secret my-secret
|
|
284
|
-
`}},async({positionals:e,values:
|
|
284
|
+
`}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a,name:o,secret:s,trigger:c=[]}=n;for(let e of c)if(!Nn.includes(e))throw new F(`Invalid trigger: ${e}\nValid triggers: ${Nn.join(`, `)}`);let l=await A(),u=await j(),d=a?await H(a,{repo:i,token:l,host:u}):i,f=!(c.length>0);try{await In({url:r,name:o??null,secret:s??null,documentsPublished:c.includes(`documentsPublished`)||f,documentsUnpublished:c.includes(`documentsUnpublished`)||f,releasesCreated:c.includes(`releasesCreated`)||f,releasesUpdated:c.includes(`releasesUpdated`)||f,tagsCreated:c.includes(`tagsCreated`)||f,tagsDeleted:c.includes(`tagsDeleted`)||f},{repo:d,token:l,host:u})}catch(e){throw e instanceof E?new F(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${r}`),console.info(`Run \`prismic webhook set-triggers ${r}\` to configure triggers.`)}),bi=N({name:`prismic webhook disable`,description:`
|
|
285
285
|
Disable a webhook in a Prismic repository.
|
|
286
286
|
|
|
287
287
|
By default, this command reads the repository from prismic.config.json at the
|
|
288
288
|
project root.
|
|
289
|
-
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
289
|
+
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o=await A(),s=await j(),c=a?await H(a,{repo:i,token:o,host:s}):i,l;try{l=await Fn({repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to disable webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===r);if(!u)throw new F(`Webhook not found: ${r}`);if(!u.config.active){console.info(`Webhook already disabled: ${r}`);return}let d=u.config._id,f=structuredClone(u.config);f.active=!1;try{await Ln(d,f,{repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${r}`)}),xi=N({name:`prismic webhook enable`,description:`
|
|
290
290
|
Enable a webhook in a Prismic repository.
|
|
291
291
|
|
|
292
292
|
By default, this command reads the repository from prismic.config.json at the
|
|
293
293
|
project root.
|
|
294
|
-
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
294
|
+
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o=await A(),s=await j(),c=a?await H(a,{repo:i,token:o,host:s}):i,l;try{l=await Fn({repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to enable webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===r);if(!u)throw new F(`Webhook not found: ${r}`);if(u.config.active){console.info(`Webhook already enabled: ${r}`);return}let d=u.config._id,f=structuredClone(u.config);f.active=!0;try{await Ln(d,f,{repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${r}`)}),Si=N({name:`prismic webhook list`,description:`
|
|
295
295
|
List all webhooks in a Prismic repository.
|
|
296
296
|
|
|
297
297
|
By default, this command reads the repository from prismic.config.json at the
|
|
298
298
|
project root.
|
|
299
|
-
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:
|
|
299
|
+
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:n=await t(),env:r,json:i}=e,a=await A(),o=await j(),s=r?await H(r,{repo:n,token:a,host:o}):n,c;try{c=await Fn({repo:s,token:a,host:o})}catch(e){throw e instanceof E?new F(`Failed to list webhooks: ${await e.text()}`):e}if(i){console.info(O(c.map(e=>e.config)));return}if(c.length===0){console.info(`No webhooks configured.`);return}let l=c.map(e=>{let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;return[`${e.config.url}${n}`,`[${t}]`]});console.info(d(l,{headers:[`URL`,`STATUS`]}))}),Ci=N({name:`prismic webhook remove`,description:`
|
|
300
300
|
Delete a webhook from a Prismic repository.
|
|
301
301
|
|
|
302
302
|
By default, this command reads the repository from prismic.config.json at the
|
|
303
303
|
project root.
|
|
304
|
-
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
304
|
+
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o=await A(),s=await j(),c=a?await H(a,{repo:i,token:o,host:s}):i,l;try{l=await Fn({repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to remove webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===r);if(!u)throw new F(`Webhook not found: ${r}`);let d=u.config._id;try{await Rn(d,{repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${r}`)}),wi=N({name:`prismic webhook set-triggers`,description:`
|
|
305
305
|
Update which events trigger a webhook.
|
|
306
306
|
|
|
307
307
|
By default, this command reads the repository from prismic.config.json at the
|
|
@@ -313,29 +313,29 @@ Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
|
|
|
313
313
|
releasesUpdated When a release is edited or deleted
|
|
314
314
|
tagsCreated When a tag is created
|
|
315
315
|
tagsDeleted When a tag is deleted
|
|
316
|
-
`}},async({positionals:e,values:
|
|
316
|
+
`}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a,trigger:o=[]}=n;for(let e of o)if(!Nn.includes(e))throw new F(`Invalid trigger: ${e}\nValid triggers: ${Nn.join(`, `)}`);let s=await A(),c=await j(),l=a?await H(a,{repo:i,token:s,host:c}):i,u;try{u=await Fn({repo:l,token:s,host:c})}catch(e){throw e instanceof E?new F(`Failed to update webhook triggers: ${await e.text()}`):e}let d=u.find(e=>e.config.url===r);if(!d)throw new F(`Webhook not found: ${r}`);let f=d.config._id;try{await Ln(f,{...d.config,documentsPublished:o.includes(`documentsPublished`),documentsUnpublished:o.includes(`documentsUnpublished`),releasesCreated:o.includes(`releasesCreated`),releasesUpdated:o.includes(`releasesUpdated`),tagsCreated:o.includes(`tagsCreated`),tagsDeleted:o.includes(`tagsDeleted`)},{repo:l,token:s,host:c})}catch(e){throw e instanceof E?new F(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${o.join(`, `)}`)}),Ti=N({name:`prismic webhook view`,description:`
|
|
317
317
|
View details of a webhook in a Prismic repository.
|
|
318
318
|
|
|
319
319
|
By default, this command reads the repository from prismic.config.json at the
|
|
320
320
|
project root.
|
|
321
|
-
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:
|
|
322
|
-
`);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Gi.test(n)?n.replace(Gi,`$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 Yi(i.slice(r))}}function Ji(e){return Array.isArray(e)?qi(...e):e}function Yi(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Xi(t).function||``)&&t.pop(),t.reverse(),Ki.test(Xi(t).function||``)&&(t.pop(),Ki.test(Xi(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Xi(t).filename,function:e.function||`?`}))}function Xi(e){return e[e.length-1]||{}}const Zi=`<anonymous>`;function Qi(e){try{return!e||typeof e!=`function`?Zi:e.name||Zi}catch{return Zi}}function $i(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function ea(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const ta={},na={};function ra(e,t){ta[e]=ta[e]||[],ta[e].push(t)}function ia(e,t){if(!na[e]){na[e]=!0;try{t()}catch(t){W&&K.error(`Error while instrumenting ${e}`,t)}}}function aa(e,t){let n=e&&ta[e];if(n)for(let r of n)try{r(t)}catch(t){W&&K.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Qi(r)}\nError:`,t)}}let oa=null;function sa(e){let t=`error`;ra(t,e),ia(t,ca)}function ca(){oa=G.onerror,G.onerror=function(e,t,n,r,i){return aa(`error`,{column:r,error:i,line:n,msg:e,url:t}),oa?oa.apply(this,arguments):!1},G.onerror.__SENTRY_INSTRUMENTED__=!0}let la=null;function ua(e){let t=`unhandledrejection`;ra(t,e),ia(t,da)}function da(){la=G.onunhandledrejection,G.onunhandledrejection=function(e){return aa(`unhandledrejection`,e),la?la.apply(this,arguments):!0},G.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const fa=Object.prototype.toString;function pa(e){switch(fa.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Ta(e,Error)}}function ma(e,t){return fa.call(e)===`[object ${t}]`}function ha(e){return ma(e,`ErrorEvent`)}function ga(e){return ma(e,`String`)}function _a(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function va(e){return e===null||_a(e)||typeof e!=`object`&&typeof e!=`function`}function ya(e){return ma(e,`Object`)}function ba(e){return typeof Event<`u`&&Ta(e,Event)}function xa(e){return typeof Element<`u`&&Ta(e,Element)}function Sa(e){return ma(e,`RegExp`)}function Ca(e){return!!(e?.then&&typeof e.then==`function`)}function wa(e){return ya(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function Ta(e,t){try{return e instanceof t}catch{return!1}}function Ea(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const Da=G;function Oa(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=ka(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 ka(e,t){let n=e,r=[];if(!n?.tagName)return``;if(Da.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&&ga(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 Aa(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Ma(i,r);try{e[t]=i}catch{W&&K.log(`Failed to replace method "${t}" in object`,e)}}function ja(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{W&&K.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ma(e,t){try{e.prototype=t.prototype=t.prototype||{},ja(e,`__sentry_original__`,t)}catch{}}function Na(e){return e.__sentry_original__}function Pa(e){if(pa(e))return{message:e.message,name:e.name,stack:e.stack,...Ia(e)};if(ba(e)){let t={type:e.type,target:Fa(e.target),currentTarget:Fa(e.currentTarget),...Ia(e)};return typeof CustomEvent<`u`&&Ta(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Fa(e){try{return xa(e)?Oa(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Ia(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 La(e){let t=Object.keys(Pa(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let Ra;function za(e){if(Ra!==void 0)return Ra?Ra(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=G;return t in n&&typeof n[t]==`function`?(Ra=n[t],Ra(e)):(Ra=null,e())}function Ba(){return za(()=>Math.random())}function Va(){return za(()=>Date.now())}function Ha(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Ua(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 Wa(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{Ea(r)?n.push($i(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function Ga(e,t,n=!1){return ga(e)?Sa(t)?t.test(e):ga(t)?n?e===t:e.includes(t):!1:!1}function Ka(e,t=[],n=!1){return t.some(t=>Ga(e,t,n))}function qa(){let e=G;return e.crypto||e.msCrypto}let Ja;function Ya(){return Ba()*16}function q(e=qa()){try{if(e?.randomUUID)return za(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Ja||=`10000000100040008000100000000000`,Ja.replace(/[018]/g,e=>(e^(Ya()&15)>>e/4).toString(16))}function Xa(e){return e.exception?.values?.[0]}function Za(e){let{message:t,event_id:n}=e;if(t)return t;let r=Xa(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Qa(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 $a(e,t){let n=Xa(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 eo=/^(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 to(e){return parseInt(e||``,10)}function no(e){let t=e.match(eo)||[],n=to(t[1]),r=to(t[2]),i=to(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 ro(e){if(io(e))return!0;try{ja(e,`__sentry_captured__`,!0)}catch{}return!1}function io(e){try{return e.__sentry_captured__}catch{}}const ao=1e3;function oo(){return Va()/ao}function so(){let{performance:e}=G;if(!e?.now||!e.timeOrigin)return oo;let t=e.timeOrigin;return()=>(t+za(()=>e.now()))/ao}let co;function lo(){return(co??=so())()}function uo(e){let t=lo(),n={sid:q(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>mo(n)};return e&&fo(n,e),n}function fo(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||lo(),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:q()),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 po(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),fo(e,n)}function mo(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 ho(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]=ho(r[e],t[e],n-1));return r}function go(){return q()}function _o(){return q().substring(16)}const vo=`_sentrySpan`;function yo(e,t){t?ja(e,vo,t):delete e[vo]}function bo(e){return e[vo]}var xo=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:go(),sampleRand:Ba()}}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,yo(t,bo(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&&fo(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():ya(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,yo(this,void 0),this._attachments=[],this.setPropagationContext({traceId:go(),sampleRand:Ba()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:oo(),...e,message:e.message?Ha(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:bo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ho(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||q();if(!this._client)return W&&K.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||q();if(!this._client)return W&&K.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||q();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(W&&K.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 Ni(`defaultCurrentScope`,()=>new xo)}function Co(){return Ni(`defaultIsolationScope`,()=>new xo)}var wo=class{constructor(e,t){let n;n=e||new xo;let r;r=t||new xo,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 Ca(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 To(){let e=Mi(ji());return e.stack=e.stack||new wo(So(),Co())}function Eo(e){return To().withScope(e)}function Do(e,t){let n=To();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Oo(e){return To().withScope(()=>e(To().getIsolationScope()))}function ko(){return{withIsolationScope:Oo,withScope:Eo,withSetScope:Do,withSetIsolationScope:(e,t)=>Oo(t),getCurrentScope:()=>To().getScope(),getIsolationScope:()=>To().getIsolationScope()}}function Ao(e){let t=Mi(ji());t.acs=e}function jo(e){let t=Mi(e);return t.acs?t.acs:ko()}function J(){return jo(ji()).getCurrentScope()}function Y(){return jo(ji()).getIsolationScope()}function Mo(){return Ni(`globalScope`,()=>new xo)}function No(...e){let t=jo(ji());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Po(...e){let t=jo(ji());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function X(){return J().getClient()}function Fo(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||_o()};return n&&(i.parent_span_id=n),i}const Io=`sentry.profile_id`,Lo=`sentry.exclusive_time`;function Ro(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function zo(e){let t=e;return{scope:t._sentryScope,isolationScope:Ro(t._sentryIsolationScope)}}const Bo=/^sentry-/;function Vo(e){let t=Uo(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(Bo)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Ho(e){if(e)return Go(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function Uo(e){if(!(!e||!ga(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=Wo(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Wo(e)}function Wo(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 Go(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?(W&&K.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const Ko=/^o(\d+)\./,qo=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Jo(e){return e===`http`||e===`https`}function Yo(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 Xo(e){let t=qo.exec(e);if(!t){Ii(()=>{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 Zo({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Zo(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Qo(e){if(!W)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(K.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?Jo(r)?t&&isNaN(parseInt(t,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function $o(e){return e.match(Ko)?.[1]}function es(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=$o(n)),r}function ts(e){let t=typeof e==`string`?Xo(e):Zo(e);if(!(!t||!Qo(t)))return t}function ns(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 rs=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function is(e){if(!e)return;let t=e.match(rs);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 as(e,t){let n=is(e),r=Vo(t);if(!n?.traceId)return{traceId:go(),sampleRand:Ba()};let i=cs(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 os(e=go(),t=_o(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function ss(e=go(),t=_o(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function cs(e,t){let n=ns(t?.sample_rand);if(n!==void 0)return n;let r=ns(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?Ba()*r:r+Ba()*(1-r):Ba()}function ls(e,t){let n=es(e);return t&&n&&t!==n?(K.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)?(K.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 us=!1;function ds(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:_s(e).parent_span_id,a=zo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||_o():t,trace_id:n}}function fs(e){let{traceId:t,spanId:n}=e.spanContext();return os(t,n,bs(e))}function ps(e){let{traceId:t,spanId:n}=e.spanContext();return ss(t,n,bs(e))}function ms(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 hs(e){return typeof e==`number`?gs(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?gs(e.getTime()):lo()}function gs(e){return e>9999999999?e/1e3:e}function _s(e){if(ys(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(vs(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:hs(i),timestamp:hs(o)||void 0,status:xs(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:ms(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function vs(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function ys(e){return typeof e.getSpanJSON==`function`}function bs(e){let{traceFlags:t}=e.spanContext();return t===1}function xs(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=jo(ji());return e.getActiveSpan?e.getActiveSpan():bo(J())}function ws(){us||=(Ii(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let Ts=!1;function Es(){if(Ts)return;function e(){let e=Cs(),t=e&&Ss(e);if(t){let e=`internal_error`;W&&K.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,Ts=!0,sa(e),ua(e)}function Ds(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||X()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Os(e){K.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ks(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(js(n)){if(Ga(e.description,n))return W&&Os(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?Ga(e.description,n.name):!0,r=n.op?e.op&&Ga(e.op,n.op):!0;if(t&&r)return W&&Os(e),!0}return!1}function As(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 js(e){return typeof e==`string`||e instanceof RegExp}const Ms=`production`;function Ns(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Ms,release:n.release,public_key:r,trace_id:e,org_id:es(t)};return t.emit(`createDsc`,i),i}function Ps(e,t){let n=t.getPropagationContext();return n.dsc||Ns(n.traceId,e)}function Fs(e){let t=X();if(!t)return{};let n=Ss(e),r=_s(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&&Vo(l);if(u)return s(u);let d=Ns(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),Ds()&&(d.sampled=String(bs(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??zo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function Is(e,t=100,n=1/0){try{return Rs(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Ls(e,t=3,n=100*1024){let r=Is(e,t);return Hs(r)>n?Ls(e,t-1,n):r}function Rs(e,t,n=1/0,r=1/0,i=Us()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=zs(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 Rs(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Pa(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]=Rs(e,t,c-1,r,i),d++}return o(t),u}function zs(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(Ea(t))return $i(t);if(wa(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Qi(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 Vs(e){return~-encodeURI(e).split(/%..|./).length}function Hs(e){return Vs(JSON.stringify(e))}function Us(){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 Gs(e,t){let[n,r]=e;return[n,[...r,t]]}function Ks(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 qs(e,t){return Ks(e,(e,n)=>t.includes(n))}function Js(e){let t=Mi(G);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Ys(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Js(r),e]:r.push(typeof e==`string`?Js(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(Is(n))}i(e)}}return typeof r==`string`?r:Xs(r)}function Xs(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 Zs(e){let t=typeof e.data==`string`?Js(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Qs={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 $s(e){return Qs[e]}function ec(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function tc(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:Yo(r)},...i&&{trace:i}}}function nc(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 rc(e,t,n,r){let i=ec(n);return Ws({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Yo(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function ic(e,t,n,r){let i=ec(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;nc(e,n?.sdk);let o=tc(e,i,r,t);return delete e.sdkProcessingMetadata,Ws(o,[[{type:a},e]])}const ac=`__SENTRY_SUPPRESS_TRACING__`,oc=(e,t)=>{let n=jo(ji());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=X(),o=Vo(i);return a&&!ls(a,o?.org_id)?lc(t):No(e=>{let n=as(r,i);return e.setPropagationContext(n),yo(e,void 0),t()})};function sc(e,t){let n=uc();return n.withActiveSpan?n.withActiveSpan(e,t):No(n=>(yo(n,e||void 0),t(n)))}function cc(e){let t=uc();return t.suppressTracing?t.suppressTracing(e):No(t=>{t.setSDKProcessingMetadata({[ac]:!0});let n=e();return t.setSDKProcessingMetadata({[ac]:void 0}),n})}function lc(e){return No(t=>(t.setPropagationContext({traceId:go(),sampleRand:Ba()}),W&&K.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),sc(null,e)))}function uc(){return jo(ji())}function dc(e){return new pc(t=>{t(e)})}function fc(e){return new pc((t,n)=>{n(e)})}var pc=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(Ca(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 mc(e,t,n,r=0){try{let i=hc(t,n,e,r);return Ca(i)?i:dc(i)}catch(e){return fc(e)}}function hc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return W&&a===null&&K.log(`Event processor "${i.id||`?`}" dropped event`),Ca(a)?a.then(e=>hc(e,t,n,r+1)):hc(a,t,n,r+1)}let gc,_c,vc,yc;function bc(e){let t=G._sentryDebugIds,n=G._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(yc&&r.length===_c&&i.length===vc)return yc;_c=r.length,vc=i.length,yc={},gc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=gc?.[r];if(i&&yc&&t)yc[i[0]]=t,gc&&(gc[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&&yc&&gc){yc[i]=t,gc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),yc}function xc(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Tc(e,t),r&&Oc(e,r),kc(e,n),Ec(e,i),Dc(e,a)}function Sc(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;Cc(e,`extra`,n),Cc(e,`tags`,r),Cc(e,`attributes`,i),Cc(e,`user`,a),Cc(e,`contexts`,o),e.sdkProcessingMetadata=ho(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 Cc(e,t,n){e[t]=ho(e[t],n,1)}function wc(e,t){let n=Mo().getScopeData();return e&&Sc(n,e.getScopeData()),t&&Sc(n,t.getScopeData()),n}function Tc(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 Ec(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Dc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Oc(e,t){e.contexts={trace:ds(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Fs(t),...e.sdkProcessingMetadata};let n=_s(Ss(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function kc(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function Ac(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||q(),timestamp:t.timestamp||oo()},l=n.integrations||e.integrations.map(e=>e.name);jc(c,e),Pc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Mc(c,e.stackParser);let u=Ic(r,n.captureContext);n.mechanism&&$a(c,n.mechanism);let d=i?i.getEventProcessors():[],f=wc(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),xc(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?dc(c):mc(m,c,n)).then(e=>(e&&Nc(e),typeof o==`number`&&o>0?Fc(e,o,s):e))}function jc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||Ms,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Ha(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Ha(e.value,a)})}function Mc(e,t){let n=bc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Nc(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 Fc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Is(e.data,t,n)}}))},...e.user&&{user:Is(e.user,t,n)},...e.contexts&&{contexts:Is(e.contexts,t,n)},...e.extra&&{extra:Is(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Is(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Is(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Is(e.contexts.flags,3,n)),r}function Ic(e,t){if(!t)return e;let n=e?e.clone():new xo;return n.update(t),n}function Lc(e){if(e)return Rc(e)||Bc(e)?{captureContext:e}:e}function Rc(e){return e instanceof xo||typeof e==`function`}const zc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Bc(e){return Object.keys(e).some(e=>zc.includes(e))}function Vc(e,t){return J().captureException(e,Lc(t))}function Hc(e,t){Y().setContext(e,t)}function Uc(e,t){Y().setTag(e,t)}function Wc(e){Y().setUser(e)}async function Gc(e){let t=X();return t?t.flush(e):(W&&K.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function Kc(){let e=X();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function qc(e){let t=Y(),{user:n}=wc(t,J()),{userAgent:r}=G.navigator||{},i=uo({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&fo(a,{status:`exited`}),Jc(),t.setSession(i),i}function Jc(){let e=Y(),t=J().getSession()||e.getSession();t&&po(t),Yc(),e.setSession()}function Yc(){let e=Y(),t=X(),n=e.getSession();n&&t&&t.captureSession(n)}function Xc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Zc(e){return`${Xc(e)}${e.projectId}/envelope/`}function Qc(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 $c(e,t,n){return t||`${Zc(e)}?${Qc(e,n)}`}const el=[];function tl(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 nl(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 tl(r)}function rl(e,t){let n={};return t.forEach(t=>{t&&al(e,t,n)}),n}function il(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function al(e,t,n){if(n[t.name]){W&&K.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!el.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),el.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)}W&&K.log(`Integration installed: ${t.name}`)}function Z(e){return e}function ol(e,t){return t?No(t,()=>{let n=Cs(),r=n?ds(n):Fo(t);return[n?Fs(n):Ps(e,t),r]}):[void 0,void 0]}function sl(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function cl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Yo(r)),Ws(i,[sl(e)])}function ll(e,t){let n=t??ul(e)??[];if(n.length===0)return;let r=e.getOptions(),i=cl(n,r._metadata,r.tunnel,e.getDsn());dl().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function ul(e){return dl().get(e)}function dl(){return Ni(`clientToLogBufferMap`,()=>new WeakMap)}function fl(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function pl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Yo(r)),Ws(i,[fl(e)])}function ml(e,t){let n=t??hl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=pl(n,r._metadata,r.tunnel,e.getDsn());gl().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function hl(e){return gl().get(e)}function gl(){return Ni(`clientToMetricBufferMap`,()=>new WeakMap)}function _l(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const vl=Symbol.for(`SentryBufferFullError`);function yl(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return fc(vl);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return dc(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>_l(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function bl(e,t=Va()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function xl(e,t){return e[t]||e.all||0}function Sl(e,t,n=Va()){return xl(e,t)>n}function Cl(e,{statusCode:t,headers:n},r=Va()){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+bl(o,r):t===429&&(i.all=r+60*1e3);return i}function wl(e,t,n=yl(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Ks(i,(t,n)=>{let i=$s(n);Sl(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(qs(o,[`client_report`])){W&&K.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Ks(o,(n,r)=>{e.recordDroppedEvent(t,$s(r))})};return n.add(()=>t({body:Ys(o)}).then(e=>e.statusCode===413?(W&&K.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(W&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&K.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Cl(r,e),e),e=>{throw s(`network_error`),W&&K.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===vl)return W&&K.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Tl(e,t,n){let r=[{type:`client_report`},{timestamp:n||oo(),discarded_events:e}];return Ws(t?{dsn:t}:{},[r])}function El(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 Dl(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?.[Io],exclusive_time:o?.[Lo],measurements:e.measurements,is_segment:!0}}function Ol(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&&{[Io]:e.profile_id},...e.exclusive_time&&{[Lo]:e.exclusive_time}}}},measurements:e.measurements}}const kl=`Not capturing exception because it's already been captured.`,Al=`Discarded session because of missing or non-string release`,jl=Symbol.for(`SentryInternalError`),Ml=Symbol.for(`SentryDoNotSendEventError`);function Nl(e){return{message:e,[jl]:!0}}function Pl(e){return{message:e,[Ml]:!0}}function Fl(e){return!!e&&typeof e==`object`&&jl in e}function Il(e){return!!e&&typeof e==`object`&&Ml in e}function Ll(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=_l(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var Rl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=yl(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=ts(e.dsn):W&&K.warn(`No DSN provided, client will not send events.`),this._dsn){let t=$c(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&&Ll(this,`afterCaptureLog`,`flushLogs`,Gl,ll),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Ll(this,`afterCaptureMetric`,`flushMetrics`,Wl,ml)}captureException(e,t,n){let r=q();if(ro(e))return W&&K.log(kl),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:q(),...n},a=_a(e)?e:String(e),o=va(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=q();if(t?.originalException&&ro(t.originalException))return W&&K.log(kl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=zl(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),fo(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){ll(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];al(this,e,this._integrations),t||il(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=ic(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=Gs(n,Zs(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=Ms}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){W&&K.warn(Al);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){W&&K.warn(Al);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=rc(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}`;W&&K.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 W&&K.error(`Error while sending envelope:`,e),{}}return W&&K.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=rl(this,e),il(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)&&(fo(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a?.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Ac(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:Fo(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ps(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=J(),r=Y()){return W&&Hl(e)&&K.log(`Captured error event \`${El(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{W&&(Il(e)?K.log(e.message):Fl(e)?K.warn(e.message):K.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Ul(e),s=Hl(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:ns(a);if(s&&typeof l==`number`&&Ba()>l)return this.recordDroppedEvent(`sample_rate`,`error`),fc(Pl(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=zl(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:Bl(Vl(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 Il(e)||Fl(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Nl(`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===vl&&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(){W&&K.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){W&&K.log(`No outcomes to send`);return}if(!this._dsn){W&&K.log(`No dsn provided, will not send outcomes`);return}W&&K.log(`Sending outcomes:`,e);let t=Tl(e,this._options.tunnel&&Yo(this._dsn));this.sendEnvelope(t)}};function zl(e){return e===`replay_event`?`replay`:e||`error`}function Bl(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Ca(e))return e.then(e=>{if(!ya(e)&&e!==null)throw Nl(n);return e},e=>{throw Nl(`${t} rejected with ${e}`)});if(!ya(e)&&e!==null)throw Nl(n);return e}function Vl(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(Hl(c)&&i)return i(c,r);if(Ul(c)){if(o||s){let t=Dl(c);if(s?.length&&ks(t,s))return null;if(o){let e=o(t);e?c=ho(n,Ol(e)):ws()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&ks(e,s)){As(n,e);continue}if(o){let n=o(e);n?t.push(n):(ws(),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 Hl(e){return e.type===void 0}function Ul(e){return e.type===`transaction`}function Wl(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Kl(e.attributes)}function Gl(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*ql(e[0]):va(e)?t+=ql(e):t+=100}),t}function ql(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=Yo(i)),t&&(a.trace=t),Ws(a,[Yl(e)])}function Yl(e){return[{type:`check_in`},e]}function Xl(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 Zl(e,t){return e(t.stack||``,1)}function Ql(e){return pa(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function $l(e){return Ql(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function eu(e,t){let n={type:t.name||t.constructor.name,value:$l(t)},r=Zl(e,t);return r.length&&(n.stacktrace={frames:r}),n}function tu(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function nu(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=La(e);if(ha(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=ru(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function ru(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function iu(e,t,n,r){if(pa(n))return[n,void 0];if(t.synthetic=!0,ya(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:Ls(n,t)},a=tu(n);if(a)return[a,i];let o=nu(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 au(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=iu(e,i,n,r),s={exception:{values:[eu(t,a)]}};return o&&(s.extra=o),Qa(s,void 0,void 0),$a(s,i),{...s,event_id:r?.event_id}}function ou(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Zl(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},$a(a,{synthetic:!0}))}if(_a(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 su=class extends Rl{constructor(e){Es(),Xl(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=au(this,this._options.stackParser,e,t);return n.level=`error`,dc(n)}eventFromMessage(e,t=`info`,n){return dc(ou(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return cu(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&cu(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:q();if(!this._isEnabled())return W&&K.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]=ol(this,n);l&&(s.contexts={trace:l});let u=Jl(s,c,this.getSdkMetadata(),o,this.getDsn());return W&&K.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){W&&K.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=yl(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 cu(e){let t=Y().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const lu=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),uu=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function du(e,t){let n=String(e).toLowerCase();return lu.has(n)?!1:uu.has(n)?!0:t?.strict?null:!!e}function fu(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 pu(e){return e.split(/[?#]/,1)[0]}function mu(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function hu(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:Ai})),i.version=Ai)}function gu(e={}){let t=e.client||X();if(!Kc()||!t)return{};let n=jo(ji());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||J(),i=e.span||Cs(),a=i?fs(i):_u(r),o=Ho(i?Fs(i):Ps(t,r));if(!rs.test(a))return K.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?ps(i):vu(r)),s}function _u(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return os(t,r,n)}function vu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return ss(t,r,n)}const yu=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function bu(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return W&&!r&&K.log(yu,e),r;let i=Ka(e,t);return n?.set(e,i),W&&!i&&K.log(yu,e),i}function xu(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Su(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=Cu({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:wu(i),headers:xu(t),cookies:s,data:o}}function Cu({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function wu(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function Tu(e,t){let n=X(),r=Y();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:oo(),...e},s=i?Ii(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let Eu;const Du=new WeakMap,Ou=Z((()=>({name:`FunctionToString`,setupOnce(){Eu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Na(this),n=Du.has(X())&&t!==void 0?t:this;return Eu.apply(n,e)}}catch{}},setup(e){Du.set(e,!0)}}))),ku=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,`vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)`,`Can't find variable: _AutofillCallbackHandler`,/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Au=Z((e={})=>{let t;return{name:`EventFilters`,setup(n){t=ju(e,n.getOptions())},processEvent(n,r,i){return t||=ju(e,i.getOptions()),Mu(n,t)?null:n}}});function ju(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:ku],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Mu(e,t){if(e.type){if(e.type===`transaction`&&Pu(e,t.ignoreTransactions))return W&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Za(e)}`),!0}else{if(Nu(e,t.ignoreErrors))return W&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Za(e)}`),!0;if(zu(e))return W&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Za(e)}`),!0;if(Fu(e,t.denyUrls))return W&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Za(e)}.\nUrl: ${Ru(e)}`),!0;if(!Iu(e,t.allowUrls))return W&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Za(e)}.\nUrl: ${Ru(e)}`),!0}return!1}function Nu(e,t){return t?.length?El(e).some(e=>Ka(e,t)):!1}function Pu(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Ka(n,t):!1}function Fu(e,t){if(!t?.length)return!1;let n=Ru(e);return n?Ka(n,t):!1}function Iu(e,t){if(!t?.length)return!0;let n=Ru(e);return n?Ka(n,t):!0}function Lu(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 Ru(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Lu(t):null}catch{return W&&K.error(`Cannot extract url for event ${Za(e)}`),null}}function zu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Bu(e,t,n,r,i,a){if(!i.exception?.values||!a||!Ta(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=Vu(e,t,r,a.originalException,n,i.exception.values,o,0))}function Vu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(Ta(r[i],Error)){Uu(o,s,r);let a=e(t,r[i]),l=c.length;Wu(a,i,l,s),c=Vu(e,t,n,r[i],i,[a,...c],a,l)}return Hu(r)&&r.errors.forEach((a,l)=>{if(Ta(a,Error)){Uu(o,s,r);let u=e(t,a),d=c.length;Wu(u,`errors[${l}]`,d,s),c=Vu(e,t,n,a,i,[u,...c],u,d)}}),c}function Hu(e){return Array.isArray(e.errors)}function Uu(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...Hu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Wu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const Gu=Z(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){Bu(eu,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 qu=[`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 qu.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Yu(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Xu(e))||null}function Yu(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Xu(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 Zu={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Qu=Z(((e={})=>{let t={...Zu,...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&&$u(e,a,{ipAddress:o},s),e}}}));function $u(e,t,n,r){if(e.request={...e.request,...ed(t,r)},r.ip){let r=t.headers&&Ju(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function ed(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||qu.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 td(e){let t=`console`;ra(t,e),ia(t,nd)}function nd(){`console`in G&&Pi.forEach(function(e){e in G.console&&Aa(G.console,e,function(t){return Fi[e]=t,function(...t){aa(`console`,{args:t,level:e}),Fi[e]?.apply(G.console,t)}})})}function rd(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const id=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function ad(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=id.exec(t);return n?n.slice(1):[]}function od(e){let t=ad(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const sd=Z((e={})=>{let t=new Set(e.levels||Pi);return{name:`Console`,setup(e){td(({args:n,level:r})=>{X()!==e||!t.has(r)||cd(r,n)})}}});function cd(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:rd(e),message:ld(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${ld(e)}`:`Assertion failed`,n.data.arguments=e}else return;Tu(n,{input:t,level:e})}function ld(e){return`util`in G&&typeof G.util.format==`function`?G.util.format(...e):Wa(e,` `)}function ud(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function dd(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 fd(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=ea(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?hd(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:md(o[3]),colno:md(o[4]),in_app:dd(s||``,c)}}if(i.match(t))return{filename:i}}}function pd(e){return[90,fd(e)]}function md(e){return parseInt(e||``,10)||void 0}function hd(e){try{return decodeURI(e)}catch{return}}var gd=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 Q=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var _d=class extends su{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||j.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};hu(n,`node-light`,[`node-core`]),K.log(`Initializing Sentry: process: ${process.pid}, thread: ${Ye?`main`:`worker-${Xe}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{ll(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(()=>{Q&&K.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const vd=Z((e={})=>({name:`ChildProcess`,setup(){Ze.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&yd(t.process,e)}),Ze.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&bd(t.worker,e)})}}));function yd(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&&Tu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Tu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function bd(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Tu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):Vc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const xd=Pe(tt),Sd=Pe(rt),Cd=Z(((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=wd(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 Td()),n.app&&(e.app=Dd()),n.device&&(e.device=Od(n.device)),n.culture){let t=Ed();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=Id()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function wd(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=j.freemem()),e}async function Td(){let e=j.platform();switch(e){case`darwin`:return Nd();case`linux`:return Fd();default:return{name:kd[e]||e,version:j.release()}}}function Ed(){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 Dd(){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 Od(e){let t={},n;try{n=j.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=j.arch(),(e===!0||e.memory)&&(t.memory_size=j.totalmem(),t.free_memory=j.freemem()),e===!0||e.cpu){let e=j.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const kd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},Ad=[{name:`fedora-release`,distros:[`Fedora`]},{name:`redhat-release`,distros:[`Red Hat Linux`,`Centos`]},{name:`redhat_version`,distros:[`Red Hat Linux`]},{name:`SuSE-release`,distros:[`SUSE Linux`]},{name:`lsb-release`,distros:[`Ubuntu Linux`,`Arch Linux`]},{name:`debian_version`,distros:[`Debian`]},{name:`debian_release`,distros:[`Debian`]},{name:`arch-release`,distros:[`Arch Linux`]},{name:`gentoo-release`,distros:[`Gentoo Linux`]},{name:`novell-release`,distros:[`SUSE Linux`]},{name:`alpine-release`,distros:[`Alpine Linux`]}],jd={alpine:e=>e,arch:e=>Md(/distrib_release=(.*)/,e),centos:e=>Md(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Md(/release (..)/,e),mint:e=>Md(/distrib_release=(.*)/,e),red:e=>Md(/release ([^ ]+)/,e),suse:e=>Md(/VERSION = (.*)\n/,e),ubuntu:e=>Md(/distrib_release=(.*)/,e)};function Md(e,t){let n=e.exec(t);return n?n[1]:void 0}async function Nd(){let e={kernel_version:j.release(),name:`Mac OS X`,version:`10.${Number(j.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Ue(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Md(/^ProductName:\s+(.*)$/m,t),e.version=Md(/^ProductVersion:\s+(.*)$/m,t),e.build=Md(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Pd(e){return e.split(` `)[0].toLowerCase()}async function Fd(){let e={kernel_version:j.release(),name:`Linux`};try{let t=await Sd(`/etc`),n=Ad.find(e=>t.includes(e.name));if(!n)return e;let r=(await xd(ze(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(Pd(e))>=0)||i[0],e.version=jd[Pd(e.name)]?.(r)}catch{}return e}function Id(){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 Ld=new gd(10),Rd=new gd(20);function zd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function Bd(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function Vd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function Hd(e,t){let n=Ld.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 Ud(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=Zd(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=Zd(r,t)),n++}return a}function Wd(e,t,n){return new Promise((r,i)=>{let a=$e(e),o=Ge({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){Rd.set(e,1),Q&&K.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]=Ua(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 Gd(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`||Bd(i)||Vd(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(Rd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=Ud(r,t);if(a.every(t=>Hd(e,t)))continue;let o=zd(Ld,e,{});i.push(Wd(e,a,o))}if(await Promise.all(i).catch(()=>{Q&&K.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&&Kd(n.stacktrace.frames,t,Ld);return e}function Kd(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;Jd(r.lineno,r,t,e)}}function qd(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Jd(e,t,n,r){if(t.lineno===void 0||r===void 0){Q&&K.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=Yd(e,n);i<e;i++){let e=r[i];if(e===void 0){qd(t),Q&&K.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){qd(t),Q&&K.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=Xd(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 Yd(e,t){return Math.max(1,e-t)}function Xd(e,t){return e+t}function Zd(e,t){return[Yd(e,t),Xd(e,t)]}const Qd=Z(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return Gd(e,t)}}})),$d=no(process.versions.node),ef=$d.major;$d.minor;let tf;async function nf(){if(tf===void 0)try{tf=!!(await import(`node:inspector`)).url()}catch{tf=!1}return tf}const rf=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function af(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 of(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function sf(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||of(e)&&of(t)}function cf(...e){K.log(`[LocalVariables]`,...e)}const lf=Z(((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||!sf(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&rf in n.originalException&&Array.isArray(n.originalException[rf])){for(let r of e.exception?.values||[])t(r,n.originalException[rf]);n.originalException[rf]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new it(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=>{cf(`Worker error`,e)}),t.once(`exit`,e=>{cf(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await nf()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:K.isEnabled()};r().then(()=>{try{i(n)}catch(e){K.error(`Failed to start worker`,e)}},e=>{K.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function uf(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function df(e,t){if(t!==void 0)return uf(e(t,1))}function ff(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 pf=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}=ff(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 mf=Z(((e={},t)=>{let n=new gd(20),r,i=!1;function a(t){let r=uf(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||!sf(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=X()?.getOptions();if(a?.includeLocalVariables){if(ef<18){K.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await nf()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await pf.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=df(e,i.description);if(c==null){s();return}let{add:l,next:u}=ff(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=af(e.maxExceptionsPerSecond||50,()=>{K.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{K.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){K.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]}}})),hf=(e={})=>$d.major<19?mf(e):lf(e);function gf(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let _f;const vf=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,yf=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...Cf()},e},getModules:Cf}));function bf(){try{return n.cache?Object.keys(n.cache):[]}catch{return[]}}function xf(){return{...vf,...Tf(),...gf()?Sf():{}}}function Sf(){let e=n.main?.paths||[],t=bf(),r={},i=new Set;return t.forEach(t=>{let n=t,a=()=>{let t=n;if(n=Re(t),!n||t===n||i.has(t))return;if(e.indexOf(n)<0)return a();let o=ze(t,`package.json`);if(i.add(t),!et(o))return a();try{let e=JSON.parse(nt(o,`utf8`));r[e.name]=e.version}catch{}};a()}),r}function Cf(){return _f||=xf(),_f}function wf(){try{let e=ze(process.cwd(),`package.json`);return JSON.parse(nt(e,`utf8`))}catch{return{}}}function Tf(){let e=wf();return{...e.dependencies,...e.devDependencies}}function Ef(e){Ii(()=>{console.error(e)});let t=X();if(t===void 0){Q&&K.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||Q&&K.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Q&&K.error(e)})}const Df=Z((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){Ye&&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=Ef;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?(Q&&K.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),Ef(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,X()===e&&Vc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const kf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Af=Z(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...kf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,Pf(e,t))}}}));function jf(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||Ga(t.name,e.name,!0),r=e.message===void 0||Ga(t.message,e.message);return n&&r}function Nf(e,t){let n=jf(t);return e.some(e=>Mf(e,n))}function Pf(e,t){return function(n,r){if(X()!==e||Nf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>sc(a,e):e=>e())(()=>{Vc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),Ff(n,t.mode)}}function Ff(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`?Ii(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(Ii(()=>{console.warn(n)}),Ef(e))}const If=Z(()=>({name:`ProcessSession`,setupOnce(){qc(),process.on(`beforeExit`,()=>{Y().getSession()?.status!==`ok`&&Jc()})}})),Lf=`Spotlight`,Rf=Z(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:Lf,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&K.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}zf(e,t)}}}));function zf(e,t){let n=Bf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){K.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=Ys(e);cc(()=>{let e=Ke.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++,K.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Bf(e){try{return new URL(`${e}`)}catch{K.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function Vf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Me.getSystemErrorMap().has(e.errno)}const Hf=Z((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!Vf(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 Uf(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function Wf(e=process.argv[1]?od(process.argv[1]):process.cwd(),t=Ve===`\\`){let n=t?Uf(e):e;return e=>{if(!e)return;let r=t?Uf(e):e,{dir:i,base:a,ext:o}=Be.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 Gf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(G.SENTRY_RELEASE?.id)return G.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 Kf=qi(pd(Wf())),qf=Symbol(`AgentBaseInternalState`);var Jf=class extends Ke.Agent{constructor(e){super(e),this[qf]={}}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(`
|
|
323
|
-
`).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
|
|
321
|
+
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:n})=>{let[r]=e,{repo:i=await t(),env:a}=n,o=await A(),s=await j(),c=a?await H(a,{repo:i,token:o,host:s}):i,l;try{l=await Fn({repo:c,token:o,host:s})}catch(e){throw e instanceof E?new F(`Failed to fetch webhook details: ${await e.text()}`):e}let u=l.find(e=>e.config.url===r);if(!u)throw new F(`Webhook not found: ${r}`);let{config:d}=u;console.info(`URL: ${d.url}`),console.info(`Name: ${d.name||`(none)`}`),console.info(`Status: ${d.active?`enabled`:`disabled`}`),console.info(`Secret: ${d.secret?`(set)`:`(none)`}`);let f=[];for(let e of Nn)d[e]&&f.push(e);if(console.info(`Triggers: ${f.length>0?f.join(`, `):`(none)`}`),Object.keys(d.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(d.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),Ei=P({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:Si,description:`List all webhooks`},create:{handler:yi,description:`Create a new webhook`},view:{handler:Ti,description:`View webhook details`},remove:{handler:Ci,description:`Delete a webhook`},enable:{handler:xi,description:`Enable a webhook`},disable:{handler:bi,description:`Disable a webhook`},"set-triggers":{handler:wi,description:`Update webhook triggers`}}}),Di=N({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await o({token:await A(),host:await j()});console.info(e.email)});const Oi=Ce({exp:fe(ce())});function ki(e){try{let[,t]=e.split(`.`);return t?ue(Oi,JSON.parse(Buffer.from(t,`base64url`).toString())):void 0}catch{return}}const W=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,G=globalThis,Ai=`10.42.0`;function ji(){return Mi(G),G}function Mi(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Ai,t[Ai]=t[Ai]||{}}function Ni(e,t,n=G){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[Ai]=r[Ai]||{};return i[e]||(i[e]=t())}const Pi=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Fi={};function Ii(e){if(!(`console`in G))return e();let t=G.console,n={},r=Object.keys(Fi);r.forEach(e=>{let r=Fi[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Li(){Wi().enabled=!0}function Ri(){Wi().enabled=!1}function zi(){return Wi().enabled}function Bi(...e){Ui(`log`,...e)}function Vi(...e){Ui(`warn`,...e)}function Hi(...e){Ui(`error`,...e)}function Ui(e,...t){W&&zi()&&Ii(()=>{G.console[e](`Sentry Logger [${e}]:`,...t)})}function Wi(){return W?Ni(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const K={enable:Li,disable:Ri,isEnabled:zi,log:Bi,warn:Vi,error:Hi},Gi=/\(error: (.*)\)/,Ki=/captureMessage|captureException/;function qi(...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(`
|
|
322
|
+
`);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Gi.test(n)?n.replace(Gi,`$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 Yi(i.slice(r))}}function Ji(e){return Array.isArray(e)?qi(...e):e}function Yi(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Xi(t).function||``)&&t.pop(),t.reverse(),Ki.test(Xi(t).function||``)&&(t.pop(),Ki.test(Xi(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Xi(t).filename,function:e.function||`?`}))}function Xi(e){return e[e.length-1]||{}}const Zi=`<anonymous>`;function Qi(e){try{return!e||typeof e!=`function`?Zi:e.name||Zi}catch{return Zi}}function $i(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function ea(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const ta={},na={};function ra(e,t){ta[e]=ta[e]||[],ta[e].push(t)}function ia(e,t){if(!na[e]){na[e]=!0;try{t()}catch(t){W&&K.error(`Error while instrumenting ${e}`,t)}}}function aa(e,t){let n=e&&ta[e];if(n)for(let r of n)try{r(t)}catch(t){W&&K.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Qi(r)}\nError:`,t)}}let oa=null;function sa(e){let t=`error`;ra(t,e),ia(t,ca)}function ca(){oa=G.onerror,G.onerror=function(e,t,n,r,i){return aa(`error`,{column:r,error:i,line:n,msg:e,url:t}),oa?oa.apply(this,arguments):!1},G.onerror.__SENTRY_INSTRUMENTED__=!0}let la=null;function ua(e){let t=`unhandledrejection`;ra(t,e),ia(t,da)}function da(){la=G.onunhandledrejection,G.onunhandledrejection=function(e){return aa(`unhandledrejection`,e),la?la.apply(this,arguments):!0},G.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const fa=Object.prototype.toString;function pa(e){switch(fa.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Ta(e,Error)}}function ma(e,t){return fa.call(e)===`[object ${t}]`}function ha(e){return ma(e,`ErrorEvent`)}function ga(e){return ma(e,`String`)}function _a(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function va(e){return e===null||_a(e)||typeof e!=`object`&&typeof e!=`function`}function ya(e){return ma(e,`Object`)}function ba(e){return typeof Event<`u`&&Ta(e,Event)}function xa(e){return typeof Element<`u`&&Ta(e,Element)}function Sa(e){return ma(e,`RegExp`)}function Ca(e){return!!(e?.then&&typeof e.then==`function`)}function wa(e){return ya(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function Ta(e,t){try{return e instanceof t}catch{return!1}}function Ea(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const Da=G;function Oa(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=ka(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 ka(e,t){let n=e,r=[];if(!n?.tagName)return``;if(Da.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&&ga(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 Aa(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Ma(i,r);try{e[t]=i}catch{W&&K.log(`Failed to replace method "${t}" in object`,e)}}function ja(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{W&&K.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ma(e,t){try{e.prototype=t.prototype=t.prototype||{},ja(e,`__sentry_original__`,t)}catch{}}function Na(e){return e.__sentry_original__}function Pa(e){if(pa(e))return{message:e.message,name:e.name,stack:e.stack,...Ia(e)};if(ba(e)){let t={type:e.type,target:Fa(e.target),currentTarget:Fa(e.currentTarget),...Ia(e)};return typeof CustomEvent<`u`&&Ta(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Fa(e){try{return xa(e)?Oa(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Ia(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 La(e){let t=Object.keys(Pa(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let Ra;function za(e){if(Ra!==void 0)return Ra?Ra(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=G;return t in n&&typeof n[t]==`function`?(Ra=n[t],Ra(e)):(Ra=null,e())}function Ba(){return za(()=>Math.random())}function Va(){return za(()=>Date.now())}function Ha(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Ua(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 Wa(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{Ea(r)?n.push($i(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function Ga(e,t,n=!1){return ga(e)?Sa(t)?t.test(e):ga(t)?n?e===t:e.includes(t):!1:!1}function Ka(e,t=[],n=!1){return t.some(t=>Ga(e,t,n))}function qa(){let e=G;return e.crypto||e.msCrypto}let Ja;function Ya(){return Ba()*16}function q(e=qa()){try{if(e?.randomUUID)return za(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Ja||=`10000000100040008000100000000000`,Ja.replace(/[018]/g,e=>(e^(Ya()&15)>>e/4).toString(16))}function Xa(e){return e.exception?.values?.[0]}function Za(e){let{message:t,event_id:n}=e;if(t)return t;let r=Xa(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Qa(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 $a(e,t){let n=Xa(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 eo=/^(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 to(e){return parseInt(e||``,10)}function no(e){let t=e.match(eo)||[],n=to(t[1]),r=to(t[2]),i=to(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 ro(e){if(io(e))return!0;try{ja(e,`__sentry_captured__`,!0)}catch{}return!1}function io(e){try{return e.__sentry_captured__}catch{}}const ao=1e3;function oo(){return Va()/ao}function so(){let{performance:e}=G;if(!e?.now||!e.timeOrigin)return oo;let t=e.timeOrigin;return()=>(t+za(()=>e.now()))/ao}let co;function lo(){return(co??=so())()}function uo(e){let t=lo(),n={sid:q(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>mo(n)};return e&&fo(n,e),n}function fo(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||lo(),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:q()),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 po(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),fo(e,n)}function mo(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 ho(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]=ho(r[e],t[e],n-1));return r}function go(){return q()}function _o(){return q().substring(16)}const vo=`_sentrySpan`;function yo(e,t){t?ja(e,vo,t):delete e[vo]}function bo(e){return e[vo]}var xo=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:go(),sampleRand:Ba()}}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,yo(t,bo(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&&fo(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():ya(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,yo(this,void 0),this._attachments=[],this.setPropagationContext({traceId:go(),sampleRand:Ba()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:oo(),...e,message:e.message?Ha(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:bo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ho(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||q();if(!this._client)return W&&K.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||q();if(!this._client)return W&&K.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||q();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(W&&K.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 Ni(`defaultCurrentScope`,()=>new xo)}function Co(){return Ni(`defaultIsolationScope`,()=>new xo)}var wo=class{constructor(e,t){let n;n=e||new xo;let r;r=t||new xo,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 Ca(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 To(){let e=Mi(ji());return e.stack=e.stack||new wo(So(),Co())}function Eo(e){return To().withScope(e)}function Do(e,t){let n=To();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Oo(e){return To().withScope(()=>e(To().getIsolationScope()))}function ko(){return{withIsolationScope:Oo,withScope:Eo,withSetScope:Do,withSetIsolationScope:(e,t)=>Oo(t),getCurrentScope:()=>To().getScope(),getIsolationScope:()=>To().getIsolationScope()}}function Ao(e){let t=Mi(ji());t.acs=e}function jo(e){let t=Mi(e);return t.acs?t.acs:ko()}function J(){return jo(ji()).getCurrentScope()}function Y(){return jo(ji()).getIsolationScope()}function Mo(){return Ni(`globalScope`,()=>new xo)}function No(...e){let t=jo(ji());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Po(...e){let t=jo(ji());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function X(){return J().getClient()}function Fo(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||_o()};return n&&(i.parent_span_id=n),i}const Io=`sentry.profile_id`,Lo=`sentry.exclusive_time`;function Ro(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function zo(e){let t=e;return{scope:t._sentryScope,isolationScope:Ro(t._sentryIsolationScope)}}const Bo=/^sentry-/;function Vo(e){let t=Uo(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(Bo)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Ho(e){if(e)return Go(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function Uo(e){if(!(!e||!ga(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=Wo(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Wo(e)}function Wo(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 Go(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?(W&&K.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const Ko=/^o(\d+)\./,qo=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Jo(e){return e===`http`||e===`https`}function Yo(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 Xo(e){let t=qo.exec(e);if(!t){Ii(()=>{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 Zo({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Zo(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Qo(e){if(!W)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(K.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?Jo(r)?t&&isNaN(parseInt(t,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function $o(e){return e.match(Ko)?.[1]}function es(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=$o(n)),r}function ts(e){let t=typeof e==`string`?Xo(e):Zo(e);if(!(!t||!Qo(t)))return t}function ns(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 rs=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function is(e){if(!e)return;let t=e.match(rs);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 as(e,t){let n=is(e),r=Vo(t);if(!n?.traceId)return{traceId:go(),sampleRand:Ba()};let i=cs(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 os(e=go(),t=_o(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function ss(e=go(),t=_o(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function cs(e,t){let n=ns(t?.sample_rand);if(n!==void 0)return n;let r=ns(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?Ba()*r:r+Ba()*(1-r):Ba()}function ls(e,t){let n=es(e);return t&&n&&t!==n?(K.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)?(K.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 us=!1;function ds(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:_s(e).parent_span_id,a=zo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||_o():t,trace_id:n}}function fs(e){let{traceId:t,spanId:n}=e.spanContext();return os(t,n,bs(e))}function ps(e){let{traceId:t,spanId:n}=e.spanContext();return ss(t,n,bs(e))}function ms(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 hs(e){return typeof e==`number`?gs(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?gs(e.getTime()):lo()}function gs(e){return e>9999999999?e/1e3:e}function _s(e){if(ys(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(vs(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:hs(i),timestamp:hs(o)||void 0,status:xs(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:ms(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function vs(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function ys(e){return typeof e.getSpanJSON==`function`}function bs(e){let{traceFlags:t}=e.spanContext();return t===1}function xs(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=jo(ji());return e.getActiveSpan?e.getActiveSpan():bo(J())}function ws(){us||=(Ii(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let Ts=!1;function Es(){if(Ts)return;function e(){let e=Cs(),t=e&&Ss(e);if(t){let e=`internal_error`;W&&K.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,Ts=!0,sa(e),ua(e)}function Ds(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||X()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Os(e){K.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ks(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(js(n)){if(Ga(e.description,n))return W&&Os(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?Ga(e.description,n.name):!0,r=n.op?e.op&&Ga(e.op,n.op):!0;if(t&&r)return W&&Os(e),!0}return!1}function As(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 js(e){return typeof e==`string`||e instanceof RegExp}const Ms=`production`;function Ns(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Ms,release:n.release,public_key:r,trace_id:e,org_id:es(t)};return t.emit(`createDsc`,i),i}function Ps(e,t){let n=t.getPropagationContext();return n.dsc||Ns(n.traceId,e)}function Fs(e){let t=X();if(!t)return{};let n=Ss(e),r=_s(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&&Vo(l);if(u)return s(u);let d=Ns(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),Ds()&&(d.sampled=String(bs(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??zo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function Is(e,t=100,n=1/0){try{return Rs(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Ls(e,t=3,n=100*1024){let r=Is(e,t);return Hs(r)>n?Ls(e,t-1,n):r}function Rs(e,t,n=1/0,r=1/0,i=Us()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=zs(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 Rs(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Pa(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]=Rs(e,t,c-1,r,i),d++}return o(t),u}function zs(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(Ea(t))return $i(t);if(wa(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Qi(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 Vs(e){return~-encodeURI(e).split(/%..|./).length}function Hs(e){return Vs(JSON.stringify(e))}function Us(){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 Gs(e,t){let[n,r]=e;return[n,[...r,t]]}function Ks(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 qs(e,t){return Ks(e,(e,n)=>t.includes(n))}function Js(e){let t=Mi(G);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Ys(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Js(r),e]:r.push(typeof e==`string`?Js(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(Is(n))}i(e)}}return typeof r==`string`?r:Xs(r)}function Xs(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 Zs(e){let t=typeof e.data==`string`?Js(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Qs={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 $s(e){return Qs[e]}function ec(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function tc(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:Yo(r)},...i&&{trace:i}}}function nc(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 rc(e,t,n,r){let i=ec(n);return Ws({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Yo(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function ic(e,t,n,r){let i=ec(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;nc(e,n?.sdk);let o=tc(e,i,r,t);return delete e.sdkProcessingMetadata,Ws(o,[[{type:a},e]])}const ac=`__SENTRY_SUPPRESS_TRACING__`,oc=(e,t)=>{let n=jo(ji());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=X(),o=Vo(i);return a&&!ls(a,o?.org_id)?lc(t):No(e=>{let n=as(r,i);return e.setPropagationContext(n),yo(e,void 0),t()})};function sc(e,t){let n=uc();return n.withActiveSpan?n.withActiveSpan(e,t):No(n=>(yo(n,e||void 0),t(n)))}function cc(e){let t=uc();return t.suppressTracing?t.suppressTracing(e):No(t=>{t.setSDKProcessingMetadata({[ac]:!0});let n=e();return t.setSDKProcessingMetadata({[ac]:void 0}),n})}function lc(e){return No(t=>(t.setPropagationContext({traceId:go(),sampleRand:Ba()}),W&&K.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),sc(null,e)))}function uc(){return jo(ji())}function dc(e){return new pc(t=>{t(e)})}function fc(e){return new pc((t,n)=>{n(e)})}var pc=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(Ca(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 mc(e,t,n,r=0){try{let i=hc(t,n,e,r);return Ca(i)?i:dc(i)}catch(e){return fc(e)}}function hc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return W&&a===null&&K.log(`Event processor "${i.id||`?`}" dropped event`),Ca(a)?a.then(e=>hc(e,t,n,r+1)):hc(a,t,n,r+1)}let gc,_c,vc,yc;function bc(e){let t=G._sentryDebugIds,n=G._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(yc&&r.length===_c&&i.length===vc)return yc;_c=r.length,vc=i.length,yc={},gc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=gc?.[r];if(i&&yc&&t)yc[i[0]]=t,gc&&(gc[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&&yc&&gc){yc[i]=t,gc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),yc}function xc(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Tc(e,t),r&&Oc(e,r),kc(e,n),Ec(e,i),Dc(e,a)}function Sc(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;Cc(e,`extra`,n),Cc(e,`tags`,r),Cc(e,`attributes`,i),Cc(e,`user`,a),Cc(e,`contexts`,o),e.sdkProcessingMetadata=ho(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 Cc(e,t,n){e[t]=ho(e[t],n,1)}function wc(e,t){let n=Mo().getScopeData();return e&&Sc(n,e.getScopeData()),t&&Sc(n,t.getScopeData()),n}function Tc(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 Ec(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Dc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Oc(e,t){e.contexts={trace:ds(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Fs(t),...e.sdkProcessingMetadata};let n=_s(Ss(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function kc(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function Ac(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||q(),timestamp:t.timestamp||oo()},l=n.integrations||e.integrations.map(e=>e.name);jc(c,e),Pc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Mc(c,e.stackParser);let u=Ic(r,n.captureContext);n.mechanism&&$a(c,n.mechanism);let d=i?i.getEventProcessors():[],f=wc(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),xc(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?dc(c):mc(m,c,n)).then(e=>(e&&Nc(e),typeof o==`number`&&o>0?Fc(e,o,s):e))}function jc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||Ms,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Ha(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Ha(e.value,a)})}function Mc(e,t){let n=bc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Nc(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 Fc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Is(e.data,t,n)}}))},...e.user&&{user:Is(e.user,t,n)},...e.contexts&&{contexts:Is(e.contexts,t,n)},...e.extra&&{extra:Is(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Is(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Is(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Is(e.contexts.flags,3,n)),r}function Ic(e,t){if(!t)return e;let n=e?e.clone():new xo;return n.update(t),n}function Lc(e){if(e)return Rc(e)||Bc(e)?{captureContext:e}:e}function Rc(e){return e instanceof xo||typeof e==`function`}const zc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Bc(e){return Object.keys(e).some(e=>zc.includes(e))}function Vc(e,t){return J().captureException(e,Lc(t))}function Hc(e,t){Y().setContext(e,t)}function Uc(e,t){Y().setTag(e,t)}function Wc(e){Y().setUser(e)}async function Gc(e){let t=X();return t?t.flush(e):(W&&K.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function Kc(){let e=X();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function qc(e){let t=Y(),{user:n}=wc(t,J()),{userAgent:r}=G.navigator||{},i=uo({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&fo(a,{status:`exited`}),Jc(),t.setSession(i),i}function Jc(){let e=Y(),t=J().getSession()||e.getSession();t&&po(t),Yc(),e.setSession()}function Yc(){let e=Y(),t=X(),n=e.getSession();n&&t&&t.captureSession(n)}function Xc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Zc(e){return`${Xc(e)}${e.projectId}/envelope/`}function Qc(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 $c(e,t,n){return t||`${Zc(e)}?${Qc(e,n)}`}const el=[];function tl(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 nl(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 tl(r)}function rl(e,t){let n={};return t.forEach(t=>{t&&al(e,t,n)}),n}function il(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function al(e,t,n){if(n[t.name]){W&&K.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!el.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),el.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)}W&&K.log(`Integration installed: ${t.name}`)}function Z(e){return e}function ol(e,t){return t?No(t,()=>{let n=Cs(),r=n?ds(n):Fo(t);return[n?Fs(n):Ps(e,t),r]}):[void 0,void 0]}function sl(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function cl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Yo(r)),Ws(i,[sl(e)])}function ll(e,t){let n=t??ul(e)??[];if(n.length===0)return;let r=e.getOptions(),i=cl(n,r._metadata,r.tunnel,e.getDsn());dl().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function ul(e){return dl().get(e)}function dl(){return Ni(`clientToLogBufferMap`,()=>new WeakMap)}function fl(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function pl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Yo(r)),Ws(i,[fl(e)])}function ml(e,t){let n=t??hl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=pl(n,r._metadata,r.tunnel,e.getDsn());gl().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function hl(e){return gl().get(e)}function gl(){return Ni(`clientToMetricBufferMap`,()=>new WeakMap)}function _l(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const vl=Symbol.for(`SentryBufferFullError`);function yl(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return fc(vl);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return dc(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>_l(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function bl(e,t=Va()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function xl(e,t){return e[t]||e.all||0}function Sl(e,t,n=Va()){return xl(e,t)>n}function Cl(e,{statusCode:t,headers:n},r=Va()){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+bl(o,r):t===429&&(i.all=r+60*1e3);return i}function wl(e,t,n=yl(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Ks(i,(t,n)=>{let i=$s(n);Sl(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(qs(o,[`client_report`])){W&&K.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Ks(o,(n,r)=>{e.recordDroppedEvent(t,$s(r))})};return n.add(()=>t({body:Ys(o)}).then(e=>e.statusCode===413?(W&&K.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(W&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&K.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Cl(r,e),e),e=>{throw s(`network_error`),W&&K.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===vl)return W&&K.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Tl(e,t,n){let r=[{type:`client_report`},{timestamp:n||oo(),discarded_events:e}];return Ws(t?{dsn:t}:{},[r])}function El(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 Dl(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?.[Io],exclusive_time:o?.[Lo],measurements:e.measurements,is_segment:!0}}function Ol(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&&{[Io]:e.profile_id},...e.exclusive_time&&{[Lo]:e.exclusive_time}}}},measurements:e.measurements}}const kl=`Not capturing exception because it's already been captured.`,Al=`Discarded session because of missing or non-string release`,jl=Symbol.for(`SentryInternalError`),Ml=Symbol.for(`SentryDoNotSendEventError`);function Nl(e){return{message:e,[jl]:!0}}function Pl(e){return{message:e,[Ml]:!0}}function Fl(e){return!!e&&typeof e==`object`&&jl in e}function Il(e){return!!e&&typeof e==`object`&&Ml in e}function Ll(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=_l(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var Rl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=yl(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=ts(e.dsn):W&&K.warn(`No DSN provided, client will not send events.`),this._dsn){let t=$c(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&&Ll(this,`afterCaptureLog`,`flushLogs`,Gl,ll),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Ll(this,`afterCaptureMetric`,`flushMetrics`,Wl,ml)}captureException(e,t,n){let r=q();if(ro(e))return W&&K.log(kl),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:q(),...n},a=_a(e)?e:String(e),o=va(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=q();if(t?.originalException&&ro(t.originalException))return W&&K.log(kl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=zl(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),fo(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){ll(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];al(this,e,this._integrations),t||il(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=ic(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=Gs(n,Zs(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=Ms}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){W&&K.warn(Al);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){W&&K.warn(Al);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=rc(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}`;W&&K.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 W&&K.error(`Error while sending envelope:`,e),{}}return W&&K.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=rl(this,e),il(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)&&(fo(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a?.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Ac(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:Fo(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ps(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=J(),r=Y()){return W&&Hl(e)&&K.log(`Captured error event \`${El(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{W&&(Il(e)?K.log(e.message):Fl(e)?K.warn(e.message):K.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Ul(e),s=Hl(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:ns(a);if(s&&typeof l==`number`&&Ba()>l)return this.recordDroppedEvent(`sample_rate`,`error`),fc(Pl(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=zl(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:Bl(Vl(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 Il(e)||Fl(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Nl(`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===vl&&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(){W&&K.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){W&&K.log(`No outcomes to send`);return}if(!this._dsn){W&&K.log(`No dsn provided, will not send outcomes`);return}W&&K.log(`Sending outcomes:`,e);let t=Tl(e,this._options.tunnel&&Yo(this._dsn));this.sendEnvelope(t)}};function zl(e){return e===`replay_event`?`replay`:e||`error`}function Bl(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Ca(e))return e.then(e=>{if(!ya(e)&&e!==null)throw Nl(n);return e},e=>{throw Nl(`${t} rejected with ${e}`)});if(!ya(e)&&e!==null)throw Nl(n);return e}function Vl(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(Hl(c)&&i)return i(c,r);if(Ul(c)){if(o||s){let t=Dl(c);if(s?.length&&ks(t,s))return null;if(o){let e=o(t);e?c=ho(n,Ol(e)):ws()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&ks(e,s)){As(n,e);continue}if(o){let n=o(e);n?t.push(n):(ws(),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 Hl(e){return e.type===void 0}function Ul(e){return e.type===`transaction`}function Wl(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Kl(e.attributes)}function Gl(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*ql(e[0]):va(e)?t+=ql(e):t+=100}),t}function ql(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=Yo(i)),t&&(a.trace=t),Ws(a,[Yl(e)])}function Yl(e){return[{type:`check_in`},e]}function Xl(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 Zl(e,t){return e(t.stack||``,1)}function Ql(e){return pa(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function $l(e){return Ql(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function eu(e,t){let n={type:t.name||t.constructor.name,value:$l(t)},r=Zl(e,t);return r.length&&(n.stacktrace={frames:r}),n}function tu(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function nu(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=La(e);if(ha(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=ru(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function ru(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function iu(e,t,n,r){if(pa(n))return[n,void 0];if(t.synthetic=!0,ya(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:Ls(n,t)},a=tu(n);if(a)return[a,i];let o=nu(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 au(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=iu(e,i,n,r),s={exception:{values:[eu(t,a)]}};return o&&(s.extra=o),Qa(s,void 0,void 0),$a(s,i),{...s,event_id:r?.event_id}}function ou(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Zl(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},$a(a,{synthetic:!0}))}if(_a(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 su=class extends Rl{constructor(e){Es(),Xl(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=au(this,this._options.stackParser,e,t);return n.level=`error`,dc(n)}eventFromMessage(e,t=`info`,n){return dc(ou(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return cu(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&cu(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:q();if(!this._isEnabled())return W&&K.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]=ol(this,n);l&&(s.contexts={trace:l});let u=Jl(s,c,this.getSdkMetadata(),o,this.getDsn());return W&&K.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){W&&K.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=yl(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 cu(e){let t=Y().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const lu=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),uu=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function du(e,t){let n=String(e).toLowerCase();return lu.has(n)?!1:uu.has(n)?!0:t?.strict?null:!!e}function fu(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 pu(e){return e.split(/[?#]/,1)[0]}function mu(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function hu(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:Ai})),i.version=Ai)}function gu(e={}){let t=e.client||X();if(!Kc()||!t)return{};let n=jo(ji());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||J(),i=e.span||Cs(),a=i?fs(i):_u(r),o=Ho(i?Fs(i):Ps(t,r));if(!rs.test(a))return K.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?ps(i):vu(r)),s}function _u(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return os(t,r,n)}function vu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return ss(t,r,n)}const yu=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function bu(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return W&&!r&&K.log(yu,e),r;let i=Ka(e,t);return n?.set(e,i),W&&!i&&K.log(yu,e),i}function xu(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Su(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=Cu({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:wu(i),headers:xu(t),cookies:s,data:o}}function Cu({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function wu(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function Tu(e,t){let n=X(),r=Y();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:oo(),...e},s=i?Ii(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let Eu;const Du=new WeakMap,Ou=Z((()=>({name:`FunctionToString`,setupOnce(){Eu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Na(this),n=Du.has(X())&&t!==void 0?t:this;return Eu.apply(n,e)}}catch{}},setup(e){Du.set(e,!0)}}))),ku=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,`vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)`,`Can't find variable: _AutofillCallbackHandler`,/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Au=Z((e={})=>{let t;return{name:`EventFilters`,setup(n){t=ju(e,n.getOptions())},processEvent(n,r,i){return t||=ju(e,i.getOptions()),Mu(n,t)?null:n}}});function ju(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:ku],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Mu(e,t){if(e.type){if(e.type===`transaction`&&Pu(e,t.ignoreTransactions))return W&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Za(e)}`),!0}else{if(Nu(e,t.ignoreErrors))return W&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Za(e)}`),!0;if(zu(e))return W&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Za(e)}`),!0;if(Fu(e,t.denyUrls))return W&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Za(e)}.\nUrl: ${Ru(e)}`),!0;if(!Iu(e,t.allowUrls))return W&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Za(e)}.\nUrl: ${Ru(e)}`),!0}return!1}function Nu(e,t){return t?.length?El(e).some(e=>Ka(e,t)):!1}function Pu(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Ka(n,t):!1}function Fu(e,t){if(!t?.length)return!1;let n=Ru(e);return n?Ka(n,t):!1}function Iu(e,t){if(!t?.length)return!0;let n=Ru(e);return n?Ka(n,t):!0}function Lu(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 Ru(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Lu(t):null}catch{return W&&K.error(`Cannot extract url for event ${Za(e)}`),null}}function zu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Bu(e,t,n,r,i,a){if(!i.exception?.values||!a||!Ta(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=Vu(e,t,r,a.originalException,n,i.exception.values,o,0))}function Vu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(Ta(r[i],Error)){Uu(o,s,r);let a=e(t,r[i]),l=c.length;Wu(a,i,l,s),c=Vu(e,t,n,r[i],i,[a,...c],a,l)}return Hu(r)&&r.errors.forEach((a,l)=>{if(Ta(a,Error)){Uu(o,s,r);let u=e(t,a),d=c.length;Wu(u,`errors[${l}]`,d,s),c=Vu(e,t,n,a,i,[u,...c],u,d)}}),c}function Hu(e){return Array.isArray(e.errors)}function Uu(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...Hu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Wu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const Gu=Z(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){Bu(eu,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 qu=[`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 qu.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Yu(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Xu(e))||null}function Yu(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Xu(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 Zu={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Qu=Z(((e={})=>{let t={...Zu,...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&&$u(e,a,{ipAddress:o},s),e}}}));function $u(e,t,n,r){if(e.request={...e.request,...ed(t,r)},r.ip){let r=t.headers&&Ju(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function ed(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||qu.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 td(e){let t=`console`;ra(t,e),ia(t,nd)}function nd(){`console`in G&&Pi.forEach(function(e){e in G.console&&Aa(G.console,e,function(t){return Fi[e]=t,function(...t){aa(`console`,{args:t,level:e}),Fi[e]?.apply(G.console,t)}})})}function rd(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const id=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function ad(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=id.exec(t);return n?n.slice(1):[]}function od(e){let t=ad(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const sd=Z((e={})=>{let t=new Set(e.levels||Pi);return{name:`Console`,setup(e){td(({args:n,level:r})=>{X()!==e||!t.has(r)||cd(r,n)})}}});function cd(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:rd(e),message:ld(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${ld(e)}`:`Assertion failed`,n.data.arguments=e}else return;Tu(n,{input:t,level:e})}function ld(e){return`util`in G&&typeof G.util.format==`function`?G.util.format(...e):Wa(e,` `)}function ud(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function dd(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 fd(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=ea(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?hd(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:md(o[3]),colno:md(o[4]),in_app:dd(s||``,c)}}if(i.match(t))return{filename:i}}}function pd(e){return[90,fd(e)]}function md(e){return parseInt(e||``,10)||void 0}function hd(e){try{return decodeURI(e)}catch{return}}var gd=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 Q=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var _d=class extends su{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||M.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};hu(n,`node-light`,[`node-core`]),K.log(`Initializing Sentry: process: ${process.pid}, thread: ${nt?`main`:`worker-${rt}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{ll(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(()=>{Q&&K.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const vd=Z((e={})=>({name:`ChildProcess`,setup(){it.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&yd(t.process,e)}),it.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&bd(t.worker,e)})}}));function yd(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&&Tu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Tu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function bd(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Tu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):Vc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const xd=Be(ct),Sd=Be(ut),Cd=Z(((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=wd(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 Td()),n.app&&(e.app=Dd()),n.device&&(e.device=Od(n.device)),n.culture){let t=Ed();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=Id()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function wd(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=M.freemem()),e}async function Td(){let e=M.platform();switch(e){case`darwin`:return Nd();case`linux`:return Fd();default:return{name:kd[e]||e,version:M.release()}}}function Ed(){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 Dd(){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 Od(e){let t={},n;try{n=M.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=M.arch(),(e===!0||e.memory)&&(t.memory_size=M.totalmem(),t.free_memory=M.freemem()),e===!0||e.cpu){let e=M.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const kd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},Ad=[{name:`fedora-release`,distros:[`Fedora`]},{name:`redhat-release`,distros:[`Red Hat Linux`,`Centos`]},{name:`redhat_version`,distros:[`Red Hat Linux`]},{name:`SuSE-release`,distros:[`SUSE Linux`]},{name:`lsb-release`,distros:[`Ubuntu Linux`,`Arch Linux`]},{name:`debian_version`,distros:[`Debian`]},{name:`debian_release`,distros:[`Debian`]},{name:`arch-release`,distros:[`Arch Linux`]},{name:`gentoo-release`,distros:[`Gentoo Linux`]},{name:`novell-release`,distros:[`SUSE Linux`]},{name:`alpine-release`,distros:[`Alpine Linux`]}],jd={alpine:e=>e,arch:e=>Md(/distrib_release=(.*)/,e),centos:e=>Md(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Md(/release (..)/,e),mint:e=>Md(/distrib_release=(.*)/,e),red:e=>Md(/release ([^ ]+)/,e),suse:e=>Md(/VERSION = (.*)\n/,e),ubuntu:e=>Md(/distrib_release=(.*)/,e)};function Md(e,t){let n=e.exec(t);return n?n[1]:void 0}async function Nd(){let e={kernel_version:M.release(),name:`Mac OS X`,version:`10.${Number(M.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Xe(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Md(/^ProductName:\s+(.*)$/m,t),e.version=Md(/^ProductVersion:\s+(.*)$/m,t),e.build=Md(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Pd(e){return e.split(` `)[0].toLowerCase()}async function Fd(){let e={kernel_version:M.release(),name:`Linux`};try{let t=await Sd(`/etc`),n=Ad.find(e=>t.includes(e.name));if(!n)return e;let r=(await xd(Ke(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(Pd(e))>=0)||i[0],e.version=jd[Pd(e.name)]?.(r)}catch{}return e}function Id(){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 Ld=new gd(10),Rd=new gd(20);function zd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function Bd(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function Vd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function Hd(e,t){let n=Ld.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 Ud(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=Zd(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=Zd(r,t)),n++}return a}function Wd(e,t,n){return new Promise((r,i)=>{let a=ot(e),o=Qe({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){Rd.set(e,1),Q&&K.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]=Ua(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 Gd(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`||Bd(i)||Vd(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(Rd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=Ud(r,t);if(a.every(t=>Hd(e,t)))continue;let o=zd(Ld,e,{});i.push(Wd(e,a,o))}if(await Promise.all(i).catch(()=>{Q&&K.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&&Kd(n.stacktrace.frames,t,Ld);return e}function Kd(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;Jd(r.lineno,r,t,e)}}function qd(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Jd(e,t,n,r){if(t.lineno===void 0||r===void 0){Q&&K.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=Yd(e,n);i<e;i++){let e=r[i];if(e===void 0){qd(t),Q&&K.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){qd(t),Q&&K.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=Xd(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 Yd(e,t){return Math.max(1,e-t)}function Xd(e,t){return e+t}function Zd(e,t){return[Yd(e,t),Xd(e,t)]}const Qd=Z(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return Gd(e,t)}}})),$d=no(process.versions.node),ef=$d.major;$d.minor;let tf;async function nf(){if(tf===void 0)try{tf=!!(await import(`node:inspector`)).url()}catch{tf=!1}return tf}const rf=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function af(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 of(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function sf(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||of(e)&&of(t)}function cf(...e){K.log(`[LocalVariables]`,...e)}const lf=Z(((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||!sf(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&rf in n.originalException&&Array.isArray(n.originalException[rf])){for(let r of e.exception?.values||[])t(r,n.originalException[rf]);n.originalException[rf]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new dt(new URL(`data:application/javascript;base64,LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQyLjAgKDA3YzkxOTApIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{cf(`Worker error`,e)}),t.once(`exit`,e=>{cf(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await nf()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:K.isEnabled()};r().then(()=>{try{i(n)}catch(e){K.error(`Failed to start worker`,e)}},e=>{K.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function uf(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function df(e,t){if(t!==void 0)return uf(e(t,1))}function ff(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 pf=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}=ff(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 mf=Z(((e={},t)=>{let n=new gd(20),r,i=!1;function a(t){let r=uf(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||!sf(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=X()?.getOptions();if(a?.includeLocalVariables){if(ef<18){K.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await nf()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await pf.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=df(e,i.description);if(c==null){s();return}let{add:l,next:u}=ff(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=af(e.maxExceptionsPerSecond||50,()=>{K.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{K.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){K.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]}}})),hf=(e={})=>$d.major<19?mf(e):lf(e);function gf(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let _f;const vf=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,yf=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...Cf()},e},getModules:Cf}));function bf(){try{return r.cache?Object.keys(r.cache):[]}catch{return[]}}function xf(){return{...vf,...Tf(),...gf()?Sf():{}}}function Sf(){let e=r.main?.paths||[],t=bf(),n={},i=new Set;return t.forEach(t=>{let r=t,a=()=>{let t=r;if(r=Ge(t),!r||t===r||i.has(t))return;if(e.indexOf(r)<0)return a();let o=Ke(t,`package.json`);if(i.add(t),!st(o))return a();try{let e=JSON.parse(lt(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function Cf(){return _f||=xf(),_f}function wf(){try{let e=Ke(process.cwd(),`package.json`);return JSON.parse(lt(e,`utf8`))}catch{return{}}}function Tf(){let e=wf();return{...e.dependencies,...e.devDependencies}}function Ef(e){Ii(()=>{console.error(e)});let t=X();if(t===void 0){Q&&K.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||Q&&K.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Q&&K.error(e)})}const Df=Z((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){nt&&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=Ef;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?(Q&&K.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),Ef(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,X()===e&&Vc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const kf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Af=Z(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...kf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,Pf(e,t))}}}));function jf(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||Ga(t.name,e.name,!0),r=e.message===void 0||Ga(t.message,e.message);return n&&r}function Nf(e,t){let n=jf(t);return e.some(e=>Mf(e,n))}function Pf(e,t){return function(n,r){if(X()!==e||Nf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>sc(a,e):e=>e())(()=>{Vc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),Ff(n,t.mode)}}function Ff(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`?Ii(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(Ii(()=>{console.warn(n)}),Ef(e))}const If=Z(()=>({name:`ProcessSession`,setupOnce(){qc(),process.on(`beforeExit`,()=>{Y().getSession()?.status!==`ok`&&Jc()})}})),Lf=`Spotlight`,Rf=Z(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:Lf,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&K.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}zf(e,t)}}}));function zf(e,t){let n=Bf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){K.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=Ys(e);cc(()=>{let e=$e.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++,K.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Bf(e){try{return new URL(`${e}`)}catch{K.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function Vf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Re.getSystemErrorMap().has(e.errno)}const Hf=Z((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!Vf(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 Uf(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function Wf(e=process.argv[1]?od(process.argv[1]):process.cwd(),t=Je===`\\`){let n=t?Uf(e):e;return e=>{if(!e)return;let r=t?Uf(e):e,{dir:i,base:a,ext:o}=qe.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 Gf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(G.SENTRY_RELEASE?.id)return G.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 Kf=qi(pd(Wf())),qf=Symbol(`AgentBaseInternalState`);var Jf=class extends $e.Agent{constructor(e){super(e),this[qf]={}}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(`
|
|
323
|
+
`).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 $e.Agent)return i.addRequest(e,r);this[qf].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[qf].currentSocket;if(this[qf].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[qf].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[qf]&&(this[qf].defaultPort=e)}get protocol(){return this[qf].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[qf]&&(this[qf].protocol=e)}};function Yf(...e){K.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function Xf(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(),Yf(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),Yf(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
|
|
324
324
|
\r
|
|
325
325
|
`);if(l===-1){Yf(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
|
|
326
|
-
`),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}Yf(`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 Zf(...e){K.log(`[https-proxy-agent]`,...e)}var Qf=class extends Jf{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??{},Zf(`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?ep(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:`){Zf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=ct.connect({...this.connectOpts,servername:e&&st.isIP(e)?void 0:e})}else Zf("Creating `net.Socket`: %o",this.connectOpts),r=st.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=st.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=Xf(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`,$f),t.secureEndpoint){Zf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return ct.connect({...ep(t,`host`,`path`,`port`),socket:r,servername:st.isIP(e)?void 0:e})}return r}r.destroy();let u=new st.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Zf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Qf.__initStatic();function $f(e){e.resume()}function ep(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function tp(e){return new We({read(){this.push(e),this.push(null)}})}function np(e){let t;try{t=new URL(e.url)}catch{return Ii(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),wl(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=rp(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?at:Ke,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Qf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return wl(e,ip(e,e.httpModule??i,o))}function rp(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function ip(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)=>{cc(()=>{let d=tp(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(ot()));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 ap(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=du(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 op(){let e=new lt;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()))}Ao({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function sp(e,t,n,r){let i=0,a=[];Q&&K.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`){Q&&K.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):Q&&K.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Q&&K.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){Q&&K.error(r,`Error building captured request body`,e)}})}catch(e){Q&&K.error(r,`Error patching request to capture body`,e)}}function cp(e,t){if(!e)return t;let n=Uo(e),r=Uo(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Go(i)}const lp=`@sentry/instrumentation-http`;function up(e,t){let n=fp(e),r=t?.statusCode,i=ud(r);Tu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function dp(e,t){let n=mp(e),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=bu(n,r,t)?gu({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),Q&&K.log(lp,`Added sentry-trace header to outgoing request`)}catch(e){Q&&K.error(lp,`Failed to add sentry-trace header to outgoing request:`,pa(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Q&&K.log(lp,`Added traceparent header to outgoing request`)}catch(e){Q&&K.error(lp,`Failed to add traceparent header to outgoing request:`,pa(e)?e.message:`Unknown error`)}if(s){let t=cp(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Q&&K.log(lp,`Added baggage header to outgoing request`)}catch(e){Q&&K.error(lp,`Failed to add baggage header to outgoing request:`,pa(e)?e.message:`Unknown error`)}}}function fp(e){try{let t=e.getHeader(`host`)||e.host,n=fu(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:mu(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 pp(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function mp(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const hp=`Http`,gp=new WeakSet,_p=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new gd(100),r=new WeakMap;return{name:hp,setupOnce(){Qe(`http.server.request.start`,(e=>{vp(e.server,t)})),Qe(`http.client.request.created`,(e=>{yp(e.request,t,n,r)})),Qe(`http.client.response.finish`,(e=>{let n=e;bp(n.request,n.response,t,r)})),Qe(`http.client.request.error`,(e=>{bp(e.request,void 0,t,r)}))}}});function vp(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(gp.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!J().getClient())return e.apply(r,i);Q&&K.log(hp,`Handling incoming request`);let a=Y().clone(),o=i[1],s=Su(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&sp(o,a,n,hp),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${pu(l)}`;return a.setTransactionName(u),Po(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return oc({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(J().getPropagationContext().propagationSpanId=_o(),e.apply(r,i)))})}});gp.add(i),e.emit=i}function yp(e,t,n,r){let i=xp(e,t);r.set(e,i),!i&&dp(e,n)}function bp(e,t,n,r){n.breadcrumbs&&((r.get(e)??xp(e,n))||up(e,t))}function xp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,pp(e)):!1}const Sp=`sentry-trace`,Cp=`baggage`,wp=/baggage: (.*)\r\n/;function Tp(e,t){let n=Op(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=bu(n,r,t)?gu({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(Sp)&&t.push(Sp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===Cp);if(s&&n===-1)t.push(Cp,s);else if(s){let e=t[n+1],r=cp(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Sp}:`)&&(e.headers+=`${Sp}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(wp)?.[1];if(s&&!n)e.headers+=`${Cp}: ${s}\r\n`;else if(s){let t=cp(n,s);t&&(e.headers=e.headers.replace(wp,`baggage: ${t}\r\n`))}}}function Ep(e,t){let n=Dp(e),r=t.statusCode,i=ud(r);Tu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Dp(e){try{let t=fu(Op(e.origin,e.path)),n={url:mu(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 Op(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 kp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new gd(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){Qe(`undici:request:create`,(e=>{Ap(e.request,t,n,r)})),Qe(`undici:request:headers`,(e=>{let n=e;jp(n.request,n.response,t,r)}))}}});function Ap(e,t,n,r){let i=Mp(e,t);r.set(e,i),!i&&Tp(e,n)}function jp(e,t,n,r){n.breadcrumbs&&(r.get(e)||Ep(e,t))}function Mp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(Op(e.origin,e.path)):!1}function Np(){return[Au(),Ou(),Gu(),Qu(),Hf(),sd(),_p(),kp(),Df(),Af(),Qd(),hf(),Cd(),vd(),If(),yf()]}function Pp(e={}){return Fp(e,Np)}function Fp(e={},t){let n=Ip(e,t);n.debug===!0&&(Q?K.enable():Ii(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),op(),J().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===Lf)&&n.integrations.push(Rf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),hu(n,`node-light`,[`node-core`]);let r=new _d(n);return J().setClient(r),r.init(),K.log(`SDK initialized from ${gf()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),zp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function Ip(e,t){let n=Lp(e.release),r=ap(e.spotlight),i=Rp(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??np,stackParser:Ji(e.stackParser||Kf),release:n,tracesSampleRate:i,spotlight:r,debug:du(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:nl({defaultIntegrations:s,integrations:o})}}function Lp(e){if(e!==void 0)return e;let t=Gf();if(t!==void 0)return t}function Rp(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 zp(){if(du(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=as(e,t);J().setPropagationContext(n)}}function Bp(){return xe.PRISMIC_SENTRY_ENABLED??xe.PROD}function Vp(){if(xe.PRISMIC_SENTRY_ENVIRONMENT)return xe.PRISMIC_SENTRY_ENVIRONMENT;let e=ne.match(/-(.+?)\./);return e?e[1]:`production`}function Hp(){try{if(!Bp())return;Pp({dsn:xe.PRISMIC_SENTRY_DSN,release:ne,environment:Vp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),Hc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function Up(e){try{if(!Bp())return;Vc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await Gc()}catch{}}const Wp=Wc,Gp=Uc,Kp=Hc,$=[`login`,`logout`,`whoami`,`sync`,`docs`,`status`],qp=N({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,sections:{DOCUMENTATION:"\n Run `prismic docs list` to browse available documentation topics.\n Run `prismic docs view <path>` to read a topic.\n "},commands:{init:{handler:$n,description:`Initialize a Prismic project`},docs:{handler:Tt,description:`Browse Prismic documentation`},gen:{handler:cn,description:`Generate files from local models`},pull:{handler:Ar,description:`Pull types and slices from Prismic`},push:{handler:jr,description:`Push types and slices to Prismic`},sync:{handler:ii,description:`Sync types and slices from Prismic`},status:{handler:Yr,description:`Show local vs remote model differences`},locale:{handler:br,description:`Manage locales`},repo:{handler:Lr,description:`Manage repositories`},type:{handler:vi,description:`Manage content types`},field:{handler:an,description:`Manage fields`},slice:{handler:Jr,description:`Manage slices`},preview:{handler:Dr,description:`Manage preview configurations`},token:{handler:li,description:`Manage API tokens`},webhook:{handler:Ei,description:`Manage webhooks`},login:{handler:xr,description:`Log in to Prismic`},logout:{handler:Sr,description:`Log out of Prismic`},whoami:{handler:Di,description:`Show the currently logged in user`}}});await Jp();async function Jp(){await je({npmPackageName:re,statePath:we}),De().catch(()=>{});let{positionals:[e],values:{version:t,help:n,repo:i=await s()}}=Ne({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(ne);return}if(typeof i!=`string`&&(i=``),!n){let t=await A();Hp(),await Zr({host:t}),i&&(Qr(i),Gp(`repository`,i),Kp(`Repository Data`,{name:i}));try{Gp(`framework`,(await o()).id)}catch{}let n=await k();if(n){let e=ki(n)?.exp,i=Date.now()/1e3;(!e||e-i<=3600)&&process.on(`exit`,()=>Ee()),(!e||e>i)&&r({token:n,host:t}).then(e=>{$r(e),Wp({id:e.shortId})}).catch(()=>{})}e&&!$.includes(e)&&ei(e)}try{await qp(),e&&!$.includes(e)&&U(e)}catch(t){if(process.exitCode=1,t instanceof P){$.includes(e)||U(e),console.error(_(t.message));return}if(t instanceof f){$.includes(e)||U(e,{error:t}),console.error(t.message);return}if(t instanceof hr){if($.includes(e)||U(e),t.availableEnvironments.length===1&&t.repo===t.availableEnvironments[0].domain)console.error(`No environments available on repository "${t.repo}".`);else{let e=t.availableEnvironments.map(e=>e.domain).join(`
|
|
327
|
-
`);console.error(
|
|
326
|
+
`),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}Yf(`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 Zf(...e){K.log(`[https-proxy-agent]`,...e)}var Qf=class extends Jf{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??{},Zf(`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?ep(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:`){Zf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=ht.connect({...this.connectOpts,servername:e&&mt.isIP(e)?void 0:e})}else Zf("Creating `net.Socket`: %o",this.connectOpts),r=mt.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=mt.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r\n`;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r\n`;let s=Xf(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`,$f),t.secureEndpoint){Zf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return ht.connect({...ep(t,`host`,`path`,`port`),socket:r,servername:mt.isIP(e)?void 0:e})}return r}r.destroy();let u=new mt.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Zf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Qf.__initStatic();function $f(e){e.resume()}function ep(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function tp(e){return new Ze({read(){this.push(e),this.push(null)}})}function np(e){let t;try{t=new URL(e.url)}catch{return Ii(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),wl(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=rp(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?ft:$e,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Qf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return wl(e,ip(e,e.httpModule??i,o))}function rp(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function ip(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)=>{cc(()=>{let d=tp(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(pt()));let p=r.startsWith(`[`),m=t.request({method:`POST`,agent:n,headers:f,hostname:p?r.slice(1,-1):r,path:`${i}${s}`,port:a,protocol:o,ca:e.caCerts},e=>{e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`);let t=e.headers[`retry-after`]??null,n=e.headers[`x-sentry-rate-limits`]??null;l({statusCode:e.statusCode,headers:{"retry-after":t,"x-sentry-rate-limits":Array.isArray(n)?n[0]||null:n}})});m.on(`error`,u),d.pipe(m)})})}}function ap(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=du(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 op(){let e=new gt;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()))}Ao({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function sp(e,t,n,r){let i=0,a=[];Q&&K.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`){Q&&K.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):Q&&K.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Q&&K.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){Q&&K.error(r,`Error building captured request body`,e)}})}catch(e){Q&&K.error(r,`Error patching request to capture body`,e)}}function cp(e,t){if(!e)return t;let n=Uo(e),r=Uo(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Go(i)}const lp=`@sentry/instrumentation-http`;function up(e,t){let n=fp(e),r=t?.statusCode,i=ud(r);Tu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function dp(e,t){let n=mp(e),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=bu(n,r,t)?gu({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),Q&&K.log(lp,`Added sentry-trace header to outgoing request`)}catch(e){Q&&K.error(lp,`Failed to add sentry-trace header to outgoing request:`,pa(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Q&&K.log(lp,`Added traceparent header to outgoing request`)}catch(e){Q&&K.error(lp,`Failed to add traceparent header to outgoing request:`,pa(e)?e.message:`Unknown error`)}if(s){let t=cp(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Q&&K.log(lp,`Added baggage header to outgoing request`)}catch(e){Q&&K.error(lp,`Failed to add baggage header to outgoing request:`,pa(e)?e.message:`Unknown error`)}}}function fp(e){try{let t=e.getHeader(`host`)||e.host,n=fu(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:mu(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 pp(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function mp(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const hp=`Http`,gp=new WeakSet,_p=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new gd(100),r=new WeakMap;return{name:hp,setupOnce(){at(`http.server.request.start`,(e=>{vp(e.server,t)})),at(`http.client.request.created`,(e=>{yp(e.request,t,n,r)})),at(`http.client.response.finish`,(e=>{let n=e;bp(n.request,n.response,t,r)})),at(`http.client.request.error`,(e=>{bp(e.request,void 0,t,r)}))}}});function vp(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(gp.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!J().getClient())return e.apply(r,i);Q&&K.log(hp,`Handling incoming request`);let a=Y().clone(),o=i[1],s=Su(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&sp(o,a,n,hp),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${pu(l)}`;return a.setTransactionName(u),Po(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return oc({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(J().getPropagationContext().propagationSpanId=_o(),e.apply(r,i)))})}});gp.add(i),e.emit=i}function yp(e,t,n,r){let i=xp(e,t);r.set(e,i),!i&&dp(e,n)}function bp(e,t,n,r){n.breadcrumbs&&((r.get(e)??xp(e,n))||up(e,t))}function xp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,pp(e)):!1}const Sp=`sentry-trace`,Cp=`baggage`,wp=/baggage: (.*)\r\n/;function Tp(e,t){let n=Op(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=bu(n,r,t)?gu({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(Sp)&&t.push(Sp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===Cp);if(s&&n===-1)t.push(Cp,s);else if(s){let e=t[n+1],r=cp(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Sp}:`)&&(e.headers+=`${Sp}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(wp)?.[1];if(s&&!n)e.headers+=`${Cp}: ${s}\r\n`;else if(s){let t=cp(n,s);t&&(e.headers=e.headers.replace(wp,`baggage: ${t}\r\n`))}}}function Ep(e,t){let n=Dp(e),r=t.statusCode,i=ud(r);Tu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Dp(e){try{let t=fu(Op(e.origin,e.path)),n={url:mu(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 Op(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 kp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new gd(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){at(`undici:request:create`,(e=>{Ap(e.request,t,n,r)})),at(`undici:request:headers`,(e=>{let n=e;jp(n.request,n.response,t,r)}))}}});function Ap(e,t,n,r){let i=Mp(e,t);r.set(e,i),!i&&Tp(e,n)}function jp(e,t,n,r){n.breadcrumbs&&(r.get(e)||Ep(e,t))}function Mp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(Op(e.origin,e.path)):!1}function Np(){return[Au(),Ou(),Gu(),Qu(),Hf(),sd(),_p(),kp(),Df(),Af(),Qd(),hf(),Cd(),vd(),If(),yf()]}function Pp(e={}){return Fp(e,Np)}function Fp(e={},t){let n=Ip(e,t);n.debug===!0&&(Q?K.enable():Ii(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),op(),J().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===Lf)&&n.integrations.push(Rf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),hu(n,`node-light`,[`node-core`]);let r=new _d(n);return J().setClient(r),r.init(),K.log(`SDK initialized from ${gf()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),zp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function Ip(e,t){let n=Lp(e.release),r=ap(e.spotlight),i=Rp(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??np,stackParser:Ji(e.stackParser||Kf),release:n,tracesSampleRate:i,spotlight:r,debug:du(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:nl({defaultIntegrations:s,integrations:o})}}function Lp(e){if(e!==void 0)return e;let t=Gf();if(t!==void 0)return t}function Rp(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 zp(){if(du(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=as(e,t);J().setPropagationContext(n)}}function Bp(){return ke.PRISMIC_SENTRY_ENABLED??ke.PROD}function Vp(){if(ke.PRISMIC_SENTRY_ENVIRONMENT)return ke.PRISMIC_SENTRY_ENVIRONMENT;let e=oe.match(/-(.+?)\./);return e?e[1]:`production`}function Hp(){try{if(!Bp())return;Pp({dsn:ke.PRISMIC_SENTRY_DSN,release:oe,environment:Vp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),Hc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function Up(e){try{if(!Bp())return;Vc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await Gc()}catch{}}const Wp=Wc,Gp=Uc,Kp=Hc,$=[`login`,`logout`,`whoami`,`sync`,`docs`,`status`],qp=P({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,sections:{DOCUMENTATION:"\n Run `prismic docs list` to browse available documentation topics.\n Run `prismic docs view <path>` to read a topic.\n "},commands:{init:{handler:cr,description:`Initialize a Prismic project`},docs:{handler:Mt,description:`Browse Prismic documentation`},gen:{handler:hn,description:`Generate files from local models`},pull:{handler:kr,description:`Pull types and slices from Prismic`},push:{handler:Ar,description:`Push types and slices to Prismic`},sync:{handler:ii,description:`Sync types and slices from Prismic`},status:{handler:Jr,description:`Show local vs remote model differences`},locale:{handler:yr,description:`Manage locales`},repo:{handler:Ir,description:`Manage repositories`},type:{handler:vi,description:`Manage content types`},field:{handler:fn,description:`Manage fields`},slice:{handler:qr,description:`Manage slices`},preview:{handler:Er,description:`Manage preview configurations`},token:{handler:li,description:`Manage API tokens`},webhook:{handler:Ei,description:`Manage webhooks`},login:{handler:br,description:`Log in to Prismic`},logout:{handler:xr,description:`Log out of Prismic`},whoami:{handler:Di,description:`Show the currently logged in user`}}});await Jp();async function Jp(){await Le({npmPackageName:se,statePath:Oe}),Ne().catch(()=>{});let{positionals:[e],values:{version:t,help:r,repo:i=await n()}}=ze({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(oe);return}if(typeof i!=`string`&&(i=``),!r){let t=await j();Hp(),await Zr({host:t}),i&&(Qr(i),Gp(`repository`,i),Kp(`Repository Data`,{name:i}));try{Gp(`framework`,(await f()).id)}catch{}let n=await A();if(n){let e=ki(n)?.exp,r=Date.now()/1e3;(!e||e-r<=3600)&&process.on(`exit`,()=>Me()),(!e||e>r)&&o({token:n,host:t}).then(e=>{$r(e),Wp({id:e.shortId})}).catch(()=>{})}e&&!$.includes(e)&&ei(e)}try{await qp(),e&&!$.includes(e)&&U(e)}catch(t){if(process.exitCode=1,t instanceof F){$.includes(e)||U(e),console.error(C(t.message));return}if(t instanceof ne){$.includes(e)||U(e,{error:t}),console.error(t.message);return}if(t instanceof mr){if($.includes(e)||U(e),t.availableEnvironments.length===1&&t.repo===t.availableEnvironments[0].domain)console.error(`No environments available on repository "${t.repo}".`);else{let e=t.availableEnvironments.map(e=>e.domain).join(`
|
|
327
|
+
`);console.error(C`
|
|
328
328
|
Environment "${t.env}" not found on repository "${t.repo}".
|
|
329
329
|
|
|
330
330
|
Available environments:
|
|
331
331
|
${e}
|
|
332
|
-
`)}return}if(t instanceof
|
|
332
|
+
`)}return}if(t instanceof ve||t instanceof be){$.includes(e)||U(e,{error:t}),console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof D){$.includes(e)||U(e),console.error(t.message||`Not found. Verify the repository and any specified identifiers exist.`);return}if(t instanceof E){$.includes(e)||U(e,{error:t});let n=new URL(t.response.url);n.search=``,console.error(C`
|
|
333
333
|
A network request failed unexpectedly:
|
|
334
334
|
|
|
335
335
|
${n}
|
|
336
336
|
|
|
337
337
|
If this error happens repeatedly, report the issue here: https://github.com/prismicio/cli/issues
|
|
338
|
-
`);return}if(t instanceof
|
|
338
|
+
`);return}if(t instanceof S){$.includes(e)||U(e),console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof y){$.includes(e)||U(e),console.error(`${t.message} Run \`prismic init\` to create a config.`);return}if(t instanceof h){$.includes(e)||U(e),console.error(C`
|
|
339
339
|
This command requires the Type Builder in your repository.
|
|
340
340
|
|
|
341
341
|
As of March 2026, the Type Builder is rolling out incrementally as Slice
|