builder.io 1.5.2 → 1.5.4

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/server/index.cjs CHANGED
@@ -1,19 +1,35 @@
1
- "use strict";var de=Object.create;var S=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Se=(e,t)=>{for(var r in t)S(e,r,{get:t[r],enumerable:!0})},I=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of me(t))!he.call(e,i)&&i!==r&&S(e,i,{get:()=>t[i],enumerable:!(n=ge(t,i))||n.enumerable});return e};var d=(e,t,r)=>(r=e!=null?de(fe(e)):{},I(t||!e||!e.__esModule?S(r,"default",{value:e,enumerable:!0}):r,e)),ve=e=>I(S({},"__esModule",{value:!0}),e);var U=ye((je,L)=>{"use strict";L.exports=function(){if(process.env.npm_config_user_agent)return Ce(process.env.npm_config_user_agent)};function Ce(e){let t=e.split(" ")[0],r=t.lastIndexOf("/"),n=t.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:t.substring(r+1)}}});var Ue={};Se(Ue,{createDevToolsServer:()=>ce,version:()=>_});module.exports=ve(Ue);var b=require("node:http");var R="preview-url";var D="framework",O="platform",F="node",k="/~builder-connect",v="/~builder-connected",w="/~builder-dev-tools",N="/~builder-dev-tools.js",u="/~builder-dev-tools-close";var be=d(U(),1);async function $(e){return(await e.hash(e.getAppRootDir())).substring(0,8)}async function V(e,t){let r=await e.readFile(t.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${t.filePath}`}],code:null,output:null}:P(e,{code:r,filePath:t.filePath,compilerOptions:t.compilerOptions})}function P(e,t){let r={diagnostics:[],code:t.code,output:null};try{let n=e.ts.transpileModule(t.code,{compilerOptions:t.compilerOptions,fileName:t.filePath??"module.tsx",reportDiagnostics:!0});n.diagnostics?.forEach(i=>{r.diagnostics.push({messageText:String(i.messageText)})}),r.output=n.outputText}catch(n){console.error("transpileModule",n),r.diagnostics.push({messageText:String(n)})}return r}var c=require("node:fs/promises");var A=require("node:os"),M=d(require("node:path"),1),Te=d(require("prettier"),1),Re=d(require("typescript"),1),De=d(require("launch-editor"),1);var ot=d(require("@sentry/node"),1);function we(){let e=(0,A.homedir)();return M.default.join(e,".config","builder","dev-tools.json")}async function j(){let e=we();try{let t=await(0,c.readFile)(e,"utf-8");if(typeof t=="string")return JSON.parse(t)}catch(t){if(t.code==="ENOENT")return null}return null}var h={CMS:"cms",VCP:"vcp",HYBRID:"hybrid"};var K=require("node:console"),B=require("node:http"),q=require("node:https");function g(e){let t=Date.now();return new Promise((r,n)=>{let s=Pe(e.url)({protocol:e.url.protocol,host:e.url.host,port:e.url.port,path:e.url.pathname+e.url.search,method:e.method,headers:e.headers},o=>{let l="";o.on("data",a=>{l+=a}),o.on("end",()=>{if((0,K.debug)(`${e.method} ${e.url.href}, duration: ${Date.now()-t}ms`),typeof o.statusCode=="number"&&o.statusCode>=200&&o.statusCode<300)if(typeof o.headers["content-type"]!="string"||!o.headers["content-type"].includes("application/json"))n(`Response from ${e.url.href} content-type is ${o.headers["content-type"]}`);else try{r(JSON.parse(l))}catch(a){n(`Response from ${e.url.href} is not valid JSON: ${l}
2
- ${a}`)}else n(`Request to ${e.url.href} failed with status ${o.statusCode}: ${l}`)})}).on("error",o=>{n(`Error fetching ${e.url.href}, ${o}`)});e.body&&(s.setHeader("Content-Type","application/json"),s.write(e.body)),s.end()})}function Pe(e){if(e.protocol==="https:")return q.request;if(e.protocol==="http:")return B.request;throw new Error(`Unsupported protocol ${e.protocol}`)}async function H(e){let t=new URL(`https://cdn.builder.io/api/v3/query/${e.publicApiKey}/${e.model}`);return t.searchParams.set("omit","meta.componentsUsed"),t.searchParams.set("apiKey",e.publicApiKey),t.searchParams.set("userAttributes.urlPath",e.pageUrl),t.searchParams.set("options.page.model",`"${e.model}"`),t.searchParams.set("cachebust","true"),(await g({url:t,method:"GET"}))[e.model]}async function J(e,t){if(t.kind===h.VCP)return!0;let r=new URL("https://cdn.builder.io/api/v2/admin"),n={query:`query {
1
+ "use strict";var _s=Object.create;var fr=Object.defineProperty;var js=Object.getOwnPropertyDescriptor;var Ms=Object.getOwnPropertyNames;var Vs=Object.getPrototypeOf,Ks=Object.prototype.hasOwnProperty;var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Us=(e,t)=>{for(var n in t)fr(e,n,{get:t[n],enumerable:!0})},Co=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ms(t))!Ks.call(e,i)&&i!==n&&fr(e,i,{get:()=>t[i],enumerable:!(r=js(t,i))||r.enumerable});return e};var k=(e,t,n)=>(n=e!=null?_s(Vs(e)):{},Co(t||!e||!e.__esModule?fr(n,"default",{value:e,enumerable:!0}):n,e)),zs=e=>Co(fr({},"__esModule",{value:!0}),e);var Fo=oe((xm,xo)=>{"use strict";xo.exports=function(){if(process.env.npm_config_user_agent)return qs(process.env.npm_config_user_agent)};function qs(e){let t=e.split(" ")[0],n=t.lastIndexOf("/"),r=t.substring(0,n);return{name:r==="npminstall"?"cnpm":r,version:t.substring(n+1)}}});var un=oe((tf,Zo)=>{"use strict";var an="\x1B",J=`${an}[`,ou="\x07",sn={to(e,t){return t?`${J}${t+1};${e+1}H`:`${J}${e+1}G`},move(e,t){let n="";return e<0?n+=`${J}${-e}D`:e>0&&(n+=`${J}${e}C`),t<0?n+=`${J}${-t}A`:t>0&&(n+=`${J}${t}B`),n},up:(e=1)=>`${J}${e}A`,down:(e=1)=>`${J}${e}B`,forward:(e=1)=>`${J}${e}C`,backward:(e=1)=>`${J}${e}D`,nextLine:(e=1)=>`${J}E`.repeat(e),prevLine:(e=1)=>`${J}F`.repeat(e),left:`${J}G`,hide:`${J}?25l`,show:`${J}?25h`,save:`${an}7`,restore:`${an}8`},iu={up:(e=1)=>`${J}S`.repeat(e),down:(e=1)=>`${J}T`.repeat(e)},au={screen:`${J}2J`,up:(e=1)=>`${J}1J`.repeat(e),down:(e=1)=>`${J}J`.repeat(e),line:`${J}2K`,lineEnd:`${J}K`,lineStart:`${J}1K`,lines(e){let t="";for(let n=0;n<e;n++)t+=this.line+(n<e-1?sn.up():"");return e&&(t+=sn.left),t}};Zo.exports={cursor:sn,scroll:iu,erase:au,beep:ou}});var Sr=oe((rf,ln)=>{var yr=process||{},ei=yr.argv||[],Fr=yr.env||{},su=!(Fr.NO_COLOR||ei.includes("--no-color"))&&(!!Fr.FORCE_COLOR||ei.includes("--color")||yr.platform==="win32"||(yr.stdout||{}).isTTY&&Fr.TERM!=="dumb"||!!Fr.CI),uu=(e,t,n=e)=>r=>{let i=""+r,a=i.indexOf(t,e.length);return~a?e+lu(i,t,n,a)+t:e+i+t},lu=(e,t,n,r)=>{let i="",a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},ti=(e=su)=>{let t=e?uu:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};ln.exports=ti();ln.exports.createColors=ti});var _a=oe((WC,$r)=>{$r.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;$r.exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;$r.exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/});var _n=oe((JC,ja)=>{var Ln=_a();ja.exports={isSpaceSeparator(e){return typeof e=="string"&&Ln.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||Ln.ID_Start.test(e))},isIdContinueChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="$"||e==="_"||e==="\u200C"||e==="\u200D"||Ln.ID_Continue.test(e))},isDigit(e){return typeof e=="string"&&/[0-9]/.test(e)},isHexDigit(e){return typeof e=="string"&&/[0-9A-Fa-f]/.test(e)}}});var za=oe((GC,Ua)=>{var te=_n(),Mn,ce,We,Or,ot,ve,re,Un,ar;Ua.exports=function(t,n){Mn=String(t),ce="start",We=[],Or=0,ot=1,ve=0,re=void 0,Un=void 0,ar=void 0;do re=Qc(),Zc[ce]();while(re.type!=="eof");return typeof n=="function"?Vn({"":ar},"",n):ar};function Vn(e,t,n){let r=e[t];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=String(i),o=Vn(r,a,n);o===void 0?delete r[a]:Object.defineProperty(r,a,{value:o,writable:!0,enumerable:!0,configurable:!0})}else for(let i in r){let a=Vn(r,i,n);a===void 0?delete r[i]:Object.defineProperty(r,i,{value:a,writable:!0,enumerable:!0,configurable:!0})}return n.call(e,t,r)}var P,b,ir,qe,I;function Qc(){for(P="default",b="",ir=!1,qe=1;;){I=Je();let e=Va[P]();if(e)return e}}function Je(){if(Mn[Or])return String.fromCodePoint(Mn.codePointAt(Or))}function h(){let e=Je();return e===`
2
+ `?(ot++,ve=0):e?ve+=e.length:ve++,e&&(Or+=e.length),e}var Va={default(){switch(I){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
3
+ `:case"\r":case"\u2028":case"\u2029":h();return;case"/":h(),P="comment";return;case void 0:return h(),U("eof")}if(te.isSpaceSeparator(I)){h();return}return Va[ce]()},comment(){switch(I){case"*":h(),P="multiLineComment";return;case"/":h(),P="singleLineComment";return}throw z(h())},multiLineComment(){switch(I){case"*":h(),P="multiLineCommentAsterisk";return;case void 0:throw z(h())}h()},multiLineCommentAsterisk(){switch(I){case"*":h();return;case"/":h(),P="default";return;case void 0:throw z(h())}h(),P="multiLineComment"},singleLineComment(){switch(I){case`
4
+ `:case"\r":case"\u2028":case"\u2029":h(),P="default";return;case void 0:return h(),U("eof")}h()},value(){switch(I){case"{":case"[":return U("punctuator",h());case"n":return h(),dt("ull"),U("null",null);case"t":return h(),dt("rue"),U("boolean",!0);case"f":return h(),dt("alse"),U("boolean",!1);case"-":case"+":h()==="-"&&(qe=-1),P="sign";return;case".":b=h(),P="decimalPointLeading";return;case"0":b=h(),P="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":b=h(),P="decimalInteger";return;case"I":return h(),dt("nfinity"),U("numeric",1/0);case"N":return h(),dt("aN"),U("numeric",NaN);case'"':case"'":ir=h()==='"',b="",P="string";return}throw z(h())},identifierNameStartEscape(){if(I!=="u")throw z(h());h();let e=Kn();switch(e){case"$":case"_":break;default:if(!te.isIdStartChar(e))throw Ma();break}b+=e,P="identifierName"},identifierName(){switch(I){case"$":case"_":case"\u200C":case"\u200D":b+=h();return;case"\\":h(),P="identifierNameEscape";return}if(te.isIdContinueChar(I)){b+=h();return}return U("identifier",b)},identifierNameEscape(){if(I!=="u")throw z(h());h();let e=Kn();switch(e){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!te.isIdContinueChar(e))throw Ma();break}b+=e,P="identifierName"},sign(){switch(I){case".":b=h(),P="decimalPointLeading";return;case"0":b=h(),P="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":b=h(),P="decimalInteger";return;case"I":return h(),dt("nfinity"),U("numeric",qe*(1/0));case"N":return h(),dt("aN"),U("numeric",NaN)}throw z(h())},zero(){switch(I){case".":b+=h(),P="decimalPoint";return;case"e":case"E":b+=h(),P="decimalExponent";return;case"x":case"X":b+=h(),P="hexadecimal";return}return U("numeric",qe*0)},decimalInteger(){switch(I){case".":b+=h(),P="decimalPoint";return;case"e":case"E":b+=h(),P="decimalExponent";return}if(te.isDigit(I)){b+=h();return}return U("numeric",qe*Number(b))},decimalPointLeading(){if(te.isDigit(I)){b+=h(),P="decimalFraction";return}throw z(h())},decimalPoint(){switch(I){case"e":case"E":b+=h(),P="decimalExponent";return}if(te.isDigit(I)){b+=h(),P="decimalFraction";return}return U("numeric",qe*Number(b))},decimalFraction(){switch(I){case"e":case"E":b+=h(),P="decimalExponent";return}if(te.isDigit(I)){b+=h();return}return U("numeric",qe*Number(b))},decimalExponent(){switch(I){case"+":case"-":b+=h(),P="decimalExponentSign";return}if(te.isDigit(I)){b+=h(),P="decimalExponentInteger";return}throw z(h())},decimalExponentSign(){if(te.isDigit(I)){b+=h(),P="decimalExponentInteger";return}throw z(h())},decimalExponentInteger(){if(te.isDigit(I)){b+=h();return}return U("numeric",qe*Number(b))},hexadecimal(){if(te.isHexDigit(I)){b+=h(),P="hexadecimalInteger";return}throw z(h())},hexadecimalInteger(){if(te.isHexDigit(I)){b+=h();return}return U("numeric",qe*Number(b))},string(){switch(I){case"\\":h(),b+=Yc();return;case'"':if(ir)return h(),U("string",b);b+=h();return;case"'":if(!ir)return h(),U("string",b);b+=h();return;case`
5
+ `:case"\r":throw z(h());case"\u2028":case"\u2029":ep(I);break;case void 0:throw z(h())}b+=h()},start(){switch(I){case"{":case"[":return U("punctuator",h())}P="value"},beforePropertyName(){switch(I){case"$":case"_":b=h(),P="identifierName";return;case"\\":h(),P="identifierNameStartEscape";return;case"}":return U("punctuator",h());case'"':case"'":ir=h()==='"',P="string";return}if(te.isIdStartChar(I)){b+=h(),P="identifierName";return}throw z(h())},afterPropertyName(){if(I===":")return U("punctuator",h());throw z(h())},beforePropertyValue(){P="value"},afterPropertyValue(){switch(I){case",":case"}":return U("punctuator",h())}throw z(h())},beforeArrayValue(){if(I==="]")return U("punctuator",h());P="value"},afterArrayValue(){switch(I){case",":case"]":return U("punctuator",h())}throw z(h())},end(){throw z(h())}};function U(e,t){return{type:e,value:t,line:ot,column:ve}}function dt(e){for(let t of e){if(Je()!==t)throw z(h());h()}}function Yc(){switch(Je()){case"b":return h(),"\b";case"f":return h(),"\f";case"n":return h(),`
6
+ `;case"r":return h(),"\r";case"t":return h()," ";case"v":return h(),"\v";case"0":if(h(),te.isDigit(Je()))throw z(h());return"\0";case"x":return h(),Xc();case"u":return h(),Kn();case`
7
+ `:case"\u2028":case"\u2029":return h(),"";case"\r":return h(),Je()===`
8
+ `&&h(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw z(h());case void 0:throw z(h())}return h()}function Xc(){let e="",t=Je();if(!te.isHexDigit(t)||(e+=h(),t=Je(),!te.isHexDigit(t)))throw z(h());return e+=h(),String.fromCodePoint(parseInt(e,16))}function Kn(){let e="",t=4;for(;t-- >0;){let n=Je();if(!te.isHexDigit(n))throw z(h());e+=h()}return String.fromCodePoint(parseInt(e,16))}var Zc={start(){if(re.type==="eof")throw Dt();jn()},beforePropertyName(){switch(re.type){case"identifier":case"string":Un=re.value,ce="afterPropertyName";return;case"punctuator":kr();return;case"eof":throw Dt()}},afterPropertyName(){if(re.type==="eof")throw Dt();ce="beforePropertyValue"},beforePropertyValue(){if(re.type==="eof")throw Dt();jn()},beforeArrayValue(){if(re.type==="eof")throw Dt();if(re.type==="punctuator"&&re.value==="]"){kr();return}jn()},afterPropertyValue(){if(re.type==="eof")throw Dt();switch(re.value){case",":ce="beforePropertyName";return;case"}":kr()}},afterArrayValue(){if(re.type==="eof")throw Dt();switch(re.value){case",":ce="beforeArrayValue";return;case"]":kr()}},end(){}};function jn(){let e;switch(re.type){case"punctuator":switch(re.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=re.value;break}if(ar===void 0)ar=e;else{let t=We[We.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,Un,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")We.push(e),Array.isArray(e)?ce="beforeArrayValue":ce="beforePropertyName";else{let t=We[We.length-1];t==null?ce="end":Array.isArray(t)?ce="afterArrayValue":ce="afterPropertyValue"}}function kr(){We.pop();let e=We[We.length-1];e==null?ce="end":Array.isArray(e)?ce="afterArrayValue":ce="afterPropertyValue"}function z(e){return Lr(e===void 0?`JSON5: invalid end of input at ${ot}:${ve}`:`JSON5: invalid character '${Ka(e)}' at ${ot}:${ve}`)}function Dt(){return Lr(`JSON5: invalid end of input at ${ot}:${ve}`)}function Ma(){return ve-=5,Lr(`JSON5: invalid identifier character at ${ot}:${ve}`)}function ep(e){console.warn(`JSON5: '${Ka(e)}' in strings is not valid ECMAScript; consider escaping`)}function Ka(e){let t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){let n=e.charCodeAt(0).toString(16);return"\\x"+("00"+n).substring(n.length)}return e}function Lr(e){let t=new SyntaxError(e);return t.lineNumber=ot,t.columnNumber=ve,t}});var Wa=oe((HC,qa)=>{var zn=_n();qa.exports=function(t,n,r){let i=[],a="",o,s,u="",l;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(r=n.space,l=n.quote,n=n.replacer),typeof n=="function")s=n;else if(Array.isArray(n)){o=[];for(let g of n){let D;typeof g=="string"?D=g:(typeof g=="number"||g instanceof String||g instanceof Number)&&(D=String(g)),D!==void 0&&o.indexOf(D)<0&&o.push(D)}}return r instanceof Number?r=Number(r):r instanceof String&&(r=String(r)),typeof r=="number"?r>0&&(r=Math.min(10,Math.floor(r)),u=" ".substr(0,r)):typeof r=="string"&&(u=r.substr(0,10)),c("",{"":t});function c(g,D){let f=D[g];switch(f!=null&&(typeof f.toJSON5=="function"?f=f.toJSON5(g):typeof f.toJSON=="function"&&(f=f.toJSON(g))),s&&(f=s.call(D,g,f)),f instanceof Number?f=Number(f):f instanceof String?f=String(f):f instanceof Boolean&&(f=f.valueOf()),f){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof f=="string")return p(f,!1);if(typeof f=="number")return String(f);if(typeof f=="object")return Array.isArray(f)?d(f):m(f)}function p(g){let D={"'":.1,'"':.2},f={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},E="";for(let y=0;y<g.length;y++){let S=g[y];switch(S){case"'":case'"':D[S]++,E+=S;continue;case"\0":if(zn.isDigit(g[y+1])){E+="\\x00";continue}}if(f[S]){E+=f[S];continue}if(S<" "){let F=S.charCodeAt(0).toString(16);E+="\\x"+("00"+F).substring(F.length);continue}E+=S}let x=l||Object.keys(D).reduce((y,S)=>D[y]<D[S]?y:S);return E=E.replace(new RegExp(x,"g"),f[x]),x+E+x}function m(g){if(i.indexOf(g)>=0)throw TypeError("Converting circular structure to JSON5");i.push(g);let D=a;a=a+u;let f=o||Object.keys(g),E=[];for(let y of f){let S=c(y,g);if(S!==void 0){let F=C(y)+":";u!==""&&(F+=" "),F+=S,E.push(F)}}let x;if(E.length===0)x="{}";else{let y;if(u==="")y=E.join(","),x="{"+y+"}";else{let S=`,
9
+ `+a;y=E.join(S),x=`{
10
+ `+a+y+`,
11
+ `+D+"}"}}return i.pop(),a=D,x}function C(g){if(g.length===0)return p(g,!0);let D=String.fromCodePoint(g.codePointAt(0));if(!zn.isIdStartChar(D))return p(g,!0);for(let f=D.length;f<g.length;f++)if(!zn.isIdContinueChar(String.fromCodePoint(g.codePointAt(f))))return p(g,!0);return g}function d(g){if(i.indexOf(g)>=0)throw TypeError("Converting circular structure to JSON5");i.push(g);let D=a;a=a+u;let f=[];for(let x=0;x<g.length;x++){let y=c(String(x),g);f.push(y!==void 0?y:"null")}let E;if(f.length===0)E="[]";else if(u==="")E="["+f.join(",")+"]";else{let x=`,
12
+ `+a,y=f.join(x);E=`[
13
+ `+a+y+`,
14
+ `+D+"]"}return i.pop(),a=D,E}}});var Ga=oe((QC,Ja)=>{var tp=za(),rp=Wa(),np={parse:tp,stringify:rp};Ja.exports=np});var Wn=oe(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});function ns(e){return Object.prototype.toString.call(e)}jr.getType=ns;function dp(e){throw new TypeError("unsupported data type: "+ns(e))}jr.throwUnknownDataType=dp});var Yn=oe(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});var Ge="";for(let e=0;e<10;e++){let t=String.fromCharCode(48+e);Ge+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(65+e);Ge+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(97+e);Ge+=t}var Lt=Ge.length,Gn={};for(let e=0;e<Lt;e++){let t=Ge[e];Gn[t]=e}function Hn(e){let t=0,n=1;for(let r=e.length-1;r>=0;r--){let i=e[r],a=Gn[i];a*=n,t+=a,n*=Lt}return t}He.s_to_int=Hn;function os(e){let t=BigInt(0),n=BigInt(1),r=BigInt(Lt);for(let i=e.length-1;i>=0;i--){let a=e[i],o=BigInt(Gn[a]);o*=n,t+=o,n*=r}return t}He.s_to_big_int=os;function Qn(e){if(e===0)return Ge[0];let t=[];for(;e!==0;){let n=e%Lt,r=Ge[n];t.push(r),e-=n,e/=Lt}return t.reverse().join("")}He.int_to_s=Qn;function is(e){let t=BigInt(0),n=BigInt(Lt);if(e===t)return Ge[0];let r=[];for(;e!==t;){let i=e%n,a=Ge[Number(i)];r.push(a),e-=i,e/=n}return r.reverse().join("")}He.big_int_to_s=is;function Vr(e){return e.split("").reverse().join("")}function as(e){if(e<0)return"-"+as(-e);let[t,n]=e.toString().split(".");if(!n)return Qn(e);let r;n&&([n,r]=n.split("e")),t=Mr(t),n=Vr(n),n=Mr(n);let i=t+"."+n;if(r){switch(i+=".",r[0]){case"+":r=r.slice(1);break;case"-":i+="-",r=r.slice(1);break}r=Vr(r),r=Mr(r),i+=r}return i}He.num_to_s=as;function Mr(e){let t=+e;return t.toString()===e?Qn(t):":"+is(BigInt(e))}He.int_str_to_s=Mr;function Jn(e){return e[0]===":"?os(e.substring(1)).toString():Hn(e).toString()}function ss(e){if(e[0]==="-")return-ss(e.substr(1));let[t,n,r]=e.split(".");if(!n)return Hn(t);t=Jn(t),n=Jn(n),n=Vr(n);let i=t+"."+n;if(r){i+="e";let a=!1;r[0]==="-"&&(a=!0,r=r.slice(1)),r=Jn(r),r=Vr(r),i+=a?-r:+r}return+i}He.s_to_num=ss});var Zn=oe(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});var Xn=Yn();function Dp(e){return"n|"+Xn.num_to_s(e)}Qe.encodeNum=Dp;function gp(e){return e=e.replace("n|",""),Xn.s_to_num(e)}Qe.decodeNum=gp;function Cp(e){return typeof e=="number"?e:Xn.s_to_int(e)}Qe.decodeKey=Cp;function hp(e){return e?"b|T":"b|F"}Qe.encodeBool=hp;function Ep(e){switch(e){case"b|T":return!0;case"b|F":return!1}return!!e}Qe.decodeBool=Ep;function xp(e){switch(e[0]+e[1]){case"b|":case"o|":case"n|":case"a|":case"s|":e="s|"+e}return e}Qe.encodeStr=xp;function Fp(e){return e[0]+e[1]==="s|"?e.substr(2):e}Qe.decodeStr=Fp});var us=oe(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.config={sort_key:!1}});var ro=oe(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});var yp=us(),Sp=Wn(),to=Zn(),Ap=Yn();function vp(e){return e.store.toArray()}Ct.memToValues=vp;function ls(){let e=[];return{forEach(t){for(let n=0;n<e.length;n++)if(t(e[n])==="break")return},add(t){e.push(t)},toArray(){return e}}}Ct.makeInMemoryStore=ls;function cs(){let e=Object.create(null),t=Object.create(null);return{getValue(n){return e[n]},getSchema(n){return t[n]},forEachValue(n){for(let[r,i]of Object.entries(e))if(n(r,i)==="break")return},forEachSchema(n){for(let[r,i]of Object.entries(t))if(n(r,i)==="break")return},setValue(n,r){e[n]=r},setSchema(n,r){t[n]=r},hasValue(n){return n in e},hasSchema(n){return n in t}}}Ct.makeInMemoryCache=cs;function wp(){return{store:ls(),cache:cs(),keyCount:0}}Ct.makeInMemoryMemory=wp;function gt(e,t){if(e.cache.hasValue(t))return e.cache.getValue(t);let n=e.keyCount++,r=Ap.num_to_s(n);return e.store.add(t),e.cache.setValue(t,r),r}function bp(e,t){yp.config.sort_key&&t.sort();let n=t.join(",");if(e.cache.hasSchema(n))return e.cache.getSchema(n);let r=sr(e,t,void 0);return e.cache.setSchema(n,r),r}function sr(e,t,n){if(t===null)return"";switch(typeof t){case"undefined":if(Array.isArray(n))return sr(e,null,n);break;case"object":if(t===null)return gt(e,null);if(Array.isArray(t)){let r="a";for(let i=0;i<t.length;i++){let a=t[i],o=a===null?"_":sr(e,a,t);r+="|"+o}return r==="a"&&(r="a|"),gt(e,r)}else{let r=Object.keys(t);if(r.length===0)return gt(e,"o|");let i="o",a=bp(e,r);i+="|"+a;for(let o of r){let s=t[o],u=sr(e,s,t);i+="|"+u}return gt(e,i)}case"boolean":return gt(e,to.encodeBool(t));case"number":return gt(e,to.encodeNum(t));case"string":return gt(e,to.encodeStr(t))}return Sp.throwUnknownDataType(t)}Ct.addValue=sr});var oo=oe(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});var Pp=Wn(),Kr=Zn(),no=ro();function Tp(e){let t=no.makeInMemoryMemory(),n=no.addValue(t,e,void 0);return[no.memToValues(t),n]}lr.compress=Tp;function Ip(e,t){if(t==="o|")return{};let n={},r=t.split("|"),i=r[1],a=ur(e,i),o=r.length;o-2===1&&!Array.isArray(a)&&(a=[a]);for(let s=2;s<o;s++){let u=a[s-2],l=r[s];l=ur(e,l),n[u]=l}return n}function Bp(e,t){if(t==="a|")return[];let n=t.split("|"),r=n.length-1,i=new Array(r);for(let a=0;a<r;a++){let o=n[a+1];o=ur(e,o),i[a]=o}return i}function ur(e,t){if(t===""||t==="_")return null;let n=Kr.decodeKey(t),r=e[n];if(r===null)return r;switch(typeof r){case"undefined":return r;case"number":return r;case"string":switch(r[0]+r[1]){case"b|":return Kr.decodeBool(r);case"o|":return Ip(e,r);case"n|":return Kr.decodeNum(r);case"a|":return Bp(e,r);default:return Kr.decodeStr(r)}}return Pp.throwUnknownDataType(r)}lr.decode=ur;function Rp(e){let[t,n]=e;return ur(t,n)}lr.decompress=Rp});var ms=oe(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});function Np(e){for(let t in e)e[t]===void 0&&delete e[t]}Ur.trimUndefined=Np;function $p(e){ps(e,new Set)}Ur.trimUndefinedRecursively=$p;function ps(e,t){t.add(e);for(let n in e)if(e[n]===void 0)delete e[n];else{let r=e[n];r&&typeof r=="object"&&!t.has(r)&&ps(r,t)}}});var Ds=oe(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});var fs=oo();it.compress=fs.compress;it.decompress=fs.decompress;var kp=oo();it.decode=kp.decode;var Op=ro();it.addValue=Op.addValue;var ds=ms();it.trimUndefined=ds.trimUndefined;it.trimUndefinedRecursively=ds.trimUndefinedRecursively});var Ss=oe(_t=>{"use strict";_t.__esModule=!0;_t.distance=_t.closest=void 0;var Ye=new Uint32Array(65536),Vp=function(e,t){for(var n=e.length,r=t.length,i=1<<n-1,a=-1,o=0,s=n,u=n;u--;)Ye[e.charCodeAt(u)]|=1<<u;for(u=0;u<r;u++){var l=Ye[t.charCodeAt(u)],c=l|o;l|=(l&a)+a^a,o|=~(l|a),a&=l,o&i&&s++,a&i&&s--,o=o<<1|1,a=a<<1|~(c|o),o&=c}for(u=n;u--;)Ye[e.charCodeAt(u)]=0;return s},Kp=function(e,t){for(var n=t.length,r=e.length,i=[],a=[],o=Math.ceil(n/32),s=Math.ceil(r/32),u=0;u<o;u++)a[u]=-1,i[u]=0;for(var l=0;l<s-1;l++){for(var c=0,p=-1,m=l*32,C=Math.min(32,r)+m,d=m;d<C;d++)Ye[e.charCodeAt(d)]|=1<<d;for(var u=0;u<n;u++){var g=Ye[t.charCodeAt(u)],D=a[u/32|0]>>>u&1,f=i[u/32|0]>>>u&1,E=g|c,x=((g|f)&p)+p^p|g|f,y=c|~(x|p),S=p&x;y>>>31^D&&(a[u/32|0]^=1<<u),S>>>31^f&&(i[u/32|0]^=1<<u),y=y<<1|D,S=S<<1|f,p=S|~(E|y),c=y&E}for(var d=m;d<C;d++)Ye[e.charCodeAt(d)]=0}for(var F=0,R=-1,W=l*32,_=Math.min(32,r-W)+W,d=W;d<_;d++)Ye[e.charCodeAt(d)]|=1<<d;for(var A=r,u=0;u<n;u++){var g=Ye[t.charCodeAt(u)],D=a[u/32|0]>>>u&1,f=i[u/32|0]>>>u&1,E=g|F,x=((g|f)&R)+R^R|g|f,y=F|~(x|R),S=R&x;A+=y>>>r-1&1,A-=S>>>r-1&1,y>>>31^D&&(a[u/32|0]^=1<<u),S>>>31^f&&(i[u/32|0]^=1<<u),y=y<<1|D,S=S<<1|f,R=S|~(E|y),F=y&E}for(var d=W;d<_;d++)Ye[e.charCodeAt(d)]=0;return A},ys=function(e,t){if(e.length<t.length){var n=t;t=e,e=n}return t.length===0?e.length:e.length<=32?Vp(e,t):Kp(e,t)};_t.distance=ys;var Up=function(e,t){for(var n=1/0,r=0,i=0;i<t.length;i++){var a=ys(e,t[i]);a<n&&(n=a,r=i)}return t[r]};_t.closest=Up});var gm={};Us(gm,{createDevToolsServer:()=>Ls,version:()=>go});module.exports=zs(gm);var Qr=require("node:http");var Yr="preview-url";var Et="framework",dr="platform",Dr="node",ho="/~builder-connect",st="/~builder-connected",Xr="/~builder-dev-tools",Zr="/~builder-dev-tools.js",ut="/~builder-dev-tools-close",Eo="/mappings";function B(e,t=""){return e.ts.createSourceFile("module.tsx",typeof t=="string"?t:"",e.ts.ScriptTarget.Latest,void 0)}function gr(e,t=""){let n=B(e,t?.trim());if(n.statements.length===0)throw new Error(`No statements found in code: ${t}`);return n.statements[0]}function ee(e,t,n){if(t){let r=e.ts.createPrinter({newLine:e.ts.NewLineKind.LineFeed,removeComments:n});return e.ts.isSourceFile(t)?r.printFile(t).trim()+`
15
+ `:r.printNode(e.ts.EmitHint.Unspecified,t,e.ts.createSourceFile("module.tsx","",e.ts.ScriptTarget.Latest)).trim()+`
16
+ `}return""}var So=k(Fo(),1);function ge(e){return e.endsWith(".mapper.tsx")||e.endsWith(".mapper.jsx")}function $(e,t,n){t=ye(t),n=ye(n),t=e.dirname(t);let r=e.basename(n,e.extname(n));n=e.dirname(n);let i;return r==="index"?i=e.relative(t,n):i=e.relative(t,e.join(n,r)),i=ye(e.normalize(i)),i.startsWith(".")||(i="./"+i),i}function ye(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}function lt(e,t){let n=e.extname(t),r=e.basename(t,n).split(/[\/\\]/),i=r[r.length-1];return yo(i==="index"?e.basename(e.dirname(t)):i)}function yo(e){return K(e).replace(/ /g,"")}function Ce(e,t){let n=e.extname(t),r=ye(e.basename(t,n)).split("/").pop();return K(r==="index"?e.basename(e.dirname(t)):r)}function M(e,t){let n=ye(e.relative(e.getAppRootDir(),t));n=n.split("/").filter(i=>i!=="."&&i!==".."&&i!=="").join("/"),n.endsWith(".tsx")||n.endsWith(".jsx")?n=n.slice(0,-4):(n.endsWith(".ts")||n.endsWith(".js"))&&(n=n.slice(0,-3));let r=e.getFrameworks();return n.startsWith("src/")&&(n=n.slice(4)),r.some(i=>i.name.includes("next"))?"@/"+n:"~/"+n}function O(e,t){let n=t,r=[];for(let i=0;i<2;i++){let a=e.basename(n);if(!a||a==="components")break;r.unshift(a),n=e.dirname(n)}return r.join("/")}function K(e){for(e=e.replace(/([A-Z])/g," $1").replace(/\./g," ").replace(/_/g," ").replace(/-/g," ").replace(/\s/g," ").trim();e.includes(" ");)e=e.replace(/ /g," ");return e.split(" ").map(t=>t.length>2?t[0].toUpperCase()+t.slice(1):t).join("").trim()}function pe(e){return e.sort((t,n)=>t.name.toLocaleLowerCase().localeCompare(n.name.toLocaleLowerCase()))}async function V(e,t,n,r){if(typeof n!="string"||n==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${n}, ${t}`);return r&&(t=r),t=e.normalize(t),(await e.hash(t+"#"+n)).substring(0,8)}async function Ao(e){return(await e.hash(e.getAppRootDir())).substring(0,8)}function Vt(e){return typeof e=="number"}function xt(e){return typeof e=="boolean"}function ue(e){return typeof e=="string"}function Ft(e){return typeof e=="string"?/^[A-Z][A-Za-z0-9]*$/.test(e):!1}function fe(e){return JSON.parse(JSON.stringify(e))}function Cr(e,t,n){for(let r of t)if(e.dirname(n).includes(r))return!0;return!1}function vo(){try{let e=(0,So.default)();if(e?.name)return e.name}catch{}return"npm"}function de(e){let t=e.join(e.getAppRootDir(),"tsconfig.json");return e.exists(t)}var Ws=["node_modules","dist","build","public"];async function he(e,t){async function n(i,a){if(a>10)return;let o=await e.readdir(i);for(let s of o){if(Ws.includes(s))continue;let u=e.join(i,s),l=await e.stat(u);if(l){if(l.isFile()&&s.startsWith("builder-registry."))return u;if(l.isDirectory()){let c=await n(u,a+1);if(c)return c}}}}let r=await n(e.getAppRootDir(),0);if(!r){let a=`builder-registry.${await de(e)?"ts":"js"}`;return e.join(t,a)}return r}async function Kt(e,t){let n=e.resolve("/");for(let r=0;r<20;r++){let i=e.join(t,"package.json"),a=await e.readFile(i);if(a)return JSON.parse(a);if(t===n)break;t=e.dirname(t)}return null}async function wo(e,t){for(let n=0;n<20;n++){let r=e.dirname(t),i=e.join(r,"node_modules");if(await e.exists(i))return i;if(t===e.getAppRootDir())break;t=e.dirname(t)}return e.join(e.getAppRootDir(),"node_modules")}async function Ut(e,t,n){let r=await e.readdir(t);return r.includes(n)?e.join(t,n):(await Promise.all(r.map(async a=>{if(a.startsWith(".")||a==="node_modules")return;let o=e.join(t,a);if((await e.stat(o)).isDirectory()){let u=await Ut(e,o,n);if(u)return u}}))).find(a=>typeof a=="string")}async function X(e,t,n){if(!Array.isArray(t)||t.length===0)throw new Error(`createTsProgram() Invalid filePaths: ${t}`);let r=await wo(e,t[0]),i=e.join(r,"typescript","lib"),a=new Map,o={fileExists:s=>{if(s=e.normalize(s),s.includes("node_modules")){let u=zt.get(s);if(!u){try{e.statSync(s).isFile()?u={exists:!0,content:e.readFileSync(s)}:u={exists:!1}}catch{u={exists:!1}}zt.set(s,u)}return u.exists}return a.has(s)||a.set(s,e.existsSync(s)),a.get(s)},getCanonicalFileName:s=>e.normalize(s),getCurrentDirectory:()=>e.cwd(),getDefaultLibFileName:()=>e.join(i,"lib.d.ts"),getDefaultLibLocation:()=>i,getNewLine:()=>`
17
+ `,getSourceFile:s=>{if(s=e.normalize(s),s.includes("node_modules")){let l=zt.get(s);if(l)return B(e,l.content)}let u=e.readFileSync(s);if(u==null){let l=e.basename(s),c=e.extname(l).toLowerCase();if(s.startsWith(i)&&c===".ts"&&(u=Po.get(l),u==null&&typeof self<"u"&&typeof fetch=="function"))throw new Er(l)}return s.includes("node_modules")&&(u?zt.set(s,{exists:!0,content:u}):zt.set(s,{exists:!1})),B(e,u)},readFile:s=>{let u=e.readFileSync(s);return typeof u=="string"?u:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return Js(e,o,t,n)}catch(s){if(s instanceof Er){await Gs(e,s.libName);continue}throw console.error("createTsProgram",s),new Error(`createTsProgram() Could not create program for: ${t[0]}`)}}function Js(e,t,n,r){let i={rootNames:[...n],options:{},host:t},a=e.ts.findConfigFile(e.dirname(n[0]),o=>e.existsSync(o));if(a){let o=bo.get(a);if(!o){let s=e.ts.readConfigFile(a,u=>{let l=e.readFileSync(u);return typeof l=="string"?l:void 0});s.error?console.error("error reading tsconfig for createTsProgram"):(o=e.ts.parseJsonConfigFileContent(s.config,e.ts.sys||{useCaseSensitiveFileNames:!1,readDirectory:(l,c)=>e.readdirSync(l),fileExists:l=>e.existsSync(l),readFile:l=>e.readFileSync(l)||void 0},e.dirname(a),void 0,a).options,bo.set(a,o))}o&&(i.options=fe(o))}return i.options.noEmit=!0,i.options.isolatedModules=!1,i.options.strict=!1,i.options.jsx=e.ts.JsxEmit.Preserve,i.options.allowJs=!0,Object.assign(i.options,r),e.ts.createProgram(i)}async function yt(e,t,n){n||(n=await X(e,[t]));let r=n.getSourceFile(t);if(!r)throw new Error(`getTypeChecker() Could not find source file: ${t}`);return{typeChecker:n.getTypeChecker(),sourceFile:r}}var Er=class{constructor(t){this.libName=t}};async function Gs(e,t){let n=`https://cdn.jsdelivr.net/npm/typescript@${e.ts.version}/lib/${t}`;hr.has(t)||hr.set(t,fetch(n).then(r=>r.text()).then(r=>{Po.set(t,r)})),await hr.get(t),hr.delete(t)}var Po=new Map,hr=new Map,zt=new Map,bo=new Map;async function To(e,t){let n=await e.readFile(t.filePath);return n==null?{diagnostics:[{messageText:`Error reading: ${t.filePath}`}],code:null,output:null}:en(e,{code:n,filePath:t.filePath,compilerOptions:t.compilerOptions})}function en(e,t){let n={diagnostics:[],code:t.code,output:null};try{let r=e.ts.transpileModule(t.code,{compilerOptions:t.compilerOptions,fileName:t.filePath??"module.tsx",reportDiagnostics:!0});r.diagnostics?.forEach(i=>{n.diagnostics.push({messageText:String(i.messageText)})}),n.output=r.outputText}catch(r){console.error("transpileModule",r),n.diagnostics.push({messageText:String(r)})}return n}var be=require("node:fs/promises");var rn=require("node:os"),nn=k(require("node:path"),1),Qs=k(require("prettier"),1),Ys=k(require("typescript"),1),Xs=k(require("launch-editor"),1);async function St(e){let t=[],n=await Kt(e,e.getRepoRootDir());if(n){let r=await Ro(n,e);t.push(...r)}return t}async function Bo(e){let t=await Kt(e,e.getRepoRootDir());return t?.scripts?.dev?t.scripts.dev.includes("--turbopack"):!1}async function Ro(e,t){let n=[];if(e&&typeof e=="object"){let r=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let i of Hs)if(r.has(i)&&!n.some(a=>a.name===i)){let a={name:i};Io.has(i)&&(a.version=await Io.get(i)(t)),n.push(a)}}return n}function tn(e){let t=parseInt(e);return Number.isNaN(t)?void 0:t}var Io=new Map([["next",async e=>{if(!e.spawnSync)return;let t=vo(),n=t==="npm"?"npx":t,{stdout:r}=e.spawnSync(n,["next","-v"],{encoding:"utf8"});if(!r)return;let i=r.match(/(Next.js v)([\d.]+)/g);if(!i)return;let a=i[0].split("Next.js v")[1],[o,s,u]=a.split(".");return{major:tn(o),minor:tn(s),patch:tn(u)}}]]),Hs=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"];var Bm=k(require("@sentry/node"),1);function No(){let e=(0,rn.homedir)();return nn.default.join(e,".config","builder","dev-tools.json")}async function xr(){let e=No();try{let t=await(0,be.readFile)(e,"utf-8");if(typeof t=="string")return JSON.parse(t)}catch(t){if(t.code==="ENOENT")return null}return null}async function $o(e){let t=No();e=typeof e=="object"&&e!=null?e:{},await(0,be.mkdir)(nn.default.dirname(t),{recursive:!0}),await(0,be.writeFile)(t,JSON.stringify(e??{},null,2))}var w={gen1:"Gen 1",gen2:"Gen 2"},qt={CMS:"cms",VCP:"vcp",HYBRID:"hybrid"};var ko=require("node:console"),Oo=require("node:http"),Lo=require("node:https");function At(e){let t=Date.now();return new Promise((n,r)=>{let a=Zs(e.url)({protocol:e.url.protocol,host:e.url.host,port:e.url.port,path:e.url.pathname+e.url.search,method:e.method,headers:e.headers},o=>{let s="";o.on("data",u=>{s+=u}),o.on("end",()=>{if((0,ko.debug)(`${e.method} ${e.url.href}, duration: ${Date.now()-t}ms`),typeof o.statusCode=="number"&&o.statusCode>=200&&o.statusCode<300)if(typeof o.headers["content-type"]!="string"||!o.headers["content-type"].includes("application/json"))r(`Response from ${e.url.href} content-type is ${o.headers["content-type"]}`);else try{n(JSON.parse(s))}catch(u){r(`Response from ${e.url.href} is not valid JSON: ${s}
18
+ ${u}`)}else r(`Request to ${e.url.href} failed with status ${o.statusCode}: ${s}`)})}).on("error",o=>{r(`Error fetching ${e.url.href}, ${o}`)});e.body&&(a.setHeader("Content-Type","application/json"),a.write(e.body)),a.end()})}function Zs(e){if(e.protocol==="https:")return Lo.request;if(e.protocol==="http:")return Oo.request;throw new Error(`Unsupported protocol ${e.protocol}`)}async function _o(e){let t=new URL(`https://cdn.builder.io/api/v3/query/${e.publicApiKey}/${e.model}`);return t.searchParams.set("omit","meta.componentsUsed"),t.searchParams.set("apiKey",e.publicApiKey),t.searchParams.set("userAttributes.urlPath",e.pageUrl),t.searchParams.set("options.page.model",`"${e.model}"`),t.searchParams.set("cachebust","true"),(await At({url:t,method:"GET"}))[e.model]}async function jo(e,t){if(t.kind===qt.VCP)return!0;let n=new URL("https://cdn.builder.io/api/v2/admin"),r={query:`query {
3
19
  models {
4
20
  id
5
21
  name
6
22
  }
7
- }`};e.debug(`Get model id for model name "${t.model}"`);let s=(await g({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)})).data.models.find(a=>a.name===t.model);if(!s)return e.debug(`No model found for model name "${t.model}"`),!1;e.debug(`Data query, modelId: "${s.id}", urlPath: "${t.pageUrl}"`);let o=new URL("https://cdn.builder.io/api/v3/data");o.searchParams.set("limit","1"),o.searchParams.set("cachebust","true"),o.searchParams.set("collection","content"),o.searchParams.set("query.published.$ne","archived"),o.searchParams.set("query.query.$elemMatch.$and[0].property","urlPath"),o.searchParams.set("query.query.$elemMatch.$and[0].operator","is"),o.searchParams.set("query.query.$elemMatch.$and[0].value",t.pageUrl),o.searchParams.set("query.modelId",s.id),o.searchParams.set("apiKey",t.publicApiKey);let l=await g({url:o,method:"GET"});return e.debug(`Data results (${l.results.length}): ${o.href}`),l.results.length>0}async function G(e,t){let r=new URL(`https://cdn.builder.io/api/v3/content/${t.model}`);r.searchParams.set("apiKey",t.publicApiKey),r.searchParams.set("cachebust","true"),r.searchParams.set("cb",Date.now().toString()),t.pageUrl&&(r.searchParams.set("url",t.pageUrl),e.debug(`get model: "${t.model}", pageUrl: "${t.pageUrl}":`,r.href)),t.id&&(r.searchParams.set("query.id",t.id),e.debug(`get model: "${t.model}", id: "${t.id}":`,r.href));let n=await g({url:r,method:"GET"});return e.debug(`get content results: ${n.results.length}`),n}async function W(e,t){let r=new URL(`https://cdn.builder.io/api/v1/write/${t.model}`);e.debug(`writing "${t.model}" content:`,r.href),await g({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`},body:t.body})}var m="page",Q="integration-welcome-screens",z="8d9ee72a33344b4b867918b442ebd0af";async function Y(e,t){let r=await G(e,{model:Q,publicApiKey:z,id:t.templateContentId});if(!Array.isArray(r?.results)||r.results.length===0||!r.results[0].data?.blocks)throw new Error(`No Builder content found for id ${t.templateContentId}`);let n=JSON.stringify(r.results[0].data.blocks),i=Ae(t.publicApiKey,t.pathname,t.title,n);await W(e,{privateAuthKey:t.privateAuthKey,model:m,body:i})}function Ae(e,t,r,n){return JSON.stringify({name:r,ownerId:e,published:"published",query:[{property:"urlPath",value:[t],operator:"is"}],data:{title:r,blocksString:n}})}async function X(e,t,r,n){e.debug(`connect builder with public key: ${t}`),e.publicApiKey=t;let i=e.closeAppServer(),s=await e.setPublicApiKey({publicApiKey:t});e.debug(`set public key: process.env.${s.envKey}=${t}`),process.env[s.envKey]=t;let o=await e.builderPageOptions();e.debug(`builder model: ${m}, path: ${o.pathname}, template: ${o.templateContentId}`);let l=await J(e,{model:m,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:r,kind:n});if(!l){await Y(e,{templateContentId:o.templateContentId,pathname:o.pathname,title:o.title,publicApiKey:t,privateAuthKey:r});let p=5,y=0;for(;!l&&y<p;){await new Promise(ue=>setTimeout(ue,1e3));let x=await H({model:m,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:r});y++,x&&x.length>0&&(l=!0)}}await i,e.debug("ensure builder setup");let a=[];n===h.VCP?a=await e.ensureFigmaImportPage():a=await e.ensureBuilderSetup(),s.modifiedType&&a.push({filePath:s.file,modifiedType:s.modifiedType}),a.forEach(p=>{p.displayFilePath=e.relative(e.getAppRootDir(),p.filePath)}),a.sort((p,y)=>p.filePath.localeCompare(y.filePath)),a.length>0?(e.debug(`modified files: ${a.map(p=>p.displayFilePath).join(", ")}`),await e.restartAppServer(),await new Promise(p=>setTimeout(p,500))):e.debug("no modified files");let T={success:!0,pathname:o.localePathname||o.pathname,modifiedFiles:a,platform:e.platform(),kind:n};return n===h.VCP&&(T.pathname="/"),e.debug(`connected builder: ${T.pathname}`),T}async function Z(e){let t=await e.builderPageOptions();e.debug(`validateBuilder, pathname: ${t.pathname}, localePathname: ${t.localePathname}, isValid: ${e.isValid}`);let r={isValid:e.isValid,pathname:t.localePathname||t.pathname,platform:e.platform()};if(e.isValid)return r;let n=await e.getPublicApiKey();return n.envValue?(e.debug(`public api key: ${n.envValue}, ${n.file}`),e.publicApiKey=n.envValue,e.debug("builder connection is valid"),r.isValid=!0,e.isValid=!0,r):(e.debug("missing public api key"),r)}async function ee(e,t){let r={type:t.type};switch(t.type){case"getCache":{r.data=await e.getCache();break}case"setCache":{await e.setCache(t.data);break}case"connectBuilder":{r.data=await X(e,t.data.publicApiKey,t.data.privateAuthKey,t.data.kind);break}case"enableDevTools":{r.data=xe(e,t.data.enabled);break}case"getRegistry":{r.data=await e.getRegistry(t.data);break}case"launchEditor":{r.data=await e.launchEditor(t.data);break}case"validateBuilder":{r.data=await Z(e);break}case"loadComponent":{r.data=await e.loadComponent(t.data);break}case"registerComponent":{r.data=await e.registerComponent(t.data),e.serverShouldRestart=!0;break}case"setComponentInfo":{r.data=await e.setRegisteredComponentInfo(t.data),e.serverShouldRestart=!0;break}case"setComponentInput":{r.data=await e.setRegisteredComponentInput(t.data),e.serverShouldRestart=!0;break}case"unregisterComponent":{r.data=await e.unregisterComponent(t.data),e.serverShouldRestart=!0;break}case"getFrameworks":{r.data=e.getFrameworks();break}case"readdir":{E(e,t.path)?r.data=await e.readdir(t.path,!0):r.errors=[`Invalid file request: ${t.path}`];break}case"readFile":{E(e,t.path)?r.data=await e.readFile(t.path):r.errors=[`Invalid file request: ${t.path}`];break}case"writeFile":{E(e,t.path)?await e.writeFile(t.path,t.content):r.errors=[`Invalid file request: ${t.path}`];break}case"ensureFigmaImportPage":{r.data=await e.ensureFigmaImportPage();break}case"transileFile":{r.data=await V(e,t);break}case"transileModule":{r.data=P(e,t);break}case"getPastSyncInfo":{r.data=await e.getPastSyncInfo?.(t.data);break}case"resyncSnippet":{r.data=await e.resyncSnippet?.(t.data);break}case"localConfig":{r.data=await j();break}default:{r.errors=[`Unknown request type: ${JSON.stringify(t)}`];let n=t}}return r}function E(e,t){if(!t||t.includes(".."))return!1;t=t.replace(/\\/g,"/");let r=t.split("/"),n=r[r.length-1];if(n.length>0){let i=n.split(".").pop();if(i&&(i=`.${i}`.toLocaleLowerCase(),i=i.split("?")[0],!_e.includes(i)))return!1}return Ee(e,t),!1}function Ee(e,t){if(!t)return!1;t=e.normalize(e.resolve(t));let r=e.getAppRootDir();return!(!t.startsWith(r)&&!t.includes("node_modules"))}var _e=[".js",".jsx",".ts",".tsx",".json",".css",".scss",".sass",".less",".html",".htm",".xml",".svg",".png",".jpg",".jpeg",".gif",".ico",".webp",".woff",".woff2",".ttf",".eot",".mp4",".webm",".ogg",".md",".txt",".csv",".pdf"];function xe(e,t){return!t&&e.serverShouldRestart&&setTimeout(()=>{console.log(`
23
+ }`};e.debug(`Get model id for model name "${t.model}"`);let a=(await At({url:n,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)})).data.models.find(u=>u.name===t.model);if(!a)return e.debug(`No model found for model name "${t.model}"`),!1;e.debug(`Data query, modelId: "${a.id}", urlPath: "${t.pageUrl}"`);let o=new URL("https://cdn.builder.io/api/v3/data");o.searchParams.set("limit","1"),o.searchParams.set("cachebust","true"),o.searchParams.set("collection","content"),o.searchParams.set("query.published.$ne","archived"),o.searchParams.set("query.query.$elemMatch.$and[0].property","urlPath"),o.searchParams.set("query.query.$elemMatch.$and[0].operator","is"),o.searchParams.set("query.query.$elemMatch.$and[0].value",t.pageUrl),o.searchParams.set("query.modelId",a.id),o.searchParams.set("apiKey",t.publicApiKey);let s=await At({url:o,method:"GET"});return e.debug(`Data results (${s.results.length}): ${o.href}`),s.results.length>0}async function Mo(e,t){let n=new URL(`https://cdn.builder.io/api/v3/content/${t.model}`);n.searchParams.set("apiKey",t.publicApiKey),n.searchParams.set("cachebust","true"),n.searchParams.set("cb",Date.now().toString()),t.pageUrl&&(n.searchParams.set("url",t.pageUrl),e.debug(`get model: "${t.model}", pageUrl: "${t.pageUrl}":`,n.href)),t.id&&(n.searchParams.set("query.id",t.id),e.debug(`get model: "${t.model}", id: "${t.id}":`,n.href));let r=await At({url:n,method:"GET"});return e.debug(`get content results: ${r.results.length}`),r}async function Vo(e,t){let n=new URL(`https://cdn.builder.io/api/v1/write/${t.model}`);e.debug(`writing "${t.model}" content:`,n.href),await At({url:n,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`},body:t.body})}var vt="page",Ko="integration-welcome-screens",Uo="8d9ee72a33344b4b867918b442ebd0af";async function zo(e,t){let n=await Mo(e,{model:Ko,publicApiKey:Uo,id:t.templateContentId});if(!Array.isArray(n?.results)||n.results.length===0||!n.results[0].data?.blocks)throw new Error(`No Builder content found for id ${t.templateContentId}`);let r=JSON.stringify(n.results[0].data.blocks),i=eu(t.publicApiKey,t.pathname,t.title,r);await Vo(e,{privateAuthKey:t.privateAuthKey,model:vt,body:i})}function eu(e,t,n,r){return JSON.stringify({name:n,ownerId:e,published:"published",query:[{property:"urlPath",value:[t],operator:"is"}],data:{title:n,blocksString:r}})}async function qo(e,t,n,r){e.debug(`connect builder with public key: ${t}`),e.publicApiKey=t;let i=e.closeAppServer(),a=await e.setPublicApiKey({publicApiKey:t});e.debug(`set public key: process.env.${a.envKey}=${t}`),process.env[a.envKey]=t;let o=await e.builderPageOptions();e.debug(`builder model: ${vt}, path: ${o.pathname}, template: ${o.templateContentId}`);let s=await jo(e,{model:vt,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:n,kind:r});if(!s){await zo(e,{templateContentId:o.templateContentId,pathname:o.pathname,title:o.title,publicApiKey:t,privateAuthKey:n});let c=5,p=0;for(;!s&&p<c;){await new Promise(C=>setTimeout(C,1e3));let m=await _o({model:vt,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:n});p++,m&&m.length>0&&(s=!0)}}await i,e.debug("ensure builder setup");let u=[];r===qt.VCP?u=await e.ensureFigmaImportPage():u=await e.ensureBuilderSetup(),a.modifiedType&&u.push({filePath:a.file,modifiedType:a.modifiedType}),u.forEach(c=>{c.displayFilePath=e.relative(e.getAppRootDir(),c.filePath)}),u.sort((c,p)=>c.filePath.localeCompare(p.filePath)),u.length>0?(e.debug(`modified files: ${u.map(c=>c.displayFilePath).join(", ")}`),await e.restartAppServer(),await new Promise(c=>setTimeout(c,500))):e.debug("no modified files");let l={success:!0,pathname:o.localePathname||o.pathname,modifiedFiles:u,platform:e.platform(),kind:r};return r===qt.VCP&&(l.pathname="/"),e.debug(`connected builder: ${l.pathname}`),l}async function Wo(e){let t=await e.builderPageOptions();e.debug(`validateBuilder, pathname: ${t.pathname}, localePathname: ${t.localePathname}, isValid: ${e.isValid}`);let n={isValid:e.isValid,pathname:t.localePathname||t.pathname,platform:e.platform()};if(e.isValid)return n;let r=await e.getPublicApiKey();return r.envValue?(e.debug(`public api key: ${r.envValue}, ${r.file}`),e.publicApiKey=r.envValue,e.debug("builder connection is valid"),n.isValid=!0,e.isValid=!0,n):(e.debug("missing public api key"),n)}async function Jo(e,t){let n={type:t.type};switch(t.type){case"getCache":{n.data=await e.getCache();break}case"setCache":{await e.setCache(t.data);break}case"connectBuilder":{n.data=await qo(e,t.data.publicApiKey,t.data.privateAuthKey,t.data.kind);break}case"enableDevTools":{n.data=nu(e,t.data.enabled);break}case"getRegistry":{n.data=await e.getRegistry(t.data);break}case"launchEditor":{n.data=await e.launchEditor(t.data);break}case"validateBuilder":{n.data=await Wo(e);break}case"loadComponent":{n.data=await e.loadComponent(t.data);break}case"registerComponent":{n.data=await e.registerComponent(t.data),e.serverShouldRestart=!0;break}case"setComponentInfo":{n.data=await e.setRegisteredComponentInfo(t.data),e.serverShouldRestart=!0;break}case"setComponentInput":{n.data=await e.setRegisteredComponentInput(t.data),e.serverShouldRestart=!0;break}case"unregisterComponent":{n.data=await e.unregisterComponent(t.data),e.serverShouldRestart=!0;break}case"getFrameworks":{n.data=e.getFrameworks();break}case"readdir":{on(e,t.path)?n.data=await e.readdir(t.path,!0):n.errors=[`Invalid file request: ${t.path}`];break}case"readFile":{on(e,t.path)?n.data=await e.readFile(t.path):n.errors=[`Invalid file request: ${t.path}`];break}case"writeFile":{on(e,t.path)?await e.writeFile(t.path,t.content):n.errors=[`Invalid file request: ${t.path}`];break}case"ensureFigmaImportPage":{n.data=await e.ensureFigmaImportPage();break}case"transileFile":{n.data=await To(e,t);break}case"transileModule":{n.data=en(e,t);break}case"getPastSyncInfo":{n.data=await e.getPastSyncInfo?.(t.data);break}case"resyncSnippet":{n.data=await e.resyncSnippet?.(t.data);break}case"localConfig":{n.data=await xr();break}default:{n.errors=[`Unknown request type: ${JSON.stringify(t)}`];let r=t}}return n}function on(e,t){if(!t||t.includes(".."))return!1;t=t.replace(/\\/g,"/");let n=t.split("/"),r=n[n.length-1];if(r.length>0){let i=r.split(".").pop();if(i&&(i=`.${i}`.toLocaleLowerCase(),i=i.split("?")[0],!ru.includes(i)))return!1}return tu(e,t),!1}function tu(e,t){if(!t)return!1;t=e.normalize(e.resolve(t));let n=e.getAppRootDir();return!(!t.startsWith(n)&&!t.includes("node_modules"))}var ru=[".js",".jsx",".ts",".tsx",".json",".css",".scss",".sass",".less",".html",".htm",".xml",".svg",".png",".jpg",".jpeg",".gif",".ico",".webp",".woff",".woff2",".ttf",".eot",".mp4",".webm",".ogg",".md",".txt",".csv",".pdf"];function nu(e,t){return!t&&e.serverShouldRestart&&setTimeout(()=>{console.log(`
8
24
  Restarting server after Builder Devtools update...
9
- `),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function te(e){return ne(e,`"use strict";(()=>{var Hr=Object.defineProperty;var qr=(t,e)=>{for(var n in e)Hr(t,n,{get:e[n],enumerable:!0})};var W=(t,e)=>{bt(t);let n=t.querySelector("aside");n.dataset.view=e,n.classList.remove("section-ready"),setTimeout(()=>{n.classList.add("section-ready")},200)},pn=t=>{Array.from(t.querySelectorAll(".back-button")).forEach(e=>{e.addEventListener("click",n=>{bt(t),n.preventDefault(),n.stopPropagation();let r=n.target;W(t,r?.dataset.back||"nav-home")})})},Tt=(t,e)=>{bt(t);let n=t.querySelector("aside"),r=document.createElement("div");r.className="ui-toast",r.innerHTML=e,n.appendChild(r),setTimeout(()=>{r.classList.add("ui-toast-show"),setTimeout(()=>{r.classList.remove("ui-toast-show"),setTimeout(()=>{r.remove()},500)},4e3)},30)},bt=t=>{let e=t.querySelector("aside");Array.from(e.querySelectorAll(".ui-toast")).forEach(r=>{r.classList.remove("ui-toast-show")})},ke=()=>{let t=fn();return localStorage.getItem(t)!=="true"},It=t=>{let e=fn();t?localStorage.removeItem(e):localStorage.setItem(e,"true")},fn=()=>jr("disableEdit"),jr=t=>\`builder.__LOCAL_APP_ID__.\${t}\`,mn=()=>{let e=document.body.querySelector("[builder-content-id]")?.getAttribute("builder-content-id");return Ee(e)},Ee=(t,e)=>{let n="/content";t&&(n+="/"+t+"/edit");let r=new URL(n,"https://builder.io");t&&e&&r.searchParams.set("selectedBlock",e);let i=new URL(location.pathname,location.href);return r.searchParams.set("overridePreviewUrl",i.href),r.href},Oe="__DEV_TOOLS_URL__",A={components:[],registryPath:"",registryDisplayPath:"",frameworks:[],dependencies:[],publicApiKey:void 0,devToolsVersion:""},J=t=>{A.components=t.components,A.registryPath=t.registryPath,A.registryDisplayPath=t.registryDisplayPath,A.dependencies=t.dependencies,A.publicApiKey=t.publicApiKey};function vn(t){let e=null,n=document.querySelector("builder-dev-tools-menu"),r=()=>{t.hide()},i=u=>{let c=u.target;if(!c){r();return}if(c.closest("builder-dev-tools-edit"))return;let a=c.closest("[builder-content-id]"),l=c.closest("[builder-id]");if(!a||!l){t.hide();return}let d=t.show(a,l);!d||d===e||(n.highlightOpener(),e=d)};document.addEventListener("pointerover",i,{passive:!0}),document.addEventListener("pointerleave",r,{passive:!0}),document.addEventListener("pointercancel",r,{passive:!0}),document.addEventListener("visibilitychange",r,{passive:!0}),window.addEventListener("popstate",r,{passive:!0});let o=history.pushState;history.pushState=function(...u){t.hide(),o.apply(this,u)};let s=history.replaceState;history.replaceState=function(...u){t.hide(),s.apply(this,u)}}var Ue=class extends HTMLElement{openInBuilder=null;block=null;constructor(){super()}connectedCallback(){this.setAttribute("aria-hidden","true");let e=this.attachShadow({mode:"open"});e.innerHTML='<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}:host{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}#content-highlight,#block{position:absolute}#content-highlight{border:3px solid var(--primary-color);background-color:var(--primary-color-alpha)}a{position:absolute;top:-33px;left:0;display:block;padding:5px 10px 8px;pointer-events:auto;z-index:100;text-decoration:none}a:hover{text-decoration:none}a span{display:block;padding:3px 6px;font-size:10px;font-weight:300;border-radius:3px;text-align:center;text-decoration:none;pointer-events:none;background-color:var(--edit-color);color:var(--text-color);white-space:nowrap}a:hover span{background-color:var(--edit-color-highlight)}a:hover~.outline{border-color:var(--edit-color-highlight)}#open-in-editor{display:none}.outline{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid var(--edit-color);background-color:var(--edit-color-alpha)}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>',this.openInBuilder=e.getElementById("open-in-builder"),this.block=e.getElementById("block"),vn(this)}show(e,n){if(!ke())return this.hide(),null;let r=e.getAttribute("builder-content-id"),i=n.getAttribute("builder-id");if(!r||!i)return this.hide(),null;let o=this.block,s=this.openInBuilder,u=n.getBoundingClientRect();o.style.top=u.top+window.scrollY-1+"px",o.style.left=u.left+window.scrollX+"px",o.style.width=u.width+"px",o.style.height=u.height+1+"px";let c=s.getBoundingClientRect();if(c.width>u.width){let a=c.width-u.width;s.style.left=a/2*-1+"px"}else s.style.left="";return s.href=Ee(r,i),this.style.display="block",i}hide(){this.style.display=""}};var gn="preview-url";var hn="_b-uid";var yn="/~builder-connect";var _n="/~builder-dev-tools";var En="https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";var Tn=()=>$({type:"validateBuilder"}),ve=t=>$({type:"launchEditor",data:t}),bn=t=>$({type:"getRegistry",data:t}),In=t=>$({type:"loadComponent",data:t}),Sn=t=>$({type:"registerComponent",data:t}),xn=t=>$({type:"setComponentInfo",data:t}),Me=t=>$({type:"setComponentInput",data:t}),Ln=t=>$({type:"unregisterComponent",data:t}),wn=t=>$({type:"enableDevTools",data:{enabled:t}}),Cn=()=>$({type:"localConfig"}),$=async t=>{let e=new URL(_n,Oe),n;try{n=await fetch(e,{method:"POST",body:JSON.stringify(t)})}catch(i){throw console.error(\`Devtools Fetch Error, \${e.href}\`,i),new Error("Builder Devtools Fetch Error")}if((n.headers.get("content-type")||"").includes("application/json")){let i=await n.json();if(n.ok)return i.data;if(Array.isArray(i.errors)&&i.errors.length>0)throw i.errors.forEach(o=>console.error(o)),new Error(\`Builder Devtools Fetch Error: \${i.errors[0]}\`)}throw new Error(\`Builder Devtools Fetch Error: \${n.status}, \${await n.text()}\`)};var Pn=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}],Ne=["color","date","email","file","longText","richText","string"],Be=["number"],Fe=["boolean"],Ve=["list"],He=["object"];function qe(t){return Ne.includes(t)?"string":Be.includes(t)?"number":Fe.includes(t)?"boolean":Ve.includes(t)?"array":He.includes(t)?"object":"string"}var $i=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(t=>t.toLowerCase()));var St=function(t,e){return St=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},St(t,e)};function V(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");St(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v.apply(this,arguments)};function Te(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function p(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(d){s(d)}}function c(l){try{a(r.throw(l))}catch(d){s(d)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function f(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function Y(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function q(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Rn="Event tracked successfully",Dn="Unexpected error occurred",An="Event rejected due to exceeded retry count",kn="Event skipped due to optOut config",On="Event rejected due to missing API key",Un="Invalid API key",Mn="Client not initialized";var Ge={};qr(Ge,{IdentifyOperation:()=>w,LogLevel:()=>M,OfflineDisabled:()=>Ke,RevenueProperty:()=>Q,ServerZone:()=>je,SpecialEventType:()=>ee,Status:()=>x});var w;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(w||(w={}));var Q;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE="$revenue"})(Q||(Q={}));var ee;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(ee||(ee={}));var M;(function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose",t[t.Debug=4]="Debug"})(M||(M={}));var je;(function(t){t.US="US",t.EU="EU"})(je||(je={}));var x;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(x||(x={}));var Ke=null;var te=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=x.Unknown),{event:t,code:e,message:n}};var X=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,X)};var Nn=function(){function t(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return t.prototype.register=function(e,n){var r,i,o;return p(this,void 0,void 0,function(){return f(this,function(s){switch(s.label){case 0:return e.name=(r=e.name)!==null&&r!==void 0?r:X(),e.type=(i=e.type)!==null&&i!==void 0?i:"enrichment",[4,(o=e.setup)===null||o===void 0?void 0:o.call(e,n,this.client)];case 1:return s.sent(),this.plugins.push(e),[2]}})})},t.prototype.deregister=function(e){var n;return p(this,void 0,void 0,function(){var r,i;return f(this,function(o){switch(o.label){case 0:return r=this.plugins.findIndex(function(s){return s.name===e}),i=this.plugins[r],this.plugins.splice(r,1),[4,(n=i.teardown)===null||n===void 0?void 0:n.call(i)];case 1:return o.sent(),[2]}})})},t.prototype.reset=function(e){this.applying=!1;var n=this.plugins;n.map(function(r){var i;return(i=r.teardown)===null||i===void 0?void 0:i.call(r)}),this.plugins=[],this.client=e},t.prototype.push=function(e){var n=this;return new Promise(function(r){n.queue.push([e,r]),n.scheduleApply(0)})},t.prototype.scheduleApply=function(e){var n=this;this.applying||(this.applying=!0,setTimeout(function(){n.apply(n.queue.shift()).then(function(){n.applying=!1,n.queue.length>0&&n.scheduleApply(0)})},e))},t.prototype.apply=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c,y,g,a,l,d,m,y,g,T,h,_,U,b,k,F;return f(this,function(I){switch(I.label){case 0:if(!e)return[2];n=L(e,1),r=n[0],i=L(e,2),o=i[1],s=this.plugins.filter(function(S){return S.type==="before"}),I.label=1;case 1:I.trys.push([1,6,7,8]),u=Y(s),c=u.next(),I.label=2;case 2:return c.done?[3,5]:(y=c.value,y.execute?[4,y.execute(v({},r))]:[3,4]);case 3:if(g=I.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,I.label=4;case 4:return c=u.next(),[3,2];case 5:return[3,8];case 6:return a=I.sent(),U={error:a},[3,8];case 7:try{c&&!c.done&&(b=u.return)&&b.call(u)}finally{if(U)throw U.error}return[7];case 8:l=this.plugins.filter(function(S){return S.type==="enrichment"||S.type===void 0}),I.label=9;case 9:I.trys.push([9,14,15,16]),d=Y(l),m=d.next(),I.label=10;case 10:return m.done?[3,13]:(y=m.value,y.execute?[4,y.execute(v({},r))]:[3,12]);case 11:if(g=I.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,I.label=12;case 12:return m=d.next(),[3,10];case 13:return[3,16];case 14:return T=I.sent(),k={error:T},[3,16];case 15:try{m&&!m.done&&(F=d.return)&&F.call(d)}finally{if(k)throw k.error}return[7];case 16:return h=this.plugins.filter(function(S){return S.type==="destination"}),_=h.map(function(S){var O=v({},r);return S.execute(O).catch(function(B){return te(O,0,String(B))})}),Promise.all(_).then(function(S){var O=L(S,1),B=O[0],Z=B||te(r,100,"Event not tracked, no destination plugins on the instance");o(Z)}),[2]}})})},t.prototype.flush=function(){return p(this,void 0,void 0,function(){var e,n,r,i=this;return f(this,function(o){switch(o.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(s){return i.apply(s)}))];case 1:return o.sent(),n=this.plugins.filter(function(s){return s.type==="destination"}),r=n.map(function(s){return s.flush&&s.flush()}),[4,Promise.all(r)];case 2:return o.sent(),[2]}})})},t}();var xt="-",de="AMP",Lt="".concat(de,"_unsent"),wt="https://api2.amplitude.com/2/httpapi",Bn="https://api.eu.amplitude.com/2/httpapi",Fn="https://api2.amplitude.com/batch",Vn="https://api.eu.amplitude.com/batch";var Kr=1e3,We=function(t){if(Object.keys(t).length>Kr)return!1;for(var e in t){var n=t[e];if(!Ct(e,n))return!1}return!0},Ct=function(t,e){var n,r;if(typeof t!="string")return!1;if(Array.isArray(e)){var i=!0;try{for(var o=Y(e),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if(typeof u=="object")i=i&&We(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(e==null)return!1;if(typeof e=="object")return We(e);if(!["number","string","boolean"].includes(typeof e))return!1}return!0};var G=function(){function t(){this._propertySet=new Set,this._properties={}}return t.prototype.getUserProperties=function(){return v({},this._properties)},t.prototype.set=function(e,n){return this._safeSet(w.SET,e,n),this},t.prototype.setOnce=function(e,n){return this._safeSet(w.SET_ONCE,e,n),this},t.prototype.append=function(e,n){return this._safeSet(w.APPEND,e,n),this},t.prototype.prepend=function(e,n){return this._safeSet(w.PREPEND,e,n),this},t.prototype.postInsert=function(e,n){return this._safeSet(w.POSTINSERT,e,n),this},t.prototype.preInsert=function(e,n){return this._safeSet(w.PREINSERT,e,n),this},t.prototype.remove=function(e,n){return this._safeSet(w.REMOVE,e,n),this},t.prototype.add=function(e,n){return this._safeSet(w.ADD,e,n),this},t.prototype.unset=function(e){return this._safeSet(w.UNSET,e,xt),this},t.prototype.clearAll=function(){return this._properties={},this._properties[w.CLEAR_ALL]=xt,this},t.prototype._safeSet=function(e,n,r){if(this._validate(e,n,r)){var i=this._properties[e];return i===void 0&&(i={},this._properties[e]=i),i[n]=r,this._propertySet.add(n),!0}return!1},t.prototype._validate=function(e,n,r){return this._properties[w.CLEAR_ALL]!==void 0||this._propertySet.has(n)?!1:e===w.ADD?typeof r=="number":e!==w.UNSET&&e!==w.REMOVE?Ct(n,r):!0},t}();var Hn=function(t,e,n){var r=typeof t=="string"?{event_type:t}:t;return v(v(v({},r),n),e&&{event_properties:e})},be=function(t,e){var n=v(v({},e),{event_type:ee.IDENTIFY,user_properties:t.getUserProperties()});return n},qn=function(t,e,n,r){var i,o=v(v({},r),{event_type:ee.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[t]=e,i)});return o},jn=function(t,e,n){var r,i=new G;i.set(t,e);var o=v(v({},n),{event_type:ee.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[t]=e,r)});return o},Kn=function(t,e){return v(v({},e),{event_type:ee.REVENUE,event_properties:t.getEventProperties()})};var H=function(t){return{promise:t||Promise.resolve()}};var Pt=function(){function t(e){e===void 0&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Nn(this),this.name=e}return t.prototype._init=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return n.sent(),[2]}})})},t.prototype.runQueuedFunctions=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c;return f(this,function(a){switch(a.label){case 0:n=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,6,7,8]),r=Y(n),i=r.next(),a.label=2;case 2:return i.done?[3,5]:(o=i.value,[4,o()]);case 3:a.sent(),a.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s=a.sent(),u={error:s},[3,8];case 7:try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}return[7];case 8:return[2]}})})},t.prototype.track=function(e,n,r){var i=Hn(e,n,r);return H(this.dispatch(i))},t.prototype.identify=function(e,n){var r=be(e,n);return H(this.dispatch(r))},t.prototype.groupIdentify=function(e,n,r,i){var o=qn(e,n,r,i);return H(this.dispatch(o))},t.prototype.setGroup=function(e,n,r){var i=jn(e,n,r);return H(this.dispatch(i))},t.prototype.revenue=function(e,n){var r=Kn(e,n);return H(this.dispatch(r))},t.prototype.add=function(e){return this.config?H(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),H())},t.prototype.remove=function(e){return this.config?H(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),H())},t.prototype.dispatchWithCallback=function(e,n){if(!this.config)return n(te(e,0,Mn));this.process(e).then(n)},t.prototype.dispatch=function(e){return p(this,void 0,void 0,function(){var n=this;return f(this,function(r){return this.config?[2,this.process(e)]:[2,new Promise(function(i){n.dispatchQ.push(n.dispatchWithCallback.bind(n,e,i))})]})})},t.prototype.process=function(e){return p(this,void 0,void 0,function(){var i,n,r,i;return f(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.config.optOut?[2,te(e,0,kn)]:[4,this.timeline.push(e)];case 1:return i=o.sent(),i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return n=o.sent(),r=String(n),this.config.loggerProvider.error(r),i=te(e,0,r),[2,i];case 3:return[2]}})})},t.prototype.setOptOut=function(e){if(!this.config){this.q.push(this.setOptOut.bind(this,!!e));return}this.config.optOut=!!e},t.prototype.flush=function(){return H(this.timeline.flush())},t}();var $e=function(){function t(){this.productId="",this.quantity=1,this.price=0}return t.prototype.setProductId=function(e){return this.productId=e,this},t.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},t.prototype.setPrice=function(e){return this.price=e,this},t.prototype.setRevenueType=function(e){return this.revenueType=e,this},t.prototype.setRevenue=function(e){return this.revenue=e,this},t.prototype.setEventProperties=function(e){return We(e)&&(this.properties=e),this},t.prototype.getEventProperties=function(){var e=this.properties?v({},this.properties):{};return e[Q.REVENUE_PRODUCT_ID]=this.productId,e[Q.REVENUE_QUANTITY]=this.quantity,e[Q.REVENUE_PRICE]=this.price,e[Q.REVENUE_TYPE]=this.revenueType,e[Q.REVENUE]=this.revenue,e},t}();var Gn=function(t,e){var n=Math.max(e,1);return t.reduce(function(r,i,o){var s=Math.floor(o/n);return r[s]||(r[s]=[]),r[s].push(i),r},[])};var Ye="Amplitude Logger ",Ie=function(){function t(){this.logLevel=M.None}return t.prototype.disable=function(){this.logLevel=M.None},t.prototype.enable=function(e){e===void 0&&(e=M.Warn),this.logLevel=e},t.prototype.log=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<M.Verbose||console.log("".concat(Ye,"[Log]: ").concat(e.join(" ")))},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<M.Warn||console.warn("".concat(Ye,"[Warn]: ").concat(e.join(" ")))},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<M.Error||console.error("".concat(Ye,"[Error]: ").concat(e.join(" ")))},t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<M.Debug||console.log("".concat(Ye,"[Debug]: ").concat(e.join(" ")))},t}();var Qe=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:M.Warn,loggerProvider:new Ie,offline:!1,optOut:!1,serverUrl:wt,serverZone:"US",useBatch:!1}},Rt=function(){function t(e){var n,r,i,o;this._optOut=!1;var s=Qe();this.apiKey=e.apiKey,this.flushIntervalMillis=(n=e.flushIntervalMillis)!==null&&n!==void 0?n:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=(r=e.logLevel)!==null&&r!==void 0?r:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline!==void 0?e.offline:s.offline,this.optOut=(i=e.optOut)!==null&&i!==void 0?i:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var u=Dt(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=u.serverZone,this.serverUrl=u.serverUrl}return Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),t}();var Gr=function(t,e){return t==="EU"?e?Vn:Bn:e?Fn:wt},Dt=function(t,e,n){if(t===void 0&&(t=""),e===void 0&&(e=Qe().serverZone),n===void 0&&(n=Qe().useBatch),t)return{serverUrl:t,serverZone:void 0};var r=["US","EU"].includes(e)?e:Qe().serverZone;return{serverZone:r,serverUrl:Gr(r,n)}};function Wr(t){return t instanceof Error?t.message:String(t)}function Xe(t){var e="";try{"body"in t&&(e=JSON.stringify(t.body,null,2))}catch{}return e}var At=function(){function t(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return t.prototype.setup=function(e){var n;return p(this,void 0,void 0,function(){var r,i=this;return f(this,function(o){switch(o.label){case 0:return this.config=e,this.storageKey="".concat(Lt,"_").concat(this.config.apiKey.substring(0,10)),[4,(n=this.config.storageProvider)===null||n===void 0?void 0:n.get(this.storageKey)];case 1:return r=o.sent(),this.saveEvents(),r&&r.length>0&&Promise.all(r.map(function(s){return i.execute(s)})).catch(),[2,Promise.resolve(void 0)]}})})},t.prototype.execute=function(e){var n=this;return new Promise(function(r){var i={event:e,attempts:0,callback:function(o){return r(o)},timeout:0};n.addToQueue(i)})},t.prototype.addToQueue=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n.filter(function(o){return o.attempts<e.config.flushMaxRetries?(o.attempts+=1,!0):(e.fulfillRequest([o],500,An),!1)});i.forEach(function(o){if(e.queue=e.queue.concat(o),o.timeout===0){e.schedule(e.config.flushIntervalMillis);return}setTimeout(function(){o.timeout=0,e.schedule(0)},o.timeout)}),this.saveEvents()},t.prototype.schedule=function(e){var n=this;this.scheduled||this.config.offline||(this.scheduled=setTimeout(function(){n.flush(!0).then(function(){n.queue.length>0&&n.schedule(e)})},e))},t.prototype.flush=function(e){return e===void 0&&(e=!1),p(this,void 0,void 0,function(){var n,r,i,o=this;return f(this,function(s){switch(s.label){case 0:return this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(n=[],r=[],this.queue.forEach(function(u){return u.timeout===0?n.push(u):r.push(u)}),this.queue=r,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),i=Gn(n,this.config.flushQueueSize),[4,Promise.all(i.map(function(u){return o.send(u,e)}))]);case 1:return s.sent(),[2]}})})},t.prototype.send=function(e,n){return n===void 0&&(n=!0),p(this,void 0,void 0,function(){var r,i,o,s,u;return f(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,On)];r={api_key:this.config.apiKey,events:e.map(function(a){var l=a.event,d=l.extra,m=Te(l,["extra"]);return m}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString()},c.label=1;case 1:return c.trys.push([1,3,,4]),i=Dt(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,r)];case 2:return o=c.sent(),o===null?(this.fulfillRequest(e,0,Dn),[2]):n?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(Xe(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return s=c.sent(),u=Wr(s),this.config.loggerProvider.error(u),this.fulfillRequest(e,0,u),[3,4];case 4:return[2]}})})},t.prototype.handleResponse=function(e,n){var r=e.status;switch(r){case x.Success:{this.handleSuccessResponse(e,n);break}case x.Invalid:{this.handleInvalidResponse(e,n);break}case x.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,n);break}case x.RateLimit:{this.handleRateLimitResponse(e,n);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(r,"' provided for ").concat(n.length,' events"}')),this.handleOtherResponse(n);break}}},t.prototype.handleSuccessResponse=function(e,n){this.fulfillRequest(n,e.statusCode,Rn)},t.prototype.handleInvalidResponse=function(e,n){var r=this;if(e.body.missingField||e.body.error.startsWith(Un)){this.fulfillRequest(n,e.statusCode,e.body.error);return}var i=q(q(q(q([],L(Object.values(e.body.eventsWithInvalidFields)),!1),L(Object.values(e.body.eventsWithMissingFields)),!1),L(Object.values(e.body.eventsWithInvalidIdLengths)),!1),L(e.body.silencedEvents),!1).flat(),o=new Set(i),s=n.filter(function(u,c){if(o.has(c)){r.fulfillRequest([u],e.statusCode,e.body.error);return}return!0});s.length>0&&this.config.loggerProvider.warn(Xe(e)),this.addToQueue.apply(this,q([],L(s),!1))},t.prototype.handlePayloadTooLargeResponse=function(e,n){if(n.length===1){this.fulfillRequest(n,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Xe(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,q([],L(n),!1))},t.prototype.handleRateLimitResponse=function(e,n){var r=this,i=Object.keys(e.body.exceededDailyQuotaUsers),o=Object.keys(e.body.exceededDailyQuotaDevices),s=e.body.throttledEvents,u=new Set(i),c=new Set(o),a=new Set(s),l=n.filter(function(d,m){if(d.event.user_id&&u.has(d.event.user_id)||d.event.device_id&&c.has(d.event.device_id)){r.fulfillRequest([d],e.statusCode,e.body.error);return}return a.has(m)&&(d.timeout=r.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(Xe(e)),this.addToQueue.apply(this,q([],L(l),!1))},t.prototype.handleOtherResponse=function(e){var n=this;this.addToQueue.apply(this,q([],L(e.map(function(r){return r.timeout=r.attempts*n.retryTimeout,r})),!1))},t.prototype.fulfillRequest=function(e,n,r){this.saveEvents(),e.forEach(function(i){return i.callback(te(i.event,n,r))})},t.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map(function(n){return n.event}));this.config.storageProvider.set(this.storageKey,e)}},t}();var $r=function(t){t===void 0&&(t=0);var e=new Error().stack||"";return e.split(\`
10
- \`).slice(2+t).map(function(n){return n.trim()})},C=function(t){return function(){var e=v({},t.config),n=e.loggerProvider,r=e.logLevel;return{logger:n,logLevel:r}}},Yr=function(t,e){var n,r;e=e.replace(/\\[(\\w+)\\]/g,".$1"),e=e.replace(/^\\./,"");try{for(var i=Y(e.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(s in t)t=t[s];else return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return t},P=function(t,e){return function(){var n,r,i={};try{for(var o=Y(e),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=Yr(t,u)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},R=function(t,e,n,r,i){return i===void 0&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),c=u.logger,a=u.logLevel;if(a&&a<M.Debug||!a||!c)return t.apply(i,o);var l={type:"invoke public method",name:e,args:o,stacktrace:$r(1),time:{start:new Date().toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=t.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),c.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),c.debug(JSON.stringify(l,null,2))),d}};var ze=function(){function t(){this.memoryStorage=new Map}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2,!0]})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return[2,this.memoryStorage.get(e)]})})},t.prototype.getRaw=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return n=r.sent(),[2,n?JSON.stringify(n):void 0]}})})},t.prototype.set=function(e,n){return p(this,void 0,void 0,function(){return f(this,function(r){return this.memoryStorage.set(e,n),[2]})})},t.prototype.remove=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return this.memoryStorage.delete(e),[2]})})},t.prototype.reset=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return this.memoryStorage.clear(),[2]})})},t}();var pe=function(){function t(){}return t.prototype.send=function(e,n){return Promise.resolve(null)},t.prototype.buildResponse=function(e){var n,r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,k,F,I,S;if(typeof e!="object")return null;var O=e.code||0,B=this.buildStatus(O);switch(B){case x.Success:return{status:B,statusCode:O,body:{eventsIngested:(n=e.events_ingested)!==null&&n!==void 0?n:0,payloadSizeBytes:(r=e.payload_size_bytes)!==null&&r!==void 0?r:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case x.Invalid:return{status:B,statusCode:O,body:{error:(o=e.error)!==null&&o!==void 0?o:"",missingField:(s=e.missing_field)!==null&&s!==void 0?s:"",eventsWithInvalidFields:(u=e.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(c=e.events_with_missing_fields)!==null&&c!==void 0?c:{},eventsWithInvalidIdLengths:(a=e.events_with_invalid_id_lengths)!==null&&a!==void 0?a:{},epsThreshold:(l=e.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(d=e.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(m=e.silenced_devices)!==null&&m!==void 0?m:[],silencedEvents:(y=e.silenced_events)!==null&&y!==void 0?y:[],throttledDevices:(g=e.throttled_devices)!==null&&g!==void 0?g:{},throttledEvents:(T=e.throttled_events)!==null&&T!==void 0?T:[]}};case x.PayloadTooLarge:return{status:B,statusCode:O,body:{error:(h=e.error)!==null&&h!==void 0?h:""}};case x.RateLimit:return{status:B,statusCode:O,body:{error:(_=e.error)!==null&&_!==void 0?_:"",epsThreshold:(U=e.eps_threshold)!==null&&U!==void 0?U:0,throttledDevices:(b=e.throttled_devices)!==null&&b!==void 0?b:{},throttledUsers:(k=e.throttled_users)!==null&&k!==void 0?k:{},exceededDailyQuotaDevices:(F=e.exceeded_daily_quota_devices)!==null&&F!==void 0?F:{},exceededDailyQuotaUsers:(I=e.exceeded_daily_quota_users)!==null&&I!==void 0?I:{},throttledEvents:(S=e.throttled_events)!==null&&S!==void 0?S:[]}};case x.Timeout:default:return{status:B,statusCode:O}}},t.prototype.buildStatus=function(e){return e>=200&&e<300?x.Success:e===429?x.RateLimit:e===413?x.PayloadTooLarge:e===408?x.Timeout:e>=400&&e<500?x.Invalid:e>=500?x.Failed:x.Unknown},t}();var N=function(){if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global};var ge=function(){var t,e=N();if(!(!((t=e?.location)===null||t===void 0)&&t.search))return{};var n=e.location.search.substring(1).split("&").filter(Boolean),r=n.reduce(function(i,o){var s=o.split("=",2),u=Wn(s[0]),c=Wn(s[1]);return c&&(i[u]=c),i},{});return r},Wn=function(t){t===void 0&&(t="");try{return decodeURIComponent(t)}catch{return""}};var $n="utm_campaign",Yn="utm_content",Qn="utm_id",Xn="utm_medium",zn="utm_source",Zn="utm_term",kt="dclid",Ot="fbclid",Ut="gbraid",Mt="gclid",Nt="ko_click_id",Bt="li_fat_id",Ft="msclkid",Vt="rtd_cid",Ht="ttclid",qt="twclid",jt="wbraid";var fe={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0};var Se=function(){function t(){}return t.prototype.parse=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2,v(v(v(v({},fe),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},t.prototype.getUtmParam=function(){var e=ge(),n=e[$n],r=e[Yn],i=e[Qn],o=e[Xn],s=e[zn],u=e[Zn];return{utm_campaign:n,utm_content:r,utm_id:i,utm_medium:o,utm_source:s,utm_term:u}},t.prototype.getReferrer=function(){var e,n,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=(n=(e=r.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&n!==void 0?n:void 0}catch{}return r},t.prototype.getClickIds=function(){var e,n=ge();return e={},e[kt]=n[kt],e[Ot]=n[Ot],e[Ut]=n[Ut],e[Mt]=n[Mt],e[Nt]=n[Nt],e[Bt]=n[Bt],e[Ft]=n[Ft],e[Vt]=n[Vt],e[Ht]=n[Ht],e[qt]=n[qt],e[jt]=n[jt],e},t}();var Ze=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[de,e,t.substring(0,n)].filter(Boolean).join("_")},Kt=function(t){return"".concat(de.toLowerCase(),"_").concat(t.substring(0,6))};var xe=function(t,e){e===void 0&&(e=Date.now());var n=Date.now(),r=n-e;return r>t};var Le=function(){function t(e){this.options=v({},e)}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){var e,n,r,i;return f(this,function(o){switch(o.label){case 0:if(!N())return[2,!1];t.testValue=String(Date.now()),e=new t(this.options),n="AMP_TEST",o.label=1;case 1:return o.trys.push([1,4,5,7]),[4,e.set(n,t.testValue)];case 2:return o.sent(),[4,e.get(n)];case 3:return r=o.sent(),[2,r===t.testValue];case 4:return i=o.sent(),[2,!1];case 5:return[4,e.remove(n)];case 6:return o.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:if(n=r.sent(),!n)return[2,void 0];try{try{n=decodeURIComponent(atob(n))}catch{}return[2,JSON.parse(n)]}catch{return[2,void 0]}return[2]}})})},t.prototype.getRaw=function(e){var n,r;return p(this,void 0,void 0,function(){var i,o,s;return f(this,function(u){return i=N(),o=(r=(n=i?.document)===null||n===void 0?void 0:n.cookie.split("; "))!==null&&r!==void 0?r:[],s=o.find(function(c){return c.indexOf(e+"=")===0}),s?[2,s.substring(e.length+1)]:[2,void 0]})})},t.prototype.set=function(e,n){var r;return p(this,void 0,void 0,function(){var i,o,s,u,c,a;return f(this,function(l){try{i=(r=this.options.expirationDays)!==null&&r!==void 0?r:0,o=n!==null?i:-1,s=void 0,o&&(u=new Date,u.setTime(u.getTime()+o*24*60*60*1e3),s=u),c="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(n)))),s&&(c+="; expires=".concat(s.toUTCString())),c+="; path=/",this.options.domain&&(c+="; domain=".concat(this.options.domain)),this.options.secure&&(c+="; Secure"),this.options.sameSite&&(c+="; SameSite=".concat(this.options.sameSite)),a=N(),a&&(a.document.cookie=c)}catch{}return[2]})})},t.prototype.remove=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return[4,this.set(e,null)];case 1:return n.sent(),[2]}})})},t.prototype.reset=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2]})})},t}();var Gt=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i,o,s;return f(this,function(u){switch(u.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(r),method:"POST"},[4,fetch(n,i)];case 1:return o=u.sent(),[4,o.json()];case 2:return s=u.sent(),[2,this.buildResponse(s)]}})})},e}(pe);var Qr=function(){function t(){}return t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Xr(),platform:"Web",os:void 0,deviceModel:void 0}},t}(),Xr=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},zr=function(){function t(){this.queue=[]}return t.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},t.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(n){e(n)}),this.queue=[])},t}(),ie=function(){return ie=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ie.apply(this,arguments)},Je=function(t,e){var n=["string","number","boolean","undefined"],r=typeof t,i=typeof e;if(r!==i)return!1;for(var o=0,s=n;o<s.length;o++){var u=s[o];if(u===r)return t===e}if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;var c=Array.isArray(t),a=Array.isArray(e);if(c!==a)return!1;if(c&&a){for(var l=0;l<t.length;l++)if(!Je(t[l],e[l]))return!1}else{var d=Object.keys(t).sort(),m=Object.keys(e).sort();if(!Je(d,m))return!1;var y=!0;return Object.keys(t).forEach(function(g){Je(t[g],e[g])||(y=!1)}),y}return!0},Zr="$set",Jr="$unset",ei="$clearAll";Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r});var ti=function(){function t(){this.identity={userProperties:{}},this.listeners=new Set}return t.prototype.editIdentity=function(){var e=this,n=ie({},this.identity.userProperties),r=ie(ie({},this.identity),{userProperties:n});return{setUserId:function(i){return r.userId=i,this},setDeviceId:function(i){return r.deviceId=i,this},setUserProperties:function(i){return r.userProperties=i,this},setOptOut:function(i){return r.optOut=i,this},updateUserProperties:function(i){for(var o=r.userProperties||{},s=0,u=Object.entries(i);s<u.length;s++){var c=u[s],a=c[0],l=c[1];switch(a){case Zr:for(var d=0,m=Object.entries(l);d<m.length;d++){var y=m[d],g=y[0],T=y[1];o[g]=T}break;case Jr:for(var h=0,_=Object.keys(l);h<_.length;h++){var g=_[h];delete o[g]}break;case ei:o={};break}}return r.userProperties=o,this},commit:function(){return e.setIdentity(r),this}}},t.prototype.getIdentity=function(){return ie({},this.identity)},t.prototype.setIdentity=function(e){var n=ie({},this.identity);this.identity=ie({},e),Je(n,this.identity)||this.listeners.forEach(function(r){r(e)})},t.prototype.addIdentityListener=function(e){this.listeners.add(e)},t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},t}(),we=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,Jn=function(){function t(){this.identityStore=new ti,this.eventBridge=new zr,this.applicationContextProvider=new Qr}return t.getInstance=function(e){return we.analyticsConnectorInstances||(we.analyticsConnectorInstances={}),we.analyticsConnectorInstances[e]||(we.analyticsConnectorInstances[e]=new t),we.analyticsConnectorInstances[e]},t}();var oe=function(t){return t===void 0&&(t="$default_instance"),Jn.getInstance(t)},Wt=function(t,e){oe(e).identityStore.editIdentity().setUserId(t).commit()},$t=function(t,e){oe(e).identityStore.editIdentity().setDeviceId(t).commit()};var Yt=function(){function t(){this.name="identity",this.type="before",this.identityStore=oe().identityStore}return t.prototype.execute=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){return n=e.user_properties,n&&this.identityStore.editIdentity().updateUserProperties(n).commit(),[2,e]})})},t.prototype.setup=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return e.instanceName&&(this.identityStore=oe(e.instanceName).identityStore),[2]})})},t}();var Qt=function(){var t,e,n,r;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(r=(n=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&n!==void 0?n:i)!==null&&r!==void 0?r:""};var Ce=function(t,e){return typeof t=="boolean"?t:t?.[e]!==!1},et=function(t){return Ce(t,"attribution")},Xt=function(t){return Ce(t,"fileDownloads")},zt=function(t){return Ce(t,"formInteractions")},tt=function(t){return Ce(t,"pageViews")},Zt=function(t){return Ce(t,"sessions")},Jt=function(t){var e=function(){return!1},n=void 0,r,i=t.pageCounter,o=tt(t.defaultTracking);return o&&(e=void 0,r=void 0,t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews=="object"&&("trackOn"in t.defaultTracking.pageViews&&(e=t.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in t.defaultTracking.pageViews&&(n=t.defaultTracking.pageViews.trackHistoryChanges),"eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType&&(r=t.defaultTracking.pageViews.eventType))),{trackOn:e,trackHistoryChanges:n,eventType:r,pageCounter:i}},en=function(t){return et(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution=="object"?v({},t.defaultTracking.attribution):{}};var nt=function(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.name,o=r.args,s=r.resolve,u=t&&t[i];if(typeof u=="function"){var c=u.apply(t,o);typeof s=="function"&&s(c?.promise)}}return t},rt=function(t){var e=t;return e&&e._q!==void 0};var er="2.5.2";var ni="Web",ri="$remote",tr=function(){function t(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat(er),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return t.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},t.prototype.execute=function(e){var n,r;return p(this,void 0,void 0,function(){var i,o,s,u;return f(this,function(c){return i=new Date().getTime(),o=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1,s=(r=e.event_id)!==null&&r!==void 0?r:o+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=i),u=v(v(v(v(v(v(v(v({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:ni}),this.config.trackingOptions.language&&{language:Qt()}),this.config.trackingOptions.ipAddress&&{ip:ri}),{insert_id:X(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:s,library:this.library,user_agent:this.userAgent}),[2,u]})})},t}();var it=function(){function t(e){this.storage=e}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){var e,n,r,i,o;return f(this,function(s){switch(s.label){case 0:if(!this.storage)return[2,!1];e=String(Date.now()),n=new t(this.storage),r="AMP_TEST",s.label=1;case 1:return s.trys.push([1,4,5,7]),[4,n.set(r,e)];case 2:return s.sent(),[4,n.get(r)];case 3:return i=s.sent(),[2,i===e];case 4:return o=s.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return s.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){var n,r;return f(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return n=i.sent(),n?[2,JSON.parse(n)]:[2,void 0];case 2:return r=i.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},t.prototype.getRaw=function(e){var n;return p(this,void 0,void 0,function(){return f(this,function(r){return[2,((n=this.storage)===null||n===void 0?void 0:n.getItem(e))||void 0]})})},t.prototype.set=function(e,n){var r;return p(this,void 0,void 0,function(){return f(this,function(i){try{(r=this.storage)===null||r===void 0||r.setItem(e,JSON.stringify(n))}catch{}return[2]})})},t.prototype.remove=function(e){var n;return p(this,void 0,void 0,function(){return f(this,function(r){try{(n=this.storage)===null||n===void 0||n.removeItem(e)}catch{}return[2]})})},t.prototype.reset=function(){var e;return p(this,void 0,void 0,function(){return f(this,function(n){try{(e=this.storage)===null||e===void 0||e.clear()}catch{}return[2]})})},t}();var ot=1e3,tn=function(t){V(e,t);function e(n){var r=this,i;return r=t.call(this,(i=N())===null||i===void 0?void 0:i.localStorage)||this,r.loggerProvider=n?.loggerProvider,r}return e.prototype.set=function(n,r){var i;return p(this,void 0,void 0,function(){var o;return f(this,function(s){switch(s.label){case 0:return Array.isArray(r)&&r.length>ot?(o=r.length-ot,[4,t.prototype.set.call(this,n,r.slice(0,ot))]):[3,2];case 1:return s.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(ot,".")),[3,4];case 2:return[4,t.prototype.set.call(this,n,r)];case 3:s.sent(),s.label=4;case 4:return[2]}})})},e}(it);var nr=function(t){V(e,t);function e(){var n;return t.call(this,(n=N())===null||n===void 0?void 0:n.sessionStorage)||this}return e}(it);var rr=function(t){V(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={done:4},n}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i=this;return f(this,function(o){return[2,new Promise(function(s,u){typeof XMLHttpRequest>"u"&&u(new Error("XHRTransport is not supported."));var c=new XMLHttpRequest;c.open("POST",n,!0),c.onreadystatechange=function(){if(c.readyState===i.state.done)try{var a=c.responseText,l=JSON.parse(a),d=i.buildResponse(l);s(d)}catch(m){u(m)}},c.setRequestHeader("Content-Type","application/json"),c.setRequestHeader("Accept","*/*"),c.send(JSON.stringify(r))})]})})},e}(pe);var ir=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i=this;return f(this,function(o){return[2,new Promise(function(s,u){var c=N();if(!c?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(r),l=c.navigator.sendBeacon(n,JSON.stringify(r));return s(l?i.buildResponse({code:200,events_ingested:r.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):i.buildResponse({code:500}))}catch(d){u(d)}})]})})},e}(pe);var or=function(t,e,n){return n===void 0&&(n=!0),p(void 0,void 0,void 0,function(){var r,i,o,s,u,c,a,l,d;return f(this,function(m){switch(m.label){case 0:return r=Kt(t),[4,e.getRaw(r)];case 1:return i=m.sent(),i?n?[4,e.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:m.sent(),m.label=3;case 3:return o=L(i.split("."),6),s=o[0],u=o[1],c=o[2],a=o[3],l=o[4],d=o[5],[2,{deviceId:s,userId:ii(u),sessionId:nn(a),lastEventId:nn(d),lastEventTime:nn(l),optOut:!!c}]}})})},nn=function(t){var e=parseInt(t,32);if(!isNaN(e))return e},ii=function(t){if(!(!atob||!escape||!t))try{return decodeURIComponent(escape(atob(t)))}catch{return}};var j="[Amplitude]",ka="".concat(j," Page Viewed"),rn="".concat(j," Form Started"),sr="".concat(j," Form Submitted"),ar="".concat(j," File Downloaded"),on="session_start",sn="session_end",ur="".concat(j," File Extension"),cr="".concat(j," File Name"),lr="".concat(j," Link ID"),dr="".concat(j," Link Text"),pr="".concat(j," Link URL"),st="".concat(j," Form ID"),at="".concat(j," Form Name"),ut="".concat(j," Form Destination"),Pe="cookie",fr="US";var oi=function(t){V(e,t);function e(n,r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,k,F,I,S,O,B,Z,ne,ce,re,le,ye,_e){i===void 0&&(i=new ze),o===void 0&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),c===void 0&&(c=1e3),a===void 0&&(a=5),l===void 0&&(l=30),d===void 0&&(d=Pe),h===void 0&&(h=new Ie),_===void 0&&(_=M.Warn),b===void 0&&(b=!1),k===void 0&&(k=!1),S===void 0&&(S=""),O===void 0&&(O=fr),Z===void 0&&(Z=30*60*1e3),ne===void 0&&(ne=new tn({loggerProvider:h})),ce===void 0&&(ce={ipAddress:!0,language:!0,platform:!0}),re===void 0&&(re="fetch"),le===void 0&&(le=!1);var E=t.call(this,{apiKey:n,storageProvider:ne,transportProvider:an(re)})||this;return E.apiKey=n,E.appVersion=r,E.cookieOptions=o,E.defaultTracking=s,E.flushIntervalMillis=c,E.flushMaxRetries=a,E.flushQueueSize=l,E.identityStorage=d,E.ingestionMetadata=m,E.instanceName=y,E.loggerProvider=h,E.logLevel=_,E.minIdLength=U,E.offline=b,E.partnerId=F,E.plan=I,E.serverUrl=S,E.serverZone=O,E.sessionTimeout=Z,E.storageProvider=ne,E.trackingOptions=ce,E.transport=re,E.useBatch=le,E._optOut=!1,E._cookieStorage=i,E.deviceId=u,E.lastEventId=g,E.lastEventTime=T,E.optOut=k,E.sessionId=B,E.pageCounter=_e,E.userId=ye,E.loggerProvider.enable(E.logLevel),E}return Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(n){this._cookieStorage!==n&&(this._cookieStorage=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(n){this._deviceId!==n&&(this._deviceId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(n){this._userId!==n&&(this._userId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(n){this._sessionId!==n&&(this._sessionId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(n){this._optOut!==n&&(this._optOut=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(n){this._lastEventTime!==n&&(this._lastEventTime=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(n){this._lastEventId!==n&&(this._lastEventId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(n){this._pageCounter!==n&&(this._pageCounter=n,this.updateStorage())},enumerable:!1,configurable:!0}),e.prototype.updateStorage=function(){var n={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter};this.cookieStorage.set(Ze(this.apiKey),n)},e}(Rt);var mr=function(t,e,n){return e===void 0&&(e={}),p(void 0,void 0,void 0,function(){var r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,k,F,I,S,O,B,Z,ne,ce,re,le,ye,_e,E,pt,ft,mt,vt,gt,ht,yt,_t,Et;return f(this,function(me){switch(me.label){case 0:return r=e.identityStorage||Pe,b={},r===Pe?[3,1]:(o="",[3,5]);case 1:return(F=(k=e.cookieOptions)===null||k===void 0?void 0:k.domain)!==null&&F!==void 0?(s=F,[3,4]):[3,2];case 2:return[4,ai()];case 3:s=me.sent(),me.label=4;case 4:o=s,me.label=5;case 5:return i=v.apply(void 0,[(b.domain=o,b.expiration=365,b.sameSite="Lax",b.secure=!1,b.upgrade=!0,b),e.cookieOptions]),u=si(e.identityStorage,i),[4,or(t,u,(S=(I=e.cookieOptions)===null||I===void 0?void 0:I.upgrade)!==null&&S!==void 0?S:!0)];case 6:return c=me.sent(),[4,u.get(Ze(t))];case 7:return a=me.sent(),l=ge(),d=(ne=(Z=(B=(O=e.deviceId)!==null&&O!==void 0?O:l.deviceId)!==null&&B!==void 0?B:a?.deviceId)!==null&&Z!==void 0?Z:c.deviceId)!==null&&ne!==void 0?ne:X(),m=(ce=a?.lastEventId)!==null&&ce!==void 0?ce:c.lastEventId,y=(re=a?.lastEventTime)!==null&&re!==void 0?re:c.lastEventTime,g=(ye=(le=e.optOut)!==null&&le!==void 0?le:a?.optOut)!==null&&ye!==void 0?ye:c.optOut,T=(_e=a?.sessionId)!==null&&_e!==void 0?_e:c.sessionId,h=(pt=(E=e.userId)!==null&&E!==void 0?E:a?.userId)!==null&&pt!==void 0?pt:c.userId,n.previousSessionDeviceId=(ft=a?.deviceId)!==null&&ft!==void 0?ft:c.deviceId,n.previousSessionUserId=(mt=a?.userId)!==null&&mt!==void 0?mt:c.userId,_={ipAddress:(gt=(vt=e.trackingOptions)===null||vt===void 0?void 0:vt.ipAddress)!==null&&gt!==void 0?gt:!0,language:(yt=(ht=e.trackingOptions)===null||ht===void 0?void 0:ht.language)!==null&&yt!==void 0?yt:!0,platform:(Et=(_t=e.trackingOptions)===null||_t===void 0?void 0:_t.platform)!==null&&Et!==void 0?Et:!0},U=a?.pageCounter,[2,new oi(t,e.appVersion,u,i,e.defaultTracking,d,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,r,e.ingestionMetadata,e.instanceName,m,y,e.loggerProvider,e.logLevel,e.minIdLength,e.offline,g,e.partnerId,e.plan,e.serverUrl,e.serverZone,T,e.sessionTimeout,e.storageProvider,_,e.transport,e.useBatch,h,U)]}})})},si=function(t,e){switch(t===void 0&&(t=Pe),e===void 0&&(e={}),t){case"localStorage":return new tn;case"sessionStorage":return new nr;case"none":return new ze;case"cookie":default:return new Le(v(v({},e),{expirationDays:e.expiration}))}},an=function(t){return t==="xhr"?new rr:t==="beacon"?new ir:new Gt},ai=function(t){return p(void 0,void 0,void 0,function(){var e,n,r,i,o,o,s,u,c,a;return f(this,function(l){switch(l.label){case 0:return[4,new Le().isEnabled()];case 1:if(!l.sent()||!t&&typeof location>"u")return[2,""];for(e=t??location.hostname,n=e.split("."),r=[],i="AMP_TLDTEST",o=n.length-2;o>=0;--o)r.push(n.slice(o).join("."));o=0,l.label=2;case 2:return o<r.length?(s=r[o],u={domain:"."+s},c=new Le(u),[4,c.set(i,1)]):[3,7];case 3:return l.sent(),[4,c.get(i)];case 4:return a=l.sent(),a?[4,c.remove(i)]:[3,6];case 5:return l.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}})})};var gr=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[de,e,t.substring(0,n)].filter(Boolean).join("_")},vr=function(t){var e=t.split(".");return e.length<=2?t:e.slice(e.length-2,e.length).join(".")},ui=function(t){return Object.values(t).every(function(e){return!e})},hr=function(t,e,n,r){r===void 0&&(r=!0);var i=t.referrer,o=t.referring_domain,s=Te(t,["referrer","referring_domain"]),u=e||{},c=u.referrer,a=u.referring_domain,l=Te(u,["referrer","referring_domain"]);if(ci(n.excludeReferrers,t.referring_domain)||!r&&ui(t)&&e)return!1;var d=JSON.stringify(s)!==JSON.stringify(l),m=vr(o||"")!==vr(a||"");return!e||d||m},ci=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=""),t.some(function(n){return n instanceof RegExp?n.test(e):n===e})},yr=function(t,e){var n=v(v({},fe),t),r=Object.entries(n).reduce(function(i,o){var s,u=L(o,2),c=u[0],a=u[1];return i.setOnce("initial_".concat(c),(s=a??e.initialEmptyValue)!==null&&s!==void 0?s:"EMPTY"),a?i.set(c,a):i.unset(c)},new G);return be(r)},_r=function(t){var e=t;return e?(e.startsWith(".")&&(e=e.substring(1)),[new RegExp("".concat(e.replace(".","\\\\."),"$"))]):[]};var un=function(t){var e=this;t===void 0&&(t={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(r,i){var o;return p(this,void 0,void 0,function(){var s,u,c,a,l,d,m,y;return f(this,function(g){switch(g.label){case 0:return s=v({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:_r((o=r.cookieOptions)===null||o===void 0?void 0:o.domain)},t),r.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),u=r.cookieStorage,c=gr(r.apiKey,"MKTG"),[4,Promise.all([new Se().parse(),u.get(c)])];case 1:return a=L.apply(void 0,[g.sent(),2]),l=a[0],d=a[1],m=xe(r.sessionTimeout,r.lastEventTime),hr(l,d,s,m)&&(s.resetSessionOnNewCampaign&&(i.setSessionId(Date.now()),r.loggerProvider.log("Created a new session for new campaign.")),r.loggerProvider.log("Tracking attribution."),y=yr(l,s),i.track(y),u.set(c,l)),[2]}})})},execute:function(r){return p(e,void 0,void 0,function(){return f(this,function(i){return[2,r]})})}};return n};var Er=function(t){var e={};for(var n in t){var r=t[n];r&&(e[n]=r)}return e};var cn=function(t){t===void 0&&(t={});var e,n=N(),r=void 0,i,o,s=function(){return p(void 0,void 0,void 0,function(){var m,y,g;return f(this,function(T){switch(T.label){case 0:return o.pageCounter=o.pageCounter?o.pageCounter+1:1,y={event_type:(g=t.eventType)!==null&&g!==void 0?g:"[Amplitude] Page Viewed"},m=[{}],[4,li()];case 1:return[2,(y.event_properties=v.apply(void 0,[v.apply(void 0,m.concat([T.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":typeof location<"u"&&location.href||"","[Amplitude] Page Path":typeof location<"u"&&location.pathname||"","[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":typeof location<"u"&&location.href.split("?")[0]||"","[Amplitude] Page Counter":o.pageCounter}]),y)]}})})},u=function(){return typeof t.trackOn>"u"||typeof t.trackOn=="function"&&t.trackOn()},c=typeof location<"u"?location.href:null,a=function(){return p(void 0,void 0,void 0,function(){var m,y,g,T,h;return f(this,function(_){switch(_.label){case 0:return m=location.href,y=pi(t.trackHistoryChanges,m,c||"")&&u(),c=m,y?(r?.log("Tracking page view event"),e!=null?[3,1]:(g=void 0,[3,3])):[3,4];case 1:return h=(T=e).track,[4,s()];case 2:g=h.apply(T,[_.sent()]),_.label=3;case 3:_.label=4;case 4:return[2]}})})},l=function(){a()},d={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(m,y){return p(void 0,void 0,void 0,function(){var g,T;return f(this,function(h){switch(h.label){case 0:return e=y,o=m,r=m.loggerProvider,r.log("Installing @amplitude/plugin-page-view-tracking-browser"),n&&(n.addEventListener("popstate",l),i=n.history.pushState,n.history.pushState=new Proxy(n.history.pushState,{apply:function(_,U,b){var k=L(b,3),F=k[0],I=k[1],S=k[2];_.apply(U,[F,I,S]),a()}})),u()?(r.log("Tracking page view event"),T=(g=e).track,[4,s()]):[3,2];case 1:T.apply(g,[h.sent()]),h.label=2;case 2:return[2]}})})},execute:function(m){return p(void 0,void 0,void 0,function(){var y;return f(this,function(g){switch(g.label){case 0:return t.trackOn==="attribution"&&di(m)?(r?.log("Enriching campaign event to page view event with campaign parameters"),[4,s()]):[3,2];case 1:y=g.sent(),m.event_type=y.event_type,m.event_properties=v(v({},m.event_properties),y.event_properties),g.label=2;case 2:return[2,m]}})})},teardown:function(){return p(void 0,void 0,void 0,function(){return f(this,function(m){return n&&(n.removeEventListener("popstate",l),i&&(n.history.pushState=i)),[2]})})}};return d},li=function(){return p(void 0,void 0,void 0,function(){var t;return f(this,function(e){switch(e.label){case 0:return t=Er,[4,new Se().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})},di=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties,n=e[w.SET]||{},r=e[w.UNSET]||{},i=q(q([],L(Object.keys(n)),!1),L(Object.keys(r)),!1);return Object.keys(fe).every(function(o){return i.includes(o)})}return!1},pi=function(t,e,n){switch(t){case"pathOnly":return e.split("?")[0]!==n.split("?")[0];default:return e!==n}};var Tr=function(){var t,e=[],n=function(a,l,d){a.addEventListener(l,d),e.push({element:a,type:l,handler:d})},r=function(){e.forEach(function(a){var l=a.element,d=a.type,m=a.handler;l?.removeEventListener(d,m)}),e=[]},i="@amplitude/plugin-form-interaction-tracking-browser",o="enrichment",s=function(a,l){return p(void 0,void 0,void 0,function(){var d,m;return f(this,function(y){return l?typeof document>"u"?[2]:(d=function(g){var T=!1;n(g,"change",function(){var h;T||l.track(rn,(h={},h[st]=he(g.id),h[at]=he(g.name),h[ut]=g.action,h)),T=!0}),n(g,"submit",function(){var h,_;T||l.track(rn,(h={},h[st]=he(g.id),h[at]=he(g.name),h[ut]=g.action,h)),l.track(sr,(_={},_[st]=he(g.id),_[at]=he(g.name),_[ut]=g.action,_)),T=!1})},m=Array.from(document.getElementsByTagName("form")),m.forEach(d),typeof MutationObserver<"u"&&(t=new MutationObserver(function(g){g.forEach(function(T){T.addedNodes.forEach(function(h){h.nodeName==="FORM"&&d(h),"querySelectorAll"in h&&typeof h.querySelectorAll=="function"&&Array.from(h.querySelectorAll("form")).map(d)})})}),t.observe(document.body,{subtree:!0,childList:!0})),[2]):(a.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])})})},u=function(a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return[2,a]})})},c=function(){return p(void 0,void 0,void 0,function(){return f(this,function(a){return t?.disconnect(),r(),[2]})})};return{name:i,type:o,setup:s,execute:u,teardown:c}},he=function(t){if(typeof t=="string")return t};var br=function(){var t,e=[],n=function(a,l,d){a.addEventListener(l,d),e.push({element:a,type:l,handler:d})},r=function(){e.forEach(function(a){var l=a.element,d=a.type,m=a.handler;l?.removeEventListener(d,m)}),e=[]},i="@amplitude/plugin-file-download-tracking-browser",o="enrichment",s=function(a,l){return p(void 0,void 0,void 0,function(){var d,m,y;return f(this,function(g){return l?typeof document>"u"?[2]:(d=function(T){var h;try{h=new URL(T.href,window.location.href)}catch{return}var _=m.exec(h.href),U=_?.[1];U&&n(T,"click",function(){var b;U&&l.track(ar,(b={},b[ur]=U,b[cr]=h.pathname,b[lr]=T.id,b[dr]=T.text,b[pr]=T.href,b))})},m=/\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/,y=Array.from(document.getElementsByTagName("a")),y.forEach(d),typeof MutationObserver<"u"&&(t=new MutationObserver(function(T){T.forEach(function(h){h.addedNodes.forEach(function(_){_.nodeName==="A"&&d(_),"querySelectorAll"in _&&typeof _.querySelectorAll=="function"&&Array.from(_.querySelectorAll("a")).map(d)})})}),t.observe(document.body,{subtree:!0,childList:!0})),[2]):(a.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])})})},u=function(a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return[2,a]})})},c=function(){return p(void 0,void 0,void 0,function(){return f(this,function(a){return t?.disconnect(),r(),[2]})})};return{name:i,type:o,setup:s,execute:u,teardown:c}};var Ir=!1,Sr=function(t){if(!(Ir||t.defaultTracking!==void 0)){var e=\`\\\`options.defaultTracking\\\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \\\`options.defaultTracking\\\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:
25
+ `),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function Go(e){return Qo(e,`"use strict";(()=>{var Hr=Object.defineProperty;var qr=(t,e)=>{for(var n in e)Hr(t,n,{get:e[n],enumerable:!0})};var W=(t,e)=>{It(t);let n=t.querySelector("aside");n.dataset.view=e,n.classList.remove("section-ready"),setTimeout(()=>{n.classList.add("section-ready")},200)},pn=t=>{Array.from(t.querySelectorAll(".back-button")).forEach(e=>{e.addEventListener("click",n=>{It(t),n.preventDefault(),n.stopPropagation();let r=n.target;W(t,r?.dataset.back||"nav-home")})})},Tt=(t,e)=>{It(t);let n=t.querySelector("aside"),r=document.createElement("div");r.className="ui-toast",r.innerHTML=e,n.appendChild(r),setTimeout(()=>{r.classList.add("ui-toast-show"),setTimeout(()=>{r.classList.remove("ui-toast-show"),setTimeout(()=>{r.remove()},500)},4e3)},30)},It=t=>{let e=t.querySelector("aside");Array.from(e.querySelectorAll(".ui-toast")).forEach(r=>{r.classList.remove("ui-toast-show")})},ke=()=>{let t=fn();return localStorage.getItem(t)!=="true"},bt=t=>{let e=fn();t?localStorage.removeItem(e):localStorage.setItem(e,"true")},fn=()=>jr("disableEdit"),jr=t=>\`builder.__LOCAL_APP_ID__.\${t}\`,mn=()=>{let e=document.body.querySelector("[builder-content-id]")?.getAttribute("builder-content-id");return Ee(e)},Ee=(t,e)=>{let n="/content";t&&(n+="/"+t+"/edit");let r=new URL(n,"https://builder.io");t&&e&&r.searchParams.set("selectedBlock",e);let i=new URL(location.pathname,location.href);return r.searchParams.set("overridePreviewUrl",i.href),r.href},Oe="__DEV_TOOLS_URL__",A={components:[],registryPath:"",registryDisplayPath:"",frameworks:[],dependencies:[],publicApiKey:void 0,devToolsVersion:""},J=t=>{A.components=t.components,A.registryPath=t.registryPath,A.registryDisplayPath=t.registryDisplayPath,A.dependencies=t.dependencies,A.publicApiKey=t.publicApiKey};function vn(t){let e=null,n=document.querySelector("builder-dev-tools-menu"),r=()=>{t.hide()},i=u=>{let c=u.target;if(!c){r();return}if(c.closest("builder-dev-tools-edit"))return;let a=c.closest("[builder-content-id]"),l=c.closest("[builder-id]");if(!a||!l){t.hide();return}let d=t.show(a,l);!d||d===e||(n.highlightOpener(),e=d)};document.addEventListener("pointerover",i,{passive:!0}),document.addEventListener("pointerleave",r,{passive:!0}),document.addEventListener("pointercancel",r,{passive:!0}),document.addEventListener("visibilitychange",r,{passive:!0}),window.addEventListener("popstate",r,{passive:!0});let o=history.pushState;history.pushState=function(...u){t.hide(),o.apply(this,u)};let s=history.replaceState;history.replaceState=function(...u){t.hide(),s.apply(this,u)}}var Ue=class extends HTMLElement{openInBuilder=null;block=null;constructor(){super()}connectedCallback(){this.setAttribute("aria-hidden","true");let e=this.attachShadow({mode:"open"});e.innerHTML='<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}:host{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}#content-highlight,#block{position:absolute}#content-highlight{border:3px solid var(--primary-color);background-color:var(--primary-color-alpha)}a{position:absolute;top:-33px;left:0;display:block;padding:5px 10px 8px;pointer-events:auto;z-index:100;text-decoration:none}a:hover{text-decoration:none}a span{display:block;padding:3px 6px;font-size:10px;font-weight:300;border-radius:3px;text-align:center;text-decoration:none;pointer-events:none;background-color:var(--edit-color);color:var(--text-color);white-space:nowrap}a:hover span{background-color:var(--edit-color-highlight)}a:hover~.outline{border-color:var(--edit-color-highlight)}#open-in-editor{display:none}.outline{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid var(--edit-color);background-color:var(--edit-color-alpha)}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>',this.openInBuilder=e.getElementById("open-in-builder"),this.block=e.getElementById("block"),vn(this)}show(e,n){if(!ke())return this.hide(),null;let r=e.getAttribute("builder-content-id"),i=n.getAttribute("builder-id");if(!r||!i)return this.hide(),null;let o=this.block,s=this.openInBuilder,u=n.getBoundingClientRect();o.style.top=u.top+window.scrollY-1+"px",o.style.left=u.left+window.scrollX+"px",o.style.width=u.width+"px",o.style.height=u.height+1+"px";let c=s.getBoundingClientRect();if(c.width>u.width){let a=c.width-u.width;s.style.left=a/2*-1+"px"}else s.style.left="";return s.href=Ee(r,i),this.style.display="block",i}hide(){this.style.display=""}};var gn="preview-url";var hn="_b-uid";var yn="/~builder-connect";var _n="/~builder-dev-tools";var En="https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";var Tn=()=>$({type:"validateBuilder"}),ve=t=>$({type:"launchEditor",data:t}),In=t=>$({type:"getRegistry",data:t}),bn=t=>$({type:"loadComponent",data:t}),Sn=t=>$({type:"registerComponent",data:t}),xn=t=>$({type:"setComponentInfo",data:t}),Me=t=>$({type:"setComponentInput",data:t}),Ln=t=>$({type:"unregisterComponent",data:t}),wn=t=>$({type:"enableDevTools",data:{enabled:t}}),Cn=()=>$({type:"localConfig"}),$=async t=>{let e=new URL(_n,Oe),n;try{n=await fetch(e,{method:"POST",body:JSON.stringify(t)})}catch(i){throw console.error(\`Devtools Fetch Error, \${e.href}\`,i),new Error("Builder Devtools Fetch Error")}if((n.headers.get("content-type")||"").includes("application/json")){let i=await n.json();if(n.ok)return i.data;if(Array.isArray(i.errors)&&i.errors.length>0)throw i.errors.forEach(o=>console.error(o)),new Error(\`Builder Devtools Fetch Error: \${i.errors[0]}\`)}throw new Error(\`Builder Devtools Fetch Error: \${n.status}, \${await n.text()}\`)};var Pn=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}],Ne=["color","date","email","file","longText","richText","string"],Be=["number"],Fe=["boolean"],Ve=["list"],He=["object"];function qe(t){return Ne.includes(t)?"string":Be.includes(t)?"number":Fe.includes(t)?"boolean":Ve.includes(t)?"array":He.includes(t)?"object":"string"}var $i=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(t=>t.toLowerCase()));var St=function(t,e){return St=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},St(t,e)};function V(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");St(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v.apply(this,arguments)};function Te(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function p(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(d){s(d)}}function c(l){try{a(r.throw(l))}catch(d){s(d)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function f(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function Y(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function q(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Rn="Event tracked successfully",Dn="Unexpected error occurred",An="Event rejected due to exceeded retry count",kn="Event skipped due to optOut config",On="Event rejected due to missing API key",Un="Invalid API key",Mn="Client not initialized";var Ge={};qr(Ge,{IdentifyOperation:()=>w,LogLevel:()=>M,OfflineDisabled:()=>Ke,RevenueProperty:()=>Q,ServerZone:()=>je,SpecialEventType:()=>ee,Status:()=>x});var w;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(w||(w={}));var Q;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE="$revenue"})(Q||(Q={}));var ee;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(ee||(ee={}));var M;(function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose",t[t.Debug=4]="Debug"})(M||(M={}));var je;(function(t){t.US="US",t.EU="EU"})(je||(je={}));var x;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(x||(x={}));var Ke=null;var te=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=x.Unknown),{event:t,code:e,message:n}};var X=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,X)};var Nn=function(){function t(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return t.prototype.register=function(e,n){var r,i,o;return p(this,void 0,void 0,function(){return f(this,function(s){switch(s.label){case 0:return e.name=(r=e.name)!==null&&r!==void 0?r:X(),e.type=(i=e.type)!==null&&i!==void 0?i:"enrichment",[4,(o=e.setup)===null||o===void 0?void 0:o.call(e,n,this.client)];case 1:return s.sent(),this.plugins.push(e),[2]}})})},t.prototype.deregister=function(e){var n;return p(this,void 0,void 0,function(){var r,i;return f(this,function(o){switch(o.label){case 0:return r=this.plugins.findIndex(function(s){return s.name===e}),i=this.plugins[r],this.plugins.splice(r,1),[4,(n=i.teardown)===null||n===void 0?void 0:n.call(i)];case 1:return o.sent(),[2]}})})},t.prototype.reset=function(e){this.applying=!1;var n=this.plugins;n.map(function(r){var i;return(i=r.teardown)===null||i===void 0?void 0:i.call(r)}),this.plugins=[],this.client=e},t.prototype.push=function(e){var n=this;return new Promise(function(r){n.queue.push([e,r]),n.scheduleApply(0)})},t.prototype.scheduleApply=function(e){var n=this;this.applying||(this.applying=!0,setTimeout(function(){n.apply(n.queue.shift()).then(function(){n.applying=!1,n.queue.length>0&&n.scheduleApply(0)})},e))},t.prototype.apply=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c,y,g,a,l,d,m,y,g,T,h,_,U,I,k,F;return f(this,function(b){switch(b.label){case 0:if(!e)return[2];n=L(e,1),r=n[0],i=L(e,2),o=i[1],s=this.plugins.filter(function(S){return S.type==="before"}),b.label=1;case 1:b.trys.push([1,6,7,8]),u=Y(s),c=u.next(),b.label=2;case 2:return c.done?[3,5]:(y=c.value,y.execute?[4,y.execute(v({},r))]:[3,4]);case 3:if(g=b.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,b.label=4;case 4:return c=u.next(),[3,2];case 5:return[3,8];case 6:return a=b.sent(),U={error:a},[3,8];case 7:try{c&&!c.done&&(I=u.return)&&I.call(u)}finally{if(U)throw U.error}return[7];case 8:l=this.plugins.filter(function(S){return S.type==="enrichment"||S.type===void 0}),b.label=9;case 9:b.trys.push([9,14,15,16]),d=Y(l),m=d.next(),b.label=10;case 10:return m.done?[3,13]:(y=m.value,y.execute?[4,y.execute(v({},r))]:[3,12]);case 11:if(g=b.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,b.label=12;case 12:return m=d.next(),[3,10];case 13:return[3,16];case 14:return T=b.sent(),k={error:T},[3,16];case 15:try{m&&!m.done&&(F=d.return)&&F.call(d)}finally{if(k)throw k.error}return[7];case 16:return h=this.plugins.filter(function(S){return S.type==="destination"}),_=h.map(function(S){var O=v({},r);return S.execute(O).catch(function(B){return te(O,0,String(B))})}),Promise.all(_).then(function(S){var O=L(S,1),B=O[0],Z=B||te(r,100,"Event not tracked, no destination plugins on the instance");o(Z)}),[2]}})})},t.prototype.flush=function(){return p(this,void 0,void 0,function(){var e,n,r,i=this;return f(this,function(o){switch(o.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(s){return i.apply(s)}))];case 1:return o.sent(),n=this.plugins.filter(function(s){return s.type==="destination"}),r=n.map(function(s){return s.flush&&s.flush()}),[4,Promise.all(r)];case 2:return o.sent(),[2]}})})},t}();var xt="-",de="AMP",Lt="".concat(de,"_unsent"),wt="https://api2.amplitude.com/2/httpapi",Bn="https://api.eu.amplitude.com/2/httpapi",Fn="https://api2.amplitude.com/batch",Vn="https://api.eu.amplitude.com/batch";var Kr=1e3,We=function(t){if(Object.keys(t).length>Kr)return!1;for(var e in t){var n=t[e];if(!Ct(e,n))return!1}return!0},Ct=function(t,e){var n,r;if(typeof t!="string")return!1;if(Array.isArray(e)){var i=!0;try{for(var o=Y(e),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if(typeof u=="object")i=i&&We(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(e==null)return!1;if(typeof e=="object")return We(e);if(!["number","string","boolean"].includes(typeof e))return!1}return!0};var G=function(){function t(){this._propertySet=new Set,this._properties={}}return t.prototype.getUserProperties=function(){return v({},this._properties)},t.prototype.set=function(e,n){return this._safeSet(w.SET,e,n),this},t.prototype.setOnce=function(e,n){return this._safeSet(w.SET_ONCE,e,n),this},t.prototype.append=function(e,n){return this._safeSet(w.APPEND,e,n),this},t.prototype.prepend=function(e,n){return this._safeSet(w.PREPEND,e,n),this},t.prototype.postInsert=function(e,n){return this._safeSet(w.POSTINSERT,e,n),this},t.prototype.preInsert=function(e,n){return this._safeSet(w.PREINSERT,e,n),this},t.prototype.remove=function(e,n){return this._safeSet(w.REMOVE,e,n),this},t.prototype.add=function(e,n){return this._safeSet(w.ADD,e,n),this},t.prototype.unset=function(e){return this._safeSet(w.UNSET,e,xt),this},t.prototype.clearAll=function(){return this._properties={},this._properties[w.CLEAR_ALL]=xt,this},t.prototype._safeSet=function(e,n,r){if(this._validate(e,n,r)){var i=this._properties[e];return i===void 0&&(i={},this._properties[e]=i),i[n]=r,this._propertySet.add(n),!0}return!1},t.prototype._validate=function(e,n,r){return this._properties[w.CLEAR_ALL]!==void 0||this._propertySet.has(n)?!1:e===w.ADD?typeof r=="number":e!==w.UNSET&&e!==w.REMOVE?Ct(n,r):!0},t}();var Hn=function(t,e,n){var r=typeof t=="string"?{event_type:t}:t;return v(v(v({},r),n),e&&{event_properties:e})},Ie=function(t,e){var n=v(v({},e),{event_type:ee.IDENTIFY,user_properties:t.getUserProperties()});return n},qn=function(t,e,n,r){var i,o=v(v({},r),{event_type:ee.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[t]=e,i)});return o},jn=function(t,e,n){var r,i=new G;i.set(t,e);var o=v(v({},n),{event_type:ee.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[t]=e,r)});return o},Kn=function(t,e){return v(v({},e),{event_type:ee.REVENUE,event_properties:t.getEventProperties()})};var H=function(t){return{promise:t||Promise.resolve()}};var Pt=function(){function t(e){e===void 0&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Nn(this),this.name=e}return t.prototype._init=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return n.sent(),[2]}})})},t.prototype.runQueuedFunctions=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c;return f(this,function(a){switch(a.label){case 0:n=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,6,7,8]),r=Y(n),i=r.next(),a.label=2;case 2:return i.done?[3,5]:(o=i.value,[4,o()]);case 3:a.sent(),a.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s=a.sent(),u={error:s},[3,8];case 7:try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}return[7];case 8:return[2]}})})},t.prototype.track=function(e,n,r){var i=Hn(e,n,r);return H(this.dispatch(i))},t.prototype.identify=function(e,n){var r=Ie(e,n);return H(this.dispatch(r))},t.prototype.groupIdentify=function(e,n,r,i){var o=qn(e,n,r,i);return H(this.dispatch(o))},t.prototype.setGroup=function(e,n,r){var i=jn(e,n,r);return H(this.dispatch(i))},t.prototype.revenue=function(e,n){var r=Kn(e,n);return H(this.dispatch(r))},t.prototype.add=function(e){return this.config?H(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),H())},t.prototype.remove=function(e){return this.config?H(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),H())},t.prototype.dispatchWithCallback=function(e,n){if(!this.config)return n(te(e,0,Mn));this.process(e).then(n)},t.prototype.dispatch=function(e){return p(this,void 0,void 0,function(){var n=this;return f(this,function(r){return this.config?[2,this.process(e)]:[2,new Promise(function(i){n.dispatchQ.push(n.dispatchWithCallback.bind(n,e,i))})]})})},t.prototype.process=function(e){return p(this,void 0,void 0,function(){var i,n,r,i;return f(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.config.optOut?[2,te(e,0,kn)]:[4,this.timeline.push(e)];case 1:return i=o.sent(),i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return n=o.sent(),r=String(n),this.config.loggerProvider.error(r),i=te(e,0,r),[2,i];case 3:return[2]}})})},t.prototype.setOptOut=function(e){if(!this.config){this.q.push(this.setOptOut.bind(this,!!e));return}this.config.optOut=!!e},t.prototype.flush=function(){return H(this.timeline.flush())},t}();var $e=function(){function t(){this.productId="",this.quantity=1,this.price=0}return t.prototype.setProductId=function(e){return this.productId=e,this},t.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},t.prototype.setPrice=function(e){return this.price=e,this},t.prototype.setRevenueType=function(e){return this.revenueType=e,this},t.prototype.setRevenue=function(e){return this.revenue=e,this},t.prototype.setEventProperties=function(e){return We(e)&&(this.properties=e),this},t.prototype.getEventProperties=function(){var e=this.properties?v({},this.properties):{};return e[Q.REVENUE_PRODUCT_ID]=this.productId,e[Q.REVENUE_QUANTITY]=this.quantity,e[Q.REVENUE_PRICE]=this.price,e[Q.REVENUE_TYPE]=this.revenueType,e[Q.REVENUE]=this.revenue,e},t}();var Gn=function(t,e){var n=Math.max(e,1);return t.reduce(function(r,i,o){var s=Math.floor(o/n);return r[s]||(r[s]=[]),r[s].push(i),r},[])};var Ye="Amplitude Logger ",be=function(){function t(){this.logLevel=M.None}return t.prototype.disable=function(){this.logLevel=M.None},t.prototype.enable=function(e){e===void 0&&(e=M.Warn),this.logLevel=e},t.prototype.log=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<M.Verbose||console.log("".concat(Ye,"[Log]: ").concat(e.join(" ")))},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<M.Warn||console.warn("".concat(Ye,"[Warn]: ").concat(e.join(" ")))},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<M.Error||console.error("".concat(Ye,"[Error]: ").concat(e.join(" ")))},t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<M.Debug||console.log("".concat(Ye,"[Debug]: ").concat(e.join(" ")))},t}();var Qe=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:M.Warn,loggerProvider:new be,offline:!1,optOut:!1,serverUrl:wt,serverZone:"US",useBatch:!1}},Rt=function(){function t(e){var n,r,i,o;this._optOut=!1;var s=Qe();this.apiKey=e.apiKey,this.flushIntervalMillis=(n=e.flushIntervalMillis)!==null&&n!==void 0?n:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=(r=e.logLevel)!==null&&r!==void 0?r:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline!==void 0?e.offline:s.offline,this.optOut=(i=e.optOut)!==null&&i!==void 0?i:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var u=Dt(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=u.serverZone,this.serverUrl=u.serverUrl}return Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),t}();var Gr=function(t,e){return t==="EU"?e?Vn:Bn:e?Fn:wt},Dt=function(t,e,n){if(t===void 0&&(t=""),e===void 0&&(e=Qe().serverZone),n===void 0&&(n=Qe().useBatch),t)return{serverUrl:t,serverZone:void 0};var r=["US","EU"].includes(e)?e:Qe().serverZone;return{serverZone:r,serverUrl:Gr(r,n)}};function Wr(t){return t instanceof Error?t.message:String(t)}function Xe(t){var e="";try{"body"in t&&(e=JSON.stringify(t.body,null,2))}catch{}return e}var At=function(){function t(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return t.prototype.setup=function(e){var n;return p(this,void 0,void 0,function(){var r,i=this;return f(this,function(o){switch(o.label){case 0:return this.config=e,this.storageKey="".concat(Lt,"_").concat(this.config.apiKey.substring(0,10)),[4,(n=this.config.storageProvider)===null||n===void 0?void 0:n.get(this.storageKey)];case 1:return r=o.sent(),this.saveEvents(),r&&r.length>0&&Promise.all(r.map(function(s){return i.execute(s)})).catch(),[2,Promise.resolve(void 0)]}})})},t.prototype.execute=function(e){var n=this;return new Promise(function(r){var i={event:e,attempts:0,callback:function(o){return r(o)},timeout:0};n.addToQueue(i)})},t.prototype.addToQueue=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n.filter(function(o){return o.attempts<e.config.flushMaxRetries?(o.attempts+=1,!0):(e.fulfillRequest([o],500,An),!1)});i.forEach(function(o){if(e.queue=e.queue.concat(o),o.timeout===0){e.schedule(e.config.flushIntervalMillis);return}setTimeout(function(){o.timeout=0,e.schedule(0)},o.timeout)}),this.saveEvents()},t.prototype.schedule=function(e){var n=this;this.scheduled||this.config.offline||(this.scheduled=setTimeout(function(){n.flush(!0).then(function(){n.queue.length>0&&n.schedule(e)})},e))},t.prototype.flush=function(e){return e===void 0&&(e=!1),p(this,void 0,void 0,function(){var n,r,i,o=this;return f(this,function(s){switch(s.label){case 0:return this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(n=[],r=[],this.queue.forEach(function(u){return u.timeout===0?n.push(u):r.push(u)}),this.queue=r,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),i=Gn(n,this.config.flushQueueSize),[4,Promise.all(i.map(function(u){return o.send(u,e)}))]);case 1:return s.sent(),[2]}})})},t.prototype.send=function(e,n){return n===void 0&&(n=!0),p(this,void 0,void 0,function(){var r,i,o,s,u;return f(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,On)];r={api_key:this.config.apiKey,events:e.map(function(a){var l=a.event,d=l.extra,m=Te(l,["extra"]);return m}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString()},c.label=1;case 1:return c.trys.push([1,3,,4]),i=Dt(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,r)];case 2:return o=c.sent(),o===null?(this.fulfillRequest(e,0,Dn),[2]):n?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(Xe(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return s=c.sent(),u=Wr(s),this.config.loggerProvider.error(u),this.fulfillRequest(e,0,u),[3,4];case 4:return[2]}})})},t.prototype.handleResponse=function(e,n){var r=e.status;switch(r){case x.Success:{this.handleSuccessResponse(e,n);break}case x.Invalid:{this.handleInvalidResponse(e,n);break}case x.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,n);break}case x.RateLimit:{this.handleRateLimitResponse(e,n);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(r,"' provided for ").concat(n.length,' events"}')),this.handleOtherResponse(n);break}}},t.prototype.handleSuccessResponse=function(e,n){this.fulfillRequest(n,e.statusCode,Rn)},t.prototype.handleInvalidResponse=function(e,n){var r=this;if(e.body.missingField||e.body.error.startsWith(Un)){this.fulfillRequest(n,e.statusCode,e.body.error);return}var i=q(q(q(q([],L(Object.values(e.body.eventsWithInvalidFields)),!1),L(Object.values(e.body.eventsWithMissingFields)),!1),L(Object.values(e.body.eventsWithInvalidIdLengths)),!1),L(e.body.silencedEvents),!1).flat(),o=new Set(i),s=n.filter(function(u,c){if(o.has(c)){r.fulfillRequest([u],e.statusCode,e.body.error);return}return!0});s.length>0&&this.config.loggerProvider.warn(Xe(e)),this.addToQueue.apply(this,q([],L(s),!1))},t.prototype.handlePayloadTooLargeResponse=function(e,n){if(n.length===1){this.fulfillRequest(n,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Xe(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,q([],L(n),!1))},t.prototype.handleRateLimitResponse=function(e,n){var r=this,i=Object.keys(e.body.exceededDailyQuotaUsers),o=Object.keys(e.body.exceededDailyQuotaDevices),s=e.body.throttledEvents,u=new Set(i),c=new Set(o),a=new Set(s),l=n.filter(function(d,m){if(d.event.user_id&&u.has(d.event.user_id)||d.event.device_id&&c.has(d.event.device_id)){r.fulfillRequest([d],e.statusCode,e.body.error);return}return a.has(m)&&(d.timeout=r.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(Xe(e)),this.addToQueue.apply(this,q([],L(l),!1))},t.prototype.handleOtherResponse=function(e){var n=this;this.addToQueue.apply(this,q([],L(e.map(function(r){return r.timeout=r.attempts*n.retryTimeout,r})),!1))},t.prototype.fulfillRequest=function(e,n,r){this.saveEvents(),e.forEach(function(i){return i.callback(te(i.event,n,r))})},t.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map(function(n){return n.event}));this.config.storageProvider.set(this.storageKey,e)}},t}();var $r=function(t){t===void 0&&(t=0);var e=new Error().stack||"";return e.split(\`
26
+ \`).slice(2+t).map(function(n){return n.trim()})},C=function(t){return function(){var e=v({},t.config),n=e.loggerProvider,r=e.logLevel;return{logger:n,logLevel:r}}},Yr=function(t,e){var n,r;e=e.replace(/\\[(\\w+)\\]/g,".$1"),e=e.replace(/^\\./,"");try{for(var i=Y(e.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(s in t)t=t[s];else return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return t},P=function(t,e){return function(){var n,r,i={};try{for(var o=Y(e),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=Yr(t,u)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},R=function(t,e,n,r,i){return i===void 0&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),c=u.logger,a=u.logLevel;if(a&&a<M.Debug||!a||!c)return t.apply(i,o);var l={type:"invoke public method",name:e,args:o,stacktrace:$r(1),time:{start:new Date().toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=t.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),c.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),c.debug(JSON.stringify(l,null,2))),d}};var ze=function(){function t(){this.memoryStorage=new Map}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2,!0]})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return[2,this.memoryStorage.get(e)]})})},t.prototype.getRaw=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return n=r.sent(),[2,n?JSON.stringify(n):void 0]}})})},t.prototype.set=function(e,n){return p(this,void 0,void 0,function(){return f(this,function(r){return this.memoryStorage.set(e,n),[2]})})},t.prototype.remove=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return this.memoryStorage.delete(e),[2]})})},t.prototype.reset=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return this.memoryStorage.clear(),[2]})})},t}();var pe=function(){function t(){}return t.prototype.send=function(e,n){return Promise.resolve(null)},t.prototype.buildResponse=function(e){var n,r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,I,k,F,b,S;if(typeof e!="object")return null;var O=e.code||0,B=this.buildStatus(O);switch(B){case x.Success:return{status:B,statusCode:O,body:{eventsIngested:(n=e.events_ingested)!==null&&n!==void 0?n:0,payloadSizeBytes:(r=e.payload_size_bytes)!==null&&r!==void 0?r:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case x.Invalid:return{status:B,statusCode:O,body:{error:(o=e.error)!==null&&o!==void 0?o:"",missingField:(s=e.missing_field)!==null&&s!==void 0?s:"",eventsWithInvalidFields:(u=e.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(c=e.events_with_missing_fields)!==null&&c!==void 0?c:{},eventsWithInvalidIdLengths:(a=e.events_with_invalid_id_lengths)!==null&&a!==void 0?a:{},epsThreshold:(l=e.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(d=e.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(m=e.silenced_devices)!==null&&m!==void 0?m:[],silencedEvents:(y=e.silenced_events)!==null&&y!==void 0?y:[],throttledDevices:(g=e.throttled_devices)!==null&&g!==void 0?g:{},throttledEvents:(T=e.throttled_events)!==null&&T!==void 0?T:[]}};case x.PayloadTooLarge:return{status:B,statusCode:O,body:{error:(h=e.error)!==null&&h!==void 0?h:""}};case x.RateLimit:return{status:B,statusCode:O,body:{error:(_=e.error)!==null&&_!==void 0?_:"",epsThreshold:(U=e.eps_threshold)!==null&&U!==void 0?U:0,throttledDevices:(I=e.throttled_devices)!==null&&I!==void 0?I:{},throttledUsers:(k=e.throttled_users)!==null&&k!==void 0?k:{},exceededDailyQuotaDevices:(F=e.exceeded_daily_quota_devices)!==null&&F!==void 0?F:{},exceededDailyQuotaUsers:(b=e.exceeded_daily_quota_users)!==null&&b!==void 0?b:{},throttledEvents:(S=e.throttled_events)!==null&&S!==void 0?S:[]}};case x.Timeout:default:return{status:B,statusCode:O}}},t.prototype.buildStatus=function(e){return e>=200&&e<300?x.Success:e===429?x.RateLimit:e===413?x.PayloadTooLarge:e===408?x.Timeout:e>=400&&e<500?x.Invalid:e>=500?x.Failed:x.Unknown},t}();var N=function(){if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global};var ge=function(){var t,e=N();if(!(!((t=e?.location)===null||t===void 0)&&t.search))return{};var n=e.location.search.substring(1).split("&").filter(Boolean),r=n.reduce(function(i,o){var s=o.split("=",2),u=Wn(s[0]),c=Wn(s[1]);return c&&(i[u]=c),i},{});return r},Wn=function(t){t===void 0&&(t="");try{return decodeURIComponent(t)}catch{return""}};var $n="utm_campaign",Yn="utm_content",Qn="utm_id",Xn="utm_medium",zn="utm_source",Zn="utm_term",kt="dclid",Ot="fbclid",Ut="gbraid",Mt="gclid",Nt="ko_click_id",Bt="li_fat_id",Ft="msclkid",Vt="rtd_cid",Ht="ttclid",qt="twclid",jt="wbraid";var fe={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0};var Se=function(){function t(){}return t.prototype.parse=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2,v(v(v(v({},fe),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},t.prototype.getUtmParam=function(){var e=ge(),n=e[$n],r=e[Yn],i=e[Qn],o=e[Xn],s=e[zn],u=e[Zn];return{utm_campaign:n,utm_content:r,utm_id:i,utm_medium:o,utm_source:s,utm_term:u}},t.prototype.getReferrer=function(){var e,n,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=(n=(e=r.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&n!==void 0?n:void 0}catch{}return r},t.prototype.getClickIds=function(){var e,n=ge();return e={},e[kt]=n[kt],e[Ot]=n[Ot],e[Ut]=n[Ut],e[Mt]=n[Mt],e[Nt]=n[Nt],e[Bt]=n[Bt],e[Ft]=n[Ft],e[Vt]=n[Vt],e[Ht]=n[Ht],e[qt]=n[qt],e[jt]=n[jt],e},t}();var Ze=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[de,e,t.substring(0,n)].filter(Boolean).join("_")},Kt=function(t){return"".concat(de.toLowerCase(),"_").concat(t.substring(0,6))};var xe=function(t,e){e===void 0&&(e=Date.now());var n=Date.now(),r=n-e;return r>t};var Le=function(){function t(e){this.options=v({},e)}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){var e,n,r,i;return f(this,function(o){switch(o.label){case 0:if(!N())return[2,!1];t.testValue=String(Date.now()),e=new t(this.options),n="AMP_TEST",o.label=1;case 1:return o.trys.push([1,4,5,7]),[4,e.set(n,t.testValue)];case 2:return o.sent(),[4,e.get(n)];case 3:return r=o.sent(),[2,r===t.testValue];case 4:return i=o.sent(),[2,!1];case 5:return[4,e.remove(n)];case 6:return o.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:if(n=r.sent(),!n)return[2,void 0];try{try{n=decodeURIComponent(atob(n))}catch{}return[2,JSON.parse(n)]}catch{return[2,void 0]}return[2]}})})},t.prototype.getRaw=function(e){var n,r;return p(this,void 0,void 0,function(){var i,o,s;return f(this,function(u){return i=N(),o=(r=(n=i?.document)===null||n===void 0?void 0:n.cookie.split("; "))!==null&&r!==void 0?r:[],s=o.find(function(c){return c.indexOf(e+"=")===0}),s?[2,s.substring(e.length+1)]:[2,void 0]})})},t.prototype.set=function(e,n){var r;return p(this,void 0,void 0,function(){var i,o,s,u,c,a;return f(this,function(l){try{i=(r=this.options.expirationDays)!==null&&r!==void 0?r:0,o=n!==null?i:-1,s=void 0,o&&(u=new Date,u.setTime(u.getTime()+o*24*60*60*1e3),s=u),c="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(n)))),s&&(c+="; expires=".concat(s.toUTCString())),c+="; path=/",this.options.domain&&(c+="; domain=".concat(this.options.domain)),this.options.secure&&(c+="; Secure"),this.options.sameSite&&(c+="; SameSite=".concat(this.options.sameSite)),a=N(),a&&(a.document.cookie=c)}catch{}return[2]})})},t.prototype.remove=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return[4,this.set(e,null)];case 1:return n.sent(),[2]}})})},t.prototype.reset=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2]})})},t}();var Gt=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i,o,s;return f(this,function(u){switch(u.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(r),method:"POST"},[4,fetch(n,i)];case 1:return o=u.sent(),[4,o.json()];case 2:return s=u.sent(),[2,this.buildResponse(s)]}})})},e}(pe);var Qr=function(){function t(){}return t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Xr(),platform:"Web",os:void 0,deviceModel:void 0}},t}(),Xr=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},zr=function(){function t(){this.queue=[]}return t.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},t.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(n){e(n)}),this.queue=[])},t}(),ie=function(){return ie=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ie.apply(this,arguments)},Je=function(t,e){var n=["string","number","boolean","undefined"],r=typeof t,i=typeof e;if(r!==i)return!1;for(var o=0,s=n;o<s.length;o++){var u=s[o];if(u===r)return t===e}if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;var c=Array.isArray(t),a=Array.isArray(e);if(c!==a)return!1;if(c&&a){for(var l=0;l<t.length;l++)if(!Je(t[l],e[l]))return!1}else{var d=Object.keys(t).sort(),m=Object.keys(e).sort();if(!Je(d,m))return!1;var y=!0;return Object.keys(t).forEach(function(g){Je(t[g],e[g])||(y=!1)}),y}return!0},Zr="$set",Jr="$unset",ei="$clearAll";Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r});var ti=function(){function t(){this.identity={userProperties:{}},this.listeners=new Set}return t.prototype.editIdentity=function(){var e=this,n=ie({},this.identity.userProperties),r=ie(ie({},this.identity),{userProperties:n});return{setUserId:function(i){return r.userId=i,this},setDeviceId:function(i){return r.deviceId=i,this},setUserProperties:function(i){return r.userProperties=i,this},setOptOut:function(i){return r.optOut=i,this},updateUserProperties:function(i){for(var o=r.userProperties||{},s=0,u=Object.entries(i);s<u.length;s++){var c=u[s],a=c[0],l=c[1];switch(a){case Zr:for(var d=0,m=Object.entries(l);d<m.length;d++){var y=m[d],g=y[0],T=y[1];o[g]=T}break;case Jr:for(var h=0,_=Object.keys(l);h<_.length;h++){var g=_[h];delete o[g]}break;case ei:o={};break}}return r.userProperties=o,this},commit:function(){return e.setIdentity(r),this}}},t.prototype.getIdentity=function(){return ie({},this.identity)},t.prototype.setIdentity=function(e){var n=ie({},this.identity);this.identity=ie({},e),Je(n,this.identity)||this.listeners.forEach(function(r){r(e)})},t.prototype.addIdentityListener=function(e){this.listeners.add(e)},t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},t}(),we=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,Jn=function(){function t(){this.identityStore=new ti,this.eventBridge=new zr,this.applicationContextProvider=new Qr}return t.getInstance=function(e){return we.analyticsConnectorInstances||(we.analyticsConnectorInstances={}),we.analyticsConnectorInstances[e]||(we.analyticsConnectorInstances[e]=new t),we.analyticsConnectorInstances[e]},t}();var oe=function(t){return t===void 0&&(t="$default_instance"),Jn.getInstance(t)},Wt=function(t,e){oe(e).identityStore.editIdentity().setUserId(t).commit()},$t=function(t,e){oe(e).identityStore.editIdentity().setDeviceId(t).commit()};var Yt=function(){function t(){this.name="identity",this.type="before",this.identityStore=oe().identityStore}return t.prototype.execute=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){return n=e.user_properties,n&&this.identityStore.editIdentity().updateUserProperties(n).commit(),[2,e]})})},t.prototype.setup=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return e.instanceName&&(this.identityStore=oe(e.instanceName).identityStore),[2]})})},t}();var Qt=function(){var t,e,n,r;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(r=(n=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&n!==void 0?n:i)!==null&&r!==void 0?r:""};var Ce=function(t,e){return typeof t=="boolean"?t:t?.[e]!==!1},et=function(t){return Ce(t,"attribution")},Xt=function(t){return Ce(t,"fileDownloads")},zt=function(t){return Ce(t,"formInteractions")},tt=function(t){return Ce(t,"pageViews")},Zt=function(t){return Ce(t,"sessions")},Jt=function(t){var e=function(){return!1},n=void 0,r,i=t.pageCounter,o=tt(t.defaultTracking);return o&&(e=void 0,r=void 0,t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews=="object"&&("trackOn"in t.defaultTracking.pageViews&&(e=t.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in t.defaultTracking.pageViews&&(n=t.defaultTracking.pageViews.trackHistoryChanges),"eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType&&(r=t.defaultTracking.pageViews.eventType))),{trackOn:e,trackHistoryChanges:n,eventType:r,pageCounter:i}},en=function(t){return et(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution=="object"?v({},t.defaultTracking.attribution):{}};var nt=function(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.name,o=r.args,s=r.resolve,u=t&&t[i];if(typeof u=="function"){var c=u.apply(t,o);typeof s=="function"&&s(c?.promise)}}return t},rt=function(t){var e=t;return e&&e._q!==void 0};var er="2.5.2";var ni="Web",ri="$remote",tr=function(){function t(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat(er),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return t.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},t.prototype.execute=function(e){var n,r;return p(this,void 0,void 0,function(){var i,o,s,u;return f(this,function(c){return i=new Date().getTime(),o=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1,s=(r=e.event_id)!==null&&r!==void 0?r:o+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=i),u=v(v(v(v(v(v(v(v({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:ni}),this.config.trackingOptions.language&&{language:Qt()}),this.config.trackingOptions.ipAddress&&{ip:ri}),{insert_id:X(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:s,library:this.library,user_agent:this.userAgent}),[2,u]})})},t}();var it=function(){function t(e){this.storage=e}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){var e,n,r,i,o;return f(this,function(s){switch(s.label){case 0:if(!this.storage)return[2,!1];e=String(Date.now()),n=new t(this.storage),r="AMP_TEST",s.label=1;case 1:return s.trys.push([1,4,5,7]),[4,n.set(r,e)];case 2:return s.sent(),[4,n.get(r)];case 3:return i=s.sent(),[2,i===e];case 4:return o=s.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return s.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){var n,r;return f(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return n=i.sent(),n?[2,JSON.parse(n)]:[2,void 0];case 2:return r=i.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},t.prototype.getRaw=function(e){var n;return p(this,void 0,void 0,function(){return f(this,function(r){return[2,((n=this.storage)===null||n===void 0?void 0:n.getItem(e))||void 0]})})},t.prototype.set=function(e,n){var r;return p(this,void 0,void 0,function(){return f(this,function(i){try{(r=this.storage)===null||r===void 0||r.setItem(e,JSON.stringify(n))}catch{}return[2]})})},t.prototype.remove=function(e){var n;return p(this,void 0,void 0,function(){return f(this,function(r){try{(n=this.storage)===null||n===void 0||n.removeItem(e)}catch{}return[2]})})},t.prototype.reset=function(){var e;return p(this,void 0,void 0,function(){return f(this,function(n){try{(e=this.storage)===null||e===void 0||e.clear()}catch{}return[2]})})},t}();var ot=1e3,tn=function(t){V(e,t);function e(n){var r=this,i;return r=t.call(this,(i=N())===null||i===void 0?void 0:i.localStorage)||this,r.loggerProvider=n?.loggerProvider,r}return e.prototype.set=function(n,r){var i;return p(this,void 0,void 0,function(){var o;return f(this,function(s){switch(s.label){case 0:return Array.isArray(r)&&r.length>ot?(o=r.length-ot,[4,t.prototype.set.call(this,n,r.slice(0,ot))]):[3,2];case 1:return s.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(ot,".")),[3,4];case 2:return[4,t.prototype.set.call(this,n,r)];case 3:s.sent(),s.label=4;case 4:return[2]}})})},e}(it);var nr=function(t){V(e,t);function e(){var n;return t.call(this,(n=N())===null||n===void 0?void 0:n.sessionStorage)||this}return e}(it);var rr=function(t){V(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={done:4},n}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i=this;return f(this,function(o){return[2,new Promise(function(s,u){typeof XMLHttpRequest>"u"&&u(new Error("XHRTransport is not supported."));var c=new XMLHttpRequest;c.open("POST",n,!0),c.onreadystatechange=function(){if(c.readyState===i.state.done)try{var a=c.responseText,l=JSON.parse(a),d=i.buildResponse(l);s(d)}catch(m){u(m)}},c.setRequestHeader("Content-Type","application/json"),c.setRequestHeader("Accept","*/*"),c.send(JSON.stringify(r))})]})})},e}(pe);var ir=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i=this;return f(this,function(o){return[2,new Promise(function(s,u){var c=N();if(!c?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(r),l=c.navigator.sendBeacon(n,JSON.stringify(r));return s(l?i.buildResponse({code:200,events_ingested:r.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):i.buildResponse({code:500}))}catch(d){u(d)}})]})})},e}(pe);var or=function(t,e,n){return n===void 0&&(n=!0),p(void 0,void 0,void 0,function(){var r,i,o,s,u,c,a,l,d;return f(this,function(m){switch(m.label){case 0:return r=Kt(t),[4,e.getRaw(r)];case 1:return i=m.sent(),i?n?[4,e.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:m.sent(),m.label=3;case 3:return o=L(i.split("."),6),s=o[0],u=o[1],c=o[2],a=o[3],l=o[4],d=o[5],[2,{deviceId:s,userId:ii(u),sessionId:nn(a),lastEventId:nn(d),lastEventTime:nn(l),optOut:!!c}]}})})},nn=function(t){var e=parseInt(t,32);if(!isNaN(e))return e},ii=function(t){if(!(!atob||!escape||!t))try{return decodeURIComponent(escape(atob(t)))}catch{return}};var j="[Amplitude]",ka="".concat(j," Page Viewed"),rn="".concat(j," Form Started"),sr="".concat(j," Form Submitted"),ar="".concat(j," File Downloaded"),on="session_start",sn="session_end",ur="".concat(j," File Extension"),cr="".concat(j," File Name"),lr="".concat(j," Link ID"),dr="".concat(j," Link Text"),pr="".concat(j," Link URL"),st="".concat(j," Form ID"),at="".concat(j," Form Name"),ut="".concat(j," Form Destination"),Pe="cookie",fr="US";var oi=function(t){V(e,t);function e(n,r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,I,k,F,b,S,O,B,Z,ne,ce,re,le,ye,_e){i===void 0&&(i=new ze),o===void 0&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),c===void 0&&(c=1e3),a===void 0&&(a=5),l===void 0&&(l=30),d===void 0&&(d=Pe),h===void 0&&(h=new be),_===void 0&&(_=M.Warn),I===void 0&&(I=!1),k===void 0&&(k=!1),S===void 0&&(S=""),O===void 0&&(O=fr),Z===void 0&&(Z=30*60*1e3),ne===void 0&&(ne=new tn({loggerProvider:h})),ce===void 0&&(ce={ipAddress:!0,language:!0,platform:!0}),re===void 0&&(re="fetch"),le===void 0&&(le=!1);var E=t.call(this,{apiKey:n,storageProvider:ne,transportProvider:an(re)})||this;return E.apiKey=n,E.appVersion=r,E.cookieOptions=o,E.defaultTracking=s,E.flushIntervalMillis=c,E.flushMaxRetries=a,E.flushQueueSize=l,E.identityStorage=d,E.ingestionMetadata=m,E.instanceName=y,E.loggerProvider=h,E.logLevel=_,E.minIdLength=U,E.offline=I,E.partnerId=F,E.plan=b,E.serverUrl=S,E.serverZone=O,E.sessionTimeout=Z,E.storageProvider=ne,E.trackingOptions=ce,E.transport=re,E.useBatch=le,E._optOut=!1,E._cookieStorage=i,E.deviceId=u,E.lastEventId=g,E.lastEventTime=T,E.optOut=k,E.sessionId=B,E.pageCounter=_e,E.userId=ye,E.loggerProvider.enable(E.logLevel),E}return Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(n){this._cookieStorage!==n&&(this._cookieStorage=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(n){this._deviceId!==n&&(this._deviceId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(n){this._userId!==n&&(this._userId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(n){this._sessionId!==n&&(this._sessionId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(n){this._optOut!==n&&(this._optOut=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(n){this._lastEventTime!==n&&(this._lastEventTime=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(n){this._lastEventId!==n&&(this._lastEventId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(n){this._pageCounter!==n&&(this._pageCounter=n,this.updateStorage())},enumerable:!1,configurable:!0}),e.prototype.updateStorage=function(){var n={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter};this.cookieStorage.set(Ze(this.apiKey),n)},e}(Rt);var mr=function(t,e,n){return e===void 0&&(e={}),p(void 0,void 0,void 0,function(){var r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,I,k,F,b,S,O,B,Z,ne,ce,re,le,ye,_e,E,pt,ft,mt,vt,gt,ht,yt,_t,Et;return f(this,function(me){switch(me.label){case 0:return r=e.identityStorage||Pe,I={},r===Pe?[3,1]:(o="",[3,5]);case 1:return(F=(k=e.cookieOptions)===null||k===void 0?void 0:k.domain)!==null&&F!==void 0?(s=F,[3,4]):[3,2];case 2:return[4,ai()];case 3:s=me.sent(),me.label=4;case 4:o=s,me.label=5;case 5:return i=v.apply(void 0,[(I.domain=o,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),e.cookieOptions]),u=si(e.identityStorage,i),[4,or(t,u,(S=(b=e.cookieOptions)===null||b===void 0?void 0:b.upgrade)!==null&&S!==void 0?S:!0)];case 6:return c=me.sent(),[4,u.get(Ze(t))];case 7:return a=me.sent(),l=ge(),d=(ne=(Z=(B=(O=e.deviceId)!==null&&O!==void 0?O:l.deviceId)!==null&&B!==void 0?B:a?.deviceId)!==null&&Z!==void 0?Z:c.deviceId)!==null&&ne!==void 0?ne:X(),m=(ce=a?.lastEventId)!==null&&ce!==void 0?ce:c.lastEventId,y=(re=a?.lastEventTime)!==null&&re!==void 0?re:c.lastEventTime,g=(ye=(le=e.optOut)!==null&&le!==void 0?le:a?.optOut)!==null&&ye!==void 0?ye:c.optOut,T=(_e=a?.sessionId)!==null&&_e!==void 0?_e:c.sessionId,h=(pt=(E=e.userId)!==null&&E!==void 0?E:a?.userId)!==null&&pt!==void 0?pt:c.userId,n.previousSessionDeviceId=(ft=a?.deviceId)!==null&&ft!==void 0?ft:c.deviceId,n.previousSessionUserId=(mt=a?.userId)!==null&&mt!==void 0?mt:c.userId,_={ipAddress:(gt=(vt=e.trackingOptions)===null||vt===void 0?void 0:vt.ipAddress)!==null&&gt!==void 0?gt:!0,language:(yt=(ht=e.trackingOptions)===null||ht===void 0?void 0:ht.language)!==null&&yt!==void 0?yt:!0,platform:(Et=(_t=e.trackingOptions)===null||_t===void 0?void 0:_t.platform)!==null&&Et!==void 0?Et:!0},U=a?.pageCounter,[2,new oi(t,e.appVersion,u,i,e.defaultTracking,d,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,r,e.ingestionMetadata,e.instanceName,m,y,e.loggerProvider,e.logLevel,e.minIdLength,e.offline,g,e.partnerId,e.plan,e.serverUrl,e.serverZone,T,e.sessionTimeout,e.storageProvider,_,e.transport,e.useBatch,h,U)]}})})},si=function(t,e){switch(t===void 0&&(t=Pe),e===void 0&&(e={}),t){case"localStorage":return new tn;case"sessionStorage":return new nr;case"none":return new ze;case"cookie":default:return new Le(v(v({},e),{expirationDays:e.expiration}))}},an=function(t){return t==="xhr"?new rr:t==="beacon"?new ir:new Gt},ai=function(t){return p(void 0,void 0,void 0,function(){var e,n,r,i,o,o,s,u,c,a;return f(this,function(l){switch(l.label){case 0:return[4,new Le().isEnabled()];case 1:if(!l.sent()||!t&&typeof location>"u")return[2,""];for(e=t??location.hostname,n=e.split("."),r=[],i="AMP_TLDTEST",o=n.length-2;o>=0;--o)r.push(n.slice(o).join("."));o=0,l.label=2;case 2:return o<r.length?(s=r[o],u={domain:"."+s},c=new Le(u),[4,c.set(i,1)]):[3,7];case 3:return l.sent(),[4,c.get(i)];case 4:return a=l.sent(),a?[4,c.remove(i)]:[3,6];case 5:return l.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}})})};var gr=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[de,e,t.substring(0,n)].filter(Boolean).join("_")},vr=function(t){var e=t.split(".");return e.length<=2?t:e.slice(e.length-2,e.length).join(".")},ui=function(t){return Object.values(t).every(function(e){return!e})},hr=function(t,e,n,r){r===void 0&&(r=!0);var i=t.referrer,o=t.referring_domain,s=Te(t,["referrer","referring_domain"]),u=e||{},c=u.referrer,a=u.referring_domain,l=Te(u,["referrer","referring_domain"]);if(ci(n.excludeReferrers,t.referring_domain)||!r&&ui(t)&&e)return!1;var d=JSON.stringify(s)!==JSON.stringify(l),m=vr(o||"")!==vr(a||"");return!e||d||m},ci=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=""),t.some(function(n){return n instanceof RegExp?n.test(e):n===e})},yr=function(t,e){var n=v(v({},fe),t),r=Object.entries(n).reduce(function(i,o){var s,u=L(o,2),c=u[0],a=u[1];return i.setOnce("initial_".concat(c),(s=a??e.initialEmptyValue)!==null&&s!==void 0?s:"EMPTY"),a?i.set(c,a):i.unset(c)},new G);return Ie(r)},_r=function(t){var e=t;return e?(e.startsWith(".")&&(e=e.substring(1)),[new RegExp("".concat(e.replace(".","\\\\."),"$"))]):[]};var un=function(t){var e=this;t===void 0&&(t={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(r,i){var o;return p(this,void 0,void 0,function(){var s,u,c,a,l,d,m,y;return f(this,function(g){switch(g.label){case 0:return s=v({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:_r((o=r.cookieOptions)===null||o===void 0?void 0:o.domain)},t),r.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),u=r.cookieStorage,c=gr(r.apiKey,"MKTG"),[4,Promise.all([new Se().parse(),u.get(c)])];case 1:return a=L.apply(void 0,[g.sent(),2]),l=a[0],d=a[1],m=xe(r.sessionTimeout,r.lastEventTime),hr(l,d,s,m)&&(s.resetSessionOnNewCampaign&&(i.setSessionId(Date.now()),r.loggerProvider.log("Created a new session for new campaign.")),r.loggerProvider.log("Tracking attribution."),y=yr(l,s),i.track(y),u.set(c,l)),[2]}})})},execute:function(r){return p(e,void 0,void 0,function(){return f(this,function(i){return[2,r]})})}};return n};var Er=function(t){var e={};for(var n in t){var r=t[n];r&&(e[n]=r)}return e};var cn=function(t){t===void 0&&(t={});var e,n=N(),r=void 0,i,o,s=function(){return p(void 0,void 0,void 0,function(){var m,y,g;return f(this,function(T){switch(T.label){case 0:return o.pageCounter=o.pageCounter?o.pageCounter+1:1,y={event_type:(g=t.eventType)!==null&&g!==void 0?g:"[Amplitude] Page Viewed"},m=[{}],[4,li()];case 1:return[2,(y.event_properties=v.apply(void 0,[v.apply(void 0,m.concat([T.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":typeof location<"u"&&location.href||"","[Amplitude] Page Path":typeof location<"u"&&location.pathname||"","[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":typeof location<"u"&&location.href.split("?")[0]||"","[Amplitude] Page Counter":o.pageCounter}]),y)]}})})},u=function(){return typeof t.trackOn>"u"||typeof t.trackOn=="function"&&t.trackOn()},c=typeof location<"u"?location.href:null,a=function(){return p(void 0,void 0,void 0,function(){var m,y,g,T,h;return f(this,function(_){switch(_.label){case 0:return m=location.href,y=pi(t.trackHistoryChanges,m,c||"")&&u(),c=m,y?(r?.log("Tracking page view event"),e!=null?[3,1]:(g=void 0,[3,3])):[3,4];case 1:return h=(T=e).track,[4,s()];case 2:g=h.apply(T,[_.sent()]),_.label=3;case 3:_.label=4;case 4:return[2]}})})},l=function(){a()},d={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(m,y){return p(void 0,void 0,void 0,function(){var g,T;return f(this,function(h){switch(h.label){case 0:return e=y,o=m,r=m.loggerProvider,r.log("Installing @amplitude/plugin-page-view-tracking-browser"),n&&(n.addEventListener("popstate",l),i=n.history.pushState,n.history.pushState=new Proxy(n.history.pushState,{apply:function(_,U,I){var k=L(I,3),F=k[0],b=k[1],S=k[2];_.apply(U,[F,b,S]),a()}})),u()?(r.log("Tracking page view event"),T=(g=e).track,[4,s()]):[3,2];case 1:T.apply(g,[h.sent()]),h.label=2;case 2:return[2]}})})},execute:function(m){return p(void 0,void 0,void 0,function(){var y;return f(this,function(g){switch(g.label){case 0:return t.trackOn==="attribution"&&di(m)?(r?.log("Enriching campaign event to page view event with campaign parameters"),[4,s()]):[3,2];case 1:y=g.sent(),m.event_type=y.event_type,m.event_properties=v(v({},m.event_properties),y.event_properties),g.label=2;case 2:return[2,m]}})})},teardown:function(){return p(void 0,void 0,void 0,function(){return f(this,function(m){return n&&(n.removeEventListener("popstate",l),i&&(n.history.pushState=i)),[2]})})}};return d},li=function(){return p(void 0,void 0,void 0,function(){var t;return f(this,function(e){switch(e.label){case 0:return t=Er,[4,new Se().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})},di=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties,n=e[w.SET]||{},r=e[w.UNSET]||{},i=q(q([],L(Object.keys(n)),!1),L(Object.keys(r)),!1);return Object.keys(fe).every(function(o){return i.includes(o)})}return!1},pi=function(t,e,n){switch(t){case"pathOnly":return e.split("?")[0]!==n.split("?")[0];default:return e!==n}};var Tr=function(){var t,e=[],n=function(a,l,d){a.addEventListener(l,d),e.push({element:a,type:l,handler:d})},r=function(){e.forEach(function(a){var l=a.element,d=a.type,m=a.handler;l?.removeEventListener(d,m)}),e=[]},i="@amplitude/plugin-form-interaction-tracking-browser",o="enrichment",s=function(a,l){return p(void 0,void 0,void 0,function(){var d,m;return f(this,function(y){return l?typeof document>"u"?[2]:(d=function(g){var T=!1;n(g,"change",function(){var h;T||l.track(rn,(h={},h[st]=he(g.id),h[at]=he(g.name),h[ut]=g.action,h)),T=!0}),n(g,"submit",function(){var h,_;T||l.track(rn,(h={},h[st]=he(g.id),h[at]=he(g.name),h[ut]=g.action,h)),l.track(sr,(_={},_[st]=he(g.id),_[at]=he(g.name),_[ut]=g.action,_)),T=!1})},m=Array.from(document.getElementsByTagName("form")),m.forEach(d),typeof MutationObserver<"u"&&(t=new MutationObserver(function(g){g.forEach(function(T){T.addedNodes.forEach(function(h){h.nodeName==="FORM"&&d(h),"querySelectorAll"in h&&typeof h.querySelectorAll=="function"&&Array.from(h.querySelectorAll("form")).map(d)})})}),t.observe(document.body,{subtree:!0,childList:!0})),[2]):(a.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])})})},u=function(a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return[2,a]})})},c=function(){return p(void 0,void 0,void 0,function(){return f(this,function(a){return t?.disconnect(),r(),[2]})})};return{name:i,type:o,setup:s,execute:u,teardown:c}},he=function(t){if(typeof t=="string")return t};var Ir=function(){var t,e=[],n=function(a,l,d){a.addEventListener(l,d),e.push({element:a,type:l,handler:d})},r=function(){e.forEach(function(a){var l=a.element,d=a.type,m=a.handler;l?.removeEventListener(d,m)}),e=[]},i="@amplitude/plugin-file-download-tracking-browser",o="enrichment",s=function(a,l){return p(void 0,void 0,void 0,function(){var d,m,y;return f(this,function(g){return l?typeof document>"u"?[2]:(d=function(T){var h;try{h=new URL(T.href,window.location.href)}catch{return}var _=m.exec(h.href),U=_?.[1];U&&n(T,"click",function(){var I;U&&l.track(ar,(I={},I[ur]=U,I[cr]=h.pathname,I[lr]=T.id,I[dr]=T.text,I[pr]=T.href,I))})},m=/\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/,y=Array.from(document.getElementsByTagName("a")),y.forEach(d),typeof MutationObserver<"u"&&(t=new MutationObserver(function(T){T.forEach(function(h){h.addedNodes.forEach(function(_){_.nodeName==="A"&&d(_),"querySelectorAll"in _&&typeof _.querySelectorAll=="function"&&Array.from(_.querySelectorAll("a")).map(d)})})}),t.observe(document.body,{subtree:!0,childList:!0})),[2]):(a.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])})})},u=function(a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return[2,a]})})},c=function(){return p(void 0,void 0,void 0,function(){return f(this,function(a){return t?.disconnect(),r(),[2]})})};return{name:i,type:o,setup:s,execute:u,teardown:c}};var br=!1,Sr=function(t){if(!(br||t.defaultTracking!==void 0)){var e=\`\\\`options.defaultTracking\\\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \\\`options.defaultTracking\\\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:
11
27
 
12
28
  amplitude.init(<YOUR_API_KEY>, {
13
29
  defaultTracking: true,
14
30
  });
15
31
 
16
- Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.\`;t.loggerProvider.warn(e),Ir=!0}};var xr=function(){var t="@amplitude/plugin-network-checker-browser",e="before",n=N(),r=[],i=function(c,a){n&&(n.addEventListener(c,a),r.push({type:c,handler:a}))},o=function(){r.forEach(function(c){var a=c.type,l=c.handler;n&&n.removeEventListener(a,l)}),r=[]},s=function(c,a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return c.offline=!navigator.onLine,i("online",function(){c.loggerProvider.debug("Network connectivity changed to online."),c.offline=!1,setTimeout(function(){a.flush()},c.flushIntervalMillis)}),i("offline",function(){c.loggerProvider.debug("Network connectivity changed to offline."),c.offline=!0}),[2]})})},u=function(){return p(void 0,void 0,void 0,function(){return f(this,function(c){return o(),[2]})})};return{name:t,type:e,setup:s,teardown:u}};var Lr=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.init=function(n,r,i){n===void 0&&(n="");var o,s;return arguments.length>2?(o=r,s=i):typeof r=="string"?(o=r,s=void 0):(o=r?.userId,s=r),H(this._init(v(v({},s),{userId:o,apiKey:n})))},e.prototype._init=function(n){var r,i;return p(this,void 0,void 0,function(){var o,s,u,c,a=this;return f(this,function(l){switch(l.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,mr(n.apiKey,n,this)]);case 1:return o=l.sent(),[4,t.prototype._init.call(this,o)];case 2:return l.sent(),this.setSessionId((i=(r=n.sessionId)!==null&&r!==void 0?r:this.config.sessionId)!==null&&i!==void 0?i:Date.now()),s=oe(n.instanceName),s.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===Ke?[3,4]:[4,this.add(xr()).promise];case 3:l.sent(),l.label=4;case 4:return[4,this.add(new At).promise];case 5:return l.sent(),[4,this.add(new tr).promise];case 6:return l.sent(),[4,this.add(new Yt).promise];case 7:return l.sent(),Sr(this.config),Xt(this.config.defaultTracking)?[4,this.add(br()).promise]:[3,9];case 8:l.sent(),l.label=9;case 9:return zt(this.config.defaultTracking)?[4,this.add(Tr()).promise]:[3,11];case 10:l.sent(),l.label=11;case 11:return et(this.config.defaultTracking)?(u=en(this.config),c=un(u),[4,this.add(c).promise]):[3,13];case 12:l.sent(),l.label=13;case 13:return tt(this.config.defaultTracking)?[4,this.add(cn(Jt(this.config))).promise]:[3,15];case 14:l.sent(),l.label=15;case 15:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 16:return l.sent(),s.eventBridge.setEventReceiver(function(d){a.track(d.eventType,d.eventProperties)}),[2]}})})},e.prototype.getUserId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.userId},e.prototype.setUserId=function(n){if(!this.config){this.q.push(this.setUserId.bind(this,n));return}(n!==this.config.userId||n===void 0)&&(this.config.userId=n,Wt(n,this.config.instanceName))},e.prototype.getDeviceId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.deviceId},e.prototype.setDeviceId=function(n){if(!this.config){this.q.push(this.setDeviceId.bind(this,n));return}this.config.deviceId=n,$t(n,this.config.instanceName)},e.prototype.reset=function(){this.setDeviceId(X()),this.setUserId(void 0)},e.prototype.getSessionId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.sessionId},e.prototype.setSessionId=function(n){var r;if(!this.config){this.q.push(this.setSessionId.bind(this,n));return}if(n!==this.config.sessionId){var i=this.getSessionId(),o=this.config.lastEventTime,s=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1;this.config.sessionId=n,this.config.lastEventTime=void 0,this.config.pageCounter=0,Zt(this.config.defaultTracking)&&(i&&o&&this.track(sn,void 0,{device_id:this.previousSessionDeviceId,event_id:++s,session_id:i,time:o+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(on,void 0,{event_id:++s,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}},e.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},e.prototype.setTransport=function(n){if(!this.config){this.q.push(this.setTransport.bind(this,n));return}this.config.transportProvider=an(n)},e.prototype.identify=function(n,r){if(rt(n)){var i=n._q;n._q=[],n=nt(new G,i)}return r?.user_id&&this.setUserId(r.user_id),r?.device_id&&this.setDeviceId(r.device_id),t.prototype.identify.call(this,n,r)},e.prototype.groupIdentify=function(n,r,i,o){if(rt(i)){var s=i._q;i._q=[],i=nt(new G,s)}return t.prototype.groupIdentify.call(this,n,r,i,o)},e.prototype.revenue=function(n,r){if(rt(n)){var i=n._q;n._q=[],n=nt(new $e,i)}return t.prototype.revenue.call(this,n,r)},e.prototype.process=function(n){return p(this,void 0,void 0,function(){var r,i;return f(this,function(o){return r=Date.now(),i=xe(this.config.sessionTimeout,this.config.lastEventTime),n.event_type!==on&&n.event_type!==sn&&(!n.session_id||n.session_id===this.getSessionId())&&i&&this.setSessionId(r),[2,t.prototype.process.call(this,n)]})})},e}(Pt);var fi=function(){var t=new Lr;return{init:R(t.init.bind(t),"init",C(t),P(t,["config"])),add:R(t.add.bind(t),"add",C(t),P(t,["config.apiKey","timeline.plugins"])),remove:R(t.remove.bind(t),"remove",C(t),P(t,["config.apiKey","timeline.plugins"])),track:R(t.track.bind(t),"track",C(t),P(t,["config.apiKey","timeline.queue.length"])),logEvent:R(t.logEvent.bind(t),"logEvent",C(t),P(t,["config.apiKey","timeline.queue.length"])),identify:R(t.identify.bind(t),"identify",C(t),P(t,["config.apiKey","timeline.queue.length"])),groupIdentify:R(t.groupIdentify.bind(t),"groupIdentify",C(t),P(t,["config.apiKey","timeline.queue.length"])),setGroup:R(t.setGroup.bind(t),"setGroup",C(t),P(t,["config.apiKey","timeline.queue.length"])),revenue:R(t.revenue.bind(t),"revenue",C(t),P(t,["config.apiKey","timeline.queue.length"])),flush:R(t.flush.bind(t),"flush",C(t),P(t,["config.apiKey","timeline.queue.length"])),getUserId:R(t.getUserId.bind(t),"getUserId",C(t),P(t,["config","config.userId"])),setUserId:R(t.setUserId.bind(t),"setUserId",C(t),P(t,["config","config.userId"])),getDeviceId:R(t.getDeviceId.bind(t),"getDeviceId",C(t),P(t,["config","config.deviceId"])),setDeviceId:R(t.setDeviceId.bind(t),"setDeviceId",C(t),P(t,["config","config.deviceId"])),reset:R(t.reset.bind(t),"reset",C(t),P(t,["config","config.userId","config.deviceId"])),getSessionId:R(t.getSessionId.bind(t),"getSessionId",C(t),P(t,["config"])),setSessionId:R(t.setSessionId.bind(t),"setSessionId",C(t),P(t,["config"])),extendSession:R(t.extendSession.bind(t),"extendSession",C(t),P(t,["config"])),setOptOut:R(t.setOptOut.bind(t),"setOptOut",C(t),P(t,["config"])),setTransport:R(t.setTransport.bind(t),"setTransport",C(t),P(t,["config"]))}},D=fi();var Hu=D.add,qu=D.extendSession,ju=D.flush,Ku=D.getDeviceId,Gu=D.getSessionId,Wu=D.getUserId,$u=D.groupIdentify,wr=D.identify,Cr=D.init,Yu=D.logEvent,Qu=D.remove,Xu=D.reset,zu=D.revenue,Zu=D.setDeviceId,Ju=D.setGroup,ec=D.setOptOut,tc=D.setSessionId,nc=D.setTransport,rc=D.setUserId,se=D.track;var K=t=>{window.dispatchEvent(new CustomEvent("builderdevtools",{detail:{eventName:t}}))};async function mi(){return Cn()}var Pr=async()=>{let t=new URL(window.location.href),e=t.hash,n=\`#\${hn}=\`,r=Math.random().toString(36).substring(2,15),i=await mi();Cr("f1d2eb79aecd01b28c8a371ea5d1751c",i?.userId||r,{logLevel:Ge.LogLevel.None,serverUrl:En,flushIntervalMillis:500});let o=new G;wr(o,{device_id:i?.deviceId,user_id:i?.userId||r});let s="anonymous";e.startsWith(n)&&(s=e.slice(n.length),s&&(vi(s),t.hash="",window.history.replaceState({},"",t.href))),K("init")};var vi=t=>{if(typeof t=="string"&&t.length>0){let e=De();Re({...e,builderUserId:t})}},De=()=>{let t=localStorage.getItem(Rr);if(t)try{let e=JSON.parse(t);return(!e.ctas||typeof e.ctas!="object")&&(e=Re({...e,ctas:{}})),e.menuOpenedTs&&(e=Re({...e,ctas:{...e.ctas,menuOpened:e.menuOpenedTs}}),delete e.menuOpenedTs),e}catch(e){console.error(e)}return Re({firstVisitTs:Date.now(),ctas:{},builderUserId:""})},Re=t=>{try{localStorage.setItem(Rr,JSON.stringify(t))}catch(e){console.error(e)}return t},ln=t=>!!De().ctas[t],dn=t=>{let e=De();return Re({...e,ctas:{...e.ctas,[t]:Date.now()}})},Rr="builderDevtools";function Dr(t){gi(t),hi(t),yi(t),_i(t)}function gi(t){let e=t.getElementById("input-register");e.addEventListener("change",async n=>{n.stopPropagation();let r=t.getElementById("input-name"),i=t.querySelector(".nav-cmp-input");i.classList.add("input-loading"),i.classList.remove("input-enabled");let o=r.dataset.id,s=r.dataset.prop,u=await Me({cmpId:o,name:s,registerInput:e.checked});K("registryUpdate"),J(u),Ae(t,o,s),ae(t,o),i.classList.remove("input-loading")})}function hi(t){t.getElementById("input-open-source").addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();let r=n.target,i=A.components.find(o=>o.id===r?.dataset.id);i&&ve({filePath:i.filePath})})}function yi(t){let e=t.getElementById("input-name"),n=e.closest(".ui-text-input"),r="",i;e.addEventListener("focus",o=>{clearTimeout(i),n.classList.remove("saved"),o.stopPropagation(),r=e.value}),e.addEventListener("blur",async o=>{if(o.stopPropagation(),clearTimeout(i),n.classList.remove("saved"),e.value!==r){if(e.value.trim().length<3){e.value=r;return}n.classList.add("saved"),i=setTimeout(()=>{n.classList.remove("saved")},3e3);let s=e.dataset.id,u=e.dataset.prop,c=await Me({cmpId:s,name:u,friendlyName:e.value});K("registryUpdate"),J(c),z(t),ae(t,s),Ae(t,s,u)}}),e.addEventListener("keyup",o=>{o.stopPropagation(),clearTimeout(i),n.classList.remove("saved"),o.key==="Escape"?(e.value=r,e.blur()):o.key==="Enter"&&e.blur()})}function _i(t){let e=t.getElementById("input-type");e.addEventListener("change",async n=>{n.stopPropagation();let r=e.dataset.id,i=e.dataset.prop,o=await Me({cmpId:r,name:i,type:e.value});K("registryUpdate"),J(o),z(t),ae(t,r),Ae(t,r,i)})}function Ae(t,e,n){let r=A.components.find(m=>m.id===e);if(!r)return null;let i=r.inputs.find(m=>m.name===n);if(!i)return null;let o=t.querySelector(".nav-cmp-input");i.isRegistered?o.classList.add("input-enabled"):o.classList.remove("input-enabled");let s=t.getElementById("input-register");s.checked=!!i.isRegistered;let u=t.getElementById("cmp-input-title");u.innerText=r.name+": "+(i.friendlyName||i.name);let c=t.getElementById("input-open-source");c.innerText=\`Open \${r.displayFilePath}\`,c.dataset.id=r.id;let a=t.getElementById("cmp-prop-name");a.innerText=i.name;let l=t.getElementById("cmp-prop-type");l.innerText=qe(i.type);let d=t.getElementById("input-name");return d.dataset.id=r.id,d.dataset.prop=i.name,d.value=i.friendlyName||i.name,Ei(t,r,i),i}function Ei(t,e,n){let r=t.getElementById("input-type");r.dataset.id=e.id,r.dataset.prop=n.name,r.innerHTML="";let i=n.type,o=Ne.includes(i),s=Be.includes(i),u=Fe.includes(i),c=Ve.includes(i),a=He.includes(i);Pn.forEach(l=>{let d=document.createElement("option");d.value=l.value,d.innerText=l.text,d.disabled=Ne.includes(l.value)&&!o||Be.includes(l.value)&&!s||Fe.includes(l.value)&&!u||Ve.includes(l.value)&&!c||He.includes(l.value)&&!a,r.appendChild(d)}),r.value=i}function Ar(t){Ti(t),bi(t),Ii(t),xi(t),Si(t)}function Ti(t){t.getElementById("cmp-register").addEventListener("change",n=>{n.stopPropagation(),ct(t,"update")})}async function ct(t,e){let n=t.querySelector(".nav-cmp-detail"),r=t.getElementById("cmp-error"),i=t.getElementById("cmp-register"),o=i.closest(".ui-switch");n.classList.remove("cmp-enabled"),i.checked&&n.classList.add("cmp-loading");try{let s=i.dataset.id,u;e==="load"?u=await In({cmpId:s}):i.checked?(u=await Sn({cmpId:s}),K("registryUpdate"),se("interaction",{type:"click",name:"register component",detail:s})):(u=await Ln({cmpId:s}),K("registryUpdate"),se("interaction",{type:"click",name:"unregister component",detail:s})),J(u),z(t);let c=ae(t,s);e==="update"&&c&&(i.checked?(n.classList.add("cmp-enabled"),Tt(t,\`<strong>\${c.name}</strong> is now registered in <strong>\${A.registryDisplayPath}</strong> and available for use in the Builder Visual Editor\`)):Tt(t,\`<strong>\${c.name}</strong> has been unregistered from <strong>\${A.registryDisplayPath}</strong> and removed from the Builder Visual Editor\`))}catch(s){console.error(s),r.innerHTML=\`<p class="error">Error loading components</p><p class="error">\${s.message||s}</p>\`,o.style.display="none"}n.classList.remove("cmp-loading")}function bi(t){let e=t.getElementById("cmp-name"),n=e.closest(".ui-text-input"),r="",i;e.addEventListener("focus",o=>{clearTimeout(i),n.classList.remove("saved"),o.stopPropagation(),r=e.value}),e.addEventListener("blur",async o=>{if(o.stopPropagation(),clearTimeout(i),n.classList.remove("saved"),e.value!==r){if(e.value.trim().length<3){e.value=r;return}n.classList.add("saved"),i=setTimeout(()=>{n.classList.remove("saved")},3e3);let s=e.dataset.id,u=await xn({cmpId:s,name:e.value});K("registryUpdate"),J(u),z(t),ae(t,s)}}),e.addEventListener("keyup",o=>{o.stopPropagation(),clearTimeout(i),n.classList.remove("saved"),o.key==="Escape"?(e.value=r,e.blur()):o.key==="Enter"&&e.blur()})}function ae(t,e){let n=A.components.find(l=>l.id===e);if(!n)return null;let r=t.getElementById("cmp-register"),i=t.getElementById("cmp-error"),o=r.closest(".ui-switch");o.style.display="",i.innerHTML="",r.dataset.id=n.id,r.checked=!!n.isRegistered;let s=t.querySelector(".nav-cmp-detail");n.isRegistered?s.classList.add("cmp-enabled"):s.classList.remove("cmp-enabled");let u=t.getElementById("cmp-name");u.dataset.id=n.id,u.value=n.name;let c=t.getElementById("cmp-open-source");c.innerText=\`Open \${n.displayFilePath}\`,c.dataset.id=n.id;let a=t.getElementById("cmp-detail-title");return a.innerText=\`\${n.name} Component\`,Li(t,n),n}function Ii(t){t.getElementById("cmp-open-source").addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();let r=n.target,i=A.components.find(o=>o.id===r?.dataset.id);i&&(ve({filePath:i.filePath}),se("interaction",{type:"click",name:"open component source file",detail:i.filePath}))})}function Si(t){t.getElementById("btn-inputs-reload").addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),ct(t,"load")})}function xi(t){t.getElementById("cmp-detail-inputs").addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();let i=n.target?.closest("button"),o=i?.dataset.id,s=i?.dataset.propName;Ae(t,o,s)&&W(t,"nav-cmp-input")})}function Li(t,e){let n=t.getElementById("cmp-detail-inputs"),r=e.inputs.filter(i=>!i.hideFromUI);r.length>0?(n.innerHTML="",r.forEach(i=>{n.appendChild(wi(e,i))})):n.innerHTML=\`<p class="cmp-inputs-empty">\${e.name} component does not have any props</p>\`}function wi(t,e){let n=document.createElement("button");n.dataset.id=t.id,n.dataset.propName=e.name,n.className="cmp-input-item nav-list-item",e.isRegistered||n.classList.add("cmp-input-item-unregistered");let r=document.createElement("span"),i=qe(e.type);r.className=\`nav-list-item-icon input-icon input-icon-\${i}\`,n.appendChild(r);let o=document.createElement("span");o.innerText=e.friendlyName||e.name,n.appendChild(o);let s=document.createElement("span");return s.className="nav-list-item-note",s.innerText=e.type,n.appendChild(s),n}function Ur(t){t.getElementById("open-builder-registry").addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),ve({filePath:A.registryPath,line:1,column:1})}),t.getElementById("cmp-list").addEventListener("click",o=>{o.preventDefault(),o.stopPropagation();let u=o.target?.dataset.id,c=A.components.find(a=>a.id===u);if(c){let a=t.querySelector(".nav-cmp-detail .section-content");a.scrollTop=0,ae(t,c.id),W(t,"nav-cmp-detail"),c.isRegistered&&ct(t,"load")}});let r=t.getElementById("component-search"),i=t.getElementById("clear-search");r?.addEventListener("input",o=>{let s=o.target.value.toLowerCase(),u=s?A.components.filter(c=>c.name.toLowerCase().includes(s)||c.displayFilePath?.toLowerCase().includes(s)):A.components;z(t,u),i.style.display=s?"flex":"none"}),i?.addEventListener("click",()=>{r.value="",z(t),i.style.display="none"}),r?.addEventListener("keydown",o=>{o.key==="Escape"&&(r.value="",z(t),i.style.display="none")})}function Mr(t){let e=bn();Ci(t,e)}async function Ci(t,e){let n=t.getElementById("cmp-list"),r=t.querySelector(".nav-cmp-list");r.classList.add("nav-loading");let i=t.getElementById("open-builder-registry");try{let o=await e;J(o),z(t),A.registryDisplayPath?i.innerText="Open "+o.registryDisplayPath:i.innerText=""}catch(o){n.innerHTML=\`<p class="error">Error loading components</p><p class="error">\${o.message||o}</p>\`,console.error(o)}r.classList.remove("nav-loading")}function z(t,e){let n=t.getElementById("cmp-list");n.innerHTML="";let r=e||A.components,i=r.filter(s=>s.isRegistered),o=r.filter(s=>!s.isRegistered);if(e&&e.length===0){let s=document.createElement("p");s.className="no-results",s.innerText="No matching components found",n.appendChild(s);return}kr(n,"Registered Components",i),kr(n,"Unregistered Components",o)}function kr(t,e,n){if(n.length>0){let r=document.createElement("h4");r.innerText=e,t.appendChild(r),n.forEach(i=>{t.appendChild(Pi(i))})}}function Pi(t){let e=document.getElementById("component-search")?.value.toLowerCase(),n=document.createElement("button");n.dataset.id=t.id,n.className="cmp-item nav-list-item",t.isRegistered&&n.classList.add("registered");let r=document.createElement("span");r.className="nav-list-item-icon",t.image&&(r.style.backgroundImage=\`url(\${t.image})\`),n.appendChild(r);let i=document.createElement("span");i.className="nav-list-item-name",i.innerHTML=Or(t.name,e),n.appendChild(i);let o=document.createElement("span");return o.className="nav-list-item-note",o.innerHTML=Or(t.displayFilePath||"",e),n.appendChild(o),n}function Or(t,e){if(!e)return t;let n=new RegExp(\`(\${e})\`,"gi");return t.replace(n,'<span class="search-highlight">$1</span>')}var Nr=t=>{t.querySelector(".menu-toggle").addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),ue(t,!0)}),t.getElementById("close").addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),ue(t,!1)}),t.getElementById("hit").addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),ue(t,!1)}),pn(t),t.addEventListener("click",e=>e.stopPropagation()),Ri(t)},ue=(t,e)=>{e?(document.body.classList.add("builder-no-scroll"),t.host.classList.add("show-builder-menu"),K("menuOpen"),dn("menuOpened"),se("interaction",{type:"click",name:"open dev-tools menu"})):(document.body.classList.remove("builder-no-scroll"),t.host.classList.remove("show-builder-menu"),K("menuClose"),setTimeout(()=>{W(t,"nav-home")},300)),wn(e)},Ri=t=>{if(!ln("menuOpened")){Di(t);return}let e=De();if(!((Date.now()-e.firstVisitTs)/1e3/60<10)&&!ln("feedback")){dn("feedback"),Ai(t);return}},Di=t=>{let e=document.createElement("a");e.classList.add("menu-toggle-tooltip"),e.href="#open-dev-tools",e.innerHTML=\`
32
+ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.\`;t.loggerProvider.warn(e),br=!0}};var xr=function(){var t="@amplitude/plugin-network-checker-browser",e="before",n=N(),r=[],i=function(c,a){n&&(n.addEventListener(c,a),r.push({type:c,handler:a}))},o=function(){r.forEach(function(c){var a=c.type,l=c.handler;n&&n.removeEventListener(a,l)}),r=[]},s=function(c,a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return c.offline=!navigator.onLine,i("online",function(){c.loggerProvider.debug("Network connectivity changed to online."),c.offline=!1,setTimeout(function(){a.flush()},c.flushIntervalMillis)}),i("offline",function(){c.loggerProvider.debug("Network connectivity changed to offline."),c.offline=!0}),[2]})})},u=function(){return p(void 0,void 0,void 0,function(){return f(this,function(c){return o(),[2]})})};return{name:t,type:e,setup:s,teardown:u}};var Lr=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.init=function(n,r,i){n===void 0&&(n="");var o,s;return arguments.length>2?(o=r,s=i):typeof r=="string"?(o=r,s=void 0):(o=r?.userId,s=r),H(this._init(v(v({},s),{userId:o,apiKey:n})))},e.prototype._init=function(n){var r,i;return p(this,void 0,void 0,function(){var o,s,u,c,a=this;return f(this,function(l){switch(l.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,mr(n.apiKey,n,this)]);case 1:return o=l.sent(),[4,t.prototype._init.call(this,o)];case 2:return l.sent(),this.setSessionId((i=(r=n.sessionId)!==null&&r!==void 0?r:this.config.sessionId)!==null&&i!==void 0?i:Date.now()),s=oe(n.instanceName),s.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===Ke?[3,4]:[4,this.add(xr()).promise];case 3:l.sent(),l.label=4;case 4:return[4,this.add(new At).promise];case 5:return l.sent(),[4,this.add(new tr).promise];case 6:return l.sent(),[4,this.add(new Yt).promise];case 7:return l.sent(),Sr(this.config),Xt(this.config.defaultTracking)?[4,this.add(Ir()).promise]:[3,9];case 8:l.sent(),l.label=9;case 9:return zt(this.config.defaultTracking)?[4,this.add(Tr()).promise]:[3,11];case 10:l.sent(),l.label=11;case 11:return et(this.config.defaultTracking)?(u=en(this.config),c=un(u),[4,this.add(c).promise]):[3,13];case 12:l.sent(),l.label=13;case 13:return tt(this.config.defaultTracking)?[4,this.add(cn(Jt(this.config))).promise]:[3,15];case 14:l.sent(),l.label=15;case 15:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 16:return l.sent(),s.eventBridge.setEventReceiver(function(d){a.track(d.eventType,d.eventProperties)}),[2]}})})},e.prototype.getUserId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.userId},e.prototype.setUserId=function(n){if(!this.config){this.q.push(this.setUserId.bind(this,n));return}(n!==this.config.userId||n===void 0)&&(this.config.userId=n,Wt(n,this.config.instanceName))},e.prototype.getDeviceId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.deviceId},e.prototype.setDeviceId=function(n){if(!this.config){this.q.push(this.setDeviceId.bind(this,n));return}this.config.deviceId=n,$t(n,this.config.instanceName)},e.prototype.reset=function(){this.setDeviceId(X()),this.setUserId(void 0)},e.prototype.getSessionId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.sessionId},e.prototype.setSessionId=function(n){var r;if(!this.config){this.q.push(this.setSessionId.bind(this,n));return}if(n!==this.config.sessionId){var i=this.getSessionId(),o=this.config.lastEventTime,s=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1;this.config.sessionId=n,this.config.lastEventTime=void 0,this.config.pageCounter=0,Zt(this.config.defaultTracking)&&(i&&o&&this.track(sn,void 0,{device_id:this.previousSessionDeviceId,event_id:++s,session_id:i,time:o+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(on,void 0,{event_id:++s,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}},e.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},e.prototype.setTransport=function(n){if(!this.config){this.q.push(this.setTransport.bind(this,n));return}this.config.transportProvider=an(n)},e.prototype.identify=function(n,r){if(rt(n)){var i=n._q;n._q=[],n=nt(new G,i)}return r?.user_id&&this.setUserId(r.user_id),r?.device_id&&this.setDeviceId(r.device_id),t.prototype.identify.call(this,n,r)},e.prototype.groupIdentify=function(n,r,i,o){if(rt(i)){var s=i._q;i._q=[],i=nt(new G,s)}return t.prototype.groupIdentify.call(this,n,r,i,o)},e.prototype.revenue=function(n,r){if(rt(n)){var i=n._q;n._q=[],n=nt(new $e,i)}return t.prototype.revenue.call(this,n,r)},e.prototype.process=function(n){return p(this,void 0,void 0,function(){var r,i;return f(this,function(o){return r=Date.now(),i=xe(this.config.sessionTimeout,this.config.lastEventTime),n.event_type!==on&&n.event_type!==sn&&(!n.session_id||n.session_id===this.getSessionId())&&i&&this.setSessionId(r),[2,t.prototype.process.call(this,n)]})})},e}(Pt);var fi=function(){var t=new Lr;return{init:R(t.init.bind(t),"init",C(t),P(t,["config"])),add:R(t.add.bind(t),"add",C(t),P(t,["config.apiKey","timeline.plugins"])),remove:R(t.remove.bind(t),"remove",C(t),P(t,["config.apiKey","timeline.plugins"])),track:R(t.track.bind(t),"track",C(t),P(t,["config.apiKey","timeline.queue.length"])),logEvent:R(t.logEvent.bind(t),"logEvent",C(t),P(t,["config.apiKey","timeline.queue.length"])),identify:R(t.identify.bind(t),"identify",C(t),P(t,["config.apiKey","timeline.queue.length"])),groupIdentify:R(t.groupIdentify.bind(t),"groupIdentify",C(t),P(t,["config.apiKey","timeline.queue.length"])),setGroup:R(t.setGroup.bind(t),"setGroup",C(t),P(t,["config.apiKey","timeline.queue.length"])),revenue:R(t.revenue.bind(t),"revenue",C(t),P(t,["config.apiKey","timeline.queue.length"])),flush:R(t.flush.bind(t),"flush",C(t),P(t,["config.apiKey","timeline.queue.length"])),getUserId:R(t.getUserId.bind(t),"getUserId",C(t),P(t,["config","config.userId"])),setUserId:R(t.setUserId.bind(t),"setUserId",C(t),P(t,["config","config.userId"])),getDeviceId:R(t.getDeviceId.bind(t),"getDeviceId",C(t),P(t,["config","config.deviceId"])),setDeviceId:R(t.setDeviceId.bind(t),"setDeviceId",C(t),P(t,["config","config.deviceId"])),reset:R(t.reset.bind(t),"reset",C(t),P(t,["config","config.userId","config.deviceId"])),getSessionId:R(t.getSessionId.bind(t),"getSessionId",C(t),P(t,["config"])),setSessionId:R(t.setSessionId.bind(t),"setSessionId",C(t),P(t,["config"])),extendSession:R(t.extendSession.bind(t),"extendSession",C(t),P(t,["config"])),setOptOut:R(t.setOptOut.bind(t),"setOptOut",C(t),P(t,["config"])),setTransport:R(t.setTransport.bind(t),"setTransport",C(t),P(t,["config"]))}},D=fi();var Hu=D.add,qu=D.extendSession,ju=D.flush,Ku=D.getDeviceId,Gu=D.getSessionId,Wu=D.getUserId,$u=D.groupIdentify,wr=D.identify,Cr=D.init,Yu=D.logEvent,Qu=D.remove,Xu=D.reset,zu=D.revenue,Zu=D.setDeviceId,Ju=D.setGroup,ec=D.setOptOut,tc=D.setSessionId,nc=D.setTransport,rc=D.setUserId,se=D.track;var K=t=>{window.dispatchEvent(new CustomEvent("builderdevtools",{detail:{eventName:t}}))};async function mi(){return Cn()}var Pr=async()=>{let t=new URL(window.location.href),e=t.hash,n=\`#\${hn}=\`,r=Math.random().toString(36).substring(2,15),i=await mi();Cr("f1d2eb79aecd01b28c8a371ea5d1751c",i?.userId||r,{logLevel:Ge.LogLevel.None,serverUrl:En,flushIntervalMillis:500});let o=new G;wr(o,{device_id:i?.deviceId,user_id:i?.userId||r});let s="anonymous";e.startsWith(n)&&(s=e.slice(n.length),s&&(vi(s),t.hash="",window.history.replaceState({},"",t.href))),K("init")};var vi=t=>{if(typeof t=="string"&&t.length>0){let e=De();Re({...e,builderUserId:t})}},De=()=>{let t=localStorage.getItem(Rr);if(t)try{let e=JSON.parse(t);return(!e.ctas||typeof e.ctas!="object")&&(e=Re({...e,ctas:{}})),e.menuOpenedTs&&(e=Re({...e,ctas:{...e.ctas,menuOpened:e.menuOpenedTs}}),delete e.menuOpenedTs),e}catch(e){console.error(e)}return Re({firstVisitTs:Date.now(),ctas:{},builderUserId:""})},Re=t=>{try{localStorage.setItem(Rr,JSON.stringify(t))}catch(e){console.error(e)}return t},ln=t=>!!De().ctas[t],dn=t=>{let e=De();return Re({...e,ctas:{...e.ctas,[t]:Date.now()}})},Rr="builderDevtools";function Dr(t){gi(t),hi(t),yi(t),_i(t)}function gi(t){let e=t.getElementById("input-register");e.addEventListener("change",async n=>{n.stopPropagation();let r=t.getElementById("input-name"),i=t.querySelector(".nav-cmp-input");i.classList.add("input-loading"),i.classList.remove("input-enabled");let o=r.dataset.id,s=r.dataset.prop,u=await Me({cmpId:o,name:s,registerInput:e.checked});K("registryUpdate"),J(u),Ae(t,o,s),ae(t,o),i.classList.remove("input-loading")})}function hi(t){t.getElementById("input-open-source").addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();let r=n.target,i=A.components.find(o=>o.id===r?.dataset.id);i&&ve({filePath:i.filePath})})}function yi(t){let e=t.getElementById("input-name"),n=e.closest(".ui-text-input"),r="",i;e.addEventListener("focus",o=>{clearTimeout(i),n.classList.remove("saved"),o.stopPropagation(),r=e.value}),e.addEventListener("blur",async o=>{if(o.stopPropagation(),clearTimeout(i),n.classList.remove("saved"),e.value!==r){if(e.value.trim().length<3){e.value=r;return}n.classList.add("saved"),i=setTimeout(()=>{n.classList.remove("saved")},3e3);let s=e.dataset.id,u=e.dataset.prop,c=await Me({cmpId:s,name:u,friendlyName:e.value});K("registryUpdate"),J(c),z(t),ae(t,s),Ae(t,s,u)}}),e.addEventListener("keyup",o=>{o.stopPropagation(),clearTimeout(i),n.classList.remove("saved"),o.key==="Escape"?(e.value=r,e.blur()):o.key==="Enter"&&e.blur()})}function _i(t){let e=t.getElementById("input-type");e.addEventListener("change",async n=>{n.stopPropagation();let r=e.dataset.id,i=e.dataset.prop,o=await Me({cmpId:r,name:i,type:e.value});K("registryUpdate"),J(o),z(t),ae(t,r),Ae(t,r,i)})}function Ae(t,e,n){let r=A.components.find(m=>m.id===e);if(!r)return null;let i=r.inputs.find(m=>m.name===n);if(!i)return null;let o=t.querySelector(".nav-cmp-input");i.isRegistered?o.classList.add("input-enabled"):o.classList.remove("input-enabled");let s=t.getElementById("input-register");s.checked=!!i.isRegistered;let u=t.getElementById("cmp-input-title");u.innerText=r.name+": "+(i.friendlyName||i.name);let c=t.getElementById("input-open-source");c.innerText=\`Open \${r.displayFilePath}\`,c.dataset.id=r.id;let a=t.getElementById("cmp-prop-name");a.innerText=i.name;let l=t.getElementById("cmp-prop-type");l.innerText=qe(i.type);let d=t.getElementById("input-name");return d.dataset.id=r.id,d.dataset.prop=i.name,d.value=i.friendlyName||i.name,Ei(t,r,i),i}function Ei(t,e,n){let r=t.getElementById("input-type");r.dataset.id=e.id,r.dataset.prop=n.name,r.innerHTML="";let i=n.type,o=Ne.includes(i),s=Be.includes(i),u=Fe.includes(i),c=Ve.includes(i),a=He.includes(i);Pn.forEach(l=>{let d=document.createElement("option");d.value=l.value,d.innerText=l.text,d.disabled=Ne.includes(l.value)&&!o||Be.includes(l.value)&&!s||Fe.includes(l.value)&&!u||Ve.includes(l.value)&&!c||He.includes(l.value)&&!a,r.appendChild(d)}),r.value=i}function Ar(t){Ti(t),Ii(t),bi(t),xi(t),Si(t)}function Ti(t){t.getElementById("cmp-register").addEventListener("change",n=>{n.stopPropagation(),ct(t,"update")})}async function ct(t,e){let n=t.querySelector(".nav-cmp-detail"),r=t.getElementById("cmp-error"),i=t.getElementById("cmp-register"),o=i.closest(".ui-switch");n.classList.remove("cmp-enabled"),i.checked&&n.classList.add("cmp-loading");try{let s=i.dataset.id,u;e==="load"?u=await bn({cmpId:s}):i.checked?(u=await Sn({cmpId:s}),K("registryUpdate"),se("interaction",{type:"click",name:"register component",detail:s})):(u=await Ln({cmpId:s}),K("registryUpdate"),se("interaction",{type:"click",name:"unregister component",detail:s})),J(u),z(t);let c=ae(t,s);e==="update"&&c&&(i.checked?(n.classList.add("cmp-enabled"),Tt(t,\`<strong>\${c.name}</strong> is now registered in <strong>\${A.registryDisplayPath}</strong> and available for use in the Builder Visual Editor\`)):Tt(t,\`<strong>\${c.name}</strong> has been unregistered from <strong>\${A.registryDisplayPath}</strong> and removed from the Builder Visual Editor\`))}catch(s){console.error(s),r.innerHTML=\`<p class="error">Error loading components</p><p class="error">\${s.message||s}</p>\`,o.style.display="none"}n.classList.remove("cmp-loading")}function Ii(t){let e=t.getElementById("cmp-name"),n=e.closest(".ui-text-input"),r="",i;e.addEventListener("focus",o=>{clearTimeout(i),n.classList.remove("saved"),o.stopPropagation(),r=e.value}),e.addEventListener("blur",async o=>{if(o.stopPropagation(),clearTimeout(i),n.classList.remove("saved"),e.value!==r){if(e.value.trim().length<3){e.value=r;return}n.classList.add("saved"),i=setTimeout(()=>{n.classList.remove("saved")},3e3);let s=e.dataset.id,u=await xn({cmpId:s,name:e.value});K("registryUpdate"),J(u),z(t),ae(t,s)}}),e.addEventListener("keyup",o=>{o.stopPropagation(),clearTimeout(i),n.classList.remove("saved"),o.key==="Escape"?(e.value=r,e.blur()):o.key==="Enter"&&e.blur()})}function ae(t,e){let n=A.components.find(l=>l.id===e);if(!n)return null;let r=t.getElementById("cmp-register"),i=t.getElementById("cmp-error"),o=r.closest(".ui-switch");o.style.display="",i.innerHTML="",r.dataset.id=n.id,r.checked=!!n.isRegistered;let s=t.querySelector(".nav-cmp-detail");n.isRegistered?s.classList.add("cmp-enabled"):s.classList.remove("cmp-enabled");let u=t.getElementById("cmp-name");u.dataset.id=n.id,u.value=n.name;let c=t.getElementById("cmp-open-source");c.innerText=\`Open \${n.displayFilePath}\`,c.dataset.id=n.id;let a=t.getElementById("cmp-detail-title");return a.innerText=\`\${n.name} Component\`,Li(t,n),n}function bi(t){t.getElementById("cmp-open-source").addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();let r=n.target,i=A.components.find(o=>o.id===r?.dataset.id);i&&(ve({filePath:i.filePath}),se("interaction",{type:"click",name:"open component source file",detail:i.filePath}))})}function Si(t){t.getElementById("btn-inputs-reload").addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),ct(t,"load")})}function xi(t){t.getElementById("cmp-detail-inputs").addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();let i=n.target?.closest("button"),o=i?.dataset.id,s=i?.dataset.propName;Ae(t,o,s)&&W(t,"nav-cmp-input")})}function Li(t,e){let n=t.getElementById("cmp-detail-inputs"),r=e.inputs.filter(i=>!i.hideFromUI);r.length>0?(n.innerHTML="",r.forEach(i=>{n.appendChild(wi(e,i))})):n.innerHTML=\`<p class="cmp-inputs-empty">\${e.name} component does not have any props</p>\`}function wi(t,e){let n=document.createElement("button");n.dataset.id=t.id,n.dataset.propName=e.name,n.className="cmp-input-item nav-list-item",e.isRegistered||n.classList.add("cmp-input-item-unregistered");let r=document.createElement("span"),i=qe(e.type);r.className=\`nav-list-item-icon input-icon input-icon-\${i}\`,n.appendChild(r);let o=document.createElement("span");o.innerText=e.friendlyName||e.name,n.appendChild(o);let s=document.createElement("span");return s.className="nav-list-item-note",s.innerText=e.type,n.appendChild(s),n}function Ur(t){t.getElementById("open-builder-registry").addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),ve({filePath:A.registryPath,line:1,column:1})}),t.getElementById("cmp-list").addEventListener("click",o=>{o.preventDefault(),o.stopPropagation();let u=o.target?.dataset.id,c=A.components.find(a=>a.id===u);if(c){let a=t.querySelector(".nav-cmp-detail .section-content");a.scrollTop=0,ae(t,c.id),W(t,"nav-cmp-detail"),c.isRegistered&&ct(t,"load")}});let r=t.getElementById("component-search"),i=t.getElementById("clear-search");r?.addEventListener("input",o=>{let s=o.target.value.toLowerCase(),u=s?A.components.filter(c=>c.name.toLowerCase().includes(s)||c.displayFilePath?.toLowerCase().includes(s)):A.components;z(t,u),i.style.display=s?"flex":"none"}),i?.addEventListener("click",()=>{r.value="",z(t),i.style.display="none"}),r?.addEventListener("keydown",o=>{o.key==="Escape"&&(r.value="",z(t),i.style.display="none")})}function Mr(t){let e=In();Ci(t,e)}async function Ci(t,e){let n=t.getElementById("cmp-list"),r=t.querySelector(".nav-cmp-list");r.classList.add("nav-loading");let i=t.getElementById("open-builder-registry");try{let o=await e;J(o),z(t),A.registryDisplayPath?i.innerText="Open "+o.registryDisplayPath:i.innerText=""}catch(o){n.innerHTML=\`<p class="error">Error loading components</p><p class="error">\${o.message||o}</p>\`,console.error(o)}r.classList.remove("nav-loading")}function z(t,e){let n=t.getElementById("cmp-list");n.innerHTML="";let r=e||A.components,i=r.filter(s=>s.isRegistered),o=r.filter(s=>!s.isRegistered);if(e&&e.length===0){let s=document.createElement("p");s.className="no-results",s.innerText="No matching components found",n.appendChild(s);return}kr(n,"Registered Components",i),kr(n,"Unregistered Components",o)}function kr(t,e,n){if(n.length>0){let r=document.createElement("h4");r.innerText=e,t.appendChild(r),n.forEach(i=>{t.appendChild(Pi(i))})}}function Pi(t){let e=document.getElementById("component-search")?.value.toLowerCase(),n=document.createElement("button");n.dataset.id=t.id,n.className="cmp-item nav-list-item",t.isRegistered&&n.classList.add("registered");let r=document.createElement("span");r.className="nav-list-item-icon",t.image&&(r.style.backgroundImage=\`url(\${t.image})\`),n.appendChild(r);let i=document.createElement("span");i.className="nav-list-item-name",i.innerHTML=Or(t.name,e),n.appendChild(i);let o=document.createElement("span");return o.className="nav-list-item-note",o.innerHTML=Or(t.displayFilePath||"",e),n.appendChild(o),n}function Or(t,e){if(!e)return t;let n=new RegExp(\`(\${e})\`,"gi");return t.replace(n,'<span class="search-highlight">$1</span>')}var Nr=t=>{t.querySelector(".menu-toggle").addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),ue(t,!0)}),t.getElementById("close").addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),ue(t,!1)}),t.getElementById("hit").addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),ue(t,!1)}),pn(t),t.addEventListener("click",e=>e.stopPropagation()),Ri(t)},ue=(t,e)=>{e?(document.body.classList.add("builder-no-scroll"),t.host.classList.add("show-builder-menu"),K("menuOpen"),dn("menuOpened"),se("interaction",{type:"click",name:"open dev-tools menu"})):(document.body.classList.remove("builder-no-scroll"),t.host.classList.remove("show-builder-menu"),K("menuClose"),setTimeout(()=>{W(t,"nav-home")},300)),wn(e)},Ri=t=>{if(!ln("menuOpened")){Di(t);return}let e=De();if(!((Date.now()-e.firstVisitTs)/1e3/60<10)&&!ln("feedback")){dn("feedback"),Ai(t);return}},Di=t=>{let e=document.createElement("a");e.classList.add("menu-toggle-tooltip"),e.href="#open-dev-tools",e.innerHTML=\`
17
33
  <div class="menu-toggle-tooltip-content">
18
34
  <h3>Open Builder Devtools</h3>
19
35
  <p>Start registering your components</p>
@@ -23,7 +39,7 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
23
39
  <h3>How's Devtools working for you?</h3>
24
40
  <p>We'd love your feedback!</p>
25
41
  </div>
26
- \`,t.appendChild(e),setTimeout(()=>{e.classList.add("menu-toggle-tooltip-show"),e.addEventListener("click",()=>{e.classList.remove("menu-toggle-tooltip-show")})},1e3)};function Br(t){t.getElementById("go-to-builder").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),ue(t,!1),window.open(mn(),"builder")}),t.getElementById("components-link").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation();let u=t.querySelector(".nav-cmp-list .section-content");u.scrollTop=0,W(t,"nav-cmp-list"),Mr(t)}),t.getElementById("settings-link").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),W(t,"nav-settings")}),t.getElementById("add-page-link").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),ue(t,!1),window.open(Ee(),"builder")}),t.getElementById("import-from-figma").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),ue(t,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function Fr(t){let e=t.getElementById("enable-edit");e.addEventListener("change",n=>{n.stopPropagation(),It(e.checked)}),e.checked=ke(),It(e.checked)}var lt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=\`<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}.menu-toggle{position:absolute;right:0;bottom:0;pointer-events:auto;padding:8px;background:transparent;border:none;appearance:none}.menu-toggle div{position:relative;width:64px;height:64px;pointer-events:none;border-radius:50%;background:#000;border:1px solid white;box-shadow:#00000054 0 0 8px}.menu-toggle:hover div{background-color:var(--background-color);border:1px solid rgb(220,220,220)}.menu-toggle svg{position:absolute;top:15px;left:15px;width:33px;height:32px}div.highlight-bg{position:absolute;top:-1px;left:-1px;background-color:#1a1a1a;pointer-events:none;transition:all .4s ease-out;opacity:0}.menu-toggle-highlight-no-transition div.highlight-bg{transition:none}.menu-toggle-highlight div.highlight-bg{opacity:1}.menu-toggle-tooltip{position:absolute;bottom:0;right:0;width:382px;height:72px;padding:0;text-align:left;appearance:none;background-color:transparent;border:none;pointer-events:none;transform:translate3d(320px,0,0);opacity:0;transition:all .15s ease-in-out;color:#fff}.menu-toggle-tooltip.menu-toggle-tooltip-show{pointer-events:auto;opacity:1;transform:translateZ(0)}.menu-toggle-tooltip-content{position:absolute;inset:0 95px 10px 0;padding:8px 12px;background-color:var(--primary-color);box-shadow:#00000054 0 0 20px;border-radius:2px}.menu-toggle-tooltip-content:before{content:"";position:absolute;bottom:15px;right:-6px;width:30px;height:30px;background-color:var(--primary-color);transform:rotate(45deg)}.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,.menu-toggle-tooltip:hover .menu-toggle-tooltip-content:before{background-color:var(--primary-color-highlight)}.menu-toggle-tooltip-content h3{margin:0;font-size:16px}.menu-toggle-tooltip-content p{margin:0;font-size:12px}section{position:absolute;display:grid;grid-template-rows:64px auto 64px;top:0;left:0;width:100%;height:100%;padding:0;pointer-events:none}.section-content{margin:0;padding:0 0 10px;font-weight:300;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;overflow-y:auto}.section-content .error{color:var(--error-color);font-weight:700}section a{text-decoration:none;color:var(--text-color)}section h3,section p{margin-left:16px;margin-right:16px}.info{font-size:12px}ul.list{list-style:none;padding:0;margin:0}ul.list li{display:block;padding:0;margin:0}ul.list a,ul.list button{display:grid;grid-template-columns:24px auto;grid-gap:16px;padding:12px;margin:8px 0;border:none;background:transparent;appearance:none;width:100%;font-weight:300;text-align:left;text-decoration:none;color:var(--text-color)}ul.list a:hover,ul.list button:hover{text-decoration:none;color:var(--text-color);background-color:var(--button-background-color-hover)}ul.list a span,ul.list button span{display:block;font-size:16px;font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}header{position:relative;display:grid;grid-template-columns:44px 1fr;gap:8px;padding-left:8px;border-bottom:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}header>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-home header>div{margin-right:56px}header h2{margin:7px 0 0;font-size:18px;font-weight:500;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p{margin:2px 0 0;font-size:12px;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button{display:block;margin:0;padding:0;width:100%;font-size:12px;font-weight:300;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button:hover{text-decoration:underline;color:var(--primary-color)}.builder-logo{margin:12px 0 0 8px}#close{display:block;position:absolute;appearance:none;background:transparent;border:none;border-radius:50%;margin:0;padding:0;right:4px;top:8px;width:48px;height:48px;z-index:1;opacity:.7}#close:hover{opacity:1;background-color:var(--button-background-color-hover)}#close svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}.back-button{position:relative;display:block;margin:7px 0 0 -2px;width:48px;height:48px;background:transparent;border:none;appearance:none;border-radius:50%}.back-button:hover{background-color:var(--button-background-color-hover)}.back-button svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}footer{border-top:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}section.nav-cmp-list{grid-template-rows:64px auto 120px}footer a{text-decoration:underline;color:var(--primary-color)}footer a:hover{color:var(--primary-color);text-decoration:none}.nav-list{padding:2px 0}.nav-loading{pointer-events:none}.nav-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.nav-loading .nav-loading-icon{opacity:.5}.nav-list h4{margin:8px 8px 8px 10px;font-size:14px;font-weight:600}.nav-list .nav-list-item+h4{margin-top:30px}.nav-list-item{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;margin:2px 0;padding:8px 28px 8px 46px;width:100%;font-size:14px;font-weight:300;text-align:left;border:none;background:transparent;appearance:none}.nav-list-item:hover{background-color:var(--button-background-color-hover)}.nav-list-item-icon{position:absolute;top:4px;left:10px;width:24px;height:24px;object-fit:contain;filter:invert(100%);background-size:24px 24px;background-repeat:no-repeat;background-position:center center}.nav-list-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.nav-list-item:after{display:block;position:absolute;content:"";background-image:url('data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');background-repeat:no-repeat;background-position:12px 9px;top:0;right:0;width:32px;height:32px;pointer-events:none}.nav-list-item-note{opacity:0;font-size:12px;padding-top:1px;text-align:right}.nav-list-item:hover .nav-list-item-note{opacity:.5}.ui-select{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-select h3{margin:0;font-size:14px;font-weight:500}.ui-select p{margin:8px 0;font-size:12px;font-weight:300}.ui-select .select{position:relative;margin:8px 0;border-radius:4px;padding:0;line-height:1.1;overflow:hidden;border:1px solid var(--border-color)}.ui-select select{appearance:none;background-color:transparent;border:none;outline:none;padding:8px 32px 8px 8px;margin:0;width:100%;font-size:14px;cursor:pointer;text-overflow:ellipsis;opacity:.6;color:var(--text-color)}.ui-select .select:after{content:"";top:6px;right:5px;width:24px;height:24px;position:absolute;background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>');background-repeat:no-repeat;background-position:center;pointer-events:none;opacity:.6}.ui-select .select:hover{border-color:var(--primary-color-subdued)}.ui-text-input .select:focus-within{border-color:var(--primary-color)}.ui-text-input .select:focus-within select{opacity:1}.spinner:after{content:" ";display:block;width:32px;height:32px;margin:0 auto;pointer-events:auto;border-radius:50%;border:3px solid var(--text-color);border-color:var(--text-color) transparent var(--text-color) transparent;animation:spinner .75s linear infinite}@keyframes spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ui-switch{display:grid;grid-template-columns:auto 48px;grid-gap:20px;margin:8px 0 16px;padding:8px 0 8px 16px;cursor:pointer}.ui-switch>*{pointer-events:none}.ui-switch input{display:none;visibility:hidden}.ui-switch .switcher{display:inline-block;border-radius:100px;width:35px;height:14px;background-color:#ccc;position:relative;top:6px;vertical-align:middle;cursor:pointer}.ui-switch input[type=checkbox]:checked+.switcher{background-color:var(--primary-color-subdued)}.ui-switch .switcher:before{content:"";display:block;width:20px;height:20px;background-color:var(--text-color);box-shadow:0 1px 3px #0009;border-radius:50%;position:absolute;top:-3px;left:0;margin-right:0;transition:all .15s}.ui-switch input[type=checkbox]:checked+.switcher:before{left:100%;margin-left:-20px;background-color:var(--primary-color)}.ui-switch h3{margin:0;font-size:14px;font-weight:500}.ui-switch p{margin:4px 0 0;font-size:12px;font-weight:300}.ui-text-input{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-text-input h3{margin:0;font-size:14px;font-weight:500}.ui-text-input p{margin:8px 0;font-size:12px;font-weight:300}.ui-text-input .input{position:relative;margin:8px 0;border:1px solid var(--border-color);border-radius:4px;background:transparent;padding:2px;overflow:hidden}.ui-text-input input{display:block;width:235px;font-size:14px;border:none;background:transparent;padding:6px;appearance:none;color:var(--text-color);opacity:.6;outline:none}.ui-text-input .input:hover{border-color:var(--primary-color-subdued)}.ui-text-input .input:focus-within{border-color:var(--primary-color)}.ui-text-input .input:focus-within input{opacity:1}.ui-text-input .input:after{content:"";position:absolute;top:5px;right:14px;width:8px;height:17px;border:2px solid rgba(51,181,51,1);border-top:none;border-left:none;transform:rotate(45deg);opacity:0;transition:opacity 80ms ease-in-out;pointer-events:none}.ui-text-input.saved .input:after{opacity:1}.ui-toast{position:fixed;bottom:8px;left:8px;right:8px;padding:6px 12px;font-size:14px;border-radius:4px;transform:translate3d(0,150%,0);opacity:0;transition:all var(--transition-time) ease-in-out;background-color:var(--primary-color-subdued);color:var(--text-color);pointer-events:none}.ui-toast.ui-toast-show{transform:translateZ(0);opacity:1;pointer-events:auto}[data-view=nav-home] .nav-home .section-content,[data-view=nav-cmp-list] .nav-cmp-list .section-content,[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,[data-view=nav-cmp-input] .nav-cmp-input .section-content,[data-view=nav-settings] .nav-settings .section-content{transform:translateZ(0);pointer-events:auto}[data-view=nav-home] .nav-home header,[data-view=nav-home] .nav-home footer,[data-view=nav-cmp-list] .nav-cmp-list header,[data-view=nav-cmp-list] .nav-cmp-list footer,[data-view=nav-cmp-detail] .nav-cmp-detail header,[data-view=nav-cmp-detail] .nav-cmp-detail footer,[data-view=nav-cmp-input] .nav-cmp-input header,[data-view=nav-cmp-input] .nav-cmp-input footer,[data-view=nav-settings] .nav-settings header,[data-view=nav-settings] .nav-settings footer{opacity:1;pointer-events:auto}[data-view=nav-cmp-list] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-home .section-content,[data-view=nav-cmp-input] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-cmp-detail .section-content,[data-view=nav-settings] .nav-home .section-content{transform:translate3d(-105%,0,0)}.cmp-item .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');opacity:.3}.cmp-item.registered .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>');opacity:.8}.search-highlight{background-color:var(--primary-color-alpha);padding:0 2px;border-radius:2px;font-weight:500}.search-container{position:sticky;top:0;z-index:10;padding:12px 16px;background:var(--background-color);border-bottom:1px solid var(--border-color)}.search-input-wrapper{position:relative;display:flex;align-items:center}.search-icon{position:absolute;left:12px;color:var(--text-color-secondary);pointer-events:none}.component-search-input{width:100%;height:36px;padding:8px 36px;border:1px solid var(--border-color);border-radius:6px;background:var(--input-background);color:var(--text-color);font-size:14px;transition:border-color .2s,box-shadow .2s}.component-search-input:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color-alpha)}.component-search-input::placeholder{color:var(--text-color-tertiary)}.clear-search-button{position:absolute;right:8px;padding:4px;color:var(--text-color-secondary);border:none;background:transparent;border-radius:4px;cursor:pointer;opacity:0;transition:opacity .2s,background-color .2s;display:flex;align-items:center;justify-content:center}.clear-search-button:hover{background-color:var(--hover-color)}.component-search-input:not(:placeholder-shown)+.clear-search-button{opacity:1}.no-results{padding:32px 16px;text-align:center;color:var(--text-color-secondary);font-size:14px}#cmp-detail{position:relative}.cmp-loading{pointer-events:none!important}.cmp-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.cmp-loading .cmp-loading-icon{opacity:.5}.cmp-cover{position:absolute;top:160px;left:0;width:100%;height:100vh;background:var(--background-color);transform:translateZ(0);pointer-events:none;display:none}[data-view=nav-cmp-detail] .cmp-cover{display:block;pointer-events:auto}.cmp-enabled .cmp-cover{transform:translate3d(0,105%,0);pointer-events:none}.section-ready .cmp-cover{transition:all var(--transition-time) ease-in-out}.cmp-detail-inputs-container{margin:8px 0 16px;padding:0}.cmp-detail-inputs-container h3{margin:0 0 6px;padding-left:16px;padding-right:8px;font-size:14px;font-weight:500;display:flex;justify-content:space-between;align-items:center}.cmp-detail-inputs-reload{font-weight:300;font-size:.9em;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmp-detail-inputs-reload:hover{text-decoration:underline;color:var(--primary-color)}.cmp-detail-inputs-container .cmp-inputs-empty{padding:0;margin-top:12px;font-size:12px;font-weight:300;opacity:.5;font-style:italic}.cmp-detail-inputs-container .nav-list-item-icon{opacity:.8;background-size:20px 20px;background-position:4px center}.input-icon{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>')}.input-icon-array{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>')}.input-icon-boolean{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>')}.input-icon-number{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>')}.input-icon-object{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>')}.input-icon-string{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>')}.cmp-input-item-unregistered{opacity:.4}.cmp-input-item-unregistered .input-icon:after{content:"";position:absolute;top:11px;left:4px;width:20px;height:2px;background-color:#000;transform:rotate(-45deg)}.cmp-prop-info{border-bottom:1px solid var(--border-color)}.cmp-input-readonly{margin:16px 0;padding:0 16px;display:grid;grid-template-columns:50% 50%;gap:12px}.cmp-input-readonly h3{margin:0;font-size:14px;font-weight:500}.cmp-input-readonly span{margin-top:2px;font-size:12px;font-weight:300;opacity:.8}.cmp-input-detail{margin:16px 0}.cmp-input-detail a{color:var(--primary-color);text-decoration:none}.cmp-input-detail a:hover{text-decoration:underline}.input-cover{position:absolute;top:175px;left:0;width:100%;height:100%;background:var(--background-color);transform:translateZ(0);transition:all var(--transition-time) ease-in-out;pointer-events:auto}.input-enabled .input-cover{transform:translate3d(0,105%,0);pointer-events:none}.input-loading-icon{position:absolute;display:inline-block;top:190px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.input-loading .input-loading-icon{opacity:.5}:host{position:fixed;inset:0;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}aside{position:absolute;top:0;right:0;width:var(--menu-width);height:100%;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;background:var(--background-color);box-shadow:#000000c9 5px 0 20px;overflow:hidden;z-index:1}:host(.show-builder-menu) aside{pointer-events:auto;transform:translateZ(0)}#hit{position:absolute;inset:0;display:none}:host(.show-builder-menu) #hit{display:block;pointer-events:auto}#version{position:absolute;bottom:6px;right:6px;font-size:8px;color:#9b9b9b}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder's selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder's Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder's Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>\`,Nr(e),Br(e),Ur(e),Ar(e),Dr(e),Fr(e),this.setAttribute("aria-hidden","true"),e.getElementById("version").textContent="v1.5.2"}highlightOpener(){let e=this.shadowRoot.querySelector(".menu-toggle");e.classList.add("menu-toggle-highlight"),e.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight")},20)},20)}};var ki=\`<style>*,*:before,*:after{box-sizing:border-box}html,body,:host{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:2147483646;margin:0;padding:0;line-height:1.8;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#252525;color:#fff;transition:opacity .25s ease-in-out}:host([aria-hidden="true"]){opacity:0;pointer-events:none}main{position:absolute;top:0;left:0;width:100%;height:100vh}h1{margin-top:0;font-size:24px;font-weight:300;line-height:1.4}p{margin:20px 0;font-weight:300}button{cursor:pointer}aside{position:absolute;top:0;left:0;width:350px;height:100vh;padding:60px 0 0 50px;background-color:#121212}aside ul{margin:30px 0 0;padding:0;list-style:none}aside li{position:relative;margin:0;padding:20px 10px;font-weight:300}aside li.highlight{color:#48a1ff}aside li.active{font-weight:700}aside li .circle{position:absolute;top:20px;left:10px;width:24px;height:24px;border:3px solid white;border-radius:50%;font-size:14px}aside li.highlight .circle{border-color:#48a1ff}aside li.active .circle:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background-color:#48a1ff}aside li.completed .circle{background-color:#48a1ff}aside li.completed .circle:after{content:"";position:absolute;top:2px;left:6px;width:6px;height:13px;border:3px solid black;border-top:none;border-left:none;transform:rotate(45deg)}aside li .line{position:absolute;top:44px;left:21px;width:3px;height:45px;background-color:#fff}aside li.completed .line{background-color:#48a1ff}aside li span{display:block;margin-left:44px}nav{margin-top:30px}section{position:absolute;top:135px;left:350px;padding:0 80px 0 140px;transition:opacity .15s ease-in-out}section[aria-hidden=true]{pointer-events:none;opacity:0}section h1,section p{min-width:300px;max-width:600px}.button{position:relative;display:inline-block;color:#fff;background-color:#48a1ff;border-radius:4px;text-decoration:none;padding:10px 40px 10px 20px;white-space:nowrap}.button:hover{background-color:#48a1ffd9}#button-icon{position:absolute;top:1px;right:5px;bottom:0;width:30px;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>');background-repeat:no-repeat;background-position:center;background-size:24px 24px}.button[aria-disabled=true]{opacity:.9;background-color:#ffffff4d;pointer-events:none;padding-right:60px}.button[aria-disabled=true] #button-icon{top:21px;right:29px;width:8px;height:8px;border-radius:4px;background:#fff;color:#fff;animation:dot-flashing .5s infinite linear alternate;animation-delay:.25s}.button[aria-disabled=true] #button-icon:before,.button[aria-disabled=true] #button-icon:after{content:"";display:inline-block;position:absolute;top:0}.button[aria-disabled=true] #button-icon:before{left:-12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:0s}.button[aria-disabled=true] #button-icon:after{left:12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:.5s}@keyframes dot-flashing{0%{background-color:#fff}50%,to{background-color:#ffffff4d}}.logo{margin-left:9px;background:url('data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>');background-repeat:no-repeat;width:150px;height:32px}@media (max-width: 840px){aside{width:250px;padding:60px 0 0 20px}section{left:250px;padding:0 80px}}@media (max-width: 590px){aside{width:230px;padding:60px 0 0 10px}section{left:230px;padding:0 40px}}#modified-files-message a{color:#cbcbcb;font-weight:300;text-decoration:underline}#modified-files-message a:hover{color:#fff;text-decoration:none}#restart-warning{border-radius:4px;padding:8px 16px;border:1px solid #fd6b3c;background:#fd6b3c1a}#react-router-steps{margin:0 0 5px;padding:0 20px}#need-help{color:#48a1ff;text-decoration:none}#router-message{border-radius:4px;padding:16px;border:1px solid #48a1ff}#router-finish-button{margin-top:12px}#router-checkbox-div{display:flex;align-items:center}#router-checkbox{margin-right:10px;width:15px;height:15px}#success-title{display:flex;align-items:center;gap:10px}#success-title .check-icon{display:inline-block;width:24px;height:24px;border:2px solid #28a745;border-radius:50%;position:relative}#success-title .check-icon:before{content:"";position:absolute;top:50%;left:50%;width:6px;height:12px;border:solid #28a745;border-width:0 2px 2px 0;transform:translate(-50%,-60%) rotate(45deg)}
42
+ \`,t.appendChild(e),setTimeout(()=>{e.classList.add("menu-toggle-tooltip-show"),e.addEventListener("click",()=>{e.classList.remove("menu-toggle-tooltip-show")})},1e3)};function Br(t){t.getElementById("go-to-builder").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),ue(t,!1),window.open(mn(),"builder")}),t.getElementById("components-link").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation();let u=t.querySelector(".nav-cmp-list .section-content");u.scrollTop=0,W(t,"nav-cmp-list"),Mr(t)}),t.getElementById("settings-link").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),W(t,"nav-settings")}),t.getElementById("add-page-link").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),ue(t,!1),window.open(Ee(),"builder")}),t.getElementById("import-from-figma").addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),ue(t,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function Fr(t){let e=t.getElementById("enable-edit");e.addEventListener("change",n=>{n.stopPropagation(),bt(e.checked)}),e.checked=ke(),bt(e.checked)}var lt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=\`<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}.menu-toggle{position:absolute;right:0;bottom:0;pointer-events:auto;padding:8px;background:transparent;border:none;appearance:none}.menu-toggle div{position:relative;width:64px;height:64px;pointer-events:none;border-radius:50%;background:#000;border:1px solid white;box-shadow:#00000054 0 0 8px}.menu-toggle:hover div{background-color:var(--background-color);border:1px solid rgb(220,220,220)}.menu-toggle svg{position:absolute;top:15px;left:15px;width:33px;height:32px}div.highlight-bg{position:absolute;top:-1px;left:-1px;background-color:#1a1a1a;pointer-events:none;transition:all .4s ease-out;opacity:0}.menu-toggle-highlight-no-transition div.highlight-bg{transition:none}.menu-toggle-highlight div.highlight-bg{opacity:1}.menu-toggle-tooltip{position:absolute;bottom:0;right:0;width:382px;height:72px;padding:0;text-align:left;appearance:none;background-color:transparent;border:none;pointer-events:none;transform:translate3d(320px,0,0);opacity:0;transition:all .15s ease-in-out;color:#fff}.menu-toggle-tooltip.menu-toggle-tooltip-show{pointer-events:auto;opacity:1;transform:translateZ(0)}.menu-toggle-tooltip-content{position:absolute;inset:0 95px 10px 0;padding:8px 12px;background-color:var(--primary-color);box-shadow:#00000054 0 0 20px;border-radius:2px}.menu-toggle-tooltip-content:before{content:"";position:absolute;bottom:15px;right:-6px;width:30px;height:30px;background-color:var(--primary-color);transform:rotate(45deg)}.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,.menu-toggle-tooltip:hover .menu-toggle-tooltip-content:before{background-color:var(--primary-color-highlight)}.menu-toggle-tooltip-content h3{margin:0;font-size:16px}.menu-toggle-tooltip-content p{margin:0;font-size:12px}section{position:absolute;display:grid;grid-template-rows:64px auto 64px;top:0;left:0;width:100%;height:100%;padding:0;pointer-events:none}.section-content{margin:0;padding:0 0 10px;font-weight:300;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;overflow-y:auto}.section-content .error{color:var(--error-color);font-weight:700}section a{text-decoration:none;color:var(--text-color)}section h3,section p{margin-left:16px;margin-right:16px}.info{font-size:12px}ul.list{list-style:none;padding:0;margin:0}ul.list li{display:block;padding:0;margin:0}ul.list a,ul.list button{display:grid;grid-template-columns:24px auto;grid-gap:16px;padding:12px;margin:8px 0;border:none;background:transparent;appearance:none;width:100%;font-weight:300;text-align:left;text-decoration:none;color:var(--text-color)}ul.list a:hover,ul.list button:hover{text-decoration:none;color:var(--text-color);background-color:var(--button-background-color-hover)}ul.list a span,ul.list button span{display:block;font-size:16px;font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}header{position:relative;display:grid;grid-template-columns:44px 1fr;gap:8px;padding-left:8px;border-bottom:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}header>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-home header>div{margin-right:56px}header h2{margin:7px 0 0;font-size:18px;font-weight:500;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p{margin:2px 0 0;font-size:12px;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button{display:block;margin:0;padding:0;width:100%;font-size:12px;font-weight:300;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button:hover{text-decoration:underline;color:var(--primary-color)}.builder-logo{margin:12px 0 0 8px}#close{display:block;position:absolute;appearance:none;background:transparent;border:none;border-radius:50%;margin:0;padding:0;right:4px;top:8px;width:48px;height:48px;z-index:1;opacity:.7}#close:hover{opacity:1;background-color:var(--button-background-color-hover)}#close svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}.back-button{position:relative;display:block;margin:7px 0 0 -2px;width:48px;height:48px;background:transparent;border:none;appearance:none;border-radius:50%}.back-button:hover{background-color:var(--button-background-color-hover)}.back-button svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}footer{border-top:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}section.nav-cmp-list{grid-template-rows:64px auto 120px}footer a{text-decoration:underline;color:var(--primary-color)}footer a:hover{color:var(--primary-color);text-decoration:none}.nav-list{padding:2px 0}.nav-loading{pointer-events:none}.nav-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.nav-loading .nav-loading-icon{opacity:.5}.nav-list h4{margin:8px 8px 8px 10px;font-size:14px;font-weight:600}.nav-list .nav-list-item+h4{margin-top:30px}.nav-list-item{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;margin:2px 0;padding:8px 28px 8px 46px;width:100%;font-size:14px;font-weight:300;text-align:left;border:none;background:transparent;appearance:none}.nav-list-item:hover{background-color:var(--button-background-color-hover)}.nav-list-item-icon{position:absolute;top:4px;left:10px;width:24px;height:24px;object-fit:contain;filter:invert(100%);background-size:24px 24px;background-repeat:no-repeat;background-position:center center}.nav-list-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.nav-list-item:after{display:block;position:absolute;content:"";background-image:url('data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');background-repeat:no-repeat;background-position:12px 9px;top:0;right:0;width:32px;height:32px;pointer-events:none}.nav-list-item-note{opacity:0;font-size:12px;padding-top:1px;text-align:right}.nav-list-item:hover .nav-list-item-note{opacity:.5}.ui-select{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-select h3{margin:0;font-size:14px;font-weight:500}.ui-select p{margin:8px 0;font-size:12px;font-weight:300}.ui-select .select{position:relative;margin:8px 0;border-radius:4px;padding:0;line-height:1.1;overflow:hidden;border:1px solid var(--border-color)}.ui-select select{appearance:none;background-color:transparent;border:none;outline:none;padding:8px 32px 8px 8px;margin:0;width:100%;font-size:14px;cursor:pointer;text-overflow:ellipsis;opacity:.6;color:var(--text-color)}.ui-select .select:after{content:"";top:6px;right:5px;width:24px;height:24px;position:absolute;background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>');background-repeat:no-repeat;background-position:center;pointer-events:none;opacity:.6}.ui-select .select:hover{border-color:var(--primary-color-subdued)}.ui-text-input .select:focus-within{border-color:var(--primary-color)}.ui-text-input .select:focus-within select{opacity:1}.spinner:after{content:" ";display:block;width:32px;height:32px;margin:0 auto;pointer-events:auto;border-radius:50%;border:3px solid var(--text-color);border-color:var(--text-color) transparent var(--text-color) transparent;animation:spinner .75s linear infinite}@keyframes spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ui-switch{display:grid;grid-template-columns:auto 48px;grid-gap:20px;margin:8px 0 16px;padding:8px 0 8px 16px;cursor:pointer}.ui-switch>*{pointer-events:none}.ui-switch input{display:none;visibility:hidden}.ui-switch .switcher{display:inline-block;border-radius:100px;width:35px;height:14px;background-color:#ccc;position:relative;top:6px;vertical-align:middle;cursor:pointer}.ui-switch input[type=checkbox]:checked+.switcher{background-color:var(--primary-color-subdued)}.ui-switch .switcher:before{content:"";display:block;width:20px;height:20px;background-color:var(--text-color);box-shadow:0 1px 3px #0009;border-radius:50%;position:absolute;top:-3px;left:0;margin-right:0;transition:all .15s}.ui-switch input[type=checkbox]:checked+.switcher:before{left:100%;margin-left:-20px;background-color:var(--primary-color)}.ui-switch h3{margin:0;font-size:14px;font-weight:500}.ui-switch p{margin:4px 0 0;font-size:12px;font-weight:300}.ui-text-input{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-text-input h3{margin:0;font-size:14px;font-weight:500}.ui-text-input p{margin:8px 0;font-size:12px;font-weight:300}.ui-text-input .input{position:relative;margin:8px 0;border:1px solid var(--border-color);border-radius:4px;background:transparent;padding:2px;overflow:hidden}.ui-text-input input{display:block;width:235px;font-size:14px;border:none;background:transparent;padding:6px;appearance:none;color:var(--text-color);opacity:.6;outline:none}.ui-text-input .input:hover{border-color:var(--primary-color-subdued)}.ui-text-input .input:focus-within{border-color:var(--primary-color)}.ui-text-input .input:focus-within input{opacity:1}.ui-text-input .input:after{content:"";position:absolute;top:5px;right:14px;width:8px;height:17px;border:2px solid rgba(51,181,51,1);border-top:none;border-left:none;transform:rotate(45deg);opacity:0;transition:opacity 80ms ease-in-out;pointer-events:none}.ui-text-input.saved .input:after{opacity:1}.ui-toast{position:fixed;bottom:8px;left:8px;right:8px;padding:6px 12px;font-size:14px;border-radius:4px;transform:translate3d(0,150%,0);opacity:0;transition:all var(--transition-time) ease-in-out;background-color:var(--primary-color-subdued);color:var(--text-color);pointer-events:none}.ui-toast.ui-toast-show{transform:translateZ(0);opacity:1;pointer-events:auto}[data-view=nav-home] .nav-home .section-content,[data-view=nav-cmp-list] .nav-cmp-list .section-content,[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,[data-view=nav-cmp-input] .nav-cmp-input .section-content,[data-view=nav-settings] .nav-settings .section-content{transform:translateZ(0);pointer-events:auto}[data-view=nav-home] .nav-home header,[data-view=nav-home] .nav-home footer,[data-view=nav-cmp-list] .nav-cmp-list header,[data-view=nav-cmp-list] .nav-cmp-list footer,[data-view=nav-cmp-detail] .nav-cmp-detail header,[data-view=nav-cmp-detail] .nav-cmp-detail footer,[data-view=nav-cmp-input] .nav-cmp-input header,[data-view=nav-cmp-input] .nav-cmp-input footer,[data-view=nav-settings] .nav-settings header,[data-view=nav-settings] .nav-settings footer{opacity:1;pointer-events:auto}[data-view=nav-cmp-list] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-home .section-content,[data-view=nav-cmp-input] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-cmp-detail .section-content,[data-view=nav-settings] .nav-home .section-content{transform:translate3d(-105%,0,0)}.cmp-item .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');opacity:.3}.cmp-item.registered .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>');opacity:.8}.search-highlight{background-color:var(--primary-color-alpha);padding:0 2px;border-radius:2px;font-weight:500}.search-container{position:sticky;top:0;z-index:10;padding:12px 16px;background:var(--background-color);border-bottom:1px solid var(--border-color)}.search-input-wrapper{position:relative;display:flex;align-items:center}.search-icon{position:absolute;left:12px;color:var(--text-color-secondary);pointer-events:none}.component-search-input{width:100%;height:36px;padding:8px 36px;border:1px solid var(--border-color);border-radius:6px;background:var(--input-background);color:var(--text-color);font-size:14px;transition:border-color .2s,box-shadow .2s}.component-search-input:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color-alpha)}.component-search-input::placeholder{color:var(--text-color-tertiary)}.clear-search-button{position:absolute;right:8px;padding:4px;color:var(--text-color-secondary);border:none;background:transparent;border-radius:4px;cursor:pointer;opacity:0;transition:opacity .2s,background-color .2s;display:flex;align-items:center;justify-content:center}.clear-search-button:hover{background-color:var(--hover-color)}.component-search-input:not(:placeholder-shown)+.clear-search-button{opacity:1}.no-results{padding:32px 16px;text-align:center;color:var(--text-color-secondary);font-size:14px}#cmp-detail{position:relative}.cmp-loading{pointer-events:none!important}.cmp-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.cmp-loading .cmp-loading-icon{opacity:.5}.cmp-cover{position:absolute;top:160px;left:0;width:100%;height:100vh;background:var(--background-color);transform:translateZ(0);pointer-events:none;display:none}[data-view=nav-cmp-detail] .cmp-cover{display:block;pointer-events:auto}.cmp-enabled .cmp-cover{transform:translate3d(0,105%,0);pointer-events:none}.section-ready .cmp-cover{transition:all var(--transition-time) ease-in-out}.cmp-detail-inputs-container{margin:8px 0 16px;padding:0}.cmp-detail-inputs-container h3{margin:0 0 6px;padding-left:16px;padding-right:8px;font-size:14px;font-weight:500;display:flex;justify-content:space-between;align-items:center}.cmp-detail-inputs-reload{font-weight:300;font-size:.9em;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmp-detail-inputs-reload:hover{text-decoration:underline;color:var(--primary-color)}.cmp-detail-inputs-container .cmp-inputs-empty{padding:0;margin-top:12px;font-size:12px;font-weight:300;opacity:.5;font-style:italic}.cmp-detail-inputs-container .nav-list-item-icon{opacity:.8;background-size:20px 20px;background-position:4px center}.input-icon{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>')}.input-icon-array{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>')}.input-icon-boolean{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>')}.input-icon-number{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>')}.input-icon-object{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>')}.input-icon-string{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>')}.cmp-input-item-unregistered{opacity:.4}.cmp-input-item-unregistered .input-icon:after{content:"";position:absolute;top:11px;left:4px;width:20px;height:2px;background-color:#000;transform:rotate(-45deg)}.cmp-prop-info{border-bottom:1px solid var(--border-color)}.cmp-input-readonly{margin:16px 0;padding:0 16px;display:grid;grid-template-columns:50% 50%;gap:12px}.cmp-input-readonly h3{margin:0;font-size:14px;font-weight:500}.cmp-input-readonly span{margin-top:2px;font-size:12px;font-weight:300;opacity:.8}.cmp-input-detail{margin:16px 0}.cmp-input-detail a{color:var(--primary-color);text-decoration:none}.cmp-input-detail a:hover{text-decoration:underline}.input-cover{position:absolute;top:175px;left:0;width:100%;height:100%;background:var(--background-color);transform:translateZ(0);transition:all var(--transition-time) ease-in-out;pointer-events:auto}.input-enabled .input-cover{transform:translate3d(0,105%,0);pointer-events:none}.input-loading-icon{position:absolute;display:inline-block;top:190px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.input-loading .input-loading-icon{opacity:.5}:host{position:fixed;inset:0;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}aside{position:absolute;top:0;right:0;width:var(--menu-width);height:100%;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;background:var(--background-color);box-shadow:#000000c9 5px 0 20px;overflow:hidden;z-index:1}:host(.show-builder-menu) aside{pointer-events:auto;transform:translateZ(0)}#hit{position:absolute;inset:0;display:none}:host(.show-builder-menu) #hit{display:block;pointer-events:auto}#version{position:absolute;bottom:6px;right:6px;font-size:8px;color:#9b9b9b}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder's selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder's Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder's Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>\`,Nr(e),Br(e),Ur(e),Ar(e),Dr(e),Fr(e),this.setAttribute("aria-hidden","true"),e.getElementById("version").textContent="v1.5.4"}highlightOpener(){let e=this.shadowRoot.querySelector(".menu-toggle");e.classList.add("menu-toggle-highlight"),e.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight")},20)},20)}};var ki=\`<style>*,*:before,*:after{box-sizing:border-box}html,body,:host{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:2147483646;margin:0;padding:0;line-height:1.8;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#252525;color:#fff;transition:opacity .25s ease-in-out}:host([aria-hidden="true"]){opacity:0;pointer-events:none}main{position:absolute;top:0;left:0;width:100%;height:100vh}h1{margin-top:0;font-size:24px;font-weight:300;line-height:1.4}p{margin:20px 0;font-weight:300}button{cursor:pointer}aside{position:absolute;top:0;left:0;width:350px;height:100vh;padding:60px 0 0 50px;background-color:#121212}aside ul{margin:30px 0 0;padding:0;list-style:none}aside li{position:relative;margin:0;padding:20px 10px;font-weight:300}aside li.highlight{color:#48a1ff}aside li.active{font-weight:700}aside li .circle{position:absolute;top:20px;left:10px;width:24px;height:24px;border:3px solid white;border-radius:50%;font-size:14px}aside li.highlight .circle{border-color:#48a1ff}aside li.active .circle:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background-color:#48a1ff}aside li.completed .circle{background-color:#48a1ff}aside li.completed .circle:after{content:"";position:absolute;top:2px;left:6px;width:6px;height:13px;border:3px solid black;border-top:none;border-left:none;transform:rotate(45deg)}aside li .line{position:absolute;top:44px;left:21px;width:3px;height:45px;background-color:#fff}aside li.completed .line{background-color:#48a1ff}aside li span{display:block;margin-left:44px}nav{margin-top:30px}section{position:absolute;top:135px;left:350px;padding:0 80px 0 140px;transition:opacity .15s ease-in-out}section[aria-hidden=true]{pointer-events:none;opacity:0}section h1,section p{min-width:300px;max-width:600px}.button{position:relative;display:inline-block;color:#fff;background-color:#48a1ff;border-radius:4px;text-decoration:none;padding:10px 40px 10px 20px;white-space:nowrap}.button:hover{background-color:#48a1ffd9}#button-icon{position:absolute;top:1px;right:5px;bottom:0;width:30px;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>');background-repeat:no-repeat;background-position:center;background-size:24px 24px}.button[aria-disabled=true]{opacity:.9;background-color:#ffffff4d;pointer-events:none;padding-right:60px}.button[aria-disabled=true] #button-icon{top:21px;right:29px;width:8px;height:8px;border-radius:4px;background:#fff;color:#fff;animation:dot-flashing .5s infinite linear alternate;animation-delay:.25s}.button[aria-disabled=true] #button-icon:before,.button[aria-disabled=true] #button-icon:after{content:"";display:inline-block;position:absolute;top:0}.button[aria-disabled=true] #button-icon:before{left:-12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:0s}.button[aria-disabled=true] #button-icon:after{left:12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:.5s}@keyframes dot-flashing{0%{background-color:#fff}50%,to{background-color:#ffffff4d}}.logo{margin-left:9px;background:url('data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>');background-repeat:no-repeat;width:150px;height:32px}@media (max-width: 840px){aside{width:250px;padding:60px 0 0 20px}section{left:250px;padding:0 80px}}@media (max-width: 590px){aside{width:230px;padding:60px 0 0 10px}section{left:230px;padding:0 40px}}#modified-files-message a{color:#cbcbcb;font-weight:300;text-decoration:underline}#modified-files-message a:hover{color:#fff;text-decoration:none}#restart-warning{border-radius:4px;padding:8px 16px;border:1px solid #fd6b3c;background:#fd6b3c1a}#react-router-steps{margin:0 0 5px;padding:0 20px}#need-help{color:#48a1ff;text-decoration:none}#router-message{border-radius:4px;padding:16px;border:1px solid #48a1ff}#router-finish-button{margin-top:12px}#router-checkbox-div{display:flex;align-items:center}#router-checkbox{margin-right:10px;width:15px;height:15px}#success-title{display:flex;align-items:center;gap:10px}#success-title .check-icon{display:inline-block;width:24px;height:24px;border:2px solid #28a745;border-radius:50%;position:relative}#success-title .check-icon:before{content:"";position:absolute;top:50%;left:50%;width:6px;height:12px;border:solid #28a745;border-width:0 2px 2px 0;transform:translate(-50%,-60%) rotate(45deg)}
27
43
  </style>\`,dt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=ki+\`<main>
28
44
  <aside>
29
45
  <div class="logo"></div>
@@ -62,7 +78,7 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
62
78
  </nav>
63
79
  </section>
64
80
  </main>
65
- \`,Oi();let n=new URL(yn,Oe);n.searchParams.set(gn,location.href);let r=e.querySelectorAll(".next-step");for(let i of r)i.setAttribute("href",n.href);se("overview step viewed")}},Oi=()=>{let t=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");t?(t.href="https://cdn.builder.io/favicon.ico",t.removeAttribute("type")):(t=document.createElement("link"),t.rel="icon",t.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(t))};var Vr=async()=>{(await Tn()).isValid||Ui()},Ui=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",dt);let t=document.querySelector("builder-dev-tools-overview");t||(t=document.createElement("builder-dev-tools-overview"),t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),setTimeout(()=>{t.removeAttribute("aria-hidden")},32)};var Mi=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",Ue),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",lt);let t=document.querySelector("builder-dev-tools-menu");t||(t=document.createElement("builder-dev-tools-menu"),t.setAttribute("data-version","1.5.2"),document.body.appendChild(t));let e=document.querySelector("builder-dev-tools-edit");e||(e=document.createElement("builder-dev-tools-edit"),document.body.appendChild(e));let n=document.getElementById("builder-dev-tools-style");n||(n=document.createElement("style"),n.id="builder-dev-tools-style",n.innerHTML=".builder-no-scroll{overflow:hidden !important}",document.head.appendChild(n)),Vr(),Pr()}catch(t){console.error("Builder Devtools:",t)}};window.location===window.parent.location&&(console.debug("Builder.io Devtools v1.5.2"),Mi());})();`)}async function re(e){return ne(e,`<!DOCTYPE html>
81
+ \`,Oi();let n=new URL(yn,Oe);n.searchParams.set(gn,location.href);let r=e.querySelectorAll(".next-step");for(let i of r)i.setAttribute("href",n.href);se("overview step viewed")}},Oi=()=>{let t=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");t?(t.href="https://cdn.builder.io/favicon.ico",t.removeAttribute("type")):(t=document.createElement("link"),t.rel="icon",t.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(t))};var Vr=async()=>{(await Tn()).isValid||Ui()},Ui=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",dt);let t=document.querySelector("builder-dev-tools-overview");t||(t=document.createElement("builder-dev-tools-overview"),t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),setTimeout(()=>{t.removeAttribute("aria-hidden")},32)};var Mi=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",Ue),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",lt);let t=document.querySelector("builder-dev-tools-menu");t||(t=document.createElement("builder-dev-tools-menu"),t.setAttribute("data-version","1.5.4"),document.body.appendChild(t));let e=document.querySelector("builder-dev-tools-edit");e||(e=document.createElement("builder-dev-tools-edit"),document.body.appendChild(e));let n=document.getElementById("builder-dev-tools-style");n||(n=document.createElement("style"),n.id="builder-dev-tools-style",n.innerHTML=".builder-no-scroll{overflow:hidden !important}",document.head.appendChild(n)),Vr(),Pr()}catch(t){console.error("Builder Devtools:",t)}};window.location===window.parent.location&&(console.debug("Builder.io Devtools v1.5.4"),Mi());})();`)}async function Ho(e){return Qo(e,`<!DOCTYPE html>
66
82
  <html lang="en" dir="ltr">
67
83
  <head>
68
84
  <meta charset="utf-8" />
@@ -224,8 +240,1166 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
224
240
  </p>
225
241
  </section>
226
242
  </main>
227
- <script>"use strict";(()=>{var Ft=\`api-key\`;var Vt=\`p-key\`;var We=\`preview-url\`;var $e=\`user-id\`;var Bt="_b-uid";var qt=\`framework\`;var jt=\`platform\`;var Gt=\`node\`;var Kt="/~builder-dev-tools";var Qt=\`kind\`;var Wt="__DEV_TOOLS_URL__";var $t=(t,e,r)=>He({type:"connectBuilder",data:{publicApiKey:t,privateAuthKey:e,kind:r}});var Ht=()=>He({type:"validateBuilder"});var Yt=t=>He({type:"launchEditor",data:t});var He=async t=>{const e=new URL(Kt,Wt);let r;try{r=await fetch(e,{method:"POST",body:JSON.stringify(t)})}catch(i){console.error(\`Devtools Fetch Error, \${e.href}\`,i);throw new Error(\`Builder Devtools Fetch Error\`)}const n=r.headers.get("content-type")||"";if(n.includes("application/json")){const i=await r.json();if(r.ok){return i.data}if(Array.isArray(i.errors)&&i.errors.length>0){i.errors.forEach(o=>console.error(o));throw new Error(\`Builder Devtools Fetch Error: \${i.errors[0]}\`)}}throw new Error(\`Builder Devtools Fetch Error: \${r.status}, \${await r.text()}\`)};var Ye=function(t,e){Ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i))r[i]=n[i]};return Ye(t,e)};function V(t,e){if(typeof e!=="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ye(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var m=function(){m=Object.assign||function t(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o))e[o]=r[o]}return e};return m.apply(this,arguments)};function de(t,e){var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0)r[n]=t[n];if(t!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++){if(e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i]))r[n[i]]=t[n[i]]}return r}function f(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(c){try{s(n.next(c))}catch(d){a(d)}}function u(c){try{s(n["throw"](c))}catch(d){a(d)}}function s(c){c.done?o(c.value):i(c.value).then(l,u)}s((n=n.apply(t,e||[])).next())})}function p(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:l(0),"throw":l(1),"return":l(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(s){return function(c){return u([s,c])}}function u(s){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(n=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=e.call(t,r)}catch(c){s=[6,c];i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}}function G(t){var e=typeof Symbol==="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length==="number")return{next:function(){if(t&&n>=t.length)t=void 0;return{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(t,e){var r=typeof Symbol==="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{while((e===void 0||e-- >0)&&!(i=n.next()).done)o.push(i.value)}catch(l){a={error:l}}finally{try{if(i&&!i.done&&(r=n["return"]))r.call(n)}finally{if(a)throw a.error}}return o}function q(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++){if(o||!(n in e)){if(!o)o=Array.prototype.slice.call(e,0,n);o[n]=e[n]}}return t.concat(o||Array.prototype.slice.call(e))}var Xt="Event tracked successfully";var zt="Unexpected error occurred";var Zt="Event rejected due to exceeded retry count";var Jt="Event skipped due to optOut config";var er="Event rejected due to missing API key";var tr="Invalid API key";var rr="Client not initialized";var D;(function(t){t["SET"]="$set";t["SET_ONCE"]="$setOnce";t["ADD"]="$add";t["APPEND"]="$append";t["PREPEND"]="$prepend";t["REMOVE"]="$remove";t["PREINSERT"]="$preInsert";t["POSTINSERT"]="$postInsert";t["UNSET"]="$unset";t["CLEAR_ALL"]="$clearAll"})(D||(D={}));var W;(function(t){t["REVENUE_PRODUCT_ID"]="$productId";t["REVENUE_QUANTITY"]="$quantity";t["REVENUE_PRICE"]="$price";t["REVENUE_TYPE"]="$revenueType";t["REVENUE"]="$revenue"})(W||(W={}));var X;(function(t){t["IDENTIFY"]="$identify";t["GROUP_IDENTIFY"]="$groupidentify";t["REVENUE"]="revenue_amount"})(X||(X={}));var U;(function(t){t[t["None"]=0]="None";t[t["Error"]=1]="Error";t[t["Warn"]=2]="Warn";t[t["Verbose"]=3]="Verbose";t[t["Debug"]=4]="Debug"})(U||(U={}));var P;(function(t){t["Unknown"]="unknown";t["Skipped"]="skipped";t["Success"]="success";t["RateLimit"]="rate_limit";t["PayloadTooLarge"]="payload_too_large";t["Invalid"]="invalid";t["Failed"]="failed";t["Timeout"]="Timeout";t["SystemError"]="SystemError"})(P||(P={}));var Xe=null;var $=function(t,e,r){if(e===void 0){e=0}if(r===void 0){r=P.Unknown}return{event:t,code:e,message:r}};var K=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,K)};var nr=function(){function t(e){this.client=e;this.queue=[];this.applying=false;this.plugins=[]}t.prototype.register=function(e,r){var n,i,o;return f(this,void 0,void 0,function(){return p(this,function(a){switch(a.label){case 0:e.name=(n=e.name)!==null&&n!==void 0?n:K();e.type=(i=e.type)!==null&&i!==void 0?i:"enrichment";return[4,(o=e.setup)===null||o===void 0?void 0:o.call(e,r,this.client)];case 1:a.sent();this.plugins.push(e);return[2]}})})};t.prototype.deregister=function(e){var r;return f(this,void 0,void 0,function(){var n,i;return p(this,function(o){switch(o.label){case 0:n=this.plugins.findIndex(function(a){return a.name===e});i=this.plugins[n];this.plugins.splice(n,1);return[4,(r=i.teardown)===null||r===void 0?void 0:r.call(i)];case 1:o.sent();return[2]}})})};t.prototype.reset=function(e){this.applying=false;var r=this.plugins;r.map(function(n){var i;return(i=n.teardown)===null||i===void 0?void 0:i.call(n)});this.plugins=[];this.client=e};t.prototype.push=function(e){var r=this;return new Promise(function(n){r.queue.push([e,n]);r.scheduleApply(0)})};t.prototype.scheduleApply=function(e){var r=this;if(this.applying)return;this.applying=true;setTimeout(function(){void r.apply(r.queue.shift()).then(function(){r.applying=false;if(r.queue.length>0){r.scheduleApply(0)}})},e)};t.prototype.apply=function(e){return f(this,void 0,void 0,function(){var r,n,i,o,a,l,u,y,h,s,c,d,v,y,h,E,g,_;var S,I,O,F;return p(this,function(T){switch(T.label){case 0:if(!e){return[2]}r=x(e,1),n=r[0];i=x(e,2),o=i[1];a=this.plugins.filter(function(w){return w.type==="before"});T.label=1;case 1:T.trys.push([1,6,7,8]);l=G(a),u=l.next();T.label=2;case 2:if(!!u.done)return[3,5];y=u.value;if(!y.execute){return[3,4]}return[4,y.execute(m({},n))];case 3:h=T.sent();if(h===null){o({event:n,code:0,message:""});return[2]}else{n=h}T.label=4;case 4:u=l.next();return[3,2];case 5:return[3,8];case 6:s=T.sent();S={error:s};return[3,8];case 7:try{if(u&&!u.done&&(I=l.return))I.call(l)}finally{if(S)throw S.error}return[7];case 8:c=this.plugins.filter(function(w){return w.type==="enrichment"||w.type===void 0});T.label=9;case 9:T.trys.push([9,14,15,16]);d=G(c),v=d.next();T.label=10;case 10:if(!!v.done)return[3,13];y=v.value;if(!y.execute){return[3,12]}return[4,y.execute(m({},n))];case 11:h=T.sent();if(h===null){o({event:n,code:0,message:""});return[2]}else{n=h}T.label=12;case 12:v=d.next();return[3,10];case 13:return[3,16];case 14:E=T.sent();O={error:E};return[3,16];case 15:try{if(v&&!v.done&&(F=d.return))F.call(d)}finally{if(O)throw O.error}return[7];case 16:g=this.plugins.filter(function(w){return w.type==="destination"});_=g.map(function(w){var k=m({},n);return w.execute(k).catch(function(M){return $(k,0,String(M))})});void Promise.all(_).then(function(w){var k=x(w,1),M=k[0];var Q=M||$(n,100,"Event not tracked, no destination plugins on the instance");o(Q)});return[2]}})})};t.prototype.flush=function(){return f(this,void 0,void 0,function(){var e,r,n;var i=this;return p(this,function(o){switch(o.label){case 0:e=this.queue;this.queue=[];return[4,Promise.all(e.map(function(a){return i.apply(a)}))];case 1:o.sent();r=this.plugins.filter(function(a){return a.type==="destination"});n=r.map(function(a){return a.flush&&a.flush()});return[4,Promise.all(n)];case 2:o.sent();return[2]}})})};return t}();var ze="-";var re="AMP";var Ze="".concat(re,"_unsent");var Je="https://api2.amplitude.com/2/httpapi";var ir="https://api.eu.amplitude.com/2/httpapi";var or="https://api2.amplitude.com/batch";var ar="https://api.eu.amplitude.com/batch";var Xr=1e3;var be=function(t){if(Object.keys(t).length>Xr){return false}for(var e in t){var r=t[e];if(!et(e,r))return false}return true};var et=function(t,e){var r,n;if(typeof t!=="string")return false;if(Array.isArray(e)){var i=true;try{for(var o=G(e),a=o.next();!a.done;a=o.next()){var l=a.value;if(Array.isArray(l)){return false}else if(typeof l==="object"){i=i&&be(l)}else if(!["number","string"].includes(typeof l)){return false}if(!i){return false}}}catch(u){r={error:u}}finally{try{if(a&&!a.done&&(n=o.return))n.call(o)}finally{if(r)throw r.error}}}else if(e===null||e===void 0){return false}else if(typeof e==="object"){return be(e)}else if(!["number","string","boolean"].includes(typeof e)){return false}return true};var z=function(){function t(){this._propertySet=new Set;this._properties={}}t.prototype.getUserProperties=function(){return m({},this._properties)};t.prototype.set=function(e,r){this._safeSet(D.SET,e,r);return this};t.prototype.setOnce=function(e,r){this._safeSet(D.SET_ONCE,e,r);return this};t.prototype.append=function(e,r){this._safeSet(D.APPEND,e,r);return this};t.prototype.prepend=function(e,r){this._safeSet(D.PREPEND,e,r);return this};t.prototype.postInsert=function(e,r){this._safeSet(D.POSTINSERT,e,r);return this};t.prototype.preInsert=function(e,r){this._safeSet(D.PREINSERT,e,r);return this};t.prototype.remove=function(e,r){this._safeSet(D.REMOVE,e,r);return this};t.prototype.add=function(e,r){this._safeSet(D.ADD,e,r);return this};t.prototype.unset=function(e){this._safeSet(D.UNSET,e,ze);return this};t.prototype.clearAll=function(){this._properties={};this._properties[D.CLEAR_ALL]=ze;return this};t.prototype._safeSet=function(e,r,n){if(this._validate(e,r,n)){var i=this._properties[e];if(i===void 0){i={};this._properties[e]=i}i[r]=n;this._propertySet.add(r);return true}return false};t.prototype._validate=function(e,r,n){if(this._properties[D.CLEAR_ALL]!==void 0){return false}if(this._propertySet.has(r)){return false}if(e===D.ADD){return typeof n==="number"}if(e!==D.UNSET&&e!==D.REMOVE){return et(r,n)}return true};return t}();var sr=function(t,e,r){var n=typeof t==="string"?{event_type:t}:t;return m(m(m({},n),r),e&&{event_properties:e})};var fe=function(t,e){var r=m(m({},e),{event_type:X.IDENTIFY,user_properties:t.getUserProperties()});return r};var ur=function(t,e,r,n){var i;var o=m(m({},n),{event_type:X.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(i={},i[t]=e,i)});return o};var cr=function(t,e,r){var n;var i=new z;i.set(t,e);var o=m(m({},r),{event_type:X.IDENTIFY,user_properties:i.getUserProperties(),groups:(n={},n[t]=e,n)});return o};var lr=function(t,e){return m(m({},e),{event_type:X.REVENUE,event_properties:t.getEventProperties()})};var B=function(t){return{promise:t||Promise.resolve()}};var tt=function(){function t(e){if(e===void 0){e="$default"}this.initializing=false;this.q=[];this.dispatchQ=[];this.logEvent=this.track.bind(this);this.timeline=new nr(this);this.name=e}t.prototype._init=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){switch(r.label){case 0:this.config=e;this.timeline.reset(this);return[4,this.runQueuedFunctions("q")];case 1:r.sent();return[2]}})})};t.prototype.runQueuedFunctions=function(e){return f(this,void 0,void 0,function(){var r,n,i,o,a;var l,u;return p(this,function(s){switch(s.label){case 0:r=this[e];this[e]=[];s.label=1;case 1:s.trys.push([1,6,7,8]);n=G(r),i=n.next();s.label=2;case 2:if(!!i.done)return[3,5];o=i.value;return[4,o()];case 3:s.sent();s.label=4;case 4:i=n.next();return[3,2];case 5:return[3,8];case 6:a=s.sent();l={error:a};return[3,8];case 7:try{if(i&&!i.done&&(u=n.return))u.call(n)}finally{if(l)throw l.error}return[7];case 8:return[2]}})})};t.prototype.track=function(e,r,n){var i=sr(e,r,n);return B(this.dispatch(i))};t.prototype.identify=function(e,r){var n=fe(e,r);return B(this.dispatch(n))};t.prototype.groupIdentify=function(e,r,n,i){var o=ur(e,r,n,i);return B(this.dispatch(o))};t.prototype.setGroup=function(e,r,n){var i=cr(e,r,n);return B(this.dispatch(i))};t.prototype.revenue=function(e,r){var n=lr(e,r);return B(this.dispatch(n))};t.prototype.add=function(e){if(!this.config){this.q.push(this.add.bind(this,e));return B()}return B(this.timeline.register(e,this.config))};t.prototype.remove=function(e){if(!this.config){this.q.push(this.remove.bind(this,e));return B()}return B(this.timeline.deregister(e))};t.prototype.dispatchWithCallback=function(e,r){if(!this.config){return r($(e,0,rr))}void this.process(e).then(r)};t.prototype.dispatch=function(e){return f(this,void 0,void 0,function(){var r=this;return p(this,function(n){if(!this.config){return[2,new Promise(function(i){r.dispatchQ.push(r.dispatchWithCallback.bind(r,e,i))})]}return[2,this.process(e)]})})};t.prototype.process=function(e){return f(this,void 0,void 0,function(){var i,r,n,i;return p(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);if(this.config.optOut){return[2,$(e,0,Jt)]}return[4,this.timeline.push(e)];case 1:i=o.sent();i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message);return[2,i];case 2:r=o.sent();n=String(r);this.config.loggerProvider.error(n);i=$(e,0,n);return[2,i];case 3:return[2]}})})};t.prototype.setOptOut=function(e){if(!this.config){this.q.push(this.setOptOut.bind(this,Boolean(e)));return}this.config.optOut=Boolean(e)};t.prototype.flush=function(){return B(this.timeline.flush())};return t}();var rt=function(){function t(){this.productId="";this.quantity=1;this.price=0}t.prototype.setProductId=function(e){this.productId=e;return this};t.prototype.setQuantity=function(e){if(e>0){this.quantity=e}return this};t.prototype.setPrice=function(e){this.price=e;return this};t.prototype.setRevenueType=function(e){this.revenueType=e;return this};t.prototype.setRevenue=function(e){this.revenue=e;return this};t.prototype.setEventProperties=function(e){if(be(e)){this.properties=e}return this};t.prototype.getEventProperties=function(){var e=this.properties?m({},this.properties):{};e[W.REVENUE_PRODUCT_ID]=this.productId;e[W.REVENUE_QUANTITY]=this.quantity;e[W.REVENUE_PRICE]=this.price;e[W.REVENUE_TYPE]=this.revenueType;e[W.REVENUE]=this.revenue;return e};return t}();var dr=function(t,e){var r=Math.max(e,1);return t.reduce(function(n,i,o){var a=Math.floor(o/r);if(!n[a]){n[a]=[]}n[a].push(i);return n},[])};var Ie="Amplitude Logger ";var pe=function(){function t(){this.logLevel=U.None}t.prototype.disable=function(){this.logLevel=U.None};t.prototype.enable=function(e){if(e===void 0){e=U.Warn}this.logLevel=e};t.prototype.log=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}if(this.logLevel<U.Verbose){return}console.log("".concat(Ie,"[Log]: ").concat(e.join(" ")))};t.prototype.warn=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}if(this.logLevel<U.Warn){return}console.warn("".concat(Ie,"[Warn]: ").concat(e.join(" ")))};t.prototype.error=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}if(this.logLevel<U.Error){return}console.error("".concat(Ie,"[Error]: ").concat(e.join(" ")))};t.prototype.debug=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}if(this.logLevel<U.Debug){return}console.log("".concat(Ie,"[Debug]: ").concat(e.join(" ")))};return t}();var Se=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:U.Warn,loggerProvider:new pe,offline:false,optOut:false,serverUrl:Je,serverZone:"US",useBatch:false}};var nt=function(){function t(e){var r,n,i,o;this._optOut=false;var a=Se();this.apiKey=e.apiKey;this.flushIntervalMillis=(r=e.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis;this.flushMaxRetries=e.flushMaxRetries||a.flushMaxRetries;this.flushQueueSize=e.flushQueueSize||a.flushQueueSize;this.instanceName=e.instanceName||a.instanceName;this.loggerProvider=e.loggerProvider||a.loggerProvider;this.logLevel=(n=e.logLevel)!==null&&n!==void 0?n:a.logLevel;this.minIdLength=e.minIdLength;this.plan=e.plan;this.ingestionMetadata=e.ingestionMetadata;this.offline=e.offline!==void 0?e.offline:a.offline;this.optOut=(i=e.optOut)!==null&&i!==void 0?i:a.optOut;this.serverUrl=e.serverUrl;this.serverZone=e.serverZone||a.serverZone;this.storageProvider=e.storageProvider;this.transportProvider=e.transportProvider;this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:a.useBatch;this.loggerProvider.enable(this.logLevel);var l=it(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=l.serverZone;this.serverUrl=l.serverUrl}Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:false,configurable:true});return t}();var zr=function(t,e){if(t==="EU"){return e?ar:ir}return e?or:Je};var it=function(t,e,r){if(t===void 0){t=""}if(e===void 0){e=Se().serverZone}if(r===void 0){r=Se().useBatch}if(t){return{serverUrl:t,serverZone:void 0}}var n=["US","EU"].includes(e)?e:Se().serverZone;return{serverZone:n,serverUrl:zr(n,r)}};function Zr(t){if(t instanceof Error)return t.message;return String(t)}function Te(t){var e="";try{if("body"in t){e=JSON.stringify(t.body,null,2)}}catch(r){}return e}var ot=function(){function t(){this.name="amplitude";this.type="destination";this.retryTimeout=1e3;this.throttleTimeout=3e4;this.storageKey="";this.scheduled=null;this.queue=[]}t.prototype.setup=function(e){var r;return f(this,void 0,void 0,function(){var n;var i=this;return p(this,function(o){switch(o.label){case 0:this.config=e;this.storageKey="".concat(Ze,"_").concat(this.config.apiKey.substring(0,10));return[4,(r=this.config.storageProvider)===null||r===void 0?void 0:r.get(this.storageKey)];case 1:n=o.sent();this.saveEvents();if(n&&n.length>0){void Promise.all(n.map(function(a){return i.execute(a)})).catch()}return[2,Promise.resolve(void 0)]}})})};t.prototype.execute=function(e){var r=this;return new Promise(function(n){var i={event:e,attempts:0,callback:function(o){return n(o)},timeout:0};void r.addToQueue(i)})};t.prototype.addToQueue=function(){var e=this;var r=[];for(var n=0;n<arguments.length;n++){r[n]=arguments[n]}var i=r.filter(function(o){if(o.attempts<e.config.flushMaxRetries){o.attempts+=1;return true}void e.fulfillRequest([o],500,Zt);return false});i.forEach(function(o){e.queue=e.queue.concat(o);if(o.timeout===0){e.schedule(e.config.flushIntervalMillis);return}setTimeout(function(){o.timeout=0;e.schedule(0)},o.timeout)});this.saveEvents()};t.prototype.schedule=function(e){var r=this;if(this.scheduled||this.config.offline){return}this.scheduled=setTimeout(function(){void r.flush(true).then(function(){if(r.queue.length>0){r.schedule(e)}})},e)};t.prototype.flush=function(e){if(e===void 0){e=false}return f(this,void 0,void 0,function(){var r,n,i;var o=this;return p(this,function(a){switch(a.label){case 0:if(this.config.offline){this.config.loggerProvider.debug("Skipping flush while offline.");return[2]}r=[];n=[];this.queue.forEach(function(l){return l.timeout===0?r.push(l):n.push(l)});this.queue=n;if(this.scheduled){clearTimeout(this.scheduled);this.scheduled=null}i=dr(r,this.config.flushQueueSize);return[4,Promise.all(i.map(function(l){return o.send(l,e)}))];case 1:a.sent();return[2]}})})};t.prototype.send=function(e,r){if(r===void 0){r=true}return f(this,void 0,void 0,function(){var n,i,o,a,l;return p(this,function(u){switch(u.label){case 0:if(!this.config.apiKey){return[2,this.fulfillRequest(e,400,er)]}n={api_key:this.config.apiKey,events:e.map(function(s){var c=s.event,d=c.extra,v=de(c,["extra"]);return v}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString()};u.label=1;case 1:u.trys.push([1,3,,4]);i=it(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl;return[4,this.config.transportProvider.send(i,n)];case 2:o=u.sent();if(o===null){this.fulfillRequest(e,0,zt);return[2]}if(!r){if("body"in o){this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(Te(o)))}else{this.fulfillRequest(e,o.statusCode,o.status)}return[2]}this.handleResponse(o,e);return[3,4];case 3:a=u.sent();l=Zr(a);this.config.loggerProvider.error(l);this.fulfillRequest(e,0,l);return[3,4];case 4:return[2]}})})};t.prototype.handleResponse=function(e,r){var n=e.status;switch(n){case P.Success:{this.handleSuccessResponse(e,r);break}case P.Invalid:{this.handleInvalidResponse(e,r);break}case P.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,r);break}case P.RateLimit:{this.handleRateLimitResponse(e,r);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(n,"' provided for ").concat(r.length,' events"}'));this.handleOtherResponse(r);break}}};t.prototype.handleSuccessResponse=function(e,r){this.fulfillRequest(r,e.statusCode,Xt)};t.prototype.handleInvalidResponse=function(e,r){var n=this;if(e.body.missingField||e.body.error.startsWith(tr)){this.fulfillRequest(r,e.statusCode,e.body.error);return}var i=q(q(q(q([],x(Object.values(e.body.eventsWithInvalidFields)),false),x(Object.values(e.body.eventsWithMissingFields)),false),x(Object.values(e.body.eventsWithInvalidIdLengths)),false),x(e.body.silencedEvents),false).flat();var o=new Set(i);var a=r.filter(function(l,u){if(o.has(u)){n.fulfillRequest([l],e.statusCode,e.body.error);return}return true});if(a.length>0){this.config.loggerProvider.warn(Te(e))}this.addToQueue.apply(this,q([],x(a),false))};t.prototype.handlePayloadTooLargeResponse=function(e,r){if(r.length===1){this.fulfillRequest(r,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Te(e));this.config.flushQueueSize/=2;this.addToQueue.apply(this,q([],x(r),false))};t.prototype.handleRateLimitResponse=function(e,r){var n=this;var i=Object.keys(e.body.exceededDailyQuotaUsers);var o=Object.keys(e.body.exceededDailyQuotaDevices);var a=e.body.throttledEvents;var l=new Set(i);var u=new Set(o);var s=new Set(a);var c=r.filter(function(d,v){if(d.event.user_id&&l.has(d.event.user_id)||d.event.device_id&&u.has(d.event.device_id)){n.fulfillRequest([d],e.statusCode,e.body.error);return}if(s.has(v)){d.timeout=n.throttleTimeout}return true});if(c.length>0){this.config.loggerProvider.warn(Te(e))}this.addToQueue.apply(this,q([],x(c),false))};t.prototype.handleOtherResponse=function(e){var r=this;this.addToQueue.apply(this,q([],x(e.map(function(n){n.timeout=n.attempts*r.retryTimeout;return n})),false))};t.prototype.fulfillRequest=function(e,r,n){this.saveEvents();e.forEach(function(i){return i.callback($(i.event,r,n))})};t.prototype.saveEvents=function(){if(!this.config.storageProvider){return}var e=Array.from(this.queue.map(function(r){return r.event}));void this.config.storageProvider.set(this.storageKey,e)};return t}();var Jr=function(t){if(t===void 0){t=0}var e=new Error().stack||"";return e.split("\\n").slice(2+t).map(function(r){return r.trim()})};var R=function(t){return function(){var e=m({},t.config),r=e.loggerProvider,n=e.logLevel;return{logger:r,logLevel:n}}};var en=function(t,e){var r,n;e=e.replace(/\\[(\\w+)\\]/g,".$1");e=e.replace(/^\\./,"");try{for(var i=G(e.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(a in t){t=t[a]}else{return}}}catch(l){r={error:l}}finally{try{if(o&&!o.done&&(n=i.return))n.call(i)}finally{if(r)throw r.error}}return t};var A=function(t,e){return function(){var r,n;var i={};try{for(var o=G(e),a=o.next();!a.done;a=o.next()){var l=a.value;i[l]=en(t,l)}}catch(u){r={error:u}}finally{try{if(a&&!a.done&&(n=o.return))n.call(o)}finally{if(r)throw r.error}}return i}};var C=function(t,e,r,n,i){if(i===void 0){i=null}return function(){var o=[];for(var a=0;a<arguments.length;a++){o[a]=arguments[a]}var l=r(),u=l.logger,s=l.logLevel;if(s&&s<U.Debug||!s||!u){return t.apply(i,o)}var c={type:"invoke public method",name:e,args:o,stacktrace:Jr(1),time:{start:new Date().toISOString()},states:{}};if(n&&c.states){c.states.before=n()}var d=t.apply(i,o);if(d&&d.promise){d.promise.then(function(){if(n&&c.states){c.states.after=n()}if(c.time){c.time.end=new Date().toISOString()}u.debug(JSON.stringify(c,null,2))})}else{if(n&&c.states){c.states.after=n()}if(c.time){c.time.end=new Date().toISOString()}u.debug(JSON.stringify(c,null,2))}return d}};var we=function(){function t(){this.memoryStorage=new Map}t.prototype.isEnabled=function(){return f(this,void 0,void 0,function(){return p(this,function(e){return[2,true]})})};t.prototype.get=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){return[2,this.memoryStorage.get(e)]})})};t.prototype.getRaw=function(e){return f(this,void 0,void 0,function(){var r;return p(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:r=n.sent();return[2,r?JSON.stringify(r):void 0]}})})};t.prototype.set=function(e,r){return f(this,void 0,void 0,function(){return p(this,function(n){this.memoryStorage.set(e,r);return[2]})})};t.prototype.remove=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){this.memoryStorage.delete(e);return[2]})})};t.prototype.reset=function(){return f(this,void 0,void 0,function(){return p(this,function(e){this.memoryStorage.clear();return[2]})})};return t}();var ne=function(){function t(){}t.prototype.send=function(e,r){return Promise.resolve(null)};t.prototype.buildResponse=function(e){var r,n,i,o,a,l,u,s,c,d,v,y,h,E,g,_,S,I,O,F,T,w;if(typeof e!=="object"){return null}var k=e.code||0;var M=this.buildStatus(k);switch(M){case P.Success:return{status:M,statusCode:k,body:{eventsIngested:(r=e.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=e.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case P.Invalid:return{status:M,statusCode:k,body:{error:(o=e.error)!==null&&o!==void 0?o:"",missingField:(a=e.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(l=e.events_with_invalid_fields)!==null&&l!==void 0?l:{},eventsWithMissingFields:(u=e.events_with_missing_fields)!==null&&u!==void 0?u:{},eventsWithInvalidIdLengths:(s=e.events_with_invalid_id_lengths)!==null&&s!==void 0?s:{},epsThreshold:(c=e.eps_threshold)!==null&&c!==void 0?c:0,exceededDailyQuotaDevices:(d=e.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(v=e.silenced_devices)!==null&&v!==void 0?v:[],silencedEvents:(y=e.silenced_events)!==null&&y!==void 0?y:[],throttledDevices:(h=e.throttled_devices)!==null&&h!==void 0?h:{},throttledEvents:(E=e.throttled_events)!==null&&E!==void 0?E:[]}};case P.PayloadTooLarge:return{status:M,statusCode:k,body:{error:(g=e.error)!==null&&g!==void 0?g:""}};case P.RateLimit:return{status:M,statusCode:k,body:{error:(_=e.error)!==null&&_!==void 0?_:"",epsThreshold:(S=e.eps_threshold)!==null&&S!==void 0?S:0,throttledDevices:(I=e.throttled_devices)!==null&&I!==void 0?I:{},throttledUsers:(O=e.throttled_users)!==null&&O!==void 0?O:{},exceededDailyQuotaDevices:(F=e.exceeded_daily_quota_devices)!==null&&F!==void 0?F:{},exceededDailyQuotaUsers:(T=e.exceeded_daily_quota_users)!==null&&T!==void 0?T:{},throttledEvents:(w=e.throttled_events)!==null&&w!==void 0?w:[]}};case P.Timeout:default:return{status:M,statusCode:k}}};t.prototype.buildStatus=function(e){if(e>=200&&e<300){return P.Success}if(e===429){return P.RateLimit}if(e===413){return P.PayloadTooLarge}if(e===408){return P.Timeout}if(e>=400&&e<500){return P.Invalid}if(e>=500){return P.Failed}return P.Unknown};return t}();var N=function(){if(typeof globalThis!=="undefined"){return globalThis}if(typeof window!=="undefined"){return window}if(typeof self!=="undefined"){return self}if(typeof global!=="undefined"){return global}return void 0};var se=function(){var t;var e=N();if(!((t=e===null||e===void 0?void 0:e.location)===null||t===void 0?void 0:t.search)){return{}}var r=e.location.search.substring(1).split("&").filter(Boolean);var n=r.reduce(function(i,o){var a=o.split("=",2);var l=fr(a[0]);var u=fr(a[1]);if(!u){return i}i[l]=u;return i},{});return n};var fr=function(t){if(t===void 0){t=""}try{return decodeURIComponent(t)}catch(e){return""}};var pr="utm_campaign";var vr="utm_content";var hr="utm_id";var gr="utm_medium";var mr="utm_source";var yr="utm_term";var at="dclid";var st="fbclid";var ut="gbraid";var ct="gclid";var lt="ko_click_id";var dt="li_fat_id";var ft="msclkid";var pt="rtd_cid";var vt="ttclid";var ht="twclid";var gt="wbraid";var ie={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0};var ve=function(){function t(){}t.prototype.parse=function(){return f(this,void 0,void 0,function(){return p(this,function(e){return[2,m(m(m(m({},ie),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})};t.prototype.getUtmParam=function(){var e=se();var r=e[pr];var n=e[vr];var i=e[hr];var o=e[gr];var a=e[mr];var l=e[yr];return{utm_campaign:r,utm_content:n,utm_id:i,utm_medium:o,utm_source:a,utm_term:l}};t.prototype.getReferrer=function(){var e,r;var n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0;n.referring_domain=(r=(e=n.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&r!==void 0?r:void 0}catch(i){}return n};t.prototype.getClickIds=function(){var e;var r=se();return e={},e[at]=r[at],e[st]=r[st],e[ut]=r[ut],e[ct]=r[ct],e[lt]=r[lt],e[dt]=r[dt],e[ft]=r[ft],e[pt]=r[pt],e[vt]=r[vt],e[ht]=r[ht],e[gt]=r[gt],e};return t}();var xe=function(t,e,r){if(e===void 0){e=""}if(r===void 0){r=10}return[re,e,t.substring(0,r)].filter(Boolean).join("_")};var mt=function(t){return"".concat(re.toLowerCase(),"_").concat(t.substring(0,6))};var he=function(t,e){if(e===void 0){e=Date.now()}var r=Date.now();var n=r-e;return n>t};var ge=function(){function t(e){this.options=m({},e)}t.prototype.isEnabled=function(){return f(this,void 0,void 0,function(){var e,r,n,i;return p(this,function(o){switch(o.label){case 0:if(!N()){return[2,false]}t.testValue=String(Date.now());e=new t(this.options);r="AMP_TEST";o.label=1;case 1:o.trys.push([1,4,5,7]);return[4,e.set(r,t.testValue)];case 2:o.sent();return[4,e.get(r)];case 3:n=o.sent();return[2,n===t.testValue];case 4:i=o.sent();return[2,false];case 5:return[4,e.remove(r)];case 6:o.sent();return[7];case 7:return[2]}})})};t.prototype.get=function(e){return f(this,void 0,void 0,function(){var r;return p(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:r=n.sent();if(!r){return[2,void 0]}try{try{r=decodeURIComponent(atob(r))}catch(i){}return[2,JSON.parse(r)]}catch(i){return[2,void 0]}return[2]}})})};t.prototype.getRaw=function(e){var r,n;return f(this,void 0,void 0,function(){var i,o,a;return p(this,function(l){i=N();o=(n=(r=i===null||i===void 0?void 0:i.document)===null||r===void 0?void 0:r.cookie.split("; "))!==null&&n!==void 0?n:[];a=o.find(function(u){return u.indexOf(e+"=")===0});if(!a){return[2,void 0]}return[2,a.substring(e.length+1)]})})};t.prototype.set=function(e,r){var n;return f(this,void 0,void 0,function(){var i,o,a,l,u,s;return p(this,function(c){try{i=(n=this.options.expirationDays)!==null&&n!==void 0?n:0;o=r!==null?i:-1;a=void 0;if(o){l=new Date;l.setTime(l.getTime()+o*24*60*60*1e3);a=l}u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(r))));if(a){u+="; expires=".concat(a.toUTCString())}u+="; path=/";if(this.options.domain){u+="; domain=".concat(this.options.domain)}if(this.options.secure){u+="; Secure"}if(this.options.sameSite){u+="; SameSite=".concat(this.options.sameSite)}s=N();if(s){s.document.cookie=u}}catch(d){}return[2]})})};t.prototype.remove=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){switch(r.label){case 0:return[4,this.set(e,null)];case 1:r.sent();return[2]}})})};t.prototype.reset=function(){return f(this,void 0,void 0,function(){return p(this,function(e){return[2]})})};return t}();var yt=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.send=function(r,n){return f(this,void 0,void 0,function(){var i,o,a;return p(this,function(l){switch(l.label){case 0:if(typeof fetch==="undefined"){throw new Error("FetchTransport is not supported")}i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(n),method:"POST"};return[4,fetch(r,i)];case 1:o=l.sent();return[4,o.json()];case 2:a=l.sent();return[2,this.buildResponse(a)]}})})};return e}(ne);var tn=function(){function t(){}t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:rn(),platform:"Web",os:void 0,deviceModel:void 0}};return t}();var rn=function(){return typeof navigator!=="undefined"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""};var nn=function(){function t(){this.queue=[]}t.prototype.logEvent=function(e){if(!this.receiver){if(this.queue.length<512){this.queue.push(e)}}else{this.receiver(e)}};t.prototype.setEventReceiver=function(e){this.receiver=e;if(this.queue.length>0){this.queue.forEach(function(r){e(r)});this.queue=[]}};return t}();var Z=function(){Z=Object.assign||function t(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o))e[o]=r[o]}return e};return Z.apply(this,arguments)};var Pe=function(t,e){var r=["string","number","boolean","undefined"];var n=typeof t;var i=typeof e;if(n!==i){return false}for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l===n){return t===e}}if(t==null&&e==null){return true}else if(t==null||e==null){return false}if(t.length!==e.length){return false}var u=Array.isArray(t);var s=Array.isArray(e);if(u!==s){return false}if(u&&s){for(var c=0;c<t.length;c++){if(!Pe(t[c],e[c])){return false}}}else{var d=Object.keys(t).sort();var v=Object.keys(e).sort();if(!Pe(d,v)){return false}var y=true;Object.keys(t).forEach(function(h){if(!Pe(t[h],e[h])){y=false}});return y}return true};var on="$set";var an="$unset";var sn="$clearAll";if(!Object.entries){Object.entries=function(t){var e=Object.keys(t);var r=e.length;var n=new Array(r);while(r--){n[r]=[e[r],t[e[r]]]}return n}}var un=function(){function t(){this.identity={userProperties:{}};this.listeners=new Set}t.prototype.editIdentity=function(){var e=this;var r=Z({},this.identity.userProperties);var n=Z(Z({},this.identity),{userProperties:r});return{setUserId:function(i){n.userId=i;return this},setDeviceId:function(i){n.deviceId=i;return this},setUserProperties:function(i){n.userProperties=i;return this},setOptOut:function(i){n.optOut=i;return this},updateUserProperties:function(i){var o=n.userProperties||{};for(var a=0,l=Object.entries(i);a<l.length;a++){var u=l[a],s=u[0],c=u[1];switch(s){case on:for(var d=0,v=Object.entries(c);d<v.length;d++){var y=v[d],h=y[0],E=y[1];o[h]=E}break;case an:for(var g=0,_=Object.keys(c);g<_.length;g++){var h=_[g];delete o[h]}break;case sn:o={};break}}n.userProperties=o;return this},commit:function(){e.setIdentity(n);return this}}};t.prototype.getIdentity=function(){return Z({},this.identity)};t.prototype.setIdentity=function(e){var r=Z({},this.identity);this.identity=Z({},e);if(!Pe(r,this.identity)){this.listeners.forEach(function(n){n(e)})}};t.prototype.addIdentityListener=function(e){this.listeners.add(e)};t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)};return t}();var me=typeof globalThis!=="undefined"?globalThis:typeof global!=="undefined"?global:self;var _r=function(){function t(){this.identityStore=new un;this.eventBridge=new nn;this.applicationContextProvider=new tn}t.getInstance=function(e){if(!me["analyticsConnectorInstances"]){me["analyticsConnectorInstances"]={}}if(!me["analyticsConnectorInstances"][e]){me["analyticsConnectorInstances"][e]=new t}return me["analyticsConnectorInstances"][e]};return t}();var J=function(t){if(t===void 0){t="$default_instance"}return _r.getInstance(t)};var _t=function(t,e){J(e).identityStore.editIdentity().setUserId(t).commit()};var Et=function(t,e){J(e).identityStore.editIdentity().setDeviceId(t).commit()};var bt=function(){function t(){this.name="identity";this.type="before";this.identityStore=J().identityStore}t.prototype.execute=function(e){return f(this,void 0,void 0,function(){var r;return p(this,function(n){r=e.user_properties;if(r){this.identityStore.editIdentity().updateUserProperties(r).commit()}return[2,e]})})};t.prototype.setup=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){if(e.instanceName){this.identityStore=J(e.instanceName).identityStore}return[2]})})};return t}();var It=function(){var t,e,r,n;if(typeof navigator==="undefined")return"";var i=navigator.userLanguage;return(n=(r=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&r!==void 0?r:i)!==null&&n!==void 0?n:""};var ye=function(t,e){if(typeof t==="boolean"){return t}if((t===null||t===void 0?void 0:t[e])===false){return false}return true};var Re=function(t){return ye(t,"attribution")};var St=function(t){return ye(t,"fileDownloads")};var Tt=function(t){return ye(t,"formInteractions")};var Ae=function(t){return ye(t,"pageViews")};var wt=function(t){return ye(t,"sessions")};var xt=function(t){var e=function(){return false};var r=void 0;var n;var i=t.pageCounter;var o=Ae(t.defaultTracking);if(o){e=void 0;n=void 0;if(t.defaultTracking&&typeof t.defaultTracking==="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews==="object"){if("trackOn"in t.defaultTracking.pageViews){e=t.defaultTracking.pageViews.trackOn}if("trackHistoryChanges"in t.defaultTracking.pageViews){r=t.defaultTracking.pageViews.trackHistoryChanges}if("eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType){n=t.defaultTracking.pageViews.eventType}}}return{trackOn:e,trackHistoryChanges:r,eventType:n,pageCounter:i}};var Pt=function(t){if(Re(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking==="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution==="object"){return m({},t.defaultTracking.attribution)}return{}};var Ce=function(t,e){for(var r=0;r<e.length;r++){var n=e[r],i=n.name,o=n.args,a=n.resolve;var l=t&&t[i];if(typeof l==="function"){var u=l.apply(t,o);if(typeof a==="function"){a(u===null||u===void 0?void 0:u.promise)}}}return t};var De=function(t){var e=t;return e&&e._q!==void 0};var Er="2.5.2";var cn="Web";var ln="$remote";var br=function(){function t(){this.name="@amplitude/plugin-context-browser";this.type="before";this.library="amplitude-ts/".concat(Er);if(typeof navigator!=="undefined"){this.userAgent=navigator.userAgent}}t.prototype.setup=function(e){this.config=e;return Promise.resolve(void 0)};t.prototype.execute=function(e){var r,n;return f(this,void 0,void 0,function(){var i,o,a,l;return p(this,function(u){i=new Date().getTime();o=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1;a=(n=e.event_id)!==null&&n!==void 0?n:o+1;this.config.lastEventId=a;if(!e.time){this.config.lastEventTime=i}l=m(m(m(m(m(m(m(m({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:cn}),this.config.trackingOptions.language&&{language:It()}),this.config.trackingOptions.ipAddress&&{ip:ln}),{insert_id:K(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:a,library:this.library,user_agent:this.userAgent});return[2,l]})})};return t}();var Le=function(){function t(e){this.storage=e}t.prototype.isEnabled=function(){return f(this,void 0,void 0,function(){var e,r,n,i,o;return p(this,function(a){switch(a.label){case 0:if(!this.storage){return[2,false]}e=String(Date.now());r=new t(this.storage);n="AMP_TEST";a.label=1;case 1:a.trys.push([1,4,5,7]);return[4,r.set(n,e)];case 2:a.sent();return[4,r.get(n)];case 3:i=a.sent();return[2,i===e];case 4:o=a.sent();return[2,false];case 5:return[4,r.remove(n)];case 6:a.sent();return[7];case 7:return[2]}})})};t.prototype.get=function(e){return f(this,void 0,void 0,function(){var r,n;return p(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,this.getRaw(e)];case 1:r=i.sent();if(!r){return[2,void 0]}return[2,JSON.parse(r)];case 2:n=i.sent();console.error("[Amplitude] Error: Could not get value from storage");return[2,void 0];case 3:return[2]}})})};t.prototype.getRaw=function(e){var r;return f(this,void 0,void 0,function(){return p(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(e))||void 0]})})};t.prototype.set=function(e,r){var n;return f(this,void 0,void 0,function(){return p(this,function(i){try{(n=this.storage)===null||n===void 0?void 0:n.setItem(e,JSON.stringify(r))}catch(o){}return[2]})})};t.prototype.remove=function(e){var r;return f(this,void 0,void 0,function(){return p(this,function(n){try{(r=this.storage)===null||r===void 0?void 0:r.removeItem(e)}catch(i){}return[2]})})};t.prototype.reset=function(){var e;return f(this,void 0,void 0,function(){return p(this,function(r){try{(e=this.storage)===null||e===void 0?void 0:e.clear()}catch(n){}return[2]})})};return t}();var Oe=1e3;var Rt=function(t){V(e,t);function e(r){var n=this;var i;n=t.call(this,(i=N())===null||i===void 0?void 0:i.localStorage)||this;n.loggerProvider=r===null||r===void 0?void 0:r.loggerProvider;return n}e.prototype.set=function(r,n){var i;return f(this,void 0,void 0,function(){var o;return p(this,function(a){switch(a.label){case 0:if(!(Array.isArray(n)&&n.length>Oe))return[3,2];o=n.length-Oe;return[4,t.prototype.set.call(this,r,n.slice(0,Oe))];case 1:a.sent();(i=this.loggerProvider)===null||i===void 0?void 0:i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(Oe,"."));return[3,4];case 2:return[4,t.prototype.set.call(this,r,n)];case 3:a.sent();a.label=4;case 4:return[2]}})})};return e}(Le);var Ir=function(t){V(e,t);function e(){var r;return t.call(this,(r=N())===null||r===void 0?void 0:r.sessionStorage)||this}return e}(Le);var Sr=function(t){V(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;r.state={done:4};return r}e.prototype.send=function(r,n){return f(this,void 0,void 0,function(){var i=this;return p(this,function(o){return[2,new Promise(function(a,l){if(typeof XMLHttpRequest==="undefined"){l(new Error("XHRTransport is not supported."))}var u=new XMLHttpRequest;u.open("POST",r,true);u.onreadystatechange=function(){if(u.readyState===i.state.done){try{var s=u.responseText;var c=JSON.parse(s);var d=i.buildResponse(c);a(d)}catch(v){l(v)}}};u.setRequestHeader("Content-Type","application/json");u.setRequestHeader("Accept","*/*");u.send(JSON.stringify(n))})]})})};return e}(ne);var Tr=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.send=function(r,n){return f(this,void 0,void 0,function(){var i=this;return p(this,function(o){return[2,new Promise(function(a,l){var u=N();if(!(u===null||u===void 0?void 0:u.navigator.sendBeacon)){throw new Error("SendBeaconTransport is not supported")}try{var s=JSON.stringify(n);var c=u.navigator.sendBeacon(r,JSON.stringify(n));if(c){return a(i.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}))}return a(i.buildResponse({code:500}))}catch(d){l(d)}})]})})};return e}(ne);var wr=function(t,e,r){if(r===void 0){r=true}return f(void 0,void 0,void 0,function(){var n,i,o,a,l,u,s,c,d;return p(this,function(v){switch(v.label){case 0:n=mt(t);return[4,e.getRaw(n)];case 1:i=v.sent();if(!i){return[2,{optOut:false}]}if(!r)return[3,3];return[4,e.remove(n)];case 2:v.sent();v.label=3;case 3:o=x(i.split("."),6),a=o[0],l=o[1],u=o[2],s=o[3],c=o[4],d=o[5];return[2,{deviceId:a,userId:dn(l),sessionId:At(s),lastEventId:At(d),lastEventTime:At(c),optOut:Boolean(u)}]}})})};var At=function(t){var e=parseInt(t,32);if(isNaN(e)){return void 0}return e};var dn=function(t){if(!atob||!escape||!t){return void 0}try{return decodeURIComponent(escape(atob(t)))}catch(e){return void 0}};var j="[Amplitude]";var pa="".concat(j," Page Viewed");var Ct="".concat(j," Form Started");var xr="".concat(j," Form Submitted");var Pr="".concat(j," File Downloaded");var Dt="session_start";var Lt="session_end";var Rr="".concat(j," File Extension");var Ar="".concat(j," File Name");var Cr="".concat(j," Link ID");var Dr="".concat(j," Link Text");var Lr="".concat(j," Link URL");var ke="".concat(j," Form ID");var Ue="".concat(j," Form Name");var Ne="".concat(j," Form Destination");var _e="cookie";var Or="US";var fn=function(t){V(e,t);function e(r,n,i,o,a,l,u,s,c,d,v,y,h,E,g,_,S,I,O,F,T,w,k,M,Q,H,ee,Y,te,ce,le){if(i===void 0){i=new we}if(o===void 0){o={domain:"",expiration:365,sameSite:"Lax",secure:false,upgrade:true}}if(u===void 0){u=1e3}if(s===void 0){s=5}if(c===void 0){c=30}if(d===void 0){d=_e}if(g===void 0){g=new pe}if(_===void 0){_=U.Warn}if(I===void 0){I=false}if(O===void 0){O=false}if(w===void 0){w=""}if(k===void 0){k=Or}if(Q===void 0){Q=30*60*1e3}if(H===void 0){H=new Rt({loggerProvider:g})}if(ee===void 0){ee={ipAddress:true,language:true,platform:true}}if(Y===void 0){Y="fetch"}if(te===void 0){te=false}var b=t.call(this,{apiKey:r,storageProvider:H,transportProvider:Ot(Y)})||this;b.apiKey=r;b.appVersion=n;b.cookieOptions=o;b.defaultTracking=a;b.flushIntervalMillis=u;b.flushMaxRetries=s;b.flushQueueSize=c;b.identityStorage=d;b.ingestionMetadata=v;b.instanceName=y;b.loggerProvider=g;b.logLevel=_;b.minIdLength=S;b.offline=I;b.partnerId=F;b.plan=T;b.serverUrl=w;b.serverZone=k;b.sessionTimeout=Q;b.storageProvider=H;b.trackingOptions=ee;b.transport=Y;b.useBatch=te;b._optOut=false;b._cookieStorage=i;b.deviceId=l;b.lastEventId=h;b.lastEventTime=E;b.optOut=O;b.sessionId=M;b.pageCounter=le;b.userId=ce;b.loggerProvider.enable(b.logLevel);return b}Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(r){if(this._cookieStorage!==r){this._cookieStorage=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(r){if(this._deviceId!==r){this._deviceId=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(r){if(this._userId!==r){this._userId=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(r){if(this._sessionId!==r){this._sessionId=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(r){if(this._optOut!==r){this._optOut=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(r){if(this._lastEventTime!==r){this._lastEventTime=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(r){if(this._lastEventId!==r){this._lastEventId=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){if(this._pageCounter!==r){this._pageCounter=r;this.updateStorage()}},enumerable:false,configurable:true});e.prototype.updateStorage=function(){var r={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter};void this.cookieStorage.set(xe(this.apiKey),r)};return e}(nt);var kr=function(t,e,r){if(e===void 0){e={}}return f(void 0,void 0,void 0,function(){var n,i,o,a,l,u,s,c,d,v,y,h,E,g,_,S;var I;var O,F,T,w,k,M,Q,H,ee,Y,te,ce,le,b,Me,Fe,Ve,Be,qe,je,Ge,Ke,Qe;return p(this,function(ae){switch(ae.label){case 0:n=e.identityStorage||_e;I={};if(!(n!==_e))return[3,1];o="";return[3,5];case 1:if(!((F=(O=e.cookieOptions)===null||O===void 0?void 0:O.domain)!==null&&F!==void 0))return[3,2];a=F;return[3,4];case 2:return[4,vn()];case 3:a=ae.sent();ae.label=4;case 4:o=a;ae.label=5;case 5:i=m.apply(void 0,[(I.domain=o,I.expiration=365,I.sameSite="Lax",I.secure=false,I.upgrade=true,I),e.cookieOptions]);l=pn(e.identityStorage,i);return[4,wr(t,l,(w=(T=e.cookieOptions)===null||T===void 0?void 0:T.upgrade)!==null&&w!==void 0?w:true)];case 6:u=ae.sent();return[4,l.get(xe(t))];case 7:s=ae.sent();c=se();d=(H=(Q=(M=(k=e.deviceId)!==null&&k!==void 0?k:c.deviceId)!==null&&M!==void 0?M:s===null||s===void 0?void 0:s.deviceId)!==null&&Q!==void 0?Q:u.deviceId)!==null&&H!==void 0?H:K();v=(ee=s===null||s===void 0?void 0:s.lastEventId)!==null&&ee!==void 0?ee:u.lastEventId;y=(Y=s===null||s===void 0?void 0:s.lastEventTime)!==null&&Y!==void 0?Y:u.lastEventTime;h=(ce=(te=e.optOut)!==null&&te!==void 0?te:s===null||s===void 0?void 0:s.optOut)!==null&&ce!==void 0?ce:u.optOut;E=(le=s===null||s===void 0?void 0:s.sessionId)!==null&&le!==void 0?le:u.sessionId;g=(Me=(b=e.userId)!==null&&b!==void 0?b:s===null||s===void 0?void 0:s.userId)!==null&&Me!==void 0?Me:u.userId;r.previousSessionDeviceId=(Fe=s===null||s===void 0?void 0:s.deviceId)!==null&&Fe!==void 0?Fe:u.deviceId;r.previousSessionUserId=(Ve=s===null||s===void 0?void 0:s.userId)!==null&&Ve!==void 0?Ve:u.userId;_={ipAddress:(qe=(Be=e.trackingOptions)===null||Be===void 0?void 0:Be.ipAddress)!==null&&qe!==void 0?qe:true,language:(Ge=(je=e.trackingOptions)===null||je===void 0?void 0:je.language)!==null&&Ge!==void 0?Ge:true,platform:(Qe=(Ke=e.trackingOptions)===null||Ke===void 0?void 0:Ke.platform)!==null&&Qe!==void 0?Qe:true};S=s===null||s===void 0?void 0:s.pageCounter;return[2,new fn(t,e.appVersion,l,i,e.defaultTracking,d,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,n,e.ingestionMetadata,e.instanceName,v,y,e.loggerProvider,e.logLevel,e.minIdLength,e.offline,h,e.partnerId,e.plan,e.serverUrl,e.serverZone,E,e.sessionTimeout,e.storageProvider,_,e.transport,e.useBatch,g,S)]}})})};var pn=function(t,e){if(t===void 0){t=_e}if(e===void 0){e={}}switch(t){case"localStorage":return new Rt;case"sessionStorage":return new Ir;case"none":return new we;case"cookie":default:return new ge(m(m({},e),{expirationDays:e.expiration}))}};var Ot=function(t){if(t==="xhr"){return new Sr}if(t==="beacon"){return new Tr}return new yt};var vn=function(t){return f(void 0,void 0,void 0,function(){var e,r,n,i,o,o,a,l,u,s;return p(this,function(c){switch(c.label){case 0:return[4,new ge().isEnabled()];case 1:if(!c.sent()||!t&&typeof location==="undefined"){return[2,""]}e=t!==null&&t!==void 0?t:location.hostname;r=e.split(".");n=[];i="AMP_TLDTEST";for(o=r.length-2;o>=0;--o){n.push(r.slice(o).join("."))}o=0;c.label=2;case 2:if(!(o<n.length))return[3,7];a=n[o];l={domain:"."+a};u=new ge(l);return[4,u.set(i,1)];case 3:c.sent();return[4,u.get(i)];case 4:s=c.sent();if(!s)return[3,6];return[4,u.remove(i)];case 5:c.sent();return[2,"."+a];case 6:o++;return[3,2];case 7:return[2,""]}})})};var Nr=function(t,e,r){if(e===void 0){e=""}if(r===void 0){r=10}return[re,e,t.substring(0,r)].filter(Boolean).join("_")};var Ur=function(t){var e=t.split(".");if(e.length<=2){return t}return e.slice(e.length-2,e.length).join(".")};var hn=function(t){return Object.values(t).every(function(e){return!e})};var Mr=function(t,e,r,n){if(n===void 0){n=true}var i=t.referrer,o=t.referring_domain,a=de(t,["referrer","referring_domain"]);var l=e||{},u=l.referrer,s=l.referring_domain,c=de(l,["referrer","referring_domain"]);if(gn(r.excludeReferrers,t.referring_domain)){return false}if(!n&&hn(t)&&e){return false}var d=JSON.stringify(a)!==JSON.stringify(c);var v=Ur(o||"")!==Ur(s||"");return!e||d||v};var gn=function(t,e){if(t===void 0){t=[]}if(e===void 0){e=""}return t.some(function(r){return r instanceof RegExp?r.test(e):r===e})};var Fr=function(t,e){var r=m(m({},ie),t);var n=Object.entries(r).reduce(function(i,o){var a;var l=x(o,2),u=l[0],s=l[1];i.setOnce("initial_".concat(u),(a=s!==null&&s!==void 0?s:e.initialEmptyValue)!==null&&a!==void 0?a:"EMPTY");if(s){return i.set(u,s)}return i.unset(u)},new z);return fe(n)};var Vr=function(t){var e=t;if(e){if(e.startsWith(".")){e=e.substring(1)}return[new RegExp("".concat(e.replace(".","\\\\."),"$"))]}return[]};var kt=function(t){var e=this;if(t===void 0){t={}}var r={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(n,i){var o;return f(this,void 0,void 0,function(){var a,l,u,s,c,d,v,y;return p(this,function(h){switch(h.label){case 0:a=m({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:false,excludeReferrers:Vr((o=n.cookieOptions)===null||o===void 0?void 0:o.domain)},t);n.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser.");l=n.cookieStorage;u=Nr(n.apiKey,"MKTG");return[4,Promise.all([new ve().parse(),l.get(u)])];case 1:s=x.apply(void 0,[h.sent(),2]),c=s[0],d=s[1];v=he(n.sessionTimeout,n.lastEventTime);if(Mr(c,d,a,v)){if(a.resetSessionOnNewCampaign){i.setSessionId(Date.now());n.loggerProvider.log("Created a new session for new campaign.")}n.loggerProvider.log("Tracking attribution.");y=Fr(c,a);i.track(y);void l.set(u,c)}return[2]}})})},execute:function(n){return f(e,void 0,void 0,function(){return p(this,function(i){return[2,n]})})}};return r};var Br=function(t){var e={};for(var r in t){var n=t[r];if(n){e[r]=n}}return e};var Ut=function(t){if(t===void 0){t={}}var e;var r=N();var n=void 0;var i;var o;var a=function(){return f(void 0,void 0,void 0,function(){var v;var y;var h;return p(this,function(E){switch(E.label){case 0:o.pageCounter=!o.pageCounter?1:o.pageCounter+1;y={event_type:(h=t.eventType)!==null&&h!==void 0?h:"[Amplitude] Page Viewed"};v=[{}];return[4,mn()];case 1:return[2,(y.event_properties=m.apply(void 0,[m.apply(void 0,v.concat([E.sent()])),{"[Amplitude] Page Domain":typeof location!=="undefined"&&location.hostname||"","[Amplitude] Page Location":typeof location!=="undefined"&&location.href||"","[Amplitude] Page Path":typeof location!=="undefined"&&location.pathname||"","[Amplitude] Page Title":typeof document!=="undefined"&&document.title||"","[Amplitude] Page URL":typeof location!=="undefined"&&location.href.split("?")[0]||"","[Amplitude] Page Counter":o.pageCounter}]),y)]}})})};var l=function(){return typeof t.trackOn==="undefined"||typeof t.trackOn==="function"&&t.trackOn()};var u=typeof location!=="undefined"?location.href:null;var s=function(){return f(void 0,void 0,void 0,function(){var v,y,h,E,g;return p(this,function(_){switch(_.label){case 0:v=location.href;y=_n(t.trackHistoryChanges,v,u||"")&&l();u=v;if(!y)return[3,4];n===null||n===void 0?void 0:n.log("Tracking page view event");if(!(e===null||e===void 0))return[3,1];h=void 0;return[3,3];case 1:g=(E=e).track;return[4,a()];case 2:h=g.apply(E,[_.sent()]);_.label=3;case 3:h;_.label=4;case 4:return[2]}})})};var c=function(){void s()};var d={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(v,y){return f(void 0,void 0,void 0,function(){var h,E;return p(this,function(g){switch(g.label){case 0:e=y;o=v;n=v.loggerProvider;n.log("Installing @amplitude/plugin-page-view-tracking-browser");if(r){r.addEventListener("popstate",c);i=r.history.pushState;r.history.pushState=new Proxy(r.history.pushState,{apply:function(_,S,I){var O=x(I,3),F=O[0],T=O[1],w=O[2];_.apply(S,[F,T,w]);void s()}})}if(!l())return[3,2];n.log("Tracking page view event");E=(h=e).track;return[4,a()];case 1:E.apply(h,[g.sent()]);g.label=2;case 2:return[2]}})})},execute:function(v){return f(void 0,void 0,void 0,function(){var y;return p(this,function(h){switch(h.label){case 0:if(!(t.trackOn==="attribution"&&yn(v)))return[3,2];n===null||n===void 0?void 0:n.log("Enriching campaign event to page view event with campaign parameters");return[4,a()];case 1:y=h.sent();v.event_type=y.event_type;v.event_properties=m(m({},v.event_properties),y.event_properties);h.label=2;case 2:return[2,v]}})})},teardown:function(){return f(void 0,void 0,void 0,function(){return p(this,function(v){if(r){r.removeEventListener("popstate",c);if(i){r.history.pushState=i}}return[2]})})}};return d};var mn=function(){return f(void 0,void 0,void 0,function(){var t;return p(this,function(e){switch(e.label){case 0:t=Br;return[4,new ve().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})};var yn=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties;var r=e[D.SET]||{};var n=e[D.UNSET]||{};var i=q(q([],x(Object.keys(r)),false),x(Object.keys(n)),false);return Object.keys(ie).every(function(o){return i.includes(o)})}return false};var _n=function(t,e,r){switch(t){case"pathOnly":return e.split("?")[0]!==r.split("?")[0];default:return e!==r}};var qr=function(){var t;var e=[];var r=function(s,c,d){s.addEventListener(c,d);e.push({element:s,type:c,handler:d})};var n=function(){e.forEach(function(s){var c=s.element,d=s.type,v=s.handler;c===null||c===void 0?void 0:c.removeEventListener(d,v)});e=[]};var i="@amplitude/plugin-form-interaction-tracking-browser";var o="enrichment";var a=function(s,c){return f(void 0,void 0,void 0,function(){var d,v;return p(this,function(y){if(!c){s.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return[2]}if(typeof document==="undefined"){return[2]}d=function(h){var E=false;r(h,"change",function(){var g;if(!E){c.track(Ct,(g={},g[ke]=ue(h.id),g[Ue]=ue(h.name),g[Ne]=h.action,g))}E=true});r(h,"submit",function(){var g,_;if(!E){c.track(Ct,(g={},g[ke]=ue(h.id),g[Ue]=ue(h.name),g[Ne]=h.action,g))}c.track(xr,(_={},_[ke]=ue(h.id),_[Ue]=ue(h.name),_[Ne]=h.action,_));E=false})};v=Array.from(document.getElementsByTagName("form"));v.forEach(d);if(typeof MutationObserver!=="undefined"){t=new MutationObserver(function(h){h.forEach(function(E){E.addedNodes.forEach(function(g){if(g.nodeName==="FORM"){d(g)}if("querySelectorAll"in g&&typeof g.querySelectorAll==="function"){Array.from(g.querySelectorAll("form")).map(d)}})})});t.observe(document.body,{subtree:true,childList:true})}return[2]})})};var l=function(s){return f(void 0,void 0,void 0,function(){return p(this,function(c){return[2,s]})})};var u=function(){return f(void 0,void 0,void 0,function(){return p(this,function(s){t===null||t===void 0?void 0:t.disconnect();n();return[2]})})};return{name:i,type:o,setup:a,execute:l,teardown:u}};var ue=function(t){if(typeof t!=="string"){return void 0}return t};var jr=function(){var t;var e=[];var r=function(s,c,d){s.addEventListener(c,d);e.push({element:s,type:c,handler:d})};var n=function(){e.forEach(function(s){var c=s.element,d=s.type,v=s.handler;c===null||c===void 0?void 0:c.removeEventListener(d,v)});e=[]};var i="@amplitude/plugin-file-download-tracking-browser";var o="enrichment";var a=function(s,c){return f(void 0,void 0,void 0,function(){var d,v,y;return p(this,function(h){if(!c){s.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return[2]}if(typeof document==="undefined"){return[2]}d=function(E){var g;try{g=new URL(E.href,window.location.href)}catch(I){return}var _=v.exec(g.href);var S=_===null||_===void 0?void 0:_[1];if(S){r(E,"click",function(){var I;if(S){c.track(Pr,(I={},I[Rr]=S,I[Ar]=g.pathname,I[Cr]=E.id,I[Dr]=E.text,I[Lr]=E.href,I))}})}};v=/\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;y=Array.from(document.getElementsByTagName("a"));y.forEach(d);if(typeof MutationObserver!=="undefined"){t=new MutationObserver(function(E){E.forEach(function(g){g.addedNodes.forEach(function(_){if(_.nodeName==="A"){d(_)}if("querySelectorAll"in _&&typeof _.querySelectorAll==="function"){Array.from(_.querySelectorAll("a")).map(d)}})})});t.observe(document.body,{subtree:true,childList:true})}return[2]})})};var l=function(s){return f(void 0,void 0,void 0,function(){return p(this,function(c){return[2,s]})})};var u=function(){return f(void 0,void 0,void 0,function(){return p(this,function(s){t===null||t===void 0?void 0:t.disconnect();n();return[2]})})};return{name:i,type:o,setup:a,execute:l,teardown:u}};var Gr=false;var Kr=function(t){if(Gr||t.defaultTracking!==void 0){return}var e="\`options.defaultTracking\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \`options.defaultTracking\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\\n\\namplitude.init(<YOUR_API_KEY>, {\\n defaultTracking: true,\\n});\\n\\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.";t.loggerProvider.warn(e);Gr=true};var Qr=function(){var t="@amplitude/plugin-network-checker-browser";var e="before";var r=N();var n=[];var i=function(u,s){if(r){r.addEventListener(u,s);n.push({type:u,handler:s})}};var o=function(){n.forEach(function(u){var s=u.type,c=u.handler;if(r){r.removeEventListener(s,c)}});n=[]};var a=function(u,s){return f(void 0,void 0,void 0,function(){return p(this,function(c){u.offline=!navigator.onLine;i("online",function(){u.loggerProvider.debug("Network connectivity changed to online.");u.offline=false;setTimeout(function(){s.flush()},u.flushIntervalMillis)});i("offline",function(){u.loggerProvider.debug("Network connectivity changed to offline.");u.offline=true});return[2]})})};var l=function(){return f(void 0,void 0,void 0,function(){return p(this,function(u){o();return[2]})})};return{name:t,type:e,setup:a,teardown:l}};var Wr=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.init=function(r,n,i){if(r===void 0){r=""}var o;var a;if(arguments.length>2){o=n;a=i}else{if(typeof n==="string"){o=n;a=void 0}else{o=n===null||n===void 0?void 0:n.userId;a=n}}return B(this._init(m(m({},a),{userId:o,apiKey:r})))};e.prototype._init=function(r){var n,i;return f(this,void 0,void 0,function(){var o,a,l,u;var s=this;return p(this,function(c){switch(c.label){case 0:if(this.initializing){return[2]}this.initializing=true;return[4,kr(r.apiKey,r,this)];case 1:o=c.sent();return[4,t.prototype._init.call(this,o)];case 2:c.sent();this.setSessionId((i=(n=r.sessionId)!==null&&n!==void 0?n:this.config.sessionId)!==null&&i!==void 0?i:Date.now());a=J(r.instanceName);a.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId});if(!(this.config.offline!==Xe))return[3,4];return[4,this.add(Qr()).promise];case 3:c.sent();c.label=4;case 4:return[4,this.add(new ot).promise];case 5:c.sent();return[4,this.add(new br).promise];case 6:c.sent();return[4,this.add(new bt).promise];case 7:c.sent();Kr(this.config);if(!St(this.config.defaultTracking))return[3,9];return[4,this.add(jr()).promise];case 8:c.sent();c.label=9;case 9:if(!Tt(this.config.defaultTracking))return[3,11];return[4,this.add(qr()).promise];case 10:c.sent();c.label=11;case 11:if(!Re(this.config.defaultTracking))return[3,13];l=Pt(this.config);u=kt(l);return[4,this.add(u).promise];case 12:c.sent();c.label=13;case 13:if(!Ae(this.config.defaultTracking))return[3,15];return[4,this.add(Ut(xt(this.config))).promise];case 14:c.sent();c.label=15;case 15:this.initializing=false;return[4,this.runQueuedFunctions("dispatchQ")];case 16:c.sent();a.eventBridge.setEventReceiver(function(d){void s.track(d.eventType,d.eventProperties)});return[2]}})})};e.prototype.getUserId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.userId};e.prototype.setUserId=function(r){if(!this.config){this.q.push(this.setUserId.bind(this,r));return}if(r!==this.config.userId||r===void 0){this.config.userId=r;_t(r,this.config.instanceName)}};e.prototype.getDeviceId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.deviceId};e.prototype.setDeviceId=function(r){if(!this.config){this.q.push(this.setDeviceId.bind(this,r));return}this.config.deviceId=r;Et(r,this.config.instanceName)};e.prototype.reset=function(){this.setDeviceId(K());this.setUserId(void 0)};e.prototype.getSessionId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.sessionId};e.prototype.setSessionId=function(r){var n;if(!this.config){this.q.push(this.setSessionId.bind(this,r));return}if(r===this.config.sessionId){return}var i=this.getSessionId();var o=this.config.lastEventTime;var a=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1;this.config.sessionId=r;this.config.lastEventTime=void 0;this.config.pageCounter=0;if(wt(this.config.defaultTracking)){if(i&&o){this.track(Lt,void 0,{device_id:this.previousSessionDeviceId,event_id:++a,session_id:i,time:o+1,user_id:this.previousSessionUserId})}this.config.lastEventTime=this.config.sessionId;this.track(Dt,void 0,{event_id:++a,session_id:this.config.sessionId,time:this.config.lastEventTime})}this.previousSessionDeviceId=this.config.deviceId;this.previousSessionUserId=this.config.userId};e.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()};e.prototype.setTransport=function(r){if(!this.config){this.q.push(this.setTransport.bind(this,r));return}this.config.transportProvider=Ot(r)};e.prototype.identify=function(r,n){if(De(r)){var i=r._q;r._q=[];r=Ce(new z,i)}if(n===null||n===void 0?void 0:n.user_id){this.setUserId(n.user_id)}if(n===null||n===void 0?void 0:n.device_id){this.setDeviceId(n.device_id)}return t.prototype.identify.call(this,r,n)};e.prototype.groupIdentify=function(r,n,i,o){if(De(i)){var a=i._q;i._q=[];i=Ce(new z,a)}return t.prototype.groupIdentify.call(this,r,n,i,o)};e.prototype.revenue=function(r,n){if(De(r)){var i=r._q;r._q=[];r=Ce(new rt,i)}return t.prototype.revenue.call(this,r,n)};e.prototype.process=function(r){return f(this,void 0,void 0,function(){var n,i;return p(this,function(o){n=Date.now();i=he(this.config.sessionTimeout,this.config.lastEventTime);if(r.event_type!==Dt&&r.event_type!==Lt&&(!r.session_id||r.session_id===this.getSessionId())&&i){this.setSessionId(n)}return[2,t.prototype.process.call(this,r)]})})};return e}(tt);var En=function(){var t=new Wr;return{init:C(t.init.bind(t),"init",R(t),A(t,["config"])),add:C(t.add.bind(t),"add",R(t),A(t,["config.apiKey","timeline.plugins"])),remove:C(t.remove.bind(t),"remove",R(t),A(t,["config.apiKey","timeline.plugins"])),track:C(t.track.bind(t),"track",R(t),A(t,["config.apiKey","timeline.queue.length"])),logEvent:C(t.logEvent.bind(t),"logEvent",R(t),A(t,["config.apiKey","timeline.queue.length"])),identify:C(t.identify.bind(t),"identify",R(t),A(t,["config.apiKey","timeline.queue.length"])),groupIdentify:C(t.groupIdentify.bind(t),"groupIdentify",R(t),A(t,["config.apiKey","timeline.queue.length"])),setGroup:C(t.setGroup.bind(t),"setGroup",R(t),A(t,["config.apiKey","timeline.queue.length"])),revenue:C(t.revenue.bind(t),"revenue",R(t),A(t,["config.apiKey","timeline.queue.length"])),flush:C(t.flush.bind(t),"flush",R(t),A(t,["config.apiKey","timeline.queue.length"])),getUserId:C(t.getUserId.bind(t),"getUserId",R(t),A(t,["config","config.userId"])),setUserId:C(t.setUserId.bind(t),"setUserId",R(t),A(t,["config","config.userId"])),getDeviceId:C(t.getDeviceId.bind(t),"getDeviceId",R(t),A(t,["config","config.deviceId"])),setDeviceId:C(t.setDeviceId.bind(t),"setDeviceId",R(t),A(t,["config","config.deviceId"])),reset:C(t.reset.bind(t),"reset",R(t),A(t,["config","config.userId","config.deviceId"])),getSessionId:C(t.getSessionId.bind(t),"getSessionId",R(t),A(t,["config"])),setSessionId:C(t.setSessionId.bind(t),"setSessionId",R(t),A(t,["config"])),extendSession:C(t.extendSession.bind(t),"extendSession",R(t),A(t,["config"])),setOptOut:C(t.setOptOut.bind(t),"setOptOut",R(t),A(t,["config"])),setTransport:C(t.setTransport.bind(t),"setTransport",R(t),A(t,["config"]))}};var L=En();var bs=L.add;var Is=L.extendSession;var Ss=L.flush;var Ts=L.getDeviceId;var ws=L.getSessionId;var xs=L.getUserId;var Ps=L.groupIdentify;var Rs=L.identify;var As=L.init;var Cs=L.logEvent;var Ds=L.remove;var Ls=L.reset;var Os=L.revenue;var ks=L.setDeviceId;var Nt=L.setGroup;var Us=L.setOptOut;var Ns=L.setSessionId;var Ms=L.setTransport;var Fs=L.setUserId;var oe=L.track;var Mt=(t,e)=>{setTimeout(()=>{const r=Array.from(document.querySelectorAll("section"));for(const n of r){n.setAttribute("aria-hidden",String(n.id!==t))}},e)};var $r=t=>{Mt("success",500);if(t){Tn()}setTimeout(bn,500)};var bn=()=>{const t=document.getElementById("step-update-app");t.className="highlight completed";const e=document.getElementById("step-setup-complete");e.className="highlight active"};var Ee=(t=[])=>{Mt("error",500);const e=document.getElementById("error-messages");e.innerHTML="";for(const r of t){const n=document.createElement("li");n.textContent=r;e.appendChild(n)}document.title=\`Error Connecting\`};var Hr=()=>{Mt("restart-server",500);document.title=\`Restart Dev Server\`};var In=async()=>{const t=new URL(location.href);const e=t.searchParams.get(We);const r=t.searchParams.get(Ft);const n=t.searchParams.get(Vt);const i=t.searchParams.get($e);const o=t.searchParams.get(qt)||"unknown";const a=t.searchParams.get(jt);const l=t.searchParams.get(Gt);const u=t.searchParams.get(Qt)||null;try{console.info(\`framework: \${o}, platform: \${a}, node: \${l}\`);const s=new URL(location.pathname,location.origin);if(r){Nt("organization",r);Nt("space",r)}if(!e){window.history.replaceState({},"",s.href);Ee(["Missing preview url"]);oe("integration failed",{url:s.href,message:"missing preview url",framework:o});return}s.searchParams.set(We,e);s.searchParams.set($e,i);window.history.replaceState({},"",s.href);if(r&&n){let c=0;const d=async()=>{c++;try{const v=await $t(r,n,u);if(v.success){const y=Yr(e,v.pathname,i);oe("site integrated",{url:y,position:o});if(v.modifiedFiles.length>0){const h=document.getElementById("modified-files-list");v.modifiedFiles.forEach(g=>{const _=document.createElement("li");const S=document.createElement("a");S.textContent=g.displayFilePath||g.filePath;S.href=\`~launch#\${g.displayFilePath}\`;S.addEventListener("click",I=>{I.preventDefault();I.stopPropagation();Yt({filePath:g.filePath})});_.appendChild(S);h.appendChild(_)});const E=document.getElementById("modified-files-message");E.removeAttribute("hidden")}if(u!=="vcp"&&(v.platform.os==="win32"||o==="@remix-run/react")){const h=document.getElementById("restart-warning");h.removeAttribute("hidden")}else if(u!=="vcp"&&(o==="react"||o==="@angular/core")){const h=document.getElementById("router-message");h.removeAttribute("hidden");if(o==="@angular/core"){oe("angular framework",{});const I=document.getElementById("angular-message-section");I?.removeAttribute("hidden")}if(o==="react"){oe("react framework",{});const I=document.getElementById("react-message-section");I?.removeAttribute("hidden")}const E=document.getElementById("router-checkbox-div");const g=document.createElement("input");g.type="checkbox";g.id="router-checkbox";const _=document.createElement("label");_.htmlFor="router-checkbox";_.textContent=\`I've updated my router files\`;E.appendChild(g);E.appendChild(_);const S=document.getElementById("router-finish-button");g.addEventListener("change",function(){if(g.checked){S.removeAttribute("hidden")}else{S.setAttribute("hidden","true")}})}else{const h=document.getElementById("go-to-app");h.removeAttribute("hidden");if(u!=="vcp"){const E=h.querySelector("p");if(E){E.removeAttribute("hidden")}const g=h.querySelector("#button-text");if(g){g.textContent="Go to your app"}}}setTimeout(()=>{$r(true)},500)}else{oe("integration failed",{path:v.pathname,message:"error connecting to Builder.io",position:o});Ee([\`Error connecting to Builder.io\`])}}catch(v){const y=String(v.message||v);if(y.includes("Fetch Error")){if(c>3){Hr()}setTimeout(d,1e3)}else{Ee([y])}}};d()}else{const c=await Ht();if(c.isValid){Yr(e,c.pathname,i);const d=document.getElementById("go-to-app");d.removeAttribute("hidden");$r(false)}else{Ee([\`Error connecting to Builder.io\`])}}}catch(s){oe("integration failed",{message:"uncaught error",details:String(s),position:JSON.stringify({framework:o,platform:a,nodeVersion:l})});console.error("integrationFailed",s);const c=String(s);if(c.includes("Fetch Error")){Hr()}else{Ee([c])}}};var Yr=(t,e,r)=>{const n=new URL(e,t);if(r){n.hash=\`\${Bt}=\${r}\`}const i=document.querySelectorAll(".next-step");for(const o of i){o.setAttribute("href",n.href)}console.debug("App Url",n.href);return n.href};var Sn=()=>{return new Promise((t,e)=>{if(globalThis.confetti){return t(globalThis.confetti)}const r=document.createElement("script");r.src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.1/dist/confetti.browser.min.js";r.onload=()=>t(globalThis.confetti);r.onerror=e;document.head.appendChild(r);r.remove()})};var Tn=async()=>{const t={spread:360,ticks:50,gravity:0,decay:.95,startVelocity:30,colors:["19b4f4","a97ff2","fd6b3c","ffffff"]};const e=Sn();const r=async()=>{const n=document.getElementById("button-icon");const i=n.getBoundingClientRect();const o=window.scrollX+i.left;const a=window.scrollY+i.top;const l={x:o/window.innerWidth,y:a/window.innerHeight};const u=await e;u({...t,origin:l,scalar:1.2});u({...t,origin:l,scalar:.75})};setTimeout(r,500);setTimeout(r,650);setTimeout(r,800);setTimeout(r,950)};In();})();
243
+ <script>"use strict";(()=>{var Ft=\`api-key\`;var Vt=\`p-key\`;var We=\`preview-url\`;var $e=\`user-id\`;var Bt="_b-uid";var qt=\`framework\`;var jt=\`platform\`;var Gt=\`node\`;var Kt="/~builder-dev-tools";var Qt=\`kind\`;var Wt="__DEV_TOOLS_URL__";var $t=(t,e,r)=>He({type:"connectBuilder",data:{publicApiKey:t,privateAuthKey:e,kind:r}});var Ht=()=>He({type:"validateBuilder"});var Yt=t=>He({type:"launchEditor",data:t});var He=async t=>{const e=new URL(Kt,Wt);let r;try{r=await fetch(e,{method:"POST",body:JSON.stringify(t)})}catch(i){console.error(\`Devtools Fetch Error, \${e.href}\`,i);throw new Error(\`Builder Devtools Fetch Error\`)}const n=r.headers.get("content-type")||"";if(n.includes("application/json")){const i=await r.json();if(r.ok){return i.data}if(Array.isArray(i.errors)&&i.errors.length>0){i.errors.forEach(o=>console.error(o));throw new Error(\`Builder Devtools Fetch Error: \${i.errors[0]}\`)}}throw new Error(\`Builder Devtools Fetch Error: \${r.status}, \${await r.text()}\`)};var Ye=function(t,e){Ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i))r[i]=n[i]};return Ye(t,e)};function V(t,e){if(typeof e!=="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ye(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var m=function(){m=Object.assign||function t(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o))e[o]=r[o]}return e};return m.apply(this,arguments)};function de(t,e){var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0)r[n]=t[n];if(t!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++){if(e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i]))r[n[i]]=t[n[i]]}return r}function f(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(c){try{s(n.next(c))}catch(d){a(d)}}function u(c){try{s(n["throw"](c))}catch(d){a(d)}}function s(c){c.done?o(c.value):i(c.value).then(l,u)}s((n=n.apply(t,e||[])).next())})}function p(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:l(0),"throw":l(1),"return":l(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(s){return function(c){return u([s,c])}}function u(s){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(n=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=e.call(t,r)}catch(c){s=[6,c];i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}}function G(t){var e=typeof Symbol==="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length==="number")return{next:function(){if(t&&n>=t.length)t=void 0;return{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(t,e){var r=typeof Symbol==="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{while((e===void 0||e-- >0)&&!(i=n.next()).done)o.push(i.value)}catch(l){a={error:l}}finally{try{if(i&&!i.done&&(r=n["return"]))r.call(n)}finally{if(a)throw a.error}}return o}function q(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++){if(o||!(n in e)){if(!o)o=Array.prototype.slice.call(e,0,n);o[n]=e[n]}}return t.concat(o||Array.prototype.slice.call(e))}var Xt="Event tracked successfully";var zt="Unexpected error occurred";var Zt="Event rejected due to exceeded retry count";var Jt="Event skipped due to optOut config";var er="Event rejected due to missing API key";var tr="Invalid API key";var rr="Client not initialized";var D;(function(t){t["SET"]="$set";t["SET_ONCE"]="$setOnce";t["ADD"]="$add";t["APPEND"]="$append";t["PREPEND"]="$prepend";t["REMOVE"]="$remove";t["PREINSERT"]="$preInsert";t["POSTINSERT"]="$postInsert";t["UNSET"]="$unset";t["CLEAR_ALL"]="$clearAll"})(D||(D={}));var W;(function(t){t["REVENUE_PRODUCT_ID"]="$productId";t["REVENUE_QUANTITY"]="$quantity";t["REVENUE_PRICE"]="$price";t["REVENUE_TYPE"]="$revenueType";t["REVENUE"]="$revenue"})(W||(W={}));var X;(function(t){t["IDENTIFY"]="$identify";t["GROUP_IDENTIFY"]="$groupidentify";t["REVENUE"]="revenue_amount"})(X||(X={}));var U;(function(t){t[t["None"]=0]="None";t[t["Error"]=1]="Error";t[t["Warn"]=2]="Warn";t[t["Verbose"]=3]="Verbose";t[t["Debug"]=4]="Debug"})(U||(U={}));var P;(function(t){t["Unknown"]="unknown";t["Skipped"]="skipped";t["Success"]="success";t["RateLimit"]="rate_limit";t["PayloadTooLarge"]="payload_too_large";t["Invalid"]="invalid";t["Failed"]="failed";t["Timeout"]="Timeout";t["SystemError"]="SystemError"})(P||(P={}));var Xe=null;var $=function(t,e,r){if(e===void 0){e=0}if(r===void 0){r=P.Unknown}return{event:t,code:e,message:r}};var K=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,K)};var nr=function(){function t(e){this.client=e;this.queue=[];this.applying=false;this.plugins=[]}t.prototype.register=function(e,r){var n,i,o;return f(this,void 0,void 0,function(){return p(this,function(a){switch(a.label){case 0:e.name=(n=e.name)!==null&&n!==void 0?n:K();e.type=(i=e.type)!==null&&i!==void 0?i:"enrichment";return[4,(o=e.setup)===null||o===void 0?void 0:o.call(e,r,this.client)];case 1:a.sent();this.plugins.push(e);return[2]}})})};t.prototype.deregister=function(e){var r;return f(this,void 0,void 0,function(){var n,i;return p(this,function(o){switch(o.label){case 0:n=this.plugins.findIndex(function(a){return a.name===e});i=this.plugins[n];this.plugins.splice(n,1);return[4,(r=i.teardown)===null||r===void 0?void 0:r.call(i)];case 1:o.sent();return[2]}})})};t.prototype.reset=function(e){this.applying=false;var r=this.plugins;r.map(function(n){var i;return(i=n.teardown)===null||i===void 0?void 0:i.call(n)});this.plugins=[];this.client=e};t.prototype.push=function(e){var r=this;return new Promise(function(n){r.queue.push([e,n]);r.scheduleApply(0)})};t.prototype.scheduleApply=function(e){var r=this;if(this.applying)return;this.applying=true;setTimeout(function(){void r.apply(r.queue.shift()).then(function(){r.applying=false;if(r.queue.length>0){r.scheduleApply(0)}})},e)};t.prototype.apply=function(e){return f(this,void 0,void 0,function(){var r,n,i,o,a,l,u,y,h,s,c,d,v,y,h,E,g,_;var S,I,L,F;return p(this,function(T){switch(T.label){case 0:if(!e){return[2]}r=x(e,1),n=r[0];i=x(e,2),o=i[1];a=this.plugins.filter(function(w){return w.type==="before"});T.label=1;case 1:T.trys.push([1,6,7,8]);l=G(a),u=l.next();T.label=2;case 2:if(!!u.done)return[3,5];y=u.value;if(!y.execute){return[3,4]}return[4,y.execute(m({},n))];case 3:h=T.sent();if(h===null){o({event:n,code:0,message:""});return[2]}else{n=h}T.label=4;case 4:u=l.next();return[3,2];case 5:return[3,8];case 6:s=T.sent();S={error:s};return[3,8];case 7:try{if(u&&!u.done&&(I=l.return))I.call(l)}finally{if(S)throw S.error}return[7];case 8:c=this.plugins.filter(function(w){return w.type==="enrichment"||w.type===void 0});T.label=9;case 9:T.trys.push([9,14,15,16]);d=G(c),v=d.next();T.label=10;case 10:if(!!v.done)return[3,13];y=v.value;if(!y.execute){return[3,12]}return[4,y.execute(m({},n))];case 11:h=T.sent();if(h===null){o({event:n,code:0,message:""});return[2]}else{n=h}T.label=12;case 12:v=d.next();return[3,10];case 13:return[3,16];case 14:E=T.sent();L={error:E};return[3,16];case 15:try{if(v&&!v.done&&(F=d.return))F.call(d)}finally{if(L)throw L.error}return[7];case 16:g=this.plugins.filter(function(w){return w.type==="destination"});_=g.map(function(w){var k=m({},n);return w.execute(k).catch(function(M){return $(k,0,String(M))})});void Promise.all(_).then(function(w){var k=x(w,1),M=k[0];var Q=M||$(n,100,"Event not tracked, no destination plugins on the instance");o(Q)});return[2]}})})};t.prototype.flush=function(){return f(this,void 0,void 0,function(){var e,r,n;var i=this;return p(this,function(o){switch(o.label){case 0:e=this.queue;this.queue=[];return[4,Promise.all(e.map(function(a){return i.apply(a)}))];case 1:o.sent();r=this.plugins.filter(function(a){return a.type==="destination"});n=r.map(function(a){return a.flush&&a.flush()});return[4,Promise.all(n)];case 2:o.sent();return[2]}})})};return t}();var ze="-";var re="AMP";var Ze="".concat(re,"_unsent");var Je="https://api2.amplitude.com/2/httpapi";var ir="https://api.eu.amplitude.com/2/httpapi";var or="https://api2.amplitude.com/batch";var ar="https://api.eu.amplitude.com/batch";var Xr=1e3;var be=function(t){if(Object.keys(t).length>Xr){return false}for(var e in t){var r=t[e];if(!et(e,r))return false}return true};var et=function(t,e){var r,n;if(typeof t!=="string")return false;if(Array.isArray(e)){var i=true;try{for(var o=G(e),a=o.next();!a.done;a=o.next()){var l=a.value;if(Array.isArray(l)){return false}else if(typeof l==="object"){i=i&&be(l)}else if(!["number","string"].includes(typeof l)){return false}if(!i){return false}}}catch(u){r={error:u}}finally{try{if(a&&!a.done&&(n=o.return))n.call(o)}finally{if(r)throw r.error}}}else if(e===null||e===void 0){return false}else if(typeof e==="object"){return be(e)}else if(!["number","string","boolean"].includes(typeof e)){return false}return true};var z=function(){function t(){this._propertySet=new Set;this._properties={}}t.prototype.getUserProperties=function(){return m({},this._properties)};t.prototype.set=function(e,r){this._safeSet(D.SET,e,r);return this};t.prototype.setOnce=function(e,r){this._safeSet(D.SET_ONCE,e,r);return this};t.prototype.append=function(e,r){this._safeSet(D.APPEND,e,r);return this};t.prototype.prepend=function(e,r){this._safeSet(D.PREPEND,e,r);return this};t.prototype.postInsert=function(e,r){this._safeSet(D.POSTINSERT,e,r);return this};t.prototype.preInsert=function(e,r){this._safeSet(D.PREINSERT,e,r);return this};t.prototype.remove=function(e,r){this._safeSet(D.REMOVE,e,r);return this};t.prototype.add=function(e,r){this._safeSet(D.ADD,e,r);return this};t.prototype.unset=function(e){this._safeSet(D.UNSET,e,ze);return this};t.prototype.clearAll=function(){this._properties={};this._properties[D.CLEAR_ALL]=ze;return this};t.prototype._safeSet=function(e,r,n){if(this._validate(e,r,n)){var i=this._properties[e];if(i===void 0){i={};this._properties[e]=i}i[r]=n;this._propertySet.add(r);return true}return false};t.prototype._validate=function(e,r,n){if(this._properties[D.CLEAR_ALL]!==void 0){return false}if(this._propertySet.has(r)){return false}if(e===D.ADD){return typeof n==="number"}if(e!==D.UNSET&&e!==D.REMOVE){return et(r,n)}return true};return t}();var sr=function(t,e,r){var n=typeof t==="string"?{event_type:t}:t;return m(m(m({},n),r),e&&{event_properties:e})};var fe=function(t,e){var r=m(m({},e),{event_type:X.IDENTIFY,user_properties:t.getUserProperties()});return r};var ur=function(t,e,r,n){var i;var o=m(m({},n),{event_type:X.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(i={},i[t]=e,i)});return o};var cr=function(t,e,r){var n;var i=new z;i.set(t,e);var o=m(m({},r),{event_type:X.IDENTIFY,user_properties:i.getUserProperties(),groups:(n={},n[t]=e,n)});return o};var lr=function(t,e){return m(m({},e),{event_type:X.REVENUE,event_properties:t.getEventProperties()})};var B=function(t){return{promise:t||Promise.resolve()}};var tt=function(){function t(e){if(e===void 0){e="$default"}this.initializing=false;this.q=[];this.dispatchQ=[];this.logEvent=this.track.bind(this);this.timeline=new nr(this);this.name=e}t.prototype._init=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){switch(r.label){case 0:this.config=e;this.timeline.reset(this);return[4,this.runQueuedFunctions("q")];case 1:r.sent();return[2]}})})};t.prototype.runQueuedFunctions=function(e){return f(this,void 0,void 0,function(){var r,n,i,o,a;var l,u;return p(this,function(s){switch(s.label){case 0:r=this[e];this[e]=[];s.label=1;case 1:s.trys.push([1,6,7,8]);n=G(r),i=n.next();s.label=2;case 2:if(!!i.done)return[3,5];o=i.value;return[4,o()];case 3:s.sent();s.label=4;case 4:i=n.next();return[3,2];case 5:return[3,8];case 6:a=s.sent();l={error:a};return[3,8];case 7:try{if(i&&!i.done&&(u=n.return))u.call(n)}finally{if(l)throw l.error}return[7];case 8:return[2]}})})};t.prototype.track=function(e,r,n){var i=sr(e,r,n);return B(this.dispatch(i))};t.prototype.identify=function(e,r){var n=fe(e,r);return B(this.dispatch(n))};t.prototype.groupIdentify=function(e,r,n,i){var o=ur(e,r,n,i);return B(this.dispatch(o))};t.prototype.setGroup=function(e,r,n){var i=cr(e,r,n);return B(this.dispatch(i))};t.prototype.revenue=function(e,r){var n=lr(e,r);return B(this.dispatch(n))};t.prototype.add=function(e){if(!this.config){this.q.push(this.add.bind(this,e));return B()}return B(this.timeline.register(e,this.config))};t.prototype.remove=function(e){if(!this.config){this.q.push(this.remove.bind(this,e));return B()}return B(this.timeline.deregister(e))};t.prototype.dispatchWithCallback=function(e,r){if(!this.config){return r($(e,0,rr))}void this.process(e).then(r)};t.prototype.dispatch=function(e){return f(this,void 0,void 0,function(){var r=this;return p(this,function(n){if(!this.config){return[2,new Promise(function(i){r.dispatchQ.push(r.dispatchWithCallback.bind(r,e,i))})]}return[2,this.process(e)]})})};t.prototype.process=function(e){return f(this,void 0,void 0,function(){var i,r,n,i;return p(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);if(this.config.optOut){return[2,$(e,0,Jt)]}return[4,this.timeline.push(e)];case 1:i=o.sent();i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message);return[2,i];case 2:r=o.sent();n=String(r);this.config.loggerProvider.error(n);i=$(e,0,n);return[2,i];case 3:return[2]}})})};t.prototype.setOptOut=function(e){if(!this.config){this.q.push(this.setOptOut.bind(this,Boolean(e)));return}this.config.optOut=Boolean(e)};t.prototype.flush=function(){return B(this.timeline.flush())};return t}();var rt=function(){function t(){this.productId="";this.quantity=1;this.price=0}t.prototype.setProductId=function(e){this.productId=e;return this};t.prototype.setQuantity=function(e){if(e>0){this.quantity=e}return this};t.prototype.setPrice=function(e){this.price=e;return this};t.prototype.setRevenueType=function(e){this.revenueType=e;return this};t.prototype.setRevenue=function(e){this.revenue=e;return this};t.prototype.setEventProperties=function(e){if(be(e)){this.properties=e}return this};t.prototype.getEventProperties=function(){var e=this.properties?m({},this.properties):{};e[W.REVENUE_PRODUCT_ID]=this.productId;e[W.REVENUE_QUANTITY]=this.quantity;e[W.REVENUE_PRICE]=this.price;e[W.REVENUE_TYPE]=this.revenueType;e[W.REVENUE]=this.revenue;return e};return t}();var dr=function(t,e){var r=Math.max(e,1);return t.reduce(function(n,i,o){var a=Math.floor(o/r);if(!n[a]){n[a]=[]}n[a].push(i);return n},[])};var Ie="Amplitude Logger ";var pe=function(){function t(){this.logLevel=U.None}t.prototype.disable=function(){this.logLevel=U.None};t.prototype.enable=function(e){if(e===void 0){e=U.Warn}this.logLevel=e};t.prototype.log=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}if(this.logLevel<U.Verbose){return}console.log("".concat(Ie,"[Log]: ").concat(e.join(" ")))};t.prototype.warn=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}if(this.logLevel<U.Warn){return}console.warn("".concat(Ie,"[Warn]: ").concat(e.join(" ")))};t.prototype.error=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}if(this.logLevel<U.Error){return}console.error("".concat(Ie,"[Error]: ").concat(e.join(" ")))};t.prototype.debug=function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}if(this.logLevel<U.Debug){return}console.log("".concat(Ie,"[Debug]: ").concat(e.join(" ")))};return t}();var Se=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:U.Warn,loggerProvider:new pe,offline:false,optOut:false,serverUrl:Je,serverZone:"US",useBatch:false}};var nt=function(){function t(e){var r,n,i,o;this._optOut=false;var a=Se();this.apiKey=e.apiKey;this.flushIntervalMillis=(r=e.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis;this.flushMaxRetries=e.flushMaxRetries||a.flushMaxRetries;this.flushQueueSize=e.flushQueueSize||a.flushQueueSize;this.instanceName=e.instanceName||a.instanceName;this.loggerProvider=e.loggerProvider||a.loggerProvider;this.logLevel=(n=e.logLevel)!==null&&n!==void 0?n:a.logLevel;this.minIdLength=e.minIdLength;this.plan=e.plan;this.ingestionMetadata=e.ingestionMetadata;this.offline=e.offline!==void 0?e.offline:a.offline;this.optOut=(i=e.optOut)!==null&&i!==void 0?i:a.optOut;this.serverUrl=e.serverUrl;this.serverZone=e.serverZone||a.serverZone;this.storageProvider=e.storageProvider;this.transportProvider=e.transportProvider;this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:a.useBatch;this.loggerProvider.enable(this.logLevel);var l=it(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=l.serverZone;this.serverUrl=l.serverUrl}Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:false,configurable:true});return t}();var zr=function(t,e){if(t==="EU"){return e?ar:ir}return e?or:Je};var it=function(t,e,r){if(t===void 0){t=""}if(e===void 0){e=Se().serverZone}if(r===void 0){r=Se().useBatch}if(t){return{serverUrl:t,serverZone:void 0}}var n=["US","EU"].includes(e)?e:Se().serverZone;return{serverZone:n,serverUrl:zr(n,r)}};function Zr(t){if(t instanceof Error)return t.message;return String(t)}function Te(t){var e="";try{if("body"in t){e=JSON.stringify(t.body,null,2)}}catch(r){}return e}var ot=function(){function t(){this.name="amplitude";this.type="destination";this.retryTimeout=1e3;this.throttleTimeout=3e4;this.storageKey="";this.scheduled=null;this.queue=[]}t.prototype.setup=function(e){var r;return f(this,void 0,void 0,function(){var n;var i=this;return p(this,function(o){switch(o.label){case 0:this.config=e;this.storageKey="".concat(Ze,"_").concat(this.config.apiKey.substring(0,10));return[4,(r=this.config.storageProvider)===null||r===void 0?void 0:r.get(this.storageKey)];case 1:n=o.sent();this.saveEvents();if(n&&n.length>0){void Promise.all(n.map(function(a){return i.execute(a)})).catch()}return[2,Promise.resolve(void 0)]}})})};t.prototype.execute=function(e){var r=this;return new Promise(function(n){var i={event:e,attempts:0,callback:function(o){return n(o)},timeout:0};void r.addToQueue(i)})};t.prototype.addToQueue=function(){var e=this;var r=[];for(var n=0;n<arguments.length;n++){r[n]=arguments[n]}var i=r.filter(function(o){if(o.attempts<e.config.flushMaxRetries){o.attempts+=1;return true}void e.fulfillRequest([o],500,Zt);return false});i.forEach(function(o){e.queue=e.queue.concat(o);if(o.timeout===0){e.schedule(e.config.flushIntervalMillis);return}setTimeout(function(){o.timeout=0;e.schedule(0)},o.timeout)});this.saveEvents()};t.prototype.schedule=function(e){var r=this;if(this.scheduled||this.config.offline){return}this.scheduled=setTimeout(function(){void r.flush(true).then(function(){if(r.queue.length>0){r.schedule(e)}})},e)};t.prototype.flush=function(e){if(e===void 0){e=false}return f(this,void 0,void 0,function(){var r,n,i;var o=this;return p(this,function(a){switch(a.label){case 0:if(this.config.offline){this.config.loggerProvider.debug("Skipping flush while offline.");return[2]}r=[];n=[];this.queue.forEach(function(l){return l.timeout===0?r.push(l):n.push(l)});this.queue=n;if(this.scheduled){clearTimeout(this.scheduled);this.scheduled=null}i=dr(r,this.config.flushQueueSize);return[4,Promise.all(i.map(function(l){return o.send(l,e)}))];case 1:a.sent();return[2]}})})};t.prototype.send=function(e,r){if(r===void 0){r=true}return f(this,void 0,void 0,function(){var n,i,o,a,l;return p(this,function(u){switch(u.label){case 0:if(!this.config.apiKey){return[2,this.fulfillRequest(e,400,er)]}n={api_key:this.config.apiKey,events:e.map(function(s){var c=s.event,d=c.extra,v=de(c,["extra"]);return v}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString()};u.label=1;case 1:u.trys.push([1,3,,4]);i=it(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl;return[4,this.config.transportProvider.send(i,n)];case 2:o=u.sent();if(o===null){this.fulfillRequest(e,0,zt);return[2]}if(!r){if("body"in o){this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(Te(o)))}else{this.fulfillRequest(e,o.statusCode,o.status)}return[2]}this.handleResponse(o,e);return[3,4];case 3:a=u.sent();l=Zr(a);this.config.loggerProvider.error(l);this.fulfillRequest(e,0,l);return[3,4];case 4:return[2]}})})};t.prototype.handleResponse=function(e,r){var n=e.status;switch(n){case P.Success:{this.handleSuccessResponse(e,r);break}case P.Invalid:{this.handleInvalidResponse(e,r);break}case P.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,r);break}case P.RateLimit:{this.handleRateLimitResponse(e,r);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(n,"' provided for ").concat(r.length,' events"}'));this.handleOtherResponse(r);break}}};t.prototype.handleSuccessResponse=function(e,r){this.fulfillRequest(r,e.statusCode,Xt)};t.prototype.handleInvalidResponse=function(e,r){var n=this;if(e.body.missingField||e.body.error.startsWith(tr)){this.fulfillRequest(r,e.statusCode,e.body.error);return}var i=q(q(q(q([],x(Object.values(e.body.eventsWithInvalidFields)),false),x(Object.values(e.body.eventsWithMissingFields)),false),x(Object.values(e.body.eventsWithInvalidIdLengths)),false),x(e.body.silencedEvents),false).flat();var o=new Set(i);var a=r.filter(function(l,u){if(o.has(u)){n.fulfillRequest([l],e.statusCode,e.body.error);return}return true});if(a.length>0){this.config.loggerProvider.warn(Te(e))}this.addToQueue.apply(this,q([],x(a),false))};t.prototype.handlePayloadTooLargeResponse=function(e,r){if(r.length===1){this.fulfillRequest(r,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Te(e));this.config.flushQueueSize/=2;this.addToQueue.apply(this,q([],x(r),false))};t.prototype.handleRateLimitResponse=function(e,r){var n=this;var i=Object.keys(e.body.exceededDailyQuotaUsers);var o=Object.keys(e.body.exceededDailyQuotaDevices);var a=e.body.throttledEvents;var l=new Set(i);var u=new Set(o);var s=new Set(a);var c=r.filter(function(d,v){if(d.event.user_id&&l.has(d.event.user_id)||d.event.device_id&&u.has(d.event.device_id)){n.fulfillRequest([d],e.statusCode,e.body.error);return}if(s.has(v)){d.timeout=n.throttleTimeout}return true});if(c.length>0){this.config.loggerProvider.warn(Te(e))}this.addToQueue.apply(this,q([],x(c),false))};t.prototype.handleOtherResponse=function(e){var r=this;this.addToQueue.apply(this,q([],x(e.map(function(n){n.timeout=n.attempts*r.retryTimeout;return n})),false))};t.prototype.fulfillRequest=function(e,r,n){this.saveEvents();e.forEach(function(i){return i.callback($(i.event,r,n))})};t.prototype.saveEvents=function(){if(!this.config.storageProvider){return}var e=Array.from(this.queue.map(function(r){return r.event}));void this.config.storageProvider.set(this.storageKey,e)};return t}();var Jr=function(t){if(t===void 0){t=0}var e=new Error().stack||"";return e.split("\\n").slice(2+t).map(function(r){return r.trim()})};var A=function(t){return function(){var e=m({},t.config),r=e.loggerProvider,n=e.logLevel;return{logger:r,logLevel:n}}};var en=function(t,e){var r,n;e=e.replace(/\\[(\\w+)\\]/g,".$1");e=e.replace(/^\\./,"");try{for(var i=G(e.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(a in t){t=t[a]}else{return}}}catch(l){r={error:l}}finally{try{if(o&&!o.done&&(n=i.return))n.call(i)}finally{if(r)throw r.error}}return t};var R=function(t,e){return function(){var r,n;var i={};try{for(var o=G(e),a=o.next();!a.done;a=o.next()){var l=a.value;i[l]=en(t,l)}}catch(u){r={error:u}}finally{try{if(a&&!a.done&&(n=o.return))n.call(o)}finally{if(r)throw r.error}}return i}};var C=function(t,e,r,n,i){if(i===void 0){i=null}return function(){var o=[];for(var a=0;a<arguments.length;a++){o[a]=arguments[a]}var l=r(),u=l.logger,s=l.logLevel;if(s&&s<U.Debug||!s||!u){return t.apply(i,o)}var c={type:"invoke public method",name:e,args:o,stacktrace:Jr(1),time:{start:new Date().toISOString()},states:{}};if(n&&c.states){c.states.before=n()}var d=t.apply(i,o);if(d&&d.promise){d.promise.then(function(){if(n&&c.states){c.states.after=n()}if(c.time){c.time.end=new Date().toISOString()}u.debug(JSON.stringify(c,null,2))})}else{if(n&&c.states){c.states.after=n()}if(c.time){c.time.end=new Date().toISOString()}u.debug(JSON.stringify(c,null,2))}return d}};var we=function(){function t(){this.memoryStorage=new Map}t.prototype.isEnabled=function(){return f(this,void 0,void 0,function(){return p(this,function(e){return[2,true]})})};t.prototype.get=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){return[2,this.memoryStorage.get(e)]})})};t.prototype.getRaw=function(e){return f(this,void 0,void 0,function(){var r;return p(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:r=n.sent();return[2,r?JSON.stringify(r):void 0]}})})};t.prototype.set=function(e,r){return f(this,void 0,void 0,function(){return p(this,function(n){this.memoryStorage.set(e,r);return[2]})})};t.prototype.remove=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){this.memoryStorage.delete(e);return[2]})})};t.prototype.reset=function(){return f(this,void 0,void 0,function(){return p(this,function(e){this.memoryStorage.clear();return[2]})})};return t}();var ne=function(){function t(){}t.prototype.send=function(e,r){return Promise.resolve(null)};t.prototype.buildResponse=function(e){var r,n,i,o,a,l,u,s,c,d,v,y,h,E,g,_,S,I,L,F,T,w;if(typeof e!=="object"){return null}var k=e.code||0;var M=this.buildStatus(k);switch(M){case P.Success:return{status:M,statusCode:k,body:{eventsIngested:(r=e.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=e.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case P.Invalid:return{status:M,statusCode:k,body:{error:(o=e.error)!==null&&o!==void 0?o:"",missingField:(a=e.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(l=e.events_with_invalid_fields)!==null&&l!==void 0?l:{},eventsWithMissingFields:(u=e.events_with_missing_fields)!==null&&u!==void 0?u:{},eventsWithInvalidIdLengths:(s=e.events_with_invalid_id_lengths)!==null&&s!==void 0?s:{},epsThreshold:(c=e.eps_threshold)!==null&&c!==void 0?c:0,exceededDailyQuotaDevices:(d=e.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(v=e.silenced_devices)!==null&&v!==void 0?v:[],silencedEvents:(y=e.silenced_events)!==null&&y!==void 0?y:[],throttledDevices:(h=e.throttled_devices)!==null&&h!==void 0?h:{},throttledEvents:(E=e.throttled_events)!==null&&E!==void 0?E:[]}};case P.PayloadTooLarge:return{status:M,statusCode:k,body:{error:(g=e.error)!==null&&g!==void 0?g:""}};case P.RateLimit:return{status:M,statusCode:k,body:{error:(_=e.error)!==null&&_!==void 0?_:"",epsThreshold:(S=e.eps_threshold)!==null&&S!==void 0?S:0,throttledDevices:(I=e.throttled_devices)!==null&&I!==void 0?I:{},throttledUsers:(L=e.throttled_users)!==null&&L!==void 0?L:{},exceededDailyQuotaDevices:(F=e.exceeded_daily_quota_devices)!==null&&F!==void 0?F:{},exceededDailyQuotaUsers:(T=e.exceeded_daily_quota_users)!==null&&T!==void 0?T:{},throttledEvents:(w=e.throttled_events)!==null&&w!==void 0?w:[]}};case P.Timeout:default:return{status:M,statusCode:k}}};t.prototype.buildStatus=function(e){if(e>=200&&e<300){return P.Success}if(e===429){return P.RateLimit}if(e===413){return P.PayloadTooLarge}if(e===408){return P.Timeout}if(e>=400&&e<500){return P.Invalid}if(e>=500){return P.Failed}return P.Unknown};return t}();var N=function(){if(typeof globalThis!=="undefined"){return globalThis}if(typeof window!=="undefined"){return window}if(typeof self!=="undefined"){return self}if(typeof global!=="undefined"){return global}return void 0};var se=function(){var t;var e=N();if(!((t=e===null||e===void 0?void 0:e.location)===null||t===void 0?void 0:t.search)){return{}}var r=e.location.search.substring(1).split("&").filter(Boolean);var n=r.reduce(function(i,o){var a=o.split("=",2);var l=fr(a[0]);var u=fr(a[1]);if(!u){return i}i[l]=u;return i},{});return n};var fr=function(t){if(t===void 0){t=""}try{return decodeURIComponent(t)}catch(e){return""}};var pr="utm_campaign";var vr="utm_content";var hr="utm_id";var gr="utm_medium";var mr="utm_source";var yr="utm_term";var at="dclid";var st="fbclid";var ut="gbraid";var ct="gclid";var lt="ko_click_id";var dt="li_fat_id";var ft="msclkid";var pt="rtd_cid";var vt="ttclid";var ht="twclid";var gt="wbraid";var ie={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0};var ve=function(){function t(){}t.prototype.parse=function(){return f(this,void 0,void 0,function(){return p(this,function(e){return[2,m(m(m(m({},ie),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})};t.prototype.getUtmParam=function(){var e=se();var r=e[pr];var n=e[vr];var i=e[hr];var o=e[gr];var a=e[mr];var l=e[yr];return{utm_campaign:r,utm_content:n,utm_id:i,utm_medium:o,utm_source:a,utm_term:l}};t.prototype.getReferrer=function(){var e,r;var n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0;n.referring_domain=(r=(e=n.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&r!==void 0?r:void 0}catch(i){}return n};t.prototype.getClickIds=function(){var e;var r=se();return e={},e[at]=r[at],e[st]=r[st],e[ut]=r[ut],e[ct]=r[ct],e[lt]=r[lt],e[dt]=r[dt],e[ft]=r[ft],e[pt]=r[pt],e[vt]=r[vt],e[ht]=r[ht],e[gt]=r[gt],e};return t}();var xe=function(t,e,r){if(e===void 0){e=""}if(r===void 0){r=10}return[re,e,t.substring(0,r)].filter(Boolean).join("_")};var mt=function(t){return"".concat(re.toLowerCase(),"_").concat(t.substring(0,6))};var he=function(t,e){if(e===void 0){e=Date.now()}var r=Date.now();var n=r-e;return n>t};var ge=function(){function t(e){this.options=m({},e)}t.prototype.isEnabled=function(){return f(this,void 0,void 0,function(){var e,r,n,i;return p(this,function(o){switch(o.label){case 0:if(!N()){return[2,false]}t.testValue=String(Date.now());e=new t(this.options);r="AMP_TEST";o.label=1;case 1:o.trys.push([1,4,5,7]);return[4,e.set(r,t.testValue)];case 2:o.sent();return[4,e.get(r)];case 3:n=o.sent();return[2,n===t.testValue];case 4:i=o.sent();return[2,false];case 5:return[4,e.remove(r)];case 6:o.sent();return[7];case 7:return[2]}})})};t.prototype.get=function(e){return f(this,void 0,void 0,function(){var r;return p(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:r=n.sent();if(!r){return[2,void 0]}try{try{r=decodeURIComponent(atob(r))}catch(i){}return[2,JSON.parse(r)]}catch(i){return[2,void 0]}return[2]}})})};t.prototype.getRaw=function(e){var r,n;return f(this,void 0,void 0,function(){var i,o,a;return p(this,function(l){i=N();o=(n=(r=i===null||i===void 0?void 0:i.document)===null||r===void 0?void 0:r.cookie.split("; "))!==null&&n!==void 0?n:[];a=o.find(function(u){return u.indexOf(e+"=")===0});if(!a){return[2,void 0]}return[2,a.substring(e.length+1)]})})};t.prototype.set=function(e,r){var n;return f(this,void 0,void 0,function(){var i,o,a,l,u,s;return p(this,function(c){try{i=(n=this.options.expirationDays)!==null&&n!==void 0?n:0;o=r!==null?i:-1;a=void 0;if(o){l=new Date;l.setTime(l.getTime()+o*24*60*60*1e3);a=l}u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(r))));if(a){u+="; expires=".concat(a.toUTCString())}u+="; path=/";if(this.options.domain){u+="; domain=".concat(this.options.domain)}if(this.options.secure){u+="; Secure"}if(this.options.sameSite){u+="; SameSite=".concat(this.options.sameSite)}s=N();if(s){s.document.cookie=u}}catch(d){}return[2]})})};t.prototype.remove=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){switch(r.label){case 0:return[4,this.set(e,null)];case 1:r.sent();return[2]}})})};t.prototype.reset=function(){return f(this,void 0,void 0,function(){return p(this,function(e){return[2]})})};return t}();var yt=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.send=function(r,n){return f(this,void 0,void 0,function(){var i,o,a;return p(this,function(l){switch(l.label){case 0:if(typeof fetch==="undefined"){throw new Error("FetchTransport is not supported")}i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(n),method:"POST"};return[4,fetch(r,i)];case 1:o=l.sent();return[4,o.json()];case 2:a=l.sent();return[2,this.buildResponse(a)]}})})};return e}(ne);var tn=function(){function t(){}t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:rn(),platform:"Web",os:void 0,deviceModel:void 0}};return t}();var rn=function(){return typeof navigator!=="undefined"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""};var nn=function(){function t(){this.queue=[]}t.prototype.logEvent=function(e){if(!this.receiver){if(this.queue.length<512){this.queue.push(e)}}else{this.receiver(e)}};t.prototype.setEventReceiver=function(e){this.receiver=e;if(this.queue.length>0){this.queue.forEach(function(r){e(r)});this.queue=[]}};return t}();var Z=function(){Z=Object.assign||function t(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o))e[o]=r[o]}return e};return Z.apply(this,arguments)};var Pe=function(t,e){var r=["string","number","boolean","undefined"];var n=typeof t;var i=typeof e;if(n!==i){return false}for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l===n){return t===e}}if(t==null&&e==null){return true}else if(t==null||e==null){return false}if(t.length!==e.length){return false}var u=Array.isArray(t);var s=Array.isArray(e);if(u!==s){return false}if(u&&s){for(var c=0;c<t.length;c++){if(!Pe(t[c],e[c])){return false}}}else{var d=Object.keys(t).sort();var v=Object.keys(e).sort();if(!Pe(d,v)){return false}var y=true;Object.keys(t).forEach(function(h){if(!Pe(t[h],e[h])){y=false}});return y}return true};var on="$set";var an="$unset";var sn="$clearAll";if(!Object.entries){Object.entries=function(t){var e=Object.keys(t);var r=e.length;var n=new Array(r);while(r--){n[r]=[e[r],t[e[r]]]}return n}}var un=function(){function t(){this.identity={userProperties:{}};this.listeners=new Set}t.prototype.editIdentity=function(){var e=this;var r=Z({},this.identity.userProperties);var n=Z(Z({},this.identity),{userProperties:r});return{setUserId:function(i){n.userId=i;return this},setDeviceId:function(i){n.deviceId=i;return this},setUserProperties:function(i){n.userProperties=i;return this},setOptOut:function(i){n.optOut=i;return this},updateUserProperties:function(i){var o=n.userProperties||{};for(var a=0,l=Object.entries(i);a<l.length;a++){var u=l[a],s=u[0],c=u[1];switch(s){case on:for(var d=0,v=Object.entries(c);d<v.length;d++){var y=v[d],h=y[0],E=y[1];o[h]=E}break;case an:for(var g=0,_=Object.keys(c);g<_.length;g++){var h=_[g];delete o[h]}break;case sn:o={};break}}n.userProperties=o;return this},commit:function(){e.setIdentity(n);return this}}};t.prototype.getIdentity=function(){return Z({},this.identity)};t.prototype.setIdentity=function(e){var r=Z({},this.identity);this.identity=Z({},e);if(!Pe(r,this.identity)){this.listeners.forEach(function(n){n(e)})}};t.prototype.addIdentityListener=function(e){this.listeners.add(e)};t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)};return t}();var me=typeof globalThis!=="undefined"?globalThis:typeof global!=="undefined"?global:self;var _r=function(){function t(){this.identityStore=new un;this.eventBridge=new nn;this.applicationContextProvider=new tn}t.getInstance=function(e){if(!me["analyticsConnectorInstances"]){me["analyticsConnectorInstances"]={}}if(!me["analyticsConnectorInstances"][e]){me["analyticsConnectorInstances"][e]=new t}return me["analyticsConnectorInstances"][e]};return t}();var J=function(t){if(t===void 0){t="$default_instance"}return _r.getInstance(t)};var _t=function(t,e){J(e).identityStore.editIdentity().setUserId(t).commit()};var Et=function(t,e){J(e).identityStore.editIdentity().setDeviceId(t).commit()};var bt=function(){function t(){this.name="identity";this.type="before";this.identityStore=J().identityStore}t.prototype.execute=function(e){return f(this,void 0,void 0,function(){var r;return p(this,function(n){r=e.user_properties;if(r){this.identityStore.editIdentity().updateUserProperties(r).commit()}return[2,e]})})};t.prototype.setup=function(e){return f(this,void 0,void 0,function(){return p(this,function(r){if(e.instanceName){this.identityStore=J(e.instanceName).identityStore}return[2]})})};return t}();var It=function(){var t,e,r,n;if(typeof navigator==="undefined")return"";var i=navigator.userLanguage;return(n=(r=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&r!==void 0?r:i)!==null&&n!==void 0?n:""};var ye=function(t,e){if(typeof t==="boolean"){return t}if((t===null||t===void 0?void 0:t[e])===false){return false}return true};var Ae=function(t){return ye(t,"attribution")};var St=function(t){return ye(t,"fileDownloads")};var Tt=function(t){return ye(t,"formInteractions")};var Re=function(t){return ye(t,"pageViews")};var wt=function(t){return ye(t,"sessions")};var xt=function(t){var e=function(){return false};var r=void 0;var n;var i=t.pageCounter;var o=Re(t.defaultTracking);if(o){e=void 0;n=void 0;if(t.defaultTracking&&typeof t.defaultTracking==="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews==="object"){if("trackOn"in t.defaultTracking.pageViews){e=t.defaultTracking.pageViews.trackOn}if("trackHistoryChanges"in t.defaultTracking.pageViews){r=t.defaultTracking.pageViews.trackHistoryChanges}if("eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType){n=t.defaultTracking.pageViews.eventType}}}return{trackOn:e,trackHistoryChanges:r,eventType:n,pageCounter:i}};var Pt=function(t){if(Ae(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking==="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution==="object"){return m({},t.defaultTracking.attribution)}return{}};var Ce=function(t,e){for(var r=0;r<e.length;r++){var n=e[r],i=n.name,o=n.args,a=n.resolve;var l=t&&t[i];if(typeof l==="function"){var u=l.apply(t,o);if(typeof a==="function"){a(u===null||u===void 0?void 0:u.promise)}}}return t};var De=function(t){var e=t;return e&&e._q!==void 0};var Er="2.5.2";var cn="Web";var ln="$remote";var br=function(){function t(){this.name="@amplitude/plugin-context-browser";this.type="before";this.library="amplitude-ts/".concat(Er);if(typeof navigator!=="undefined"){this.userAgent=navigator.userAgent}}t.prototype.setup=function(e){this.config=e;return Promise.resolve(void 0)};t.prototype.execute=function(e){var r,n;return f(this,void 0,void 0,function(){var i,o,a,l;return p(this,function(u){i=new Date().getTime();o=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1;a=(n=e.event_id)!==null&&n!==void 0?n:o+1;this.config.lastEventId=a;if(!e.time){this.config.lastEventTime=i}l=m(m(m(m(m(m(m(m({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:cn}),this.config.trackingOptions.language&&{language:It()}),this.config.trackingOptions.ipAddress&&{ip:ln}),{insert_id:K(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:a,library:this.library,user_agent:this.userAgent});return[2,l]})})};return t}();var Oe=function(){function t(e){this.storage=e}t.prototype.isEnabled=function(){return f(this,void 0,void 0,function(){var e,r,n,i,o;return p(this,function(a){switch(a.label){case 0:if(!this.storage){return[2,false]}e=String(Date.now());r=new t(this.storage);n="AMP_TEST";a.label=1;case 1:a.trys.push([1,4,5,7]);return[4,r.set(n,e)];case 2:a.sent();return[4,r.get(n)];case 3:i=a.sent();return[2,i===e];case 4:o=a.sent();return[2,false];case 5:return[4,r.remove(n)];case 6:a.sent();return[7];case 7:return[2]}})})};t.prototype.get=function(e){return f(this,void 0,void 0,function(){var r,n;return p(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,this.getRaw(e)];case 1:r=i.sent();if(!r){return[2,void 0]}return[2,JSON.parse(r)];case 2:n=i.sent();console.error("[Amplitude] Error: Could not get value from storage");return[2,void 0];case 3:return[2]}})})};t.prototype.getRaw=function(e){var r;return f(this,void 0,void 0,function(){return p(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(e))||void 0]})})};t.prototype.set=function(e,r){var n;return f(this,void 0,void 0,function(){return p(this,function(i){try{(n=this.storage)===null||n===void 0?void 0:n.setItem(e,JSON.stringify(r))}catch(o){}return[2]})})};t.prototype.remove=function(e){var r;return f(this,void 0,void 0,function(){return p(this,function(n){try{(r=this.storage)===null||r===void 0?void 0:r.removeItem(e)}catch(i){}return[2]})})};t.prototype.reset=function(){var e;return f(this,void 0,void 0,function(){return p(this,function(r){try{(e=this.storage)===null||e===void 0?void 0:e.clear()}catch(n){}return[2]})})};return t}();var Le=1e3;var At=function(t){V(e,t);function e(r){var n=this;var i;n=t.call(this,(i=N())===null||i===void 0?void 0:i.localStorage)||this;n.loggerProvider=r===null||r===void 0?void 0:r.loggerProvider;return n}e.prototype.set=function(r,n){var i;return f(this,void 0,void 0,function(){var o;return p(this,function(a){switch(a.label){case 0:if(!(Array.isArray(n)&&n.length>Le))return[3,2];o=n.length-Le;return[4,t.prototype.set.call(this,r,n.slice(0,Le))];case 1:a.sent();(i=this.loggerProvider)===null||i===void 0?void 0:i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(Le,"."));return[3,4];case 2:return[4,t.prototype.set.call(this,r,n)];case 3:a.sent();a.label=4;case 4:return[2]}})})};return e}(Oe);var Ir=function(t){V(e,t);function e(){var r;return t.call(this,(r=N())===null||r===void 0?void 0:r.sessionStorage)||this}return e}(Oe);var Sr=function(t){V(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;r.state={done:4};return r}e.prototype.send=function(r,n){return f(this,void 0,void 0,function(){var i=this;return p(this,function(o){return[2,new Promise(function(a,l){if(typeof XMLHttpRequest==="undefined"){l(new Error("XHRTransport is not supported."))}var u=new XMLHttpRequest;u.open("POST",r,true);u.onreadystatechange=function(){if(u.readyState===i.state.done){try{var s=u.responseText;var c=JSON.parse(s);var d=i.buildResponse(c);a(d)}catch(v){l(v)}}};u.setRequestHeader("Content-Type","application/json");u.setRequestHeader("Accept","*/*");u.send(JSON.stringify(n))})]})})};return e}(ne);var Tr=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.send=function(r,n){return f(this,void 0,void 0,function(){var i=this;return p(this,function(o){return[2,new Promise(function(a,l){var u=N();if(!(u===null||u===void 0?void 0:u.navigator.sendBeacon)){throw new Error("SendBeaconTransport is not supported")}try{var s=JSON.stringify(n);var c=u.navigator.sendBeacon(r,JSON.stringify(n));if(c){return a(i.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}))}return a(i.buildResponse({code:500}))}catch(d){l(d)}})]})})};return e}(ne);var wr=function(t,e,r){if(r===void 0){r=true}return f(void 0,void 0,void 0,function(){var n,i,o,a,l,u,s,c,d;return p(this,function(v){switch(v.label){case 0:n=mt(t);return[4,e.getRaw(n)];case 1:i=v.sent();if(!i){return[2,{optOut:false}]}if(!r)return[3,3];return[4,e.remove(n)];case 2:v.sent();v.label=3;case 3:o=x(i.split("."),6),a=o[0],l=o[1],u=o[2],s=o[3],c=o[4],d=o[5];return[2,{deviceId:a,userId:dn(l),sessionId:Rt(s),lastEventId:Rt(d),lastEventTime:Rt(c),optOut:Boolean(u)}]}})})};var Rt=function(t){var e=parseInt(t,32);if(isNaN(e)){return void 0}return e};var dn=function(t){if(!atob||!escape||!t){return void 0}try{return decodeURIComponent(escape(atob(t)))}catch(e){return void 0}};var j="[Amplitude]";var pa="".concat(j," Page Viewed");var Ct="".concat(j," Form Started");var xr="".concat(j," Form Submitted");var Pr="".concat(j," File Downloaded");var Dt="session_start";var Ot="session_end";var Ar="".concat(j," File Extension");var Rr="".concat(j," File Name");var Cr="".concat(j," Link ID");var Dr="".concat(j," Link Text");var Or="".concat(j," Link URL");var ke="".concat(j," Form ID");var Ue="".concat(j," Form Name");var Ne="".concat(j," Form Destination");var _e="cookie";var Lr="US";var fn=function(t){V(e,t);function e(r,n,i,o,a,l,u,s,c,d,v,y,h,E,g,_,S,I,L,F,T,w,k,M,Q,H,ee,Y,te,ce,le){if(i===void 0){i=new we}if(o===void 0){o={domain:"",expiration:365,sameSite:"Lax",secure:false,upgrade:true}}if(u===void 0){u=1e3}if(s===void 0){s=5}if(c===void 0){c=30}if(d===void 0){d=_e}if(g===void 0){g=new pe}if(_===void 0){_=U.Warn}if(I===void 0){I=false}if(L===void 0){L=false}if(w===void 0){w=""}if(k===void 0){k=Lr}if(Q===void 0){Q=30*60*1e3}if(H===void 0){H=new At({loggerProvider:g})}if(ee===void 0){ee={ipAddress:true,language:true,platform:true}}if(Y===void 0){Y="fetch"}if(te===void 0){te=false}var b=t.call(this,{apiKey:r,storageProvider:H,transportProvider:Lt(Y)})||this;b.apiKey=r;b.appVersion=n;b.cookieOptions=o;b.defaultTracking=a;b.flushIntervalMillis=u;b.flushMaxRetries=s;b.flushQueueSize=c;b.identityStorage=d;b.ingestionMetadata=v;b.instanceName=y;b.loggerProvider=g;b.logLevel=_;b.minIdLength=S;b.offline=I;b.partnerId=F;b.plan=T;b.serverUrl=w;b.serverZone=k;b.sessionTimeout=Q;b.storageProvider=H;b.trackingOptions=ee;b.transport=Y;b.useBatch=te;b._optOut=false;b._cookieStorage=i;b.deviceId=l;b.lastEventId=h;b.lastEventTime=E;b.optOut=L;b.sessionId=M;b.pageCounter=le;b.userId=ce;b.loggerProvider.enable(b.logLevel);return b}Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(r){if(this._cookieStorage!==r){this._cookieStorage=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(r){if(this._deviceId!==r){this._deviceId=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(r){if(this._userId!==r){this._userId=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(r){if(this._sessionId!==r){this._sessionId=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(r){if(this._optOut!==r){this._optOut=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(r){if(this._lastEventTime!==r){this._lastEventTime=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(r){if(this._lastEventId!==r){this._lastEventId=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){if(this._pageCounter!==r){this._pageCounter=r;this.updateStorage()}},enumerable:false,configurable:true});e.prototype.updateStorage=function(){var r={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter};void this.cookieStorage.set(xe(this.apiKey),r)};return e}(nt);var kr=function(t,e,r){if(e===void 0){e={}}return f(void 0,void 0,void 0,function(){var n,i,o,a,l,u,s,c,d,v,y,h,E,g,_,S;var I;var L,F,T,w,k,M,Q,H,ee,Y,te,ce,le,b,Me,Fe,Ve,Be,qe,je,Ge,Ke,Qe;return p(this,function(ae){switch(ae.label){case 0:n=e.identityStorage||_e;I={};if(!(n!==_e))return[3,1];o="";return[3,5];case 1:if(!((F=(L=e.cookieOptions)===null||L===void 0?void 0:L.domain)!==null&&F!==void 0))return[3,2];a=F;return[3,4];case 2:return[4,vn()];case 3:a=ae.sent();ae.label=4;case 4:o=a;ae.label=5;case 5:i=m.apply(void 0,[(I.domain=o,I.expiration=365,I.sameSite="Lax",I.secure=false,I.upgrade=true,I),e.cookieOptions]);l=pn(e.identityStorage,i);return[4,wr(t,l,(w=(T=e.cookieOptions)===null||T===void 0?void 0:T.upgrade)!==null&&w!==void 0?w:true)];case 6:u=ae.sent();return[4,l.get(xe(t))];case 7:s=ae.sent();c=se();d=(H=(Q=(M=(k=e.deviceId)!==null&&k!==void 0?k:c.deviceId)!==null&&M!==void 0?M:s===null||s===void 0?void 0:s.deviceId)!==null&&Q!==void 0?Q:u.deviceId)!==null&&H!==void 0?H:K();v=(ee=s===null||s===void 0?void 0:s.lastEventId)!==null&&ee!==void 0?ee:u.lastEventId;y=(Y=s===null||s===void 0?void 0:s.lastEventTime)!==null&&Y!==void 0?Y:u.lastEventTime;h=(ce=(te=e.optOut)!==null&&te!==void 0?te:s===null||s===void 0?void 0:s.optOut)!==null&&ce!==void 0?ce:u.optOut;E=(le=s===null||s===void 0?void 0:s.sessionId)!==null&&le!==void 0?le:u.sessionId;g=(Me=(b=e.userId)!==null&&b!==void 0?b:s===null||s===void 0?void 0:s.userId)!==null&&Me!==void 0?Me:u.userId;r.previousSessionDeviceId=(Fe=s===null||s===void 0?void 0:s.deviceId)!==null&&Fe!==void 0?Fe:u.deviceId;r.previousSessionUserId=(Ve=s===null||s===void 0?void 0:s.userId)!==null&&Ve!==void 0?Ve:u.userId;_={ipAddress:(qe=(Be=e.trackingOptions)===null||Be===void 0?void 0:Be.ipAddress)!==null&&qe!==void 0?qe:true,language:(Ge=(je=e.trackingOptions)===null||je===void 0?void 0:je.language)!==null&&Ge!==void 0?Ge:true,platform:(Qe=(Ke=e.trackingOptions)===null||Ke===void 0?void 0:Ke.platform)!==null&&Qe!==void 0?Qe:true};S=s===null||s===void 0?void 0:s.pageCounter;return[2,new fn(t,e.appVersion,l,i,e.defaultTracking,d,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,n,e.ingestionMetadata,e.instanceName,v,y,e.loggerProvider,e.logLevel,e.minIdLength,e.offline,h,e.partnerId,e.plan,e.serverUrl,e.serverZone,E,e.sessionTimeout,e.storageProvider,_,e.transport,e.useBatch,g,S)]}})})};var pn=function(t,e){if(t===void 0){t=_e}if(e===void 0){e={}}switch(t){case"localStorage":return new At;case"sessionStorage":return new Ir;case"none":return new we;case"cookie":default:return new ge(m(m({},e),{expirationDays:e.expiration}))}};var Lt=function(t){if(t==="xhr"){return new Sr}if(t==="beacon"){return new Tr}return new yt};var vn=function(t){return f(void 0,void 0,void 0,function(){var e,r,n,i,o,o,a,l,u,s;return p(this,function(c){switch(c.label){case 0:return[4,new ge().isEnabled()];case 1:if(!c.sent()||!t&&typeof location==="undefined"){return[2,""]}e=t!==null&&t!==void 0?t:location.hostname;r=e.split(".");n=[];i="AMP_TLDTEST";for(o=r.length-2;o>=0;--o){n.push(r.slice(o).join("."))}o=0;c.label=2;case 2:if(!(o<n.length))return[3,7];a=n[o];l={domain:"."+a};u=new ge(l);return[4,u.set(i,1)];case 3:c.sent();return[4,u.get(i)];case 4:s=c.sent();if(!s)return[3,6];return[4,u.remove(i)];case 5:c.sent();return[2,"."+a];case 6:o++;return[3,2];case 7:return[2,""]}})})};var Nr=function(t,e,r){if(e===void 0){e=""}if(r===void 0){r=10}return[re,e,t.substring(0,r)].filter(Boolean).join("_")};var Ur=function(t){var e=t.split(".");if(e.length<=2){return t}return e.slice(e.length-2,e.length).join(".")};var hn=function(t){return Object.values(t).every(function(e){return!e})};var Mr=function(t,e,r,n){if(n===void 0){n=true}var i=t.referrer,o=t.referring_domain,a=de(t,["referrer","referring_domain"]);var l=e||{},u=l.referrer,s=l.referring_domain,c=de(l,["referrer","referring_domain"]);if(gn(r.excludeReferrers,t.referring_domain)){return false}if(!n&&hn(t)&&e){return false}var d=JSON.stringify(a)!==JSON.stringify(c);var v=Ur(o||"")!==Ur(s||"");return!e||d||v};var gn=function(t,e){if(t===void 0){t=[]}if(e===void 0){e=""}return t.some(function(r){return r instanceof RegExp?r.test(e):r===e})};var Fr=function(t,e){var r=m(m({},ie),t);var n=Object.entries(r).reduce(function(i,o){var a;var l=x(o,2),u=l[0],s=l[1];i.setOnce("initial_".concat(u),(a=s!==null&&s!==void 0?s:e.initialEmptyValue)!==null&&a!==void 0?a:"EMPTY");if(s){return i.set(u,s)}return i.unset(u)},new z);return fe(n)};var Vr=function(t){var e=t;if(e){if(e.startsWith(".")){e=e.substring(1)}return[new RegExp("".concat(e.replace(".","\\\\."),"$"))]}return[]};var kt=function(t){var e=this;if(t===void 0){t={}}var r={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(n,i){var o;return f(this,void 0,void 0,function(){var a,l,u,s,c,d,v,y;return p(this,function(h){switch(h.label){case 0:a=m({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:false,excludeReferrers:Vr((o=n.cookieOptions)===null||o===void 0?void 0:o.domain)},t);n.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser.");l=n.cookieStorage;u=Nr(n.apiKey,"MKTG");return[4,Promise.all([new ve().parse(),l.get(u)])];case 1:s=x.apply(void 0,[h.sent(),2]),c=s[0],d=s[1];v=he(n.sessionTimeout,n.lastEventTime);if(Mr(c,d,a,v)){if(a.resetSessionOnNewCampaign){i.setSessionId(Date.now());n.loggerProvider.log("Created a new session for new campaign.")}n.loggerProvider.log("Tracking attribution.");y=Fr(c,a);i.track(y);void l.set(u,c)}return[2]}})})},execute:function(n){return f(e,void 0,void 0,function(){return p(this,function(i){return[2,n]})})}};return r};var Br=function(t){var e={};for(var r in t){var n=t[r];if(n){e[r]=n}}return e};var Ut=function(t){if(t===void 0){t={}}var e;var r=N();var n=void 0;var i;var o;var a=function(){return f(void 0,void 0,void 0,function(){var v;var y;var h;return p(this,function(E){switch(E.label){case 0:o.pageCounter=!o.pageCounter?1:o.pageCounter+1;y={event_type:(h=t.eventType)!==null&&h!==void 0?h:"[Amplitude] Page Viewed"};v=[{}];return[4,mn()];case 1:return[2,(y.event_properties=m.apply(void 0,[m.apply(void 0,v.concat([E.sent()])),{"[Amplitude] Page Domain":typeof location!=="undefined"&&location.hostname||"","[Amplitude] Page Location":typeof location!=="undefined"&&location.href||"","[Amplitude] Page Path":typeof location!=="undefined"&&location.pathname||"","[Amplitude] Page Title":typeof document!=="undefined"&&document.title||"","[Amplitude] Page URL":typeof location!=="undefined"&&location.href.split("?")[0]||"","[Amplitude] Page Counter":o.pageCounter}]),y)]}})})};var l=function(){return typeof t.trackOn==="undefined"||typeof t.trackOn==="function"&&t.trackOn()};var u=typeof location!=="undefined"?location.href:null;var s=function(){return f(void 0,void 0,void 0,function(){var v,y,h,E,g;return p(this,function(_){switch(_.label){case 0:v=location.href;y=_n(t.trackHistoryChanges,v,u||"")&&l();u=v;if(!y)return[3,4];n===null||n===void 0?void 0:n.log("Tracking page view event");if(!(e===null||e===void 0))return[3,1];h=void 0;return[3,3];case 1:g=(E=e).track;return[4,a()];case 2:h=g.apply(E,[_.sent()]);_.label=3;case 3:h;_.label=4;case 4:return[2]}})})};var c=function(){void s()};var d={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(v,y){return f(void 0,void 0,void 0,function(){var h,E;return p(this,function(g){switch(g.label){case 0:e=y;o=v;n=v.loggerProvider;n.log("Installing @amplitude/plugin-page-view-tracking-browser");if(r){r.addEventListener("popstate",c);i=r.history.pushState;r.history.pushState=new Proxy(r.history.pushState,{apply:function(_,S,I){var L=x(I,3),F=L[0],T=L[1],w=L[2];_.apply(S,[F,T,w]);void s()}})}if(!l())return[3,2];n.log("Tracking page view event");E=(h=e).track;return[4,a()];case 1:E.apply(h,[g.sent()]);g.label=2;case 2:return[2]}})})},execute:function(v){return f(void 0,void 0,void 0,function(){var y;return p(this,function(h){switch(h.label){case 0:if(!(t.trackOn==="attribution"&&yn(v)))return[3,2];n===null||n===void 0?void 0:n.log("Enriching campaign event to page view event with campaign parameters");return[4,a()];case 1:y=h.sent();v.event_type=y.event_type;v.event_properties=m(m({},v.event_properties),y.event_properties);h.label=2;case 2:return[2,v]}})})},teardown:function(){return f(void 0,void 0,void 0,function(){return p(this,function(v){if(r){r.removeEventListener("popstate",c);if(i){r.history.pushState=i}}return[2]})})}};return d};var mn=function(){return f(void 0,void 0,void 0,function(){var t;return p(this,function(e){switch(e.label){case 0:t=Br;return[4,new ve().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})};var yn=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties;var r=e[D.SET]||{};var n=e[D.UNSET]||{};var i=q(q([],x(Object.keys(r)),false),x(Object.keys(n)),false);return Object.keys(ie).every(function(o){return i.includes(o)})}return false};var _n=function(t,e,r){switch(t){case"pathOnly":return e.split("?")[0]!==r.split("?")[0];default:return e!==r}};var qr=function(){var t;var e=[];var r=function(s,c,d){s.addEventListener(c,d);e.push({element:s,type:c,handler:d})};var n=function(){e.forEach(function(s){var c=s.element,d=s.type,v=s.handler;c===null||c===void 0?void 0:c.removeEventListener(d,v)});e=[]};var i="@amplitude/plugin-form-interaction-tracking-browser";var o="enrichment";var a=function(s,c){return f(void 0,void 0,void 0,function(){var d,v;return p(this,function(y){if(!c){s.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return[2]}if(typeof document==="undefined"){return[2]}d=function(h){var E=false;r(h,"change",function(){var g;if(!E){c.track(Ct,(g={},g[ke]=ue(h.id),g[Ue]=ue(h.name),g[Ne]=h.action,g))}E=true});r(h,"submit",function(){var g,_;if(!E){c.track(Ct,(g={},g[ke]=ue(h.id),g[Ue]=ue(h.name),g[Ne]=h.action,g))}c.track(xr,(_={},_[ke]=ue(h.id),_[Ue]=ue(h.name),_[Ne]=h.action,_));E=false})};v=Array.from(document.getElementsByTagName("form"));v.forEach(d);if(typeof MutationObserver!=="undefined"){t=new MutationObserver(function(h){h.forEach(function(E){E.addedNodes.forEach(function(g){if(g.nodeName==="FORM"){d(g)}if("querySelectorAll"in g&&typeof g.querySelectorAll==="function"){Array.from(g.querySelectorAll("form")).map(d)}})})});t.observe(document.body,{subtree:true,childList:true})}return[2]})})};var l=function(s){return f(void 0,void 0,void 0,function(){return p(this,function(c){return[2,s]})})};var u=function(){return f(void 0,void 0,void 0,function(){return p(this,function(s){t===null||t===void 0?void 0:t.disconnect();n();return[2]})})};return{name:i,type:o,setup:a,execute:l,teardown:u}};var ue=function(t){if(typeof t!=="string"){return void 0}return t};var jr=function(){var t;var e=[];var r=function(s,c,d){s.addEventListener(c,d);e.push({element:s,type:c,handler:d})};var n=function(){e.forEach(function(s){var c=s.element,d=s.type,v=s.handler;c===null||c===void 0?void 0:c.removeEventListener(d,v)});e=[]};var i="@amplitude/plugin-file-download-tracking-browser";var o="enrichment";var a=function(s,c){return f(void 0,void 0,void 0,function(){var d,v,y;return p(this,function(h){if(!c){s.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return[2]}if(typeof document==="undefined"){return[2]}d=function(E){var g;try{g=new URL(E.href,window.location.href)}catch(I){return}var _=v.exec(g.href);var S=_===null||_===void 0?void 0:_[1];if(S){r(E,"click",function(){var I;if(S){c.track(Pr,(I={},I[Ar]=S,I[Rr]=g.pathname,I[Cr]=E.id,I[Dr]=E.text,I[Or]=E.href,I))}})}};v=/\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;y=Array.from(document.getElementsByTagName("a"));y.forEach(d);if(typeof MutationObserver!=="undefined"){t=new MutationObserver(function(E){E.forEach(function(g){g.addedNodes.forEach(function(_){if(_.nodeName==="A"){d(_)}if("querySelectorAll"in _&&typeof _.querySelectorAll==="function"){Array.from(_.querySelectorAll("a")).map(d)}})})});t.observe(document.body,{subtree:true,childList:true})}return[2]})})};var l=function(s){return f(void 0,void 0,void 0,function(){return p(this,function(c){return[2,s]})})};var u=function(){return f(void 0,void 0,void 0,function(){return p(this,function(s){t===null||t===void 0?void 0:t.disconnect();n();return[2]})})};return{name:i,type:o,setup:a,execute:l,teardown:u}};var Gr=false;var Kr=function(t){if(Gr||t.defaultTracking!==void 0){return}var e="\`options.defaultTracking\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \`options.defaultTracking\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\\n\\namplitude.init(<YOUR_API_KEY>, {\\n defaultTracking: true,\\n});\\n\\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.";t.loggerProvider.warn(e);Gr=true};var Qr=function(){var t="@amplitude/plugin-network-checker-browser";var e="before";var r=N();var n=[];var i=function(u,s){if(r){r.addEventListener(u,s);n.push({type:u,handler:s})}};var o=function(){n.forEach(function(u){var s=u.type,c=u.handler;if(r){r.removeEventListener(s,c)}});n=[]};var a=function(u,s){return f(void 0,void 0,void 0,function(){return p(this,function(c){u.offline=!navigator.onLine;i("online",function(){u.loggerProvider.debug("Network connectivity changed to online.");u.offline=false;setTimeout(function(){s.flush()},u.flushIntervalMillis)});i("offline",function(){u.loggerProvider.debug("Network connectivity changed to offline.");u.offline=true});return[2]})})};var l=function(){return f(void 0,void 0,void 0,function(){return p(this,function(u){o();return[2]})})};return{name:t,type:e,setup:a,teardown:l}};var Wr=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.init=function(r,n,i){if(r===void 0){r=""}var o;var a;if(arguments.length>2){o=n;a=i}else{if(typeof n==="string"){o=n;a=void 0}else{o=n===null||n===void 0?void 0:n.userId;a=n}}return B(this._init(m(m({},a),{userId:o,apiKey:r})))};e.prototype._init=function(r){var n,i;return f(this,void 0,void 0,function(){var o,a,l,u;var s=this;return p(this,function(c){switch(c.label){case 0:if(this.initializing){return[2]}this.initializing=true;return[4,kr(r.apiKey,r,this)];case 1:o=c.sent();return[4,t.prototype._init.call(this,o)];case 2:c.sent();this.setSessionId((i=(n=r.sessionId)!==null&&n!==void 0?n:this.config.sessionId)!==null&&i!==void 0?i:Date.now());a=J(r.instanceName);a.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId});if(!(this.config.offline!==Xe))return[3,4];return[4,this.add(Qr()).promise];case 3:c.sent();c.label=4;case 4:return[4,this.add(new ot).promise];case 5:c.sent();return[4,this.add(new br).promise];case 6:c.sent();return[4,this.add(new bt).promise];case 7:c.sent();Kr(this.config);if(!St(this.config.defaultTracking))return[3,9];return[4,this.add(jr()).promise];case 8:c.sent();c.label=9;case 9:if(!Tt(this.config.defaultTracking))return[3,11];return[4,this.add(qr()).promise];case 10:c.sent();c.label=11;case 11:if(!Ae(this.config.defaultTracking))return[3,13];l=Pt(this.config);u=kt(l);return[4,this.add(u).promise];case 12:c.sent();c.label=13;case 13:if(!Re(this.config.defaultTracking))return[3,15];return[4,this.add(Ut(xt(this.config))).promise];case 14:c.sent();c.label=15;case 15:this.initializing=false;return[4,this.runQueuedFunctions("dispatchQ")];case 16:c.sent();a.eventBridge.setEventReceiver(function(d){void s.track(d.eventType,d.eventProperties)});return[2]}})})};e.prototype.getUserId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.userId};e.prototype.setUserId=function(r){if(!this.config){this.q.push(this.setUserId.bind(this,r));return}if(r!==this.config.userId||r===void 0){this.config.userId=r;_t(r,this.config.instanceName)}};e.prototype.getDeviceId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.deviceId};e.prototype.setDeviceId=function(r){if(!this.config){this.q.push(this.setDeviceId.bind(this,r));return}this.config.deviceId=r;Et(r,this.config.instanceName)};e.prototype.reset=function(){this.setDeviceId(K());this.setUserId(void 0)};e.prototype.getSessionId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.sessionId};e.prototype.setSessionId=function(r){var n;if(!this.config){this.q.push(this.setSessionId.bind(this,r));return}if(r===this.config.sessionId){return}var i=this.getSessionId();var o=this.config.lastEventTime;var a=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1;this.config.sessionId=r;this.config.lastEventTime=void 0;this.config.pageCounter=0;if(wt(this.config.defaultTracking)){if(i&&o){this.track(Ot,void 0,{device_id:this.previousSessionDeviceId,event_id:++a,session_id:i,time:o+1,user_id:this.previousSessionUserId})}this.config.lastEventTime=this.config.sessionId;this.track(Dt,void 0,{event_id:++a,session_id:this.config.sessionId,time:this.config.lastEventTime})}this.previousSessionDeviceId=this.config.deviceId;this.previousSessionUserId=this.config.userId};e.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()};e.prototype.setTransport=function(r){if(!this.config){this.q.push(this.setTransport.bind(this,r));return}this.config.transportProvider=Lt(r)};e.prototype.identify=function(r,n){if(De(r)){var i=r._q;r._q=[];r=Ce(new z,i)}if(n===null||n===void 0?void 0:n.user_id){this.setUserId(n.user_id)}if(n===null||n===void 0?void 0:n.device_id){this.setDeviceId(n.device_id)}return t.prototype.identify.call(this,r,n)};e.prototype.groupIdentify=function(r,n,i,o){if(De(i)){var a=i._q;i._q=[];i=Ce(new z,a)}return t.prototype.groupIdentify.call(this,r,n,i,o)};e.prototype.revenue=function(r,n){if(De(r)){var i=r._q;r._q=[];r=Ce(new rt,i)}return t.prototype.revenue.call(this,r,n)};e.prototype.process=function(r){return f(this,void 0,void 0,function(){var n,i;return p(this,function(o){n=Date.now();i=he(this.config.sessionTimeout,this.config.lastEventTime);if(r.event_type!==Dt&&r.event_type!==Ot&&(!r.session_id||r.session_id===this.getSessionId())&&i){this.setSessionId(n)}return[2,t.prototype.process.call(this,r)]})})};return e}(tt);var En=function(){var t=new Wr;return{init:C(t.init.bind(t),"init",A(t),R(t,["config"])),add:C(t.add.bind(t),"add",A(t),R(t,["config.apiKey","timeline.plugins"])),remove:C(t.remove.bind(t),"remove",A(t),R(t,["config.apiKey","timeline.plugins"])),track:C(t.track.bind(t),"track",A(t),R(t,["config.apiKey","timeline.queue.length"])),logEvent:C(t.logEvent.bind(t),"logEvent",A(t),R(t,["config.apiKey","timeline.queue.length"])),identify:C(t.identify.bind(t),"identify",A(t),R(t,["config.apiKey","timeline.queue.length"])),groupIdentify:C(t.groupIdentify.bind(t),"groupIdentify",A(t),R(t,["config.apiKey","timeline.queue.length"])),setGroup:C(t.setGroup.bind(t),"setGroup",A(t),R(t,["config.apiKey","timeline.queue.length"])),revenue:C(t.revenue.bind(t),"revenue",A(t),R(t,["config.apiKey","timeline.queue.length"])),flush:C(t.flush.bind(t),"flush",A(t),R(t,["config.apiKey","timeline.queue.length"])),getUserId:C(t.getUserId.bind(t),"getUserId",A(t),R(t,["config","config.userId"])),setUserId:C(t.setUserId.bind(t),"setUserId",A(t),R(t,["config","config.userId"])),getDeviceId:C(t.getDeviceId.bind(t),"getDeviceId",A(t),R(t,["config","config.deviceId"])),setDeviceId:C(t.setDeviceId.bind(t),"setDeviceId",A(t),R(t,["config","config.deviceId"])),reset:C(t.reset.bind(t),"reset",A(t),R(t,["config","config.userId","config.deviceId"])),getSessionId:C(t.getSessionId.bind(t),"getSessionId",A(t),R(t,["config"])),setSessionId:C(t.setSessionId.bind(t),"setSessionId",A(t),R(t,["config"])),extendSession:C(t.extendSession.bind(t),"extendSession",A(t),R(t,["config"])),setOptOut:C(t.setOptOut.bind(t),"setOptOut",A(t),R(t,["config"])),setTransport:C(t.setTransport.bind(t),"setTransport",A(t),R(t,["config"]))}};var O=En();var bs=O.add;var Is=O.extendSession;var Ss=O.flush;var Ts=O.getDeviceId;var ws=O.getSessionId;var xs=O.getUserId;var Ps=O.groupIdentify;var As=O.identify;var Rs=O.init;var Cs=O.logEvent;var Ds=O.remove;var Os=O.reset;var Ls=O.revenue;var ks=O.setDeviceId;var Nt=O.setGroup;var Us=O.setOptOut;var Ns=O.setSessionId;var Ms=O.setTransport;var Fs=O.setUserId;var oe=O.track;var Mt=(t,e)=>{setTimeout(()=>{const r=Array.from(document.querySelectorAll("section"));for(const n of r){n.setAttribute("aria-hidden",String(n.id!==t))}},e)};var $r=t=>{Mt("success",500);if(t){Tn()}setTimeout(bn,500)};var bn=()=>{const t=document.getElementById("step-update-app");t.className="highlight completed";const e=document.getElementById("step-setup-complete");e.className="highlight active"};var Ee=(t=[])=>{Mt("error",500);const e=document.getElementById("error-messages");e.innerHTML="";for(const r of t){const n=document.createElement("li");n.textContent=r;e.appendChild(n)}document.title=\`Error Connecting\`};var Hr=()=>{Mt("restart-server",500);document.title=\`Restart Dev Server\`};var In=async()=>{const t=new URL(location.href);const e=t.searchParams.get(We);const r=t.searchParams.get(Ft);const n=t.searchParams.get(Vt);const i=t.searchParams.get($e);const o=t.searchParams.get(qt)||"unknown";const a=t.searchParams.get(jt);const l=t.searchParams.get(Gt);const u=t.searchParams.get(Qt)||null;try{console.info(\`framework: \${o}, platform: \${a}, node: \${l}\`);const s=new URL(location.pathname,location.origin);if(r){Nt("organization",r);Nt("space",r)}if(!e){window.history.replaceState({},"",s.href);Ee(["Missing preview url"]);oe("integration failed",{url:s.href,message:"missing preview url",framework:o});return}s.searchParams.set(We,e);s.searchParams.set($e,i);window.history.replaceState({},"",s.href);if(r&&n){let c=0;const d=async()=>{c++;try{const v=await $t(r,n,u);if(v.success){const y=Yr(e,v.pathname,i);oe("site integrated",{url:y,position:o});if(v.modifiedFiles.length>0){const h=document.getElementById("modified-files-list");v.modifiedFiles.forEach(g=>{const _=document.createElement("li");const S=document.createElement("a");S.textContent=g.displayFilePath||g.filePath;S.href=\`~launch#\${g.displayFilePath}\`;S.addEventListener("click",I=>{I.preventDefault();I.stopPropagation();Yt({filePath:g.filePath})});_.appendChild(S);h.appendChild(_)});const E=document.getElementById("modified-files-message");E.removeAttribute("hidden")}if(u!=="vcp"&&(v.platform.os==="win32"||o==="@remix-run/react")){const h=document.getElementById("restart-warning");h.removeAttribute("hidden")}else if(u!=="vcp"&&(o==="react"||o==="@angular/core")){const h=document.getElementById("router-message");h.removeAttribute("hidden");if(o==="@angular/core"){oe("angular framework",{});const I=document.getElementById("angular-message-section");I?.removeAttribute("hidden")}if(o==="react"){oe("react framework",{});const I=document.getElementById("react-message-section");I?.removeAttribute("hidden")}const E=document.getElementById("router-checkbox-div");const g=document.createElement("input");g.type="checkbox";g.id="router-checkbox";const _=document.createElement("label");_.htmlFor="router-checkbox";_.textContent=\`I've updated my router files\`;E.appendChild(g);E.appendChild(_);const S=document.getElementById("router-finish-button");g.addEventListener("change",function(){if(g.checked){S.removeAttribute("hidden")}else{S.setAttribute("hidden","true")}})}else{const h=document.getElementById("go-to-app");h.removeAttribute("hidden");if(u!=="vcp"){const E=h.querySelector("p");if(E){E.removeAttribute("hidden")}const g=h.querySelector("#button-text");if(g){g.textContent="Go to your app"}}}setTimeout(()=>{$r(true)},500)}else{oe("integration failed",{path:v.pathname,message:"error connecting to Builder.io",position:o});Ee([\`Error connecting to Builder.io\`])}}catch(v){const y=String(v.message||v);if(y.includes("Fetch Error")){if(c>3){Hr()}setTimeout(d,1e3)}else{Ee([y])}}};d()}else{const c=await Ht();if(c.isValid){Yr(e,c.pathname,i);const d=document.getElementById("go-to-app");d.removeAttribute("hidden");$r(false)}else{Ee([\`Error connecting to Builder.io\`])}}}catch(s){oe("integration failed",{message:"uncaught error",details:String(s),position:JSON.stringify({framework:o,platform:a,nodeVersion:l})});console.error("integrationFailed",s);const c=String(s);if(c.includes("Fetch Error")){Hr()}else{Ee([c])}}};var Yr=(t,e,r)=>{const n=new URL(e,t);if(r){n.hash=\`\${Bt}=\${r}\`}const i=document.querySelectorAll(".next-step");for(const o of i){o.setAttribute("href",n.href)}console.debug("App Url",n.href);return n.href};var Sn=()=>{return new Promise((t,e)=>{if(globalThis.confetti){return t(globalThis.confetti)}const r=document.createElement("script");r.src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.1/dist/confetti.browser.min.js";r.onload=()=>t(globalThis.confetti);r.onerror=e;document.head.appendChild(r);r.remove()})};var Tn=async()=>{const t={spread:360,ticks:50,gravity:0,decay:.95,startVelocity:30,colors:["19b4f4","a97ff2","fd6b3c","ffffff"]};const e=Sn();const r=async()=>{const n=document.getElementById("button-icon");const i=n.getBoundingClientRect();const o=window.scrollX+i.left;const a=window.scrollY+i.top;const l={x:o/window.innerWidth,y:a/window.innerHeight};const u=await e;u({...t,origin:l,scalar:1.2});u({...t,origin:l,scalar:.75})};setTimeout(r,500);setTimeout(r,650);setTimeout(r,800);setTimeout(r,950)};In();})();
228
244
  </script>
229
245
  </body>
230
246
  </html>
231
- `)}async function ne(e,t){let r=await $(e),n=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,r).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,n.length?n[0].name:"")}var oe=require("node:os");async function ie(e,t){let r=new URL("/cli-auth","https://builder.io");r.searchParams.set("client_id",e.getClientId()),r.searchParams.set("host",await e.getDeviceId()),r.searchParams.set("response_type","code"),r.searchParams.set("cli","true");let n=new URL(v,e.devToolsServerUrl);n.searchParams.set(O,(0,oe.platform)()),n.searchParams.set(F,process.versions.node);let i=e.getFrameworks();return i.length>0&&(r.searchParams.set(D,i[0].name),n.searchParams.set(D,i[0].name)),r.searchParams.set("redirect_url",n.href),r.searchParams.set("preview_url",t),r.href}async function ae(e,t,r,n){try{if(!e)return f(r,n,400,"Builder context closed");let i=Ne(r);if(i.pathname===w){if(r.method==="POST"){let s=await ke(r);if(s)try{let o=await ee(e,JSON.parse(s));return se(r,n,200,o)}catch(o){e.debug("Dev API Error",o.stack||o.message||o);let l={errors:[String(o.message||o)]};return se(r,n,500,l)}}else if(r.method==="OPTIONS"){let s={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version"},o=r.headers.origin;o&&o!=="null"?le(new URL(o))&&(s["Access-Control-Allow-Origin"]=o):s["Access-Control-Allow-Origin"]="*",n.writeHead(200,s),n.end();return}return f(r,n,405,`${w} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(i.pathname===N)return Ie(r,n,200,await te(e));if(i.pathname===k){let s=i.searchParams.get(R);return s?Fe(n,302,await ie(e,s)):f(r,n,400,`Missing ${R} querystring`)}return i.pathname===v?Oe(r,n,200,await re(e)):i.pathname===u?(e.debug(`Close Dev Tools Server Requested: ${i.href}`),setTimeout(()=>{try{t.close(s=>{e.debug(`Dev Tools Server Closed Error: ${s}`)})}catch(s){e.debug(`Error closing devtools server: ${s}`)}},20),f(r,n,200,"Closing Dev Tools Server")):f(r,n,404,"Not found")}catch(i){return console.error("Dev Server Error",i),f(r,n,500,`Dev Server Error: ${i}`)}}function se(e,t,r,n){C(e,t,r,"application/json",JSON.stringify(n))}function Ie(e,t,r,n){C(e,t,r,"application/javascript",n)}function Oe(e,t,r,n){C(e,t,r,"text/html",n)}function f(e,t,r,n){C(e,t,r,"text/plain",n)}function C(e,t,r,n,i){let s={"Content-Type":`${n}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.5.2"},o=e.headers.origin;o&&o!=="null"?le(new URL(o))&&(s["Access-Control-Allow-Origin"]=o):s["Access-Control-Allow-Origin"]="*",t.writeHead(r,s),t.end(i)}function le(e){return e.hostname==="localhost"||e.origin==="https://builder.io"||e.origin==="https://www.builder.io"||e.origin.endsWith(".builder.io")?!0:e.port===""?!1:e.port!=="80"&&e.port!=="443"}function Fe(e,t,r){e.writeHead(t,{Location:r}),e.end()}async function ke(e){let t="";for await(let r of e)t+=r;return t}function Ne(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function pe(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await Le(e),r=(0,b.createServer)((i,s)=>{ae(e,r,i,s)}),n=()=>new Promise((i,s)=>{r.listening?(e.debug(`closing devtools server on port ${t}`),r.close(o=>{e=null,o?(e.debug(`error closing devtools server on port ${t}`),s(o)):(e&&e.debug(`closed devtools server on port ${t}`),i())})):(e.debug(`devtools server on port ${t} not listening`),i())});return process.once("SIGTERM",n),process.once("SIGINT",n),process.env.CI!=="true"&&process.stdin.on("end",n),globalThis.__builderDevToolsServer={url:new URL(`http://localhost:${t}`).href,port:t,setContext:i=>{e.debug(`set devtools context on server ${t}`),e=i},close:async()=>{globalThis.__builderDevToolsServer=null,await n()}},new Promise(i=>{r.listen(t,()=>{e.debug(`started devtools server on port ${t}`),i(globalThis.__builderDevToolsServer)})})}function Le(e){return new Promise(t=>{let r=e.port;try{(0,b.request)({hostname:"localhost",port:r,path:u,method:"GET"},i=>{i.on("end",()=>{e.debug(`${u} - Response ended`),t(r)})}).on("error",i=>{e.debug(`${u} - No response ${i}`),t(r)}).end()}catch(n){e.debug(`${u} - Error ${n}`),t(r)}})}async function ce(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},r=e.getFrameworks().map(s=>s.name).join(", ");t.debug(`create devtools ${_} [${r}]`);let n=await pe(t);return t.devToolsServerUrl=n.url,t.port=n.port,{getUrl:()=>t.devToolsServerUrl}}var _="1.5.2";0&&(module.exports={createDevToolsServer,version});
247
+ `)}async function Qo(e,t){let n=await Ao(e),r=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,n).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,r.length?r[0].name:"")}var Yo=require("node:os");async function Xo(e,t){let n=new URL("/cli-auth","https://builder.io");n.searchParams.set("client_id",e.getClientId()),n.searchParams.set("host",await e.getDeviceId()),n.searchParams.set("response_type","code"),n.searchParams.set("cli","true");let r=new URL(st,e.devToolsServerUrl);r.searchParams.set(dr,(0,Yo.platform)()),r.searchParams.set(Dr,process.versions.node);let i=e.getFrameworks();return i.length>0&&(n.searchParams.set(Et,i[0].name),r.searchParams.set(Et,i[0].name)),n.searchParams.set("redirect_url",r.href),n.searchParams.set("preview_url",t),n.href}var Do=require("http");var Bs=require("os"),Hr=require("path"),Ke=require("fs");var ie=k(un(),1),wt=require("node:process"),Ze=k(require("node:readline"),1),mn=k(require("node:readline"),1),li=require("node:tty");function cu({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}var pu=cu();function ci(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(pu,"")}function pi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mi={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(r){var i=r.charCodeAt(0),a=r.length==2?r.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=a&&a<=57343&&(i&=1023,a&=1023,o=i<<10|a,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},t.characterLength=function(r){var i=this.eastAsianWidth(r);return i=="F"||i=="W"||i=="A"?2:1};function n(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(r){for(var i=n(r),a=0,o=0;o<i.length;o++)a=a+this.characterLength(i[o]);return a},t.slice=function(r,i,a){textLen=t.length(r),i=i||0,a=a||1,i<0&&(i=textLen+i),a<0&&(a=textLen+a);for(var o="",s=0,u=n(r),l=0;l<u.length;l++){var c=u[l],p=t.length(c);if(s>=i-(p==2?1:0))if(s+p<=a)o+=c;else break;s+=p}return o}})(mi);var mu=mi.exports,fu=pi(mu),du=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Du=pi(du);function Wt(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=ci(e),e.length===0))return 0;e=e.replace(Du()," ");let n=t.ambiguousIsNarrow?1:2,r=0;for(let i of e){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(fu.eastAsianWidth(i)){case"F":case"W":r+=2;break;case"A":r+=n;break;default:r+=1}}return r}var cn=10,ri=(e=0)=>t=>`\x1B[${t+e}m`,ni=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,oi=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,q={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(q.modifier);var gu=Object.keys(q.color),Cu=Object.keys(q.bgColor);[...gu,...Cu];function hu(){let e=new Map;for(let[t,n]of Object.entries(q)){for(let[r,i]of Object.entries(n))q[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[r]=q[r],e.set(i[0],i[1]);Object.defineProperty(q,t,{value:n,enumerable:!1})}return Object.defineProperty(q,"codes",{value:e,enumerable:!1}),q.color.close="\x1B[39m",q.bgColor.close="\x1B[49m",q.color.ansi=ri(),q.color.ansi256=ni(),q.color.ansi16m=oi(),q.bgColor.ansi=ri(cn),q.bgColor.ansi256=ni(cn),q.bgColor.ansi16m=oi(cn),Object.defineProperties(q,{rgbToAnsi256:{value:(t,n,r)=>t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:t=>{let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(a=>a+a).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>q.rgbToAnsi256(...q.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,r,i;if(t>=232)n=((t-232)*10+8)/255,r=n,i=n;else{t-=16;let s=t%36;n=Math.floor(t/36)/5,r=Math.floor(s/6)/5,i=s%6/5}let a=Math.max(n,r,i)*2;if(a===0)return 30;let o=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(n));return a===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,n,r)=>q.ansi256ToAnsi(q.rgbToAnsi256(t,n,r)),enumerable:!1},hexToAnsi:{value:t=>q.ansi256ToAnsi(q.hexToAnsi256(t)),enumerable:!1}}),q}var Eu=hu(),wr=new Set(["\x1B","\x9B"]),xu=39,dn="\x07",fi="[",Fu="]",di="m",Dn=`${Fu}8;;`,ii=e=>`${wr.values().next().value}${fi}${e}${di}`,ai=e=>`${wr.values().next().value}${Dn}${e}${dn}`,yu=e=>e.split(" ").map(t=>Wt(t)),pn=(e,t,n)=>{let r=[...t],i=!1,a=!1,o=Wt(ci(e[e.length-1]));for(let[s,u]of r.entries()){let l=Wt(u);if(o+l<=n?e[e.length-1]+=u:(e.push(u),o=0),wr.has(u)&&(i=!0,a=r.slice(s+1).join("").startsWith(Dn)),i){a?u===dn&&(i=!1,a=!1):u===di&&(i=!1);continue}o+=l,o===n&&s<r.length-1&&(e.push(""),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Su=e=>{let t=e.split(" "),n=t.length;for(;n>0&&!(Wt(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},Au=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let r="",i,a,o=yu(e),s=[""];for(let[l,c]of e.split(" ").entries()){n.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=Wt(s[s.length-1]);if(l!==0&&(p>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(""),p=0),(p>0||n.trim===!1)&&(s[s.length-1]+=" ",p++)),n.hard&&o[l]>t){let m=t-p,C=1+Math.floor((o[l]-m-1)/t);Math.floor((o[l]-1)/t)<C&&s.push(""),pn(s,c,t);continue}if(p+o[l]>t&&p>0&&o[l]>0){if(n.wordWrap===!1&&p<t){pn(s,c,t);continue}s.push("")}if(p+o[l]>t&&n.wordWrap===!1){pn(s,c,t);continue}s[s.length-1]+=c}n.trim!==!1&&(s=s.map(l=>Su(l)));let u=[...s.join(`
248
+ `)];for(let[l,c]of u.entries()){if(r+=c,wr.has(c)){let{groups:m}=new RegExp(`(?:\\${fi}(?<code>\\d+)m|\\${Dn}(?<uri>.*)${dn})`).exec(u.slice(l).join(""))||{groups:{}};if(m.code!==void 0){let C=Number.parseFloat(m.code);i=C===xu?void 0:C}else m.uri!==void 0&&(a=m.uri.length===0?void 0:m.uri)}let p=Eu.codes.get(Number(i));u[l+1]===`
249
+ `?(a&&(r+=ai("")),i&&p&&(r+=ii(p))):c===`
250
+ `&&(i&&p&&(r+=ii(i)),a&&(r+=ai(a)))}return r};function si(e,t,n){return String(e).normalize().replace(/\r\n/g,`
251
+ `).split(`
252
+ `).map(r=>Au(r,t,n)).join(`
253
+ `)}var vu=Object.defineProperty,wu=(e,t,n)=>t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ee=(e,t,n)=>(wu(e,typeof t!="symbol"?t+"":t,n),n);function bu(e,t){if(e===t)return;let n=e.split(`
254
+ `),r=t.split(`
255
+ `),i=[];for(let a=0;a<Math.max(n.length,r.length);a++)n[a]!==r[a]&&i.push(a);return i}var Di=Symbol("clack:cancel");function ct(e){return e===Di}function Ar(e,t){e.isTTY&&e.setRawMode(t)}var ui=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Pu=new Set(["up","down","left","right","space","enter"]),fn=class{constructor({render:t,input:n=wt.stdin,output:r=wt.stdout,...i},a=!0){Ee(this,"input"),Ee(this,"output"),Ee(this,"rl"),Ee(this,"opts"),Ee(this,"_track",!1),Ee(this,"_render"),Ee(this,"_cursor",0),Ee(this,"state","initial"),Ee(this,"value"),Ee(this,"error",""),Ee(this,"subscribers",new Map),Ee(this,"_prevFrame",""),this.opts=i,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=a,this.input=n,this.output=r}prompt(){let t=new li.WriteStream(0);return t._write=(n,r,i)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),i()},this.input.pipe(t),this.rl=mn.default.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),mn.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Ar(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((n,r)=>{this.once("submit",()=>{this.output.write(ie.cursor.show),this.output.off("resize",this.render),Ar(this.input,!1),n(this.value)}),this.once("cancel",()=>{this.output.write(ie.cursor.show),this.output.off("resize",this.render),Ar(this.input,!1),n(Di)})})}on(t,n){let r=this.subscribers.get(t)??[];r.push({cb:n}),this.subscribers.set(t,r)}once(t,n){let r=this.subscribers.get(t)??[];r.push({cb:n,once:!0}),this.subscribers.set(t,r)}emit(t,...n){let r=this.subscribers.get(t)??[],i=[];for(let a of r)a.cb(...n),a.once&&i.push(()=>r.splice(r.indexOf(a),1));for(let a of i)a()}unsubscribe(){this.subscribers.clear()}onKeypress(t,n){if(this.state==="error"&&(this.state="active"),n?.name&&!this._track&&ui.has(n.name)&&this.emit("cursor",ui.get(n.name)),n?.name&&Pu.has(n.name)&&this.emit("cursor",n.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),n?.name==="return"){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
256
+ `),Ar(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=si(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
257
+ `).length-1;this.output.write(ie.cursor.move(-999,t*-1))}render(){let t=si(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(ie.cursor.hide);else{let n=bu(this._prevFrame,t);if(this.restoreCursor(),n&&n?.length===1){let r=n[0];this.output.write(ie.cursor.move(0,r)),this.output.write(ie.erase.lines(1));let i=t.split(`
258
+ `);this.output.write(i[r]),this._prevFrame=t,this.output.write(ie.cursor.move(0,i.length-r-1));return}else if(n&&n?.length>1){let r=n[0];this.output.write(ie.cursor.move(0,r)),this.output.write(ie.erase.down());let i=t.split(`
259
+ `).slice(r);this.output.write(i.join(`
260
+ `)),this._prevFrame=t;return}this.output.write(ie.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}},vr=class extends fn{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",n=>{this.output.write(ie.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var Tu=globalThis.process.platform.startsWith("win");function gi({input:e=wt.stdin,output:t=wt.stdout,overwrite:n=!0,hideCursor:r=!0}={}){let i=Ze.createInterface({input:e,output:t,prompt:"",tabSize:1});Ze.emitKeypressEvents(e,i),e.isTTY&&e.setRawMode(!0);let a=(o,{name:s})=>{if(String(o)===""){r&&t.write(ie.cursor.show),process.exit(0);return}if(!n)return;Ze.moveCursor(t,s==="return"?0:-1,s==="return"?-1:0,()=>{Ze.clearLine(t,1,()=>{e.once("keypress",a)})})};return r&&t.write(ie.cursor.hide),e.once("keypress",a),()=>{e.off("keypress",a),r&&t.write(ie.cursor.show),e.isTTY&&!Tu&&e.setRawMode(!1),i.terminal=!1,i.close()}}var xe=k(require("node:process"),1),T=k(Sr(),1),bt=k(un(),1);function Iu(){return xe.default.platform!=="win32"?xe.default.env.TERM!=="linux":!!xe.default.env.CI||!!xe.default.env.WT_SESSION||!!xe.default.env.TERMINUS_SUBLIME||xe.default.env.ConEmuTask==="{cmd::Cmder}"||xe.default.env.TERM_PROGRAM==="Terminus-Sublime"||xe.default.env.TERM_PROGRAM==="vscode"||xe.default.env.TERM==="xterm-256color"||xe.default.env.TERM==="alacritty"||xe.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var gn=Iu(),H=(e,t)=>gn?e:t,Bu=H("\u25C6","*"),Ei=H("\u25A0","x"),xi=H("\u25B2","x"),Cn=H("\u25C7","o"),mf=H("\u250C","T"),Ue=H("\u2502","|"),Fi=H("\u2514","\u2014"),Ci=H("\u25CF",">"),hi=H("\u25CB"," "),ff=H("\u25FB","[\u2022]"),df=H("\u25FC","[+]"),Df=H("\u25FB","[ ]"),gf=H("\u25AA","\u2022"),Cf=H("\u2500","-"),hf=H("\u256E","+"),Ef=H("\u251C","+"),xf=H("\u256F","+"),Ru=H("\u25CF","\u2022"),Nu=H("\u25C6","*"),$u=H("\u25B2","!"),ku=H("\u25A0","x"),Ou=e=>{switch(e){case"initial":case"active":return T.default.cyan(Bu);case"cancel":return T.default.red(Ei);case"error":return T.default.yellow(xi);case"submit":return T.default.green(Cn)}};var Jt=e=>{let t=e.active??"Yes",n=e.inactive??"No";return new vr({active:t,inactive:n,initialValue:e.initialValue??!0,render(){let r=`${T.default.gray(Ue)}
261
+ ${Ou(this.state)} ${e.message}
262
+ `,i=this.value?t:n;switch(this.state){case"submit":return`${r}${T.default.gray(Ue)} ${T.default.dim(i)}`;case"cancel":return`${r}${T.default.gray(Ue)} ${T.default.strikethrough(T.default.dim(i))}
263
+ ${T.default.gray(Ue)}`;default:return`${r}${T.default.cyan(Ue)} ${this.value?`${T.default.green(Ci)} ${t}`:`${T.default.dim(hi)} ${T.default.dim(t)}`} ${T.default.dim("/")} ${this.value?`${T.default.dim(hi)} ${T.default.dim(n)}`:`${T.default.green(Ci)} ${n}`}
264
+ ${T.default.cyan(Fi)}
265
+ `}}}).prompt()};var Gt=(e="")=>{process.stdout.write(`${T.default.gray(Fi)} ${T.default.red(e)}
266
+
267
+ `)};var le={message:(e="",{symbol:t=T.default.gray(Ue)}={})=>{let n=[`${T.default.gray(Ue)}`];if(e){let[r,...i]=e.split(`
268
+ `);n.push(`${t} ${r}`,...i.map(a=>`${T.default.gray(Ue)} ${a}`))}process.stdout.write(`${n.join(`
269
+ `)}
270
+ `)},info:e=>{le.message(e,{symbol:T.default.blue(Ru)})},success:e=>{le.message(e,{symbol:T.default.green(Nu)})},step:e=>{le.message(e,{symbol:T.default.green(Cn)})},warn:e=>{le.message(e,{symbol:T.default.yellow($u)})},warning:e=>{le.warn(e)},error:e=>{le.message(e,{symbol:T.default.red(ku)})}},Pt=()=>{let e=gn?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=gn?80:120,n,r,i=!1,a="",o=C=>{let d=C>1?"Something went wrong":"Canceled";i&&m(d,C)},s=()=>o(2),u=()=>o(1),l=()=>{process.on("uncaughtExceptionMonitor",s),process.on("unhandledRejection",s),process.on("SIGINT",u),process.on("SIGTERM",u),process.on("exit",o)},c=()=>{process.removeListener("uncaughtExceptionMonitor",s),process.removeListener("unhandledRejection",s),process.removeListener("SIGINT",u),process.removeListener("SIGTERM",u),process.removeListener("exit",o)},p=(C="")=>{i=!0,n=gi(),a=C.replace(/\.+$/,""),process.stdout.write(`${T.default.gray(Ue)}
271
+ `);let d=0,g=0;l(),r=setInterval(()=>{let D=T.default.magenta(e[d]),f=".".repeat(Math.floor(g)).slice(0,3);process.stdout.write(bt.cursor.move(-999,0)),process.stdout.write(bt.erase.down(1)),process.stdout.write(`${D} ${a}${f}`),d=d+1<e.length?d+1:0,g=g<e.length?g+.125:0},t)},m=(C="",d=0)=>{a=C??a,i=!1,clearInterval(r);let g=d===0?T.default.green(Cn):d===1?T.default.red(Ei):T.default.red(xi);process.stdout.write(bt.cursor.move(-999,0)),process.stdout.write(bt.erase.down(1)),process.stdout.write(`${g} ${a}
272
+ `),c(),n()};return{start:p,stop:m,message:(C="")=>{a=C??a}}};var jt=k(Sr(),1),Xe=k(require("@sentry/node"),1);var G=k(require("typescript"),1);var mo=k(require("@sentry/node"),1);var Y=k(Sr(),1);async function Pe(e){let t=yi(e),n=await e.readFile(t);return typeof n=="string"?JSON.parse(n):{}}async function Te(e,t){t=typeof t=="object"&&t!=null?t:{};let n=yi(e);await e.writeFile(n,JSON.stringify(t??{},null,2))}function yi(e){let t=e.getAppRootDir();return e.join(t,"node_modules",".builder","builder-cache.json")}async function et(e,t,n){let r={envKey:n,envValue:null,file:""};for(let i of t){let a=e.join(e.getAppRootDir(),i),o=await Lu(e,a);if(o){let s=o[n];if(typeof s=="string"&&s.length>0&&s!=="YOUR_API_KEY")return r.envValue=s,r.file=a,r}}return r.file=e.join(e.getAppRootDir(),t[t.length-1]),r}async function Lu(e,t){let n=await e.readFile(t);return typeof n=="string"?Si(n):null}function Si(e){let t={},n=e.replace(/\r\n?/gm,`
273
+ `),r;for(;(r=_u.exec(n))!=null;){let i=r[1],a=r[2]||"";a=a.trim();let o=a[0];a=a.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),o==='"'&&(a=a.replace(/\\n/g,`
274
+ `),a=a.replace(/\\r/g,"\r")),t[i]=a}return t}var _u=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;async function tt(e,t,n,r){let i="# https://www.builder.io/c/docs/using-your-api-key",a=await e.readFile(t);if(a)if(a.includes(n))if(a.includes(r))e.debug(`"${n}" with "${r}" already set in ${t}`);else return e.debug(`Replace "${n}" in ${t}`),a=a.replace(new RegExp(`${n}=.*`),`${n}=${r}`),await e.writeFile(t,a),"update";else return e.debug(`Append "${n}" to ${t}`),a+=`
275
+
276
+ ${i}
277
+ ${n}=${r}
278
+
279
+ `,await e.writeFile(t,a),"update";else return e.debug(`Creating new .env file with "${n}" at ${t}`),a=[i,`${n}=${r}`,""].join(`
280
+ `),await e.writeFile(t,a),"create";return null}async function Ht(e){return await et(e,[".env.local",".env.development.local",".env.production.local",".env.development",".env.production",".env"],Ie)}async function Ai(e,t){let n=await Ht(e),r=await tt(e,n.file,n.envKey,t);return{...n,modifiedType:r}}var Ie="NEXT_PUBLIC_BUILDER_API_KEY";function Tt(e,t,n,r,i=!0){let a=t.properties.filter(s=>e.ts.isPropertyAssignment(s)),o=ju(e,t,n);return o>-1?r==null&&i?e.ts.factory.updateObjectLiteralExpression(t,a.filter((s,u)=>u!==o)):(a[o]=e.ts.factory.updatePropertyAssignment(a[o],a[o].name,Qt(e,r)),e.ts.factory.updateObjectLiteralExpression(t,a)):(r!=null&&a.push(e.ts.factory.createPropertyAssignment(n,Qt(e,r))),e.ts.factory.updateObjectLiteralExpression(t,a))}function ju(e,t,n){return t.properties.findIndex(r=>L(e,r)===n)}function Yt(e,t){switch(t.kind){case e.ts.SyntaxKind.ArrayLiteralExpression:return Vu(e,t);case e.ts.SyntaxKind.ObjectLiteralExpression:return Mu(e,t);case e.ts.SyntaxKind.StringLiteral:return t.text;case e.ts.SyntaxKind.NumericLiteral:return Number(t.text);case e.ts.SyntaxKind.NoSubstitutionTemplateLiteral:return t.text;case e.ts.SyntaxKind.TrueKeyword:return!0;case e.ts.SyntaxKind.FalseKeyword:return!1;case e.ts.SyntaxKind.Identifier:switch(t.escapedText){case"undefined":return;case"null":return null;case"String":return String;case"Number":return Number;case"Boolean":return Boolean;case"NaN":return NaN}}}function Mu(e,t){let n={};if(t&&e.ts.isObjectLiteralExpression(t)){for(let r of t.properties)if(e.ts.isPropertyAssignment(r)){let i=L(e,r);i&&(n[i]=Yt(e,r.initializer))}}return n}function Vu(e,t){return t&&e.ts.isArrayLiteralExpression(t)?t.elements.map(n=>Yt(e,n)):[]}function L(e,t){if(t&&e.ts.isPropertyAssignment(t)){let n=t.name;switch(n.kind){case e.ts.SyntaxKind.Identifier:return n.text;case e.ts.SyntaxKind.StringLiteral:case e.ts.SyntaxKind.NumericLiteral:return n.text;case e.ts.SyntaxKind.ComputedPropertyName:let r=n.expression;if(e.ts.isStringLiteral(r)||e.ts.isNumericLiteral(r))return n.expression.text}}}function Qt(e,t){return hn(e,t,new WeakSet)}function hn(e,t,n){return t===void 0?e.ts.factory.createIdentifier("undefined"):t===null?e.ts.factory.createIdentifier("null"):typeof t=="string"?e.ts.factory.createStringLiteral(t):typeof t=="number"?isNaN(t)?e.ts.factory.createIdentifier("NaN"):e.ts.factory.createNumericLiteral(t):t===!0?e.ts.factory.createTrue():t===!1?e.ts.factory.createFalse():t===String?e.ts.factory.createIdentifier("String"):t===Number?e.ts.factory.createIdentifier("Number"):t===Boolean?e.ts.factory.createIdentifier("Boolean"):Array.isArray(t)?Ku(e,t,n):typeof t=="object"?Uu(e,t,n):e.ts.factory.createIdentifier(t)}function Ku(e,t,n){let r=t.map(i=>hn(e,i,n));return e.ts.factory.createArrayLiteralExpression(r,!0)}function Uu(e,t,n){if(n.has(t))return e.ts.factory.createIdentifier("undefined");n.add(t);let r=Object.keys(t).map(i=>e.ts.factory.createPropertyAssignment(i,hn(e,t[i],n)));return e.ts.factory.createObjectLiteralExpression(r,!0)}function pt(e,t,n){let r=[];if(!n)return r;let i=null;if(e.ts.isArrowFunction(n)||e.ts.isFunctionExpression(n)||e.ts.isFunctionDeclaration(n)){let a=n.parameters;if(a.length>0){let o=a[0],s=t.getTypeAtLocation(o);s.aliasTypeArguments&&s.aliasTypeArguments.length>0?i=s.aliasTypeArguments[0].getProperties():i=s.getProperties()}}else if(e.ts.isIdentifier(n)){let a=t.getTypeAtLocation(n),o=a.symbol?.valueDeclaration;if(o&&e.ts.isClassDeclaration(o)){let u=o.heritageClauses?.find(l=>l.token===e.ts.SyntaxKind.ExtendsKeyword)?.types;if(u){for(let l of u)if(t.getSymbolAtLocation(l.expression)?.name==="Component"){if(e.ts.isExpressionWithTypeArguments(l)){let p=l.typeArguments;if(p){let m=p[0];i=t.getTypeFromTypeNode(m).getProperties()}}break}}}if(!i){let s=a.getCallSignatures();if(s.length>0){let u=s[0].getParameters();u.length>0&&(i=t.getTypeOfSymbolAtLocation(u[0],n).getProperties())}}}else if(e.ts.isExportSpecifier(n)){let a=t.getSymbolAtLocation(n.name);if(a){let s=t.getTypeOfSymbolAtLocation(a,n).getCallSignatures();if(s.length>0){let u=s[0].getParameters();u.length>0&&(i=t.getTypeOfSymbolAtLocation(u[0],n).getProperties())}}}if(i)for(let a of i){let o=zu(e,t,a);o&&r.push(o)}return r=r.filter(wi),r.length>0?r:qu(e,n)}function zu(e,t,n){let r=n.valueDeclaration,i=n.getName();if(r||(r=n.getDeclarations()?.[0]),r&&e.ts.isPropertySignature(r)){if(i!=="children"&&r.getSourceFile().fileName.includes("node_modules/@types/"))return null;let a="string",o;if(r?.type){let u=t.getTypeFromTypeNode(r.type),l=t.typeToString(u),c=En(l);c.knownType?a=c.builderType:Ju(l)||u.flags&e.ts.TypeFlags.StringLike?a="string":u.flags&e.ts.TypeFlags.NumberLike?a="number":u.flags&e.ts.TypeFlags.IndexedAccess?a="list":u.flags&e.ts.TypeFlags.Object||u.isUnion()&&u.types.every(p=>p.flags&e.ts.TypeFlags.Object)||u.isIntersection()&&u.types.some(p=>p.flags&e.ts.TypeFlags.Object)?a="object":a="string",l!==a&&(o=l)}let s={name:i,type:a,isRegistered:!1};if(o&&r.type){let u=Yu(e,t,t.getTypeFromTypeNode(r.type));s.meta=s.meta||{},u&&u.length>0&&s.type==="string"&&u.every(Hu)?s.enum=u.map(Qu):s.meta.ts=o}return r.questionToken||(s.required=!0),s}return null}function qu(e,t){let n=[],r=e.ts.getJSDocCommentsAndTags(t);for(let i of r)if(!(!e.ts.isJSDoc(i)||!i.tags))for(let a of i.tags){if(!e.ts.isJSDocParameterTag(a)||a.tagName.text!=="param")continue;let s=a.typeExpression?.type;if(!s||!e.ts.isJSDocTypeLiteral(s))continue;let u=s.jsDocPropertyTags;if(u)for(let l of u){if(!e.ts.isJSDocPropertyLikeTag(l))continue;let c=l.name;if(!e.ts.isQualifiedName(c))continue;let p=l.typeExpression;if(!p)continue;let m="";switch(p.type.kind){case e.ts.SyntaxKind.StringKeyword:{m="string";break}case e.ts.SyntaxKind.NumberKeyword:{m="number";break}case e.ts.SyntaxKind.BooleanKeyword:{m="boolean";break}default:continue}let d={name:c.right.text,type:m,isRegistered:!1};n.push(d)}}return n.filter(wi)}var Wu=["ClassicComponent","FunctionComponent","IntrinsicElements","JSX","ReactNode","ReactElement","ReactPortal"];function Ju(e){return typeof e!="string"?!1:!!Wu.some(t=>e.includes(t))}function En(e){return typeof e=="string"&&(e=e.trim(),Gu.some(t=>t.value===e))?{builderType:e,knownType:!0}:{builderType:"string",knownType:!1}}var Gu=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}];function Hu(e){return/^['"].*['"]$/.test(e)}function Qu(e){return(e.startsWith('"')||e.startsWith("'"))&&(e.endsWith('"')||e.endsWith("'"))?e.slice(1,-1):e}var Yu=(e,t,n)=>{let r=new Set;vi(e,t,n,r);let i=r.delete("true"),a=r.delete("false");(i||a)&&r.add("boolean");let o=Array.from(r.keys()).sort();if(o.length>1&&(o=o.map(s=>s.indexOf("=>")>=0?`(${s})`:s)),!(o.length>20))return o},Xu=(e,t,n)=>{let r=e.ts.TypeFormatFlags.InElementType|e.ts.TypeFormatFlags.NoTruncation;return t.typeToString(n,void 0,r)},vi=(e,t,n,r)=>{if(n.isUnion())n.types.forEach(i=>{vi(e,t,i,r)});else if(n.isLiteral()){let i=Xu(e,t,n);r.add(i)}};function wi(e){let t=e?.name;if(typeof t!="string"||t===""||t.startsWith("aria")||t.startsWith("data-"))return!1;if(t.startsWith("on")&&t.length>2){let n=t.charAt(2);if(n.toUpperCase()===n)return!1}return!Zu.has(t.toLowerCase())}var Zu=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(e=>e.toLowerCase()));function me(e,t,n){for(let r of n.properties){if(!e.ts.isPropertyAssignment(r))continue;let i=L(e,r);if(i==="name"&&e.ts.isStringLiteral(r.initializer)){t.name=r.initializer.text;continue}if(i==="description"&&e.ts.isStringLiteral(r.initializer)){t.description=r.initializer.text;continue}if(i==="image"&&e.ts.isStringLiteral(r.initializer)){t.image=r.initializer.text;continue}if(i==="inputs"&&e.ts.isArrayLiteralExpression(r.initializer)){let a=el(e,r.initializer);De(t,a);continue}if(i==="meta"&&e.ts.isObjectLiteralExpression(r.initializer)){let a=Yt(e,r.initializer);a&&typeof a=="object"&&(t.meta=a);continue}}return t}function el(e,t){let n=[];for(let r of t.elements)e.ts.isObjectLiteralExpression(r)&&n.push(tl(e,r));return n}function tl(e,t){let n=Yt(e,t),r=ul(n);return r.isRegistered=!0,r}function Z(e,t,n){let r=nl(n);return t=Tt(e,t,"name",r.name,!1),t=Tt(e,t,"description",r.description),t=Tt(e,t,"image",r.image),t=Tt(e,t,"meta",r.meta),t=rl(e,t,r),ll(e,t)}function rl(e,t,n){let r=null,i=t.properties.filter(s=>e.ts.isPropertyAssignment(s)&&e.ts.isIdentifier(s.name)),a=i.findIndex(s=>e.ts.isIdentifier(s.name)&&s.name.text==="inputs"),o=[...n.inputs??[]];if(a>-1){if(o.length===0)return Tt(e,t,"inputs",null);let s=i[a];e.ts.isPropertyAssignment(s)&&e.ts.isArrayLiteralExpression(s.initializer)&&(r=s.initializer)}return o.length===0?t:(r=il(e,r||e.ts.factory.createArrayLiteralExpression(),o),a>-1?i[a]=e.ts.factory.updatePropertyAssignment(i[a],i[a].name,r):i.push(e.ts.factory.createPropertyAssignment("inputs",r)),e.ts.factory.updateObjectLiteralExpression(t,i))}function nl(e){return{name:e.name,description:e.description,image:e.image,inputs:(e.inputs||[]).filter(n=>n.isRegistered).map(ol),...e.meta?{meta:{...e.meta}}:{}}}function ol(e){let t={name:e.name,type:e.type};return(ue(e.defaultValue)||Vt(e.defaultValue)||xt(e.defaultValue))&&(t.defaultValue=e.defaultValue),ue(e.friendlyName)&&(t.friendlyName=e.friendlyName),ue(e.helperText)&&(t.helperText=e.helperText),e.required===!0&&(t.required=!0),Array.isArray(e.enum)&&(t.enum=e.enum),e.hideFromUI===!0&&(t.hideFromUI=!0),typeof e.meta=="object"&&e.meta!=null&&Object.keys(e.meta).length>0&&(t.meta=e.meta),t}function il(e,t,n){let r=t.elements.filter(i=>{if(!e.ts.isObjectLiteralExpression(i))return!1;let a=i.properties.find(s=>L(e,s)==="name");if(!a)return!1;let o=a.initializer;return e.ts.isStringLiteral(o)?n.some(s=>s.name===o.text):!1});for(let i of n)r=al(e,r,i);return r.sort((i,a)=>{let o=i.properties.find(m=>L(e,m)==="name"),s=a.properties.find(m=>L(e,m)==="name"),u=o?.initializer,l=s?.initializer,c=u&&e.ts.isStringLiteral(u)?u.text:"zz",p=l&&e.ts.isStringLiteral(l)?l.text:"zz";return c.toLowerCase().localeCompare(p.toLowerCase())}),e.ts.factory.updateArrayLiteralExpression(t,r)}function al(e,t,n){let r=t.findIndex(i=>i.properties.some(a=>{let o=L(e,a);return e.ts.isPropertyAssignment(a)&&o==="name"&&e.ts.isStringLiteral(a.initializer)&&a.initializer.text===n.name}));if(r>-1)t[r]=bi(e,t[r],n);else{let i=bi(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("name",e.ts.factory.createStringLiteral(n.name))],!0),n);t.push(i)}return t}function bi(e,t,n){let r=t.properties.filter(a=>e.ts.isPropertyAssignment(a)),i=Object.keys(n).filter(a=>a!=="isRegistered");for(let a of i)r=sl(e,r,n,a);return r=cl(e,r.filter(a=>{let o=L(e,a);return i.includes(o)})),e.ts.factory.updateObjectLiteralExpression(t,r)}function sl(e,t,n,r){let i=t.findIndex(a=>e.ts.isIdentifier(a.name)&&a.name.text===r);return i>-1?t[i]=e.ts.factory.updatePropertyAssignment(t[i],t[i].name,Qt(e,n[r])):t.push(e.ts.factory.createPropertyAssignment(r,Qt(e,n[r]))),t}function De(e,t){for(let n of t){let r=e.inputs.findIndex(i=>i.name===n.name);r>-1?(n.isRegistered||!e.inputs[r].isRegistered)&&(e.inputs[r]=n):e.inputs.push(n)}e.acceptsChildren=xn(e)}function ul(e){let t=En(e.type),n={name:e.name.trim(),type:t.builderType};return ue(e.friendlyName)&&e.friendlyName.trim()!==e.name.trim()&&(n.friendlyName=e.friendlyName),(ue(e.defaultValue)||Vt(e.defaultValue)||xt(e.defaultValue))&&(n.defaultValue=e.defaultValue),ue(e.helperText)&&(n.helperText=e.helperText),xt(e.required)&&(n.required=e.required),typeof e.meta=="object"&&e.meta!=null&&Object.keys(e.meta).length>0&&(n.meta=e.meta),Array.isArray(e.enum)&&e.enum.length>0&&(n.enum=e.enum),e.hideFromUI===!0&&(n.hideFromUI=!0),Fn(n)}function xn(e){let t=e.inputs.some(r=>r.name==="children"),n=e.inputs.some(r=>r.meta?.ts==="ReactNode");return!!(t||n||e.acceptsChildren===!0)}function Fn(e){if(e.name==="children"&&(e.hideFromUI=!0,delete e.required),e.type==="object"&&e.defaultValue==null&&(e.hideFromUI=!0),e.type==="list"&&e.defaultValue==null&&(e.hideFromUI=!0),e.meta){let t=e.meta.ts;typeof t=="string"&&(t=t.trim(),t.endsWith("ReactNode")&&(t="ReactNode"),e.meta.ts=t,t==="ReactNode"&&(e.hideFromUI=!0))}return e}function ll(e,t){let n=[...t.properties].sort((r,i)=>{let a=L(e,r)||"zz",o=L(e,i)||"zz";if(a==="inputs")return 1;let s=Pi.indexOf(a),u=Pi.indexOf(o);return s>-1?u>-1&&s>u?1:-1:u>-1?s>-1&&u<s?-1:1:a.localeCompare(o)});return e.ts.factory.updateObjectLiteralExpression(t,n)}var Pi=["component","name","description"];function cl(e,t){return[...t].sort((r,i)=>{let a=L(e,r)||"zz",o=L(e,i)||"zz",s=Ti.indexOf(a),u=Ti.indexOf(o);return s>-1?u>-1&&s>u?1:-1:u>-1?s>-1&&u<s?-1:1:a.localeCompare(o)})}var Ti=["name","type"];function It(e,t){for(let n of t.properties){if(!e.ts.isPropertyAssignment(n)||!e.ts.isIdentifier(n.name))continue;if(L(e,n)==="canHaveChildren"){let{initializer:i}=n;return i.kind===e.ts.SyntaxKind.TrueKeyword}}return!1}function Ii(e,t){let n=`Builder.registerComponent(
281
+ `;if(e.appDir)t.acceptsChildren?n+=` withChildren(${t.importName}),
282
+ `:n+=` ${t.importName},
283
+ `;else{let i=t.externalImportPath?t.externalImportPath:$(e,e.registryPath,t.filePath);t.exportName==="default"?t.acceptsChildren?n+=` withChildren(dynamic(() => import(${JSON.stringify(i)}))),
284
+ `:n+=` dynamic(() => import(${JSON.stringify(i)})),
285
+ `:t.acceptsChildren?n+=` withChildren(dynamic(async () => (await import(${JSON.stringify(i)})).${t.exportName})),
286
+ `:n+=` dynamic(async () => (await import(${JSON.stringify(i)})).${t.exportName}),
287
+ `}n+=` {
288
+ name: "${t.name}",
289
+ }
290
+ `,n+=");";let r=gr(e,n);return yn(e,r,t)}function yn(e,t,n){if(!e.ts.isExpressionStatement(t))return t;let r=t.expression;if(!e.ts.isCallExpression(r))return t;let i=[...r.arguments];if(i.length<2)return t;n.acceptsChildren?e.ts.isCallExpression(i[0])&&e.ts.isIdentifier(i[0].expression)&&i[0].expression.text==="withChildren"||(i[0]=e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("withChildren"),void 0,[i[0]])):e.ts.isCallExpression(i[0])&&e.ts.isIdentifier(i[0].expression)&&i[0].expression.text==="withChildren"&&(i[0]=i[0].arguments[0]);let a=i[1];return e.ts.isObjectLiteralExpression(a)?(i[1]=Z(e,a,n),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(r,r.expression,r.typeArguments,i))):t}function N(e,t,n,r="esm"){return Array.isArray(n.namedImports)&&n.namedImports.forEach(i=>{t=pl(e,t,i,n.importPath,!!n.isTypeOnly,r)}),typeof n.defaultImport=="string"&&(t=ml(e,t,n.defaultImport,n.importPath,r)),t}function pl(e,t,n,r,i,a){return a==="cjs"?Ri(e,t,null,n,r):Bi(e,t,null,n,r,i)}function ml(e,t,n,r,i){return i==="cjs"?Ri(e,t,n,null,r):Bi(e,t,n,null,r,!1)}function Bi(e,t,n,r,i,a){let o=[...t.statements],s=0,u=!1,l=!1;for(let C=0;C<o.length;C++){let d=o[C];if(!e.ts.isImportDeclaration(d)||(s=C,!d.moduleSpecifier||!e.ts.isStringLiteral(d.moduleSpecifier))||d.moduleSpecifier.text!==i||!!d.importClause?.isTypeOnly!==a)continue;let g=[],D=d.importClause?.namedBindings;if(D&&e.ts.isNamedImports(D)&&D.elements&&g.push(...D.elements),typeof r=="string"){if(g.some(E=>E.name.text===r))return t;g.push(e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(r))),g.sort((E,x)=>E.name.text.localeCompare(x.name.text)),u=!0}let f=d.importClause?d.importClause.name:void 0;if(typeof n=="string"){if(f&&f.text===n)return t;f=e.ts.factory.createIdentifier(n),l=!0}if(u||l)return o[C]=e.ts.factory.updateImportDeclaration(d,void 0,e.ts.factory.createImportClause(a,f,e.ts.factory.createNamedImports(g)),d.moduleSpecifier,void 0),e.ts.factory.updateSourceFile(t,o)}let c,p;typeof n=="string"&&(c=e.ts.factory.createIdentifier(n)),typeof r=="string"&&(p=e.ts.factory.createNamedImports([e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(r))]));let m=e.ts.factory.createImportDeclaration(void 0,e.ts.factory.createImportClause(a,c,p),e.ts.factory.createStringLiteral(i));return o.splice(s,0,m),e.ts.factory.updateSourceFile(t,o)}function Ri(e,t,n,r,i){let a=[...t.statements],o=0;for(let s=0;s<a.length;s++){let u=a[s];if(e.ts.isVariableStatement(u))for(let l=0;l<u.declarationList.declarations.length;l++){let c=[...u.declarationList.declarations],p=c[l],m=p.initializer;if(!m||!e.ts.isCallExpression(m))continue;let C=m.expression;if(!e.ts.isIdentifier(C)||C.text!=="require"||m.arguments.length!==1)continue;let d=m.arguments[0];if(e.ts.isStringLiteral(d)&&(o=s,d.text===i)){if(e.ts.isIdentifier(p.name)&&typeof n=="string")return p.name.text===n?t:(c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createIdentifier(n),p.exclamationToken,p.type,p.initializer),a[s]=e.ts.factory.updateVariableStatement(u,u.modifiers,e.ts.factory.updateVariableDeclarationList(u.declarationList,c)),e.ts.factory.updateSourceFile(t,a));if(e.ts.isObjectBindingPattern(p.name)&&typeof r=="string"){let g=[...p.name.elements];return g.some(f=>!e.ts.isBindingElement(f)||!e.ts.isIdentifier(f.name)?!1:f.name.text===r)?t:(g.push(e.ts.factory.createBindingElement(void 0,void 0,r)),g.sort((f,E)=>!e.ts.isBindingElement(f)||!e.ts.isIdentifier(f.name)||!e.ts.isBindingElement(E)||!e.ts.isIdentifier(E.name)?0:f.name.text.localeCompare(E.name.text)),c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createObjectBindingPattern(g),p.exclamationToken,p.type,p.initializer),a[s]=e.ts.factory.updateVariableStatement(u,u.modifiers,e.ts.factory.updateVariableDeclarationList(u.declarationList,c)),e.ts.factory.updateSourceFile(t,a))}}}}if(typeof n=="string"){let s=e.ts.factory.createVariableStatement(void 0,e.ts.factory.createVariableDeclarationList([e.ts.factory.createVariableDeclaration(n,void 0,void 0,e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("require"),void 0,[e.ts.factory.createStringLiteral(i)]))],e.ts.NodeFlags.Const));return a.splice(o,0,s),e.ts.factory.updateSourceFile(t,a)}if(typeof r=="string"){let s=e.ts.factory.createVariableStatement(void 0,e.ts.factory.createVariableDeclarationList([e.ts.factory.createVariableDeclaration(e.ts.factory.createObjectBindingPattern([e.ts.factory.createBindingElement(void 0,void 0,r)]),void 0,void 0,e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("require"),void 0,[e.ts.factory.createStringLiteral(i)]))],e.ts.NodeFlags.Const));return a.splice(o,0,s),e.ts.factory.updateSourceFile(t,a)}return t}function mt(e,t,n="esm"){return n==="cjs"?dl(e,t):fl(e,t)}function fl(e,t){let n=[];for(let r of t.statements){if(e.ts.isExportDeclaration(r)){if(r.exportClause&&e.ts.isNamedExports(r.exportClause)){for(let i of r.exportClause.elements)if(r.moduleSpecifier&&n.push({isDefaultExport:!1,statement:r,node:i}),e.ts.isIdentifier(i.name)){let a=i.name.text;for(let o of t.statements)if(e.ts.isVariableStatement(o))for(let s of o.declarationList.declarations)e.ts.isIdentifier(s.name)&&s.name.text===a&&n.push({isDefaultExport:!1,statement:o,node:o});else e.ts.isFunctionDeclaration(o)&&o.name&&o.name.text===a&&n.push({isDefaultExport:!1,statement:o,node:o})}}else!r.exportClause&&r.moduleSpecifier&&n.push({isDefaultExport:!1,statement:r,node:r});continue}if(e.ts.isExportAssignment(r)){let i=r.flags===e.ts.NodeFlags.None,a=r.expression;if(e.ts.isIdentifier(a)){let o=a.text;for(let s of t.statements){if(e.ts.isVariableStatement(s))for(let u of s.declarationList.declarations)e.ts.isIdentifier(u.name)&&u.name.text===o&&n.push({isDefaultExport:i,statement:s,node:s});e.ts.isFunctionDeclaration(s)&&s.name?.text===o&&n.push({isDefaultExport:i,statement:s,node:s})}}else(e.ts.isArrowFunction(a)||e.ts.isCallExpression(a)||e.ts.isFunctionDeclaration(a)||e.ts.isObjectLiteralExpression(a))&&n.push({isDefaultExport:i,statement:r,node:a});continue}if((e.ts.isVariableStatement(r)||e.ts.isFunctionDeclaration(r))&&r.modifiers&&r.modifiers.some(i=>i.kind===e.ts.SyntaxKind.ExportKeyword)){n.push({isDefaultExport:r.modifiers.some(i=>i.kind===e.ts.SyntaxKind.DefaultKeyword),statement:r,node:r});continue}}return n}function dl(e,t){let n=[];for(let r of t.statements)if(e.ts.isExpressionStatement(r)&&e.ts.isBinaryExpression(r.expression)&&e.ts.isPropertyAccessExpression(r.expression.left)){let i=r.expression.left,a=r.expression.right;if(!e.ts.isIdentifier(i.expression))continue;if(i.expression.text==="module"&&i.name.text==="exports"){if(e.ts.isIdentifier(a)){let o=a.text;for(let s of t.statements)if(e.ts.isVariableStatement(s))for(let u of s.declarationList.declarations)e.ts.isIdentifier(u.name)&&u.name.text===o&&n.push({isDefaultExport:!0,statement:s,node:s});else e.ts.isFunctionDeclaration(s)&&s.name&&s.name.text===o&&n.push({isDefaultExport:!0,statement:s,node:s})}else n.push({isDefaultExport:!0,statement:r,node:a});continue}}return n}function Dl(e,t,n){for(let r of t.statements)if(e.ts.isImportDeclaration(r)&&r.importClause){if(r.importClause.namedBindings&&e.ts.isNamedImports(r.importClause.namedBindings)){for(let i of r.importClause.namedBindings.elements)if(e.ts.isIdentifier(i.name)&&i.name.text===n&&e.ts.isStringLiteral(r.moduleSpecifier))return{importPath:r.moduleSpecifier.text,exportType:"named"}}if(r.importClause.name&&r.importClause.name.text===n&&e.ts.isStringLiteral(r.moduleSpecifier))return{importPath:r.moduleSpecifier.text,exportType:"default"}}return null}async function Be(e,t,n,r){let i=Dl(e,n,r);if(i){let a=await Xt(e,e.normalize(e.resolve(e.dirname(t),i.importPath))),o=e.relative(e.getAppRootDir(),a);return{displayFilePath:O(e,a),filePath:a,relFilePath:o,importPath:i.importPath,exportType:i.exportType}}return null}function Bt(e,t,n){for(let r=0;r<t.statements.length;r++){let i=t.statements[r];if(e.ts.isVariableStatement(i)){for(let a of i.declarationList.declarations)if(e.ts.isIdentifier(a.name)&&a.name.text===n)return{statement:i,statementIndex:r}}}return null}function Q(e,t,n){let r=Bt(e,t,n);if(r&&r.statement.declarationList.declarations.length>0){let i=r.statement.declarationList.declarations[0];if(i.initializer&&e.ts.isArrayLiteralExpression(i.initializer))return{statement:r.statement,statementIndex:r.statementIndex,variableDeclaration:i,arrayLiteralExp:i.initializer}}return null}function br(e,t){if(t){if(gl(e,t))return!0;let n=!1;if(t.forEachChild(r=>{br(e,r)&&(n=!0)}),n)return!0}return!1}function gl(e,t){return e.ts.isJsxElement(t)||e.ts.isJsxOpeningElement(t)||e.ts.isJsxOpeningFragment(t)||e.ts.isJsxSelfClosingElement(t)||e.ts.isJsxFragment(t)||e.ts.isJsxChild(t)}async function Xt(e,t){let n=e.extname(t).toLowerCase();if(n===""||!Sn.includes(n)){for(let r of Sn){let i=t+r;if(await e.exists(i))return i}for(let r of Sn){let i=e.join(t,"index"+r);if(await e.exists(i))return i}}return t}var Sn=[".tsx",".jsx",".ts",".js"];function Rt(e,t,n){if(!n||!t)return;let r=t.getSymbolAtLocation(n);if(!r)return;let i=r.valueDeclaration;if(!i)return;let a=i.getSourceFile().fileName,o=Cl(e,a);return o?[{name:o}]:void 0}function Cl(e,t){if(typeof t=="string"){t=e.normalize(ye(t));let n=t.split("/"),r=n.lastIndexOf("node_modules");if(r>-1){let i=n.slice(r+1),a=i[0];if(a)return a.startsWith("@")&&i[1]&&(a+="/"+i[1]),a}}}function Re(e){let t=[];for(let n of e)if(n.dependencies)for(let r of n.dependencies)t.some(i=>i.name===r.name)||t.push({...r});return t.sort((n,r)=>n.name.localeCompare(r.name))}function Ni(e,t,n="esm"){return n==="cjs"?xl(e,t):El(e,t)}var hl=/^(@\w|\w)/;function El(e,t){let n=[];for(let r of t.statements)if(e.ts.isImportDeclaration(r)&&e.ts.isLiteralExpression(r.moduleSpecifier)){if(!hl.test(r.moduleSpecifier.text)||r.importClause?.isTypeOnly)continue;if(r.importClause&&r.importClause.namedBindings&&e.ts.isNamedImports(r.importClause.namedBindings))for(let i of r.importClause.namedBindings.elements)i.isTypeOnly||n.push({isDefaultExport:!1,statement:r,node:i.name});r.importClause&&r.importClause.name&&n.push({isDefaultExport:!0,statement:r,node:r.importClause.name})}return n}function xl(e,t){return[]}async function Nt(e,t){if(!t.some(o=>!o.isRegistered))return t;let r=await X(e,t.map(o=>o.filePath)),i=r.getTypeChecker();return await Promise.all(t.map(async o=>{let s=r.getSourceFile(o.filePath);if(s){let l=(await rt(e,i,o.filePath,s,!1)).find(c=>c.cmpInfo.id===o.id);l&&(o.inputs=pt(e,i,l.node.fnNode))}return o}))}async function $t(e,t,n,r){if(t.node.fnNode){let{sourceFile:i,typeChecker:a}=await yt(e,t.cmpInfo.filePath,n),s=(await rt(e,a,t.cmpInfo.filePath,i,r)).find(u=>u.cmpInfo.id===t.cmpInfo.id);if(!s)throw new Error(`createComponentInputs() Could not find component ${t.cmpInfo.name} in ${t.cmpInfo.filePath}`);return pt(e,a,s.node.fnNode)}return[]}async function ki(e,t,n){let r=e.extname(t).toLowerCase();if(r===".tsx"||r===".jsx"||r===".ts"||r===".js"){let i=await e.readFile(t);if(i)return Fl(e,t,i,n)}return null}function Fl(e,t,n,r=!1){let i=B(e,n);return rt(e,null,t,i,r)}async function rt(e,t,n,r,i){let a=[];for(let s of r.statements)if(e.ts.isExpressionStatement(s)&&e.ts.isStringLiteral(s.expression)&&s.expression.text==="use server")return a;let o=mt(e,r);return i&&o.push(...Ni(e,r)),n=e.normalize(n),await Promise.all(o.map(async s=>{let u=await yl(e,t,n,s);a.push(...u)})),a}async function yl(e,t,n,r){let i=[],a=e.relative(e.getAppRootDir(),n),o=M(e,n);if(e.ts.isVariableStatement(r.node)){for(let s of r.node.declarationList.declarations){if(!e.ts.isIdentifier(s.name)||!Ft(s.name.text))continue;let u=ze(e,t,s.initializer);if(u){let l=u.name||s.name.text,c=r.isDefaultExport?"default":l,p=r.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await V(e,n,c),displayFilePath:O(e,n),name:K(l),inputs:[],exportName:c,exportType:p,importName:l,filePath:n,relFilePath:a,importPath:o,dependencies:u.deps},node:u})}}return i}if(e.ts.isArrowFunction(r.node)){let s=ze(e,t,r.node);if(s){let u=Ce(e,n),l=r.isDefaultExport?"default":u,c=r.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await V(e,n,l),displayFilePath:O(e,n),name:u,inputs:[],exportName:l,exportType:c,importName:lt(e,n),filePath:n,relFilePath:a,importPath:o,dependencies:s.deps},node:s})}return i}if(e.ts.isFunctionExpression(r.node)||e.ts.isFunctionDeclaration(r.node)){let s=r.node.name?.text;if(s&&!Ft(s))return i;let u=ze(e,t,r.node);if(u){let l=u.name||Ce(e,n),c=r.isDefaultExport||!u.name?"default":u.name,p=r.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await V(e,n,c),displayFilePath:O(e,n),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||lt(e,n),filePath:n,relFilePath:a,importPath:o,dependencies:u.deps},node:u})}return i}if((e.ts.isExportSpecifier(r.node)||e.ts.isIdentifier(r.node))&&Ft(r.node.getText())){let s,u=ze(e,t,r.node);if(u){let l=u.name||Ce(e,n),c=r.isDefaultExport||!u.name?"default":u.name,p=r.isDefaultExport?"default":"named",m=Sl(e,r.node)?.moduleSpecifier??Al(e,r.node)?.moduleSpecifier;if(m&&e.ts.isStringLiteral(m)){let C=t?.getSymbolAtLocation(m);if(C&&C.declarations&&C.declarations.length>0){let d=C.declarations[0];(!e.ts.isSourceFile(d)||e.ts.isSourceFile(d)&&d.fileName.includes("node_modules"))&&(s=m.text)}}i.push({cmpInfo:{id:await V(e,n,c,s),displayFilePath:O(e,n),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||lt(e,n),filePath:n,relFilePath:a,importPath:s||o,externalImportPath:s,dependencies:u.deps},node:u})}return i}if(e.ts.isExportDeclaration(r.node)&&r.node.exportClause===void 0){let s=r.node.moduleSpecifier;if(s&&e.ts.isStringLiteral(s)){let u=await wl(e,t,n,s);i.push(...u)}return i}return i}function Sl(e,t){for(;t;){if(e.ts.isExportDeclaration(t))return t;t=t.parent}return null}function Al(e,t){for(;t;){if(e.ts.isImportDeclaration(t))return t;t=t.parent}return null}function ze(e,t,n){if(!n)return null;if(e.ts.isArrowFunction(n))return br(e,n.body)?{name:"",fnNode:n,deps:Rt(e,t,n)}:null;if(e.ts.isFunctionExpression(n)||e.ts.isFunctionDeclaration(n))return br(e,n.body)?{name:n.name?.text||"",fnNode:n,deps:Rt(e,t,n)}:null;if(e.ts.isCallExpression(n)){let r=n.expression;if(e.ts.isPropertyAccessExpression(r)){let i=n.arguments;if(i.length===0)return null;let a=r.expression;if(!e.ts.isIdentifier(a)||a.text!=="React")return null;let o=r.name;return!e.ts.isIdentifier(o)||o.text!=="forwardRef"?null:ze(e,t,i[0])}else if(e.ts.isIdentifier(r)&&r.text==="observer"){let i=n.arguments;return i.length===0?null:ze(e,t,i[0])}return null}if(!t)return null;if(e.ts.isPropertyAccessExpression(n)){let r=n.expression,i=n.name;if(!e.ts.isIdentifier(r)||!e.ts.isIdentifier(i)||!Ft(i.text))return null;let o=t.getTypeAtLocation(i).getCallSignatures();if(o.length>0&&o[0].getParameters().length>0)return{name:"",fnNode:i,deps:Rt(e,t,i)}}if(e.ts.isExportSpecifier(n)){let r=n.name;return{name:r.text||"",fnNode:r,deps:Rt(e,t,r)}}if(e.ts.isIdentifier(n))return{name:n.text||"",fnNode:n,deps:Rt(e,t,n)};if(e.ts.isExpressionStatement(n)){let r=n.expression;if(e.ts.isAsExpression(r)&&e.ts.isIdentifier(r.type)&&r.type.text==="default")return ze(e,t,r.expression)}if(e.ts.isVariableStatement(n)){for(let r of n.declarationList.declarations)if(r.initializer&&e.ts.isAsExpression(r.initializer)){let i=r.initializer;if(e.ts.isIdentifier(i.type)&&i.type.text==="default"){let a=ze(e,t,i.expression);if(a&&e.ts.isIdentifier(r.name))return{name:r.name.text,fnNode:a.fnNode,deps:a.deps}}}}return null}async function Oi(e,t){let n=[],r=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(r.map(async a=>{let o=e.normalize(a.fileName);if(Cr(e,vl,a.fileName)||o===e.reactConfigPath||o===e.builderComponentPath)return;let s=await rt(e,i,o,a,o===e.registryPath);n.push(...s)})),n.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var vl=new Set(["node_modules","dist"]);async function wl(e,t,n,r){let i=[],a=r.text;if(!t)return i;try{let o=t.getSymbolAtLocation(r);if(!o)return i;let s=t.getExportsOfModule(o);for(let u of s){let l=u.valueDeclaration||u.declarations?.[0];if(!l)continue;let c=u.name;if(!Ft(c)&&c!=="default"||!Li(e,t,l))continue;let p=ze(e,t,l);if(p){let m=u.name,C=m==="default"?"default":"named",d=K(m),g=m==="default"?lt(e,n):m;i.push({cmpInfo:{id:await V(e,n,m,a),displayFilePath:O(e,n),name:d,inputs:[],exportName:m,exportType:C,importName:g,filePath:n,relFilePath:e.relative(e.getAppRootDir(),n),importPath:a,externalImportPath:a,dependencies:p.deps},node:p})}}}catch(o){console.error(`Error processing module ${a}:`,o)}return i}function Li(e,t,n){if(e.ts.isInterfaceDeclaration(n)||e.ts.isTypeAliasDeclaration(n))return!1;if(e.ts.isExportSpecifier(n)){let r=t.getSymbolAtLocation(n.name);if(r){let a=t.getAliasedSymbol(r).declarations?.[0];if(a)return Li(e,t,a)}return!1}if(e.ts.isFunctionDeclaration(n)||e.ts.isArrowFunction(n)||e.ts.isFunctionExpression(n)){let r=t.getSignatureFromDeclaration(n);if(r){let i=t.getReturnTypeOfSignature(r);return $i(i,t)}}return e.ts.isClassDeclaration(n)?n.heritageClauses?.some(i=>i.types.some(a=>a.expression.getText()==="React.Component"||a.expression.getText()==="Component"))??!1:e.ts.isVariableDeclaration(n)?t.getTypeAtLocation(n).getCallSignatures().some(a=>$i(t.getReturnTypeOfSignature(a),t)):!1}function $i(e,t){let n=t.typeToString(e);return n==="JSX.Element"||n==="Element"||n.includes("ReactElement")||n.includes("React.ReactElement")||n.includes("ReactNode")}async function _i(e,t){let n=[],r=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(r.map(async a=>{let o=e.basename(a.fileName);if(e.appDir&&bl.has(o)||e.dirname(a.fileName).includes("node_modules"))return;let s=e.normalize(a.fileName);if(s===e.nextConfigPath||s===e.builderComponentPath)return;let u=await rt(e,i,s,a,s===e.registryPath||ge(s));n.push(...u)})),n.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var bl=new Set(["default.tsx","default.ts","default.jsx","default.js","error.tsx","error.ts","error.jsx","error.js","layout.tsx","layout.ts","layout.jsx","layout.js","loading.tsx","loading.ts","loading.jsx","loading.js","not-found.tsx","not-found.ts","not-found.jsx","not-found.js","page.tsx","page.ts","page.jsx","page.js","route.tsx","route.ts","route.jsx","route.js","template.tsx","template.ts","template.jsx","template.js"]);function Ne(e,t){let n=[],r=[],i=[],a=[];for(let o of t.statements){if(e.ts.isImportDeclaration(o)){if(e.ts.isStringLiteral(o.moduleSpecifier)){let u=o.moduleSpecifier.text;if(!u.startsWith(".")&&!u.startsWith("/")){n.push(o);continue}}let s=o.importClause;if(s){if(s.namedBindings){r.push(o);continue}if(s.name){r.push(o);continue}}i.push(o);continue}a.push(o)}return e.ts.factory.updateSourceFile(t,[...An(e,n),...An(e,r),...An(e,i),...a])}function Se(e){let t=e.split(`
291
+ `).map(r=>r.trimEnd());e="";let n=!1;for(let r=t.length-1;r>=0;r--){let i=t[r];!n&&i.startsWith("import ")&&(n=!0,i=i+`
292
+ `),/^builder.init(.*)$/.test(i)&&(i=i+`
293
+ `),t[r-1]&&!t[r-1].includes("*/")&&(i.trim().startsWith("Builder.registerComponent")&&(i=`
294
+ `+i),i.trim().startsWith("/**")&&(i=`
295
+ `+i),i.trim().startsWith("module.exports")&&(i=`
296
+ `+i),i.trim().startsWith("export ")&&(i=`
297
+ `+i)),e=i+`
298
+ `+e}return e.trim()+`
299
+ `}function An(e,t){return t.sort((n,r)=>{let i=ji(e,n),a=ji(e,r);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())})}function ji(e,t){let n=t.importClause;if(n){let r=n.namedBindings;if(r&&e.ts.isNamedImports(r)&&r.elements.length>0)return r.elements[0].name.text;if(n.name)return n.name.text}return t.moduleSpecifier&&e.ts.isStringLiteral(t.moduleSpecifier)?t.moduleSpecifier.text:""}function Vi(e){return typeof e=="string"&&!e.includes("'use client'")&&!e.includes(`"use client"'`)&&(e=`"use client"
300
+ ${e}`),e}function Ki(e,t){let n=t.statements.filter(r=>!(e.ts.isExpressionStatement(r)&&e.ts.isStringLiteral(r.expression)&&e.ts.isStringLiteral(r.expression)&&r.expression.text==="use client"));return e.ts.factory.updateSourceFile(t,n)}function $e(e,t){return t.sort((n,r)=>{if(e.ts.isObjectLiteralExpression(n)&&e.ts.isObjectLiteralExpression(r)){let i=Mi(e,n),a=Mi(e,r);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())}return 1})}function Mi(e,t){let n=t.properties.find(r=>L(e,r)==="name");return n&&e.ts.isPropertyAssignment(n)&&e.ts.isStringLiteral(n.initializer)?n.initializer.text:"zzzz"}async function Ui(e){let t=await e.readFile(e.registryPath);return t?Pl(e,t):{components:[],sourceFile:B(e,"")}}async function Pl(e,t){let n=B(e,t);return e.sdkVersion===w.gen2?Il(e,n):Tl(e,n)}async function Tl(e,t){let n=[];for(let r=0;r<t.statements.length;r++){let i=t.statements[r];if(!e.ts.isExpressionStatement(i))continue;let a=i.expression;if(!e.ts.isCallExpression(a))continue;let o=a.expression;if(!e.ts.isPropertyAccessExpression(o))continue;let s=o.expression;if(!e.ts.isIdentifier(s)||s.text!=="Builder"||o.name.text!=="registerComponent")continue;let l=a.arguments;if(l.length<2)continue;let c=l[1];if(!e.ts.isObjectLiteralExpression(c))continue;let p=l[0];if(e.ts.isCallExpression(p)){let m=e.ts.isIdentifier(p.expression)&&p.expression.text;if(m==="withChildren"){let d=bn(e,p.arguments[0]);if(e.ts.isCallExpression(d)){let g=await vn(e,r,d,c,!0);g&&n.push(g)}else{let g=d;if(e.ts.isIdentifier(g)){let D=await wn(e,t,r,g,c,!0);D&&n.push(D)}}continue}if(m==="dynamic"){let d=await vn(e,r,p,c,!1);d&&n.push(d);continue}let C=bn(e,p.arguments[0]);if(e.ts.isCallExpression(C)&&e.ts.isIdentifier(C.expression)&&C.expression.text==="dynamic"){let d=await vn(e,r,C,c,!1);d&&n.push(d);continue}if(e.ts.isIdentifier(C)){let d=await wn(e,t,r,C,c,!1);d&&n.push(d);continue}continue}if(e.ts.isIdentifier(p)){let m=await wn(e,t,r,p,c,!1);m&&n.push(m);continue}}return{sourceFile:t,components:pe(n)}}function bn(e,t){return e.ts.isCallExpression(t)?(e.ts.isIdentifier(t.expression)&&t.expression.text)==="dynamic"?t:bn(e,t.arguments[0]):t}async function vn(e,t,n,r,i){let a={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:t,acceptsChildren:i},o=n.arguments;if(o.length===0)return null;let s=o[0];if(!e.ts.isArrowFunction(s))return null;let u=s.body;if(e.ts.isCallExpression(u)){if(u.expression.kind!==e.ts.SyntaxKind.ImportKeyword||u.arguments.length!==1)return null;let c=u.arguments[0];if(!e.ts.isStringLiteral(c))return null;let p=c.text,m=await kt(e,p);a.filePath=m,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(m)?a.importPath=M(e,a.filePath):(a.externalImportPath=p,a.importPath=a.externalImportPath),a.name=Ce(e,a.filePath),a.importName="default",a.exportName="default",a.exportType="default"}else if(e.ts.isPropertyAccessExpression(u)){let l=u.expression;if(!e.ts.isParenthesizedExpression(l))return null;let c=l.expression;if(!e.ts.isAwaitExpression(c))return null;let p=c.expression;if(!e.ts.isCallExpression(p)||p.expression.kind!==e.ts.SyntaxKind.ImportKeyword||p.arguments.length!==1)return null;let C=p.arguments[0];if(!e.ts.isStringLiteral(C)||!e.ts.isIdentifier(u.name))return null;let d=C.text,g=await kt(e,d);a.filePath=g,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(g)?a.importPath=M(e,a.filePath):(a.externalImportPath=d,a.importPath=a.externalImportPath),a.name=K(u.name.text),a.importName=u.name.text,a.exportName=u.name.text,a.exportType="named"}else return null;return a=me(e,a,r),a.displayFilePath=O(e,a.filePath),a.filePath&&a.exportName&&(a.id=await V(e,a.filePath,a.exportName,a.externalImportPath)),a}async function wn(e,t,n,r,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:n,acceptsChildren:a},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===r.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;let c=await kt(e,l.text);o.filePath=c,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(c)?o.importPath=M(e,o.filePath):(o.externalImportPath=l.text,o.importPath=o.externalImportPath),o.name=Ce(e,o.filePath),o.importName=r.text,o.exportName="default",o.exportType="default"}else{let l=s.find(m=>!m.importClause||!m.importClause.namedBindings||!e.ts.isNamedImports(m.importClause.namedBindings)?!1:m.importClause.namedBindings.elements.some(C=>C.name.text===r.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await kt(e,c.text);o.filePath=p,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=M(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=K(r.text),o.importName=r.text,o.exportName=r.text,o.exportType="named"}return o=me(e,o,i),o.displayFilePath=O(e,o.filePath),o.filePath&&o.exportName&&(o.id=await V(e,o.filePath,o.exportName,o.externalImportPath)),o}function kt(e,t){return Xt(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}function zi(e,t,n){let r=!1,i=0,a=[...t.statements];for(let l=0;l<a.length;l++){let c=a[l];if(e.ts.isImportDeclaration(c)){i=l;continue}if(!e.ts.isExpressionStatement(c))continue;let p=c.expression;if(!e.ts.isCallExpression(p))continue;let m=p.expression;if(!e.ts.isPropertyAccessExpression(m))continue;let C=m.expression;if(!e.ts.isIdentifier(C)||C.text!=="builder")continue;if(m.name.text=="init"){r=!0;break}else continue}if(r)return t;let o=e.ts.factory.createPropertyAccessExpression(e.ts.factory.createPropertyAccessExpression(e.ts.factory.createIdentifier("process"),e.ts.factory.createIdentifier("env")),e.ts.factory.createIdentifier(Ie)),s=n?e.ts.factory.createNonNullExpression(o):o,u=e.ts.factory.createExpressionStatement(e.ts.factory.createCallExpression(e.ts.factory.createPropertyAccessExpression(e.ts.factory.createIdentifier("builder"),e.ts.factory.createIdentifier("init")),void 0,[s]));return a.splice(i+1,0,u),e.ts.factory.updateSourceFile(t,a)}async function Il(e,t){let n=[],r=Q(e,t,"CUSTOM_COMPONENTS");return r&&await Promise.all(r.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Pn(e,t,i);o&&(o.nodeIndex=a,n.push(o))})),{sourceFile:t,components:pe(n)}}async function Pn(e,t,n){if(!e.ts.isObjectLiteralExpression(n))return null;let r={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1};It(e,n)&&(r.acceptsChildren=!0);for(let a of n.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(L(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isCallExpression(u)&&(e.ts.isIdentifier(u.expression)&&u.expression.text)==="dynamic"){let C=u.arguments;if(C.length===0)return null;let d=C[0];if(!e.ts.isArrowFunction(d))return null;let g=d.body;if(e.ts.isCallExpression(g)){if(g.expression.kind!==e.ts.SyntaxKind.ImportKeyword||g.arguments.length!==1)return null;let f=g.arguments[0];if(!e.ts.isStringLiteral(f))return null;let E=f.text,x=await kt(e,E);r.filePath=x,r.relFilePath=e.relative(e.getAppRootDir(),r.filePath),await e.exists(x)?r.importPath=M(e,r.filePath):(r.externalImportPath=E,r.importPath=r.externalImportPath),r.name=Ce(e,r.filePath),r.importName="default",r.exportName="default",r.exportType="default"}else if(e.ts.isPropertyAccessExpression(g)){let D=g.expression;if(!e.ts.isParenthesizedExpression(D))return null;let f=D.expression;if(!e.ts.isAwaitExpression(f))return null;let E=f.expression;if(!e.ts.isCallExpression(E)||E.expression.kind!==e.ts.SyntaxKind.ImportKeyword||E.arguments.length!==1)return null;let y=E.arguments[0];if(!e.ts.isStringLiteral(y)||!e.ts.isIdentifier(g.name))return null;let S=y.text,F=await kt(e,S);r.filePath=F,r.relFilePath=e.relative(e.getAppRootDir(),r.filePath),await e.exists(F)?r.importPath=M(e,r.filePath):(r.externalImportPath=S,r.importPath=r.externalImportPath),r.name=K(g.name.text),r.importName=g.name.text,r.exportName=g.name.text,r.exportType="named"}else return null;return r=me(e,r,n),r.displayFilePath=O(e,r.filePath),r.filePath&&r.exportName&&(r.id=await V(e,r.filePath,r.exportName,r.externalImportPath)),r}if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;r.name===""&&(r.name=K(s)),r.importName=s;let l=await Be(e,e.registryPath,t,s);if(!l)continue;r.filePath=l.filePath,r.relFilePath=l.relFilePath,await e.exists(l.filePath)?r.importPath=M(e,l.filePath):(r.externalImportPath=l.importPath,r.importPath=r.externalImportPath),r.importPath=M(e,l.filePath),r.displayFilePath=l.displayFilePath,r.exportType=l.exportType;let c=t.statements.filter(m=>e.ts.isImportDeclaration(m)),p=c.find(m=>m.importClause&&m.importClause.name?.text===s);if(p){let m=p.moduleSpecifier;if(!e.ts.isStringLiteral(m))return null;r.exportName="default"}else{let m=c.find(d=>!d.importClause||!d.importClause.namedBindings||!e.ts.isNamedImports(d.importClause.namedBindings)?!1:d.importClause.namedBindings.elements.some(g=>g.name.text===s));if(!m)return null;let C=m.moduleSpecifier;if(!e.ts.isStringLiteral(C))return null;r.exportName=s}continue}}return r=me(e,r,n),r.filePath&&r.exportName&&(r.id=await V(e,r.filePath,r.exportName,r.externalImportPath)),r}function ke(e,t){let n=[...t.statements],r=!1;for(let i=t.statements.length-1;i>=0;i--){let a=t.statements[i];if(e.ts.isImportDeclaration(a)&&a.importClause){let o=!1,s=a.importClause.namedBindings;if(s&&e.ts.isNamedImports(s)&&s.elements){let u=[...s.elements];for(let l=u.length-1;l>=0;l--){let c=u[l];if(e.ts.isImportSpecifier(c)){let p=c.name;if(p&&e.ts.isIdentifier(p)){let m=p.text;qi(e,t,m)||u.splice(l,1)}}}if(u.length===0)o=!0;else if(s.elements.length!==u.length){let l=e.ts.factory.updateImportClause(a.importClause,!1,a.importClause.name,e.ts.factory.createNamedImports(u)),c=e.ts.factory.updateImportDeclaration(a,void 0,l,a.moduleSpecifier,void 0);n[i]=c,r=!0}}else if(a.importClause.name&&e.ts.isIdentifier(a.importClause.name)){let u=a.importClause.name.text;qi(e,t,u)||(o=!0)}o&&(n.splice(i,1),r=!0)}}return r?e.ts.factory.updateSourceFile(t,n):t}function qi(e,t,n){let r=!1;function i(a){if(!e.ts.isImportDeclaration(a)){if(e.ts.isIdentifier(a)&&a.text===n){r=!0;return}e.ts.forEachChild(a,i)}}return e.ts.forEachChild(t,i),r}function Oe(e,t,n,r,i,a,o){let s=null,u=null,l=null,c=-1;t=fe(t),n=fe(n);let p=t.find(C=>C.id===e),m=n.find(C=>C.id===e);if(r)m||(s={...fe(p),inputs:fe(p.inputs).map(C=>(C.isRegistered=!0,C))},c=n.length,n.push(s));else if(typeof m?.nodeIndex=="number"&&m.nodeIndex>-1){if(i)c=m.nodeIndex,u=fe(m),n=n.filter(C=>C.id!==e);else if(a!=null)Bl(m,a),c=m.nodeIndex,l=m;else if(o!=null){let C=m.inputs.find(d=>d.name===o.name);C&&(o.registerInput===!1?C.isRegistered=!1:(Rl(C,o),C.isRegistered=!0),l=m,c=m.nodeIndex)}}return{addCmpToRegistry:s,removeCmpFromRegistry:u,updateRegisteredCmp:l,nodeIndex:c,components:Ae(t,n)}}function Ae(e,t){let n=pe([...t.map(r=>(r.isRegistered=!0,r)),...e.filter(r=>!t.some(i=>i.id===r.id)).map(r=>(r.isRegistered=!1,r))]);return n.forEach(r=>{r.inputs=r.inputs.map(Fn),r.inputs.sort((o,s)=>o.name.toLowerCase().localeCompare(s.name.toLowerCase()));let i=t.find(o=>o.id===r.id);i&&(i.acceptsChildren=xn(r));let a=e.find(o=>o.id===r.id&&o.externalImportPath);a&&(r.filePath=a.filePath,r.relFilePath=a.relFilePath)}),n}function Bl(e,t){ue(t.name)?e.name=t.name:t.name===null&&(e.name=e.importName),ue(t.description)?e.description=t.description:t.description===null&&delete e.description,ue(t.image)?e.image=t.image:t.image===null&&delete e.image}function Rl(e,t){ue(t.type)&&(e.type=t.type),ue(t.friendlyName)?e.friendlyName=t.friendlyName:t.friendlyName===null&&delete e.friendlyName,ue(t.defaultValue)||Vt(t.defaultValue)||xt(t.defaultValue)?e.defaultValue=t.defaultValue:t.defaultValue===null&&delete e.defaultValue,ue(t.helperText)?e.helperText=t.helperText:t.helperText===null&&delete e.helperText,t.required===!0?e.required=t.required:(t.required===null||t.required===!1)&&delete e.required}async function nt(e){let t=new Set,n=async i=>{let a=await e.readdir(i);await Promise.all(a.map(async o=>{if(o.startsWith(".")||o==="node_modules")return;let s=e.join(i,o),u=e.extname(o).toLowerCase();if(u===".tsx"||u===".jsx"||u===".ts"||u===".js"){t.add(s);return}(await e.stat(s)).isDirectory()&&await n(s)}))};return await n(e.getAppRootDir()),await X(e,[...t])}function Le(e,t,n){return Bt(e,t,n.variableName)?t:Nl(e,t,n)}function Nl(e,t,n){let r=typeof n.arrayType=="string"?e.ts.factory.createArrayTypeNode(e.ts.factory.createTypeReferenceNode(n.arrayType,void 0)):void 0,i=e.ts.factory.createArrayLiteralExpression([]),a=e.ts.factory.createVariableDeclaration(n.variableName,void 0,r,i),o=e.ts.factory.createVariableDeclarationList([a],e.ts.NodeFlags.Const),s=e.ts.factory.createModifier(e.ts.SyntaxKind.ExportKeyword),u=e.ts.factory.createVariableStatement([s],o),l=[...t.statements,u];return e.ts.factory.updateSourceFile(t,l)}async function _e(e,t,n,r,i,a,o,s){let u=await nt(e),[l,c,p,m]=await Promise.all([_i(e,u),Ui(e),de(e),Ht(e)]),C=l.map(x=>x.cmpInfo),d=c.components,g={components:Ae(C,d),registryPath:e.registryPath,registryDisplayPath:O(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Re(C),publicApiKey:m.envValue??void 0,devToolsVersion:e.version};if(s)return g.components=await Nt(e,g.components),g;let D=!1,f=c.sourceFile,E=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(E.length>0){let x=E.map(F=>{let R=l.find(W=>W.cmpInfo.id===F);if(!R)throw new Error(`Component ${F} not found`);return R}),y=Array.from(new Set(x.map(F=>F.cmpInfo.filePath))),S=await X(e,y);for(let F of x){let R=g.components.find(v=>v.id===F.cmpInfo.id),W=await $t(e,F,S,e.registryPath===F.cmpInfo.filePath||ge(F.cmpInfo.filePath));De(R,W);let _=C.findIndex(v=>v.id===F.cmpInfo.id);C[_].inputs=W;let A=Oe(F.cmpInfo.id,C,d,n,r,i,a);if(e.sdkVersion===w.gen2){let{elements:v,elmIndex:ae,statementIndex:Fe,statement:ne,variableDeclaration:j}=await Ol(e,f,F);if(A.addCmpToRegistry)v.push(kl(e,A.addCmpToRegistry)),D=!0;else if(A.removeCmpFromRegistry)v.splice(ae,1),D=!0;else if(A.updateRegisteredCmp){let se=Z(e,v[ae],A.updateRegisteredCmp);v[ae]=e.ts.factory.updateObjectLiteralExpression(se,[Ji(e,A.updateRegisteredCmp),...se.properties.slice(1)]),D=!0}if(D&&o){let se=[...f.statements];se[Fe]=e.ts.factory.updateVariableStatement(ne,ne.modifiers,e.ts.factory.updateVariableDeclarationList(ne.declarationList,[e.ts.factory.updateVariableDeclaration(j,j.name,j.exclamationToken,j.type,e.ts.factory.createArrayLiteralExpression($e(e,v)))])),f=e.ts.factory.updateSourceFile(f,se),f=Wi(e,A,f),f=N(e,f,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),f=Le(e,f,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),g.components=A.components,d=A.components.filter(at=>at.isRegistered)}}else{let v=[...f.statements];A.addCmpToRegistry?(v.push(Ii(e,A.addCmpToRegistry)),D=!0):A.removeCmpFromRegistry?(v.splice(A.nodeIndex,1),D=!0):A.updateRegisteredCmp&&(v[A.nodeIndex]=yn(e,v[A.nodeIndex],A.updateRegisteredCmp),D=!0),D&&o&&(f=e.ts.factory.updateSourceFile(f,v),f=N(e,f,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),f=zi(e,f,p),f=Wi(e,A,f),R?.acceptsChildren&&(f=N(e,f,{namedImports:["withChildren"],importPath:"@builder.io/react"})),g.components=A.components,d=A.components.filter(ae=>ae.isRegistered))}}}if(D&&o){f=ke(e,f),f=Ne(e,f),e.appDir&&(f=Ki(e,f));let x=ee(e,f);x=Se(x),e.appDir&&(x=Vi(x)),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return g}function Ji(e,t){let n=e.ts.factory.createIdentifier(t.importName);return e.appDir?e.ts.factory.createPropertyAssignment("component",n):e.ts.factory.createPropertyAssignment("component",Ll(e,t))}function $l(e){return e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())}function kl(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([Ji(e,t),...t.acceptsChildren?[$l(e)]:[]],!0),t)}async function Ol(e,t,n){let r=Q(e,t,"CUSTOM_COMPONENTS");if(!r)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=r.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Pn(e,t,i[o]))?.id===n.cmpInfo.id){a=o;break}return{...r,elements:i,elmIndex:a}}function Wi(e,t,n){if(e.appDir){let r=t.addCmpToRegistry||t.updateRegisteredCmp;if(r){let i=r.externalImportPath?r.externalImportPath:$(e,e.registryPath,r.filePath);r.exportType==="default"?n=N(e,n,{defaultImport:r.importName,importPath:i}):r.exportType==="named"&&(n=N(e,n,{namedImports:[r.importName],importPath:i}))}}else n=N(e,n,{defaultImport:"dynamic",importPath:"next/dynamic"});return n}function Ll(e,t){let n=t.externalImportPath?t.externalImportPath:$(e,e.registryPath,t.filePath),r=t.exportName!=="default",i;r?i=e.ts.factory.createPropertyAccessExpression(e.ts.factory.createAwaitExpression(e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(n)])),e.ts.factory.createIdentifier(t.exportName)):i=e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(n)]);let a=e.ts.factory.createArrowFunction(r?[e.ts.factory.createModifier(e.ts.SyntaxKind.AsyncKeyword)]:void 0,void 0,[],void 0,e.ts.factory.createToken(e.ts.SyntaxKind.EqualsGreaterThanToken),i);return e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("dynamic"),void 0,[a])}async function Hi(e){let t=[],n=await Kl(e,t);return await ea(e,t,n),e.appDir?(e.debug(`ensure builder setup for next.js app ${e.appDir}`),await jl(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure builder setup for next.js pages ${e.pagesDir}`),await Ml(e,e.pagesDir,t)),t}async function Qi(e){let t=[];return await ea(e,t),e.appDir?(e.debug(`ensure figma-imports setup for next.js app ${e.appDir}`),await _l(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure figma-imports setup for next.js pages ${e.pagesDir}`),await Vl(e,e.pagesDir,t)),t}async function _l(e,t,n){let r=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"figma-imports",r);if(!await e.exists(i)){let a=await e.formatCode(i,Xi({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),n.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,Yi(e));await e.writeFile(e.builderComponentPath,a),n.push({filePath:e.builderComponentPath,modifiedType:"create"})}}async function jl(e,t,n){let r=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"[...page]",r);if(!await e.exists(i)){let a=await e.formatCode(i,Xi({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),n.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,Yi(e));await e.writeFile(e.builderComponentPath,a),n.push({filePath:e.builderComponentPath,modifiedType:"create"})}}function Yi(e){let t=e.typescriptEnabled;return e.sdkVersion===w.gen2?`
301
+ "use client";
302
+ import { ${t?"BuilderContent, ":""} isPreviewing, Content } from "@builder.io/sdk-react";
303
+ import DefaultErrorPage from "next/error";
304
+ import { CUSTOM_COMPONENTS } from ${JSON.stringify($(e,e.builderComponentPath,e.registryPath))};
305
+ ${t?`
306
+ interface BuilderPageProps {
307
+ content: BuilderContent | null;
308
+ model: string;
309
+ }`:""}
310
+
311
+ // Builder Public API Key set in .env file
312
+ const builderApiKey = process.env.${Ie}${t?"!":""};
313
+
314
+ export function RenderBuilderContent({ content, model }${t?": BuilderPageProps":""}) {
315
+ // Call the isPreviewing hook to determine if
316
+ // the page is being previewed in Builder
317
+ // If "content" has a value or the page is being previewed in Builder,
318
+ // render the BuilderComponent with the specified content and model props.
319
+ if (content || isPreviewing()) {
320
+ return <Content
321
+ content={content}
322
+ apiKey={builderApiKey}
323
+ model={model}
324
+ customComponents={CUSTOM_COMPONENTS}
325
+ />;
326
+ }
327
+ // If the "content" is falsy and the page is
328
+ // not being previewed in Builder, render the
329
+ // DefaultErrorPage with a 404.
330
+ return <DefaultErrorPage statusCode={404} />;
331
+ }
332
+ `.trimStart():`
333
+ "use client";
334
+ ${t?'import { ComponentProps } from "react";':""}
335
+ import { BuilderComponent, useIsPreviewing } from "@builder.io/react";
336
+ import { ${t?"BuilderContent, ":""}builder } from '@builder.io/sdk';
337
+ import DefaultErrorPage from "next/error";
338
+ import ${JSON.stringify($(e,e.builderComponentPath,e.registryPath))};
339
+ ${t?`
340
+ type BuilderPageProps = ComponentProps<typeof BuilderComponent>;`:""}
341
+
342
+ // Builder Public API Key set in .env file
343
+ builder.init(process.env.${Ie}${t?"!":""});
344
+
345
+ export function RenderBuilderContent({ content, model }${t?": BuilderPageProps":""}) {
346
+ // Call the useIsPreviewing hook to determine if
347
+ // the page is being previewed in Builder
348
+ const isPreviewing = useIsPreviewing();
349
+ // If "content" has a value or the page is being previewed in Builder,
350
+ // render the BuilderComponent with the specified content and model props.
351
+ if (content || isPreviewing) {
352
+ return <BuilderComponent content={content} model={model} />;
353
+ }
354
+ // If the "content" is falsy and the page is
355
+ // not being previewed in Builder, render the
356
+ // DefaultErrorPage with a 404.
357
+ return <DefaultErrorPage statusCode={404} />;
358
+ }
359
+ `.trimStart()}function Gi(e){return e.features.asyncParams?`
360
+ interface PageProps {
361
+ params: Promise<{
362
+ page: string[];
363
+ }>;
364
+ }`:`
365
+ interface PageProps {
366
+ params: {
367
+ page: string[];
368
+ };
369
+ }`}function Xi({sys:e,routePath:t,modelName:n}){let r=e.typescriptEnabled,i=$(e,t,e.builderComponentPath);return e.sdkVersion===w.gen2?`
370
+ import { fetchOneEntry } from "@builder.io/sdk-react";
371
+ import { RenderBuilderContent } from ${JSON.stringify(i)};
372
+
373
+ // Builder Public API Key set in .env file
374
+ const PUBLIC_API_KEY = process.env.${Ie}${r?"!":""};
375
+
376
+ ${r?Gi(e):""}
377
+
378
+ export default async function Page(props${r?": PageProps":""}) {
379
+ const builderModelName = "${n}";
380
+
381
+ // Use the page path specified in the URL to fetch the content
382
+ const urlPath = "/" + (${e.features.asyncParams?"(await props?.params)":"props?.params"}?.page?.join("/") || "");
383
+
384
+ const content = await fetchOneEntry({
385
+ // Get the page content from Builder with the specified options
386
+ apiKey: PUBLIC_API_KEY,
387
+ model: builderModelName,
388
+ userAttributes: { urlPath },
389
+ });
390
+
391
+ return (
392
+ <>
393
+ {/* Render the Builder page */}
394
+ <RenderBuilderContent content={content} model={builderModelName} />
395
+ </>
396
+ );
397
+ }
398
+ `.trimStart():`
399
+ import { builder } from "@builder.io/sdk";
400
+ import { RenderBuilderContent } from ${JSON.stringify(i)};
401
+
402
+ // Builder Public API Key set in .env file
403
+ builder.init(process.env.${Ie}${r?"!":""});
404
+ ${r?Gi(e):""}
405
+
406
+ export default async function Page(props${r?": PageProps":""}) {
407
+ const builderModelName = "${n}";
408
+
409
+ const content = await builder
410
+ // Get the page content from Builder with the specified options
411
+ .get(builderModelName, {
412
+ userAttributes: {
413
+ // Use the page path specified in the URL to fetch the content
414
+ urlPath: "/" + (${e.features.asyncParams?"(await props?.params)":"props?.params"}?.page?.join("/") || ""),
415
+ },
416
+ })
417
+ // Convert the result to a promise
418
+ .toPromise();
419
+
420
+ return (
421
+ <>
422
+ {/* Render the Builder page */}
423
+ <RenderBuilderContent content={content} model={builderModelName} />
424
+ </>
425
+ );
426
+ }
427
+ `.trimStart()}async function Ml(e,t,n){let r=`[...page].${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,r);if(!await e.exists(i)){let a=await e.formatCode(i,Zi({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),n.push({filePath:i,modifiedType:"create"})}}async function Vl(e,t,n){let r=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,r);if(!await e.exists(i)){let a=await e.formatCode(i,Zi({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),n.push({filePath:i,modifiedType:"create"})}}function Zi({sys:e,routePath:t,modelName:n}){let r=e.typescriptEnabled;return e.sdkVersion===w.gen2?`
428
+ import React from "react";
429
+ import { useRouter } from "next/router";
430
+ ${r?'import type { BuilderContent } from "@builder.io/sdk-react";':""}
431
+ import {
432
+ Content,
433
+ fetchEntries,
434
+ fetchOneEntry,
435
+ isPreviewing,
436
+ } from "@builder.io/sdk-react";
437
+ import DefaultErrorPage from "next/error";
438
+ import Head from "next/head";
439
+ ${r?'import { GetStaticProps } from "next";':""}
440
+ import { CUSTOM_COMPONENTS } from ${JSON.stringify($(e,e.builderComponentPath,e.registryPath))};
441
+
442
+ const BUILDER_API_KEY = process.env.${Ie}${r?"!":""};
443
+
444
+ // Define a function that fetches the Builder
445
+ // content for a given page
446
+ export const getStaticProps${r?": GetStaticProps":""} = async ({ params }) => {
447
+ ${e.features.asyncParams?"await params;":""}
448
+ const urlPath =
449
+ "/" +
450
+ (Array.isArray(params?.page) ? params.page.join("/") : params?.page || "");
451
+
452
+ // Fetch the builder content for the given page
453
+ const page = await fetchOneEntry({
454
+ apiKey: BUILDER_API_KEY,
455
+ model: "${n}",
456
+ userAttributes: { urlPath },
457
+ });
458
+
459
+ return {
460
+ // Return the page content as props
461
+ props: { page },
462
+ // Revalidate the content every 5 seconds
463
+ revalidate: 5,
464
+ };
465
+ };
466
+
467
+ ${n==="page"?`
468
+ // Define a function that generates the
469
+ // static paths for all pages in Builder
470
+ export async function getStaticPaths() {
471
+ // Get a list of all pages in Builder
472
+ const pages = await fetchEntries({
473
+ apiKey: BUILDER_API_KEY,
474
+ model: "page",
475
+ // We only need the URL field
476
+ fields: "data.url",
477
+ options: { noTargeting: true },
478
+ });
479
+ // Generate the static paths for all pages in Builder
480
+ return {
481
+ paths: pages.map((page) => \`\${page.data?.url}\`),
482
+ fallback: "blocking",
483
+ };
484
+ }
485
+ `:""}
486
+
487
+ // Define the Page component
488
+ export default function Page(props${r?": { page: BuilderContent | null }":""}) {
489
+ const router = useRouter();
490
+ const canShowContent = props.page || isPreviewing(router.asPath);
491
+
492
+ // If the page content is not available
493
+ // and not in preview/editing mode, show a 404 error page
494
+ if (!canShowContent) {
495
+ return <DefaultErrorPage statusCode={404} />;
496
+ }
497
+
498
+ // If the page content is available, render
499
+ // the BuilderComponent with the page content
500
+ return (
501
+ <>
502
+ <Head>
503
+ <title>{props.page?.data?.title}</title>
504
+ </Head>
505
+ {/* Render the Builder page */}
506
+ <Content
507
+ model="${n}"
508
+ content={props.page}
509
+ apiKey={BUILDER_API_KEY}
510
+ customComponents={CUSTOM_COMPONENTS}
511
+ />
512
+ </>
513
+ );
514
+ }
515
+
516
+ `:`
517
+ import React from "react";
518
+ import { useRouter } from "next/router";
519
+ import { BuilderComponent, builder, useIsPreviewing } from "@builder.io/react";
520
+ import DefaultErrorPage from "next/error";
521
+ import Head from "next/head";${r?`
522
+ import { BuilderContent } from "@builder.io/sdk";`:""}${r?`
523
+ import { GetStaticProps } from "next";`:""}
524
+ import ${JSON.stringify($(e,t,e.registryPath))};
525
+
526
+ builder.init(process.env.${Ie}${r?"!":""});
527
+
528
+ // Define a function that fetches the Builder
529
+ // content for a given page
530
+ export const getStaticProps${r?": GetStaticProps":""} = async ({ params }) => {
531
+ ${e.features.asyncParams?"await params;":""}
532
+ // Fetch the builder content for the given page
533
+ const page = await builder
534
+ .get("${n}", {
535
+ userAttributes: {
536
+ urlPath: "/" + ((params?.page${r?" as string[]":""})?.join("/") || ""),
537
+ },
538
+ })
539
+ .toPromise();
540
+
541
+ // Return the page content as props
542
+ return {
543
+ props: {
544
+ page: page || null,
545
+ },
546
+ // Revalidate the content every 5 seconds
547
+ revalidate: 5,
548
+ };
549
+ };
550
+
551
+ ${n==="page"?`// Define a function that generates the
552
+ // static paths for all pages in Builder
553
+ export async function getStaticPaths() {
554
+ // Get a list of all pages in Builder
555
+ const pages = await builder.getAll("page", {
556
+ // We only need the URL field
557
+ fields: "data.url",
558
+ options: { noTargeting: true },
559
+ });
560
+
561
+ // Generate the static paths for all pages in Builder
562
+ return {
563
+ paths: pages.map((page) => String(page.data?.url)).filter(url => url !== '/'),
564
+ fallback: 'blocking',
565
+ };
566
+ }`:""}
567
+
568
+ // Define the Page component
569
+ export default function Page({ page }${r?": { page: BuilderContent | null }":""}) {
570
+ const router = useRouter();
571
+ const isPreviewing = useIsPreviewing();
572
+
573
+ // If the page content is not available
574
+ // and not in preview mode, show a 404 error page
575
+ if (!page && !isPreviewing) {
576
+ return <DefaultErrorPage statusCode={404} />;
577
+ }
578
+
579
+ // If the page content is available, render
580
+ // the BuilderComponent with the page content
581
+ return (
582
+ <>
583
+ <Head>
584
+ <title>{page?.data?.title}</title>
585
+ </Head>
586
+ {/* Render the Builder page */}
587
+ <BuilderComponent model="${n}" content={page || undefined} />
588
+ </>
589
+ );
590
+ }
591
+ `.trimStart()}async function Kl(e,t){let r=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${r}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=Ul(e);if(!await e.exists(a)){let l=await e.formatCode(a,s);await e.writeFile(a,l),t.push({filePath:a,modifiedType:"create"})}return await e.exists(o)||(await e.writeFile(o,u),t.push({filePath:o,modifiedType:"create"})),a}function Ul(e){let t=e.typescriptEnabled,n=`
592
+ "use client"
593
+ import React, { useState } from "react";
594
+ import styles from "./styles.module.css";
595
+ ${t?`
596
+ interface CounterProps {
597
+ initialCount?: number;
598
+ }`:""}
599
+
600
+ function Counter({ initialCount = 99 }${t?": CounterProps":""}) {
601
+ const [count, setCount] = useState(initialCount);
602
+
603
+ const increment = () => {
604
+ setCount((prevCount) => prevCount + 1);
605
+ };
606
+
607
+ const decrement = () => {
608
+ setCount((prevCount) => prevCount - 1);
609
+ };
610
+
611
+ return (
612
+ <div className={styles.counter}>
613
+ <button className={styles.btn} onClick={decrement}>
614
+ -
615
+ </button>
616
+ <span className={styles.count}>{count}</span>
617
+ <button className={styles.btn} onClick={increment}>
618
+ +
619
+ </button>
620
+ </div>
621
+ );
622
+ }
623
+
624
+ export default Counter;
625
+ `.trimStart(),r=`
626
+ .counter {
627
+ margin: 32px auto;
628
+ display: flex;
629
+ width: 100%;
630
+ max-width: 190px;
631
+ }
632
+
633
+ .btn {
634
+ width: 42px;
635
+ font-size: 32px;
636
+ font-weight: bold;
637
+ background-color: #1c6bd1;
638
+ color: white;
639
+ border: none;
640
+ border-radius: 4px;
641
+ cursor: pointer;
642
+ line-height: 1.4;
643
+ }
644
+
645
+ .btn:hover {
646
+ opacity: 0.8;
647
+ }
648
+
649
+ .count {
650
+ flex: 1;
651
+ font-size: 42px;
652
+ text-align: center;
653
+ }
654
+ `.trimStart();return{component:n,styles:r}}async function ea(e,t,n){if(!await e.exists(e.registryPath)){if(e.sdkVersion===w.gen2){let a=zl(e);await e.writeFile(e.registryPath,a)}else await e.writeFile(e.registryPath,"");t.push({filePath:e.registryPath,modifiedType:"create"})}if(!n)return;let i=(await _e(e,null,!1,!1,null,null,!1,!1)).components.find(a=>a.filePath===n);i&&await _e(e,i.id,!0,!1,null,null,!0,!1)}function zl(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-react";
655
+
656
+ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
657
+ ];`:`export const CUSTOM_COMPONENTS = [
658
+ ];
659
+ `}async function Ot(e){let t=await Kt(e,e.getRepoRootDir());if(t&&typeof t=="object"){let n=new Set(Object.keys({...t.dependencies,...t.devDependencies}));if(n.has("@builder.io/sdk-react"))return w.gen2;if(n.has("@builder.io/react"))return w.gen1}return null}async function ta(e){let t=await ql(e);return{builderPageOptions:async()=>({templateContentId:"3de2f13211234071a4b19a17b4fbc5a7",pathname:"/builder-demo",title:"Builder + Next.js Demo Page"}),ensureBuilderSetup:()=>Hi(t),ensureFigmaImportPage:()=>Qi(t),getRegistryPath:()=>t.registryPath,getRegistry:r=>_e(t,null,!1,!1,null,null,!1,!!r?.readAllInputTypes),addExternalPackage:r=>{t.addExternalPackage(r)},loadComponent:async r=>{let i=await _e(t,r.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===r.cmpId)}},registerComponent:r=>_e(t,r.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:r=>_e(t,r.cmpId,!1,!1,r,null,!0,!1),setRegisteredComponentInput:r=>_e(t,r.cmpId,!1,!1,null,r,!0,!1),unregisterComponent:r=>_e(t,r.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>Ht(t),setPublicApiKey:r=>Ai(t,r.publicApiKey),getDependencies:r=>r.sdkVersion===w.gen2?[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-react"}]:[{name:"@builder.io/dev-tools"},{name:"@builder.io/react"},{name:"@builder.io/sdk"}],getDevRunCommand:()=>"dev",getCache:()=>Pe(t),setCache:r=>Te(t,r)}}async function ql(e){let t=e.getAppRootDir(),n=e.join(t,"src"),r=await Wl(e),i=await de(e),a=e.getFrameworks().find(l=>l.name==="next"),o={asyncParams:a?.version?.major!==void 0&&a.version.major>=15},s={},u={...e,addExternalPackage:l=>{s[e.join(t,l,"index.ts")]=`export * from "${l}";`},readFileSync:l=>s[l]??e.readFileSync(l),existsSync:l=>!!s[l]||e.existsSync(l),readdirSync:l=>{let c=e.readdirSync(l);return l===t?[...c,...Object.keys(s).map(p=>p.slice(t.length+1))]:c},readdir:async l=>{let c=await e.readdir(l);return l===t?[...c,...Object.keys(s).map(p=>p.slice(t.length+1))]:c},appDir:null,pagesDir:null,srcDir:null,builderComponentPath:"",componentsDir:"",registryPath:"",nextConfigPath:r,typescriptEnabled:i,features:o};if(e.sdkVersion?u.sdkVersion=e.sdkVersion:u.sdkVersion=await Ot(u),await e.exists(n)){u.srcDir=n,u.componentsDir=e.join(n,"components");let l=e.join(n,"app");await e.exists(l)&&(u.appDir=l);let c=e.join(n,"pages");await e.exists(c)&&(u.pagesDir=c),u.registryPath=await he(e,n)}else u.componentsDir=e.join(t,"components"),u.registryPath=await he(e,t);if(u.builderComponentPath=e.join(u.componentsDir,`builder.${i?"tsx":"jsx"}`),!u.appDir){let l=e.join(t,"app");await e.exists(l)&&(u.appDir=l)}if(!u.pagesDir){let l=e.join(t,"pages");await e.exists(l)&&(u.pagesDir=l)}if(!u.appDir&&!u.pagesDir)throw new Error(`Could not find Next.js "app" or "pages" directory. Searched in "${t}".`);return u}async function Wl(e){let t=e.join(e.getAppRootDir(),"next.config.ts");if(await e.exists(t))return t;let n=e.join(e.getAppRootDir(),"next.config.mjs");if(await e.exists(n))return n;let r=e.join(e.getAppRootDir(),"next.config.js");if(await e.exists(r))return r;throw new Error(`Could not find Next.js config file. Searched for "next.config.ts", "next.config.mjs" and "next.config.js" in "${e.getAppRootDir()}".`)}async function Zt(e){return await et(e,[".env"],na)}async function ra(e,t){Jl(t);let n=await Zt(e),r=await tt(e,n.file,n.envKey,t);return{...n,modifiedType:r}}function Jl(e){typeof process<"u"&&(process.env[na]=e)}var na="PUBLIC_BUILDER_API_KEY";function oa(e,t,n){if(n.length===0)return e;let r=e.split(`
660
+ `),i=r.findIndex(s=>s.includes(n));if(i===-1||r.some(s=>s.includes(t[0])))return e;let o=["/**",...t.map(s=>` * ${s.trim()}`)," */"];return r.splice(i,0,...o),r.join(`
661
+ `)}async function aa(e,t){let n=[],r=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(r.map(async a=>{let o=e.basename(a.fileName);if(o.startsWith(".")||Ql.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await Pr(e,i,s,a);n.push(...u)})),n}async function sa(e,t){if(e.extname(t).toLowerCase()===".tsx"){let r=await e.readFile(t);if(r)return Gl(e,t,r)}return null}function Gl(e,t,n){let r=B(e,n);return Pr(e,null,t,r)}async function Pr(e,t,n,r){n=e.normalize(n);let i=[],a=mt(e,r);return await Promise.all(a.map(async o=>{let s=await Hl(e,t,n,o);s&&i.push(s)})),i}async function Hl(e,t,n,r){let i=e.relative(e.getAppRootDir(),n),a=M(e,n);if(e.ts.isVariableStatement(r.node))for(let o of r.node.declarationList.declarations){let s=ia(e,o.initializer);if(s&&e.ts.isIdentifier(o.name)){let u=o.name.text;return{cmpInfo:{id:await V(e,n,u),displayFilePath:O(e,n),name:K(u),inputs:[],exportName:r.isDefaultExport?"default":u,exportType:r.isDefaultExport?"default":"named",importName:u,filePath:n,relFilePath:i,importPath:a},node:s}}}else if(e.ts.isCallExpression(r.node)){let o=ia(e,r.node);if(o)return{cmpInfo:{id:await V(e,n,"default"),displayFilePath:O(e,n),name:Ce(e,n),inputs:[],exportName:"default",exportType:"default",importName:lt(e,n),filePath:n,relFilePath:i,importPath:a},node:o}}return null}function ia(e,t){if(t&&e.ts.isCallExpression(t)&&e.ts.isIdentifier(t.expression)&&t.expression.text==="component$"&&t.arguments.length>0){let n=t.arguments[0];if(e.ts.isArrowFunction(n)||e.ts.isFunctionExpression(n))return{callExpression:t,fnNode:n}}return null}var Ql=new Set(["node_modules","layout.tsx","404.tsx","router-head.tsx"]);async function ua(e,t){let n=t.node.fnNode;if((e.ts.isArrowFunction(n)||e.ts.isFunctionExpression(n))&&n.parameters.length>0){let{sourceFile:i,typeChecker:a}=await yt(e,t.cmpInfo.filePath,null);if(!(await Pr(e,a,t.cmpInfo.filePath,i)).find(u=>u.cmpInfo.id===t.cmpInfo.id))throw new Error(`createComponentInputs() Could not find component ${t.cmpInfo.name} in ${t.cmpInfo.filePath}`);return pt(e,a,n)}return[]}async function la(e){return Tn(e)}async function Tn(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Yl),t.push({filePath:e.registryPath,modifiedType:"create"})),t}var Yl=`import type { RegisteredComponent } from "@builder.io/sdk-qwik";
662
+
663
+ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
664
+ ];
665
+ `;async function ca(e){await Tn(e);let t=await e.readFile(e.registryPath);return t?Xl(e,t):{components:[],sourceFile:B(e,"")}}async function Xl(e,t){let n=B(e,t);return Zl(e,n)}async function Zl(e,t){let n=[],r=Q(e,t,"CUSTOM_COMPONENTS");return r&&await Promise.all(r.arrayLiteralExp.elements.map(async(i,a)=>{let o=await In(e,t,i);o&&(o.nodeIndex=a,n.push(o))})),{sourceFile:t,components:pe(n)}}async function In(e,t,n){if(!e.ts.isObjectLiteralExpression(n))return null;let r={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[]};for(let i of n.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(L(e,i)==="component"&&e.ts.isIdentifier(i.initializer)){let o=i.initializer.text;r.name===""&&(r.name=K(o)),r.importName=o;let s=await Be(e,e.registryPath,t,o);if(!s)continue;r.filePath=s.filePath,r.relFilePath=s.relFilePath,r.importPath=M(e,s.filePath),r.displayFilePath=s.displayFilePath,r.exportType=s.exportType;let u=await sa(e,s.filePath);if(u&&u.length>0)if(u.length===1)r.exportName=u[0].cmpInfo.exportName;else{let l=u.find(c=>c.cmpInfo.exportName===o);l&&(r.exportName=l.cmpInfo.exportName)}continue}}return r=me(e,r,n),r.filePath&&r.exportName&&(r.id=await V(e,r.filePath,r.exportName)),r}async function pa(e){let t=new Set,n=async i=>{let a=await e.readdir(i);await Promise.all(a.map(async o=>{if(o.startsWith(".")||o==="node_modules")return;let s=e.join(i,o),u=e.extname(o).toLowerCase();if(u===".tsx"||u===".ts"){t.add(s);return}(await e.stat(s)).isDirectory()&&await n(s)}))};return await n(e.getAppRootDir()),await X(e,[...t])}async function ft(e,t,n,r,i,a,o,s){let u=await pa(e),[l,c,p]=await Promise.all([aa(e,u),ca(e),Zt(e)]),m=l.map(g=>g.cmpInfo),C=c.components,d={components:Ae(m,C),registryPath:e.registryPath,registryDisplayPath:O(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Re(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d;if(t!=null){let g=l.find(A=>A.cmpInfo.id===t);if(!g)throw new Error(`Component ${t} not found`);let D=c.sourceFile,f=d.components.find(A=>A.id===t),E=await ua(e,g);De(f,E),t=Array.isArray(t)?t[0]:t;let x=Oe(t,m,C,n,r,i,a),{elements:y,elmIndex:S,statementIndex:F,statement:R,variableDeclaration:W}=await tc(e,D,g),_=!1;if(x.addCmpToRegistry?(y.push(ec(e,x.addCmpToRegistry)),_=!0):x.removeCmpFromRegistry?(y.splice(S,1),_=!0):x.updateRegisteredCmp&&(y[S]=Z(e,y[S],x.updateRegisteredCmp),_=!0),_&&o){let A=[...D.statements];A[F]=e.ts.factory.updateVariableStatement(R,R.modifiers,e.ts.factory.updateVariableDeclarationList(R.declarationList,[e.ts.factory.updateVariableDeclaration(W,W.name,W.exclamationToken,W.type,e.ts.factory.createArrayLiteralExpression($e(e,y)))])),D=e.ts.factory.updateSourceFile(D,A),f.exportType==="named"?D=N(e,D,{namedImports:[f.importName],importPath:$(e,e.registryPath,f.filePath)}):D=N(e,D,{defaultImport:f.importName,importPath:$(e,e.registryPath,f.filePath)}),D=N(e,D,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-qwik",isTypeOnly:!0}),D=Le(e,D,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),D=ke(e,D),D=Ne(e,D);let v=ee(e,D);v=Se(v),v=oa(v,rc,"CUSTOM_COMPONENTS"),v=await e.formatCode(e.registryPath,v),await e.writeFile(e.registryPath,v)}d.components=x.components}return d}function ec(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName))],!0),t)}async function tc(e,t,n){let r=Q(e,t,"CUSTOM_COMPONENTS");if(!r)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=r.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await In(e,t,i[o]))?.id===n.cmpInfo.id){a=o;break}return{...r,elements:i,elmIndex:a}}var rc=["This array is used to integrate custom components within Builder.","https://www.builder.io/c/docs/custom-components-intro","",'These components will be found the "Custom Components"',"section of Builder's visual editor.",'You can also turn on "components only mode" to limit',"editing to only these components.","https://www.builder.io/c/docs/guides/components-only-mode"];async function ma(e){let t=await nc(e);return{builderPageOptions:async()=>({templateContentId:"dc70f1d979ad416d8fd357137eb9ddfb",pathname:"/",title:"Builder + Qwik Demo Page"}),ensureBuilderSetup:()=>la(t),ensureFigmaImportPage:async()=>[],getRegistryPath:()=>t.registryPath,getRegistry:r=>ft(t,null,!1,!1,null,null,!1,!!r?.readAllInputTypes),addExternalPackage:async r=>{},loadComponent:async r=>{let i=await ft(t,r.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===r.cmpId)}},registerComponent:r=>ft(t,r.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:r=>ft(t,r.cmpId,!1,!1,r,null,!0,!1),setRegisteredComponentInput:r=>ft(t,r.cmpId,!1,!1,null,r,!0,!1),unregisterComponent:r=>ft(t,r.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>Zt(t),setPublicApiKey:r=>ra(t,r.publicApiKey),getDependencies:r=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-qwik"}],getDevRunCommand:()=>"dev",getCache:()=>Pe(t),setCache:r=>Te(t,r)}}async function nc(e){let t=await Ut(e,e.getAppRootDir(),"components");if(!t)throw new Error(`Could not find components directory within project: ${e.getAppRootDir()}`);let n=await he(e,t),r=e.join(e.getAppRootDir(),".env");return{...e,componentsDir:t,registryPath:n,envPath:r}}async function er(e){return await et(e,[".env"],tr)}async function fa(e,t){let n=await er(e),r=await tt(e,n.file,n.envKey,t);return{...n,modifiedType:r}}var tr="PUBLIC_BUILDER_KEY";var oc=new Set(["dist","node_modules"]);async function da(e,t){let n=[],r=t.getSourceFiles(),i=t.getTypeChecker(),a=e.join(e.getAppRootDir(),"build");return await Promise.all(r.map(async o=>{let s=e.basename(o.fileName);if(s.startsWith(".")||s==="node_modules"||Cr(e,oc,o.fileName)||ic.has(s)||s.includes("$."))return;let u=e.normalize(o.fileName);if(u===e.remixConfigPath||u===a)return;let l=await rt(e,i,u,o,u===e.registryPath);n.push(...l)})),n}var ic=new Set(["root.tsx","root.ts","root.jsx","root.js","_index.tsx","_index.jsx","_index.ts","_index.js"]);async function Da(e){await Tr(e);let t=await e.readFile(e.registryPath);return t?ac(e,t):{components:[],sourceFile:B(e,"")}}async function ac(e,t){let n=B(e,t);return sc(e,n)}async function sc(e,t){let n=[],r=Q(e,t,"CUSTOM_COMPONENTS");return r&&await Promise.all(r.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Bn(e,t,i);o&&(o.nodeIndex=a,n.push(o))})),{sourceFile:t,components:pe(n)}}async function Bn(e,t,n){if(!e.ts.isObjectLiteralExpression(n))return null;let r={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1};e.sdkVersion===w.gen2&&It(e,n)&&(r.acceptsChildren=!0);for(let i of n.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(L(e,i)==="component"){let o,{initializer:s}=i;if(e.ts.isIdentifier(s))o=s.text;else if(e.ts.isCallExpression(s)){(e.ts.isIdentifier(s.expression)&&s.expression.text)==="withChildren"&&(r.acceptsChildren=!0);let c=s.arguments[0];e.ts.isIdentifier(c)&&(o=c.text)}if(!o)continue;r.name===""&&(r.name=K(o)),r.importName=o;let u=await Be(e,e.registryPath,t,o);if(!u)continue;if(r.filePath=u.filePath,r.relFilePath=u.relFilePath,await e.exists(u.filePath)?r.importPath=M(e,u.filePath):(r.externalImportPath=u.importPath,r.importPath=r.externalImportPath),r.displayFilePath=u.displayFilePath,r.exportType=u.exportType,r.externalImportPath)r.exportName=o;else{let l=await ki(e,u.filePath,e.registryPath===u.filePath||ge(u.filePath));if(l&&l.length>0)if(l.length===1)r.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(r.exportName=c.cmpInfo.exportName)}}continue}}return r=me(e,r,n),r.filePath&&r.exportName&&(r.id=await V(e,r.filePath,r.exportName,r.externalImportPath)),r}async function je(e,t,n,r,i,a,o,s){let u=await nt(e),[l,c,p]=await Promise.all([da(e,u),Da(e),er(e)]),m=l.map(E=>E.cmpInfo),C=c.components,d={components:Ae(m,C),registryPath:e.registryPath,registryDisplayPath:O(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Re(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await Nt(e,d.components),d;let g=!1,D=c.sourceFile,f=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(f.length>0){let E=f.map(S=>{let F=l.find(R=>R.cmpInfo.id===S);if(!F)throw new Error(`Component ${S} not found`);return F}),x=Array.from(new Set(E.map(S=>S.cmpInfo.filePath))),y=await X(e,x);for(let S of E){let F=d.components.find(j=>j.id===S.cmpInfo.id),R=await $t(e,S,y,e.registryPath===S.cmpInfo.filePath||ge(S.cmpInfo.filePath));De(F,R);let W=m.findIndex(j=>j.id===S.cmpInfo.id);m[W].inputs=R;let _=Oe(S.cmpInfo.id,m,C,n,r,i,a),{elements:A,elmIndex:v,statementIndex:ae,statement:Fe,variableDeclaration:ne}=await lc(e,D,S);if(_.addCmpToRegistry)A.push(uc(e,_.addCmpToRegistry)),g=!0;else if(_.removeCmpFromRegistry)A.splice(v,1),g=!0;else if(_.updateRegisteredCmp){let j=Z(e,A[v],_.updateRegisteredCmp);A[v]=e.ts.factory.updateObjectLiteralExpression(j,[ga(e,_.updateRegisteredCmp),...j.properties.slice(1)]),g=!0}if(g&&o){let j=[...D.statements];j[ae]=e.ts.factory.updateVariableStatement(Fe,Fe.modifiers,e.ts.factory.updateVariableDeclarationList(Fe.declarationList,[e.ts.factory.updateVariableDeclaration(ne,ne.name,ne.exclamationToken,ne.type,e.ts.factory.createArrayLiteralExpression($e(e,A)))])),D=e.ts.factory.updateSourceFile(D,j),F.exportType==="named"?D=N(e,D,{namedImports:[F.importName],importPath:F.externalImportPath?F.externalImportPath:$(e,e.registryPath,F.filePath)}):D=N(e,D,{defaultImport:F.importName,importPath:F.externalImportPath?F.externalImportPath:$(e,e.registryPath,F.filePath)});let se=e.sdkVersion===w.gen2?"@builder.io/sdk-react":"@builder.io/react";D=N(e,D,{namedImports:["RegisteredComponent"],importPath:se,isTypeOnly:!0}),F.acceptsChildren&&e.sdkVersion!==w.gen2&&(D=N(e,D,{namedImports:["withChildren"],importPath:"@builder.io/react"})),D=Le(e,D,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=_.components,C=_.components.filter(at=>at.isRegistered)}}}if(g&&o){D=ke(e,D),D=Ne(e,D);let E=ee(e,D);E=Se(E),E=await e.formatCode(e.registryPath,E),await e.writeFile(e.registryPath,E)}return d}function ga(e,t){if(e.sdkVersion===w.gen2)return e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName));let n=e.ts.factory.createIdentifier(t.importName),r=t.acceptsChildren?e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("withChildren"),void 0,[n]):n;return e.ts.factory.createPropertyAssignment("component",r)}function uc(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([ga(e,t),...t.acceptsChildren&&e.sdkVersion===w.gen2?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}async function lc(e,t,n){let r=Q(e,t,"CUSTOM_COMPONENTS");if(!r)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=r.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Bn(e,t,i[o]))?.id===n.cmpInfo.id){a=o;break}return{...r,elements:i,elmIndex:a}}async function Ca(e){let t=[],n=await mc(e,t);return t.push(...await Tr(e)),await dc(e,n),await pc(e,t),t}async function ha(e){let t=[];return t.push(...await Tr(e)),await cc(e,t),t}async function cc(e,t){let n=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureFigmaImportRoute, hasLocaleParam"),n=`($locale).${n}`);let r=e.join(e.routesDir,n),i=await e.exists(r);e.debug(`remixEnsureFigmaImportRoute, hasRoute: ${i}`);let a=await e.formatCode(r,Ea({sys:e,routePath:r,modelName:"figma-imports"}));await e.writeFile(r,a),t.push({filePath:r,modifiedType:i?"update":"create"})}async function pc(e,t){let n=`$.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureAppRoute, hasLocaleParam"),n=`($locale).${n}`),e.sdkVersion===w.gen2&&(n=`($slug)._index.${e.typescriptEnabled?"tsx":"jsx"}`);let r=e.join(e.routesDir,n),i=await e.exists(r);e.debug(`remixEnsureAppRoute, hasRoute: ${i}`);let a=await e.formatCode(r,Ea({sys:e,routePath:r,modelName:"page"}));await e.writeFile(r,a),t.push({filePath:r,modifiedType:i?"update":"create"})}function Ea({sys:e,routePath:t,modelName:n}){let r=e.typescriptEnabled,i=$(e,t,e.registryPath),a="",o="";r&&(a="import type { LoaderArgs } from '@remix-run/server-runtime';",o=": LoaderArgs");let s=`process.env.${tr}`;return e.getFrameworks().some(u=>u.name==="@shopify/remix-oxygen")&&(s=`context.env.${tr}`),r&&(s+="!"),e.sdkVersion===w.gen2?`
666
+
667
+ import {
668
+ Content,
669
+ fetchOneEntry,
670
+ getBuilderSearchParams,
671
+ isPreviewing,
672
+ } from "@builder.io/sdk-react";
673
+ ${r?'import type { LoaderFunctionArgs } from "@remix-run/node";':""}
674
+ import { useLoaderData } from "@remix-run/react";
675
+ import { fetch ${r?"as webFetch":""}} from "@remix-run/web-fetch";
676
+ import { CUSTOM_COMPONENTS } from ${JSON.stringify(i)};
677
+
678
+ export const loader = async ({ params, request }${r?": LoaderFunctionArgs":""}) => {
679
+ const builderApiKey = ${s};
680
+ const url = new URL(request.url);
681
+ const urlPath = \`/\${params["slug"] || ""}\`;
682
+
683
+ const page = await fetchOneEntry({
684
+ model: "${n}",
685
+ apiKey: builderApiKey,
686
+ options: getBuilderSearchParams(url.searchParams),
687
+ userAttributes: { urlPath },
688
+ fetch: webFetch,
689
+ });
690
+
691
+ if (!page && !isPreviewing(url.search)) {
692
+ throw new Response("Page Not Found", {
693
+ status: 404,
694
+ statusText: "Page not found in Builder.io",
695
+ });
696
+ }
697
+
698
+ return { page, builderApiKey };
699
+ };
700
+
701
+ // Define and render the page.
702
+ export default function Page() {
703
+ const { page, builderApiKey } = useLoaderData${r?"<typeof loader>":""}();
704
+ // Render the page content from Builder.io
705
+ return (
706
+ <Content
707
+ model="${n}"
708
+ apiKey={builderApiKey}
709
+ content={page}
710
+ customComponents={CUSTOM_COMPONENTS}
711
+ />
712
+ );
713
+ }
714
+ `:`
715
+ import { BuilderComponent, builder } from "@builder.io/react";
716
+ import { useLoaderData } from "@remix-run/react";
717
+ import { CUSTOM_COMPONENTS } from ${JSON.stringify(i)};
718
+ ${a}
719
+
720
+ // Fetch contents of the page
721
+ export const loader = async ({ params, request, context }${o}) => {
722
+ // Initialize the Builder client and pass in your Public API Key
723
+ const builderApiKey = ${s};
724
+ builder.init(builderApiKey);
725
+
726
+ // Fetch data content from Builder.io based on the URL path
727
+ const page = await builder
728
+ .get("${n}", {
729
+ userAttributes: {
730
+ urlPath: "/" + params["*"],
731
+ },
732
+ locale: params.locale,
733
+ })
734
+ .toPromise();
735
+
736
+ // Verify the user is previewing or editing in Builder
737
+ const isPreviewing = new URL(request.url).searchParams.has("builder.preview");
738
+
739
+ // If the page is not found and the user is not previewing, throw a 404.
740
+ // The CatchBoundary component will catch the error
741
+ if (!page && !isPreviewing) {
742
+ throw new Response("Page Not Found", {
743
+ status: 404,
744
+ statusText:
745
+ "We couldn't find this page, please check your url path and if the page is published on Builder.io.",
746
+ });
747
+ }
748
+
749
+ return { page, builderApiKey };
750
+ };
751
+
752
+ // Define and render the page.
753
+ export default function Page() {
754
+ // Use the useLoaderData hook to get the Page data from "loader" above.
755
+ const { page, builderApiKey } = useLoaderData${r?"<typeof loader>":""}();
756
+
757
+ // Render the page content from Builder.io
758
+ return (
759
+ <BuilderComponent
760
+ customComponents={CUSTOM_COMPONENTS}
761
+ apiKey={builderApiKey}
762
+ model="${n}"
763
+ content={page}
764
+ />
765
+ );
766
+ }
767
+
768
+ ${r?`
769
+ declare global {
770
+ interface Env {
771
+ ${tr}: string;
772
+ }
773
+ }
774
+ `:""}
775
+ `}async function mc(e,t){let r=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${r}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=fc(e),l=await e.exists(a);if(e.debug(`remixEnsureCounterComponent, hasCounterCmp: ${l}`),!l){let p=await e.formatCode(a,s);await e.writeFile(a,p),t.push({filePath:a,modifiedType:"create"})}let c=await e.exists(o);return e.debug(`remixEnsureCounterComponent, hasCounterStyles: ${c}`),c||(await e.writeFile(o,u),t.push({filePath:o,modifiedType:"create"})),a}function fc(e){let t=e.typescriptEnabled,n=`
776
+ import { useState } from "react";
777
+ import styles from "./styles.module.css";
778
+ ${t?`
779
+ interface CounterProps {
780
+ initialCount?: number;
781
+ }`:""}
782
+
783
+ function Counter({ initialCount = 99 }${t?": CounterProps":""}) {
784
+ const [count, setCount] = useState(initialCount);
785
+
786
+ const increment = () => {
787
+ setCount((prevCount) => prevCount + 1);
788
+ };
789
+
790
+ const decrement = () => {
791
+ setCount((prevCount) => prevCount - 1);
792
+ };
793
+
794
+ return (
795
+ <div className={styles.counter}>
796
+ <button className={styles.btn} onClick={decrement}>
797
+ -
798
+ </button>
799
+ <span className={styles.count}>{count}</span>
800
+ <button className={styles.btn} onClick={increment}>
801
+ +
802
+ </button>
803
+ </div>
804
+ );
805
+ }
806
+
807
+ export default Counter;
808
+ `.trimStart(),r=`
809
+ .counter {
810
+ margin: 32px auto;
811
+ display: flex;
812
+ width: 100%;
813
+ max-width: 190px;
814
+ color: #1c6bd1;
815
+ }
816
+
817
+ .btn {
818
+ width: 42px;
819
+ font-size: 32px;
820
+ font-weight: bold;
821
+ background-color: #1c6bd1;
822
+ color: white;
823
+ border: none;
824
+ border-radius: 4px;
825
+ cursor: pointer;
826
+ line-height: 1.4;
827
+ }
828
+
829
+ .btn:hover {
830
+ opacity: 0.8;
831
+ }
832
+
833
+ .count {
834
+ flex: 1;
835
+ font-size: 42px;
836
+ text-align: center;
837
+ }
838
+ `.trimStart();return{component:n,styles:r}}async function dc(e,t){let r=(await je(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);r&&await je(e,r.id,!0,!1,null,null,!0,!1)}async function Tr(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Dc(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}function Dc(e){let t=e.sdkVersion===w.gen2;return e.typescriptEnabled?`import type { RegisteredComponent } from ${t?'"@builder.io/sdk-react"':'"@builder.io/react"'};
839
+
840
+ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
841
+ ];`:`export const CUSTOM_COMPONENTS = [
842
+ ];
843
+ `}async function xa(e){let t=await gc(e);return{builderPageOptions:async()=>{let r="/builder-demo",i=t.hasLocaleParam?`/en-us${r}`:void 0;return{templateContentId:"a5c9eef7909d4fc99554264a17de22c9",pathname:r,localePathname:i,title:"Builder + Remix Demo Page"}},ensureBuilderSetup:()=>Ca(t),ensureFigmaImportPage:()=>ha(t),getRegistryPath:()=>t.registryPath,getRegistry:r=>je(t,null,!1,!1,null,null,!1,!!r?.readAllInputTypes),addExternalPackage:r=>{t.addExternalPackage(r)},loadComponent:async r=>{let i=await je(t,r.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===r.cmpId)}},registerComponent:r=>je(t,r.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:r=>je(t,r.cmpId,!1,!1,r,null,!0,!1),setRegisteredComponentInput:r=>je(t,r.cmpId,!1,!1,null,r,!0,!1),unregisterComponent:r=>je(t,r.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>er(t),setPublicApiKey:r=>fa(t,r.publicApiKey),getDependencies:r=>r.sdkVersion===w.gen2?[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-react"}]:[{name:"@builder.io/dev-tools"},{name:"@builder.io/react"},{name:"@builder.io/sdk"}],getDevRunCommand:()=>"dev",getCache:()=>Pe(t),setCache:r=>Te(t,r)}}async function gc(e){let t=await hc(e),n=e.getAppRootDir(),r=await Ec(e),i=e.dirname(r),a=e.join(i,"components"),o=await de(e),s=await he(e,i),u={},l={...e,registryPath:s,remixConfigPath:t,typescriptEnabled:o,appDir:i,componentsDir:a,routesDir:r,hasLocaleParam:await Cc(e,r),addExternalPackage:c=>{u[e.join(n,c,"index.ts")]=`export * from "${c}";`},readFileSync:c=>u[c]??e.readFileSync(c),existsSync:c=>!!u[c]||e.existsSync(c),readdirSync:c=>{let p=e.readdirSync(c);return c===n?[...p,...Object.keys(u).map(m=>m.slice(n.length+1))]:p},readdir:async c=>{let p=await e.readdir(c);return c===n?[...p,...Object.keys(u).map(m=>m.slice(n.length+1))]:p}};return e.sdkVersion?l.sdkVersion=e.sdkVersion:l.sdkVersion=await Ot(l),l}async function Cc(e,t){return(await e.readdir(t)).some(r=>r.startsWith("($locale)."))}async function hc(e){let t=["remix.config.ts","remix.config.js","vite.config.ts","vite.config.js"];for(let n of t){let r=e.join(e.getAppRootDir(),n);if(await e.exists(r))return r}throw new Error(`Could not find Remix config file. Searched for ${t.join(", ")} in "${e.getAppRootDir()}".`)}async function Ec(e){let t=await Ut(e,e.getAppRootDir(),"routes");if(t)return t;throw new Error(`Could not find Remix "routes" directory in "${e.getAppRootDir()}". Please ensure this command is ran from within your Remix project's directory.`)}async function rr(e){let t=[".env"],n=e.configType==="vite"?nr:Ir;return await et(e,t,n)}async function Fa(e,t){let n=await rr(e),r=await tt(e,n.file,n.envKey,t);return{...n,modifiedType:r}}var nr="VITE_PUBLIC_BUILDER_KEY",Ir="YOUR_PUBLIC_BUILDER_KEY";function ya(e,t){let n=`Builder.registerComponent(
844
+ `;n+=` ${t.importName},
845
+ `,n+=` {
846
+ name: "${t.name}",
847
+ }
848
+ `,n+=");";let r=gr(e,n);return Rn(e,r,t)}function Rn(e,t,n){if(!e.ts.isExpressionStatement(t))return t;let r=t.expression;if(!e.ts.isCallExpression(r))return t;let i=[...r.arguments];if(i.length<2)return t;let a=i[1];return e.ts.isObjectLiteralExpression(a)?(i[1]=Z(e,a,n),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(r,r.expression,r.typeArguments,i))):t}async function Sa(e){let t=await e.readFile(e.registryPath);return t?xc(e,t):{components:[],sourceFile:B(e,"")}}async function xc(e,t){let n=B(e,t);return e.sdkVersion===w.gen2?Sc(e,n):Fc(e,n)}async function Fc(e,t){let n=[];for(let r=0;r<t.statements.length;r++){let i=t.statements[r];if(!e.ts.isExpressionStatement(i))continue;let a=i.expression;if(!e.ts.isCallExpression(a))continue;let o=a.expression;if(!e.ts.isPropertyAccessExpression(o))continue;let s=o.expression;if(!e.ts.isIdentifier(s)||s.text!=="Builder"||o.name.text!=="registerComponent")continue;let l=a.arguments;if(l.length<2)continue;let c=l[1];if(!e.ts.isObjectLiteralExpression(c))continue;let p=l[0];if(e.ts.isIdentifier(p)){let m=await yc(e,t,r,p,c,!1);m&&n.push(m);continue}}return{sourceFile:t,components:pe(n)}}async function yc(e,t,n,r,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:n,acceptsChildren:a},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===r.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;o.filePath=await Nn(e,l.text),o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),o.importPath=M(e,o.filePath),o.name=Ce(e,o.filePath),o.importName=r.text,o.exportName="default",o.exportType="default"}else{let l=s.find(m=>!m.importClause||!m.importClause.namedBindings||!e.ts.isNamedImports(m.importClause.namedBindings)?!1:m.importClause.namedBindings.elements.some(C=>C.name.text===r.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await Nn(e,c.text);o.filePath=await Nn(e,c.text),o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=M(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=K(r.text),o.importName=r.text,o.exportName=r.text,o.exportType="named"}return o=me(e,o,i),o.displayFilePath=O(e,o.filePath),o.filePath&&o.exportName&&(o.id=await V(e,o.filePath,o.exportName,o.externalImportPath)),o}function Nn(e,t){return Xt(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}async function Sc(e,t){let n=[],r=Q(e,t,"CUSTOM_COMPONENTS");return r&&await Promise.all(r.arrayLiteralExp.elements.map(async(i,a)=>{let o=await $n(e,t,i);o&&(o.nodeIndex=a,n.push(o))})),{sourceFile:t,components:pe(n)}}async function $n(e,t,n){if(!e.ts.isObjectLiteralExpression(n))return null;let r={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1};It(e,n)&&(r.acceptsChildren=!0);for(let a of n.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(L(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;r.name===""&&(r.name=K(s)),r.importName=s;let l=await Be(e,e.registryPath,t,s);if(!l)continue;r.filePath=l.filePath,r.relFilePath=l.relFilePath,await e.exists(l.filePath)?r.importPath=M(e,l.filePath):(r.externalImportPath=l.importPath,r.importPath=r.externalImportPath),r.displayFilePath=l.displayFilePath,r.exportType=l.exportType;let c=t.statements.filter(m=>e.ts.isImportDeclaration(m)),p=c.find(m=>m.importClause&&m.importClause.name?.text===s);if(p){let m=p.moduleSpecifier;if(!e.ts.isStringLiteral(m))return null;r.exportName="default"}else{let m=c.find(d=>!d.importClause||!d.importClause.namedBindings||!e.ts.isNamedImports(d.importClause.namedBindings)?!1:d.importClause.namedBindings.elements.some(g=>g.name.text===s));if(!m)return null;let C=m.moduleSpecifier;if(!e.ts.isStringLiteral(C))return null;r.exportName=s}continue}}return r=me(e,r,n),r.filePath&&r.exportName&&(r.id=await V(e,r.filePath,r.exportName,r.externalImportPath)),r}async function Me(e,t,n,r,i,a,o,s){let u=await nt(e),[l,c,p,m]=await Promise.all([Oi(e,u),Sa(e),de(e),rr(e)]),C=l.map(x=>x.cmpInfo),d=c.components,g={components:Ae(C,d),registryPath:e.registryPath,registryDisplayPath:O(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Re(C),publicApiKey:m.envValue??void 0,devToolsVersion:e.version};if(s)return g.components=await Nt(e,g.components),g;let D=!1,f=c.sourceFile,E=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(E.length>0){let x=E.map(F=>{let R=l.find(W=>W.cmpInfo.id===F);if(!R)throw new Error(`Component ${F} not found`);return R}),y=Array.from(new Set(x.map(F=>F.cmpInfo.filePath))),S=await X(e,y);for(let F of x){let R=g.components.find(v=>v.id===F.cmpInfo.id),W=await $t(e,F,S,e.registryPath===F.cmpInfo.filePath||ge(F.cmpInfo.filePath));De(R,W);let _=C.findIndex(v=>v.id===F.cmpInfo.id);C[_].inputs=W;let A=Oe(F.cmpInfo.id,C,d,n,r,i,a);if(e.sdkVersion===w.gen2){let{elements:v,elmIndex:ae,statementIndex:Fe,statement:ne,variableDeclaration:j}=await Ac(e,f,F);if(A.addCmpToRegistry)v.push(vc(e,A.addCmpToRegistry)),D=!0;else if(A.removeCmpFromRegistry)v.splice(ae,1),D=!0;else if(A.updateRegisteredCmp){let se=Z(e,v[ae],A.updateRegisteredCmp),at=e.ts.factory.createIdentifier(A.updateRegisteredCmp.importName);v[ae]=e.ts.factory.updateObjectLiteralExpression(se,[e.ts.factory.createPropertyAssignment("component",at),...se.properties.slice(1)]),D=!0}if(D&&o){let se=[...f.statements];se[Fe]=e.ts.factory.updateVariableStatement(ne,ne.modifiers,e.ts.factory.updateVariableDeclarationList(ne.declarationList,[e.ts.factory.updateVariableDeclaration(j,j.name,j.exclamationToken,j.type,e.ts.factory.createArrayLiteralExpression($e(e,v)))])),f=e.ts.factory.updateSourceFile(f,se),f=Aa(e,A,f),f=N(e,f,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),f=Le(e,f,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),g.components=A.components,d=A.components.filter(at=>at.isRegistered)}}else{let v=[...f.statements];A.addCmpToRegistry?(v.push(ya(e,A.addCmpToRegistry)),D=!0):A.removeCmpFromRegistry?(v.splice(A.nodeIndex,1),D=!0):A.updateRegisteredCmp&&(v[A.nodeIndex]=Rn(e,v[A.nodeIndex],A.updateRegisteredCmp),D=!0),D&&o&&(f=e.ts.factory.updateSourceFile(f,v),f=N(e,f,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),f=Aa(e,A,f),R?.acceptsChildren&&(f=N(e,f,{namedImports:["withChildren"],importPath:"@builder.io/react"})),g.components=A.components,d=A.components.filter(ae=>ae.isRegistered))}}}if(D&&o){f=ke(e,f),f=Ne(e,f);let x=ee(e,f);x=Se(x),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return g}async function Ac(e,t,n){let r=Q(e,t,"CUSTOM_COMPONENTS");if(!r)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=r.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await $n(e,t,i[o]))?.id===n.cmpInfo.id){a=o;break}return{...r,elements:i,elmIndex:a}}function vc(e,t){let n=e.ts.factory.createIdentifier(t.importName);return Z(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",n),...t.acceptsChildren?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}function Aa(e,t,n){let r=t.addCmpToRegistry||t.updateRegisteredCmp;if(r){let i=r.externalImportPath?r.externalImportPath:$(e,e.registryPath,r.filePath);r.exportType==="default"?n=N(e,n,{defaultImport:r.importName,importPath:i}):r.exportType==="named"&&(n=N(e,n,{namedImports:[r.importName],importPath:i}))}return n}async function va(e){let t=[],n=await wc(e,t);if(await Pa(e,t,n),!await e.exists(e.builderComponentPath)){let r=await e.formatCode(e.builderComponentPath,ba(e,e.builderComponentPath));await e.writeFile(e.builderComponentPath,r),t.push({filePath:e.builderComponentPath,modifiedType:"create"})}return t}async function wa(e){let t=[];await Pa(e,t);let n=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`,r=e.join(e.componentsDir,n);if(!await e.exists(r)){let i=await e.formatCode(r,ba(e,r,"figma-imports"));await e.writeFile(r,i),t.push({filePath:r,modifiedType:"create"})}return t}function ba(e,t,n="page"){let r=e.typescriptEnabled;return e.sdkVersion===w.gen2?`
849
+ import React from "react";
850
+ import {
851
+ Content,
852
+ fetchOneEntry,
853
+ getBuilderSearchParams,
854
+ isPreviewing,
855
+ ${r?"type BuilderContent,":""}
856
+ } from "@builder.io/sdk-react";
857
+ import { CUSTOM_COMPONENTS } from ${JSON.stringify($(e,t,e.registryPath))};
858
+
859
+ // Builder Public API Key set in .env file
860
+ const BUILDER_API_KEY = ${e.configType==="vite"?`import.meta.env.${nr};`:`${Ir};`}
861
+ const MODEL_NAME = "${n}";
862
+
863
+ export default function BuilderPage() {
864
+ const [notFound, setNotFound] = React.useState(false);
865
+ const [content, setContent] = React.useState${r?"<BuilderContent | null>":""}(null);
866
+
867
+ // get the page content from Builder
868
+ React.useEffect(() => {
869
+ fetchOneEntry({
870
+ model: MODEL_NAME,
871
+ apiKey: BUILDER_API_KEY,
872
+ userAttributes: {
873
+ urlPath: window.location.pathname,
874
+ },
875
+ options: getBuilderSearchParams(new URL(location.href).searchParams),
876
+ })
877
+ .then((content) => {
878
+ if (content) {
879
+ setContent(content);
880
+ }
881
+ setNotFound(!content);
882
+ })
883
+ .catch((err) => {
884
+ console.log("Oops: ", err);
885
+ });
886
+ }, []);
887
+
888
+ // If no page is found, return
889
+ // a 404 page from your code.
890
+ if (notFound && !isPreviewing()) {
891
+ return <div>404 Page Not Found</div>;
892
+ }
893
+
894
+ // return the page when found
895
+ return (
896
+ <>
897
+ {/* Render the Builder page */}
898
+ <Content
899
+ content={content}
900
+ model={MODEL_NAME}
901
+ apiKey={BUILDER_API_KEY}
902
+ customComponents={CUSTOM_COMPONENTS}
903
+ />
904
+ </>
905
+ );
906
+ }
907
+ `:`
908
+ import React from "react";
909
+ import { BuilderComponent, builder, useIsPreviewing } from "@builder.io/react";
910
+ import ${JSON.stringify($(e,t,e.registryPath))};
911
+
912
+ // Builder Public API Key set in .env file
913
+ ${e.configType==="vite"?`builder.init(import.meta.env.${nr}${r?"!":""})`:`builder.init("${Ir}")`}
914
+
915
+ export default function BuilderPage() {
916
+ const isPreviewingInBuilder = useIsPreviewing();
917
+ const [notFound, setNotFound] = React.useState(false);
918
+ const [content, setContent] = React.useState(null);
919
+
920
+ // get the page content from Builder
921
+ React.useEffect(() => {
922
+ async function fetchContent() {
923
+ const content = await builder
924
+ .get("${n}", {
925
+ url: window.location.pathname,
926
+ })
927
+ .promise();
928
+
929
+ setContent(content);
930
+ setNotFound(!content);
931
+
932
+ // if the page title is found,
933
+ // set the document title
934
+ if (content?.data.title) {
935
+ document.title = content.data.title;
936
+ }
937
+ }
938
+ fetchContent();
939
+ }, []);
940
+
941
+ if (content === null) {
942
+ return;
943
+ }
944
+ // If no page is found, return
945
+ // a 404 page from your code.
946
+ if (notFound && !isPreviewingInBuilder) {
947
+ return <div>404 Page Not Found</div>;
948
+ }
949
+
950
+ // return the page when found
951
+ return (
952
+ <>
953
+ {/* Render the Builder page */}
954
+ <BuilderComponent model="${n}" content={content} />
955
+ </>
956
+ );
957
+ }
958
+ `.trimStart()}async function Pa(e,t,n){if(!await e.exists(e.registryPath)){if(e.sdkVersion===w.gen2){let a=Pc(e);await e.writeFile(e.registryPath,a)}else await e.writeFile(e.registryPath,"");t.push({filePath:e.registryPath,modifiedType:"create"})}if(!n)return;let i=(await Me(e,null,!1,!1,null,null,!1,!1)).components.find(a=>a.filePath===n);i&&await Me(e,i.id,!0,!1,null,null,!0,!1)}async function wc(e,t){let r=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${r}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=bc(e);if(!await e.exists(a)){let l=await e.formatCode(a,s);await e.writeFile(a,l),t.push({filePath:a,modifiedType:"create"})}return await e.exists(o)||(await e.writeFile(o,u),t.push({filePath:o,modifiedType:"create"})),a}function bc(e){let t=e.typescriptEnabled,n=`
959
+ "use client"
960
+ import React, { useState } from "react";
961
+ import styles from "./styles.module.css";
962
+ ${t?`
963
+ interface CounterProps {
964
+ initialCount?: number;
965
+ }`:""}
966
+
967
+ function Counter({ initialCount = 99 }${t?": CounterProps":""}) {
968
+ const [count, setCount] = useState(initialCount);
969
+
970
+ const increment = () => {
971
+ setCount((prevCount) => prevCount + 1);
972
+ };
973
+
974
+ const decrement = () => {
975
+ setCount((prevCount) => prevCount - 1);
976
+ };
977
+
978
+ return (
979
+ <div className={styles.counter}>
980
+ <button className={styles.btn} onClick={decrement}>
981
+ -
982
+ </button>
983
+ <span className={styles.count}>{count}</span>
984
+ <button className={styles.btn} onClick={increment}>
985
+ +
986
+ </button>
987
+ </div>
988
+ );
989
+ }
990
+
991
+ export default Counter;
992
+ `.trimStart(),r=`
993
+ .counter {
994
+ margin: 32px auto;
995
+ display: flex;
996
+ width: 100%;
997
+ max-width: 190px;
998
+ }
999
+
1000
+ .btn {
1001
+ width: 42px;
1002
+ font-size: 32px;
1003
+ font-weight: bold;
1004
+ background-color: #1c6bd1;
1005
+ color: white;
1006
+ border: none;
1007
+ border-radius: 4px;
1008
+ cursor: pointer;
1009
+ line-height: 1.4;
1010
+ }
1011
+
1012
+ .btn:hover {
1013
+ opacity: 0.8;
1014
+ }
1015
+
1016
+ .count {
1017
+ flex: 1;
1018
+ font-size: 42px;
1019
+ text-align: center;
1020
+ }
1021
+ `.trimStart();return{component:n,styles:r}}function Pc(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-react";
1022
+
1023
+ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
1024
+ ];`:`export const CUSTOM_COMPONENTS = [
1025
+ ];
1026
+ `}async function Ta(e){let t=await Tc(e);return{builderPageOptions:async()=>({templateContentId:"2e36438034894a8abf279ea9e6d3596f",pathname:"/builder-demo",title:"Builder + React Demo Page"}),ensureBuilderSetup:()=>va(t),ensureFigmaImportPage:()=>wa(t),getRegistryPath:()=>t.registryPath,getRegistry:r=>Me(t,null,!1,!1,null,null,!1,!!r?.readAllInputTypes),addExternalPackage:r=>{t.addExternalPackage(r)},loadComponent:async r=>{let i=await Me(t,r.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===r.cmpId)}},registerComponent:r=>Me(t,r.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:r=>Me(t,r.cmpId,!1,!1,r,null,!0,!1),setRegisteredComponentInput:r=>Me(t,r.cmpId,!1,!1,null,r,!0,!1),unregisterComponent:r=>Me(t,r.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>rr(t),setPublicApiKey:r=>Fa(t,r.publicApiKey),getDependencies:r=>r.sdkVersion===w.gen2?[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-react"}]:[{name:"@builder.io/dev-tools"},{name:"@builder.io/react"},{name:"@builder.io/sdk"}],getDevRunCommand:()=>"dev",getCache:()=>Pe(t),setCache:r=>Te(t,r)}}async function Tc(e){let t=await Ic(e),n=e.getAppRootDir(),r=e.join(n,"src"),i=await de(e),a={},o={...e,srcDir:null,builderComponentPath:"",componentsDir:"",registryPath:"",reactConfigPath:t,typescriptEnabled:i,configType:"",addExternalPackage:s=>{a[e.join(n,s,"index.ts")]=`export * from "${s}";`},readFileSync:s=>a[s]??e.readFileSync(s),existsSync:s=>!!a[s]||e.existsSync(s),readdirSync:s=>{let u=e.readdirSync(s);return s===n?[...u,...Object.keys(a).map(l=>l.slice(n.length+1))]:u},readdir:async s=>{let u=await e.readdir(s);return s===n?[...u,...Object.keys(a).map(l=>l.slice(n.length+1))]:u}};return e.sdkVersion?o.sdkVersion=e.sdkVersion:o.sdkVersion=await Ot(o),t.includes("webpack.config")&&(o.configType="webpack"),t.includes("vite.config")&&(o.configType="vite"),await e.exists(r)?(o.srcDir=r,o.componentsDir=e.join(r,"components"),o.registryPath=await he(e,r),o.builderComponentPath=e.join(o.srcDir,`builder-page.${i?"tsx":"jsx"}`)):(o.componentsDir=e.join(n,"components"),o.registryPath=await he(e,n),o.builderComponentPath=e.join(n,`builder-page.${i?"tsx":"jsx"}`)),o}async function Ic(e){let t=["vite.config.ts","vite.config.js","webpack.config.js","webpack.config.ts"];for(let n of t){let r=e.join(e.getAppRootDir(),n);if(await e.exists(r))return r}if(e.ignoreMissingConfig)return"";throw new Error(`Could not find React config file. Searched for ${t.join(", ")} in "${e.getAppRootDir()}".`)}async function or(e){return await Bc(e,["environment.ts"],Br)}async function Ia(e,t){let n=await or(e),r=await kc(e,n.file,n.envKey,t);return{...n,modifiedType:r}}async function Bc(e,t,n){let r={envKey:n,envValue:null,file:""};for(let i of t){let a=e.join(e.getAppRootDir(),"src","environments",i),o=await Rc(e,a);if(typeof o=="string"&&o.length>0&&o!=="YOUR_API_KEY")return r.envValue=o,r.file=a,r}return r.file=e.join(e.getAppRootDir(),"src","environments",t[t.length-1]),r}async function Rc(e,t){let n=await e.readFile(t);return n?Nc(e,n):""}function Nc(e,t){let n=B(e,t),r="",a=Bt(e,n,"environment");if(a&&a.statement.declarationList.declarations.length>0){let s=a.statement.declarationList.declarations[0].initializer;s&&e.ts.isObjectLiteralExpression(s)&&s.properties.forEach(u=>{e.ts.isPropertyAssignment(u)&&e.ts.isIdentifier(u.name)&&u.name.text===Br&&e.ts.isStringLiteral(u.initializer)&&(r=u.initializer.text)})}return r}async function $c(e,t,n,r){let i=B(e,t),o=Bt(e,i,"environment");if(o&&o.statement.declarationList.declarations.length>0){let s=o.statement.declarationList,u=s.declarations[0],l=u.initializer;if(l&&e.ts.isObjectLiteralExpression(l)){let c=e.ts.factory.createPropertyAssignment(e.ts.factory.createIdentifier(n),e.ts.factory.createStringLiteral(r)),p=e.ts.factory.createNodeArray([...l.properties,c]),m=e.ts.factory.updateObjectLiteralExpression(l,p),C=e.ts.factory.updateVariableDeclaration(u,u.name,u.exclamationToken,u.type,m),d=e.ts.factory.updateVariableDeclarationList(s,[C]);return e.ts.factory.updateVariableStatement(o.statement,o.statement.modifiers,d)}return null}return null}async function kc(e,t,n,r){let i=await e.readFile(t);if(i)if(i.includes(n))e.debug(`"${n}" already set in ${t}`);else{e.debug(`Add "${n}" to ${t}`);let a=await $c(e,i,n,r);if(a){let o=ee(e,a),s=await e.formatCode(t,o);await e.writeFile(t,s)}return"update"}else{e.debug(`Creating new env file with "${n}" at ${t}`);let a=`
1027
+ // https://www.builder.io/c/docs/using-your-api-key
1028
+ export const environment = {
1029
+ production: false,
1030
+ builderApiKey: "${r}",
1031
+ };
1032
+ `.trimStart(),o=await e.formatCode(t,a);return await e.writeFile(t,o),"create"}return null}var Br="builderApiKey";async function Ra(e,t){let n=[],r=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(r.map(async a=>{let o=e.basename(a.fileName);if(_c(e,a.fileName)||o.startsWith(".")||o==="node_modules"||Oc.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await Rr(e,i,s,a);n.push(...u)})),n.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var Oc=new Set([]),Lc=new Set(["node_modules"]);function _c(e,t){for(let n of Lc)if(e.dirname(t).includes(n))return!0;return!1}async function Na(e,t){let n=e.extname(t).toLowerCase();if(n===".tsx"||n===".jsx"||n===".ts"||n===".js"){let r=await e.readFile(t);if(r)return jc(e,t,r)}return null}function jc(e,t,n){let r=B(e,n);return Rr(e,null,t,r)}async function Rr(e,t,n,r){let i=[],a={};n=e.normalize(n);let o=r.statements.filter(c=>e.ts.isClassDeclaration(c)&&zc(e,c)),s=r.statements.find(c=>e.ts.isImportDeclaration(c)&&e.ts.isStringLiteral(c.moduleSpecifier)&&c.moduleSpecifier.text==="@angular/core");if(s&&e.ts.isImportDeclaration(s)){let c=s.importClause?.namedBindings;if(c&&e.ts.isNamedImports(c)){let p=c.elements.find(m=>(m.propertyName??m.name).text==="input");p&&(a.inputSignalImportName=p.name.text)}}let u=await Vc(e,t,n,r),l=qc(e,r);return await Promise.all(o.map(async c=>{let p=await Mc(e,t,n,c,l,a);i.push(...p)})),i.push(...u),i}async function kn(e,t,n){if(t.node.fnNode){let{sourceFile:r,typeChecker:i}=await yt(e,t.cmpInfo.filePath,n),o=(await Rr(e,i,t.cmpInfo.filePath,r)).find(s=>s.cmpInfo.id===t.cmpInfo.id);if(!o)throw new Error(`Could not find component ${t.cmpInfo.name} in ${t.cmpInfo.filePath}`);return o.cmpInfo.inputs}return[]}async function $a(e,t,n){if(!n.some(s=>!s.isRegistered))return n;let i=await X(e,n.map(s=>s.filePath)),a=i.getTypeChecker();return await Promise.all(n.filter(s=>!(s.name.endsWith("Page")||s.name.endsWith("Module")||s.name==="AppComponent")).map(async s=>{if(!s.isRegistered){let u=i.getSourceFile(s.filePath);if(u){let c=(await Rr(e,a,s.filePath,u)).find(p=>p.cmpInfo.id===s.id);if(c){s.inputs=pt(e,a,c.node.fnNode);let p=t.find(m=>m.cmpInfo.id===s.id);if(p){let m=await kn(e,p,i);De(s,m)}}}}return s}))}async function Mc(e,t,n,r,i,a){let o=[],s=e.relative(e.getAppRootDir(),n),u=M(e,n),l=r.name?.text;if(!l)return o;let c=!1;r.modifiers&&(c=r.modifiers.some(d=>d.kind===e.ts.SyntaxKind.DefaultKeyword));let p=c?"default":l,m=c?"default":"named",C=[];return r.members.forEach(d=>{if(e.ts.isPropertyDeclaration(d)||e.ts.isGetAccessor(d)||e.ts.isSetAccessor(d)){let f=(e.ts.getDecorators(d)??[]).find(x=>Kc(e,x))!==void 0&&e.ts.isIdentifier(d.name),E=a?.inputSignalImportName!==void 0&&e.ts.isIdentifier(d.name)&&Uc(e,d,a.inputSignalImportName);if(f||E){let x="any";if(e.ts.isSetAccessor(d))x=Ba(e,d.parameters[0].type);else if(d.type&&t){let S=t.getTypeAtLocation(d.type);x=t.typeToString(S)}else x=Ba(e,d.type);let y={name:d.name.text,type:i[x]?"string":x};i[x]&&(y.enum=i[x]),C.push(y)}}}),o.push({cmpInfo:{id:await V(e,n,l),displayFilePath:O(e,n),name:K(l),inputs:C,exportName:p,exportType:m,importName:l,filePath:n,relFilePath:s,importPath:u,meta:{...Jc(e,r)}},node:{name:l,fnNode:r,deps:void 0}}),o}async function Vc(e,t,n,r){let i=[],a=e.relative(e.getAppRootDir(),n),o=M(e,n);for(let s of r.statements)if(e.ts.isExportDeclaration(s)&&s.exportClause&&e.ts.isNamedExports(s.exportClause))for(let u of s.exportClause.elements){let l=u.name?.text;if(!l)continue;let c=l,p="named",m=[];if(t){let g=t.getSymbolAtLocation(u.name);if(g){let D=t.getDeclaredTypeOfSymbol(g);t.getPropertiesOfType(D).forEach(E=>{let x=E.getDeclarations();x&&x.forEach(y=>{if(e.ts.isPropertyDeclaration(y)){let S=t.getTypeAtLocation(y),F={name:E.getName(),type:Wc(e,t,S)};m.push(F)}})})}}let C=e.ts.isExportSpecifier(u)&&u.parent?u.parent.parent:void 0,d;if(C){let g=C.moduleSpecifier;if(g&&e.ts.isStringLiteral(g)){let D=t?.getSymbolAtLocation(g);if(D&&D.declarations&&D.declarations.length>0){let f=D.declarations[0];(!e.ts.isSourceFile(f)||e.ts.isSourceFile(f)&&f.fileName.includes("node_modules"))&&(d=g.text)}}}i.push({cmpInfo:{id:await V(e,n,l,d),displayFilePath:O(e,n),name:K(l),inputs:m,exportName:c,exportType:p,importName:l,filePath:n,relFilePath:a,importPath:d||o,externalImportPath:d},node:{name:l,fnNode:u,deps:void 0}})}return i}function Kc(e,t){return ka(e,t,"Input")}function Uc(e,t,n){return e.ts.isPropertyDeclaration(t)&&t.initializer!==void 0&&e.ts.isCallExpression(t.initializer)&&e.ts.isIdentifier(t.initializer.expression)&&t.initializer.expression.text===n}function ka(e,t,n){if(e.ts.isCallExpression(t.expression)){let r=t.expression;if(e.ts.isIdentifier(r.expression))return r.expression?.text===n}return!1}function zc(e,t){return!!e.ts.getDecorators(t)?.some(i=>e.ts.isCallExpression(i.expression)&&e.ts.isIdentifier(i.expression.expression)&&i.expression.expression.text==="Component")}function Ba(e,t){if(!t)return"any";let n="any";switch(t.kind){case e.ts.SyntaxKind.StringKeyword:n="string";break;case e.ts.SyntaxKind.NumberKeyword:n="number";break;case e.ts.SyntaxKind.BooleanKeyword:n="boolean";break;case e.ts.SyntaxKind.TypeReference:e.ts.isTypeReferenceNode(t)&&e.ts.isIdentifier(t.typeName)&&(n=t.typeName.text);break}return n.includes("|")?"string":n}function qc(e,t){let n={};return e.ts.forEachChild(t,r=>{e.ts.isTypeAliasDeclaration(r)&&e.ts.isUnionTypeNode(r.type)&&r.type.types.every(i=>e.ts.isLiteralTypeNode(i)&&e.ts.isStringLiteral(i.literal))&&(n[r.name.text]=r.type.types.map(i=>i.literal.text))}),n}function Wc(e,t,n){let r=t.typeToString(n);if(r==="any"){let i=n.getSymbol();if(i){let a=i.getDeclarations();if(a&&a.length>0){let o=a[0];if(e.ts.isVariableDeclaration(o)){let s=o.type;s&&(r=t.typeToString(t.getTypeAtLocation(s)))}}}}return r}function Jc(e,t){let{getDecorators:n,isCallExpression:r,isIdentifier:i,isObjectLiteralExpression:a,isPropertyAssignment:o,isStringLiteral:s,SyntaxKind:u}=e.ts,l,c;return n(t)?.forEach(m=>{if(ka(e,m,"Component")){let{expression:C}=m;if(r(C)){let[d]=C.arguments;a(d)&&d.properties.forEach(g=>{o(g)&&i(g.name)&&(g.name.escapedText==="selector"&&s(g.initializer)&&(l=g.initializer.text),g.name.escapedText==="standalone"&&(c=g.initializer.kind===u.TrueKeyword))})}}}),{selector:l,standalone:c}}async function Nr(e,t,n){let r=e.typescriptEnabled?".ts":".js",i=`app.module${r}`,a=e.join(e.appDir,i),o=await e.readFile(a);if(!o){console.error(`Unable to read app.module.${r} at ${a}`);return}let s=await Gc(e,a,t,n,o);if(!s){console.error(`Unable to update app.module.${r} at ${a}`);return}return await e.writeFile(a,s),a}async function Gc(e,t,n,r,i){let a=i,o=B(e,i),s=$(e,t,r);o=N(e,o,{namedImports:[n],importPath:s}),o=N(e,o,{namedImports:["Content"],importPath:"@builder.io/sdk-angular"});let u=[];for(let l of o.statements)if(e.ts.isClassDeclaration(l)&&l.name?.text==="AppModule"){let c=Hc(e,n,l);u.push(c)}else u.push(l);return o=e.ts.factory.updateSourceFile(o,u),a=ee(e,o),a}function Hc(e,t,n){let r=e.ts.getDecorators(n);if(r){for(let i of r)if(e.ts.isCallExpression(i.expression)&&e.ts.isIdentifier(i.expression.expression)&&i.expression.expression.text==="NgModule"){let a=i.expression.arguments;if(a.length===1&&e.ts.isObjectLiteralExpression(a[0])){let o=Oa(e,a[0],"declarations",t);if(o){let s=Oa(e,o,"imports","Content");if(s&&(o=s),o){let u=e.ts.factory.updateDecorator(i,e.ts.factory.updateCallExpression(i.expression,i.expression.expression,i.expression.typeArguments,[o])),c=[...r.map(p=>p===i?u:p),...e.ts.getModifiers(n)||[]];return e.ts.factory.updateClassDeclaration(n,c,n.name,n.typeParameters,n.heritageClauses,n.members)}}}}}return n}function Oa(e,t,n,r){let i=[...t.properties],a=i.findIndex(s=>L(e,s)===n);if(a>-1){let s=i[a];if(e.ts.isPropertyAssignment(s)&&s.initializer&&e.ts.isArrayLiteralExpression(s.initializer)){let u=La(e,s.initializer,r);return u?(i[a]=e.ts.factory.updatePropertyAssignment(s,s.name,u),e.ts.factory.updateObjectLiteralExpression(t,i)):null}return null}let o=La(e,e.ts.factory.createArrayLiteralExpression([],!0),r);return o?e.ts.factory.updateObjectLiteralExpression(t,[...i,e.ts.factory.createPropertyAssignment(n,o)]):null}function La(e,t,n){return t.elements.some(i=>e.ts.isIdentifier(i)?i.text===n:!1)?null:e.ts.factory.updateArrayLiteralExpression(t,[...t.elements,e.ts.factory.createIdentifier(n)])}async function On(e,t,n,r){try{if(e.magicast){let a=`app.routes${e.typescriptEnabled?".ts":".js"}`,o=e.join(e.appDir,a),s=await e.magicast.loadFile(o);Object.keys(s.exports).length===0&&(s.exports.routes=[]);let l=Object.keys(s.exports)[0],c=s.exports[l];if(c.find(m=>m.path===t))return;let p=e.magicast.builders.raw("{}");if(p.path=t,p.component=e.magicast.builders.raw(n),c.push(p),s.imports.$items.find(m=>m.imported===n))return;s.imports.$append({imported:n,from:r}),await e.magicast.writeFile(s,o)}}catch(i){console.error(i)}}var Ha=k(Ga(),1);async function Qa(e){let t=e.ts.findConfigFile(e.getAppRootDir(),e.existsSync);if(t){let n=await e.readFile(t);if(!n)return;let r=Ha.default.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return;let i=r.compilerOptions;if(!i||typeof i!="object"||Array.isArray(i))return;let a=i.paths;(!a||typeof a!="object"||Array.isArray(a))&&(i.paths={},a=i.paths),Object.assign(i.paths,{"~/*":["./src/*"]}),await e.writeFile(t,JSON.stringify(r,null,2))}}async function Ya(e){let t=[],n=await ap(e,t);t.push(...await _r(e)),await op(e,n);let r="BuilderPage";if(!await e.exists(e.builderPageComponentPath)){let i=await e.formatCode(e.builderPageComponentPath,Za(e,r,e.builderPageComponentPath,"builder-page","page",!0));await e.writeFile(e.builderPageComponentPath,i),t.push({filePath:e.builderPageComponentPath,modifiedType:"create"})}if(e.hasAppModule){await Nr(e,"Counter",n);let i=await Nr(e,r,e.builderPageComponentPath);i&&t.push({filePath:i,modifiedType:"update"})}return await On(e,"**",r,"./components/builder-page.component"),t}async function Xa(e){let t=[];t.push(...await _r(e));let n="FigmaImportsPage",r="figma-imports.component",i=e.join(e.componentsDir,`${r}.${e.typescriptEnabled?"ts":"js"}`);if(!await e.exists(i)){let a=await e.formatCode(i,Za(e,n,i,"figma-imports","figma-imports",!1));await e.writeFile(i,a),t.push({filePath:i,modifiedType:"create"})}if(e.hasAppModule){let a=await Nr(e,n,i);a&&t.push({filePath:a,modifiedType:"update"})}return await On(e,"figma-imports",n,`./components/${r}`),await Qa(e),t}async function _r(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,ip(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}async function op(e,t){let r=(await Ve(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);r&&await Ve(e,r.id,!0,!1,null,null,!0,!1)}function Za(e,t,n,r,i,a){let o=!e.hasAppModule,s=$(e,n,e.registryPath),u=e.join(e.getAppRootDir(),"src","environments","environment.ts"),l=$(e,n,u),c=a?` <ng-container *ngIf="content || isPreviewing; else notFound">
1033
+ <builder-content
1034
+ [model]="model"
1035
+ [content]="content"
1036
+ [apiKey]="apiKey"
1037
+ [customComponents]="customComponents"
1038
+ ></builder-content>
1039
+ </ng-container>
1040
+
1041
+ <ng-template #notFound>
1042
+ <div>404 - Content not found</div>
1043
+ </ng-template>`:` <builder-content
1044
+ [model]="model"
1045
+ [content]="content"
1046
+ [apiKey]="apiKey"
1047
+ [customComponents]="customComponents"
1048
+ ></builder-content>`;return`
1049
+ import { Component, Input } from '@angular/core';
1050
+ import { fetchOneEntry, type BuilderContent${a?", isPreviewing":""} } from '@builder.io/sdk-angular';
1051
+ ${o?"import { Content } from '@builder.io/sdk-angular';":""}
1052
+ ${o?"import { CommonModule } from '@angular/common';":""}
1053
+ import { environment } from ${JSON.stringify(l)};
1054
+ import { CUSTOM_COMPONENTS } from ${JSON.stringify(s)};
1055
+
1056
+ @Component({
1057
+ selector: 'app-${r}',
1058
+ ${o?"standalone: true,":""}
1059
+ ${o?"imports: [Content, CommonModule],":""}
1060
+ template: \`
1061
+ ${c}
1062
+ \`,
1063
+ })
1064
+ export class ${t} {
1065
+
1066
+ ${a?`isPreviewing = isPreviewing();
1067
+ `:""}
1068
+ @Input() model = '${i}';
1069
+
1070
+ apiKey = environment.${Br};
1071
+ ${e.typescriptEnabled?`
1072
+ content: BuilderContent | null = null;
1073
+ `:`
1074
+ content = null;
1075
+ `}
1076
+
1077
+ customComponents = CUSTOM_COMPONENTS;
1078
+
1079
+ async ngOnInit() {
1080
+ const urlPath = window.location.pathname || '/';
1081
+
1082
+ const builderContent = await fetchOneEntry({
1083
+ model: this.model,
1084
+ apiKey: this.apiKey,
1085
+ userAttributes: {
1086
+ urlPath,
1087
+ },
1088
+ });
1089
+
1090
+ if (!builderContent) {
1091
+ return;
1092
+ }
1093
+
1094
+ this.content = builderContent;
1095
+ }
1096
+ }
1097
+
1098
+ `.trimStart()}function ip(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-angular";
1099
+
1100
+ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
1101
+ ];`:`export const CUSTOM_COMPONENTS = [
1102
+ ];
1103
+ `}async function ap(e,t){let r=e.typescriptEnabled?"ts":"js",i=e.join(e.componentsDir,`counter.component.${r}`),a=await e.exists(i);e.debug(`angularEnsureCounterComponent, hasCounterCmp: ${a}`);let o=sp(e);if(!a){let s=await e.formatCode(i,o);await e.writeFile(i,s),t.push({filePath:i,modifiedType:"create"})}return i}function sp(e){return`
1104
+ import { Component, Input } from '@angular/core';
1105
+
1106
+ @Component({
1107
+ selector: 'app-counter',
1108
+ ${e.hasAppModule?"":"standalone: true,"}
1109
+ template: \`
1110
+ <div class="counter">
1111
+ <button class="btn" (click)="decrement()">-</button>
1112
+ <span class="count">{{ count }}</span>
1113
+ <button class="btn" (click)="increment()">+</button>
1114
+ </div>
1115
+ \`,
1116
+ styles: [
1117
+ \`
1118
+ .counter {
1119
+ margin: 32px auto;
1120
+ display: flex;
1121
+ width: 100%;
1122
+ max-width: 190px;
1123
+ }
1124
+
1125
+ .btn {
1126
+ width: 42px;
1127
+ font-size: 32px;
1128
+ font-weight: bold;
1129
+ background-color: #1c6bd1;
1130
+ color: white;
1131
+ border: none;
1132
+ border-radius: 4px;
1133
+ cursor: pointer;
1134
+ line-height: 1.4;
1135
+ }
1136
+
1137
+ .btn:hover {
1138
+ opacity: 0.8;
1139
+ }
1140
+
1141
+ .count {
1142
+ flex: 1;
1143
+ font-size: 42px;
1144
+ text-align: center;
1145
+ margin: 0 8px;
1146
+ }
1147
+ \`,
1148
+ ],
1149
+ })
1150
+ export class Counter {
1151
+ @Input() initialCount: number = 99;
1152
+ count: number;
1153
+
1154
+ constructor() {
1155
+ this.count = this.initialCount;
1156
+ }
1157
+
1158
+ ngOnInit(): void {
1159
+ this.count = this.initialCount;
1160
+ }
1161
+
1162
+ increment(): void {
1163
+ this.count += 1;
1164
+ }
1165
+
1166
+ decrement(): void {
1167
+ this.count -= 1;
1168
+ }
1169
+ }
1170
+
1171
+ `.trimStart()}async function es(e){await _r(e);let t=await e.readFile(e.registryPath);return t?up(e,t):{components:[],sourceFile:B(e,"")}}async function up(e,t){let n=B(e,t);return lp(e,n)}async function lp(e,t){let n=[],r=Q(e,t,"CUSTOM_COMPONENTS");return r&&await Promise.all(r.arrayLiteralExp.elements.map(async(i,a)=>{let o=await qn(e,t,i);o&&(o.nodeIndex=a,n.push(o))})),{sourceFile:t,components:pe(n)}}async function qn(e,t,n){if(!e.ts.isObjectLiteralExpression(n))return null;let r={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[]};for(let i of n.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(L(e,i)==="component"){let o,{initializer:s}=i;if(e.ts.isIdentifier(s))o=s.text;else if(e.ts.isCallExpression(s)){let l=s.arguments[0];e.ts.isIdentifier(l)&&(o=l.text)}if(!o)continue;r.name===""&&(r.name=K(o)),r.importName=o;let u=await Be(e,e.registryPath,t,o);if(!u)continue;if(r.filePath=u.filePath,r.relFilePath=u.relFilePath,await e.exists(u.filePath)?r.importPath=M(e,u.filePath):(r.externalImportPath=u.importPath,r.importPath=r.externalImportPath),r.displayFilePath=u.displayFilePath,r.exportType=u.exportType,r.externalImportPath)r.exportName=o;else{let l=await Na(e,u.filePath);if(l&&l.length>0)if(l.length===1)r.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(r.exportName=c.cmpInfo.exportName)}}continue}}return r=me(e,r,n),r.filePath&&r.exportName&&(r.id=await V(e,r.filePath,r.exportName,r.externalImportPath)),r}async function Ve(e,t,n,r,i,a,o,s){let u=await nt(e),[l,c,p]=await Promise.all([Ra(e,u),es(e),or(e)]),m=l.map(E=>E.cmpInfo),C=c.components,d={components:Ae(m,C),registryPath:e.registryPath,registryDisplayPath:O(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Re(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await $a(e,l,d.components),d;let g=!1,D=c.sourceFile,f=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(f.length>0){let E=f.map(S=>{let F=l.find(R=>R.cmpInfo.id===S);if(!F)throw new Error(`Component ${S} not found`);return F}),x=Array.from(new Set(E.map(S=>S.cmpInfo.filePath))),y=await X(e,x);for(let S of E){let F=d.components.find(j=>j.id===S.cmpInfo.id),R=await kn(e,S,y);De(F,R);let W=m.findIndex(j=>j.id===S.cmpInfo.id);m[W].inputs=R;let _=Oe(S.cmpInfo.id,m,C,n,r,i,a),{elements:A,elmIndex:v,statementIndex:ae,statement:Fe,variableDeclaration:ne}=await pp(e,D,S);if(_.addCmpToRegistry)A.push(cp(e,_.addCmpToRegistry)),g=!0;else if(_.removeCmpFromRegistry)A.splice(v,1),g=!0;else if(_.updateRegisteredCmp){let j=Z(e,A[v],_.updateRegisteredCmp);A[v]=e.ts.factory.updateObjectLiteralExpression(j,[ts(e,_.updateRegisteredCmp),...j.properties.slice(1)]),g=!0}if(g&&o){let j=[...D.statements];j[ae]=e.ts.factory.updateVariableStatement(Fe,Fe.modifiers,e.ts.factory.updateVariableDeclarationList(Fe.declarationList,[e.ts.factory.updateVariableDeclaration(ne,ne.name,ne.exclamationToken,ne.type,e.ts.factory.createArrayLiteralExpression($e(e,A)))])),D=e.ts.factory.updateSourceFile(D,j),F.exportType==="named"?D=N(e,D,{namedImports:[F.importName],importPath:F.externalImportPath?F.externalImportPath:$(e,e.registryPath,F.filePath)}):D=N(e,D,{defaultImport:F.importName,importPath:F.externalImportPath?F.externalImportPath:$(e,e.registryPath,F.filePath)}),D=N(e,D,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-angular",isTypeOnly:!0}),D=Le(e,D,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=_.components,C=_.components.filter(se=>se.isRegistered)}}}if(g&&o){D=ke(e,D),D=Ne(e,D);let E=ee(e,D);E=Se(E),E=await e.formatCode(e.registryPath,E),await e.writeFile(e.registryPath,E)}return d}function ts(e,t){let n=e.ts.factory.createIdentifier(t.importName);return e.ts.factory.createPropertyAssignment("component",n)}function cp(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([ts(e,t)],!0),t)}async function pp(e,t,n){let r=Q(e,t,"CUSTOM_COMPONENTS");if(!r)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=r.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await qn(e,t,i[o]))?.id===n.cmpInfo.id){a=o;break}return{...r,elements:i,elmIndex:a}}async function rs(e){let t=await mp(e),n={};return{builderPageOptions:async()=>({templateContentId:"f0b8016ac92e474699293211a268ebaa",pathname:"/builder-demo",title:"Builder + Angular Demo Page"}),ensureBuilderSetup:()=>Ya(t),ensureFigmaImportPage:()=>Xa(t),getRegistryPath:()=>t.registryPath,getRegistry:i=>Ve(t,null,!1,!1,null,null,!1,!!i?.readAllInputTypes),addExternalPackage:async i=>{n[i]||(n[i]=`export * from "${i}";`)},loadComponent:async i=>{let a=await Ve(t,i.cmpId,!1,!1,null,null,!1,!1);return{...a,component:a.components.find(o=>o.id===i.cmpId)}},registerComponent:i=>Ve(t,i.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:i=>Ve(t,i.cmpId,!1,!1,i,null,!0,!1),setRegisteredComponentInput:i=>Ve(t,i.cmpId,!1,!1,null,i,!0,!1),unregisterComponent:i=>Ve(t,i.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>or(t),setPublicApiKey:i=>Ia(t,i.publicApiKey),getDependencies:i=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-angular"},{name:"concurrently"}],getDevRunCommand:()=>"builder-dev",getCache:()=>Pe(t),setCache:i=>Te(t,i)}}async function mp(e){let t=await fp(e),n=e.getAppRootDir(),r=e.join(n,"src"),i=await de(e),a=e.join(r,"app"),o=await he(e,a),s={...e,srcDir:"",appDir:"",componentsDir:"",registryPath:o,angularConfigPath:t,typescriptEnabled:i,builderPageComponentPath:"",hasAppModule:!1};if(!await e.exists(r))throw new Error(`Could not find src directory. Searched for src in "${e.getAppRootDir()}".`);s.srcDir=r,s.appDir=a,s.componentsDir=e.join(s.appDir,"components"),s.builderPageComponentPath=e.join(s.componentsDir,`builder-page.component.${i?"ts":"js"}`);let u=`app.module.${i?"ts":"js"}`,l=e.join(s.appDir,u);return await e.exists(l)&&(s.hasAppModule=!0),s}async function fp(e){let t=e.join(e.getAppRootDir(),"angular.json");if(await e.exists(t))return t;let n=e.join(e.getAppRootDir(),"project.json");if(await e.exists(n))return n;throw new Error(`Could not find Angular config file. Searched for angular.json & project.json in "${e.getAppRootDir()}".`)}var zr=k(Ds(),1);async function gs(e,t){let r={components:(await t.getRegistry()).components.filter(a=>a.isRegistered).map(a=>{let o={filePath:ye(e.relative(e.getAppRootDir(),a.filePath)),name:a.name,image:a.image,description:a.description,exportName:a.exportName,inputs:fe(a.inputs)};return fe(o)}),version:1};e.debug("exporting registry components:",r.components.length);let i=(0,zr.compress)(r);return btoa(JSON.stringify(i))}async function Cs(e,t,n){if(typeof n!="string")throw new Error("Invalid registry to import");let r=await t.getRegistry(),i=JSON.parse(atob(n)),a=(0,zr.decompress)(i),o=fe(r);e.debug("importing registry components:",a.components.length);for(let s of a.components){let u=ye(e.normalize(s.filePath)),l=r.components.find(p=>ye(p.filePath).endsWith(u)&&p.exportName===s.exportName);if(!l){console.error(`Could not find component to register: ${s.filePath}, ${s.exportName}`);continue}e.debug(`register (${l.id})`,l.filePath),await t.registerComponent({cmpId:l.id});for(let p of s.inputs)e.debug(`set input (${l.id})`),await t.setRegisteredComponentInput({cmpId:l.id,name:p.name,type:p.type,required:p.required,defaultValue:p.defaultValue,friendlyName:p.friendlyName,helperText:p.helperText});e.debug(`set input (${l.id}) info`);let c=await t.setRegisteredComponentInfo({cmpId:l.id,name:s.name,image:s.image,description:s.description});o=fe(c)}return o}var we={react:"react",remix:"remix",angular:"angular",next:"next",qwik:"qwik"},Jh={[we.react]:[{version:w.gen1,recommended:!0},{version:w.gen2,recommended:!1}],[we.remix]:[{version:w.gen1,recommended:!1},{version:w.gen2,recommended:!0}],[we.angular]:[{version:w.gen2,recommended:!0}],[we.next]:[{version:w.gen1,recommended:!0},{version:w.gen2,recommended:!1}],[we.qwik]:[{version:w.gen2,recommended:!0}]};async function hs(e,t){let n=[],r=new Set;async function i(s){let u=e.join(s,"package.json");try{let l=await e.readFile(u);if(l===null)throw new Error(`Failed to read package.json at ${u}`);let c=JSON.parse(l);if(r.has(c.name))return null;r.add(c.name);let p={name:c.name,subPackages:[]},m=await e.readdir(s);for(let C of m)C!=="node_modules"&&(await e.stat(e.join(s,C))).isDirectory()&&p.subPackages.push(C);return n.push(p),p}catch(l){return console.error(`Error reading package.json at ${s}:`,l),null}}let a=e.join(t,"package.json"),o=await e.readFile(a);if(o!==null){let s=JSON.parse(o),u={...s.dependencies,...s.devDependencies};for(let l of Object.keys(u)){let c=e.join(t,"node_modules",l);await i(c)}if(s.workspaces)for(let l of s.workspaces){let c=await e.readdir(e.join(t,l));for(let p of c){let m=e.join(t,l,p);await i(m)}}}return n}var Lp={"@builder.io/qwik-city":ma,next:ta,"@remix-run/react":xa,react:Ta,"@angular/core":rs},_p={"@builder.io/qwik-city":we.qwik,next:we.next,"@remix-run/react":we.remix,react:we.react,"@angular/core":we.angular};async function qr(e){if(!e.ts)throw new Error("createDevTools() requires a TypeScript instance passed to the 'ts' option");if((!e.frameworks||e.frameworks.length===0)&&(e.frameworks=await St(e)),e.frameworks.length===0)throw new Error("Supported Devtools framework for not found");for(let t of e.frameworks){let n=Lp[t.name];if(n){if(t.name==="next"&&await Bo(e))throw new Error("Turbopack does not support the Builder.io devtools cli. Please disable Turbopack or manually integrate Builder.io into your Next.js project.");let r=await n(e);return{...r,exportRegistry:()=>gs(e,r),importRegistry:a=>Cs(e,r,a),framework:_p[t.name],findAllDependencies:async()=>await hs(e,e.getRepoRootDir())}}}throw new Error(`Devtools framework not found for ${e.getAppRootDir()}, ${JSON.stringify(e.frameworks,null,2)}`)}var V0=`
1172
+ /** @type {import('next').NextConfig} */
1173
+ const nextConfig = {
1174
+ }
1175
+
1176
+ module.exports = nextConfig
1177
+ `.trimStart();var Wp=k(require("prompts"),1);var jp=k(require("prettier"),1);var cr=k(require("@amplitude/analytics-node"),1),Wr=k(require("@sentry/node"),1);var Mp;async function Es(e){Mp=e;let t=await xr();await $o({...t,userId:e})}var Jp=k(require("@sentry/node"),1);var Fs=k(require("@sentry/node"),1);var xs=require("undici"),ht=async(e,t)=>{let n="fetch"in globalThis?globalThis.fetch:xs.fetch;try{return await n(e,t)}catch(r){let i=typeof e=="string"?e:e instanceof URL?e.toString():e.url,a=t?.method||"GET",o=r instanceof Error?r.message:String(r),s=new Error(`Fetch failed for ${a} ${i}: ${o}`);throw r instanceof Error&&(s.cause=r),s.requestContext={url:i,method:a,headers:t?.headers},s}};var Gp=k(Ss(),1);var As=k(require("@sentry/node"),1),vs=k(require("@amplitude/analytics-node"),1);async function Jr(e){if(process.env.NODE_ENV!=="test")try{await Promise.allSettled([As.flush(2e3),vs.flush().promise])}catch(t){console.error(t)}process.exit(e)}var ws=process.env.AIR_HOST||"https://air-layout-v2-tk43uighdq-uc.a.run.app";var bs=e=>{let t=new URL(e);if(!e.startsWith("https://www.figma.com/design/"))return null;let n=t.searchParams.get("node-id")?.replaceAll("-",":"),r=t.pathname.split("/")[2];return n&&r?{fileID:r,nodeId:n}:null};var Ps=async(e,t,n,r)=>(await Qp(`files/${t}/nodes`,{auth:e,params:{ids:n,depth:r}})).nodes,Hp="https://api.figma.com/v1/",Qp=async(e,{auth:t,params:n})=>{let r=new URL(`${Hp}${e}`),i={};if(t.oauth?i.Authorization=`Bearer ${t.access_token}`:i["X-FIGMA-TOKEN"]=t.access_token,n)for(let o in n)n[o]!=null&&r.searchParams.set(o,n[o].toString());let a=await ht(r,{headers:i});if(!a.ok)throw new Error(`Figma REST ${a.statusText}: ${await a.text()}`);return a.json()};var Yp=/[^\x00-\x7F]/g;function uo(e){return e=e.replace(Yp,""),e=e.replace(/[\W\d]/g," "),e=e.trim(),e=Xp(e),e=e.charAt(0).toUpperCase()+e.slice(1),e}function Xp(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,function(t,n){return n===0?t.toLowerCase():t.toUpperCase()}).replace(/\s+/g,"")}async function Zp(e,t,n){let r=[],i=[t],a=e.relative(e.getAppRootDir(),t.fileName);for(;i.length>0;){let o=i.shift();if(nm(o,t)){let s=tm(e,o,t,n),{line:u,character:l}=t.getLineAndCharacterOfPosition(o.getStart());s&&(s.loc=`${a}:${u+1}:${l+1}`,r.push(s))}i.push(...o.getChildren(t))}return r}var em="figmaMapping";function tm(e,t,n,r){let[i]=t.arguments;if(!i)throw new Error("Invalid figmaMapping call, no arguments found");if(!G.default.isObjectLiteralExpression(i))throw new Error("Invalid figmaMapping call, argument is not an object literal");let a=i.properties;if(!a)throw new Error("Invalid figmaMapping call, argument has no properties");let o="",s,u,l="-",c=e.basename(n.fileName,".mapper.tsx"),p,m,C,d;if(t.typeArguments&&t.typeArguments.length>0){let D=Ts(t.typeArguments[0].getText(n));D&&(c=D)}for(let D of a){let f=D.name?.getText(n);if(!f)throw new Error("Invalid figmaMapping call, property has no name");switch(f){case"url":{if(!("initializer"in D))throw new Error("Invalid figmaMapping call, url has no initializer");let E=D.initializer;if(!G.default.isStringLiteral(E))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");d=E.text;break}case"componentKey":{if(!("initializer"in D))throw new Error("Invalid figmaMapping call, componentKey has no initializer");let E=D.initializer;if(!G.default.isStringLiteral(E))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");o=E.text;break}case"mapper":if(G.default.isMethodDeclaration(D)){let E=function(x){if((G.default.isJsxOpeningElement(x)||G.default.isJsxSelfClosingElement(x))&&G.default.isIdentifier(x.tagName)){l=x.tagName.getText(n);let S=r.getSymbolAtLocation(x.tagName)?.getDeclarations()?.[0];if(S){let F=rm(S);F?.importClause&&(F.importClause.name?.getText(n)===l?p="default":F.importClause.namedBindings&&(p="named"),m=l,G.default.isStringLiteral(F.moduleSpecifier)&&(C=F.moduleSpecifier.text))}return l}else if(G.default.isTaggedTemplateExpression(x)&&G.default.isIdentifier(x.tag)&&x.tag.escapedText==="html"){let y=x.template.getText(n).match(/^`<([^\s]+)/);if(y){l=y[1];return}}else G.default.forEachChild(x,E)};var g=E;if(D.parameters[0].type){let x=D.parameters[0].type.getText(n),y=Ts(x);y&&(c=y)}G.default.forEachChild(D,E),u=D.getText(n).replace(/^mapper/,"function Mapper"),s=po(u);break}case"designTokenMapper":if(G.default.isMethodDeclaration(D)){u=D.getText(n).replace(/^designTokenMapper/,"function Mapper"),s=po(u),o="design-tokens";break}case"genericMapper":if(G.default.isMethodDeclaration(D)){u=D.getText(n).replace(/^genericMapper/,"function Mapper"),s=po(u),o="*";break}}}if(!o&&!d)throw new Error("Invalid figmaMapping call, no componentKey or url found");if(!o&&!s)throw new Error("Invalid figmaMapping call, no mapper found");if(!o&&!u)throw new Error("Invalid figmaMapping call, no original mapper found");return{builderName:l,figmaName:c,figmaKey:o,figmaUrl:d,inputMapper:s,exportType:p,importName:m,importPath:C,originalInputMapper:u,source:"cli"}}function po(e){return G.default.transpile(e,{target:G.default.ScriptTarget.Latest,allowNonTsExtensions:!0,moduleResolution:G.default.ModuleResolutionKind.NodeJs,module:G.default.ModuleKind.CommonJS,noImplicitAny:!1,esModuleInterop:!0,noUnusedLocals:!1,noUnusedParameters:!1,jsx:G.default.JsxEmit.React,jsxFactory:"React.createElement",jsxFragmentFactory:"React.Fragment",allowJs:!0,checkJs:!0,strict:!0,suppressImplicitAnyIndexErrors:!0,typeRoots:["node_modules/@types"],inlineSources:!0,inlineSourceMap:!0})}function rm(e){let t=e;for(;t;){if(G.default.isImportDeclaration(t))return t;t=t.parent}}function nm(e,t){return G.default.isCallExpression(e)&&e.expression.getText(t).includes(em)}async function Gr(e){let t=["node_modules","dist","build","public"];return(await e.readdirRecursive(e.getAppRootDir(),t)).filter(r=>ge(r))}function Ts(e){let t=e.match(/^Figma(\w+)Props$/);if(t&&typeof t[1]=="string")return t[1]}var om=async(e,t)=>{let n=new Map,r={};return t.forEach(i=>{let a=bs(i);if(!a)throw new Error("Invalid Figma URL, use Cmd+L while selecting a figma component to get a link to selection");let o=n.get(a.fileID);o||(o=[],n.set(a.fileID,o)),o.includes(a.nodeId)||o.push(a.nodeId),r[i]=`${a.fileID}/${a.nodeId}`}),await Promise.all(Array.from(n.entries()).map(async([i,a])=>{let o=await Ps(e,i,a.join(","),0);for(let s of a){let u=o[s],l=u.components[s]?.key??u.componentSets[s]?.key;if(!l)throw new Error(`Cannot resolve figma component key for ${s} in file ${i}`);let c=`${i}/${s}`;for(let p of t)r[p]===c&&(r[p]=l)}})),r};async function lo(e,t,n,r=!1){try{return n||(n=await qr(e)),await n.setPublicApiKey({publicApiKey:t}),r&&await n.ensureFigmaImportPage(),!0}catch(i){return mo.captureException(i),!1}}async function co({figmaAuth:e,force:t,mappingFiles:n,print:r,sys:i}){if(!n.length)return{figmaBuilderLinks:[],foundErrors:!1};let a=[],o=await X(i,n),s=o.getTypeChecker(),u=[...o.getSyntacticDiagnostics(),...o.getGlobalDiagnostics(),...o.getSemanticDiagnostics(),...o.getDeclarationDiagnostics()].filter(m=>!(m.category!==G.default.DiagnosticCategory.Error||m.code===6133||m.code===6138||m.code===6196||m.code===6192||m.code===6198||m.code===6199||m.code===6205||m.code===1449||m.code===2578||m.code===2695||m.code===2322)),l=new Set,c=!1;for(let m of n)try{let C=o.getSourceFile(m);if(!C)throw new Error(`Could not find source file for ${m}`);let d=C?.fileName;if(d){let D=u.filter(f=>f.file?.fileName===d);if(D.length>0&&(c=!0,t!==!0)){le.error((0,Y.red)(`TypeScript errors in ${(0,Y.dim)(i.relative(i.getAppRootDir(),m))}:
1178
+ `)+D.map(f=>` \u2022 ${im(f)}`).join(`
1179
+ `));continue}}let g=await Zp(i,C,s);if(a.push(...g),r){let D=!1,f=`${(0,Y.dim)(i.relative(i.getAppRootDir(),m))}:
1180
+ `+g.map(E=>{let x=!1;E.figmaKey?(x||(x=l.has(E.figmaKey)),l.add(E.figmaKey)):E.figmaUrl&&(x||(x=l.has(E.figmaUrl)),l.add(E.figmaUrl));let y="";switch(E.figmaKey){case"design-tokens":y=" "+(0,Y.cyan)("\u2747\uFE0E Design tokens mapper");break;case"*":y=" "+(0,Y.yellow)("\u25CF Generic mapper");break;default:y=` ${(0,Y.magenta)("\u2756 "+uo(E.figmaName))} ${(0,Y.dim)("\u2192")} ${E.builderName==="-"?"-":"<"+E.builderName+">"}`;break}return x&&(D=!0,y=(0,Y.bgRed)(y+(0,Y.bold)(" <= duplicated"))),y}).join(`
1181
+ `);D?(c=!0,le.error(f)):le.info(f)}}catch(C){return mo.captureException(C),console.error(C),await Jr(1)}let p=a.filter(m=>m.figmaUrl&&!m.figmaKey).map(m=>m.figmaUrl);if(p.length>0){let m=await om(e,p);for(let C of a)if(C.figmaUrl&&!C.figmaKey){let d=m[C.figmaUrl];if(!d)throw new Error("bad internal state");C.figmaKey=d}}return{figmaBuilderLinks:a,foundErrors:c}}function im(e){let{messageText:t}=e;if(typeof t=="string")return t;let{next:n}=t,r=[t.messageText];return n&&r.push(n.map(i=>i.messageText).join(`
1182
+ `)),r.join(`
1183
+ `)}var Rs=require("crypto");var fo=e=>!!(process.env.CI||e.ci),pr=async(e,t,n)=>{let r=fo(t)?{}:lm(e),i=r.spaceName,a=r.userId,o,s=process.env.BUILDER_PUBLIC_KEY??t.spaceId??r.builderPublicKey,u=process.env.BUILDER_PRIVATE_KEY??t.privateKey??r.builderPrivateKey,l=process.env.FIGMA_PERSONAL_TOKEN??t.figmaToken;if(l?o={access_token:l,oauth:!1}:o=r.figmaAuth,n.forceSpaceId&&s&&s!==n.forceSpaceId){le.warning(`CLI is currently logged in space ${(0,jt.yellow)(s)},
1184
+ however the command required --spaceId=${(0,jt.green)(n.forceSpaceId)}`);let c=t.yes||await Jt({message:"Do you wanna switch spaces?",active:"Yes",inactive:`Stay in current ${i} space`});if(ct(c)||!c)throw Gt(`Aborting. Another way to fix this conflict is making sure the figma plugin is logged in "${i}" instead.`),new Error("Exiting");s=n.forceSpaceId,u=void 0,i=void 0,a=void 0}if(fo(t)){if(!o&&n.figmaAuth)throw new Error(`No Figma personal token found.
1185
+ Please set the FIGMA_PERSONAL_TOKEN environment variable.`);if(!u&&n.builderPrivateKey)throw new Error(`No Builder private key found.
1186
+ Please set the BUILDER_PRIVATE_KEY environment variable.`);if(!s&&n.builderPublicKey)throw new Error(`No Builder public key found.
1187
+ Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u}}if((n.force||!o&&n.figmaAuth)&&(o=await sm(),Is(e,{figmaAuth:o})),n.force||!u&&n.builderPrivateKey||!s&&n.builderPublicKey){let{privateKey:c,spaceId:p,spaceName:m,userId:C}=await um(e,n.forceSpaceId);if(n.forceSpaceId&&p!==n.forceSpaceId)throw new Error(`OAuth flow returned space ${(0,jt.yellow)(p)}, however the command required --spaceId=${(0,jt.green)(n.forceSpaceId)}`);s=p,u=c,i=m,a=C,await Es(a),await lo(e,p,void 0,!1),Is(e,{builderPublicKey:s,builderPrivateKey:u,spaceName:i,userId:a})}return a&&Xe.setUser({id:a,username:process.env.USER||process.env.USERNAME||"unknown"}),(i||s)&&Xe.setContext("builder",{spaceId:s,spaceName:i}),{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u,spaceName:i,userId:a}},am="RHr2ed743waC2g2ZHMEJSn6O0NQ08L";async function sm(){let e=Pt(),{default:t}=await import("open");e.start("Waiting for Figma auth");let n=(0,Rs.randomUUID)(),r=new URL("https://www.figma.com/oauth");r.searchParams.set("client_id","nrGCqw6TLl95QJhVDi097A"),r.searchParams.set("redirect_uri","http://localhost:5283/figma-connect"),r.searchParams.set("scope","files:read,file_dev_resources:read,file_variables:read"),r.searchParams.set("state",n),r.searchParams.set("response_type","code");let i,a=new Promise((o,s)=>{i=(0,Do.createServer)(async(u,l)=>{let c=new URL(u.url||"","http://localhost:5283");if(c.pathname==="/figma-connect"){let p=c.searchParams.get("code"),m=c.searchParams.get("state");if(p&&n===m){let C=await ht("https://www.figma.com/api/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:"nrGCqw6TLl95QJhVDi097A",client_secret:am,redirect_uri:"http://localhost:5283/figma-connect",code:p,grant_type:"authorization_code"}).toString()});C.ok||s(new Error("Failed to get figma access token"));let d=await C.json();l.end(`<!DOCTYPE html>
1188
+ <html lang="en" dir="ltr">
1189
+ <head>
1190
+ <meta charset="utf-8" />
1191
+ <script>
1192
+ (function (window) {
1193
+ if (window.location !== window.top.location) {
1194
+ window.top.location = window.location;
1195
+ }
1196
+ })(this);
1197
+ </script>
1198
+ <title>Successfully Connected With Builder.io</title>
1199
+ <link rel="icon shortcut" href="https://cdn.builder.io/favicon.ico" />
1200
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
1201
+ <style>
1202
+ body {
1203
+ background-color: #2a2a2a;
1204
+ }
1205
+ main {
1206
+ width: 100vw;
1207
+ height: 100vh;
1208
+ display: flex;
1209
+ align-items: center;
1210
+ justify-content: center;
1211
+ }
1212
+ .auth-container {
1213
+ display: flex;
1214
+ flex-direction: column;
1215
+ justify-content: center;
1216
+ align-items: center;
1217
+ max-width: 444px;
1218
+ padding: 40px 20px;
1219
+ border-radius: 4px;
1220
+ border: 1px solid var(--Dark-Mode-outline, #555);
1221
+ font-family: Inter, sans-serif;
1222
+ text-align: center;
1223
+ }
1224
+
1225
+ .auth-icon {
1226
+ width: 64px;
1227
+ aspect-ratio: 1;
1228
+ object-fit: contain;
1229
+ object-position: center;
1230
+ }
1231
+
1232
+ .auth-content {
1233
+ align-self: stretch;
1234
+ display: flex;
1235
+ flex-direction: column;
1236
+ justify-content: start;
1237
+ width: 100%;
1238
+ margin-top: 24px;
1239
+ }
1240
+
1241
+ .auth-title {
1242
+ color: #fff;
1243
+ font-size: 20px;
1244
+ font-weight: 600;
1245
+ line-height: 1.2;
1246
+ align-self: center;
1247
+ }
1248
+
1249
+ .auth-message {
1250
+ color: rgba(255, 255, 255, 1);
1251
+ font-size: 14px;
1252
+ font-weight: 400;
1253
+ line-height: 20px;
1254
+ margin-top: 4px;
1255
+ }
1256
+
1257
+ .auth-logo {
1258
+ width: 186px;
1259
+ aspect-ratio: 2.91;
1260
+ object-fit: contain;
1261
+ object-position: center;
1262
+ border-radius: 0;
1263
+ margin-top: 24px;
1264
+ max-width: 100%;
1265
+ }
1266
+ </style>
1267
+ </head>
1268
+
1269
+ <body>
1270
+ <main>
1271
+ <section class="auth-container">
1272
+ <img
1273
+ src="https://cdn.builder.io/api/v1/image/assets/TEMP/77fa9d1570a153d1f6171e29d4650f05b4ee7f28f09e94bb10c40108f1237d3c?placeholderIfAbsent=true&apiKey=38af5e1d956b48c29e1199757cc72fdb"
1274
+ alt="Authentication icon"
1275
+ class="auth-icon"
1276
+ loading="lazy"
1277
+ />
1278
+ <div class="auth-content">
1279
+ <h1 class="auth-title">Authentication successful</h1>
1280
+ <p class="auth-message">
1281
+ You can now close this browser tab and return to your CLI to
1282
+ continue
1283
+ </p>
1284
+ </div>
1285
+ <img
1286
+ src="https://cdn.builder.io/api/v1/image/assets/TEMP/183613c2acd7df7fb88682c42deef5e84d8522e6a384f4ad19327df1bda5dfab?placeholderIfAbsent=true&apiKey=38af5e1d956b48c29e1199757cc72fdb"
1287
+ alt="Company logo"
1288
+ class="auth-logo"
1289
+ loading="lazy"
1290
+ />
1291
+ </section>
1292
+ </main>
1293
+ <!--SCRIPT_PLACEHOLDER-->
1294
+ </body>
1295
+ </html>
1296
+ `.replace("{{MESSAGE}}","The CLI has authenticated correctly with Figma"),()=>{o({...d,oauth:!0})})}}}),i.listen(5283,()=>{t(r.href,{wait:!1})})});try{return await a}finally{e.stop("Authenticated with Figma"),i&&("closeAllConnections"in i&&i.closeAllConnections(),i.close(o=>{o&&(Xe.captureException(o),console.error(o))}))}}async function um(e,t){let n=Pt();n.start("Waiting for Builder auth");let{default:r}=await import("open"),i=new URL("/cli-auth","https://builder.io");i.searchParams.set("client_id","builder-dev-tools-cli"),i.searchParams.set("host",await e.getDeviceId()),i.searchParams.set("response_type","code"),i.searchParams.set("cli","true"),t&&i.searchParams.set("space_id",t);let a,o=new URL(st,"http://localhost:5283");o.searchParams.set(dr,(0,Bs.platform)()),o.searchParams.set(Dr,process.versions.node);let s=e.getFrameworks();s.length>0&&(i.searchParams.set(Et,s[0].name),o.searchParams.set(Et,s[0].name)),i.searchParams.set("redirect_url",o.href);let u=new Promise(l=>{a=(0,Do.createServer)(async(c,p)=>{let m=new URL(c.url||"","http://localhost:5283");m.pathname===st&&p.end(`<!DOCTYPE html>
1297
+ <html lang="en" dir="ltr">
1298
+ <head>
1299
+ <meta charset="utf-8" />
1300
+ <script>
1301
+ (function (window) {
1302
+ if (window.location !== window.top.location) {
1303
+ window.top.location = window.location;
1304
+ }
1305
+ })(this);
1306
+ </script>
1307
+ <title>Successfully Connected With Builder.io</title>
1308
+ <link rel="icon shortcut" href="https://cdn.builder.io/favicon.ico" />
1309
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
1310
+ <style>
1311
+ body {
1312
+ background-color: #2a2a2a;
1313
+ }
1314
+ main {
1315
+ width: 100vw;
1316
+ height: 100vh;
1317
+ display: flex;
1318
+ align-items: center;
1319
+ justify-content: center;
1320
+ }
1321
+ .auth-container {
1322
+ display: flex;
1323
+ flex-direction: column;
1324
+ justify-content: center;
1325
+ align-items: center;
1326
+ max-width: 444px;
1327
+ padding: 40px 20px;
1328
+ border-radius: 4px;
1329
+ border: 1px solid var(--Dark-Mode-outline, #555);
1330
+ font-family: Inter, sans-serif;
1331
+ text-align: center;
1332
+ }
1333
+
1334
+ .auth-icon {
1335
+ width: 64px;
1336
+ aspect-ratio: 1;
1337
+ object-fit: contain;
1338
+ object-position: center;
1339
+ }
1340
+
1341
+ .auth-content {
1342
+ align-self: stretch;
1343
+ display: flex;
1344
+ flex-direction: column;
1345
+ justify-content: start;
1346
+ width: 100%;
1347
+ margin-top: 24px;
1348
+ }
1349
+
1350
+ .auth-title {
1351
+ color: #fff;
1352
+ font-size: 20px;
1353
+ font-weight: 600;
1354
+ line-height: 1.2;
1355
+ align-self: center;
1356
+ }
1357
+
1358
+ .auth-message {
1359
+ color: rgba(255, 255, 255, 1);
1360
+ font-size: 14px;
1361
+ font-weight: 400;
1362
+ line-height: 20px;
1363
+ margin-top: 4px;
1364
+ }
1365
+
1366
+ .auth-logo {
1367
+ width: 186px;
1368
+ aspect-ratio: 2.91;
1369
+ object-fit: contain;
1370
+ object-position: center;
1371
+ border-radius: 0;
1372
+ margin-top: 24px;
1373
+ max-width: 100%;
1374
+ }
1375
+ </style>
1376
+ </head>
1377
+
1378
+ <body>
1379
+ <main>
1380
+ <section class="auth-container">
1381
+ <img
1382
+ src="https://cdn.builder.io/api/v1/image/assets/TEMP/77fa9d1570a153d1f6171e29d4650f05b4ee7f28f09e94bb10c40108f1237d3c?placeholderIfAbsent=true&apiKey=38af5e1d956b48c29e1199757cc72fdb"
1383
+ alt="Authentication icon"
1384
+ class="auth-icon"
1385
+ loading="lazy"
1386
+ />
1387
+ <div class="auth-content">
1388
+ <h1 class="auth-title">Authentication successful</h1>
1389
+ <p class="auth-message">
1390
+ You can now close this browser tab and return to your CLI to
1391
+ continue
1392
+ </p>
1393
+ </div>
1394
+ <img
1395
+ src="https://cdn.builder.io/api/v1/image/assets/TEMP/183613c2acd7df7fb88682c42deef5e84d8522e6a384f4ad19327df1bda5dfab?placeholderIfAbsent=true&apiKey=38af5e1d956b48c29e1199757cc72fdb"
1396
+ alt="Company logo"
1397
+ class="auth-logo"
1398
+ loading="lazy"
1399
+ />
1400
+ </section>
1401
+ </main>
1402
+ <!--SCRIPT_PLACEHOLDER-->
1403
+ </body>
1404
+ </html>
1405
+ `.replace("{{MESSAGE}}","The CLI has authenticated correctly with Builder.io"),()=>{l({privateKey:m.searchParams.get("p-key")||"",spaceId:m.searchParams.get("api-key")||"",spaceName:m.searchParams.get("org-name")||"",userId:m.searchParams.get("user-id")||""})})}),a.listen(5283,()=>{r(i.href,{wait:!1})})});try{return await u}finally{n.stop("Authenticated with Builder.io"),a&&("closeAllConnections"in a&&a.closeAllConnections(),a.close(l=>{l&&(Xe.captureException(l),console.error(l))}))}}function Is(e,t){let n=e.getAppRootDir(),r=(0,Hr.join)(n,"node_modules",".builder"),i=(0,Hr.join)(r,"data.json");if((0,Ke.existsSync)(i))try{let a=(0,Ke.readFileSync)(i,"utf8"),o=JSON.parse(a);t=Object.assign(o.credentials,t)}catch(a){Xe.captureException(a),console.error("Failed to store credentials",a)}else(0,Ke.mkdirSync)(r,{recursive:!0});(0,Ke.writeFileSync)(i,JSON.stringify({credentials:t},null,2))}function lm(e){let t=e.getAppRootDir(),n=(0,Hr.join)(t,"node_modules",".builder","data.json");if((0,Ke.existsSync)(n))try{let r=(0,Ke.readFileSync)(n,"utf8");return JSON.parse(r).credentials}catch(r){Xe.captureException(r),console.error("Failed to load credentials",r)}return{}}async function $s(e,t,n,r){try{if(!e)return Mt(n,r,400,"Builder context closed");let i=dm(n);if(i.pathname===Xr){if(n.method==="POST"){let a=await fm(n);if(a)try{let o=await Jo(e,JSON.parse(a));return Ns(n,r,200,o)}catch(o){e.debug("Dev API Error",o.stack||o.message||o);let s={errors:[String(o.message||o)]};return Ns(n,r,500,s)}}else if(n.method==="OPTIONS"){let a={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version"},o=n.headers.origin;o&&o!=="null"?ks(new URL(o))&&(a["Access-Control-Allow-Origin"]=o):a["Access-Control-Allow-Origin"]="*",r.writeHead(200,a),r.end();return}return Mt(n,r,405,`${Xr} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(i.pathname===Zr)return cm(n,r,200,await Go(e));if(i.pathname===ho){let a=i.searchParams.get(Yr);return a?mm(r,302,await Xo(e,a)):Mt(n,r,400,`Missing ${Yr} querystring`)}if(i.pathname===st)return pm(n,r,200,await Ho(e));if(i.pathname===Eo){let{figmaAuth:a}=await pr(e,{_:[]},{figmaAuth:!0}),o=await Gr(e),{figmaBuilderLinks:s,foundErrors:u}=await co({figmaAuth:a,force:!0,mappingFiles:o,sys:e,print:!1});return mr(n,r,200,"application/json",JSON.stringify({figmaBuilderLinks:s,foundErrors:u,version:2,local:!0},null,2))}return i.pathname===ut?(e.debug(`Close Dev Tools Server Requested: ${i.href}`),setTimeout(()=>{try{t.close(a=>{e.debug(`Dev Tools Server Closed Error: ${a}`)})}catch(a){e.debug(`Error closing devtools server: ${a}`)}},20),Mt(n,r,200,"Closing Dev Tools Server")):Mt(n,r,404,"Not found")}catch(i){return console.error("Dev Server Error",i),Mt(n,r,500,`Dev Server Error: ${i}`)}}function Ns(e,t,n,r){mr(e,t,n,"application/json",JSON.stringify(r))}function cm(e,t,n,r){mr(e,t,n,"application/javascript",r)}function pm(e,t,n,r){mr(e,t,n,"text/html",r)}function Mt(e,t,n,r){mr(e,t,n,"text/plain",r)}function mr(e,t,n,r,i){let a={"Content-Type":`${r}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.5.4"},o=e.headers.origin;o&&o!=="null"?ks(new URL(o))&&(a["Access-Control-Allow-Origin"]=o):a["Access-Control-Allow-Origin"]="*",t.writeHead(n,a),t.end(i)}function ks(e){return e.hostname==="localhost"||e.origin==="https://builder.io"||e.origin==="https://www.builder.io"||e.origin.endsWith(".builder.io")?!0:e.port===""?!1:e.port!=="80"&&e.port!=="443"}function mm(e,t,n){e.writeHead(t,{Location:n}),e.end()}async function fm(e){let t="";for await(let n of e)t+=n;return t}function dm(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function Os(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await Dm(e),n=(0,Qr.createServer)((i,a)=>{$s(e,n,i,a)}),r=()=>new Promise((i,a)=>{n.listening?(e.debug(`closing devtools server on port ${t}`),n.close(o=>{e=null,o?(e.debug(`error closing devtools server on port ${t}`),a(o)):(e&&e.debug(`closed devtools server on port ${t}`),i())})):(e.debug(`devtools server on port ${t} not listening`),i())});return process.once("SIGTERM",r),process.once("SIGINT",r),process.env.CI!=="true"&&process.stdin.on("end",r),globalThis.__builderDevToolsServer={url:new URL(`http://localhost:${t}`).href,port:t,setContext:i=>{e.debug(`set devtools context on server ${t}`),e=i},close:async()=>{globalThis.__builderDevToolsServer=null,await r()}},new Promise(i=>{n.listen(t,()=>{e.debug(`started devtools server on port ${t}`),i(globalThis.__builderDevToolsServer)})})}function Dm(e){return new Promise(t=>{let n=e.port;try{(0,Qr.request)({hostname:"localhost",port:n,path:ut,method:"GET"},i=>{i.on("end",()=>{e.debug(`${ut} - Response ended`),t(n)})}).on("error",i=>{e.debug(`${ut} - No response ${i}`),t(n)}).end()}catch(r){e.debug(`${ut} - Error ${r}`),t(n)}})}async function Ls(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},n=e.getFrameworks().map(a=>a.name).join(", ");t.debug(`create devtools ${go} [${n}]`);let r=await Os(t);return t.devToolsServerUrl=r.url,t.port=r.port,{getUrl:()=>t.devToolsServerUrl}}var go="1.5.4";0&&(module.exports={createDevToolsServer,version});