builder.io 1.6.10 → 1.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/cli/index.cjs +323 -324
  2. package/cli/index.cjs.map +4 -4
  3. package/cli/main.cjs +2 -2
  4. package/core/index.cjs +58 -58
  5. package/core/index.mjs +58 -58
  6. package/figma/jsx-runtime/index.d.ts +2 -2
  7. package/figma/jsx-runtime/prop-types.d.ts +9 -9
  8. package/figma/jsx-runtime/react.d.ts +101 -105
  9. package/node/index.cjs +46 -47
  10. package/node/index.mjs +46 -47
  11. package/package.json +1 -1
  12. package/remix/build.cjs +1 -1
  13. package/remix/index.mjs +1 -1
  14. package/remix/server-build/index.cjs +3 -3
  15. package/server/index.cjs +119 -119
  16. package/server/index.mjs +119 -119
  17. package/types/_tests_/code.e2e.d.ts +1 -0
  18. package/types/_tests_/create-builder.e2e.d.ts +1 -0
  19. package/types/_tests_/figma-generate.e2e.d.ts +1 -0
  20. package/types/_tests_/figma-publish.e2e.d.ts +1 -0
  21. package/types/_tests_/help.e2e.d.ts +1 -0
  22. package/types/_tests_/utils.d.ts +42 -0
  23. package/types/_tests_/vitest.config.d.ts +2 -0
  24. package/types/cli/builder-add/options.d.ts +1 -1
  25. package/types/cli/code-file-utils.d.ts +1 -1
  26. package/types/cli/credentials.d.ts +1 -1
  27. package/types/cli/figma-publish.d.ts +3 -1
  28. package/types/cli/index.d.ts +2 -0
  29. package/types/cli/spinner.d.ts +0 -1
  30. package/types/cli/track.d.ts +1 -1
  31. package/types/common/ast/component-input-types.d.ts +1 -1
  32. package/types/common/builder/builder-api.d.ts +1 -1
  33. package/types/common/builder/content-generation.d.ts +1 -1
  34. package/types/common/test-utils.d.ts +1 -1
  35. package/types/core/adapters/next/next-test-utils.d.ts +5 -5
  36. package/types/core/adapters/react/react-test-utils.d.ts +2 -2
  37. package/types/core/adapters/remix/remix-test-utils.d.ts +2 -2
  38. package/types/figma/index.d.ts +0 -1
  39. package/types/server/request-handler.d.ts +0 -1
  40. package/types/tsconfig.tsbuildinfo +1 -0
  41. package/types/types.d.ts +0 -1
  42. package/types/vitest.config.d.ts +2 -0
  43. package/vite/index.cjs +3 -3
  44. package/vite/index.d.ts +1 -1
  45. package/vite/index.mjs +3 -3
  46. package/webpack/index.cjs +1 -1
  47. package/webpack/index.d.ts +1 -1
  48. package/webpack/index.mjs +1 -1
  49. package/types/cli/kv.d.ts +0 -20
  50. package/types/cli/main.d.cts +0 -2
  51. package/types/figma/jsx-runtime/index.d.cts +0 -2
  52. package/types/figma/jsx-runtime/index.d.ts +0 -2
  53. package/types/next/index.d.cts +0 -4
  54. package/types/next/index.d.mts +0 -4
  55. package/types/remix/index-shim.d.cts +0 -2
  56. /package/types/vite/{index.d.ts → main.d.ts} +0 -0
  57. /package/types/webpack/{index.d.ts → main.d.ts} +0 -0
package/server/index.cjs CHANGED
@@ -1,46 +1,50 @@
1
- "use strict";var Fu=Object.create;var vn=Object.defineProperty;var yu=Object.getOwnPropertyDescriptor;var Su=Object.getOwnPropertyNames;var vu=Object.getPrototypeOf,wu=Object.prototype.hasOwnProperty;var se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Au=(e,t)=>{for(var r in t)vn(e,r,{get:t[r],enumerable:!0})},qo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Su(t))!wu.call(e,i)&&i!==r&&vn(e,i,{get:()=>t[i],enumerable:!(n=yu(t,i))||n.enumerable});return e};var T=(e,t,r)=>(r=e!=null?Fu(vu(e)):{},qo(t||!e||!e.__esModule?vn(r,"default",{value:e,enumerable:!0}):r,e)),bu=e=>qo(vn({},"__esModule",{value:!0}),e);var Go=se((vf,Ho)=>{"use strict";Ho.exports=function(){if(process.env.npm_config_user_agent)return Pu(process.env.npm_config_user_agent)};function Pu(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 Bn=se((id,wi)=>{"use strict";var br="\x1B",Q=`${br}[`,Uu="\x07",Pr={to(e,t){return t?`${Q}${t+1};${e+1}H`:`${Q}${e+1}G`},move(e,t){let r="";return e<0?r+=`${Q}${-e}D`:e>0&&(r+=`${Q}${e}C`),t<0?r+=`${Q}${-t}A`:t>0&&(r+=`${Q}${t}B`),r},up:(e=1)=>`${Q}${e}A`,down:(e=1)=>`${Q}${e}B`,forward:(e=1)=>`${Q}${e}C`,backward:(e=1)=>`${Q}${e}D`,nextLine:(e=1)=>`${Q}E`.repeat(e),prevLine:(e=1)=>`${Q}F`.repeat(e),left:`${Q}G`,hide:`${Q}?25l`,show:`${Q}?25h`,save:`${br}7`,restore:`${br}8`},Ku={up:(e=1)=>`${Q}S`.repeat(e),down:(e=1)=>`${Q}T`.repeat(e)},zu={screen:`${Q}2J`,up:(e=1)=>`${Q}1J`.repeat(e),down:(e=1)=>`${Q}J`.repeat(e),line:`${Q}2K`,lineEnd:`${Q}K`,lineStart:`${Q}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Pr.up():"");return e&&(t+=Pr.left),t}};wi.exports={cursor:Pr,scroll:Ku,erase:zu,beep:Uu}});var He=se((ad,Tr)=>{var Nn=process||{},Ai=Nn.argv||[],Rn=Nn.env||{},qu=!(Rn.NO_COLOR||Ai.includes("--no-color"))&&(!!Rn.FORCE_COLOR||Ai.includes("--color")||Nn.platform==="win32"||(Nn.stdout||{}).isTTY&&Rn.TERM!=="dumb"||!!Rn.CI),Wu=(e,t,r=e)=>n=>{let i=""+n,a=i.indexOf(t,e.length);return~a?e+Ju(i,t,r,a)+t:e+i+t},Ju=(e,t,r,n)=>{let i="",a=0;do i+=e.substring(a,n)+r,a=n+t.length,n=e.indexOf(t,a);while(~n);return i+e.substring(a)},bi=(e=qu)=>{let t=e?Wu:()=>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")}};Tr.exports=bi();Tr.exports.createColors=bi});var us=se((QC,qn)=>{qn.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;qn.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]/;qn.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 no=se((YC,ls)=>{var to=us();ls.exports={isSpaceSeparator(e){return typeof e=="string"&&to.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||to.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"||to.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 ds=se((XC,fs)=>{var re=no(),oo,pe,Xe,Jn,lt,Pe,oe,so,dn;fs.exports=function(t,r){oo=String(t),pe="start",Xe=[],Jn=0,lt=1,Pe=0,oe=void 0,so=void 0,dn=void 0;do oe=_p(),Vp[pe]();while(oe.type!=="eof");return typeof r=="function"?io({"":dn},"",r):dn};function io(e,t,r){let n=e[t];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let i=0;i<n.length;i++){let a=String(i),o=io(n,a,r);o===void 0?delete n[a]:Object.defineProperty(n,a,{value:o,writable:!0,enumerable:!0,configurable:!0})}else for(let i in n){let a=io(n,i,r);a===void 0?delete n[i]:Object.defineProperty(n,i,{value:a,writable:!0,enumerable:!0,configurable:!0})}return r.call(e,t,n)}var I,P,fn,Ye,R;function _p(){for(I="default",P="",fn=!1,Ye=1;;){R=Ze();let e=ps[I]();if(e)return e}}function Ze(){if(oo[Jn])return String.fromCodePoint(oo.codePointAt(Jn))}function C(){let e=Ze();return e===`
2
- `?(lt++,Pe=0):e?Pe+=e.length:Pe++,e&&(Jn+=e.length),e}var ps={default(){switch(R){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
3
- `:case"\r":case"\u2028":case"\u2029":C();return;case"/":C(),I="comment";return;case void 0:return C(),W("eof")}if(re.isSpaceSeparator(R)){C();return}return ps[pe]()},comment(){switch(R){case"*":C(),I="multiLineComment";return;case"/":C(),I="singleLineComment";return}throw J(C())},multiLineComment(){switch(R){case"*":C(),I="multiLineCommentAsterisk";return;case void 0:throw J(C())}C()},multiLineCommentAsterisk(){switch(R){case"*":C();return;case"/":C(),I="default";return;case void 0:throw J(C())}C(),I="multiLineComment"},singleLineComment(){switch(R){case`
4
- `:case"\r":case"\u2028":case"\u2029":C(),I="default";return;case void 0:return C(),W("eof")}C()},value(){switch(R){case"{":case"[":return W("punctuator",C());case"n":return C(),St("ull"),W("null",null);case"t":return C(),St("rue"),W("boolean",!0);case"f":return C(),St("alse"),W("boolean",!1);case"-":case"+":C()==="-"&&(Ye=-1),I="sign";return;case".":P=C(),I="decimalPointLeading";return;case"0":P=C(),I="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":P=C(),I="decimalInteger";return;case"I":return C(),St("nfinity"),W("numeric",1/0);case"N":return C(),St("aN"),W("numeric",NaN);case'"':case"'":fn=C()==='"',P="",I="string";return}throw J(C())},identifierNameStartEscape(){if(R!=="u")throw J(C());C();let e=ao();switch(e){case"$":case"_":break;default:if(!re.isIdStartChar(e))throw cs();break}P+=e,I="identifierName"},identifierName(){switch(R){case"$":case"_":case"\u200C":case"\u200D":P+=C();return;case"\\":C(),I="identifierNameEscape";return}if(re.isIdContinueChar(R)){P+=C();return}return W("identifier",P)},identifierNameEscape(){if(R!=="u")throw J(C());C();let e=ao();switch(e){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!re.isIdContinueChar(e))throw cs();break}P+=e,I="identifierName"},sign(){switch(R){case".":P=C(),I="decimalPointLeading";return;case"0":P=C(),I="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":P=C(),I="decimalInteger";return;case"I":return C(),St("nfinity"),W("numeric",Ye*(1/0));case"N":return C(),St("aN"),W("numeric",NaN)}throw J(C())},zero(){switch(R){case".":P+=C(),I="decimalPoint";return;case"e":case"E":P+=C(),I="decimalExponent";return;case"x":case"X":P+=C(),I="hexadecimal";return}return W("numeric",Ye*0)},decimalInteger(){switch(R){case".":P+=C(),I="decimalPoint";return;case"e":case"E":P+=C(),I="decimalExponent";return}if(re.isDigit(R)){P+=C();return}return W("numeric",Ye*Number(P))},decimalPointLeading(){if(re.isDigit(R)){P+=C(),I="decimalFraction";return}throw J(C())},decimalPoint(){switch(R){case"e":case"E":P+=C(),I="decimalExponent";return}if(re.isDigit(R)){P+=C(),I="decimalFraction";return}return W("numeric",Ye*Number(P))},decimalFraction(){switch(R){case"e":case"E":P+=C(),I="decimalExponent";return}if(re.isDigit(R)){P+=C();return}return W("numeric",Ye*Number(P))},decimalExponent(){switch(R){case"+":case"-":P+=C(),I="decimalExponentSign";return}if(re.isDigit(R)){P+=C(),I="decimalExponentInteger";return}throw J(C())},decimalExponentSign(){if(re.isDigit(R)){P+=C(),I="decimalExponentInteger";return}throw J(C())},decimalExponentInteger(){if(re.isDigit(R)){P+=C();return}return W("numeric",Ye*Number(P))},hexadecimal(){if(re.isHexDigit(R)){P+=C(),I="hexadecimalInteger";return}throw J(C())},hexadecimalInteger(){if(re.isHexDigit(R)){P+=C();return}return W("numeric",Ye*Number(P))},string(){switch(R){case"\\":C(),P+=Mp();return;case'"':if(fn)return C(),W("string",P);P+=C();return;case"'":if(!fn)return C(),W("string",P);P+=C();return;case`
5
- `:case"\r":throw J(C());case"\u2028":case"\u2029":Up(R);break;case void 0:throw J(C())}P+=C()},start(){switch(R){case"{":case"[":return W("punctuator",C())}I="value"},beforePropertyName(){switch(R){case"$":case"_":P=C(),I="identifierName";return;case"\\":C(),I="identifierNameStartEscape";return;case"}":return W("punctuator",C());case'"':case"'":fn=C()==='"',I="string";return}if(re.isIdStartChar(R)){P+=C(),I="identifierName";return}throw J(C())},afterPropertyName(){if(R===":")return W("punctuator",C());throw J(C())},beforePropertyValue(){I="value"},afterPropertyValue(){switch(R){case",":case"}":return W("punctuator",C())}throw J(C())},beforeArrayValue(){if(R==="]")return W("punctuator",C());I="value"},afterArrayValue(){switch(R){case",":case"]":return W("punctuator",C())}throw J(C())},end(){throw J(C())}};function W(e,t){return{type:e,value:t,line:lt,column:Pe}}function St(e){for(let t of e){if(Ze()!==t)throw J(C());C()}}function Mp(){switch(Ze()){case"b":return C(),"\b";case"f":return C(),"\f";case"n":return C(),`
6
- `;case"r":return C(),"\r";case"t":return C()," ";case"v":return C(),"\v";case"0":if(C(),re.isDigit(Ze()))throw J(C());return"\0";case"x":return C(),jp();case"u":return C(),ao();case`
7
- `:case"\u2028":case"\u2029":return C(),"";case"\r":return C(),Ze()===`
8
- `&&C(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw J(C());case void 0:throw J(C())}return C()}function jp(){let e="",t=Ze();if(!re.isHexDigit(t)||(e+=C(),t=Ze(),!re.isHexDigit(t)))throw J(C());return e+=C(),String.fromCodePoint(parseInt(e,16))}function ao(){let e="",t=4;for(;t-- >0;){let r=Ze();if(!re.isHexDigit(r))throw J(C());e+=C()}return String.fromCodePoint(parseInt(e,16))}var Vp={start(){if(oe.type==="eof")throw vt();ro()},beforePropertyName(){switch(oe.type){case"identifier":case"string":so=oe.value,pe="afterPropertyName";return;case"punctuator":Wn();return;case"eof":throw vt()}},afterPropertyName(){if(oe.type==="eof")throw vt();pe="beforePropertyValue"},beforePropertyValue(){if(oe.type==="eof")throw vt();ro()},beforeArrayValue(){if(oe.type==="eof")throw vt();if(oe.type==="punctuator"&&oe.value==="]"){Wn();return}ro()},afterPropertyValue(){if(oe.type==="eof")throw vt();switch(oe.value){case",":pe="beforePropertyName";return;case"}":Wn()}},afterArrayValue(){if(oe.type==="eof")throw vt();switch(oe.value){case",":pe="beforeArrayValue";return;case"]":Wn()}},end(){}};function ro(){let e;switch(oe.type){case"punctuator":switch(oe.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=oe.value;break}if(dn===void 0)dn=e;else{let t=Xe[Xe.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,so,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")Xe.push(e),Array.isArray(e)?pe="beforeArrayValue":pe="beforePropertyName";else{let t=Xe[Xe.length-1];t==null?pe="end":Array.isArray(t)?pe="afterArrayValue":pe="afterPropertyValue"}}function Wn(){Xe.pop();let e=Xe[Xe.length-1];e==null?pe="end":Array.isArray(e)?pe="afterArrayValue":pe="afterPropertyValue"}function J(e){return Hn(e===void 0?`JSON5: invalid end of input at ${lt}:${Pe}`:`JSON5: invalid character '${ms(e)}' at ${lt}:${Pe}`)}function vt(){return Hn(`JSON5: invalid end of input at ${lt}:${Pe}`)}function cs(){return Pe-=5,Hn(`JSON5: invalid identifier character at ${lt}:${Pe}`)}function Up(e){console.warn(`JSON5: '${ms(e)}' in strings is not valid ECMAScript; consider escaping`)}function ms(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 r=e.charCodeAt(0).toString(16);return"\\x"+("00"+r).substring(r.length)}return e}function Hn(e){let t=new SyntaxError(e);return t.lineNumber=lt,t.columnNumber=Pe,t}});var gs=se((ZC,Ds)=>{var uo=no();Ds.exports=function(t,r,n){let i=[],a="",o,s,u="",l;if(r!=null&&typeof r=="object"&&!Array.isArray(r)&&(n=r.space,l=r.quote,r=r.replacer),typeof r=="function")s=r;else if(Array.isArray(r)){o=[];for(let d of r){let g;typeof d=="string"?g=d:(typeof d=="number"||d instanceof String||d instanceof Number)&&(g=String(d)),g!==void 0&&o.indexOf(g)<0&&o.push(g)}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),u=" ".substr(0,n)):typeof n=="string"&&(u=n.substr(0,10)),c("",{"":t});function c(d,g){let m=g[d];switch(m!=null&&(typeof m.toJSON5=="function"?m=m.toJSON5(d):typeof m.toJSON=="function"&&(m=m.toJSON(d))),s&&(m=s.call(g,d,m)),m instanceof Number?m=Number(m):m instanceof String?m=String(m):m instanceof Boolean&&(m=m.valueOf()),m){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof m=="string")return p(m,!1);if(typeof m=="number")return String(m);if(typeof m=="object")return Array.isArray(m)?D(m):f(m)}function p(d){let g={"'":.1,'"':.2},m={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},E="";for(let v=0;v<d.length;v++){let S=d[v];switch(S){case"'":case'"':g[S]++,E+=S;continue;case"\0":if(uo.isDigit(d[v+1])){E+="\\x00";continue}}if(m[S]){E+=m[S];continue}if(S<" "){let y=S.charCodeAt(0).toString(16);E+="\\x"+("00"+y).substring(y.length);continue}E+=S}let x=l||Object.keys(g).reduce((v,S)=>g[v]<g[S]?v:S);return E=E.replace(new RegExp(x,"g"),m[x]),x+E+x}function f(d){if(i.indexOf(d)>=0)throw TypeError("Converting circular structure to JSON5");i.push(d);let g=a;a=a+u;let m=o||Object.keys(d),E=[];for(let v of m){let S=c(v,d);if(S!==void 0){let y=h(v)+":";u!==""&&(y+=" "),y+=S,E.push(y)}}let x;if(E.length===0)x="{}";else{let v;if(u==="")v=E.join(","),x="{"+v+"}";else{let S=`,
1
+ "use strict";var mu=Object.create;var vn=Object.defineProperty;var fu=Object.getOwnPropertyDescriptor;var du=Object.getOwnPropertyNames;var Du=Object.getPrototypeOf,gu=Object.prototype.hasOwnProperty;var se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hu=(e,t)=>{for(var r in t)vn(e,r,{get:t[r],enumerable:!0})},_o=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of du(t))!gu.call(e,i)&&i!==r&&vn(e,i,{get:()=>t[i],enumerable:!(n=fu(t,i))||n.enumerable});return e};var I=(e,t,r)=>(r=e!=null?mu(Du(e)):{},_o(t||!e||!e.__esModule?vn(r,"default",{value:e,enumerable:!0}):r,e)),Cu=e=>_o(vn({},"__esModule",{value:!0}),e);var Uo=se((Df,Vo)=>{"use strict";Vo.exports=function(){if(process.env.npm_config_user_agent)return xu(process.env.npm_config_user_agent)};function xu(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 Bn=se((Hf,Ci)=>{"use strict";var Sr="\x1B",Q=`${Sr}[`,ku="\x07",vr={to(e,t){return t?`${Q}${t+1};${e+1}H`:`${Q}${e+1}G`},move(e,t){let r="";return e<0?r+=`${Q}${-e}D`:e>0&&(r+=`${Q}${e}C`),t<0?r+=`${Q}${-t}A`:t>0&&(r+=`${Q}${t}B`),r},up:(e=1)=>`${Q}${e}A`,down:(e=1)=>`${Q}${e}B`,forward:(e=1)=>`${Q}${e}C`,backward:(e=1)=>`${Q}${e}D`,nextLine:(e=1)=>`${Q}E`.repeat(e),prevLine:(e=1)=>`${Q}F`.repeat(e),left:`${Q}G`,hide:`${Q}?25l`,show:`${Q}?25h`,save:`${Sr}7`,restore:`${Sr}8`},$u={up:(e=1)=>`${Q}S`.repeat(e),down:(e=1)=>`${Q}T`.repeat(e)},Lu={screen:`${Q}2J`,up:(e=1)=>`${Q}1J`.repeat(e),down:(e=1)=>`${Q}J`.repeat(e),line:`${Q}2K`,lineEnd:`${Q}K`,lineStart:`${Q}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?vr.up():"");return e&&(t+=vr.left),t}};Ci.exports={cursor:vr,scroll:$u,erase:Lu,beep:ku}});var Ye=se((Qf,wr)=>{var Nn=process||{},xi=Nn.argv||[],Rn=Nn.env||{},Ou=!(Rn.NO_COLOR||xi.includes("--no-color"))&&(!!Rn.FORCE_COLOR||xi.includes("--color")||Nn.platform==="win32"||(Nn.stdout||{}).isTTY&&Rn.TERM!=="dumb"||!!Rn.CI),_u=(e,t,r=e)=>n=>{let i=""+n,a=i.indexOf(t,e.length);return~a?e+ju(i,t,r,a)+t:e+i+t},ju=(e,t,r,n)=>{let i="",a=0;do i+=e.substring(a,n)+r,a=n+t.length,n=e.indexOf(t,a);while(~n);return i+e.substring(a)},Ei=(e=Ou)=>{let t=e?_u:()=>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")}};wr.exports=Ei();wr.exports.createColors=Ei});var ts=se((MC,qn)=>{qn.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;qn.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]/;qn.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 Xr=se((VC,ns)=>{var Yr=ts();ns.exports={isSpaceSeparator(e){return typeof e=="string"&&Yr.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||Yr.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"||Yr.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 ss=se((UC,as)=>{var re=Xr(),eo,de,tt,Jn,ct,Re,oe,ro,gn;as.exports=function(t,r){eo=String(t),de="start",tt=[],Jn=0,ct=1,Re=0,oe=void 0,ro=void 0,gn=void 0;do oe=Ip(),Np[de]();while(oe.type!=="eof");return typeof r=="function"?to({"":gn},"",r):gn};function to(e,t,r){let n=e[t];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let i=0;i<n.length;i++){let a=String(i),o=to(n,a,r);o===void 0?delete n[a]:Object.defineProperty(n,a,{value:o,writable:!0,enumerable:!0,configurable:!0})}else for(let i in n){let a=to(n,i,r);a===void 0?delete n[i]:Object.defineProperty(n,i,{value:a,writable:!0,enumerable:!0,configurable:!0})}return r.call(e,t,n)}var T,P,Dn,et,R;function Ip(){for(T="default",P="",Dn=!1,et=1;;){R=nt();let e=os[T]();if(e)return e}}function nt(){if(eo[Jn])return String.fromCodePoint(eo.codePointAt(Jn))}function C(){let e=nt();return e===`
2
+ `?(ct++,Re=0):e?Re+=e.length:Re++,e&&(Jn+=e.length),e}var os={default(){switch(R){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
3
+ `:case"\r":case"\u2028":case"\u2029":C();return;case"/":C(),T="comment";return;case void 0:return C(),W("eof")}if(re.isSpaceSeparator(R)){C();return}return os[de]()},comment(){switch(R){case"*":C(),T="multiLineComment";return;case"/":C(),T="singleLineComment";return}throw J(C())},multiLineComment(){switch(R){case"*":C(),T="multiLineCommentAsterisk";return;case void 0:throw J(C())}C()},multiLineCommentAsterisk(){switch(R){case"*":C();return;case"/":C(),T="default";return;case void 0:throw J(C())}C(),T="multiLineComment"},singleLineComment(){switch(R){case`
4
+ `:case"\r":case"\u2028":case"\u2029":C(),T="default";return;case void 0:return C(),W("eof")}C()},value(){switch(R){case"{":case"[":return W("punctuator",C());case"n":return C(),vt("ull"),W("null",null);case"t":return C(),vt("rue"),W("boolean",!0);case"f":return C(),vt("alse"),W("boolean",!1);case"-":case"+":C()==="-"&&(et=-1),T="sign";return;case".":P=C(),T="decimalPointLeading";return;case"0":P=C(),T="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":P=C(),T="decimalInteger";return;case"I":return C(),vt("nfinity"),W("numeric",1/0);case"N":return C(),vt("aN"),W("numeric",NaN);case'"':case"'":Dn=C()==='"',P="",T="string";return}throw J(C())},identifierNameStartEscape(){if(R!=="u")throw J(C());C();let e=no();switch(e){case"$":case"_":break;default:if(!re.isIdStartChar(e))throw rs();break}P+=e,T="identifierName"},identifierName(){switch(R){case"$":case"_":case"\u200C":case"\u200D":P+=C();return;case"\\":C(),T="identifierNameEscape";return}if(re.isIdContinueChar(R)){P+=C();return}return W("identifier",P)},identifierNameEscape(){if(R!=="u")throw J(C());C();let e=no();switch(e){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!re.isIdContinueChar(e))throw rs();break}P+=e,T="identifierName"},sign(){switch(R){case".":P=C(),T="decimalPointLeading";return;case"0":P=C(),T="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":P=C(),T="decimalInteger";return;case"I":return C(),vt("nfinity"),W("numeric",et*(1/0));case"N":return C(),vt("aN"),W("numeric",NaN)}throw J(C())},zero(){switch(R){case".":P+=C(),T="decimalPoint";return;case"e":case"E":P+=C(),T="decimalExponent";return;case"x":case"X":P+=C(),T="hexadecimal";return}return W("numeric",et*0)},decimalInteger(){switch(R){case".":P+=C(),T="decimalPoint";return;case"e":case"E":P+=C(),T="decimalExponent";return}if(re.isDigit(R)){P+=C();return}return W("numeric",et*Number(P))},decimalPointLeading(){if(re.isDigit(R)){P+=C(),T="decimalFraction";return}throw J(C())},decimalPoint(){switch(R){case"e":case"E":P+=C(),T="decimalExponent";return}if(re.isDigit(R)){P+=C(),T="decimalFraction";return}return W("numeric",et*Number(P))},decimalFraction(){switch(R){case"e":case"E":P+=C(),T="decimalExponent";return}if(re.isDigit(R)){P+=C();return}return W("numeric",et*Number(P))},decimalExponent(){switch(R){case"+":case"-":P+=C(),T="decimalExponentSign";return}if(re.isDigit(R)){P+=C(),T="decimalExponentInteger";return}throw J(C())},decimalExponentSign(){if(re.isDigit(R)){P+=C(),T="decimalExponentInteger";return}throw J(C())},decimalExponentInteger(){if(re.isDigit(R)){P+=C();return}return W("numeric",et*Number(P))},hexadecimal(){if(re.isHexDigit(R)){P+=C(),T="hexadecimalInteger";return}throw J(C())},hexadecimalInteger(){if(re.isHexDigit(R)){P+=C();return}return W("numeric",et*Number(P))},string(){switch(R){case"\\":C(),P+=Bp();return;case'"':if(Dn)return C(),W("string",P);P+=C();return;case"'":if(!Dn)return C(),W("string",P);P+=C();return;case`
5
+ `:case"\r":throw J(C());case"\u2028":case"\u2029":kp(R);break;case void 0:throw J(C())}P+=C()},start(){switch(R){case"{":case"[":return W("punctuator",C())}T="value"},beforePropertyName(){switch(R){case"$":case"_":P=C(),T="identifierName";return;case"\\":C(),T="identifierNameStartEscape";return;case"}":return W("punctuator",C());case'"':case"'":Dn=C()==='"',T="string";return}if(re.isIdStartChar(R)){P+=C(),T="identifierName";return}throw J(C())},afterPropertyName(){if(R===":")return W("punctuator",C());throw J(C())},beforePropertyValue(){T="value"},afterPropertyValue(){switch(R){case",":case"}":return W("punctuator",C())}throw J(C())},beforeArrayValue(){if(R==="]")return W("punctuator",C());T="value"},afterArrayValue(){switch(R){case",":case"]":return W("punctuator",C())}throw J(C())},end(){throw J(C())}};function W(e,t){return{type:e,value:t,line:ct,column:Re}}function vt(e){for(let t of e){if(nt()!==t)throw J(C());C()}}function Bp(){switch(nt()){case"b":return C(),"\b";case"f":return C(),"\f";case"n":return C(),`
6
+ `;case"r":return C(),"\r";case"t":return C()," ";case"v":return C(),"\v";case"0":if(C(),re.isDigit(nt()))throw J(C());return"\0";case"x":return C(),Rp();case"u":return C(),no();case`
7
+ `:case"\u2028":case"\u2029":return C(),"";case"\r":return C(),nt()===`
8
+ `&&C(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw J(C());case void 0:throw J(C())}return C()}function Rp(){let e="",t=nt();if(!re.isHexDigit(t)||(e+=C(),t=nt(),!re.isHexDigit(t)))throw J(C());return e+=C(),String.fromCodePoint(parseInt(e,16))}function no(){let e="",t=4;for(;t-- >0;){let r=nt();if(!re.isHexDigit(r))throw J(C());e+=C()}return String.fromCodePoint(parseInt(e,16))}var Np={start(){if(oe.type==="eof")throw wt();Zr()},beforePropertyName(){switch(oe.type){case"identifier":case"string":ro=oe.value,de="afterPropertyName";return;case"punctuator":Wn();return;case"eof":throw wt()}},afterPropertyName(){if(oe.type==="eof")throw wt();de="beforePropertyValue"},beforePropertyValue(){if(oe.type==="eof")throw wt();Zr()},beforeArrayValue(){if(oe.type==="eof")throw wt();if(oe.type==="punctuator"&&oe.value==="]"){Wn();return}Zr()},afterPropertyValue(){if(oe.type==="eof")throw wt();switch(oe.value){case",":de="beforePropertyName";return;case"}":Wn()}},afterArrayValue(){if(oe.type==="eof")throw wt();switch(oe.value){case",":de="beforeArrayValue";return;case"]":Wn()}},end(){}};function Zr(){let e;switch(oe.type){case"punctuator":switch(oe.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=oe.value;break}if(gn===void 0)gn=e;else{let t=tt[tt.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,ro,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")tt.push(e),Array.isArray(e)?de="beforeArrayValue":de="beforePropertyName";else{let t=tt[tt.length-1];t==null?de="end":Array.isArray(t)?de="afterArrayValue":de="afterPropertyValue"}}function Wn(){tt.pop();let e=tt[tt.length-1];e==null?de="end":Array.isArray(e)?de="afterArrayValue":de="afterPropertyValue"}function J(e){return Gn(e===void 0?`JSON5: invalid end of input at ${ct}:${Re}`:`JSON5: invalid character '${is(e)}' at ${ct}:${Re}`)}function wt(){return Gn(`JSON5: invalid end of input at ${ct}:${Re}`)}function rs(){return Re-=5,Gn(`JSON5: invalid identifier character at ${ct}:${Re}`)}function kp(e){console.warn(`JSON5: '${is(e)}' in strings is not valid ECMAScript; consider escaping`)}function is(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 r=e.charCodeAt(0).toString(16);return"\\x"+("00"+r).substring(r.length)}return e}function Gn(e){let t=new SyntaxError(e);return t.lineNumber=ct,t.columnNumber=Re,t}});var ls=se((KC,us)=>{var oo=Xr();us.exports=function(t,r,n){let i=[],a="",o,s,u="",l;if(r!=null&&typeof r=="object"&&!Array.isArray(r)&&(n=r.space,l=r.quote,r=r.replacer),typeof r=="function")s=r;else if(Array.isArray(r)){o=[];for(let d of r){let g;typeof d=="string"?g=d:(typeof d=="number"||d instanceof String||d instanceof Number)&&(g=String(d)),g!==void 0&&o.indexOf(g)<0&&o.push(g)}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),u=" ".substr(0,n)):typeof n=="string"&&(u=n.substr(0,10)),c("",{"":t});function c(d,g){let m=g[d];switch(m!=null&&(typeof m.toJSON5=="function"?m=m.toJSON5(d):typeof m.toJSON=="function"&&(m=m.toJSON(d))),s&&(m=s.call(g,d,m)),m instanceof Number?m=Number(m):m instanceof String?m=String(m):m instanceof Boolean&&(m=m.valueOf()),m){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof m=="string")return p(m,!1);if(typeof m=="number")return String(m);if(typeof m=="object")return Array.isArray(m)?D(m):f(m)}function p(d){let g={"'":.1,'"':.2},m={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},E="";for(let v=0;v<d.length;v++){let S=d[v];switch(S){case"'":case'"':g[S]++,E+=S;continue;case"\0":if(oo.isDigit(d[v+1])){E+="\\x00";continue}}if(m[S]){E+=m[S];continue}if(S<" "){let y=S.charCodeAt(0).toString(16);E+="\\x"+("00"+y).substring(y.length);continue}E+=S}let x=l||Object.keys(g).reduce((v,S)=>g[v]<g[S]?v:S);return E=E.replace(new RegExp(x,"g"),m[x]),x+E+x}function f(d){if(i.indexOf(d)>=0)throw TypeError("Converting circular structure to JSON5");i.push(d);let g=a;a=a+u;let m=o||Object.keys(d),E=[];for(let v of m){let S=c(v,d);if(S!==void 0){let y=h(v)+":";u!==""&&(y+=" "),y+=S,E.push(y)}}let x;if(E.length===0)x="{}";else{let v;if(u==="")v=E.join(","),x="{"+v+"}";else{let S=`,
9
9
  `+a;v=E.join(S),x=`{
10
10
  `+a+v+`,
11
- `+g+"}"}}return i.pop(),a=g,x}function h(d){if(d.length===0)return p(d,!0);let g=String.fromCodePoint(d.codePointAt(0));if(!uo.isIdStartChar(g))return p(d,!0);for(let m=g.length;m<d.length;m++)if(!uo.isIdContinueChar(String.fromCodePoint(d.codePointAt(m))))return p(d,!0);return d}function D(d){if(i.indexOf(d)>=0)throw TypeError("Converting circular structure to JSON5");i.push(d);let g=a;a=a+u;let m=[];for(let x=0;x<d.length;x++){let v=c(String(x),d);m.push(v!==void 0?v:"null")}let E;if(m.length===0)E="[]";else if(u==="")E="["+m.join(",")+"]";else{let x=`,
11
+ `+g+"}"}}return i.pop(),a=g,x}function h(d){if(d.length===0)return p(d,!0);let g=String.fromCodePoint(d.codePointAt(0));if(!oo.isIdStartChar(g))return p(d,!0);for(let m=g.length;m<d.length;m++)if(!oo.isIdContinueChar(String.fromCodePoint(d.codePointAt(m))))return p(d,!0);return d}function D(d){if(i.indexOf(d)>=0)throw TypeError("Converting circular structure to JSON5");i.push(d);let g=a;a=a+u;let m=[];for(let x=0;x<d.length;x++){let v=c(String(x),d);m.push(v!==void 0?v:"null")}let E;if(m.length===0)E="[]";else if(u==="")E="["+m.join(",")+"]";else{let x=`,
12
12
  `+a,v=m.join(x);E=`[
13
13
  `+a+v+`,
14
- `+g+"]"}return i.pop(),a=g,E}}});var Cs=se((e0,hs)=>{var Kp=ds(),zp=gs(),qp={parse:Kp,stringify:zp};hs.exports=qp});var co=se(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});function bs(e){return Object.prototype.toString.call(e)}Qn.getType=bs;function nm(e){throw new TypeError("unsupported data type: "+bs(e))}Qn.throwUnknownDataType=nm});var go=se(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});var et="";for(let e=0;e<10;e++){let t=String.fromCharCode(48+e);et+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(65+e);et+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(97+e);et+=t}var Kt=et.length,mo={};for(let e=0;e<Kt;e++){let t=et[e];mo[t]=e}function fo(e){let t=0,r=1;for(let n=e.length-1;n>=0;n--){let i=e[n],a=mo[i];a*=r,t+=a,r*=Kt}return t}tt.s_to_int=fo;function Ps(e){let t=BigInt(0),r=BigInt(1),n=BigInt(Kt);for(let i=e.length-1;i>=0;i--){let a=e[i],o=BigInt(mo[a]);o*=r,t+=o,r*=n}return t}tt.s_to_big_int=Ps;function Do(e){if(e===0)return et[0];let t=[];for(;e!==0;){let r=e%Kt,n=et[r];t.push(n),e-=r,e/=Kt}return t.reverse().join("")}tt.int_to_s=Do;function Ts(e){let t=BigInt(0),r=BigInt(Kt);if(e===t)return et[0];let n=[];for(;e!==t;){let i=e%r,a=et[Number(i)];n.push(a),e-=i,e/=r}return n.reverse().join("")}tt.big_int_to_s=Ts;function Xn(e){return e.split("").reverse().join("")}function Is(e){if(e<0)return"-"+Is(-e);let[t,r]=e.toString().split(".");if(!r)return Do(e);let n;r&&([r,n]=r.split("e")),t=Yn(t),r=Xn(r),r=Yn(r);let i=t+"."+r;if(n){switch(i+=".",n[0]){case"+":n=n.slice(1);break;case"-":i+="-",n=n.slice(1);break}n=Xn(n),n=Yn(n),i+=n}return i}tt.num_to_s=Is;function Yn(e){let t=+e;return t.toString()===e?Do(t):":"+Ts(BigInt(e))}tt.int_str_to_s=Yn;function po(e){return e[0]===":"?Ps(e.substring(1)).toString():fo(e).toString()}function Bs(e){if(e[0]==="-")return-Bs(e.substr(1));let[t,r,n]=e.split(".");if(!r)return fo(t);t=po(t),r=po(r),r=Xn(r);let i=t+"."+r;if(n){i+="e";let a=!1;n[0]==="-"&&(a=!0,n=n.slice(1)),n=po(n),n=Xn(n),i+=a?-n:+n}return+i}tt.s_to_num=Bs});var Co=se(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});var ho=go();function rm(e){return"n|"+ho.num_to_s(e)}nt.encodeNum=rm;function om(e){return e=e.replace("n|",""),ho.s_to_num(e)}nt.decodeNum=om;function im(e){return typeof e=="number"?e:ho.s_to_int(e)}nt.decodeKey=im;function am(e){return e?"b|T":"b|F"}nt.encodeBool=am;function sm(e){switch(e){case"b|T":return!0;case"b|F":return!1}return!!e}nt.decodeBool=sm;function um(e){switch(e[0]+e[1]){case"b|":case"o|":case"n|":case"a|":case"s|":e="s|"+e}return e}nt.encodeStr=um;function lm(e){return e[0]+e[1]==="s|"?e.substr(2):e}nt.decodeStr=lm});var Rs=se(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.config={sort_key:!1}});var Fo=se(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});var cm=Rs(),pm=co(),Eo=Co(),mm=go();function fm(e){return e.store.toArray()}At.memToValues=fm;function Ns(){let e=[];return{forEach(t){for(let r=0;r<e.length;r++)if(t(e[r])==="break")return},add(t){e.push(t)},toArray(){return e}}}At.makeInMemoryStore=Ns;function ks(){let e=Object.create(null),t=Object.create(null);return{getValue(r){return e[r]},getSchema(r){return t[r]},forEachValue(r){for(let[n,i]of Object.entries(e))if(r(n,i)==="break")return},forEachSchema(r){for(let[n,i]of Object.entries(t))if(r(n,i)==="break")return},setValue(r,n){e[r]=n},setSchema(r,n){t[r]=n},hasValue(r){return r in e},hasSchema(r){return r in t}}}At.makeInMemoryCache=ks;function dm(){return{store:Ns(),cache:ks(),keyCount:0}}At.makeInMemoryMemory=dm;function wt(e,t){if(e.cache.hasValue(t))return e.cache.getValue(t);let r=e.keyCount++,n=mm.num_to_s(r);return e.store.add(t),e.cache.setValue(t,n),n}function Dm(e,t){cm.config.sort_key&&t.sort();let r=t.join(",");if(e.cache.hasSchema(r))return e.cache.getSchema(r);let n=Dn(e,t,void 0);return e.cache.setSchema(r,n),n}function Dn(e,t,r){if(t===null)return"";switch(typeof t){case"undefined":if(Array.isArray(r))return Dn(e,null,r);break;case"object":if(t===null)return wt(e,null);if(Array.isArray(t)){let n="a";for(let i=0;i<t.length;i++){let a=t[i],o=a===null?"_":Dn(e,a,t);n+="|"+o}return n==="a"&&(n="a|"),wt(e,n)}else{let n=Object.keys(t);if(n.length===0)return wt(e,"o|");let i="o",a=Dm(e,n);i+="|"+a;for(let o of n){let s=t[o],u=Dn(e,s,t);i+="|"+u}return wt(e,i)}case"boolean":return wt(e,Eo.encodeBool(t));case"number":return wt(e,Eo.encodeNum(t));case"string":return wt(e,Eo.encodeStr(t))}return pm.throwUnknownDataType(t)}At.addValue=Dn});var So=se(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});var gm=co(),Zn=Co(),yo=Fo();function hm(e){let t=yo.makeInMemoryMemory(),r=yo.addValue(t,e,void 0);return[yo.memToValues(t),r]}hn.compress=hm;function Cm(e,t){if(t==="o|")return{};let r={},n=t.split("|"),i=n[1],a=gn(e,i),o=n.length;o-2===1&&!Array.isArray(a)&&(a=[a]);for(let s=2;s<o;s++){let u=a[s-2],l=n[s];l=gn(e,l),r[u]=l}return r}function xm(e,t){if(t==="a|")return[];let r=t.split("|"),n=r.length-1,i=new Array(n);for(let a=0;a<n;a++){let o=r[a+1];o=gn(e,o),i[a]=o}return i}function gn(e,t){if(t===""||t==="_")return null;let r=Zn.decodeKey(t),n=e[r];if(n===null)return n;switch(typeof n){case"undefined":return n;case"number":return n;case"string":switch(n[0]+n[1]){case"b|":return Zn.decodeBool(n);case"o|":return Cm(e,n);case"n|":return Zn.decodeNum(n);case"a|":return xm(e,n);default:return Zn.decodeStr(n)}}return gm.throwUnknownDataType(n)}hn.decode=gn;function Em(e){let[t,r]=e;return gn(t,r)}hn.decompress=Em});var Ls=se(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});function Fm(e){for(let t in e)e[t]===void 0&&delete e[t]}er.trimUndefined=Fm;function ym(e){$s(e,new Set)}er.trimUndefinedRecursively=ym;function $s(e,t){t.add(e);for(let r in e)if(e[r]===void 0)delete e[r];else{let n=e[r];n&&typeof n=="object"&&!t.has(n)&&$s(n,t)}}});var Ms=se(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});var Os=So();ct.compress=Os.compress;ct.decompress=Os.decompress;var Sm=So();ct.decode=Sm.decode;var vm=Fo();ct.addValue=vm.addValue;var _s=Ls();ct.trimUndefined=_s.trimUndefined;ct.trimUndefinedRecursively=_s.trimUndefinedRecursively});var Ef={};Au(Ef,{createDevToolsServer:()=>To,version:()=>zo});module.exports=bu(Ef);var gr=require("node:http");var hr="preview-url";var bt="framework",wn="platform",An="node",Wo="/~builder-connect",gt="/~builder-connected",Cr="/~builder-dev-tools",xr="/~builder-dev-tools.js",ht="/~builder-dev-tools-close",Jo="/mappings";function N(e,t=""){return e.ts.createSourceFile("module.tsx",typeof t=="string"?t:"",e.ts.ScriptTarget.Latest,void 0)}function bn(e,t=""){let r=N(e,t?.trim());if(r.statements.length===0)throw new Error(`No statements found in code: ${t}`);return r.statements[0]}function ne(e,t,r){if(t){let n=e.ts.createPrinter({newLine:e.ts.NewLineKind.LineFeed,removeComments:r});return e.ts.isSourceFile(t)?n.printFile(t).trim()+`
14
+ `+g+"]"}return i.pop(),a=g,E}}});var ps=se((zC,cs)=>{var $p=ss(),Lp=ls(),Op={parse:$p,stringify:Lp};cs.exports=Op});var ao=se(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.throwUnsupportedData=pt.throwUnknownDataType=pt.getType=void 0;function Es(e){return Object.prototype.toString.call(e)}pt.getType=Es;function Gp(e){throw new TypeError("unsupported data type: "+Es(e))}pt.throwUnknownDataType=Gp;function Hp(e){throw new TypeError("unsupported data type: "+e)}pt.throwUnsupportedData=Hp});var po=se(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.s_to_num=ue.int_str_to_s=ue.num_to_s=ue.big_int_to_s=ue.int_to_s=ue.s_to_big_int=ue.s_to_int=void 0;var rt="";for(let e=0;e<10;e++){let t=String.fromCharCode(48+e);rt+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(65+e);rt+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(97+e);rt+=t}var zt=rt.length,uo={};for(let e=0;e<zt;e++){let t=rt[e];uo[t]=e}function lo(e){let t=0,r=1;for(let n=e.length-1;n>=0;n--){let i=e[n],a=uo[i];a*=r,t+=a,r*=zt}return t}ue.s_to_int=lo;function Fs(e){let t=BigInt(0),r=BigInt(1),n=BigInt(zt);for(let i=e.length-1;i>=0;i--){let a=e[i],o=BigInt(uo[a]);o*=r,t+=o,r*=n}return t}ue.s_to_big_int=Fs;function co(e){if(e===0)return rt[0];let t=[];for(;e!==0;){let r=e%zt,n=rt[r];t.push(n),e-=r,e/=zt}return t.reverse().join("")}ue.int_to_s=co;function ys(e){let t=BigInt(0),r=BigInt(zt);if(e===t)return rt[0];let n=[];for(;e!==t;){let i=e%r,a=rt[Number(i)];n.push(a),e/=r}return n.reverse().join("")}ue.big_int_to_s=ys;function Ss(e){return e.split("").reverse().join("")}function vs(e){if(e<0)return"-"+vs(-e);let[t,r]=e.toString().split(".");if(!r)if(t.includes("e")){let[a,o]=t.split("e");t=a,r="0e"+o}else return co(e);let n;r&&([r,n]=r.split("e")),t=Qn(t),r=Ss(r),r=Qn(r);let i=t+"."+r;if(n){switch(i+=".",n[0]){case"+":n=n.slice(1);break;case"-":i+="-",n=n.slice(1);break}n=Qn(n),i+=n}return i}ue.num_to_s=vs;function Qn(e){let t=+e;return t.toString()===e&&t+1!==t&&t-1!==t?co(t):":"+ys(BigInt(e))}ue.int_str_to_s=Qn;function so(e){return e[0]===":"?Fs(e.substring(1)).toString():lo(e).toString()}function ws(e){if(e[0]==="-")return-ws(e.substr(1));let[t,r,n]=e.split(".");if(!r)return lo(t);t=so(t),r=so(r),r=Ss(r);let i=t+"."+r;if(n){i+="e";let a=!1;n[0]==="-"&&(a=!0,n=n.slice(1)),n=so(n),i+=a?-n:+n}return+i}ue.s_to_num=ws});var fo=se(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.decodeStr=le.encodeStr=le.decodeBool=le.encodeBool=le.decodeKey=le.decodeNum=le.encodeNum=void 0;var mo=po();function Qp(e){return"n|"+(0,mo.num_to_s)(e)}le.encodeNum=Qp;function Yp(e){return e=e.replace("n|",""),(0,mo.s_to_num)(e)}le.decodeNum=Yp;function Xp(e){return typeof e=="number"?e:(0,mo.s_to_int)(e)}le.decodeKey=Xp;function Zp(e){return e?"b|T":"b|F"}le.encodeBool=Zp;function em(e){switch(e){case"b|T":return!0;case"b|F":return!1}return!!e}le.decodeBool=em;function tm(e){switch(e[0]+e[1]){case"b|":case"o|":case"n|":case"a|":case"s|":e="s|"+e}return e}le.encodeStr=tm;function nm(e){return e[0]+e[1]==="s|"?e.substr(2):e}le.decodeStr=nm});var Do=se(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.config=void 0;Yn.config={sort_key:!1,error_on_nan:!1,error_on_infinite:!1}});var xo=se(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.addValue=be.makeInMemoryMemory=be.makeInMemoryCache=be.makeInMemoryStore=be.memToValues=void 0;var Co=Do(),go=ao(),ho=fo(),rm=po();function om(e){return e.store.toArray()}be.memToValues=om;function bs(){let e=[];return{forEach(t){for(let r=0;r<e.length;r++)if(t(e[r])==="break")return},add(t){e.push(t)},toArray(){return e}}}be.makeInMemoryStore=bs;function As(){let e=Object.create(null),t=Object.create(null);return{getValue(r){return e[r]},getSchema(r){return t[r]},forEachValue(r){for(let[n,i]of Object.entries(e))if(r(n,i)==="break")return},forEachSchema(r){for(let[n,i]of Object.entries(t))if(r(n,i)==="break")return},setValue(r,n){e[r]=n},setSchema(r,n){t[r]=n},hasValue(r){return r in e},hasSchema(r){return r in t}}}be.makeInMemoryCache=As;function im(){return{store:bs(),cache:As(),keyCount:0}}be.makeInMemoryMemory=im;function bt(e,t){if(e.cache.hasValue(t))return e.cache.getValue(t);let r=e.keyCount++,n=(0,rm.num_to_s)(r);return e.store.add(t),e.cache.setValue(t,n),n}function am(e,t){Co.config.sort_key&&t.sort();let r=t.join(",");if(e.cache.hasSchema(r))return e.cache.getSchema(r);let n=hn(e,t,void 0);return e.cache.setSchema(r,n),n}function hn(e,t,r){if(t===null)return"";switch(typeof t){case"undefined":if(Array.isArray(r))return hn(e,null,r);break;case"object":if(t===null)return bt(e,null);if(Array.isArray(t)){let n="a";for(let i=0;i<t.length;i++){let a=t[i],o=a===null?"_":hn(e,a,t);n+="|"+o}return n==="a"&&(n="a|"),bt(e,n)}else{let n=Object.keys(t);if(n.length===0)return bt(e,"o|");let i="o",a=am(e,n);i+="|"+a;for(let o of n){let s=t[o],u=hn(e,s,t);i+="|"+u}return bt(e,i)}case"boolean":return bt(e,(0,ho.encodeBool)(t));case"number":return Number.isNaN(t)?(Co.config.error_on_nan&&(0,go.throwUnsupportedData)("[number NaN]"),""):Number.POSITIVE_INFINITY===t||Number.NEGATIVE_INFINITY===t?(Co.config.error_on_infinite&&(0,go.throwUnsupportedData)("[number Infinity]"),""):bt(e,(0,ho.encodeNum)(t));case"string":return bt(e,(0,ho.encodeStr)(t))}return(0,go.throwUnknownDataType)(t)}be.addValue=hn});var Fo=se(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.decompress=mt.decode=mt.compress=void 0;var sm=ao(),Xn=fo(),Eo=xo();function um(e){let t=(0,Eo.makeInMemoryMemory)(),r=(0,Eo.addValue)(t,e,void 0);return[(0,Eo.memToValues)(t),r]}mt.compress=um;function lm(e,t){if(t==="o|")return{};let r={},n=t.split("|"),i=n[1],a=Cn(e,i),o=n.length;o-2===1&&!Array.isArray(a)&&(a=[a]);for(let s=2;s<o;s++){let u=a[s-2],l=n[s];l=Cn(e,l),r[u]=l}return r}function cm(e,t){if(t==="a|")return[];let r=t.split("|"),n=r.length-1,i=new Array(n);for(let a=0;a<n;a++){let o=r[a+1];o=Cn(e,o),i[a]=o}return i}function Cn(e,t){if(t===""||t==="_")return null;let r=(0,Xn.decodeKey)(t),n=e[r];if(n===null)return n;switch(typeof n){case"undefined":return n;case"number":return n;case"string":switch(n[0]+n[1]){case"b|":return(0,Xn.decodeBool)(n);case"o|":return lm(e,n);case"n|":return(0,Xn.decodeNum)(n);case"a|":return cm(e,n);default:return(0,Xn.decodeStr)(n)}}return(0,sm.throwUnknownDataType)(n)}mt.decode=Cn;function pm(e){let[t,r]=e;return Cn(t,r)}mt.decompress=pm});var Ts=se(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.trimUndefinedRecursively=qt.trimUndefined=void 0;function mm(e){for(let t in e)e[t]===void 0&&delete e[t]}qt.trimUndefined=mm;function fm(e){Ps(e,new Set)}qt.trimUndefinedRecursively=fm;function Ps(e,t){t.add(e);for(let r in e)if(e[r]===void 0)delete e[r];else{let n=e[r];n&&typeof n=="object"&&!t.has(n)&&Ps(n,t)}}});var Rs=se(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.config=ce.trimUndefinedRecursively=ce.trimUndefined=ce.addValue=ce.decode=ce.decompress=ce.compress=void 0;var Is=Fo();Object.defineProperty(ce,"compress",{enumerable:!0,get:function(){return Is.compress}});Object.defineProperty(ce,"decompress",{enumerable:!0,get:function(){return Is.decompress}});var dm=Fo();Object.defineProperty(ce,"decode",{enumerable:!0,get:function(){return dm.decode}});var Dm=xo();Object.defineProperty(ce,"addValue",{enumerable:!0,get:function(){return Dm.addValue}});var Bs=Ts();Object.defineProperty(ce,"trimUndefined",{enumerable:!0,get:function(){return Bs.trimUndefined}});Object.defineProperty(ce,"trimUndefinedRecursively",{enumerable:!0,get:function(){return Bs.trimUndefinedRecursively}});var gm=Do();Object.defineProperty(ce,"config",{enumerable:!0,get:function(){return gm.config}})});var pf={};hu(pf,{createDevToolsServer:()=>Ao,version:()=>Oo});module.exports=Cu(pf);var mr=require("http");var fr="preview-url";var Pt="framework",wn="platform",bn="node",jo="/~builder-connect",ht="/~builder-connected",dr="/~builder-dev-tools",Dr="/~builder-dev-tools.js",Ct="/~builder-dev-tools-close",Mo="/mappings";function N(e,t=""){return e.ts.createSourceFile("module.tsx",typeof t=="string"?t:"",e.ts.ScriptTarget.Latest,void 0)}function An(e,t=""){let r=N(e,t?.trim());if(r.statements.length===0)throw new Error(`No statements found in code: ${t}`);return r.statements[0]}function ne(e,t,r){if(t){let n=e.ts.createPrinter({newLine:e.ts.NewLineKind.LineFeed,removeComments:r});return e.ts.isSourceFile(t)?n.printFile(t).trim()+`
15
15
  `:n.printNode(e.ts.EmitHint.Unspecified,t,e.ts.createSourceFile("module.tsx","",e.ts.ScriptTarget.Latest)).trim()+`
16
- `}return""}var Yo=T(Go(),1);function De(e){return e.endsWith(".mapper.tsx")||e.endsWith(".mapper.jsx")||e.endsWith(".mapper.ts")||e.endsWith(".mapper.js")||e.endsWith(".mapper.mjs")}function L(e,t,r){t=we(t),r=we(r),t=e.dirname(t);let n=e.basename(r,e.extname(r));r=e.dirname(r);let i;return n==="index"?i=e.relative(t,r):i=e.relative(t,e.join(r,n)),i=we(e.normalize(i)),i.startsWith(".")||(i="./"+i),i}function we(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}function Ct(e,t){let r=e.extname(t),n=e.basename(t,r).split(/[\/\\]/),i=n[n.length-1];return Qo(i==="index"?e.basename(e.dirname(t)):i)}function Qo(e){return q(e).replace(/ /g,"")}function Ee(e,t){let r=e.extname(t),n=we(e.basename(t,r)).split("/").pop();return q(n==="index"?e.basename(e.dirname(t)):n)}function K(e,t){let r=we(e.relative(e.getAppRootDir(),t));r=r.split("/").filter(i=>i!=="."&&i!==".."&&i!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=e.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(i=>i.name.includes("next"))?"@/"+r:"~/"+r}function M(e,t){let r=t,n=[];for(let i=0;i<2;i++){let a=e.basename(r);if(!a||a==="components")break;n.unshift(a),r=e.dirname(r)}return n.join("/")}function q(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 me(e){return e.sort((t,r)=>t.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function z(e,t,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${t}`);return n&&(t=n),t=e.normalize(t),(await e.hash(t+"#"+r)).substring(0,8)}async function Xo(e){return(await e.hash(e.getAppRootDir())).substring(0,8)}function Jt(e){return typeof e=="number"}function Pt(e){return typeof e=="boolean"}function ce(e){return typeof e=="string"}function Tt(e){return typeof e=="string"?/^[A-Z][A-Za-z0-9]*$/.test(e):!1}function ge(e){return JSON.parse(JSON.stringify(e))}function Pn(e,t,r){for(let n of t)if(e.dirname(r).includes(n))return!0;return!1}function Zo(){try{let e=(0,Yo.default)();if(e?.name)return e.name}catch{}return"npm"}function Tu(){return process.platform.startsWith("win")}function Be(){return Tu()?'"@builder.io/dev-tools"':"builder.io"}function he(e){let t=e.join(e.getAppRootDir(),"tsconfig.json");return e.exists(t)}var Iu=["node_modules","dist","build","public"];async function Fe(e,t){async function r(i,a){if(a>10)return;let o=await e.readdir(i);for(let s of o){if(Iu.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 r(u,a+1);if(c)return c}}}}let n=await r(e.getAppRootDir(),0);if(!n){let a=`builder-registry.${await he(e)?"ts":"js"}`;return e.join(t,a)}return n}async function Ht(e,t){let r=e.resolve("/");for(let n=0;n<20;n++){let i=e.join(t,"package.json"),a=await e.readFile(i);if(a)return JSON.parse(a);if(t===r)break;t=e.dirname(t)}return null}async function ei(e,t){for(let r=0;r<20;r++){let n=e.dirname(t),i=e.join(n,"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 Gt(e,t,r){let n=await e.readdir(t);return n.includes(r)?e.join(t,r):(await Promise.all(n.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 Gt(e,o,r);if(u)return u}}))).find(a=>typeof a=="string")}async function ee(e,t,r){if(!Array.isArray(t)||t.length===0)throw new Error(`createTsProgram() Invalid filePaths: ${t}`);let n=await ei(e,t[0]),i=e.join(n,"typescript","lib"),a=new Map,o={fileExists:s=>{if(s=e.normalize(s),s.includes("node_modules")){let u=Qt.get(s);if(!u){try{e.statSync(s).isFile()?u={exists:!0,content:e.readFileSync(s)}:u={exists:!1}}catch{u={exists:!1}}Qt.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=Qt.get(s);if(l)return N(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=ni.get(l),u==null&&typeof self<"u"&&typeof fetch=="function"))throw new In(l)}return s.includes("node_modules")&&(u?Qt.set(s,{exists:!0,content:u}):Qt.set(s,{exists:!1})),N(e,u)},readFile:s=>{let u=e.readFileSync(s);return typeof u=="string"?u:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return Bu(e,o,t,r)}catch(s){if(s instanceof In){await Ru(e,s.libName);continue}throw console.error("createTsProgram",s),new Error(`createTsProgram() Could not create program for: ${t[0]}`)}}function Bu(e,t,r,n){let i={rootNames:[...r],options:{},host:t},a=e.ts.findConfigFile(e.dirname(r[0]),o=>e.existsSync(o));if(a){let o=ti.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,ti.set(a,o))}o&&(i.options=ge(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,n),e.ts.createProgram(i)}async function It(e,t,r){r||(r=await ee(e,[t]));let n=r.getSourceFile(t);if(!n)throw new Error(`getTypeChecker() Could not find source file: ${t}`);return{typeChecker:r.getTypeChecker(),sourceFile:n}}var In=class{constructor(t){this.libName=t}};async function Ru(e,t){let r=`https://cdn.jsdelivr.net/npm/typescript@${e.ts.version}/lib/${t}`;Tn.has(t)||Tn.set(t,fetch(r).then(n=>n.text()).then(n=>{ni.set(t,n)})),await Tn.get(t),Tn.delete(t)}var ni=new Map,Tn=new Map,Qt=new Map,ti=new Map;async function ri(e,t){let r=await e.readFile(t.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${t.filePath}`}],code:null,output:null}:Er(e,{code:r,filePath:t.filePath,compilerOptions:t.compilerOptions})}function Er(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 Re=require("node:fs/promises");var yr=require("node:os"),Sr=T(require("node:path"),1),ku=T(require("prettier"),1),$u=T(require("typescript"),1),Lu=T(require("launch-editor"),1);async function Bt(e){let t=[],r=await Ht(e,e.getRepoRootDir());if(r){let n=await ii(r,e);t.push(...n)}return t}async function ii(e,t){let r=[];if(e&&typeof e=="object"){let n=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let i of Nu)if(n.has(i)&&!r.some(a=>a.name===i)){let a={name:i};oi.has(i)&&(a.version=await oi.get(i)(t)),r.push(a)}}return r}function Fr(e){let t=parseInt(e);return Number.isNaN(t)?void 0:t}var oi=new Map([["next",async e=>{if(!e.spawnSync)return;let t=Zo(),r=t==="npm"?"npx":t,{stdout:n}=e.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let i=n.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:Fr(o),minor:Fr(s),patch:Fr(u)}}]]),Nu=["@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 $f=T(require("@sentry/node"),1);function ai(){let e=(0,yr.homedir)();return Sr.default.join(e,".config","builder","dev-tools.json")}function vr(e,t){return typeof e=="object"&&e!=null&&t in e}async function Rt(){let e=ai();try{let t=await(0,Re.readFile)(e,"utf-8");if(typeof t=="string")return JSON.parse(t)}catch(t){if(t.code==="ENOENT")return null}return null}async function wr(e){let t=ai();e=typeof e=="object"&&e!=null?e:{},await(0,Re.mkdir)(Sr.default.dirname(t),{recursive:!0}),await(0,Re.writeFile)(t,JSON.stringify(e??{},null,2))}var b={gen1:"Gen 1",gen2:"Gen 2"},Yt={CMS:"cms",VCP:"vcp",HYBRID:"hybrid"};var si=require("node:console"),ui=require("node:http"),li=require("node:https");function Nt(e){let t=Date.now();return new Promise((r,n)=>{let a=Ou(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,si.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(s))}catch(u){n(`Response from ${e.url.href} is not valid JSON: ${s}
18
- ${u}`)}else n(`Request to ${e.url.href} failed with status ${o.statusCode}: ${s}`)})}).on("error",o=>{n(`Error fetching ${e.url.href}, ${o}`)});e.body&&(a.setHeader("Content-Type","application/json"),a.write(e.body)),a.end()})}function Ou(e){if(e.protocol==="https:")return li.request;if(e.protocol==="http:")return ui.request;throw new Error(`Unsupported protocol ${e.protocol}`)}async function ci(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 Nt({url:t,method:"GET"}))[e.model]}async function pi(e,t){if(t.kind===Yt.VCP)return!0;let r=new URL("https://cdn.builder.io/api/v2/admin"),n={query:`query {
16
+ `}return""}var zo=I(Uo(),1);function he(e){return e.endsWith(".mapper.tsx")||e.endsWith(".mapper.jsx")||e.endsWith(".mapper.ts")||e.endsWith(".mapper.js")||e.endsWith(".mapper.mjs")}function L(e,t,r){t=Te(t),r=Te(r),t=e.dirname(t);let n=e.basename(r,e.extname(r));r=e.dirname(r);let i;return n==="index"?i=e.relative(t,r):i=e.relative(t,e.join(r,n)),i=Te(e.normalize(i)),i.startsWith(".")||(i="./"+i),i}function Te(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}function xt(e,t){let r=e.extname(t),n=e.basename(t,r).split(/[\/\\]/),i=n[n.length-1];return Ko(i==="index"?e.basename(e.dirname(t)):i)}function Ko(e){return q(e).replace(/ /g,"")}function ye(e,t){let r=e.extname(t),n=Te(e.basename(t,r)).split("/").pop();return q(n==="index"?e.basename(e.dirname(t)):n)}function K(e,t){let r=Te(e.relative(e.getAppRootDir(),t));r=r.split("/").filter(i=>i!=="."&&i!==".."&&i!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=e.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(i=>i.name.includes("next"))?"@/"+r:"~/"+r}function j(e,t){let r=t,n=[];for(let i=0;i<2;i++){let a=e.basename(r);if(!a||a==="components")break;n.unshift(a),r=e.dirname(r)}return n.join("/")}function q(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 De(e){return e.sort((t,r)=>t.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function z(e,t,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${t}`);return n&&(t=n),t=e.normalize(t),(await e.hash(t+"#"+r)).substring(0,8)}async function qo(e){return(await e.hash(e.getAppRootDir())).substring(0,8)}function Ht(e){return typeof e=="number"}function Tt(e){return typeof e=="boolean"}function fe(e){return typeof e=="string"}function It(e){return typeof e=="string"?/^[A-Z][A-Za-z0-9]*$/.test(e):!1}function Ce(e){return JSON.parse(JSON.stringify(e))}function Pn(e,t,r){for(let n of t)if(e.dirname(r).includes(n))return!0;return!1}function Wo(){try{let e=(0,zo.default)();if(e?.name)return e.name}catch{}return"npm"}function Eu(){return process.platform.startsWith("win")}function ke(){return Eu()?'"@builder.io/dev-tools"':"builder.io"}function xe(e){let t=e.join(e.getAppRootDir(),"tsconfig.json");return e.exists(t)}var Fu=["node_modules","dist","build","public"];async function Se(e,t){async function r(i,a){if(a>10)return;let o=await e.readdir(i);for(let s of o){if(Fu.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 r(u,a+1);if(c)return c}}}}let n=await r(e.getAppRootDir(),0);if(!n){let a=`builder-registry.${await xe(e)?"ts":"js"}`;return e.join(t,a)}return n}async function Qt(e,t){let r=e.resolve("/");for(let n=0;n<20;n++){let i=e.join(t,"package.json"),a=await e.readFile(i);if(a)return JSON.parse(a);if(t===r)break;t=e.dirname(t)}return null}async function Jo(e,t){for(let r=0;r<20;r++){let n=e.dirname(t),i=e.join(n,"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 Yt(e,t,r){let n=await e.readdir(t);return n.includes(r)?e.join(t,r):(await Promise.all(n.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 Yt(e,o,r);if(u)return u}}))).find(a=>typeof a=="string")}async function ee(e,t,r){if(!Array.isArray(t)||t.length===0)throw new Error(`createTsProgram() Invalid filePaths: ${t}`);let n=await Jo(e,t[0]),i=e.join(n,"typescript","lib"),a=new Map,o={fileExists:s=>{if(s=e.normalize(s),s.includes("node_modules")){let u=Xt.get(s);if(!u){try{e.statSync(s).isFile()?u={exists:!0,content:e.readFileSync(s)}:u={exists:!1}}catch{u={exists:!1}}Xt.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=Xt.get(s);if(l)return N(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=Ho.get(l),u==null&&typeof self<"u"&&typeof fetch=="function"))throw new In(l)}return s.includes("node_modules")&&(u?Xt.set(s,{exists:!0,content:u}):Xt.set(s,{exists:!1})),N(e,u)},readFile:s=>{let u=e.readFileSync(s);return typeof u=="string"?u:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return yu(e,o,t,r)}catch(s){if(s instanceof In){await Su(e,s.libName);continue}throw e.Sentry?.captureException(s),new Error(`createTsProgram() Could not create program for: ${t[0]}`,{cause:s})}}function yu(e,t,r,n){let i={rootNames:[...r],options:{},host:t},a=e.ts.findConfigFile(e.dirname(r[0]),o=>e.existsSync(o));if(a){let o=Go.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?e.Sentry?.captureException(new Error("Error reading tsconfig for createTsProgram"),{extra:{error:s.error,tsConfigPath:a}}):(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,Go.set(a,o))}o&&(i.options=Ce(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,n),e.ts.createProgram(i)}async function Bt(e,t,r){r||(r=await ee(e,[t]));let n=r.getSourceFile(t);if(!n)throw new Error(`getTypeChecker() Could not find source file: ${t}`);return{typeChecker:r.getTypeChecker(),sourceFile:n}}var In=class{constructor(t){this.libName=t}};async function Su(e,t){let r=`https://cdn.jsdelivr.net/npm/typescript@${e.ts.version}/lib/${t}`;Tn.has(t)||Tn.set(t,fetch(r).then(n=>n.text()).then(n=>{Ho.set(t,n)})),await Tn.get(t),Tn.delete(t)}var Ho=new Map,Tn=new Map,Xt=new Map,Go=new Map;async function Qo(e,t){let r=await e.readFile(t.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${t.filePath}`}],code:null,output:null}:gr(e,{code:r,filePath:t.filePath,compilerOptions:t.compilerOptions})}function gr(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 $e=require("fs/promises");var Cr=require("os"),xr=I(require("path"),1),wu=I(require("prettier"),1),bu=I(require("typescript"),1),Au=I(require("launch-editor"),1);async function Rt(e){let t=[],r=await Qt(e,e.getRepoRootDir());if(r){let n=await Xo(r,e);t.push(...n)}return t}async function Xo(e,t){let r=[];if(e&&typeof e=="object"){let n=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let i of vu)if(n.has(i)&&!r.some(a=>a.name===i)){let a={name:i};Yo.has(i)&&(a.version=await Yo.get(i)(t)),r.push(a)}}return r}function hr(e){let t=parseInt(e);return Number.isNaN(t)?void 0:t}var Yo=new Map([["next",async e=>{if(!e.spawnSync)return;let t=Wo(),r=t==="npm"?"npx":t,{stdout:n}=e.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let i=n.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:hr(o),minor:hr(s),patch:hr(u)}}]]),vu=["@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 Pu=I(require("@sentry/node"),1);function Zo(){let e=(0,Cr.homedir)();return xr.default.join(e,".config","builder","dev-tools.json")}function Er(e,t){return typeof e=="object"&&e!=null&&t in e}async function Nt(){let e=Zo();try{let t=await(0,$e.readFile)(e,"utf-8");if(typeof t=="string")return JSON.parse(t)}catch(t){if(t.code==="ENOENT")return null}return null}async function Fr(e){let t=Zo();e=typeof e=="object"&&e!=null?e:{},await(0,$e.mkdir)(xr.default.dirname(t),{recursive:!0}),await(0,$e.writeFile)(t,JSON.stringify(e??{},null,2))}var A={gen1:"Gen 1",gen2:"Gen 2"},Zt={CMS:"cms",VCP:"vcp",HYBRID:"hybrid"};var ei=require("console"),ti=require("http"),ni=require("https");function kt(e){let t=Date.now();return new Promise((r,n)=>{let a=Tu(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,ei.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(s))}catch(u){n(`Response from ${e.url.href} is not valid JSON: ${s}
18
+ ${u}`)}else n(`Request to ${e.url.href} failed with status ${o.statusCode}: ${s}`)})}).on("error",o=>{n(`Error fetching ${e.url.href}, ${o}`)});e.body&&(a.setHeader("Content-Type","application/json"),a.write(e.body)),a.end()})}function Tu(e){if(e.protocol==="https:")return ni.request;if(e.protocol==="http:")return ti.request;throw new Error(`Unsupported protocol ${e.protocol}`)}async function ri(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 kt({url:t,method:"GET"}))[e.model]}async function oi(e,t){if(t.kind===Zt.VCP)return!0;let r=new URL("https://cdn.builder.io/api/v2/admin"),n={query:`query {
19
19
  models {
20
20
  id
21
21
  name
22
22
  }
23
- }`};e.debug(`Get model id for model name "${t.model}"`);let a=(await Nt({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)})).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 Nt({url:o,method:"GET"});return e.debug(`Data results (${s.results.length}): ${o.href}`),s.results.length>0}async function mi(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 Nt({url:r,method:"GET"});return e.debug(`get content results: ${n.results.length}`),n}async function fi(e,t){let r=new URL(`https://cdn.builder.io/api/v1/write/${t.model}`);e.debug(`writing "${t.model}" content:`,r.href),await Nt({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`},body:t.body})}var kt="page",di="integration-welcome-screens",Di="8d9ee72a33344b4b867918b442ebd0af";async function gi(e,t){let r=await mi(e,{model:di,publicApiKey:Di,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=_u(t.publicApiKey,t.pathname,t.title,n);await fi(e,{privateAuthKey:t.privateAuthKey,model:kt,body:i})}function _u(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 hi(e,t,r,n){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: ${kt}, path: ${o.pathname}, template: ${o.templateContentId}`);let s=await pi(e,{model:kt,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:r,kind:n});if(!s){await gi(e,{templateContentId:o.templateContentId,pathname:o.pathname,title:o.title,publicApiKey:t,privateAuthKey:r});let c=5,p=0;for(;!s&&p<c;){await new Promise(h=>setTimeout(h,1e3));let f=await ci({model:kt,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:r});p++,f&&f.length>0&&(s=!0)}}await i,e.debug("ensure builder setup");let u=[];n===Yt.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:n};return n===Yt.VCP&&(l.pathname="/"),e.debug(`connected builder: ${l.pathname}`),l}async function Ci(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 xi(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 hi(e,t.data.publicApiKey,t.data.privateAuthKey,t.data.kind);break}case"enableDevTools":{r.data=Vu(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 Ci(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":{Ar(e,t.path)?r.data=await e.readdir(t.path,!0):r.errors=[`Invalid file request: ${t.path}`];break}case"readFile":{Ar(e,t.path)?r.data=await e.readFile(t.path):r.errors=[`Invalid file request: ${t.path}`];break}case"writeFile":{Ar(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 ri(e,t);break}case"transileModule":{r.data=Er(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 Rt();break}default:{r.errors=[`Unknown request type: ${JSON.stringify(t)}`];let n=t}}return r}function Ar(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],!ju.includes(i)))return!1}return Mu(e,t),!1}function Mu(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 ju=[".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 Vu(e,t){return!t&&e.serverShouldRestart&&setTimeout(()=>{console.log(`
23
+ }`};e.debug(`Get model id for model name "${t.model}"`);let a=(await kt({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)})).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 kt({url:o,method:"GET"});return e.debug(`Data results (${s.results.length}): ${o.href}`),s.results.length>0}async function ii(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 kt({url:r,method:"GET"});return e.debug(`get content results: ${n.results.length}`),n}async function ai(e,t){let r=new URL(`https://cdn.builder.io/api/v1/write/${t.model}`);e.debug(`writing "${t.model}" content:`,r.href),await kt({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`},body:t.body})}var $t="page",si="integration-welcome-screens",ui="8d9ee72a33344b4b867918b442ebd0af";async function li(e,t){let r=await ii(e,{model:si,publicApiKey:ui,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=Iu(t.publicApiKey,t.pathname,t.title,n);await ai(e,{privateAuthKey:t.privateAuthKey,model:$t,body:i})}function Iu(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 ci(e,t,r,n){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: ${$t}, path: ${o.pathname}, template: ${o.templateContentId}`);let s=await oi(e,{model:$t,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:r,kind:n});if(!s){await li(e,{templateContentId:o.templateContentId,pathname:o.pathname,title:o.title,publicApiKey:t,privateAuthKey:r});let c=5,p=0;for(;!s&&p<c;){await new Promise(h=>setTimeout(h,1e3));let f=await ri({model:$t,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:r});p++,f&&f.length>0&&(s=!0)}}await i,e.debug("ensure builder setup");let u=[];n===Zt.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:n};return n===Zt.VCP&&(l.pathname="/"),e.debug(`connected builder: ${l.pathname}`),l}async function pi(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 mi(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 ci(e,t.data.publicApiKey,t.data.privateAuthKey,t.data.kind);break}case"enableDevTools":{r.data=Nu(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 pi(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":{yr(e,t.path)?r.data=await e.readdir(t.path,!0):r.errors=[`Invalid file request: ${t.path}`];break}case"readFile":{yr(e,t.path)?r.data=await e.readFile(t.path):r.errors=[`Invalid file request: ${t.path}`];break}case"writeFile":{yr(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 Qo(e,t);break}case"transileModule":{r.data=gr(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 Nt();break}default:{r.errors=[`Unknown request type: ${JSON.stringify(t)}`];let n=t}}return r}function yr(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],!Ru.includes(i)))return!1}return Bu(e,t),!1}function Bu(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 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(`
24
24
  Restarting server after Builder Devtools update...
25
- `),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function Ei(e){return yi(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:
25
+ `),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function fi(e){return Di(e,`"use strict";(()=>{var Ns=Object.defineProperty;var Ms=(e,t)=>{for(var r in t)Ns(e,r,{get:t[r],enumerable:!0})};var ue=(e,t)=>{Xr(e);let r=e.querySelector("aside");r.dataset.view=t,r.classList.remove("section-ready"),setTimeout(()=>{r.classList.add("section-ready")},200)},bo=e=>{Array.from(e.querySelectorAll(".back-button")).forEach(t=>{t.addEventListener("click",r=>{Xr(e),r.preventDefault(),r.stopPropagation();let n=r.target;ue(e,n?.dataset.back||"nav-home")})})},Yr=(e,t)=>{Xr(e);let r=e.querySelector("aside"),n=document.createElement("div");n.className="ui-toast",n.innerHTML=t,r.appendChild(n),setTimeout(()=>{n.classList.add("ui-toast-show"),setTimeout(()=>{n.classList.remove("ui-toast-show"),setTimeout(()=>{n.remove()},500)},4e3)},30)},Xr=e=>{let t=e.querySelector("aside");Array.from(t.querySelectorAll(".ui-toast")).forEach(n=>{n.classList.remove("ui-toast-show")})},_t=()=>{let e=xo();return localStorage.getItem(e)!=="true"},Qr=e=>{let t=xo();e?localStorage.removeItem(t):localStorage.setItem(t,"true")},xo=()=>Fs("disableEdit"),Fs=e=>\`builder.__LOCAL_APP_ID__.\${e}\`,Io=()=>{let t=document.body.querySelector("[builder-content-id]")?.getAttribute("builder-content-id");return Qe(t)},Qe=(e,t)=>{let r="/content";e&&(r+="/"+e+"/edit");let n=new URL(r,"https://builder.io");e&&t&&n.searchParams.set("selectedBlock",t);let o=new URL(location.pathname,location.href);return n.searchParams.set("overridePreviewUrl",o.href),n.href},Tt="__DEV_TOOLS_URL__",j={components:[],registryPath:"",registryDisplayPath:"",frameworks:[],dependencies:[],publicApiKey:void 0,devToolsVersion:""},me=e=>{j.components=e.components,j.registryPath=e.registryPath,j.registryDisplayPath=e.registryDisplayPath,j.dependencies=e.dependencies,j.publicApiKey=e.publicApiKey};function So(e){let t=null,r=document.querySelector("builder-dev-tools-menu"),n=()=>{e.hide()},o=u=>{let s=u.target;if(!s){n();return}if(s.closest("builder-dev-tools-edit"))return;let c=s.closest("[builder-content-id]"),l=s.closest("[builder-id]");if(!c||!l){e.hide();return}let f=e.show(c,l);!f||f===t||(r.highlightOpener(),t=f)};document.addEventListener("pointerover",o,{passive:!0}),document.addEventListener("pointerleave",n,{passive:!0}),document.addEventListener("pointercancel",n,{passive:!0}),document.addEventListener("visibilitychange",n,{passive:!0}),window.addEventListener("popstate",n,{passive:!0});let i=history.pushState;history.pushState=function(...u){e.hide(),i.apply(this,u)};let a=history.replaceState;history.replaceState=function(...u){e.hide(),a.apply(this,u)}}var bt=class extends HTMLElement{openInBuilder=null;block=null;constructor(){super()}connectedCallback(){this.setAttribute("aria-hidden","true");let t=this.attachShadow({mode:"open"});t.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=t.getElementById("open-in-builder"),this.block=t.getElementById("block"),So(this)}show(t,r){if(!_t())return this.hide(),null;let n=t.getAttribute("builder-content-id"),o=r.getAttribute("builder-id");if(!n||!o)return this.hide(),null;let i=this.block,a=this.openInBuilder,u=r.getBoundingClientRect();i.style.top=u.top+window.scrollY-1+"px",i.style.left=u.left+window.scrollX+"px",i.style.width=u.width+"px",i.style.height=u.height+1+"px";let s=a.getBoundingClientRect();if(s.width>u.width){let c=s.width-u.width;a.style.left=c/2*-1+"px"}else a.style.left="";return a.href=Qe(n,o),this.style.display="block",o}hide(){this.style.display=""}};var Lo="preview-url";var wo="_b-uid";var Ao="/~builder-connect";var Co="/~builder-dev-tools";var Po="https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";var Ro=()=>ce({type:"validateBuilder"}),Ue=e=>ce({type:"launchEditor",data:e}),Do=e=>ce({type:"getRegistry",data:e}),Oo=e=>ce({type:"loadComponent",data:e}),ko=e=>ce({type:"registerComponent",data:e}),Uo=e=>ce({type:"setComponentInfo",data:e}),xt=e=>ce({type:"setComponentInput",data:e}),No=e=>ce({type:"unregisterComponent",data:e}),Mo=e=>ce({type:"enableDevTools",data:{enabled:e}}),Fo=()=>ce({type:"localConfig"}),ce=async e=>{let t=new URL(Co,Tt),r;try{r=await fetch(t,{method:"POST",body:JSON.stringify(e)})}catch(o){throw console.error(\`Devtools Fetch Error, \${t.href}\`,o),new Error("Builder Devtools Fetch Error")}if((r.headers.get("content-type")||"").includes("application/json")){let o=await r.json();if(r.ok)return o.data;if(Array.isArray(o.errors)&&o.errors.length>0)throw o.errors.forEach(i=>console.error(i)),new Error(\`Builder Devtools Fetch Error: \${o.errors[0]}\`)}throw new Error(\`Builder Devtools Fetch Error: \${r.status}, \${await r.text()}\`)};var Vo=[{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"}],It=["color","date","email","file","longText","richText","string"],St=["number"],Lt=["boolean"],wt=["list"],At=["object"];function Ct(e){return It.includes(e)?"string":St.includes(e)?"number":Lt.includes(e)?"boolean":wt.includes(e)?"array":At.includes(e)?"object":"string"}var Qc=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()));var zr=function(e,t){return zr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},zr(e,t)};function k(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");zr(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var b=function(){return b=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},b.apply(this,arguments)};function ze(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function y(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function u(l){try{c(n.next(l))}catch(f){a(f)}}function s(l){try{c(n.throw(l))}catch(f){a(f)}}function c(l){l.done?i(l.value):o(l.value).then(u,s)}c((n=n.apply(e,t||[])).next())})}function h(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function O(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function I(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Se(e){return this instanceof Se?(this.v=e,this):new Se(e)}function Bo(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,f)}}function u(p,m){n[p]&&(o[p]=function(E){return new Promise(function(x,g){i.push([p,E,x,g])>1||s(p,E)})},m&&(o[p]=m(o[p])))}function s(p,m){try{c(n[p](m))}catch(E){d(i[0][3],E)}}function c(p){p.value instanceof Se?Promise.resolve(p.value.v).then(l,f):d(i[0][2],p)}function l(p){s("next",p)}function f(p){s("throw",p)}function d(p,m){p(m),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Ho(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof O=="function"?O(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(u,s){a=e[i](a),o(u,s,a.done,a.value)})}}function o(i,a,u,s){Promise.resolve(s).then(function(c){i({value:c,done:u})},a)}}var Go="Event tracked successfully",qo="Unexpected error occurred",jo="Event rejected due to exceeded retry count",Wo="Event skipped due to optOut config",Ko="Event rejected due to missing API key",$o="Invalid API key",Yo="Client not initialized";var M;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"})(M||(M={}));var ve=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=M.Unknown),{event:e,code:t,message:r}};var re=function(e){return e?(e^Math.random()*16>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,re)};var Xo=function(){function e(t){this.client=t,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(t,r){var n,o;return y(this,void 0,void 0,function(){return h(this,function(i){switch(i.label){case 0:return this.plugins.some(function(a){return a.name===t.name})?(r.loggerProvider.warn("Plugin with name ".concat(t.name," already exists, skipping registration")),[2]):(t.name===void 0&&(t.name=re(),r.loggerProvider.warn(\`Plugin name is undefined.
26
+ Generating a random UUID for plugin name: \`.concat(t.name,\`.
27
+ Set a name for the plugin to prevent it from being added multiple times.\`))),t.type=(n=t.type)!==null&&n!==void 0?n:"enrichment",[4,(o=t.setup)===null||o===void 0?void 0:o.call(t,r,this.client)]);case 1:return i.sent(),this.plugins.push(t),[2]}})})},e.prototype.deregister=function(t,r){var n;return y(this,void 0,void 0,function(){var o,i;return h(this,function(a){switch(a.label){case 0:return o=this.plugins.findIndex(function(u){return u.name===t}),o===-1?(r.loggerProvider.warn("Plugin with name ".concat(t," does not exist, skipping deregistration")),[2]):(i=this.plugins[o],this.plugins.splice(o,1),[4,(n=i.teardown)===null||n===void 0?void 0:n.call(i)]);case 1:return a.sent(),[2]}})})},e.prototype.reset=function(t){this.applying=!1;var r=this.plugins;r.map(function(n){var o;return(o=n.teardown)===null||o===void 0?void 0:o.call(n)}),this.plugins=[],this.client=t},e.prototype.push=function(t){var r=this;return new Promise(function(n){r.queue.push([t,n]),r.scheduleApply(0)})},e.prototype.scheduleApply=function(t){var r=this;this.applying||(this.applying=!0,setTimeout(function(){r.apply(r.queue.shift()).then(function(){r.applying=!1,r.queue.length>0&&r.scheduleApply(0)})},t))},e.prototype.apply=function(t){return y(this,void 0,void 0,function(){var r,n,o,i,a,u,s,p,m,c,l,f,d,p,m,E,x,g,v,_,T,A;return h(this,function(S){switch(S.label){case 0:if(!t)return[2];r=I(t,1),n=r[0],o=I(t,2),i=o[1],a=this.plugins.filter(function(L){return L.type==="before"}),S.label=1;case 1:S.trys.push([1,6,7,8]),u=O(a),s=u.next(),S.label=2;case 2:return s.done?[3,5]:(p=s.value,p.execute?[4,p.execute(b({},n))]:[3,4]);case 3:if(m=S.sent(),m===null)return i({event:n,code:0,message:""}),[2];n=m,S.label=4;case 4:return s=u.next(),[3,2];case 5:return[3,8];case 6:return c=S.sent(),v={error:c},[3,8];case 7:try{s&&!s.done&&(_=u.return)&&_.call(u)}finally{if(v)throw v.error}return[7];case 8:l=this.plugins.filter(function(L){return L.type==="enrichment"||L.type===void 0}),S.label=9;case 9:S.trys.push([9,14,15,16]),f=O(l),d=f.next(),S.label=10;case 10:return d.done?[3,13]:(p=d.value,p.execute?[4,p.execute(b({},n))]:[3,12]);case 11:if(m=S.sent(),m===null)return i({event:n,code:0,message:""}),[2];n=m,S.label=12;case 12:return d=f.next(),[3,10];case 13:return[3,16];case 14:return E=S.sent(),T={error:E},[3,16];case 15:try{d&&!d.done&&(A=f.return)&&A.call(f)}finally{if(T)throw T.error}return[7];case 16:return x=this.plugins.filter(function(L){return L.type==="destination"}),g=x.map(function(L){var w=b({},n);return L.execute(w).catch(function(R){return ve(w,0,String(R))})}),Promise.all(g).then(function(L){var w=I(L,1),R=w[0],Z=R||ve(n,100,"Event not tracked, no destination plugins on the instance");i(Z)}),[2]}})})},e.prototype.flush=function(){return y(this,void 0,void 0,function(){var t,r,n,o=this;return h(this,function(i){switch(i.label){case 0:return t=this.queue,this.queue=[],[4,Promise.all(t.map(function(a){return o.apply(a)}))];case 1:return i.sent(),r=this.plugins.filter(function(a){return a.type==="destination"}),n=r.map(function(a){return a.flush&&a.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e}();var Zr="-",Ne="AMP",Qo="".concat(Ne,"_unsent"),Jr="https://api2.amplitude.com/2/httpapi",zo="https://api.eu.amplitude.com/2/httpapi",Zo="https://api2.amplitude.com/batch",Jo="https://api.eu.amplitude.com/batch";var Vs=1e3,Pt=function(e){if(Object.keys(e).length>Vs)return!1;for(var t in e){var r=e[t];if(!en(t,r))return!1}return!0},en=function(e,t){var r,n;if(typeof e!="string")return!1;if(Array.isArray(t)){var o=!0;try{for(var i=O(t),a=i.next();!a.done;a=i.next()){var u=a.value;if(Array.isArray(u))return!1;if(typeof u=="object")o=o&&Pt(u);else if(!["number","string"].includes(typeof u))return!1;if(!o)return!1}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}else{if(t==null)return!1;if(typeof t=="object")return Pt(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0};var ae=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return b({},this._properties)},e.prototype.set=function(t,r){return this._safeSet(z.SET,t,r),this},e.prototype.setOnce=function(t,r){return this._safeSet(z.SET_ONCE,t,r),this},e.prototype.append=function(t,r){return this._safeSet(z.APPEND,t,r),this},e.prototype.prepend=function(t,r){return this._safeSet(z.PREPEND,t,r),this},e.prototype.postInsert=function(t,r){return this._safeSet(z.POSTINSERT,t,r),this},e.prototype.preInsert=function(t,r){return this._safeSet(z.PREINSERT,t,r),this},e.prototype.remove=function(t,r){return this._safeSet(z.REMOVE,t,r),this},e.prototype.add=function(t,r){return this._safeSet(z.ADD,t,r),this},e.prototype.unset=function(t){return this._safeSet(z.UNSET,t,Zr),this},e.prototype.clearAll=function(){return this._properties={},this._properties[z.CLEAR_ALL]=Zr,this},e.prototype._safeSet=function(t,r,n){if(this._validate(t,r,n)){var o=this._properties[t];return o===void 0&&(o={},this._properties[t]=o),o[r]=n,this._propertySet.add(r),!0}return!1},e.prototype._validate=function(t,r,n){return this._properties[z.CLEAR_ALL]!==void 0||this._propertySet.has(r)?!1:t===z.ADD?typeof n=="number":t!==z.UNSET&&t!==z.REMOVE?en(r,n):!0},e}();var z;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(z||(z={}));var ei;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(ei||(ei={}));var Le;(function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"})(Le||(Le={}));var ti=function(e,t,r){var n=typeof e=="string"?{event_type:e}:e;return b(b(b({},n),r),t&&{event_properties:t})},Ze=function(e,t){var r=b(b({},t),{event_type:Le.IDENTIFY,user_properties:e.getUserProperties()});return r},ri=function(e,t,r,n){var o,i=b(b({},n),{event_type:Le.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(o={},o[e]=t,o)});return i},ni=function(e,t,r){var n,o=new ae;o.set(e,t);var i=b(b({},r),{event_type:Le.IDENTIFY,user_properties:o.getUserProperties(),groups:(n={},n[e]=t,n)});return i},oi=function(e,t){return b(b({},t),{event_type:Le.REVENUE,event_properties:e.getEventProperties()})};var Y=function(e){return{promise:e||Promise.resolve()}};var tn=function(){function e(t){t===void 0&&(t="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Xo(this),this.name=t}return e.prototype._init=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){switch(r.label){case 0:return this.config=t,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return r.sent(),this.isReady=!0,[2]}})})},e.prototype.runQueuedFunctions=function(t){return y(this,void 0,void 0,function(){var r,n,o,i,a,u,s,c;return h(this,function(l){switch(l.label){case 0:r=this[t],this[t]=[],l.label=1;case 1:l.trys.push([1,8,9,10]),n=O(r),o=n.next(),l.label=2;case 2:return o.done?[3,7]:(i=o.value,a=i(),a&&"promise"in a?[4,a.promise]:[3,4]);case 3:return l.sent(),[3,6];case 4:return[4,a];case 5:l.sent(),l.label=6;case 6:return o=n.next(),[3,2];case 7:return[3,10];case 8:return u=l.sent(),s={error:u},[3,10];case 9:try{o&&!o.done&&(c=n.return)&&c.call(n)}finally{if(s)throw s.error}return[7];case 10:return this[t].length?[4,this.runQueuedFunctions(t)]:[3,12];case 11:l.sent(),l.label=12;case 12:return[2]}})})},e.prototype.track=function(t,r,n){var o=ti(t,r,n);return Y(this.dispatch(o))},e.prototype.identify=function(t,r){var n=Ze(t,r);return Y(this.dispatch(n))},e.prototype.groupIdentify=function(t,r,n,o){var i=ri(t,r,n,o);return Y(this.dispatch(i))},e.prototype.setGroup=function(t,r,n){var o=ni(t,r,n);return Y(this.dispatch(o))},e.prototype.revenue=function(t,r){var n=oi(t,r);return Y(this.dispatch(n))},e.prototype.add=function(t){return this.isReady?this._addPlugin(t):(this.q.push(this._addPlugin.bind(this,t)),Y())},e.prototype._addPlugin=function(t){return Y(this.timeline.register(t,this.config))},e.prototype.remove=function(t){return this.isReady?this._removePlugin(t):(this.q.push(this._removePlugin.bind(this,t)),Y())},e.prototype._removePlugin=function(t){return Y(this.timeline.deregister(t,this.config))},e.prototype.dispatchWithCallback=function(t,r){if(!this.isReady)return r(ve(t,0,Yo));this.process(t).then(r)},e.prototype.dispatch=function(t){return y(this,void 0,void 0,function(){var r=this;return h(this,function(n){return this.isReady?[2,this.process(t)]:[2,new Promise(function(o){r.dispatchQ.push(r.dispatchWithCallback.bind(r,t,o))})]})})},e.prototype.process=function(t){return y(this,void 0,void 0,function(){var o,r,n,o;return h(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,ve(t,0,Wo)]:[4,this.timeline.push(t)];case 1:return o=i.sent(),o.code===200?this.config.loggerProvider.log(o.message):o.code===100?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return r=i.sent(),n=String(r),this.config.loggerProvider.error(n),o=ve(t,0,n),[2,o];case 3:return[2]}})})},e.prototype.setOptOut=function(t){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!t));return}this._setOptOut(t)},e.prototype._setOptOut=function(t){this.config.optOut=!!t},e.prototype.flush=function(){return Y(this.timeline.flush())},e}();var Rt=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(t){return this.productId=t,this},e.prototype.setQuantity=function(t){return t>0&&(this.quantity=t),this},e.prototype.setPrice=function(t){return this.price=t,this},e.prototype.setRevenueType=function(t){return this.revenueType=t,this},e.prototype.setCurrency=function(t){return this.currency=t,this},e.prototype.setRevenue=function(t){return this.revenue=t,this},e.prototype.setReceipt=function(t){return this.receipt=t,this},e.prototype.setReceiptSig=function(t){return this.receiptSig=t,this},e.prototype.setEventProperties=function(t){return Pt(t)&&(this.properties=t),this},e.prototype.getEventProperties=function(){var t=this.properties?b({},this.properties):{};return t[le.REVENUE_PRODUCT_ID]=this.productId,t[le.REVENUE_QUANTITY]=this.quantity,t[le.REVENUE_PRICE]=this.price,t[le.REVENUE_TYPE]=this.revenueType,t[le.REVENUE_CURRENCY]=this.currency,t[le.REVENUE]=this.revenue,t[le.RECEIPT]=this.receipt,t[le.RECEIPT_SIG]=this.receiptSig,t},e}();var le;(function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"})(le||(le={}));var ii=function(e,t){var r=Math.max(t,1);return e.reduce(function(n,o,i){var a=Math.floor(i/r);return n[a]||(n[a]=[]),n[a].push(o),n},[])};var $;(function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"})($||($={}));var Dt="Amplitude Logger ",Je=function(){function e(){this.logLevel=$.None}return e.prototype.disable=function(){this.logLevel=$.None},e.prototype.enable=function(t){t===void 0&&(t=$.Warn),this.logLevel=t},e.prototype.log=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<$.Verbose||console.log("".concat(Dt,"[Log]: ").concat(t.join(" ")))},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<$.Warn||console.warn("".concat(Dt,"[Warn]: ").concat(t.join(" ")))},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<$.Error||console.error("".concat(Dt,"[Error]: ").concat(t.join(" ")))},e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<$.Debug||console.log("".concat(Dt,"[Debug]: ").concat(t.join(" ")))},e}();var Ot=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:$.Warn,loggerProvider:new Je,offline:!1,optOut:!1,serverUrl:Jr,serverZone:"US",useBatch:!1}},rn=function(){function e(t){var r,n,o,i;this._optOut=!1;var a=Ot();this.apiKey=t.apiKey,this.flushIntervalMillis=(r=t.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis,this.flushMaxRetries=t.flushMaxRetries||a.flushMaxRetries,this.flushQueueSize=t.flushQueueSize||a.flushQueueSize,this.instanceName=t.instanceName||a.instanceName,this.loggerProvider=t.loggerProvider||a.loggerProvider,this.logLevel=(n=t.logLevel)!==null&&n!==void 0?n:a.logLevel,this.minIdLength=t.minIdLength,this.plan=t.plan,this.ingestionMetadata=t.ingestionMetadata,this.offline=t.offline!==void 0?t.offline:a.offline,this.optOut=(o=t.optOut)!==null&&o!==void 0?o:a.optOut,this.serverUrl=t.serverUrl,this.serverZone=t.serverZone||a.serverZone,this.storageProvider=t.storageProvider,this.transportProvider=t.transportProvider,this.useBatch=(i=t.useBatch)!==null&&i!==void 0?i:a.useBatch,this.loggerProvider.enable(this.logLevel);var u=nn(t.serverUrl,t.serverZone,t.useBatch);this.serverZone=u.serverZone,this.serverUrl=u.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(t){this._optOut=t},enumerable:!1,configurable:!0}),e}();var Bs=function(e,t){return e==="EU"?t?Jo:zo:t?Zo:Jr},nn=function(e,t,r){if(e===void 0&&(e=""),t===void 0&&(t=Ot().serverZone),r===void 0&&(r=Ot().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=["US","EU"].includes(t)?t:Ot().serverZone;return{serverZone:n,serverUrl:Bs(n,r)}},et=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(t,r){this.sdk.metrics.histogram[t]=r},e}();function Hs(e){return e instanceof Error?e.message:String(e)}function kt(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch{}return t}var on=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[]}return e.prototype.setup=function(t){var r;return y(this,void 0,void 0,function(){var n,o=this;return h(this,function(i){switch(i.label){case 0:return this.config=t,this.storageKey="".concat(Qo,"_").concat(this.config.apiKey.substring(0,10)),[4,(r=this.config.storageProvider)===null||r===void 0?void 0:r.get(this.storageKey)];case 1:return n=i.sent(),n&&n.length>0&&Promise.all(n.map(function(a){return o.execute(a)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(t){var r=this;return t.insert_id||(t.insert_id=re()),new Promise(function(n){var o={event:t,attempts:0,callback:function(i){return n(i)},timeout:0};r.queue.push(o),r.schedule(r.config.flushIntervalMillis),r.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(t){var r=this;return t.filter(function(n){return n.attempts+=1,n.attempts<r.config.flushMaxRetries?!0:(r.fulfillRequest([n],500,jo),!1)})},e.prototype.scheduleEvents=function(t){var r=this;t.forEach(function(n){r.schedule(n.timeout===0?r.config.flushIntervalMillis:n.timeout)})},e.prototype.schedule=function(t){var r=this;if(!this.config.offline&&(this.scheduleId===null||this.scheduleId&&t>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=t,this.scheduleId=setTimeout(function(){r.queue=r.queue.map(function(n){return n.timeout=0,n}),r.flush(!0)},t);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,n,o,i=this;return h(this,function(a){switch(a.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),r=[],n=[],this.queue.forEach(function(u){return u.timeout===0?r.push(u):n.push(u)}),o=ii(r,this.config.flushQueueSize),[4,o.reduce(function(u,s){return y(i,void 0,void 0,function(){return h(this,function(c){switch(c.label){case 0:return[4,u];case 1:return c.sent(),[4,this.send(s,t)];case 2:return[2,c.sent()]}})})},Promise.resolve())]);case 1:return a.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(t,r){return r===void 0&&(r=!0),y(this,void 0,void 0,function(){var n,o,i,a,u;return h(this,function(s){switch(s.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(t,400,Ko)];n={api_key:this.config.apiKey,events:t.map(function(c){var l=c.event,f=l.extra,d=ze(l,["extra"]);return d}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new et,s.label=1;case 1:return s.trys.push([1,3,,4]),o=nn(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(o,n)];case 2:return i=s.sent(),i===null?(this.fulfillRequest(t,0,qo),[2]):r?(this.handleResponse(i,t),[3,4]):("body"in i?this.fulfillRequest(t,i.statusCode,"".concat(i.status,": ").concat(kt(i))):this.fulfillRequest(t,i.statusCode,i.status),[2]);case 3:return a=s.sent(),u=Hs(a),this.config.loggerProvider.error(u),this.handleResponse({status:M.Failed,statusCode:0},t),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(t,r){var n=t.status;switch(n){case M.Success:{this.handleSuccessResponse(t,r);break}case M.Invalid:{this.handleInvalidResponse(t,r);break}case M.PayloadTooLarge:{this.handlePayloadTooLargeResponse(t,r);break}case M.RateLimit:{this.handleRateLimitResponse(t,r);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(n,"' provided for ").concat(r.length,' events"}')),this.handleOtherResponse(r);break}}},e.prototype.handleSuccessResponse=function(t,r){this.fulfillRequest(r,t.statusCode,Go)},e.prototype.handleInvalidResponse=function(t,r){var n=this;if(t.body.missingField||t.body.error.startsWith($o)){this.fulfillRequest(r,t.statusCode,t.body.error);return}var o=D(D(D(D([],I(Object.values(t.body.eventsWithInvalidFields)),!1),I(Object.values(t.body.eventsWithMissingFields)),!1),I(Object.values(t.body.eventsWithInvalidIdLengths)),!1),I(t.body.silencedEvents),!1).flat(),i=new Set(o),a=r.filter(function(s,c){if(i.has(c)){n.fulfillRequest([s],t.statusCode,t.body.error);return}return!0});a.length>0&&this.config.loggerProvider.warn(kt(t));var u=this.removeEventsExceedFlushMaxRetries(a);this.scheduleEvents(u)},e.prototype.handlePayloadTooLargeResponse=function(t,r){if(r.length===1){this.fulfillRequest(r,t.statusCode,t.body.error);return}this.config.loggerProvider.warn(kt(t)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.handleRateLimitResponse=function(t,r){var n=this,o=Object.keys(t.body.exceededDailyQuotaUsers),i=Object.keys(t.body.exceededDailyQuotaDevices),a=t.body.throttledEvents,u=new Set(o),s=new Set(i),c=new Set(a),l=r.filter(function(d,p){if(d.event.user_id&&u.has(d.event.user_id)||d.event.device_id&&s.has(d.event.device_id)){n.fulfillRequest([d],t.statusCode,t.body.error);return}return c.has(p)&&(d.timeout=n.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(kt(t));var f=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(f)},e.prototype.handleOtherResponse=function(t){var r=this,n=t.map(function(i){return i.timeout=i.attempts*r.retryTimeout,i}),o=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(o)},e.prototype.fulfillRequest=function(t,r,n){this.removeEvents(t),t.forEach(function(o){return o.callback(ve(o.event,r,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var t=this.queue.map(function(r){return r.event});this.config.storageProvider.set(this.storageKey,t)}},e.prototype.removeEvents=function(t){this.queue=this.queue.filter(function(r){return!t.some(function(n){return n.event.insert_id===r.event.insert_id})}),this.saveEvents()},e}();var Gs=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:qs(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),qs=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},js=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(t){this.receiver?this.receiver(t):this.queue.length<512&&this.queue.push(t)},e.prototype.setEventReceiver=function(t){this.receiver=t,this.queue.length>0&&(this.queue.forEach(function(r){t(r)}),this.queue=[])},e}(),ge=function(){return ge=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},ge.apply(this,arguments)};function Ut(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ai(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}var Nt=function(e,t){var r,n,o=["string","number","boolean","undefined"],i=typeof e,a=typeof t;if(i!==a)return!1;try{for(var u=Ut(o),s=u.next();!s.done;s=u.next()){var c=s.value;if(c===i)return e===t}}catch(x){r={error:x}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}if(e==null&&t==null)return!0;if(e==null||t==null||e.length!==t.length)return!1;var l=Array.isArray(e),f=Array.isArray(t);if(l!==f)return!1;if(l&&f){for(var d=0;d<e.length;d++)if(!Nt(e[d],t[d]))return!1}else{var p=Object.keys(e).sort(),m=Object.keys(t).sort();if(!Nt(p,m))return!1;var E=!0;return Object.keys(e).forEach(function(x){Nt(e[x],t[x])||(E=!1)}),E}return!0},Ws="$set",Ks="$unset",$s="$clearAll";Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var Ys=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var t=this,r=ge({},this.identity.userProperties),n=ge(ge({},this.identity),{userProperties:r});return{setUserId:function(o){return n.userId=o,this},setDeviceId:function(o){return n.deviceId=o,this},setUserProperties:function(o){return n.userProperties=o,this},setOptOut:function(o){return n.optOut=o,this},updateUserProperties:function(o){var i,a,u,s,c,l,f=n.userProperties||{};try{for(var d=Ut(Object.entries(o)),p=d.next();!p.done;p=d.next()){var m=ai(p.value,2),E=m[0],x=m[1];switch(E){case Ws:try{for(var g=(u=void 0,Ut(Object.entries(x))),v=g.next();!v.done;v=g.next()){var _=ai(v.value,2),T=_[0],A=_[1];f[T]=A}}catch(w){u={error:w}}finally{try{v&&!v.done&&(s=g.return)&&s.call(g)}finally{if(u)throw u.error}}break;case Ks:try{for(var S=(c=void 0,Ut(Object.keys(x))),L=S.next();!L.done;L=S.next()){var T=L.value;delete f[T]}}catch(w){c={error:w}}finally{try{L&&!L.done&&(l=S.return)&&l.call(S)}finally{if(c)throw c.error}}break;case $s:f={};break}}}catch(w){i={error:w}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}return n.userProperties=f,this},commit:function(){return t.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ge({},this.identity)},e.prototype.setIdentity=function(t){var r=ge({},this.identity);this.identity=ge({},t),Nt(r,this.identity)||this.listeners.forEach(function(n){n(t)})},e.prototype.addIdentityListener=function(t){this.listeners.add(t)},e.prototype.removeIdentityListener=function(t){this.listeners.delete(t)},e}(),tt=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,si=function(){function e(){this.identityStore=new Ys,this.eventBridge=new js,this.applicationContextProvider=new Gs}return e.getInstance=function(t){return tt.analyticsConnectorInstances||(tt.analyticsConnectorInstances={}),tt.analyticsConnectorInstances[t]||(tt.analyticsConnectorInstances[t]=new e),tt.analyticsConnectorInstances[t]},e}();var he=function(e){return e===void 0&&(e="$default_instance"),si.getInstance(e)},an=function(e,t){he(t).identityStore.editIdentity().setUserId(e).commit()},sn=function(e,t){he(t).identityStore.editIdentity().setDeviceId(e).commit()};var un=function(){function e(){this.name="identity",this.type="before",this.identityStore=he().identityStore}return e.prototype.execute=function(t){return y(this,void 0,void 0,function(){var r;return h(this,function(n){return r=t.user_properties,r&&this.identityStore.editIdentity().updateUserProperties(r).commit(),[2,t]})})},e.prototype.setup=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){return t.instanceName&&(this.identityStore=he(t.instanceName).identityStore),[2]})})},e}();var W=function(){var e="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[e]<"u")return globalThis[e];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 rt=function(e,t){t===void 0&&(t=Date.now());var r=Date.now(),n=r-t;return n>e};var Mt=function(e,t,r){return t===void 0&&(t=""),r===void 0&&(r=10),[Ne,t,e.substring(0,r)].filter(Boolean).join("_")},cn=function(e){return"".concat(Ne.toLowerCase(),"_").concat(e.substring(0,6))};var ln=function(){var e,t,r,n;if(typeof navigator>"u")return"";var o=navigator.userLanguage;return(n=(r=(t=(e=navigator.languages)===null||e===void 0?void 0:e[0])!==null&&t!==void 0?t:navigator.language)!==null&&r!==void 0?r:o)!==null&&n!==void 0?n:""};var ye=function(){var e,t=W();if(!(!((e=t?.location)===null||e===void 0)&&e.search))return{};var r=t.location.search.substring(1).split("&").filter(Boolean),n=r.reduce(function(o,i){var a=i.split("=",2),u=ui(a[0]),s=ui(a[1]);return s&&(o[u]=s),o},{});return n},ui=function(e){e===void 0&&(e="");try{return decodeURIComponent(e)}catch{return""}};var Xs=function(e){e===void 0&&(e=0);var t=new Error().stack||"";return t.split(\`
28
+ \`).slice(2+e).map(function(r){return r.trim()})},F=function(e){return function(){var t=b({},e.config),r=t.loggerProvider,n=t.logLevel;return{logger:r,logLevel:n}}},Qs=function(e,t){var r,n;t=t.replace(/\\[(\\w+)\\]/g,".$1"),t=t.replace(/^\\./,"");try{for(var o=O(t.split(".")),i=o.next();!i.done;i=o.next()){var a=i.value;if(a in e)e=e[a];else return}}catch(u){r={error:u}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return e},V=function(e,t){return function(){var r,n,o={};try{for(var i=O(t),a=i.next();!a.done;a=i.next()){var u=a.value;o[u]=Qs(e,u)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o}},B=function(e,t,r,n,o){return o===void 0&&(o=null),function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var u=r(),s=u.logger,c=u.logLevel;if(c&&c<$.Debug||!c||!s)return e.apply(o,i);var l={type:"invoke public method",name:t,args:i,stacktrace:Xs(1),time:{start:new Date().toISOString()},states:{}};n&&l.states&&(l.states.before=n());var f=e.apply(o,i);return f&&f.promise?f.promise.then(function(){n&&l.states&&(l.states.after=n()),l.time&&(l.time.end=new Date().toISOString()),s.debug(JSON.stringify(l,null,2))}):(n&&l.states&&(l.states.after=n()),l.time&&(l.time.end=new Date().toISOString()),s.debug(JSON.stringify(l,null,2))),f}};var nt=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return[2,!0]})})},e.prototype.get=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){return[2,this.memoryStorage.get(t)]})})},e.prototype.getRaw=function(t){return y(this,void 0,void 0,function(){var r;return h(this,function(n){switch(n.label){case 0:return[4,this.get(t)];case 1:return r=n.sent(),[2,r?JSON.stringify(r):void 0]}})})},e.prototype.set=function(t,r){return y(this,void 0,void 0,function(){return h(this,function(n){return this.memoryStorage.set(t,r),[2]})})},e.prototype.remove=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){return this.memoryStorage.delete(t),[2]})})},e.prototype.reset=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return this.memoryStorage.clear(),[2]})})},e}();var ot=function(){function e(t){this.options=b({},t)}return e.prototype.isEnabled=function(){return y(this,void 0,void 0,function(){var t,r,n,o;return h(this,function(i){switch(i.label){case 0:if(!W())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(r,e.testValue)];case 2:return i.sent(),[4,t.get(r)];case 3:return n=i.sent(),[2,n===e.testValue];case 4:return o=i.sent(),[2,!1];case 5:return[4,t.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(t){var r;return y(this,void 0,void 0,function(){var n,o;return h(this,function(i){switch(i.label){case 0:return[4,this.getRaw(t)];case 1:if(n=i.sent(),!n)return[2,void 0];try{return o=(r=zs(n))!==null&&r!==void 0?r:Zs(n),o===void 0?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(t,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(o)]}catch{return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(t,", value: ").concat(n)),[2,void 0]}return[2]}})})},e.prototype.getRaw=function(t){var r,n;return y(this,void 0,void 0,function(){var o,i,a;return h(this,function(u){return o=W(),i=(n=(r=o?.document)===null||r===void 0?void 0:r.cookie.split("; "))!==null&&n!==void 0?n:[],a=i.find(function(s){return s.indexOf(t+"=")===0}),a?[2,a.substring(t.length+1)]:[2,void 0]})})},e.prototype.set=function(t,r){var n;return y(this,void 0,void 0,function(){var o,i,a,u,s,c,l;return h(this,function(f){try{o=(n=this.options.expirationDays)!==null&&n!==void 0?n:0,i=r!==null?o:-1,a=void 0,i&&(u=new Date,u.setTime(u.getTime()+i*24*60*60*1e3),a=u),s="".concat(t,"=").concat(btoa(encodeURIComponent(JSON.stringify(r)))),a&&(s+="; expires=".concat(a.toUTCString())),s+="; path=/",this.options.domain&&(s+="; domain=".concat(this.options.domain)),this.options.secure&&(s+="; Secure"),this.options.sameSite&&(s+="; SameSite=".concat(this.options.sameSite)),c=W(),c&&(c.document.cookie=s)}catch(d){l=d instanceof Error?d.message:String(d),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(t,". Error: ").concat(l))}return[2]})})},e.prototype.remove=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){switch(r.label){case 0:return[4,this.set(t,null)];case 1:return r.sent(),[2]}})})},e.prototype.reset=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return[2]})})},e}();var zs=function(e){try{return decodeURIComponent(atob(e))}catch{return}},Zs=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch{return}};var fn=function(e,t,r){return t===void 0&&(t=""),r===void 0&&(r=10),[Ne,t,e.substring(0,r)].filter(Boolean).join("_")};var we=function(){function e(){}return e.prototype.send=function(t,r){return Promise.resolve(null)},e.prototype.buildResponse=function(t){var r,n,o,i,a,u,s,c,l,f,d,p,m,E,x,g,v,_,T,A,S,L;if(typeof t!="object")return null;var w=t.code||0,R=this.buildStatus(w);switch(R){case M.Success:return{status:R,statusCode:w,body:{eventsIngested:(r=t.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=t.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(o=t.server_upload_time)!==null&&o!==void 0?o:0}};case M.Invalid:return{status:R,statusCode:w,body:{error:(i=t.error)!==null&&i!==void 0?i:"",missingField:(a=t.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(u=t.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(s=t.events_with_missing_fields)!==null&&s!==void 0?s:{},eventsWithInvalidIdLengths:(c=t.events_with_invalid_id_lengths)!==null&&c!==void 0?c:{},epsThreshold:(l=t.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(f=t.exceeded_daily_quota_devices)!==null&&f!==void 0?f:{},silencedDevices:(d=t.silenced_devices)!==null&&d!==void 0?d:[],silencedEvents:(p=t.silenced_events)!==null&&p!==void 0?p:[],throttledDevices:(m=t.throttled_devices)!==null&&m!==void 0?m:{},throttledEvents:(E=t.throttled_events)!==null&&E!==void 0?E:[]}};case M.PayloadTooLarge:return{status:R,statusCode:w,body:{error:(x=t.error)!==null&&x!==void 0?x:""}};case M.RateLimit:return{status:R,statusCode:w,body:{error:(g=t.error)!==null&&g!==void 0?g:"",epsThreshold:(v=t.eps_threshold)!==null&&v!==void 0?v:0,throttledDevices:(_=t.throttled_devices)!==null&&_!==void 0?_:{},throttledUsers:(T=t.throttled_users)!==null&&T!==void 0?T:{},exceededDailyQuotaDevices:(A=t.exceeded_daily_quota_devices)!==null&&A!==void 0?A:{},exceededDailyQuotaUsers:(S=t.exceeded_daily_quota_users)!==null&&S!==void 0?S:{},throttledEvents:(L=t.throttled_events)!==null&&L!==void 0?L:[]}};case M.Timeout:default:return{status:R,statusCode:w}}},e.prototype.buildStatus=function(t){return t>=200&&t<300?M.Success:t===429?M.RateLimit:t===413?M.PayloadTooLarge:t===408?M.Timeout:t>=400&&t<500?M.Invalid:t>=500?M.Failed:M.Unknown},e}();var dn=function(e){k(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.send=function(r,n){return y(this,void 0,void 0,function(){var o,i,a;return h(this,function(u){switch(u.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return o={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(n),method:"POST"},[4,fetch(r,o)];case 1:return i=u.sent(),[4,i.text()];case 2:a=u.sent();try{return[2,this.buildResponse(JSON.parse(a))]}catch{return[2,this.buildResponse({code:i.status})]}return[2]}})})},t}(we);var pn=null;var it=function(e,t){return typeof e=="boolean"?e:e?.[t]!==!1},mn=function(e){return it(e,"attribution")},ci=function(e){return it(e,"fileDownloads")},li=function(e){return it(e,"formInteractions")},vn=function(e){return it(e,"pageViews")},gn=function(e){return it(e,"sessions")},hn=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.elementInteractions===!0||typeof e.elementInteractions=="object")},fi=function(e){if(hn(e.autocapture)&&typeof e.autocapture=="object"&&typeof e.autocapture.elementInteractions=="object")return e.autocapture.elementInteractions},di=function(e){var t=function(){return!1},r=void 0,n,o=e.pageCounter,i=vn(e.defaultTracking);return i&&(t=void 0,n=void 0,e.defaultTracking&&typeof e.defaultTracking=="object"&&e.defaultTracking.pageViews&&typeof e.defaultTracking.pageViews=="object"&&("trackOn"in e.defaultTracking.pageViews&&(t=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(n=e.defaultTracking.pageViews.eventType))),{trackOn:t,trackHistoryChanges:r,eventType:n,pageCounter:o}},pi=function(e){return mn(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking=="object"&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution=="object"?b({},e.defaultTracking.attribution):{}};var Ft=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=n.name,i=n.args,a=n.resolve,u=e&&e[o];if(typeof u=="function"){var s=u.apply(e,i);typeof a=="function"&&a(s?.promise)}}return e},Vt=function(e){var t=e;return t&&t._q!==void 0};var mi="2.12.0";var vi="amplitude-ts";var Js="Web",eu="$remote",gi=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(vi,"/").concat(mi),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(t){return this.config=t,Promise.resolve(void 0)},e.prototype.execute=function(t){return y(this,void 0,void 0,function(){var r,n,o,i,a,u;return h(this,function(s){return r=new Date().getTime(),n=(a=this.config.lastEventId)!==null&&a!==void 0?a:-1,o=(u=t.event_id)!==null&&u!==void 0?u:n+1,this.config.lastEventId=o,t.time||(this.config.lastEventTime=r),i=b(b(b(b(b(b(b(b({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:Js}),this.config.trackingOptions.language&&{language:ln()}),this.config.trackingOptions.ipAddress&&{ip:eu}),{insert_id:re(),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}}),t),{event_id:o,library:this.library,user_agent:this.userAgent}),[2,i]})})},e}();var Bt=function(){function e(t){this.storage=t}return e.prototype.isEnabled=function(){return y(this,void 0,void 0,function(){var t,r,n,o,i;return h(this,function(a){switch(a.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",a.label=1;case 1:return a.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return a.sent(),[4,r.get(n)];case 3:return o=a.sent(),[2,o===t];case 4:return i=a.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return a.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(t){return y(this,void 0,void 0,function(){var r,n;return h(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getRaw(t)];case 1:return r=o.sent(),r?[2,JSON.parse(r)]:[2,void 0];case 2:return n=o.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(t){return y(this,void 0,void 0,function(){var r;return h(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(t))||void 0]})})},e.prototype.set=function(t,r){return y(this,void 0,void 0,function(){var n;return h(this,function(o){try{(n=this.storage)===null||n===void 0||n.setItem(t,JSON.stringify(r))}catch{}return[2]})})},e.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r;return h(this,function(n){try{(r=this.storage)===null||r===void 0||r.removeItem(t)}catch{}return[2]})})},e.prototype.reset=function(){return y(this,void 0,void 0,function(){var t;return h(this,function(r){try{(t=this.storage)===null||t===void 0||t.clear()}catch{}return[2]})})},e}();var Ht=1e3,yn=function(e){k(t,e);function t(r){var n,o=e.call(this,(n=W())===null||n===void 0?void 0:n.localStorage)||this;return o.loggerProvider=r?.loggerProvider,o}return t.prototype.set=function(r,n){return y(this,void 0,void 0,function(){var o,i;return h(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>Ht?(o=n.length-Ht,[4,e.prototype.set.call(this,r,n.slice(0,Ht))]):[3,2];case 1:return a.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(Ht,".")),[3,4];case 2:return[4,e.prototype.set.call(this,r,n)];case 3:a.sent(),a.label=4;case 4:return[2]}})})},t}(Bt);var hi=function(e){k(t,e);function t(){var r;return e.call(this,(r=W())===null||r===void 0?void 0:r.sessionStorage)||this}return t}(Bt);var yi=function(e){k(t,e);function t(){var r=e.apply(this,D([],I(arguments),!1))||this;return r.state={done:4},r}return t.prototype.send=function(r,n){return y(this,void 0,void 0,function(){var o=this;return h(this,function(i){return[2,new Promise(function(a,u){typeof XMLHttpRequest>"u"&&u(new Error("XHRTransport is not supported."));var s=new XMLHttpRequest;s.open("POST",r,!0),s.onreadystatechange=function(){if(s.readyState===o.state.done){var c=s.responseText;try{a(o.buildResponse(JSON.parse(c)))}catch{a(o.buildResponse({code:s.status}))}}},s.setRequestHeader("Content-Type","application/json"),s.setRequestHeader("Accept","*/*"),s.send(JSON.stringify(n))})]})})},t}(we);var Ei=function(e){k(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.send=function(r,n){return y(this,void 0,void 0,function(){var o=this;return h(this,function(i){return[2,new Promise(function(a,u){var s=W();if(!s?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var c=JSON.stringify(n),l=s.navigator.sendBeacon(r,JSON.stringify(n));return a(l?o.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:c.length,server_upload_time:Date.now()}):o.buildResponse({code:500}))}catch(f){u(f)}})]})})},t}(we);var _i=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return y(void 0,D([e,t],I(r),!1),void 0,function(o,i,a){var u,s,c,l,f,d,p,m,E;return a===void 0&&(a=!0),h(this,function(x){switch(x.label){case 0:return u=cn(o),[4,i.getRaw(u)];case 1:return s=x.sent(),s?a?[4,i.remove(u)]:[3,3]:[2,{optOut:!1}];case 2:x.sent(),x.label=3;case 3:return c=I(s.split("."),6),l=c[0],f=c[1],d=c[2],p=c[3],m=c[4],E=c[5],[2,{deviceId:l,userId:tu(f),sessionId:En(p),lastEventId:En(E),lastEventTime:En(m),optOut:!!d}]}})})},En=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},tu=function(e){if(!(!atob||!escape||!e))try{return decodeURIComponent(escape(atob(e)))}catch{return}};var ne="[Amplitude]",Id="".concat(ne," Page Viewed"),_n="".concat(ne," Form Started"),Ti="".concat(ne," Form Submitted"),bi="".concat(ne," File Downloaded"),Tn="session_start",bn="session_end",xi="".concat(ne," File Extension"),Ii="".concat(ne," File Name"),Si="".concat(ne," Link ID"),Li="".concat(ne," Link Text"),wi="".concat(ne," Link URL"),Gt="".concat(ne," Form ID"),qt="".concat(ne," Form Name"),jt="".concat(ne," Form Destination"),at="cookie",Ai="US";var ru=function(e){k(t,e);function t(r,n,o,i,a,u,s,c,l,f,d,p,m,E,x,g,v,_,T,A,S,L,w,R,Z,J,Q,ee,pe,be,xe,Ye,Xe,ke){o===void 0&&(o=new nt),i===void 0&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),c===void 0&&(c=1e3),l===void 0&&(l=5),f===void 0&&(f=30),d===void 0&&(d=at),g===void 0&&(g=new Je),v===void 0&&(v=$.Warn),T===void 0&&(T=!1),A===void 0&&(A=!1),w===void 0&&(w=""),R===void 0&&(R=Ai),J===void 0&&(J=30*60*1e3),Q===void 0&&(Q=new yn({loggerProvider:g})),ee===void 0&&(ee={ipAddress:!0,language:!0,platform:!0}),pe===void 0&&(pe="fetch"),be===void 0&&(be=!1),xe===void 0&&(xe=!1);var C=e.call(this,{apiKey:r,storageProvider:Q,transportProvider:xn(pe)})||this;return C.apiKey=r,C.appVersion=n,C.cookieOptions=i,C.defaultTracking=a,C.autocapture=u,C.flushIntervalMillis=c,C.flushMaxRetries=l,C.flushQueueSize=f,C.identityStorage=d,C.ingestionMetadata=p,C.instanceName=m,C.loggerProvider=g,C.logLevel=v,C.minIdLength=_,C.offline=T,C.partnerId=S,C.plan=L,C.serverUrl=w,C.serverZone=R,C.sessionTimeout=J,C.storageProvider=Q,C.trackingOptions=ee,C.transport=pe,C.useBatch=be,C.fetchRemoteConfig=xe,C._optOut=!1,C._cookieStorage=o,C.deviceId=s,C.lastEventId=E,C.lastEventTime=x,C.optOut=A,C.sessionId=Z,C.pageCounter=Xe,C.userId=Ye,C.debugLogsEnabled=ke,C.loggerProvider.enable(ke?$.Debug:C.logLevel),C}return Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(r){this._cookieStorage!==r&&(this._cookieStorage=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(r){this._deviceId!==r&&(this._deviceId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(r){this._userId!==r&&(this._userId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(r){this._sessionId!==r&&(this._sessionId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(r){this._optOut!==r&&(this._optOut=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(r){this._lastEventTime!==r&&(this._lastEventTime=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(r){this._lastEventId!==r&&(this._lastEventId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){this._pageCounter!==r&&(this._pageCounter=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(r){this._debugLogsEnabled!==r&&(this._debugLogsEnabled=r,this.updateStorage())},enumerable:!1,configurable:!0}),t.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,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(Mt(this.apiKey),r)},t}(rn);var Ci=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return y(void 0,D([e],I(t),!1),void 0,function(n,o,i){var a,u,s,c,l,f,d,p,m,E,x,g,v,_,T,A,S,L,w,R,Z,J,Q,ee,pe,be,xe,Ye,Xe,ke,C,Nr,Mr,Fr,Vr,Br,Hr,Gr,qr,jr,Wr,Kr,$r;return o===void 0&&(o={}),h(this,function(Ie){switch(Ie.label){case 0:return a=o.identityStorage||at,w={},a===at?[3,1]:(s="",[3,5]);case 1:return(Z=(R=o.cookieOptions)===null||R===void 0?void 0:R.domain)!==null&&Z!==void 0?(c=Z,[3,4]):[3,2];case 2:return[4,ou()];case 3:c=Ie.sent(),Ie.label=4;case 4:s=c,Ie.label=5;case 5:return u=b.apply(void 0,[(w.domain=s,w.expiration=365,w.sameSite="Lax",w.secure=!1,w.upgrade=!0,w),o.cookieOptions]),l=nu(o.identityStorage,u),[4,_i(n,l,(Q=(J=o.cookieOptions)===null||J===void 0?void 0:J.upgrade)!==null&&Q!==void 0?Q:!0)];case 6:return f=Ie.sent(),[4,l.get(Mt(n))];case 7:return d=Ie.sent(),p=ye(),m=(Ye=(xe=(be=(pe=(ee=o.deviceId)!==null&&ee!==void 0?ee:p.ampDeviceId)!==null&&pe!==void 0?pe:p.deviceId)!==null&&be!==void 0?be:d?.deviceId)!==null&&xe!==void 0?xe:f.deviceId)!==null&&Ye!==void 0?Ye:re(),E=(Xe=d?.lastEventId)!==null&&Xe!==void 0?Xe:f.lastEventId,x=(ke=d?.lastEventTime)!==null&&ke!==void 0?ke:f.lastEventTime,g=(Nr=(C=o.optOut)!==null&&C!==void 0?C:d?.optOut)!==null&&Nr!==void 0?Nr:f.optOut,v=(Mr=d?.sessionId)!==null&&Mr!==void 0?Mr:f.sessionId,_=(Vr=(Fr=o.userId)!==null&&Fr!==void 0?Fr:d?.userId)!==null&&Vr!==void 0?Vr:f.userId,i.previousSessionDeviceId=(Br=d?.deviceId)!==null&&Br!==void 0?Br:f.deviceId,i.previousSessionUserId=(Hr=d?.userId)!==null&&Hr!==void 0?Hr:f.userId,T={ipAddress:(qr=(Gr=o.trackingOptions)===null||Gr===void 0?void 0:Gr.ipAddress)!==null&&qr!==void 0?qr:!0,language:(Wr=(jr=o.trackingOptions)===null||jr===void 0?void 0:jr.language)!==null&&Wr!==void 0?Wr:!0,platform:($r=(Kr=o.trackingOptions)===null||Kr===void 0?void 0:Kr.platform)!==null&&$r!==void 0?$r:!0},A=d?.pageCounter,S=d?.debugLogsEnabled,o.autocapture!==void 0&&(o.defaultTracking=o.autocapture),L=new ru(n,o.appVersion,l,u,o.defaultTracking,o.autocapture,m,o.flushIntervalMillis,o.flushMaxRetries,o.flushQueueSize,a,o.ingestionMetadata,o.instanceName,E,x,o.loggerProvider,o.logLevel,o.minIdLength,o.offline,g,o.partnerId,o.plan,o.serverUrl,o.serverZone,v,o.sessionTimeout,o.storageProvider,T,o.transport,o.useBatch,o.fetchRemoteConfig,_,A,S),[4,L.storageProvider.isEnabled()];case 8:return Ie.sent()||(L.loggerProvider.warn("Storage provider ".concat(L.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),L.storageProvider=new nt),[2,L]}})})},nu=function(e,t){switch(e===void 0&&(e=at),t===void 0&&(t={}),e){case"localStorage":return new yn;case"sessionStorage":return new hi;case"none":return new nt;case"cookie":default:return new ot(b(b({},t),{expirationDays:t.expiration}))}},xn=function(e){return e==="xhr"?new yi:e==="beacon"?new Ei:new dn},ou=function(e){return y(void 0,void 0,void 0,function(){var t,r,n,o,i,i,a,u,s,c;return h(this,function(l){switch(l.label){case 0:return[4,new ot().isEnabled()];case 1:if(!l.sent()||!e&&(typeof location>"u"||!location.hostname))return[2,""];for(t=e??location.hostname,r=t.split("."),n=[],o="AMP_TLDTEST",i=r.length-2;i>=0;--i)n.push(r.slice(i).join("."));i=0,l.label=2;case 2:return i<n.length?(a=n[i],u={domain:"."+a},s=new ot(u),[4,s.set(o,1)]):[3,7];case 3:return l.sent(),[4,s.get(o)];case 4:return c=l.sent(),c?[4,s.remove(o)]:[3,6];case 5:return l.sent(),[2,"."+a];case 6:return i++,[3,2];case 7:return[2,""]}})})};var st=function(){var e="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[e]<"u")return globalThis[e];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 In=function(){var e,t=st();if(!(!((e=t?.location)===null||e===void 0)&&e.search))return{};var r=t.location.search.substring(1).split("&").filter(Boolean),n=r.reduce(function(o,i){var a=i.split("=",2),u=Pi(a[0]),s=Pi(a[1]);return s&&(o[u]=s),o},{});return n},Pi=function(e){e===void 0&&(e="");try{return decodeURIComponent(e)}catch{return""}};var Ri="utm_campaign",Di="utm_content",Oi="utm_id",ki="utm_medium",Ui="utm_source",Ni="utm_term",Sn="dclid",Ln="fbclid",wn="gbraid",An="gclid",Cn="ko_click_id",Pn="li_fat_id",Rn="msclkid",Dn="rtd_cid",On="ttclid",kn="twclid",Un="wbraid";var ut={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 Nn=function(){function e(){}return e.prototype.parse=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return[2,b(b(b(b({},ut),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var t=In(),r=t[Ri],n=t[Di],o=t[Oi],i=t[ki],a=t[Ui],u=t[Ni];return{utm_campaign:r,utm_content:n,utm_id:o,utm_medium:i,utm_source:a,utm_term:u}},e.prototype.getReferrer=function(){var t,r,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=(r=(t=n.referrer)===null||t===void 0?void 0:t.split("/")[2])!==null&&r!==void 0?r:void 0}catch{}return n},e.prototype.getClickIds=function(){var t,r=In();return t={},t[Sn]=r[Sn],t[Ln]=r[Ln],t[wn]=r[wn],t[An]=r[An],t[Cn]=r[Cn],t[Pn]=r[Pn],t[Rn]=r[Rn],t[Dn]=r[Dn],t[On]=r[On],t[kn]=r[kn],t[Un]=r[Un],t},e}();var Me;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(Me||(Me={}));var Mn;(function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"})(Mn||(Mn={}));var Fn;(function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"})(Fn||(Fn={}));var Mi=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t};var iu="[Amplitude] Page Viewed",Vn=function(e){e===void 0&&(e={});var t,r=st(),n=void 0,o,i,a=e.trackOn,u=e.trackHistoryChanges,s=e.eventType,c=s===void 0?iu:s,l=function(g){var v=g;try{v=decodeURI(g)}catch(_){n?.error("Malformed URI sequence: ",_)}return v},f=function(){return y(void 0,void 0,void 0,function(){var g,v,_;return h(this,function(T){switch(T.label){case 0:return g=l(typeof location<"u"&&location.href||""),_={event_type:c},v=[{}],[4,au()];case 1:return[2,(_.event_properties=b.apply(void 0,[b.apply(void 0,v.concat([T.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":g,"[Amplitude] Page Path":typeof location<"u"&&l(location.pathname)||"","[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":g.split("?")[0]}]),_)]}})})},d=function(){return typeof a>"u"||typeof a=="function"&&a()},p=typeof location<"u"?location.href:null,m=function(){return y(void 0,void 0,void 0,function(){var g,v,_,T,A;return h(this,function(S){switch(S.label){case 0:return g=location.href,v=uu(u,g,p||"")&&d(),p=g,v?(n?.log("Tracking page view event"),t!=null?[3,1]:(_=void 0,[3,3])):[3,4];case 1:return A=(T=t).track,[4,f()];case 2:_=A.apply(T,[S.sent()]),S.label=3;case 3:S.label=4;case 4:return[2]}})})},E=function(){m()},x={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(g,v){return y(void 0,void 0,void 0,function(){var _,T;return h(this,function(A){switch(A.label){case 0:return t=v,i=g,n=g.loggerProvider,n.log("Installing @amplitude/plugin-page-view-tracking-browser"),r&&(r.addEventListener("popstate",E),o=r.history.pushState,r.history.pushState=new Proxy(r.history.pushState,{apply:function(S,L,w){var R=I(w,3),Z=R[0],J=R[1],Q=R[2];S.apply(L,[Z,J,Q]),m()}})),d()?(n.log("Tracking page view event"),T=(_=t).track,[4,f()]):[3,2];case 1:T.apply(_,[A.sent()]),A.label=2;case 2:return[2]}})})},execute:function(g){return y(void 0,void 0,void 0,function(){var v;return h(this,function(_){switch(_.label){case 0:return a==="attribution"&&su(g)?(n?.log("Enriching campaign event to page view event with campaign parameters"),[4,f()]):[3,2];case 1:v=_.sent(),g.event_type=v.event_type,g.event_properties=b(b({},g.event_properties),v.event_properties),_.label=2;case 2:return i&&g.event_type===c&&(i.pageCounter=i.pageCounter?i.pageCounter+1:1,g.event_properties=b(b({},g.event_properties),{"[Amplitude] Page Counter":i.pageCounter})),[2,g]}})})},teardown:function(){return y(void 0,void 0,void 0,function(){return h(this,function(g){return r&&(r.removeEventListener("popstate",E),o&&(r.history.pushState=o)),[2]})})}};return x},au=function(){return y(void 0,void 0,void 0,function(){var e;return h(this,function(t){switch(t.label){case 0:return e=Mi,[4,new Nn().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},su=function(e){if(e.event_type==="$identify"&&e.user_properties){var t=e.user_properties,r=t[Me.SET]||{},n=t[Me.UNSET]||{},o=D(D([],I(Object.keys(r)),!1),I(Object.keys(n)),!1);return Object.keys(ut).every(function(i){return o.includes(i)})}return!1},uu=function(e,t,r){switch(e){case"pathOnly":{if(r=="")return!0;var n=new URL(t),o=new URL(r),i=n.origin+n.pathname,a=o.origin+o.pathname;return i!==a}default:return t!==r}};var Vi=function(){var e,t=[],r=function(c,l,f){c.addEventListener(l,f),t.push({element:c,type:l,handler:f})},n=function(){t.forEach(function(c){var l=c.element,f=c.type,d=c.handler;l?.removeEventListener(f,d)}),t=[]},o="@amplitude/plugin-form-interaction-tracking-browser",i="enrichment",a=function(c,l){return y(void 0,void 0,void 0,function(){var f;return h(this,function(d){return(f=W())===null||f===void 0||f.addEventListener("load",function(){if(!l){c.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return}if(!(typeof document>"u")){var p=function(E){var x=!1;r(E,"change",function(){var g,v=Fi(E);x||l.track(_n,(g={},g[Gt]=Fe(E.id),g[qt]=Fe(E.name),g[jt]=v,g)),x=!0}),r(E,"submit",function(){var g,v,_=Fi(E);x||l.track(_n,(g={},g[Gt]=Fe(E.id),g[qt]=Fe(E.name),g[jt]=_,g)),l.track(Ti,(v={},v[Gt]=Fe(E.id),v[qt]=Fe(E.name),v[jt]=_,v)),x=!1})},m=Array.from(document.getElementsByTagName("form"));m.forEach(p),typeof MutationObserver<"u"&&(e=new MutationObserver(function(E){E.forEach(function(x){x.addedNodes.forEach(function(g){g.nodeName==="FORM"&&p(g),"querySelectorAll"in g&&typeof g.querySelectorAll=="function"&&Array.from(g.querySelectorAll("form")).map(p)})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}),[2]})})},u=function(c){return y(void 0,void 0,void 0,function(){return h(this,function(l){return[2,c]})})},s=function(){return y(void 0,void 0,void 0,function(){return h(this,function(c){return e?.disconnect(),n(),[2]})})};return{name:o,type:i,setup:a,execute:u,teardown:s}},Fe=function(e){if(typeof e=="string")return e},Fi=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(t??""),window.location.href).href}catch{}return t};var Bi=function(){var e,t=[],r=function(c,l,f){c.addEventListener(l,f),t.push({element:c,type:l,handler:f})},n=function(){t.forEach(function(c){var l=c.element,f=c.type,d=c.handler;l?.removeEventListener(f,d)}),t=[]},o="@amplitude/plugin-file-download-tracking-browser",i="enrichment",a=function(c,l){return y(void 0,void 0,void 0,function(){var f;return h(this,function(d){return(f=W())===null||f===void 0||f.addEventListener("load",function(){if(!l){c.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return}if(!(typeof document>"u")){var p=function(x){var g;try{g=new URL(x.href,window.location.href)}catch{return}var v=m.exec(g.href),_=v?.[1];_&&r(x,"click",function(){var T;_&&l.track(bi,(T={},T[xi]=_,T[Ii]=g.pathname,T[Si]=x.id,T[Li]=x.text,T[wi]=x.href,T))})},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)(\\?.+)?$/,E=Array.from(document.getElementsByTagName("a"));E.forEach(p),typeof MutationObserver<"u"&&(e=new MutationObserver(function(x){x.forEach(function(g){g.addedNodes.forEach(function(v){v.nodeName==="A"&&p(v),"querySelectorAll"in v&&typeof v.querySelectorAll=="function"&&Array.from(v.querySelectorAll("a")).map(p)})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}),[2]})})},u=function(c){return y(void 0,void 0,void 0,function(){return h(this,function(l){return[2,c]})})},s=function(){return y(void 0,void 0,void 0,function(){return h(this,function(c){return e?.disconnect(),n(),[2]})})};return{name:o,type:i,setup:a,execute:u,teardown:s}};var Hi=!1,Gi=function(e){if(!(Hi||e.defaultTracking!==void 0)){var t=\`\\\`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:
27
29
 
28
30
  amplitude.init(<YOUR_API_KEY>, {
29
31
  defaultTracking: true,
30
32
  });
31
33
 
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=\`
34
+ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.\`;e.loggerProvider.warn(t),Hi=!0}};var qi=function(){var e="@amplitude/plugin-network-checker-browser",t="before",r=W(),n=[],o=function(s,c){r&&(r.addEventListener(s,c),n.push({type:s,handler:c}))},i=function(){n.forEach(function(s){var c=s.type,l=s.handler;r&&r.removeEventListener(c,l)}),n=[]},a=function(s,c){return y(void 0,void 0,void 0,function(){return h(this,function(l){return typeof navigator>"u"?(s.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),s.offline=!1,[2]):(s.offline=!navigator.onLine,o("online",function(){s.loggerProvider.debug("Network connectivity changed to online."),s.offline=!1,setTimeout(function(){c.flush()},s.flushIntervalMillis)}),o("offline",function(){s.loggerProvider.debug("Network connectivity changed to offline."),s.offline=!0}),[2])})})},u=function(){return y(void 0,void 0,void 0,function(){return h(this,function(s){return i(),[2]})})};return{name:e,type:t,setup:a,teardown:u}};var Ve;(function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"})(Ve||(Ve={}));var K;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"})(K||(K={}));var Bn=function(){function e(){}return e.prototype.send=function(t,r){return Promise.resolve(null)},e.prototype.buildResponse=function(t){var r,n,o,i,a,u,s,c,l,f,d,p,m,E,x,g,v,_,T,A,S,L;if(typeof t!="object")return null;var w=t.code||0,R=this.buildStatus(w);switch(R){case K.Success:return{status:R,statusCode:w,body:{eventsIngested:(r=t.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=t.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(o=t.server_upload_time)!==null&&o!==void 0?o:0}};case K.Invalid:return{status:R,statusCode:w,body:{error:(i=t.error)!==null&&i!==void 0?i:"",missingField:(a=t.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(u=t.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(s=t.events_with_missing_fields)!==null&&s!==void 0?s:{},eventsWithInvalidIdLengths:(c=t.events_with_invalid_id_lengths)!==null&&c!==void 0?c:{},epsThreshold:(l=t.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(f=t.exceeded_daily_quota_devices)!==null&&f!==void 0?f:{},silencedDevices:(d=t.silenced_devices)!==null&&d!==void 0?d:[],silencedEvents:(p=t.silenced_events)!==null&&p!==void 0?p:[],throttledDevices:(m=t.throttled_devices)!==null&&m!==void 0?m:{},throttledEvents:(E=t.throttled_events)!==null&&E!==void 0?E:[]}};case K.PayloadTooLarge:return{status:R,statusCode:w,body:{error:(x=t.error)!==null&&x!==void 0?x:""}};case K.RateLimit:return{status:R,statusCode:w,body:{error:(g=t.error)!==null&&g!==void 0?g:"",epsThreshold:(v=t.eps_threshold)!==null&&v!==void 0?v:0,throttledDevices:(_=t.throttled_devices)!==null&&_!==void 0?_:{},throttledUsers:(T=t.throttled_users)!==null&&T!==void 0?T:{},exceededDailyQuotaDevices:(A=t.exceeded_daily_quota_devices)!==null&&A!==void 0?A:{},exceededDailyQuotaUsers:(S=t.exceeded_daily_quota_users)!==null&&S!==void 0?S:{},throttledEvents:(L=t.throttled_events)!==null&&L!==void 0?L:[]}};case K.Timeout:default:return{status:R,statusCode:w}}},e.prototype.buildStatus=function(t){return t>=200&&t<300?K.Success:t===429?K.RateLimit:t===413?K.PayloadTooLarge:t===408?K.Timeout:t>=400&&t<500?K.Invalid:t>=500?K.Failed:K.Unknown},e}();var cu="Network error occurred, remote config fetch failed",lu="Remote config successfully fetched",fu="Remote config fetch rejected due to exceeded retry count",ji="Remote config fetch rejected due to timeout after 5 seconds",Wi="Unexpected error occurred",du="https://sr-client-cfg.amplitude.com/config",pu="https://sr-client-cfg.stag2.amplitude.com/config",mu="https://sr-client-cfg.eu.amplitude.com/config",vu=function(){function e(t){var r=t.localConfig,n=t.configKeys,o=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteConfig=function(i,a,u){return y(o,void 0,void 0,function(){var s,c,l;return h(this,function(f){switch(f.label){case 0:return s=Date.now(),[4,this.fetchWithTimeout(u)];case 1:return c=f.sent(),c&&(l=c.configs&&c.configs[i],l)?(this.metrics.fetchTimeAPISuccess=Date.now()-s,[2,l[a]]):(this.metrics.fetchTimeAPIFail=Date.now()-s,[2,void 0])}})})},this.fetchWithTimeout=function(i){return y(o,void 0,void 0,function(){var a,u,s;return h(this,function(c){switch(c.label){case 0:return a=new AbortController,u=setTimeout(function(){return a.abort()},5e3),[4,this.fetchRemoteConfig(a.signal,i)];case 1:return s=c.sent(),clearTimeout(u),[2,s]}})})},this.fetchRemoteConfig=function(i,a){return y(o,void 0,void 0,function(){var u,s,c,l,f,d,p,m,E,x,g,v,_;return h(this,function(T){switch(T.label){case 0:if(a===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:fu})];if(i.aborted)return[2,this.completeRequest({err:ji})];a!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=a,this.attempts=0),T.label=1;case 1:T.trys.push([1,3,,4]),u=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(s=O(this.configKeys),c=s.next();!c.done;c=s.next())l=c.value,u.append("config_keys",l)}catch(A){g={error:A}}finally{try{c&&!c.done&&(v=s.return)&&v.call(s)}finally{if(g)throw g.error}}return a&&u.set("session_id",String(a)),f={headers:{Accept:"*/*"},method:"GET"},d="".concat(this.getServerUrl(),"?").concat(u.toString()),this.attempts+=1,[4,fetch(d,b(b({},f),{signal:i}))];case 2:if(p=T.sent(),p===null)return[2,this.completeRequest({err:Wi})];switch(m=new Bn().buildStatus(p.status),m){case K.Success:return this.attempts=0,[2,this.parseAndStoreConfig(p)];case K.Failed:return[2,this.retryFetch(i,a)];default:return[2,this.completeRequest({err:cu})]}return[3,4];case 3:return E=T.sent(),x=E,i.aborted?[2,this.completeRequest({err:ji})]:[2,this.completeRequest({err:(_=x.message)!==null&&_!==void 0?_:Wi})];case 4:return[2]}})})},this.retryFetch=function(i,a){return y(o,void 0,void 0,function(){var u=this;return h(this,function(s){switch(s.label){case 0:return[4,new Promise(function(c){return setTimeout(c,u.attempts*u.retryTimeout)})];case 1:return s.sent(),[2,this.fetchRemoteConfig(i,a)]}})})},this.parseAndStoreConfig=function(i){return y(o,void 0,void 0,function(){var a;return h(this,function(u){switch(u.label){case 0:return[4,i.json()];case 1:return a=u.sent(),this.completeRequest({success:lu}),[2,a]}})})},this.localConfig=r,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.serverZone===Ve.STAGING?pu:this.localConfig.serverZone===Ve.EU?mu:du},e.prototype.completeRequest=function(t){var r=t.err,n=t.success;if(r)throw new Error(r);n&&this.localConfig.loggerProvider.log(n)},e}();var Ki=function(e){var t=e.localConfig,r=e.configKeys;return y(void 0,void 0,void 0,function(){return h(this,function(n){return[2,new vu({localConfig:t,configKeys:r})]})})};var $i=Ki;var hu=function(){function e(t){this.config=t,this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}return e.prototype.initialize=function(){return y(this,void 0,void 0,function(){var t;return h(this,function(r){switch(r.label){case 0:return t=this,[4,$i({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:return t.remoteConfigFetch=r.sent(),[2]}})})},e.prototype.generateJoinedConfig=function(){return y(this,void 0,void 0,function(){var t,r,n,o,i,a,u;return h(this,function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),r=this.remoteConfigFetch,r?[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return t=r,this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(t,null,2)),t&&"autocapture"in t&&(typeof t.autocapture=="boolean"&&(this.config.autocapture=t.autocapture),typeof t.autocapture=="object"&&(this.config.autocapture===void 0&&(this.config.autocapture=t.autocapture),typeof this.config.autocapture=="boolean"&&(this.config.autocapture=b({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},t.autocapture)),typeof this.config.autocapture=="object"&&(this.config.autocapture=b(b({},this.config.autocapture),t.autocapture))),this.config.defaultTracking=this.config.autocapture),this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2)),(o=(u=this.config).requestMetadata)!==null&&o!==void 0||(u.requestMetadata=new et),!((i=this.remoteConfigFetch)===null||i===void 0)&&i.metrics.fetchTimeAPISuccess&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess),!((a=this.remoteConfigFetch)===null||a===void 0)&&a.metrics.fetchTimeAPIFail&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail),[3,4];case 3:return n=s.sent(),this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",n),[3,4];case 4:return[2,this.config]}})})},e}();var Yi=function(e){return y(void 0,void 0,void 0,function(){var t;return h(this,function(r){switch(r.label){case 0:return t=new hu(e),[4,t.initialize()];case 1:return r.sent(),[2,t]}})})};var Hn=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Gn="data-amp-track-",qn=["div","span","h1","h2","h3","h4","h5","h6"];var Xi="@amplitude/plugin-autocapture-browser",ct="[Amplitude] Element Clicked",Qi="[Amplitude] Element Changed",zi="[Amplitude] Element ID",Zi="[Amplitude] Element Class",Wt="[Amplitude] Element Tag",Kt="[Amplitude] Element Text",Ji="[Amplitude] Element Hierarchy",ea="[Amplitude] Element Href",ta="[Amplitude] Element Position Left",ra="[Amplitude] Element Position Top",na="[Amplitude] Element Aria Label",oa="[Amplitude] Element Attributes",$t="[Amplitude] Element Selector",ia="[Amplitude] Element Parent Label",Yt="[Amplitude] Page URL",aa="[Amplitude] Page Title",sa="[Amplitude] Viewport Height",ua="[Amplitude] Viewport Width",lt="https://app.amplitude.com",yu="https://app.eu.amplitude.com",Eu="https://apps.stag2.amplitude.com",ca={US:lt,EU:yu,STAGING:Eu},la="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",ft="amp-visual-tagging-selector-highlight";function P(e){return typeof e=="function"}function Xt(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Qt=Xt(function(e){return function(r){e(this),this.message=r?r.length+\` errors occurred during unsubscription:
35
+ \`+r.map(function(n,o){return o+1+") "+n.toString()}).join(\`
36
+ \`):"",this.name="UnsubscriptionError",this.errors=r}});function dt(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Be=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=O(a),s=u.next();!s.done;s=u.next()){var c=s.value;c.remove(this)}}catch(E){t={error:E}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}else a.remove(this);var l=this.initialTeardown;if(P(l))try{l()}catch(E){i=E instanceof Qt?E.errors:[E]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=O(f),p=d.next();!p.done;p=d.next()){var m=p.value;try{da(m)}catch(E){i=i??[],E instanceof Qt?i=D(D([],I(i)),I(E.errors)):i.push(E)}}}catch(E){n={error:E}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(i)throw new Qt(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)da(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&dt(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&dt(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Kp=Be.EMPTY;function zt(e){return e instanceof Be||e&&"closed"in e&&P(e.remove)&&P(e.add)&&P(e.unsubscribe)}function da(e){P(e)?e():e.unsubscribe()}var se={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var He={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=He.delegate;return o?.setTimeout?o.setTimeout.apply(o,D([e,t],I(r))):setTimeout.apply(void 0,D([e,t],I(r)))},clearTimeout:function(e){var t=He.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Zt(e){He.setTimeout(function(){var t=se.onUnhandledError;if(t)t(e);else throw e})}function Ae(){}var pa=function(){return jn("C",void 0,void 0)}();function ma(e){return jn("E",void 0,e)}function va(e){return jn("N",e,void 0)}function jn(e,t,r){return{kind:e,value:t,error:r}}var Ce=null;function ga(e){if(se.useDeprecatedSynchronousErrorHandling){var t=!Ce;if(t&&(Ce={errorThrown:!1,error:null}),e(),t){var r=Ce,n=r.errorThrown,o=r.error;if(Ce=null,n)throw o}}else e()}function ha(e){se.useDeprecatedSynchronousErrorHandling&&Ce&&(Ce.errorThrown=!0,Ce.error=e)}var pt=function(e){k(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,zt(r)&&r.add(n)):n.destination=xu,n}return t.create=function(r,n,o){return new er(r,n,o)},t.prototype.next=function(r){this.isStopped?Kn(va(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Kn(ma(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Kn(pa,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Be);var _u=Function.prototype.bind;function Wn(e,t){return _u.call(e,t)}var Tu=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Jt(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Jt(n)}else Jt(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Jt(r)}},e}(),er=function(e){k(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(P(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var u;i&&se.useDeprecatedNextContext?(u=Object.create(r),u.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Wn(r.next,u),error:r.error&&Wn(r.error,u),complete:r.complete&&Wn(r.complete,u)}):a=r}return i.destination=new Tu(a),i}return t}(pt);function Jt(e){se.useDeprecatedSynchronousErrorHandling?ha(e):Zt(e)}function bu(e){throw e}function Kn(e,t){var r=se.onStoppedNotification;r&&He.setTimeout(function(){return r(e,t)})}var xu={closed:!0,next:Ae,error:bu,complete:Ae};var Ge=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function tr(e){return e}function ya(e){return e.length===0?tr:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var H=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=Su(t)?t:new er(t,r,n);return ga(function(){var a=o,u=a.operator,s=a.source;i.add(u?u.call(i,s):s?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=Ea(r),new r(function(o,i){var a=new er({next:function(u){try{t(u)}catch(s){i(s),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Ge]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ya(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Ea(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function Ea(e){var t;return(t=e??se.Promise)!==null&&t!==void 0?t:Promise}function Iu(e){return e&&P(e.next)&&P(e.error)&&P(e.complete)}function Su(e){return e&&e instanceof pt||Iu(e)&&zt(e)}function Lu(e){return P(e?.lift)}function N(e){return function(t){if(Lu(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function U(e,t,r,n,o){return new wu(e,t,r,n,o)}var wu=function(e){k(t,e);function t(r,n,o,i,a,u){var s=e.call(this,r)||this;return s.onFinalize=a,s.shouldUnsubscribe=u,s._next=n?function(c){try{n(c)}catch(l){r.error(l)}}:e.prototype._next,s._error=i?function(c){try{i(c)}catch(l){r.error(l)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(pt);var $n={now:function(){return($n.delegate||Date).now()},delegate:void 0};var _a=function(e){k(t,e);function t(r,n){return e.call(this)||this}return t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(Be);var mt={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=mt.delegate;return o?.setInterval?o.setInterval.apply(o,D([e,t],I(r))):setInterval.apply(void 0,D([e,t],I(r)))},clearInterval:function(e){var t=mt.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0};var Ta=function(e){k(t,e);function t(r,n){var o=e.call(this,r,n)||this;return o.scheduler=r,o.work=n,o.pending=!1,o}return t.prototype.schedule=function(r,n){var o;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var i=this.id,a=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(a,i,n)),this.pending=!0,this.delay=n,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(a,this.id,n),this},t.prototype.requestAsyncId=function(r,n,o){return o===void 0&&(o=0),mt.setInterval(r.flush.bind(r,this),o)},t.prototype.recycleAsyncId=function(r,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&mt.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(r,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var o=!1,i;try{this.work(r)}catch(a){o=!0,i=a||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,o=r.scheduler,i=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,dt(i,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(_a);var Yn=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(t,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,t).schedule(n,r)},e.now=$n.now,e}();var ba=function(e){k(t,e);function t(r,n){n===void 0&&(n=Yn.now);var o=e.call(this,r,n)||this;return o.actions=[],o._active=!1,o}return t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var o;this._active=!0;do if(o=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,o){for(;r=n.shift();)r.unsubscribe();throw o}},t}(Yn);var Pe=new ba(Ta),xa=Pe;var Re=new H(function(e){return e.complete()});function rr(e){return e&&P(e.schedule)}function Ia(e){return e[e.length-1]}function nr(e){return rr(Ia(e))?e.pop():void 0}function Sa(e,t){return typeof Ia(e)=="number"?e.pop():t}var qe=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function or(e){return P(e?.then)}function ir(e){return P(e[Ge])}function ar(e){return Symbol.asyncIterator&&P(e?.[Symbol.asyncIterator])}function sr(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Au(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ur=Au();function cr(e){return P(e?.[ur])}function lr(e){return Bo(this,arguments,function(){var r,n,o,i;return h(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Se(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Se(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Se(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function fr(e){return P(e?.getReader)}function G(e){if(e instanceof H)return e;if(e!=null){if(ir(e))return Cu(e);if(qe(e))return Pu(e);if(or(e))return Ru(e);if(ar(e))return La(e);if(cr(e))return Du(e);if(fr(e))return Ou(e)}throw sr(e)}function Cu(e){return new H(function(t){var r=e[Ge]();if(P(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Pu(e){return new H(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Ru(e){return new H(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Zt)})}function Du(e){return new H(function(t){var r,n;try{for(var o=O(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(u){r={error:u}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function La(e){return new H(function(t){ku(e,t).catch(function(r){return t.error(r)})})}function Ou(e){return La(lr(e))}function ku(e,t){var r,n,o,i;return y(this,void 0,void 0,function(){var a,u;return h(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),r=Ho(e),s.label=1;case 1:return[4,r.next()];case 2:if(n=s.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=s.sent(),o={error:u},[3,11];case 6:return s.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function te(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function dr(e,t){return t===void 0&&(t=0),N(function(r,n){r.subscribe(U(n,function(o){return te(n,e,function(){return n.next(o)},t)},function(){return te(n,e,function(){return n.complete()},t)},function(o){return te(n,e,function(){return n.error(o)},t)}))})}function pr(e,t){return t===void 0&&(t=0),N(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function wa(e,t){return G(e).pipe(pr(t),dr(t))}function Aa(e,t){return G(e).pipe(pr(t),dr(t))}function Ca(e,t){return new H(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}function Pa(e,t){return new H(function(r){var n;return te(r,t,function(){n=e[ur](),te(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(u){r.error(u);return}a?r.complete():r.next(i)},0,!0)}),function(){return P(n?.return)&&n.return()}})}function mr(e,t){if(!e)throw new Error("Iterable cannot be null");return new H(function(r){te(r,t,function(){var n=e[Symbol.asyncIterator]();te(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}function Ra(e,t){return mr(lr(e),t)}function Da(e,t){if(e!=null){if(ir(e))return wa(e,t);if(qe(e))return Ca(e,t);if(or(e))return Aa(e,t);if(ar(e))return mr(e,t);if(cr(e))return Pa(e,t);if(fr(e))return Ra(e,t)}throw sr(e)}function vr(e,t){return t?Da(e,t):G(e)}function gr(e){return e instanceof Date&&!isNaN(e)}var Uu=Xt(function(e){return function(r){r===void 0&&(r=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=r}});function Xn(e,t){var r=gr(e)?{first:e}:typeof e=="number"?{each:e}:e,n=r.first,o=r.each,i=r.with,a=i===void 0?Nu:i,u=r.scheduler,s=u===void 0?t??Pe:u,c=r.meta,l=c===void 0?null:c;if(n==null&&o==null)throw new TypeError("No timeout provided.");return N(function(f,d){var p,m,E=null,x=0,g=function(v){m=te(d,s,function(){try{p.unsubscribe(),G(a({meta:l,lastValue:E,seen:x})).subscribe(d)}catch(_){d.error(_)}},v)};p=f.subscribe(U(d,function(v){m?.unsubscribe(),x++,d.next(E=v),o>0&&g(o)},void 0,void 0,function(){m?.closed||m?.unsubscribe(),E=null})),!x&&g(n!=null?typeof n=="number"?n:+n-s.now():o)})}function Nu(e){throw new Uu(e)}function X(e,t){return N(function(r,n){var o=0;r.subscribe(U(n,function(i){n.next(e.call(t,i,o++))}))})}var Mu=Array.isArray;function Fu(e,t){return Mu(t)?e.apply(void 0,D([],I(t))):e(t)}function Oa(e){return X(function(t){return Fu(e,t)})}function ka(e,t,r,n,o,i,a,u){var s=[],c=0,l=0,f=!1,d=function(){f&&!s.length&&!c&&t.complete()},p=function(E){return c<n?m(E):s.push(E)},m=function(E){i&&t.next(E),c++;var x=!1;G(r(E,l++)).subscribe(U(t,function(g){o?.(g),i?p(g):t.next(g)},function(){x=!0},void 0,function(){if(x)try{c--;for(var g=function(){var v=s.shift();a?te(t,a,function(){return m(v)}):m(v)};s.length&&c<n;)g();d()}catch(v){t.error(v)}}))};return e.subscribe(U(t,p,function(){f=!0,d()})),function(){u?.()}}function De(e,t,r){return r===void 0&&(r=1/0),P(t)?De(function(n,o){return X(function(i,a){return t(n,i,o,a)})(G(e(n,o)))},r):(typeof t=="number"&&(r=t),N(function(n,o){return ka(n,o,e,r)}))}function hr(e){return e===void 0&&(e=1/0),De(tr,e)}function Ua(){return hr(1)}function Na(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ua()(vr(e,nr(e)))}var Vu=["addListener","removeListener"],Bu=["addEventListener","removeEventListener"],Hu=["on","off"];function Oe(e,t,r,n){if(P(r)&&(n=r,r=void 0),n)return Oe(e,t,r).pipe(Oa(n));var o=I(ju(e)?Bu.map(function(u){return function(s){return e[u](t,s,r)}}):Gu(e)?Vu.map(Ma(e,t)):qu(e)?Hu.map(Ma(e,t)):[],2),i=o[0],a=o[1];if(!i&&qe(e))return De(function(u){return Oe(u,t,r)})(G(e));if(!i)throw new TypeError("Invalid event target");return new H(function(u){var s=function(){for(var c=[],l=0;l<arguments.length;l++)c[l]=arguments[l];return u.next(1<c.length?c:c[0])};return i(s),function(){return a(s)}})}function Ma(e,t){return function(r){return function(n){return e[r](t,n)}}}function Gu(e){return P(e.addListener)&&P(e.removeListener)}function qu(e){return P(e.on)&&P(e.off)}function ju(e){return P(e.addEventListener)&&P(e.removeEventListener)}function Fa(e,t,r){e===void 0&&(e=0),r===void 0&&(r=xa);var n=-1;return t!=null&&(rr(t)?r=t:n=t),new H(function(o){var i=gr(e)?+e-r.now():e;i<0&&(i=0);var a=0;return r.schedule(function(){o.closed||(o.next(a++),0<=n?this.schedule(void 0,n):o.complete())},i)})}function vt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=nr(e),n=Sa(e,1/0),o=e;return o.length?o.length===1?G(o[0]):hr(n)(vr(o,r)):Re}function oe(e,t){return N(function(r,n){var o=0;r.subscribe(U(n,function(i){return e.call(t,i,o++)&&n.next(i)}))})}function Qn(e){return N(function(t,r){var n=[];return t.subscribe(U(r,function(o){return n.push(o)},function(){r.next(n),r.complete()})),G(e).subscribe(U(r,function(){var o=n;n=[],r.next(o)},Ae)),function(){n=null}})}function zn(e,t){return t===void 0&&(t=Pe),N(function(r,n){var o=null,i=null,a=null,u=function(){if(o){o.unsubscribe(),o=null;var c=i;i=null,n.next(c)}};function s(){var c=a+e,l=t.now();if(l<c){o=this.schedule(void 0,c-l),n.add(o);return}u()}r.subscribe(U(n,function(c){i=c,a=t.now(),o||(o=t.schedule(s,e),n.add(o))},function(){u(),n.complete()},void 0,function(){i=o=null}))})}function je(e){return e<=0?function(){return Re}:N(function(t,r){var n=0;t.subscribe(U(r,function(o){++n<=e&&(r.next(o),e<=n&&r.complete())}))})}function Va(){return N(function(e,t){e.subscribe(U(t,Ae))})}function Ba(e){return X(function(){return e})}function Zn(e,t){return t?function(r){return Na(t.pipe(je(1),Va()),r.pipe(Zn(e)))}:De(function(r,n){return G(e(r,n)).pipe(je(1),Ba(r))})}function Jn(e,t){t===void 0&&(t=Pe);var r=Fa(e,t);return Zn(function(){return r})}function eo(){return N(function(e,t){var r,n=!1;e.subscribe(U(t,function(o){var i=r;r=o,n&&t.next([i,o]),n=!0}))})}function to(e,t){return N(function(r,n){var o=null,i=0,a=!1,u=function(){return a&&!o&&n.complete()};r.subscribe(U(n,function(s){o?.unsubscribe();var c=0,l=i++;G(e(s,l)).subscribe(o=U(n,function(f){return n.next(t?t(s,f,l,c++):f)},function(){o=null,u()}))},function(){a=!0,u()}))})}var fe,no;function ja(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return"html";var r={root:document.body,idName:function(i){return!0},className:function(i){return!0},tagName:function(i){return!0},attr:function(i,a){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};fe=b(b({},r),t),no=Wu(fe.root,r);var n=yr(e,"all",function(){return yr(e,"two",function(){return yr(e,"one",function(){return yr(e,"none")})})});if(n){var o=$a(Ya(n,e));return o.length>0&&(n=o[0]),Tr(n)}else throw new Error("Selector was not found.")}function Wu(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function yr(e,t,r){for(var n=null,o=[],i=e,a=0,u=function(){var c,l,f=_r(Ku(i))||_r.apply(void 0,D([],I($u(i)),!1))||_r.apply(void 0,D([],I(Yu(i)),!1))||_r(Xu(i))||[qa()],d=Qu(i);if(t=="all")d&&(f=f.concat(f.filter(ro).map(function(g){return Er(g,d)})));else if(t=="two")f=f.slice(0,1),d&&(f=f.concat(f.filter(ro).map(function(g){return Er(g,d)})));else if(t=="one"){var p=I(f=f.slice(0,1),1),m=p[0];d&&ro(m)&&(f=[Er(m,d)])}else t=="none"&&(f=[qa()],d&&(f=[Er(f[0],d)]));try{for(var E=(c=void 0,O(f)),x=E.next();!x.done;x=E.next()){var m=x.value;m.level=a}}catch(g){c={error:g}}finally{try{x&&!x.done&&(l=E.return)&&l.call(E)}finally{if(c)throw c.error}}if(o.push(f),o.length>=fe.seedMinLength&&(n=Ha(o,r),n))return"break";i=i.parentElement,a++};i;){var s=u();if(s==="break")break}return n||(n=Ha(o,r)),!n&&r?r():n}function Ha(e,t){var r,n,o=e.reduce(function(c,l){return c*l.length},1);if(o>fe.threshold)return t?t():null;var i=$a(Ka(e));try{for(var a=O(i),u=a.next();!u.done;u=a.next()){var s=u.value;if(Wa(s))return s}}catch(c){r={error:c}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return null}function Tr(e){for(var t=e[0],r=t.name,n=1;n<e.length;n++){var o=e[n].level||0;t.level===o-1?r="".concat(e[n].name," > ").concat(r):r="".concat(e[n].name," ").concat(r),t=e[n]}return r}function Ga(e){return e.map(function(t){return t.penalty}).reduce(function(t,r){return t+r},0)}function Wa(e){var t=Tr(e);switch(no.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function Ku(e){var t=e.getAttribute("id");return t&&fe.idName(t)?{name:"#"+CSS.escape(t),penalty:0}:null}function $u(e){var t=Array.from(e.attributes).filter(function(r){return fe.attr(r.name,r.value)});return t.map(function(r){return{name:"[".concat(CSS.escape(r.name),'="').concat(CSS.escape(r.value),'"]'),penalty:.5}})}function Yu(e){var t=Array.from(e.classList).filter(fe.className);return t.map(function(r){return{name:"."+CSS.escape(r),penalty:1}})}function Xu(e){var t=e.tagName.toLowerCase();return fe.tagName(t)?{name:t,penalty:2}:null}function qa(){return{name:"*",penalty:3}}function Qu(e){var t=e.parentNode;if(!t)return null;var r=t.firstChild;if(!r)return null;for(var n=0;r&&(r.nodeType===Node.ELEMENT_NODE&&n++,r!==e);)r=r.nextSibling;return n}function Er(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function ro(e){return e.name!=="html"&&!e.name.startsWith("#")}function _r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(zu);return r.length>0?r:null}function zu(e){return e!=null}function Ka(e,t){var r,n,o,i,a,u;return t===void 0&&(t=[]),h(this,function(s){switch(s.label){case 0:if(!(e.length>0))return[3,9];s.label=1;case 1:s.trys.push([1,6,7,8]),r=O(e[0]),n=r.next(),s.label=2;case 2:return n.done?[3,5]:(o=n.value,[5,O(Ka(e.slice(1,e.length),t.concat(o)))]);case 3:s.sent(),s.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return i=s.sent(),a={error:i},[3,8];case 7:try{n&&!n.done&&(u=r.return)&&u.call(r)}finally{if(a)throw a.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:s.sent(),s.label=11;case 11:return[2]}})}function $a(e){return D([],I(e),!1).sort(function(t,r){return Ga(t)-Ga(r)})}function Ya(e,t,r){var n,o,i;return r===void 0&&(r={counter:0,visited:new Map}),h(this,function(a){switch(a.label){case 0:if(!(e.length>2&&e.length>fe.optimizedMinLength))return[3,5];n=1,a.label=1;case 1:return n<e.length-1?r.counter>fe.maxNumberOfTries?[2]:(r.counter+=1,o=D([],I(e),!1),o.splice(n,1),i=Tr(o),r.visited.has(i)?[2]:Wa(o)&&Zu(o,t)?[4,o]:[3,4]):[3,5];case 2:return a.sent(),r.visited.set(i,!0),[5,O(Ya(o,t,r))];case 3:a.sent(),a.label=4;case 4:return n++,[3,1];case 5:return[2]}})}function Zu(e,t){return no.querySelector(Tr(e))===t}var Ju=["input","select","textarea"],br=function(e,t){return function(r,n){var o,i,a,u=e.pageUrlAllowlist,s=e.shouldTrackEventResolver,c=(i=(o=n?.tagName)===null||o===void 0?void 0:o.toLowerCase)===null||i===void 0?void 0:i.call(o);if(!c)return!1;if(s)return s(r,n);if(!tc(window.location.href,u))return!1;var l=String(n?.getAttribute("type"))||"";if(typeof l=="string")switch(l.toLowerCase()){case"hidden":return!1;case"password":return!1}if(t){var f=t.some(function(p){var m;return!!(!((m=n?.matches)===null||m===void 0)&&m.call(n,p))});if(!f)return!1}switch(c){case"input":case"select":case"textarea":return r==="change"||r==="click";default:{var d=(a=window?.getComputedStyle)===null||a===void 0?void 0:a.call(window,n);return d&&d.getPropertyValue("cursor")==="pointer"&&r==="click"?!0:r==="click"}}}},Xa=function(e){if(e==null)return!1;if(typeof e=="string"){var t=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(t.test((e||"").replace(/[- ]/g,"")))return!1;var r=/(^\\d{3}-?\\d{2}-?\\d{4}$)/;if(r.test(e))return!1}return!0},ec=function(e){return!!e&&e.nodeType===3},oo=function(e){var t,r,n,o=(r=(t=e?.tagName)===null||t===void 0?void 0:t.toLowerCase)===null||r===void 0?void 0:r.call(t),i=e instanceof HTMLElement?((n=e.getAttribute("contenteditable"))===null||n===void 0?void 0:n.toLowerCase())==="true":!1;return!Ju.includes(o)&&!i},xr=function(e){var t="";return oo(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach(function(r){var n="";ec(r)?r.textContent&&(n=r.textContent):n=xr(r),t+=n.split(/(\\s+)/).filter(Xa).join("").replace(/[\\r\\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}),t},io=function(e,t){var r,n,o="";try{return o=ja(e,{className:function(l){return l!==ft},maxNumberOfTries:1e3}),o}catch(l){if(t){var i=l;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var a=(n=(r=e?.tagName)===null||r===void 0?void 0:r.toLowerCase)===null||n===void 0?void 0:n.call(r);a&&(o=a);var u=e.getAttribute("id"),s=e.getAttribute("class");if(u)o="#".concat(u);else if(s){var c=s.split(" ").filter(function(l){return l!==ft}).join(".");c&&(o="".concat(o,".").concat(c))}return o},tc=function(e,t){return!t||!t.length?!0:t.some(function(r){return typeof r=="string"?e===r:e.match(r)})},Qa=function(e,t){return e.getAttributeNames().reduce(function(r,n){if(n.startsWith(t)){var o=n.replace(t,""),i=e.getAttribute(n);o&&(r[o]=i||"")}return r},{})},rc=function(e){return e==null||typeof e=="object"&&Object.keys(e).length===0||typeof e=="string"&&e.trim().length===0},ao=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return rc(n)||(t[r]=n),t},{})},so=function(e){var t=e.parentElement;if(!t)return"";var r;try{r=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch{r=null}if(r){var n=r.textContent||"";return Xa(n)?n:""}return so(t)};var gt=function(e,t){return e?t.some(function(r){var n;return(n=e?.matches)===null||n===void 0?void 0:n.call(e,r)})?e:gt(e?.parentElement,t):null},za=function(e,t){var r,n,o;if(!e)return{};var i=(o=(n=e?.tagName)===null||n===void 0?void 0:n.toLowerCase)===null||o===void 0?void 0:o.call(n),a=io(e,t),u=(r={},r[Wt]=i,r[Kt]=xr(e),r[$t]=a,r[Yt]=window.location.href.split("?")[0],r);return ao(u)},Za=function(e){return new Promise(function(t,r){var n;try{var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=e,o.addEventListener("load",function(){t({status:!0})},{once:!0}),o.addEventListener("error",function(){r({status:!1,message:"Failed to load the script ".concat(e)})}),(n=document.head)===null||n===void 0||n.appendChild(o)}catch(i){r(i)}})};function Ja(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}var We=function(e){return!(e.event.target===null||!e.closestTrackedAncestor)};var es=function(){function e(t){var r=t===void 0?{}:t,n=r.origin,o=n===void 0?lt:n,i=this;this.endpoint=lt,this.requestCallbacks={},this.onSelect=function(a){i.notify({action:"element-selected",data:a})},this.onTrack=function(a,u){a==="selector-mode-changed"?i.notify({action:"track-selector-mode-changed",data:u}):a==="selector-moved"&&i.notify({action:"track-selector-moved",data:u})},this.endpoint=o}return e.prototype.notify=function(t){var r,n,o,i;(n=(r=this.logger)===null||r===void 0?void 0:r.debug)===null||n===void 0||n.call(r,"Message sent: ",JSON.stringify(t)),(i=(o=window.opener)===null||o===void 0?void 0:o.postMessage)===null||i===void 0||i.call(o,t,this.endpoint)},e.prototype.sendRequest=function(t,r,n){var o=this;n===void 0&&(n={timeout:15e3});var i=Ja(),a={id:i,action:t,args:r},u=new Promise(function(s,c){o.requestCallbacks[i]={resolve:s,reject:c},o.notify(a),n?.timeout>0&&setTimeout(function(){c(new Error("".concat(t," timed out (id: ").concat(i,")"))),delete o.requestCallbacks[i]},n.timeout)});return u},e.prototype.handleResponse=function(t){var r;if(!this.requestCallbacks[t.id]){(r=this.logger)===null||r===void 0||r.warn("No callback found for request id: ".concat(t.id));return}this.requestCallbacks[t.id].resolve(t.responseData),delete this.requestCallbacks[t.id]},e.prototype.setup=function(t){var r=this,n=t===void 0?{}:t,o=n.logger,i=n.endpoint,a=n.isElementSelectable,u=n.cssSelectorAllowlist,s=n.actionClickAllowlist;this.logger=o,i&&this.endpoint===lt&&(this.endpoint=i);var c=null;window.addEventListener("message",function(l){var f,d,p,m,E;if((d=(f=r.logger)===null||f===void 0?void 0:f.debug)===null||d===void 0||d.call(f,"Message received: ",JSON.stringify(l)),r.endpoint===l.origin){var x=l?.data,g=x?.action;if(g)if("id"in x)(m=(p=r.logger)===null||p===void 0?void 0:p.debug)===null||m===void 0||m.call(p,"Received Response to previous request: ",JSON.stringify(l)),r.handleResponse(x);else if(g==="ping")r.notify({action:"pong"});else if(g==="initialize-visual-tagging-selector"){var v=x?.data;Za(la).then(function(){var _;c=(_=window?.amplitudeVisualTaggingSelector)===null||_===void 0?void 0:_.call(window,{getEventTagProps:za,isElementSelectable:function(T){return a?a(v?.actionType||"click",T):!0},onTrack:r.onTrack,onSelect:r.onSelect,visualHighlightClass:ft,messenger:r,cssSelectorAllowlist:u,actionClickAllowlist:s}),r.notify({action:"selector-loaded"})}).catch(function(){var _;(_=r.logger)===null||_===void 0||_.warn("Failed to initialize visual tagging selector")})}else g==="close-visual-tagging-selector"&&((E=c?.close)===null||E===void 0||E.call(c))}}),this.notify({action:"page-loaded"})},e}();var nc=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],oc=["type"],ic=["svg","path","g"],ac=["password","hidden"],sc=128,uc=1024;function cc(e){var t,r,n,o,i,a;if(e===null)return null;var u=String(e.tagName).toLowerCase(),s={tag:u},c=Array.from((o=(n=e.parentElement)===null||n===void 0?void 0:n.children)!==null&&o!==void 0?o:[]);c.length&&(s.index=c.indexOf(e),s.indexOfType=c.filter(function(T){return T.tagName===e.tagName}).indexOf(e));var l=(a=(i=e.previousElementSibling)===null||i===void 0?void 0:i.tagName)===null||a===void 0?void 0:a.toLowerCase();l&&(s.prevSib=String(l));var f=e.getAttribute("id");f&&(s.id=String(f));var d=Array.from(e.classList);d.length&&(s.classes=d);var p={},m=Array.from(e.attributes),E=m.filter(function(T){return!nc.includes(T.name)}),x=!oo(e);if(!ac.includes(String(e.getAttribute("type")))&&!ic.includes(u))try{for(var g=O(E),v=g.next();!v.done;v=g.next()){var _=v.value;x&&!oc.includes(_.name)||(p[_.name]=String(_.value).substring(0,sc))}}catch(T){t={error:T}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(t)throw t.error}}return Object.keys(p).length&&(s.attrs=p),s}function lc(e){var t=[];if(!e)return t;t.push(e);for(var r=e.parentElement;r&&r.tagName!=="HTML";)t.push(r),r=r.parentElement;return t}var ts=function(e){var t=[];if(!e)return[];var r=lc(e);return t=fc(r.map(function(n){return cc(n)}),uc),t};function fc(e,t){for(var r=0,n=0;n<e.length;n++){var o=e[n];if(o===null)r+=4;else{var i=Ir(o);r+=i?Array.from(i).length:4}if(r>t)return e.slice(0,n)}return e}function Ir(e,t){t===void 0&&(t=!1);try{if(e==null)return t?"None":null;if(typeof e=="string")return t?(e=e.replace(/\\\\/g,"\\\\\\\\").replace(/\\n/g,"\\\\n").replace(/\\t/g,"\\\\t").replace(/\\r/g,"\\\\r"),e.includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\\\'"),'"'):"'".concat(e,"'")):e;if(typeof e=="boolean")return e?"True":"False";if(Array.isArray(e)){var r=e.map(function(i){return Ir(i,!0)});return"[".concat(r.join(", "),"]")}else if(typeof e=="object"){var n=Object.entries(e).filter(function(i){var a=I(i,1),u=a[0];return u!=null}).map(function(i){var a=I(i,2),u=a[0],s=a[1];return"".concat(String(Ir(u,!0)),": ").concat(String(Ir(s,!0)))}),o="{".concat(n.join(", "),"}");return o.includes("\\\\'")&&(o=o.replace(/'/g,"'").replace(/'/g,"\\\\'")),o}return e.toString()}catch{return null}}var dc=5;function rs(e){var t=e.amplitude,r=e.allObservables,n=e.options,o=e.shouldTrackEvent,i=r.clickObservable,a=i.pipe(eo(),oe(function(l){var f=I(l,2),d=f[0],p=f[1],m=d.event.target!==p.event.target,E=Math.abs(p.event.screenX-d.event.screenX)<=20&&Math.abs(p.event.screenY-d.event.screenY)<=20;return m&&!E})),u=i.pipe(zn(n.debounceTime),X(function(){return"timeout"})),s=vt(a,u),c=i.pipe(Jn(0),oe(We),oe(function(l){return o("click",l.closestTrackedAncestor)}),Qn(s));return c.subscribe(function(l){var f,d,p=l.length>=dc?ct:ct;try{for(var m=O(l),E=m.next();!E.done;E=m.next()){var x=E.value;t?.track(p,x.targetElementProperties)}}catch(g){f={error:g}}finally{try{E&&!E.done&&(d=m.return)&&d.call(m)}finally{if(f)throw f.error}}})}function ns(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,o=e.shouldTrackEvent,i=r.changeObservable,a=i.pipe(oe(We),oe(function(u){return o("change",u.closestTrackedAncestor)}));return a.subscribe(function(u){t?.track(Qi,n("change",u.closestTrackedAncestor))})}function os(e){var t=e.amplitude,r=e.allObservables,n=e.options,o=e.getEventProperties,i=e.shouldTrackEvent,a=e.shouldTrackActionClick,u=r.clickObservable,s=r.mutationObservable,c=r.navigateObservable,l=u.pipe(oe(function(m){return!i("click",m.closestTrackedAncestor)}),X(function(m){var E=gt(m.event.target,n.actionClickAllowlist);return m.closestTrackedAncestor=E,m.closestTrackedAncestor!==null&&(m.targetElementProperties=o(m.type,m.closestTrackedAncestor)),m}),oe(We),oe(function(m){return a("click",m.closestTrackedAncestor)})),f=[s];c&&f.push(c);var d=vt.apply(void 0,D([],I(f),!1)),p=l.pipe(to(function(m){return d.pipe(je(1),Xn({first:500,with:function(){return Re}}),X(function(){return m}))}));return p.subscribe(function(m){t?.track(ct,o("click",m.closestTrackedAncestor))})}var Ke;(function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"})(Ke||(Ke={}));function pc(e){return e.type==="click"||e.type==="change"}var Sr=function(e){var t,r,n;e===void 0&&(e={});var o=e.dataAttributePrefix,i=o===void 0?Gn:o,a=e.visualTaggingOptions,u=a===void 0?{enabled:!0,messenger:new es}:a;e.cssSelectorAllowlist=(t=e.cssSelectorAllowlist)!==null&&t!==void 0?t:Hn,e.actionClickAllowlist=(r=e.actionClickAllowlist)!==null&&r!==void 0?r:qn,e.debounceTime=(n=e.debounceTime)!==null&&n!==void 0?n:0;var s=Xi,c="enrichment",l=[],f=void 0,d=function(){var v,_=Oe(document,"click",{capture:!0}).pipe(X(function(L){return m(L,"click")})),T=Oe(document,"change",{capture:!0}).pipe(X(function(L){return m(L,"change")})),A;window.navigation&&(A=Oe(window.navigation,"navigate").pipe(X(function(L){return m(L,"navigate")})));var S=new H(function(L){var w=new MutationObserver(function(R){L.next(R)});return w.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return w.disconnect()}}).pipe(X(function(L){return m(L,"mutation")}));return v={},v[Ke.ClickObservable]=_,v[Ke.ChangeObservable]=T,v[Ke.NavigateObservable]=A,v[Ke.MutationObservable]=S,v},p=function(v,_){var T,A,S,L=(S=(A=_?.tagName)===null||A===void 0?void 0:A.toLowerCase)===null||S===void 0?void 0:S.call(A),w=typeof _.getBoundingClientRect=="function"?_.getBoundingClientRect():{left:null,top:null},R=_.getAttribute("aria-label"),Z=Qa(_,i),J=so(_),Q=io(_,f),ee=(T={},T[zi]=_.getAttribute("id")||"",T[Zi]=_.getAttribute("class"),T[Ji]=ts(_),T[Wt]=L,T[Kt]=xr(_),T[ta]=w.left==null?null:Math.round(w.left),T[ra]=w.top==null?null:Math.round(w.top),T[na]=R,T[oa]=Z,T[$t]=Q,T[ia]=J,T[Yt]=window.location.href.split("?")[0],T[aa]=typeof document<"u"&&document.title||"",T[sa]=window.innerHeight,T[ua]=window.innerWidth,T);return L==="a"&&v==="click"&&_ instanceof HTMLAnchorElement&&(ee[ea]=_.href),ao(ee)},m=function(v,_){var T={event:v,timestamp:Date.now(),type:_};if(pc(T)&&T.event.target!==null){var A=gt(T.event.target,e.cssSelectorAllowlist);return A&&(T.closestTrackedAncestor=A,T.targetElementProperties=p(T.type,A)),T}return T},E=function(v,_){return y(void 0,void 0,void 0,function(){var T,A,S,L,w,R,Z,J,Q,ee;return h(this,function(pe){return f=v.loggerProvider,typeof document>"u"?[2]:(T=br(e,e.cssSelectorAllowlist),A=br(e,e.actionClickAllowlist),S=d(),L=rs({allObservables:S,options:e,amplitude:_,shouldTrackEvent:T}),l.push(L),w=ns({allObservables:S,getEventProperties:p,amplitude:_,shouldTrackEvent:T}),l.push(w),R=os({allObservables:S,options:e,getEventProperties:p,amplitude:_,shouldTrackEvent:T,shouldTrackActionClick:A}),l.push(R),(Q=v?.loggerProvider)===null||Q===void 0||Q.log("".concat(s," has been successfully added.")),window.opener&&u.enabled&&(Z=e.cssSelectorAllowlist,J=e.actionClickAllowlist,(ee=u.messenger)===null||ee===void 0||ee.setup(b(b({logger:v?.loggerProvider},v?.serverZone&&{endpoint:ca[v.serverZone]}),{isElementSelectable:br(e,D(D([],I(Z),!1),I(J),!1)),cssSelectorAllowlist:Z,actionClickAllowlist:J}))),[2])})})},x=function(v){return y(void 0,void 0,void 0,function(){return h(this,function(_){return[2,v]})})},g=function(){return y(void 0,void 0,void 0,function(){var v,_,T,A,S;return h(this,function(L){try{for(v=O(l),_=v.next();!_.done;_=v.next())T=_.value,T.unsubscribe()}catch(w){A={error:w}}finally{try{_&&!_.done&&(S=v.return)&&S.call(v)}finally{if(A)throw A.error}}return[2]})})};return{name:s,type:c,setup:E,execute:x,teardown:g}};var is="utm_campaign",as="utm_content",ss="utm_id",us="utm_medium",cs="utm_source",ls="utm_term",uo="dclid",co="fbclid",lo="gbraid",fo="gclid",po="ko_click_id",mo="li_fat_id",vo="msclkid",go="rtd_cid",ho="ttclid",yo="twclid",Eo="wbraid";var $e={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 fs=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},mc=function(e){return Object.values(e).every(function(t){return!t})},ds=function(e,t,r,n,o){o===void 0&&(o=!0);var i=e.referrer,a=e.referring_domain,u=ze(e,["referrer","referring_domain"]),s=t||{},c=s.referrer,l=s.referring_domain,f=ze(s,["referrer","referring_domain"]);if(vc(r.excludeReferrers,e.referring_domain))return n.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!o&&mc(e)&&t)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var d=JSON.stringify(u)!==JSON.stringify(f),p=fs(a||"")!==fs(l||""),m=!t||d||p;return m?n.debug("This is a new campaign. An $identify event will be sent."):n.debug("This is not a new campaign because it's the same as the previous one."),m},vc=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=""),e.some(function(r){return r instanceof RegExp?r.test(t):r===t})},ps=function(e,t){var r=b(b({},$e),e),n=Object.entries(r).reduce(function(o,i){var a,u=I(i,2),s=u[0],c=u[1];return o.setOnce("initial_".concat(s),(a=c??t.initialEmptyValue)!==null&&a!==void 0?a:"EMPTY"),c?o.set(s,c):o.unset(s)},new ae);return Ze(n)},ms=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\\\."),"$"))]):[]};var vs=function(){function e(){}return e.prototype.parse=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return[2,b(b(b(b({},$e),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var t=ye(),r=t[is],n=t[as],o=t[ss],i=t[us],a=t[cs],u=t[ls];return{utm_campaign:r,utm_content:n,utm_id:o,utm_medium:i,utm_source:a,utm_term:u}},e.prototype.getReferrer=function(){var t,r,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=(r=(t=n.referrer)===null||t===void 0?void 0:t.split("/")[2])!==null&&r!==void 0?r:void 0}catch{}return n},e.prototype.getClickIds=function(){var t,r=ye();return t={},t[uo]=r[uo],t[co]=r[co],t[lo]=r[lo],t[fo]=r[fo],t[po]=r[po],t[mo]=r[mo],t[vo]=r[vo],t[go]=r[go],t[ho]=r[ho],t[yo]=r[yo],t[Eo]=r[Eo],t},e}();var gs=function(){function e(t,r){var n;this.shouldTrackNewCampaign=!1,this.options=b({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:ms((n=r.cookieOptions)===null||n===void 0?void 0:n.domain)},t),this.storage=r.cookieStorage,this.storageKey=fn(r.apiKey,"MKTG"),this.currentCampaign=$e,this.sessionTimeout=r.sessionTimeout,this.lastEventTime=r.lastEventTime,this.logger=r.loggerProvider,r.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return y(this,void 0,void 0,function(){var t,r;return h(this,function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return r=I.apply(void 0,[n.sent(),2]),this.currentCampaign=r[0],this.previousCampaign=r[1],t=this.lastEventTime?rt(this.sessionTimeout,this.lastEventTime):!0,ds(this.currentCampaign,this.previousCampaign,this.options,this.logger,t)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return y(this,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return[4,Promise.all([new vs().parse(),this.storage.get(this.storageKey)])];case 1:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(t){this.shouldTrackNewCampaign=!1;var r=ps(this.currentCampaign,this.options);return t&&(r.event_id=t),r},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}();var hs=function(e){k(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(r,n,o){r===void 0&&(r="");var i,a;return arguments.length>2?(i=n,a=o):typeof n=="string"?(i=n,a=void 0):(i=n?.userId,a=n),Y(this._init(b(b({},a),{userId:i,apiKey:r})))},t.prototype._init=function(r){return y(this,void 0,void 0,function(){var n,o,i,a,u,s,c=this,l,f,d;return h(this,function(p){switch(p.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Ci(r.apiKey,r,this)]);case 1:return n=p.sent(),r.fetchRemoteConfig?[4,Yi(n)]:[3,4];case 2:return o=p.sent(),[4,o.generateJoinedConfig()];case 3:n=p.sent(),p.label=4;case 4:return[4,e.prototype._init.call(this,n)];case 5:return p.sent(),this.logBrowserOptions(n),mn(this.config.defaultTracking)?(i=pi(this.config),this.webAttribution=new gs(i,this.config),[4,this.webAttribution.init()]):[3,7];case 6:p.sent(),p.label=7;case 7:return a=ye(),u=Number.isNaN(Number(a.ampSessionId))?void 0:Number(a.ampSessionId),this.setSessionId((d=(f=(l=r.sessionId)!==null&&l!==void 0?l:u)!==null&&f!==void 0?f:this.config.sessionId)!==null&&d!==void 0?d:Date.now()),s=he(r.instanceName),s.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===pn?[3,9]:[4,this.add(qi()).promise];case 8:p.sent(),p.label=9;case 9:return[4,this.add(new on).promise];case 10:return p.sent(),[4,this.add(new gi).promise];case 11:return p.sent(),[4,this.add(new un).promise];case 12:return p.sent(),Gi(this.config),ci(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Bi()).promise]):[3,14];case 13:p.sent(),p.label=14;case 14:return li(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Vi()).promise]):[3,16];case 15:p.sent(),p.label=16;case 16:return vn(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Vn(di(this.config))).promise]):[3,18];case 17:p.sent(),p.label=18;case 18:return hn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Sr(fi(this.config))).promise]):[3,20];case 19:p.sent(),p.label=20;case 20:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 21:return p.sent(),s.eventBridge.setEventReceiver(function(m){c.track(m.eventType,m.eventProperties)}),[2]}})})},t.prototype.getUserId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.userId},t.prototype.setUserId=function(r){if(!this.config){this.q.push(this.setUserId.bind(this,r));return}this.config.loggerProvider.debug("function setUserId: ",r),(r!==this.config.userId||r===void 0)&&(this.config.userId=r,an(r,this.config.instanceName))},t.prototype.getDeviceId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.deviceId},t.prototype.setDeviceId=function(r){if(!this.config){this.q.push(this.setDeviceId.bind(this,r));return}this.config.loggerProvider.debug("function setDeviceId: ",r),this.config.deviceId=r,sn(r,this.config.instanceName)},t.prototype.reset=function(){this.setDeviceId(re()),this.setUserId(void 0)},t.prototype.getSessionId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.sessionId},t.prototype.setSessionId=function(r){var n,o=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,r)),Y(Promise.resolve());if(r===this.config.sessionId)return Y(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",r);var i=this.getSessionId(),a=this.config.lastEventTime,u=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1;this.config.sessionId=r,this.config.lastEventTime=void 0,this.config.pageCounter=0,gn(this.config.defaultTracking)&&(i&&a&&o.push(this.track(bn,void 0,{device_id:this.previousSessionDeviceId,event_id:++u,session_id:i,time:a+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++u,o);return gn(this.config.defaultTracking)&&o.push(this.track(Tn,void 0,{event_id:s?++u:u,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,Y(Promise.all(o))},t.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},t.prototype.setTransport=function(r){if(!this.config){this.q.push(this.setTransport.bind(this,r));return}this.config.transportProvider=xn(r)},t.prototype.identify=function(r,n){if(Vt(r)){var o=r._q;r._q=[],r=Ft(new ae,o)}return n?.user_id&&this.setUserId(n.user_id),n?.device_id&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,r,n)},t.prototype.groupIdentify=function(r,n,o,i){if(Vt(o)){var a=o._q;o._q=[],o=Ft(new ae,a)}return e.prototype.groupIdentify.call(this,r,n,o,i)},t.prototype.revenue=function(r,n){if(Vt(r)){var o=r._q;r._q=[],r=Ft(new Rt,o)}return e.prototype.revenue.call(this,r,n)},t.prototype.trackCampaignEventIfNeeded=function(r,n){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var o=this.webAttribution.generateCampaignEvent(r);return n?n.push(this.track(o).promise):this.track(o),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(r){return y(this,void 0,void 0,function(){var n,o,i;return h(this,function(a){return n=Date.now(),o=rt(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),r.event_type!==Tn&&r.event_type!==bn&&(!r.session_id||r.session_id===this.getSessionId())&&(o||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):o||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,r)]})})},t.prototype.logBrowserOptions=function(r){try{var n=b(b({},r),{apiKey:r.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(n))}catch(o){this.config.loggerProvider.error("Error logging browser config",o)}},t}(tn);var gc=function(){var e=new hs;return{init:B(e.init.bind(e),"init",F(e),V(e,["config"])),add:B(e.add.bind(e),"add",F(e),V(e,["config.apiKey","timeline.plugins"])),remove:B(e.remove.bind(e),"remove",F(e),V(e,["config.apiKey","timeline.plugins"])),track:B(e.track.bind(e),"track",F(e),V(e,["config.apiKey","timeline.queue.length"])),logEvent:B(e.logEvent.bind(e),"logEvent",F(e),V(e,["config.apiKey","timeline.queue.length"])),identify:B(e.identify.bind(e),"identify",F(e),V(e,["config.apiKey","timeline.queue.length"])),groupIdentify:B(e.groupIdentify.bind(e),"groupIdentify",F(e),V(e,["config.apiKey","timeline.queue.length"])),setGroup:B(e.setGroup.bind(e),"setGroup",F(e),V(e,["config.apiKey","timeline.queue.length"])),revenue:B(e.revenue.bind(e),"revenue",F(e),V(e,["config.apiKey","timeline.queue.length"])),flush:B(e.flush.bind(e),"flush",F(e),V(e,["config.apiKey","timeline.queue.length"])),getUserId:B(e.getUserId.bind(e),"getUserId",F(e),V(e,["config","config.userId"])),setUserId:B(e.setUserId.bind(e),"setUserId",F(e),V(e,["config","config.userId"])),getDeviceId:B(e.getDeviceId.bind(e),"getDeviceId",F(e),V(e,["config","config.deviceId"])),setDeviceId:B(e.setDeviceId.bind(e),"setDeviceId",F(e),V(e,["config","config.deviceId"])),reset:B(e.reset.bind(e),"reset",F(e),V(e,["config","config.userId","config.deviceId"])),getSessionId:B(e.getSessionId.bind(e),"getSessionId",F(e),V(e,["config"])),setSessionId:B(e.setSessionId.bind(e),"setSessionId",F(e),V(e,["config"])),extendSession:B(e.extendSession.bind(e),"extendSession",F(e),V(e,["config"])),setOptOut:B(e.setOptOut.bind(e),"setOptOut",F(e),V(e,["config"])),setTransport:B(e.setTransport.bind(e),"setTransport",F(e),V(e,["config"]))}},q=gc();var Dr={};Ms(Dr,{DEFAULT_ACTION_CLICK_ALLOWLIST:()=>Ts,DEFAULT_CSS_SELECTOR_ALLOWLIST:()=>Es,DEFAULT_DATA_ATTRIBUTE_PREFIX:()=>_s,IdentifyOperation:()=>Lr,LogLevel:()=>Cr,OfflineDisabled:()=>ys,RevenueProperty:()=>wr,ServerZone:()=>Pr,SpecialEventType:()=>Ar,Status:()=>Rr});var Lr;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(Lr||(Lr={}));var wr;(function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"})(wr||(wr={}));var Ar;(function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"})(Ar||(Ar={}));var Cr;(function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"})(Cr||(Cr={}));var Pr;(function(e){e.US="US",e.EU="EU"})(Pr||(Pr={}));var Rr;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"})(Rr||(Rr={}));var ys=null;var Es=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],_s="data-amp-track-",Ts=["div","span","h1","h2","h3","h4","h5","h6"];var zE=q.add,ZE=q.extendSession,JE=q.flush,e_=q.getDeviceId,t_=q.getSessionId,r_=q.getUserId,n_=q.groupIdentify,bs=q.identify,xs=q.init,o_=q.logEvent,i_=q.remove,a_=q.reset,s_=q.revenue,u_=q.setDeviceId,c_=q.setGroup,l_=q.setOptOut,f_=q.setSessionId,d_=q.setTransport,p_=q.setUserId,Ee=q.track;var ie=e=>{window.dispatchEvent(new CustomEvent("builderdevtools",{detail:{eventName:e}}))};async function hc(){return Fo()}var Is=async()=>{let e=new URL(window.location.href),t=e.hash,r=\`#\${wo}=\`,n=Math.random().toString(36).substring(2,15),o=await hc();xs("f1d2eb79aecd01b28c8a371ea5d1751c",o?.userId||n,{logLevel:Dr.LogLevel.None,serverUrl:Po,flushIntervalMillis:500});let i=new ae;bs(i,{device_id:o?.deviceId,user_id:o?.userId||n});let a="anonymous";t.startsWith(r)&&(a=t.slice(r.length),a&&(yc(a),e.hash="",window.history.replaceState({},"",e.href))),ie("init")};var yc=e=>{if(typeof e=="string"&&e.length>0){let t=yt();ht({...t,builderUserId:e})}},yt=()=>{let e=localStorage.getItem(Ss);if(e)try{let t=JSON.parse(e);return(!t.ctas||typeof t.ctas!="object")&&(t=ht({...t,ctas:{}})),t.menuOpenedTs&&(t=ht({...t,ctas:{...t.ctas,menuOpened:t.menuOpenedTs}}),delete t.menuOpenedTs),t}catch(t){console.error(t)}return ht({firstVisitTs:Date.now(),ctas:{},builderUserId:""})},ht=e=>{try{localStorage.setItem(Ss,JSON.stringify(e))}catch(t){console.error(t)}return e},_o=e=>!!yt().ctas[e],To=e=>{let t=yt();return ht({...t,ctas:{...t.ctas,[e]:Date.now()}})},Ss="builderDevtools";function Ls(e){Ec(e),_c(e),Tc(e),bc(e)}function Ec(e){let t=e.getElementById("input-register");t.addEventListener("change",async r=>{r.stopPropagation();let n=e.getElementById("input-name"),o=e.querySelector(".nav-cmp-input");o.classList.add("input-loading"),o.classList.remove("input-enabled");let i=n.dataset.id,a=n.dataset.prop,u=await xt({cmpId:i,name:a,registerInput:t.checked});ie("registryUpdate"),me(u),Et(e,i,a),_e(e,i),o.classList.remove("input-loading")})}function _c(e){e.getElementById("input-open-source").addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let n=r.target,o=j.components.find(i=>i.id===n?.dataset.id);o&&Ue({filePath:o.filePath})})}function Tc(e){let t=e.getElementById("input-name"),r=t.closest(".ui-text-input"),n="",o;t.addEventListener("focus",i=>{clearTimeout(o),r.classList.remove("saved"),i.stopPropagation(),n=t.value}),t.addEventListener("blur",async i=>{if(i.stopPropagation(),clearTimeout(o),r.classList.remove("saved"),t.value!==n){if(t.value.trim().length<3){t.value=n;return}r.classList.add("saved"),o=setTimeout(()=>{r.classList.remove("saved")},3e3);let a=t.dataset.id,u=t.dataset.prop,s=await xt({cmpId:a,name:u,friendlyName:t.value});ie("registryUpdate"),me(s),de(e),_e(e,a),Et(e,a,u)}}),t.addEventListener("keyup",i=>{i.stopPropagation(),clearTimeout(o),r.classList.remove("saved"),i.key==="Escape"?(t.value=n,t.blur()):i.key==="Enter"&&t.blur()})}function bc(e){let t=e.getElementById("input-type");t.addEventListener("change",async r=>{r.stopPropagation();let n=t.dataset.id,o=t.dataset.prop,i=await xt({cmpId:n,name:o,type:t.value});ie("registryUpdate"),me(i),de(e),_e(e,n),Et(e,n,o)})}function Et(e,t,r){let n=j.components.find(d=>d.id===t);if(!n)return null;let o=n.inputs.find(d=>d.name===r);if(!o)return null;let i=e.querySelector(".nav-cmp-input");o.isRegistered?i.classList.add("input-enabled"):i.classList.remove("input-enabled");let a=e.getElementById("input-register");a.checked=!!o.isRegistered;let u=e.getElementById("cmp-input-title");u.innerText=n.name+": "+(o.friendlyName||o.name);let s=e.getElementById("input-open-source");s.innerText=\`Open \${n.displayFilePath}\`,s.dataset.id=n.id;let c=e.getElementById("cmp-prop-name");c.innerText=o.name;let l=e.getElementById("cmp-prop-type");l.innerText=Ct(o.type);let f=e.getElementById("input-name");return f.dataset.id=n.id,f.dataset.prop=o.name,f.value=o.friendlyName||o.name,xc(e,n,o),o}function xc(e,t,r){let n=e.getElementById("input-type");n.dataset.id=t.id,n.dataset.prop=r.name,n.innerHTML="";let o=r.type,i=It.includes(o),a=St.includes(o),u=Lt.includes(o),s=wt.includes(o),c=At.includes(o);Vo.forEach(l=>{let f=document.createElement("option");f.value=l.value,f.innerText=l.text,f.disabled=It.includes(l.value)&&!i||St.includes(l.value)&&!a||Lt.includes(l.value)&&!u||wt.includes(l.value)&&!s||At.includes(l.value)&&!c,n.appendChild(f)}),n.value=o}function ws(e){Ic(e),Sc(e),Lc(e),Ac(e),wc(e)}function Ic(e){e.getElementById("cmp-register").addEventListener("change",r=>{r.stopPropagation(),Or(e,"update")})}async function Or(e,t){let r=e.querySelector(".nav-cmp-detail"),n=e.getElementById("cmp-error"),o=e.getElementById("cmp-register"),i=o.closest(".ui-switch");r.classList.remove("cmp-enabled"),o.checked&&r.classList.add("cmp-loading");try{let a=o.dataset.id,u;t==="load"?u=await Oo({cmpId:a}):o.checked?(u=await ko({cmpId:a}),ie("registryUpdate"),Ee("interaction",{type:"click",name:"register component",detail:a})):(u=await No({cmpId:a}),ie("registryUpdate"),Ee("interaction",{type:"click",name:"unregister component",detail:a})),me(u),de(e);let s=_e(e,a);t==="update"&&s&&(o.checked?(r.classList.add("cmp-enabled"),Yr(e,\`<strong>\${s.name}</strong> is now registered in <strong>\${j.registryDisplayPath}</strong> and available for use in the Builder Visual Editor\`)):Yr(e,\`<strong>\${s.name}</strong> has been unregistered from <strong>\${j.registryDisplayPath}</strong> and removed from the Builder Visual Editor\`))}catch(a){console.error(a),n.innerHTML=\`<p class="error">Error loading components</p><p class="error">\${a.message||a}</p>\`,i.style.display="none"}r.classList.remove("cmp-loading")}function Sc(e){let t=e.getElementById("cmp-name"),r=t.closest(".ui-text-input"),n="",o;t.addEventListener("focus",i=>{clearTimeout(o),r.classList.remove("saved"),i.stopPropagation(),n=t.value}),t.addEventListener("blur",async i=>{if(i.stopPropagation(),clearTimeout(o),r.classList.remove("saved"),t.value!==n){if(t.value.trim().length<3){t.value=n;return}r.classList.add("saved"),o=setTimeout(()=>{r.classList.remove("saved")},3e3);let a=t.dataset.id,u=await Uo({cmpId:a,name:t.value});ie("registryUpdate"),me(u),de(e),_e(e,a)}}),t.addEventListener("keyup",i=>{i.stopPropagation(),clearTimeout(o),r.classList.remove("saved"),i.key==="Escape"?(t.value=n,t.blur()):i.key==="Enter"&&t.blur()})}function _e(e,t){let r=j.components.find(l=>l.id===t);if(!r)return null;let n=e.getElementById("cmp-register"),o=e.getElementById("cmp-error"),i=n.closest(".ui-switch");i.style.display="",o.innerHTML="",n.dataset.id=r.id,n.checked=!!r.isRegistered;let a=e.querySelector(".nav-cmp-detail");r.isRegistered?a.classList.add("cmp-enabled"):a.classList.remove("cmp-enabled");let u=e.getElementById("cmp-name");u.dataset.id=r.id,u.value=r.name;let s=e.getElementById("cmp-open-source");s.innerText=\`Open \${r.displayFilePath}\`,s.dataset.id=r.id;let c=e.getElementById("cmp-detail-title");return c.innerText=\`\${r.name} Component\`,Cc(e,r),r}function Lc(e){e.getElementById("cmp-open-source").addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let n=r.target,o=j.components.find(i=>i.id===n?.dataset.id);o&&(Ue({filePath:o.filePath}),Ee("interaction",{type:"click",name:"open component source file",detail:o.filePath}))})}function wc(e){e.getElementById("btn-inputs-reload").addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),Or(e,"load")})}function Ac(e){e.getElementById("cmp-detail-inputs").addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let o=r.target?.closest("button"),i=o?.dataset.id,a=o?.dataset.propName;Et(e,i,a)&&ue(e,"nav-cmp-input")})}function Cc(e,t){let r=e.getElementById("cmp-detail-inputs"),n=t.inputs.filter(o=>!o.hideFromUI);n.length>0?(r.innerHTML="",n.forEach(o=>{r.appendChild(Pc(t,o))})):r.innerHTML=\`<p class="cmp-inputs-empty">\${t.name} component does not have any props</p>\`}function Pc(e,t){let r=document.createElement("button");r.dataset.id=e.id,r.dataset.propName=t.name,r.className="cmp-input-item nav-list-item",t.isRegistered||r.classList.add("cmp-input-item-unregistered");let n=document.createElement("span"),o=Ct(t.type);n.className=\`nav-list-item-icon input-icon input-icon-\${o}\`,r.appendChild(n);let i=document.createElement("span");i.innerText=t.friendlyName||t.name,r.appendChild(i);let a=document.createElement("span");return a.className="nav-list-item-note",a.innerText=t.type,r.appendChild(a),r}function Ps(e){e.getElementById("open-builder-registry").addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),Ue({filePath:j.registryPath,line:1,column:1})}),e.getElementById("cmp-list").addEventListener("click",i=>{i.preventDefault(),i.stopPropagation();let u=i.target?.dataset.id,s=j.components.find(c=>c.id===u);if(s){let c=e.querySelector(".nav-cmp-detail .section-content");c.scrollTop=0,_e(e,s.id),ue(e,"nav-cmp-detail"),s.isRegistered&&Or(e,"load")}});let n=e.getElementById("component-search"),o=e.getElementById("clear-search");n?.addEventListener("input",i=>{let a=i.target.value.toLowerCase(),u=a?j.components.filter(s=>s.name.toLowerCase().includes(a)||s.displayFilePath?.toLowerCase().includes(a)):j.components;de(e,u),o.style.display=a?"flex":"none"}),o?.addEventListener("click",()=>{n.value="",de(e),o.style.display="none"}),n?.addEventListener("keydown",i=>{i.key==="Escape"&&(n.value="",de(e),o.style.display="none")})}function Rs(e){let t=Do();Rc(e,t)}async function Rc(e,t){let r=e.getElementById("cmp-list"),n=e.querySelector(".nav-cmp-list");n.classList.add("nav-loading");let o=e.getElementById("open-builder-registry");try{let i=await t;me(i),de(e),j.registryDisplayPath?o.innerText="Open "+i.registryDisplayPath:o.innerText=""}catch(i){r.innerHTML=\`<p class="error">Error loading components</p><p class="error">\${i.message||i}</p>\`,console.error(i)}n.classList.remove("nav-loading")}function de(e,t){let r=e.getElementById("cmp-list");r.innerHTML="";let n=t||j.components,o=n.filter(a=>a.isRegistered),i=n.filter(a=>!a.isRegistered);if(t&&t.length===0){let a=document.createElement("p");a.className="no-results",a.innerText="No matching components found",r.appendChild(a);return}As(r,"Registered Components",o),As(r,"Unregistered Components",i)}function As(e,t,r){if(r.length>0){let n=document.createElement("h4");n.innerText=t,e.appendChild(n),r.forEach(o=>{e.appendChild(Dc(o))})}}function Dc(e){let t=document.getElementById("component-search")?.value.toLowerCase(),r=document.createElement("button");r.dataset.id=e.id,r.className="cmp-item nav-list-item",e.isRegistered&&r.classList.add("registered");let n=document.createElement("span");n.className="nav-list-item-icon",e.image&&(n.style.backgroundImage=\`url(\${e.image})\`),r.appendChild(n);let o=document.createElement("span");o.className="nav-list-item-name",o.innerHTML=Cs(e.name,t),r.appendChild(o);let i=document.createElement("span");return i.className="nav-list-item-note",i.innerHTML=Cs(e.displayFilePath||"",t),r.appendChild(i),r}function Cs(e,t){if(!t)return e;let r=new RegExp(\`(\${t})\`,"gi");return e.replace(r,'<span class="search-highlight">$1</span>')}var Ds=e=>{e.querySelector(".menu-toggle").addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),Te(e,!0)}),e.getElementById("close").addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),Te(e,!1)}),e.getElementById("hit").addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),Te(e,!1)}),bo(e),e.addEventListener("click",t=>t.stopPropagation()),Oc(e)},Te=(e,t)=>{t?(document.body.classList.add("builder-no-scroll"),e.host.classList.add("show-builder-menu"),ie("menuOpen"),To("menuOpened"),Ee("interaction",{type:"click",name:"open dev-tools menu"})):(document.body.classList.remove("builder-no-scroll"),e.host.classList.remove("show-builder-menu"),ie("menuClose"),setTimeout(()=>{ue(e,"nav-home")},300)),Mo(t)},Oc=e=>{if(!_o("menuOpened")){kc(e);return}let t=yt();if(!((Date.now()-t.firstVisitTs)/1e3/60<10)&&!_o("feedback")){To("feedback"),Uc(e);return}},kc=e=>{let t=document.createElement("a");t.classList.add("menu-toggle-tooltip"),t.href="#open-dev-tools",t.innerHTML=\`
33
37
  <div class="menu-toggle-tooltip-content">
34
38
  <h3>Open Builder Devtools</h3>
35
39
  <p>Start registering your components</p>
36
40
  </div>
37
- \`,t.appendChild(e),setTimeout(()=>{e.classList.add("menu-toggle-tooltip-show"),e.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),e.classList.remove("menu-toggle-tooltip-show"),ue(t,!0)})},1e3)},Ai=t=>{let e=document.createElement("a");e.classList.add("menu-toggle-tooltip"),e.href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform",e.target="_blank",e.innerHTML=\`
41
+ \`,e.appendChild(t),setTimeout(()=>{t.classList.add("menu-toggle-tooltip-show"),t.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),t.classList.remove("menu-toggle-tooltip-show"),Te(e,!0)})},1e3)},Uc=e=>{let t=document.createElement("a");t.classList.add("menu-toggle-tooltip"),t.href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform",t.target="_blank",t.innerHTML=\`
38
42
  <div class="menu-toggle-tooltip-content">
39
43
  <h3>How's Devtools working for you?</h3>
40
44
  <p>We'd love your feedback!</p>
41
45
  </div>
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.6.10"}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)}
43
- </style>\`,dt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=ki+\`<main>
46
+ \`,e.appendChild(t),setTimeout(()=>{t.classList.add("menu-toggle-tooltip-show"),t.addEventListener("click",()=>{t.classList.remove("menu-toggle-tooltip-show")})},1e3)};function Os(e){e.getElementById("go-to-builder").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open(Io(),"builder")}),e.getElementById("components-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let u=e.querySelector(".nav-cmp-list .section-content");u.scrollTop=0,ue(e,"nav-cmp-list"),Rs(e)}),e.getElementById("settings-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),ue(e,"nav-settings")}),e.getElementById("add-page-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open(Qe(),"builder")}),e.getElementById("import-from-figma").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function ks(e){let t=e.getElementById("enable-edit");t.addEventListener("change",r=>{r.stopPropagation(),Qr(t.checked)}),t.checked=_t(),Qr(t.checked)}var kr=class extends HTMLElement{constructor(){super()}connectedCallback(){let t=this.attachShadow({mode:"open"});t.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>\`,Ds(t),Os(t),Ps(t),ws(t),Ls(t),ks(t),this.setAttribute("aria-hidden","true"),t.getElementById("version").textContent="v1.6.12"}highlightOpener(){let t=this.shadowRoot.querySelector(".menu-toggle");t.classList.add("menu-toggle-highlight"),t.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{t.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{t.classList.remove("menu-toggle-highlight")},20)},20)}};var Nc=\`<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)}
47
+ </style>\`,Ur=class extends HTMLElement{constructor(){super()}connectedCallback(){let t=this.attachShadow({mode:"open"});t.innerHTML=Nc+\`<main>
44
48
  <aside>
45
49
  <div class="logo"></div>
46
50
 
@@ -78,7 +82,7 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
78
82
  </nav>
79
83
  </section>
80
84
  </main>
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.6.10"),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.6.10"),Mi());})();`)}async function Fi(e){return yi(e,`<!DOCTYPE html>
85
+ \`,Mc();let r=new URL(Ao,Tt);r.searchParams.set(Lo,location.href);let n=t.querySelectorAll(".next-step");for(let o of n)o.setAttribute("href",r.href);Ee("overview step viewed")}},Mc=()=>{let e=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");e?(e.href="https://cdn.builder.io/favicon.ico",e.removeAttribute("type")):(e=document.createElement("link"),e.rel="icon",e.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(e))};var Us=async()=>{(await Ro()).isValid||Fc()},Fc=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",Ur);let e=document.querySelector("builder-dev-tools-overview");e||(e=document.createElement("builder-dev-tools-overview"),e.setAttribute("aria-hidden","true"),document.body.appendChild(e)),setTimeout(()=>{e.removeAttribute("aria-hidden")},32)};var Vc=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",bt),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",kr);let e=document.querySelector("builder-dev-tools-menu");e||(e=document.createElement("builder-dev-tools-menu"),e.setAttribute("data-version","1.6.12"),document.body.appendChild(e));let t=document.querySelector("builder-dev-tools-edit");t||(t=document.createElement("builder-dev-tools-edit"),document.body.appendChild(t));let r=document.getElementById("builder-dev-tools-style");r||(r=document.createElement("style"),r.id="builder-dev-tools-style",r.innerHTML=".builder-no-scroll{overflow:hidden !important}",document.head.appendChild(r)),Us(),Is()}catch(e){console.error("Builder Devtools:",e)}};window.location===window.parent.location&&(console.debug("Builder.io Devtools v1.6.12"),Vc());})();`)}async function di(e){return Di(e,`<!doctype html>
82
86
  <html lang="en" dir="ltr">
83
87
  <head>
84
88
  <meta charset="utf-8" />
@@ -240,44 +244,44 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
240
244
  </p>
241
245
  </section>
242
246
  </main>
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();})();
247
+ <script>"use strict";(()=>{var jn=\`api-key\`;var Wn=\`p-key\`;var mr=\`preview-url\`;var hr=\`user-id\`;var Kn="_b-uid";var Hn=\`framework\`;var $n=\`platform\`;var Yn=\`node\`;var Qn="/~builder-dev-tools";var Xn=\`kind\`;var zn="__DEV_TOOLS_URL__";var Zn=(e,t,r)=>gr({type:"connectBuilder",data:{publicApiKey:e,privateAuthKey:t,kind:r}});var Jn=()=>gr({type:"validateBuilder"});var eo=e=>gr({type:"launchEditor",data:e});var gr=async e=>{const t=new URL(Qn,zn);let r;try{r=await fetch(t,{method:"POST",body:JSON.stringify(e)})}catch(o){console.error(\`Devtools Fetch Error, \${t.href}\`,o);throw new Error(\`Builder Devtools Fetch Error\`)}const n=r.headers.get("content-type")||"";if(n.includes("application/json")){const o=await r.json();if(r.ok){return o.data}if(Array.isArray(o.errors)&&o.errors.length>0){o.errors.forEach(i=>console.error(i));throw new Error(\`Builder Devtools Fetch Error: \${o.errors[0]}\`)}}throw new Error(\`Builder Devtools Fetch Error: \${r.status}, \${await r.text()}\`)};var _r=function(e,t){_r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o))r[o]=n[o]};return _r(e,t)};function U(e,t){if(typeof t!=="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");_r(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var x=function(){x=Object.assign||function e(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i))t[i]=r[i]}return t};return x.apply(this,arguments)};function qe(e,t){var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0)r[n]=e[n];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++){if(t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o]))r[n[o]]=e[n[o]]}return r}function E(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function u(l){try{c(n.next(l))}catch(d){a(d)}}function s(l){try{c(n["throw"](l))}catch(d){a(d)}}function c(l){l.done?i(l.value):o(l.value).then(u,s)}c((n=n.apply(e,t||[])).next())})}function g(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=u(0),a["throw"]=u(1),a["return"]=u(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(r=0)),r)try{if(n=1,o&&(i=c[0]&2?o["return"]:c[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;if(o=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:r.label++;return{value:c[1],done:false};case 5:r.label++;o=c[1];c=[0];continue;case 7:c=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1];i=c;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(c);break}if(i[2])r.ops.pop();r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l];o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}function D(e){var t=typeof Symbol==="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&n>=e.length)e=void 0;return{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function I(e,t){var r=typeof Symbol==="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{while((t===void 0||t-- >0)&&!(o=n.next()).done)i.push(o.value)}catch(u){a={error:u}}finally{try{if(o&&!o.done&&(r=n["return"]))r.call(n)}finally{if(a)throw a.error}}return i}function O(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++){if(i||!(n in t)){if(!i)i=Array.prototype.slice.call(t,0,n);i[n]=t[n]}}return e.concat(i||Array.prototype.slice.call(t))}function he(e){return this instanceof he?(this.v=e,this):new he(e)}function to(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(v){return Promise.resolve(v).then(p,d)}}function u(p,v){if(n[p]){o[p]=function(_){return new Promise(function(b,h){i.push([p,_,b,h])>1||s(p,_)})};if(v)o[p]=v(o[p])}}function s(p,v){try{c(n[p](v))}catch(_){f(i[0][3],_)}}function c(p){p.value instanceof he?Promise.resolve(p.value.v).then(l,d):f(i[0][2],p)}function l(p){s("next",p)}function d(p){s("throw",p)}function f(p,v){if(p(v),i.shift(),i.length)s(i[0][0],i[0][1])}}function ro(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof D==="function"?D(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(u,s){a=e[i](a),o(u,s,a.done,a.value)})}}function o(i,a,u,s){Promise.resolve(s).then(function(c){i({value:c,done:u})},a)}}var no="Event tracked successfully";var oo="Unexpected error occurred";var io="Event rejected due to exceeded retry count";var ao="Event skipped due to optOut config";var so="Event rejected due to missing API key";var uo="Invalid API key";var co="Client not initialized";var M;(function(e){e["Unknown"]="unknown";e["Skipped"]="skipped";e["Success"]="success";e["RateLimit"]="rate_limit";e["PayloadTooLarge"]="payload_too_large";e["Invalid"]="invalid";e["Failed"]="failed";e["Timeout"]="Timeout";e["SystemError"]="SystemError"})(M||(M={}));var ue=function(e,t,r){if(t===void 0){t=0}if(r===void 0){r=M.Unknown}return{event:e,code:t,message:r}};var te=function(e){return e?(e^Math.random()*16>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,te)};var lo=function(){function e(t){this.client=t;this.queue=[];this.applying=false;this.plugins=[]}e.prototype.register=function(t,r){var n,o;return E(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:if(this.plugins.some(function(a){return a.name===t.name})){r.loggerProvider.warn("Plugin with name ".concat(t.name," already exists, skipping registration"));return[2]}if(t.name===void 0){t.name=te();r.loggerProvider.warn("Plugin name is undefined. \\n Generating a random UUID for plugin name: ".concat(t.name,". \\n Set a name for the plugin to prevent it from being added multiple times."))}t.type=(n=t.type)!==null&&n!==void 0?n:"enrichment";return[4,(o=t.setup)===null||o===void 0?void 0:o.call(t,r,this.client)];case 1:i.sent();this.plugins.push(t);return[2]}})})};e.prototype.deregister=function(t,r){var n;return E(this,void 0,void 0,function(){var o,i;return g(this,function(a){switch(a.label){case 0:o=this.plugins.findIndex(function(u){return u.name===t});if(o===-1){r.loggerProvider.warn("Plugin with name ".concat(t," does not exist, skipping deregistration"));return[2]}i=this.plugins[o];this.plugins.splice(o,1);return[4,(n=i.teardown)===null||n===void 0?void 0:n.call(i)];case 1:a.sent();return[2]}})})};e.prototype.reset=function(t){this.applying=false;var r=this.plugins;r.map(function(n){var o;return(o=n.teardown)===null||o===void 0?void 0:o.call(n)});this.plugins=[];this.client=t};e.prototype.push=function(t){var r=this;return new Promise(function(n){r.queue.push([t,n]);r.scheduleApply(0)})};e.prototype.scheduleApply=function(t){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)}})},t)};e.prototype.apply=function(t){return E(this,void 0,void 0,function(){var r,n,o,i,a,u,s,p,v,c,l,d,f,p,v,_,b,h;var m,y,T,P;return g(this,function(S){switch(S.label){case 0:if(!t){return[2]}r=I(t,1),n=r[0];o=I(t,2),i=o[1];a=this.plugins.filter(function(w){return w.type==="before"});S.label=1;case 1:S.trys.push([1,6,7,8]);u=D(a),s=u.next();S.label=2;case 2:if(!!s.done)return[3,5];p=s.value;if(!p.execute){return[3,4]}return[4,p.execute(x({},n))];case 3:v=S.sent();if(v===null){i({event:n,code:0,message:""});return[2]}else{n=v}S.label=4;case 4:s=u.next();return[3,2];case 5:return[3,8];case 6:c=S.sent();m={error:c};return[3,8];case 7:try{if(s&&!s.done&&(y=u.return))y.call(u)}finally{if(m)throw m.error}return[7];case 8:l=this.plugins.filter(function(w){return w.type==="enrichment"||w.type===void 0});S.label=9;case 9:S.trys.push([9,14,15,16]);d=D(l),f=d.next();S.label=10;case 10:if(!!f.done)return[3,13];p=f.value;if(!p.execute){return[3,12]}return[4,p.execute(x({},n))];case 11:v=S.sent();if(v===null){i({event:n,code:0,message:""});return[2]}else{n=v}S.label=12;case 12:f=d.next();return[3,10];case 13:return[3,16];case 14:_=S.sent();T={error:_};return[3,16];case 15:try{if(f&&!f.done&&(P=d.return))P.call(d)}finally{if(T)throw T.error}return[7];case 16:b=this.plugins.filter(function(w){return w.type==="destination"});h=b.map(function(w){var A=x({},n);return w.execute(A).catch(function(R){return ue(A,0,String(R))})});void Promise.all(h).then(function(w){var A=I(w,1),R=A[0];var z=R||ue(n,100,"Event not tracked, no destination plugins on the instance");i(z)});return[2]}})})};e.prototype.flush=function(){return E(this,void 0,void 0,function(){var t,r,n;var o=this;return g(this,function(i){switch(i.label){case 0:t=this.queue;this.queue=[];return[4,Promise.all(t.map(function(a){return o.apply(a)}))];case 1:i.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:i.sent();return[2]}})})};return e}();var yr="-";var Ae="AMP";var fo="".concat(Ae,"_unsent");var Er="https://api2.amplitude.com/2/httpapi";var po="https://api.eu.amplitude.com/2/httpapi";var vo="https://api2.amplitude.com/batch";var mo="https://api.eu.amplitude.com/batch";var Ma=1e3;var ut=function(e){if(Object.keys(e).length>Ma){return false}for(var t in e){var r=e[t];if(!br(t,r))return false}return true};var br=function(e,t){var r,n;if(typeof e!=="string")return false;if(Array.isArray(t)){var o=true;try{for(var i=D(t),a=i.next();!a.done;a=i.next()){var u=a.value;if(Array.isArray(u)){return false}else if(typeof u==="object"){o=o&&ut(u)}else if(!["number","string"].includes(typeof u)){return false}if(!o){return false}}}catch(s){r={error:s}}finally{try{if(a&&!a.done&&(n=i.return))n.call(i)}finally{if(r)throw r.error}}}else if(t===null||t===void 0){return false}else if(typeof t==="object"){return ut(t)}else if(!["number","string","boolean"].includes(typeof t)){return false}return true};var ce=function(){function e(){this._propertySet=new Set;this._properties={}}e.prototype.getUserProperties=function(){return x({},this._properties)};e.prototype.set=function(t,r){this._safeSet(X.SET,t,r);return this};e.prototype.setOnce=function(t,r){this._safeSet(X.SET_ONCE,t,r);return this};e.prototype.append=function(t,r){this._safeSet(X.APPEND,t,r);return this};e.prototype.prepend=function(t,r){this._safeSet(X.PREPEND,t,r);return this};e.prototype.postInsert=function(t,r){this._safeSet(X.POSTINSERT,t,r);return this};e.prototype.preInsert=function(t,r){this._safeSet(X.PREINSERT,t,r);return this};e.prototype.remove=function(t,r){this._safeSet(X.REMOVE,t,r);return this};e.prototype.add=function(t,r){this._safeSet(X.ADD,t,r);return this};e.prototype.unset=function(t){this._safeSet(X.UNSET,t,yr);return this};e.prototype.clearAll=function(){this._properties={};this._properties[X.CLEAR_ALL]=yr;return this};e.prototype._safeSet=function(t,r,n){if(this._validate(t,r,n)){var o=this._properties[t];if(o===void 0){o={};this._properties[t]=o}o[r]=n;this._propertySet.add(r);return true}return false};e.prototype._validate=function(t,r,n){if(this._properties[X.CLEAR_ALL]!==void 0){return false}if(this._propertySet.has(r)){return false}if(t===X.ADD){return typeof n==="number"}if(t!==X.UNSET&&t!==X.REMOVE){return br(r,n)}return true};return e}();var X;(function(e){e["SET"]="$set";e["SET_ONCE"]="$setOnce";e["ADD"]="$add";e["APPEND"]="$append";e["PREPEND"]="$prepend";e["REMOVE"]="$remove";e["PREINSERT"]="$preInsert";e["POSTINSERT"]="$postInsert";e["UNSET"]="$unset";e["CLEAR_ALL"]="$clearAll"})(X||(X={}));var ho;(function(e){e["SET"]="$set";e["SET_ONCE"]="$setOnce";e["ADD"]="$add";e["APPEND"]="$append";e["PREPEND"]="$prepend";e["REMOVE"]="$remove";e["PREINSERT"]="$preInsert";e["POSTINSERT"]="$postInsert";e["UNSET"]="$unset";e["CLEAR_ALL"]="$clearAll"})(ho||(ho={}));var ge;(function(e){e["IDENTIFY"]="$identify";e["GROUP_IDENTIFY"]="$groupidentify";e["REVENUE"]="revenue_amount"})(ge||(ge={}));var go=function(e,t,r){var n=typeof e==="string"?{event_type:e}:e;return x(x(x({},n),r),t&&{event_properties:t})};var Be=function(e,t){var r=x(x({},t),{event_type:ge.IDENTIFY,user_properties:e.getUserProperties()});return r};var _o=function(e,t,r,n){var o;var i=x(x({},n),{event_type:ge.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(o={},o[e]=t,o)});return i};var yo=function(e,t,r){var n;var o=new ce;o.set(e,t);var i=x(x({},r),{event_type:ge.IDENTIFY,user_properties:o.getUserProperties(),groups:(n={},n[e]=t,n)});return i};var Eo=function(e,t){return x(x({},t),{event_type:ge.REVENUE,event_properties:e.getEventProperties()})};var $=function(e){return{promise:e||Promise.resolve()}};var Tr=function(){function e(t){if(t===void 0){t="$default"}this.initializing=false;this.isReady=false;this.q=[];this.dispatchQ=[];this.logEvent=this.track.bind(this);this.timeline=new lo(this);this.name=t}e.prototype._init=function(t){return E(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:this.config=t;this.timeline.reset(this);return[4,this.runQueuedFunctions("q")];case 1:r.sent();this.isReady=true;return[2]}})})};e.prototype.runQueuedFunctions=function(t){return E(this,void 0,void 0,function(){var r,n,o,i,a,u;var s,c;return g(this,function(l){switch(l.label){case 0:r=this[t];this[t]=[];l.label=1;case 1:l.trys.push([1,8,9,10]);n=D(r),o=n.next();l.label=2;case 2:if(!!o.done)return[3,7];i=o.value;a=i();if(!(a&&"promise"in a))return[3,4];return[4,a.promise];case 3:l.sent();return[3,6];case 4:return[4,a];case 5:l.sent();l.label=6;case 6:o=n.next();return[3,2];case 7:return[3,10];case 8:u=l.sent();s={error:u};return[3,10];case 9:try{if(o&&!o.done&&(c=n.return))c.call(n)}finally{if(s)throw s.error}return[7];case 10:if(!this[t].length)return[3,12];return[4,this.runQueuedFunctions(t)];case 11:l.sent();l.label=12;case 12:return[2]}})})};e.prototype.track=function(t,r,n){var o=go(t,r,n);return $(this.dispatch(o))};e.prototype.identify=function(t,r){var n=Be(t,r);return $(this.dispatch(n))};e.prototype.groupIdentify=function(t,r,n,o){var i=_o(t,r,n,o);return $(this.dispatch(i))};e.prototype.setGroup=function(t,r,n){var o=yo(t,r,n);return $(this.dispatch(o))};e.prototype.revenue=function(t,r){var n=Eo(t,r);return $(this.dispatch(n))};e.prototype.add=function(t){if(!this.isReady){this.q.push(this._addPlugin.bind(this,t));return $()}return this._addPlugin(t)};e.prototype._addPlugin=function(t){return $(this.timeline.register(t,this.config))};e.prototype.remove=function(t){if(!this.isReady){this.q.push(this._removePlugin.bind(this,t));return $()}return this._removePlugin(t)};e.prototype._removePlugin=function(t){return $(this.timeline.deregister(t,this.config))};e.prototype.dispatchWithCallback=function(t,r){if(!this.isReady){return r(ue(t,0,co))}void this.process(t).then(r)};e.prototype.dispatch=function(t){return E(this,void 0,void 0,function(){var r=this;return g(this,function(n){if(!this.isReady){return[2,new Promise(function(o){r.dispatchQ.push(r.dispatchWithCallback.bind(r,t,o))})]}return[2,this.process(t)]})})};e.prototype.process=function(t){return E(this,void 0,void 0,function(){var o,r,n,o;return g(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);if(this.config.optOut){return[2,ue(t,0,ao)]}return[4,this.timeline.push(t)];case 1:o=i.sent();o.code===200?this.config.loggerProvider.log(o.message):o.code===100?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message);return[2,o];case 2:r=i.sent();n=String(r);this.config.loggerProvider.error(n);o=ue(t,0,n);return[2,o];case 3:return[2]}})})};e.prototype.setOptOut=function(t){if(!this.isReady){this.q.push(this._setOptOut.bind(this,Boolean(t)));return}this._setOptOut(t)};e.prototype._setOptOut=function(t){this.config.optOut=Boolean(t)};e.prototype.flush=function(){return $(this.timeline.flush())};return e}();var xr=function(){function e(){this.productId="";this.quantity=1;this.price=0}e.prototype.setProductId=function(t){this.productId=t;return this};e.prototype.setQuantity=function(t){if(t>0){this.quantity=t}return this};e.prototype.setPrice=function(t){this.price=t;return this};e.prototype.setRevenueType=function(t){this.revenueType=t;return this};e.prototype.setCurrency=function(t){this.currency=t;return this};e.prototype.setRevenue=function(t){this.revenue=t;return this};e.prototype.setReceipt=function(t){this.receipt=t;return this};e.prototype.setReceiptSig=function(t){this.receiptSig=t;return this};e.prototype.setEventProperties=function(t){if(ut(t)){this.properties=t}return this};e.prototype.getEventProperties=function(){var t=this.properties?x({},this.properties):{};t[ie.REVENUE_PRODUCT_ID]=this.productId;t[ie.REVENUE_QUANTITY]=this.quantity;t[ie.REVENUE_PRICE]=this.price;t[ie.REVENUE_TYPE]=this.revenueType;t[ie.REVENUE_CURRENCY]=this.currency;t[ie.REVENUE]=this.revenue;t[ie.RECEIPT]=this.receipt;t[ie.RECEIPT_SIG]=this.receiptSig;return t};return e}();var ie;(function(e){e["REVENUE_PRODUCT_ID"]="$productId";e["REVENUE_QUANTITY"]="$quantity";e["REVENUE_PRICE"]="$price";e["REVENUE_TYPE"]="$revenueType";e["REVENUE_CURRENCY"]="$currency";e["REVENUE"]="$revenue";e["RECEIPT"]="$receipt";e["RECEIPT_SIG"]="$receiptSig"})(ie||(ie={}));var bo=function(e,t){var r=Math.max(t,1);return e.reduce(function(n,o,i){var a=Math.floor(i/r);if(!n[a]){n[a]=[]}n[a].push(o);return n},[])};var H;(function(e){e[e["None"]=0]="None";e[e["Error"]=1]="Error";e[e["Warn"]=2]="Warn";e[e["Verbose"]=3]="Verbose";e[e["Debug"]=4]="Debug"})(H||(H={}));var ct="Amplitude Logger ";var je=function(){function e(){this.logLevel=H.None}e.prototype.disable=function(){this.logLevel=H.None};e.prototype.enable=function(t){if(t===void 0){t=H.Warn}this.logLevel=t};e.prototype.log=function(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}if(this.logLevel<H.Verbose){return}console.log("".concat(ct,"[Log]: ").concat(t.join(" ")))};e.prototype.warn=function(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}if(this.logLevel<H.Warn){return}console.warn("".concat(ct,"[Warn]: ").concat(t.join(" ")))};e.prototype.error=function(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}if(this.logLevel<H.Error){return}console.error("".concat(ct,"[Error]: ").concat(t.join(" ")))};e.prototype.debug=function(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}if(this.logLevel<H.Debug){return}console.log("".concat(ct,"[Debug]: ").concat(t.join(" ")))};return e}();var lt=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:H.Warn,loggerProvider:new je,offline:false,optOut:false,serverUrl:Er,serverZone:"US",useBatch:false}};var Ir=function(){function e(t){var r,n,o,i;this._optOut=false;var a=lt();this.apiKey=t.apiKey;this.flushIntervalMillis=(r=t.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis;this.flushMaxRetries=t.flushMaxRetries||a.flushMaxRetries;this.flushQueueSize=t.flushQueueSize||a.flushQueueSize;this.instanceName=t.instanceName||a.instanceName;this.loggerProvider=t.loggerProvider||a.loggerProvider;this.logLevel=(n=t.logLevel)!==null&&n!==void 0?n:a.logLevel;this.minIdLength=t.minIdLength;this.plan=t.plan;this.ingestionMetadata=t.ingestionMetadata;this.offline=t.offline!==void 0?t.offline:a.offline;this.optOut=(o=t.optOut)!==null&&o!==void 0?o:a.optOut;this.serverUrl=t.serverUrl;this.serverZone=t.serverZone||a.serverZone;this.storageProvider=t.storageProvider;this.transportProvider=t.transportProvider;this.useBatch=(i=t.useBatch)!==null&&i!==void 0?i:a.useBatch;this.loggerProvider.enable(this.logLevel);var u=Sr(t.serverUrl,t.serverZone,t.useBatch);this.serverZone=u.serverZone;this.serverUrl=u.serverUrl}Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(t){this._optOut=t},enumerable:false,configurable:true});return e}();var Fa=function(e,t){if(e==="EU"){return t?mo:po}return t?vo:Er};var Sr=function(e,t,r){if(e===void 0){e=""}if(t===void 0){t=lt().serverZone}if(r===void 0){r=lt().useBatch}if(e){return{serverUrl:e,serverZone:void 0}}var n=["US","EU"].includes(t)?t:lt().serverZone;return{serverZone:n,serverUrl:Fa(n,r)}};var We=function(){function e(){this.sdk={metrics:{histogram:{}}}}e.prototype.recordHistogram=function(t,r){this.sdk.metrics.histogram[t]=r};return e}();function Va(e){if(e instanceof Error)return e.message;return String(e)}function ft(e){var t="";try{if("body"in e){t=JSON.stringify(e.body,null,2)}}catch(r){}return t}var wr=function(){function e(){this.name="amplitude";this.type="destination";this.retryTimeout=1e3;this.throttleTimeout=3e4;this.storageKey="";this.scheduleId=null;this.scheduledTimeout=0;this.flushId=null;this.queue=[]}e.prototype.setup=function(t){var r;return E(this,void 0,void 0,function(){var n;var o=this;return g(this,function(i){switch(i.label){case 0:this.config=t;this.storageKey="".concat(fo,"_").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=i.sent();if(n&&n.length>0){void Promise.all(n.map(function(a){return o.execute(a)})).catch()}return[2,Promise.resolve(void 0)]}})})};e.prototype.execute=function(t){var r=this;if(!t.insert_id){t.insert_id=te()}return new Promise(function(n){var o={event:t,attempts:0,callback:function(i){return n(i)},timeout:0};r.queue.push(o);r.schedule(r.config.flushIntervalMillis);r.saveEvents()})};e.prototype.removeEventsExceedFlushMaxRetries=function(t){var r=this;return t.filter(function(n){n.attempts+=1;if(n.attempts<r.config.flushMaxRetries){return true}void r.fulfillRequest([n],500,io);return false})};e.prototype.scheduleEvents=function(t){var r=this;t.forEach(function(n){r.schedule(n.timeout===0?r.config.flushIntervalMillis:n.timeout)})};e.prototype.schedule=function(t){var r=this;if(this.config.offline){return}if(this.scheduleId===null||this.scheduleId&&t>this.scheduledTimeout){if(this.scheduleId){clearTimeout(this.scheduleId)}this.scheduledTimeout=t;this.scheduleId=setTimeout(function(){r.queue=r.queue.map(function(n){n.timeout=0;return n});void r.flush(true)},t);return}};e.prototype.resetSchedule=function(){this.scheduleId=null;this.scheduledTimeout=0};e.prototype.flush=function(t){if(t===void 0){t=false}return E(this,void 0,void 0,function(){var r,n,o;var i=this;return g(this,function(a){switch(a.label){case 0:if(this.config.offline){this.resetSchedule();this.config.loggerProvider.debug("Skipping flush while offline.");return[2]}if(this.flushId){this.resetSchedule();this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved.");return[2]}this.flushId=this.scheduleId;this.resetSchedule();r=[];n=[];this.queue.forEach(function(u){return u.timeout===0?r.push(u):n.push(u)});o=bo(r,this.config.flushQueueSize);return[4,o.reduce(function(u,s){return E(i,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return[4,u];case 1:c.sent();return[4,this.send(s,t)];case 2:return[2,c.sent()]}})})},Promise.resolve())];case 1:a.sent();this.flushId=null;this.scheduleEvents(this.queue);return[2]}})})};e.prototype.send=function(t,r){if(r===void 0){r=true}return E(this,void 0,void 0,function(){var n,o,i,a,u;return g(this,function(s){switch(s.label){case 0:if(!this.config.apiKey){return[2,this.fulfillRequest(t,400,so)]}n={api_key:this.config.apiKey,events:t.map(function(c){var l=c.event,d=l.extra,f=qe(l,["extra"]);return f}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata};this.config.requestMetadata=new We;s.label=1;case 1:s.trys.push([1,3,,4]);o=Sr(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl;return[4,this.config.transportProvider.send(o,n)];case 2:i=s.sent();if(i===null){this.fulfillRequest(t,0,oo);return[2]}if(!r){if("body"in i){this.fulfillRequest(t,i.statusCode,"".concat(i.status,": ").concat(ft(i)))}else{this.fulfillRequest(t,i.statusCode,i.status)}return[2]}this.handleResponse(i,t);return[3,4];case 3:a=s.sent();u=Va(a);this.config.loggerProvider.error(u);this.handleResponse({status:M.Failed,statusCode:0},t);return[3,4];case 4:return[2]}})})};e.prototype.handleResponse=function(t,r){var n=t.status;switch(n){case M.Success:{this.handleSuccessResponse(t,r);break}case M.Invalid:{this.handleInvalidResponse(t,r);break}case M.PayloadTooLarge:{this.handlePayloadTooLargeResponse(t,r);break}case M.RateLimit:{this.handleRateLimitResponse(t,r);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(n,"' provided for ").concat(r.length,' events"}'));this.handleOtherResponse(r);break}}};e.prototype.handleSuccessResponse=function(t,r){this.fulfillRequest(r,t.statusCode,no)};e.prototype.handleInvalidResponse=function(t,r){var n=this;if(t.body.missingField||t.body.error.startsWith(uo)){this.fulfillRequest(r,t.statusCode,t.body.error);return}var o=O(O(O(O([],I(Object.values(t.body.eventsWithInvalidFields)),false),I(Object.values(t.body.eventsWithMissingFields)),false),I(Object.values(t.body.eventsWithInvalidIdLengths)),false),I(t.body.silencedEvents),false).flat();var i=new Set(o);var a=r.filter(function(s,c){if(i.has(c)){n.fulfillRequest([s],t.statusCode,t.body.error);return}return true});if(a.length>0){this.config.loggerProvider.warn(ft(t))}var u=this.removeEventsExceedFlushMaxRetries(a);this.scheduleEvents(u)};e.prototype.handlePayloadTooLargeResponse=function(t,r){if(r.length===1){this.fulfillRequest(r,t.statusCode,t.body.error);return}this.config.loggerProvider.warn(ft(t));this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)};e.prototype.handleRateLimitResponse=function(t,r){var n=this;var o=Object.keys(t.body.exceededDailyQuotaUsers);var i=Object.keys(t.body.exceededDailyQuotaDevices);var a=t.body.throttledEvents;var u=new Set(o);var s=new Set(i);var c=new Set(a);var l=r.filter(function(f,p){if(f.event.user_id&&u.has(f.event.user_id)||f.event.device_id&&s.has(f.event.device_id)){n.fulfillRequest([f],t.statusCode,t.body.error);return}if(c.has(p)){f.timeout=n.throttleTimeout}return true});if(l.length>0){this.config.loggerProvider.warn(ft(t))}var d=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(d)};e.prototype.handleOtherResponse=function(t){var r=this;var n=t.map(function(i){i.timeout=i.attempts*r.retryTimeout;return i});var o=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(o)};e.prototype.fulfillRequest=function(t,r,n){this.removeEvents(t);t.forEach(function(o){return o.callback(ue(o.event,r,n))})};e.prototype.saveEvents=function(){if(!this.config.storageProvider){return}var t=this.queue.map(function(r){return r.event});void this.config.storageProvider.set(this.storageKey,t)};e.prototype.removeEvents=function(t){this.queue=this.queue.filter(function(r){return!t.some(function(n){return n.event.insert_id===r.event.insert_id})});this.saveEvents()};return e}();var Ga=function(){function e(){}e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:qa(),platform:"Web",os:void 0,deviceModel:void 0}};return e}();var qa=function(){return typeof navigator!=="undefined"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""};var Ba=function(){function e(){this.queue=[]}e.prototype.logEvent=function(t){if(!this.receiver){if(this.queue.length<512){this.queue.push(t)}}else{this.receiver(t)}};e.prototype.setEventReceiver=function(t){this.receiver=t;if(this.queue.length>0){this.queue.forEach(function(r){t(r)});this.queue=[]}};return e}();var le=function(){le=Object.assign||function e(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i))t[i]=r[i]}return t};return le.apply(this,arguments)};function dt(e){var t=typeof Symbol==="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&n>=e.length)e=void 0;return{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function To(e,t){var r=typeof Symbol==="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{while((t===void 0||t-- >0)&&!(o=n.next()).done)i.push(o.value)}catch(u){a={error:u}}finally{try{if(o&&!o.done&&(r=n["return"]))r.call(n)}finally{if(a)throw a.error}}return i}var pt=function(e,t){var r,n;var o=["string","number","boolean","undefined"];var i=typeof e;var a=typeof t;if(i!==a){return false}try{for(var u=dt(o),s=u.next();!s.done;s=u.next()){var c=s.value;if(c===i){return e===t}}}catch(b){r={error:b}}finally{try{if(s&&!s.done&&(n=u.return))n.call(u)}finally{if(r)throw r.error}}if(e==null&&t==null){return true}else if(e==null||t==null){return false}if(e.length!==t.length){return false}var l=Array.isArray(e);var d=Array.isArray(t);if(l!==d){return false}if(l&&d){for(var f=0;f<e.length;f++){if(!pt(e[f],t[f])){return false}}}else{var p=Object.keys(e).sort();var v=Object.keys(t).sort();if(!pt(p,v)){return false}var _=true;Object.keys(e).forEach(function(b){if(!pt(e[b],t[b])){_=false}});return _}return true};var ja="$set";var Wa="$unset";var Ka="$clearAll";if(!Object.entries){Object.entries=function(e){var t=Object.keys(e);var r=t.length;var n=new Array(r);while(r--){n[r]=[t[r],e[t[r]]]}return n}}var Ha=function(){function e(){this.identity={userProperties:{}};this.listeners=new Set}e.prototype.editIdentity=function(){var t=this;var r=le({},this.identity.userProperties);var n=le(le({},this.identity),{userProperties:r});return{setUserId:function(o){n.userId=o;return this},setDeviceId:function(o){n.deviceId=o;return this},setUserProperties:function(o){n.userProperties=o;return this},setOptOut:function(o){n.optOut=o;return this},updateUserProperties:function(o){var i,a,u,s,c,l;var d=n.userProperties||{};try{for(var f=dt(Object.entries(o)),p=f.next();!p.done;p=f.next()){var v=To(p.value,2),_=v[0],b=v[1];switch(_){case ja:try{for(var h=(u=void 0,dt(Object.entries(b))),m=h.next();!m.done;m=h.next()){var y=To(m.value,2),T=y[0],P=y[1];d[T]=P}}catch(A){u={error:A}}finally{try{if(m&&!m.done&&(s=h.return))s.call(h)}finally{if(u)throw u.error}}break;case Wa:try{for(var S=(c=void 0,dt(Object.keys(b))),w=S.next();!w.done;w=S.next()){var T=w.value;delete d[T]}}catch(A){c={error:A}}finally{try{if(w&&!w.done&&(l=S.return))l.call(S)}finally{if(c)throw c.error}}break;case Ka:d={};break}}}catch(A){i={error:A}}finally{try{if(p&&!p.done&&(a=f.return))a.call(f)}finally{if(i)throw i.error}}n.userProperties=d;return this},commit:function(){t.setIdentity(n);return this}}};e.prototype.getIdentity=function(){return le({},this.identity)};e.prototype.setIdentity=function(t){var r=le({},this.identity);this.identity=le({},t);if(!pt(r,this.identity)){this.listeners.forEach(function(n){n(t)})}};e.prototype.addIdentityListener=function(t){this.listeners.add(t)};e.prototype.removeIdentityListener=function(t){this.listeners.delete(t)};return e}();var Ke=typeof globalThis!=="undefined"?globalThis:typeof global!=="undefined"?global:self;var xo=function(){function e(){this.identityStore=new Ha;this.eventBridge=new Ba;this.applicationContextProvider=new Ga}e.getInstance=function(t){if(!Ke["analyticsConnectorInstances"]){Ke["analyticsConnectorInstances"]={}}if(!Ke["analyticsConnectorInstances"][t]){Ke["analyticsConnectorInstances"][t]=new e}return Ke["analyticsConnectorInstances"][t]};return e}();var fe=function(e){if(e===void 0){e="$default_instance"}return xo.getInstance(e)};var Ar=function(e,t){fe(t).identityStore.editIdentity().setUserId(e).commit()};var Pr=function(e,t){fe(t).identityStore.editIdentity().setDeviceId(e).commit()};var Cr=function(){function e(){this.name="identity";this.type="before";this.identityStore=fe().identityStore}e.prototype.execute=function(t){return E(this,void 0,void 0,function(){var r;return g(this,function(n){r=t.user_properties;if(r){this.identityStore.editIdentity().updateUserProperties(r).commit()}return[2,t]})})};e.prototype.setup=function(t){return E(this,void 0,void 0,function(){return g(this,function(r){if(t.instanceName){this.identityStore=fe(t.instanceName).identityStore}return[2]})})};return e}();var W=function(){var e="ampIntegrationContext";if(typeof globalThis!=="undefined"&&typeof globalThis[e]!=="undefined"){return globalThis[e]}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 He=function(e,t){if(t===void 0){t=Date.now()}var r=Date.now();var n=r-t;return n>e};var vt=function(e,t,r){if(t===void 0){t=""}if(r===void 0){r=10}return[Ae,t,e.substring(0,r)].filter(Boolean).join("_")};var Lr=function(e){return"".concat(Ae.toLowerCase(),"_").concat(e.substring(0,6))};var Rr=function(){var e,t,r,n;if(typeof navigator==="undefined")return"";var o=navigator.userLanguage;return(n=(r=(t=(e=navigator.languages)===null||e===void 0?void 0:e[0])!==null&&t!==void 0?t:navigator.language)!==null&&r!==void 0?r:o)!==null&&n!==void 0?n:""};var de=function(){var e;var t=W();if(!((e=t===null||t===void 0?void 0:t.location)===null||e===void 0?void 0:e.search)){return{}}var r=t.location.search.substring(1).split("&").filter(Boolean);var n=r.reduce(function(o,i){var a=i.split("=",2);var u=Io(a[0]);var s=Io(a[1]);if(!s){return o}o[u]=s;return o},{});return n};var Io=function(e){if(e===void 0){e=""}try{return decodeURIComponent(e)}catch(t){return""}};var $a=function(e){if(e===void 0){e=0}var t=new Error().stack||"";return t.split("\\n").slice(2+e).map(function(r){return r.trim()})};var F=function(e){return function(){var t=x({},e.config),r=t.loggerProvider,n=t.logLevel;return{logger:r,logLevel:n}}};var Ya=function(e,t){var r,n;t=t.replace(/\\[(\\w+)\\]/g,".$1");t=t.replace(/^\\./,"");try{for(var o=D(t.split(".")),i=o.next();!i.done;i=o.next()){var a=i.value;if(a in e){e=e[a]}else{return}}}catch(u){r={error:u}}finally{try{if(i&&!i.done&&(n=o.return))n.call(o)}finally{if(r)throw r.error}}return e};var V=function(e,t){return function(){var r,n;var o={};try{for(var i=D(t),a=i.next();!a.done;a=i.next()){var u=a.value;o[u]=Ya(e,u)}}catch(s){r={error:s}}finally{try{if(a&&!a.done&&(n=i.return))n.call(i)}finally{if(r)throw r.error}}return o}};var G=function(e,t,r,n,o){if(o===void 0){o=null}return function(){var i=[];for(var a=0;a<arguments.length;a++){i[a]=arguments[a]}var u=r(),s=u.logger,c=u.logLevel;if(c&&c<H.Debug||!c||!s){return e.apply(o,i)}var l={type:"invoke public method",name:t,args:i,stacktrace:$a(1),time:{start:new Date().toISOString()},states:{}};if(n&&l.states){l.states.before=n()}var d=e.apply(o,i);if(d&&d.promise){d.promise.then(function(){if(n&&l.states){l.states.after=n()}if(l.time){l.time.end=new Date().toISOString()}s.debug(JSON.stringify(l,null,2))})}else{if(n&&l.states){l.states.after=n()}if(l.time){l.time.end=new Date().toISOString()}s.debug(JSON.stringify(l,null,2))}return d}};var $e=function(){function e(){this.memoryStorage=new Map}e.prototype.isEnabled=function(){return E(this,void 0,void 0,function(){return g(this,function(t){return[2,true]})})};e.prototype.get=function(t){return E(this,void 0,void 0,function(){return g(this,function(r){return[2,this.memoryStorage.get(t)]})})};e.prototype.getRaw=function(t){return E(this,void 0,void 0,function(){var r;return g(this,function(n){switch(n.label){case 0:return[4,this.get(t)];case 1:r=n.sent();return[2,r?JSON.stringify(r):void 0]}})})};e.prototype.set=function(t,r){return E(this,void 0,void 0,function(){return g(this,function(n){this.memoryStorage.set(t,r);return[2]})})};e.prototype.remove=function(t){return E(this,void 0,void 0,function(){return g(this,function(r){this.memoryStorage.delete(t);return[2]})})};e.prototype.reset=function(){return E(this,void 0,void 0,function(){return g(this,function(t){this.memoryStorage.clear();return[2]})})};return e}();var Ye=function(){function e(t){this.options=x({},t)}e.prototype.isEnabled=function(){return E(this,void 0,void 0,function(){var t,r,n,o;return g(this,function(i){switch(i.label){case 0:if(!W()){return[2,false]}e.testValue=String(Date.now());t=new e(this.options);r="AMP_TEST";i.label=1;case 1:i.trys.push([1,4,5,7]);return[4,t.set(r,e.testValue)];case 2:i.sent();return[4,t.get(r)];case 3:n=i.sent();return[2,n===e.testValue];case 4:o=i.sent();return[2,false];case 5:return[4,t.remove(r)];case 6:i.sent();return[7];case 7:return[2]}})})};e.prototype.get=function(t){var r;return E(this,void 0,void 0,function(){var n,o;return g(this,function(i){switch(i.label){case 0:return[4,this.getRaw(t)];case 1:n=i.sent();if(!n){return[2,void 0]}try{o=(r=Qa(n))!==null&&r!==void 0?r:Xa(n);if(o===void 0){console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(t,", value: ").concat(n));return[2,void 0]}return[2,JSON.parse(o)]}catch(a){console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(t,", value: ").concat(n));return[2,void 0]}return[2]}})})};e.prototype.getRaw=function(t){var r,n;return E(this,void 0,void 0,function(){var o,i,a;return g(this,function(u){o=W();i=(n=(r=o===null||o===void 0?void 0:o.document)===null||r===void 0?void 0:r.cookie.split("; "))!==null&&n!==void 0?n:[];a=i.find(function(s){return s.indexOf(t+"=")===0});if(!a){return[2,void 0]}return[2,a.substring(t.length+1)]})})};e.prototype.set=function(t,r){var n;return E(this,void 0,void 0,function(){var o,i,a,u,s,c,l;return g(this,function(d){try{o=(n=this.options.expirationDays)!==null&&n!==void 0?n:0;i=r!==null?o:-1;a=void 0;if(i){u=new Date;u.setTime(u.getTime()+i*24*60*60*1e3);a=u}s="".concat(t,"=").concat(btoa(encodeURIComponent(JSON.stringify(r))));if(a){s+="; expires=".concat(a.toUTCString())}s+="; path=/";if(this.options.domain){s+="; domain=".concat(this.options.domain)}if(this.options.secure){s+="; Secure"}if(this.options.sameSite){s+="; SameSite=".concat(this.options.sameSite)}c=W();if(c){c.document.cookie=s}}catch(f){l=f instanceof Error?f.message:String(f);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(t,". Error: ").concat(l))}return[2]})})};e.prototype.remove=function(t){return E(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this.set(t,null)];case 1:r.sent();return[2]}})})};e.prototype.reset=function(){return E(this,void 0,void 0,function(){return g(this,function(t){return[2]})})};return e}();var Qa=function(e){try{return decodeURIComponent(atob(e))}catch(t){return void 0}};var Xa=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(t){return void 0}};var Or=function(e,t,r){if(t===void 0){t=""}if(r===void 0){r=10}return[Ae,t,e.substring(0,r)].filter(Boolean).join("_")};var _e=function(){function e(){}e.prototype.send=function(t,r){return Promise.resolve(null)};e.prototype.buildResponse=function(t){var r,n,o,i,a,u,s,c,l,d,f,p,v,_,b,h,m,y,T,P,S,w;if(typeof t!=="object"){return null}var A=t.code||0;var R=this.buildStatus(A);switch(R){case M.Success:return{status:R,statusCode:A,body:{eventsIngested:(r=t.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=t.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(o=t.server_upload_time)!==null&&o!==void 0?o:0}};case M.Invalid:return{status:R,statusCode:A,body:{error:(i=t.error)!==null&&i!==void 0?i:"",missingField:(a=t.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(u=t.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(s=t.events_with_missing_fields)!==null&&s!==void 0?s:{},eventsWithInvalidIdLengths:(c=t.events_with_invalid_id_lengths)!==null&&c!==void 0?c:{},epsThreshold:(l=t.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(d=t.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(f=t.silenced_devices)!==null&&f!==void 0?f:[],silencedEvents:(p=t.silenced_events)!==null&&p!==void 0?p:[],throttledDevices:(v=t.throttled_devices)!==null&&v!==void 0?v:{},throttledEvents:(_=t.throttled_events)!==null&&_!==void 0?_:[]}};case M.PayloadTooLarge:return{status:R,statusCode:A,body:{error:(b=t.error)!==null&&b!==void 0?b:""}};case M.RateLimit:return{status:R,statusCode:A,body:{error:(h=t.error)!==null&&h!==void 0?h:"",epsThreshold:(m=t.eps_threshold)!==null&&m!==void 0?m:0,throttledDevices:(y=t.throttled_devices)!==null&&y!==void 0?y:{},throttledUsers:(T=t.throttled_users)!==null&&T!==void 0?T:{},exceededDailyQuotaDevices:(P=t.exceeded_daily_quota_devices)!==null&&P!==void 0?P:{},exceededDailyQuotaUsers:(S=t.exceeded_daily_quota_users)!==null&&S!==void 0?S:{},throttledEvents:(w=t.throttled_events)!==null&&w!==void 0?w:[]}};case M.Timeout:default:return{status:R,statusCode:A}}};e.prototype.buildStatus=function(t){if(t>=200&&t<300){return M.Success}if(t===429){return M.RateLimit}if(t===413){return M.PayloadTooLarge}if(t===408){return M.Timeout}if(t>=400&&t<500){return M.Invalid}if(t>=500){return M.Failed}return M.Unknown};return e}();var Dr=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.send=function(r,n){return E(this,void 0,void 0,function(){var o,i,a;return g(this,function(u){switch(u.label){case 0:if(typeof fetch==="undefined"){throw new Error("FetchTransport is not supported")}o={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(n),method:"POST"};return[4,fetch(r,o)];case 1:i=u.sent();return[4,i.text()];case 2:a=u.sent();try{return[2,this.buildResponse(JSON.parse(a))]}catch(s){return[2,this.buildResponse({code:i.status})]}return[2]}})})};return t}(_e);var Ur=null;var Qe=function(e,t){if(typeof e==="boolean"){return e}if((e===null||e===void 0?void 0:e[t])===false){return false}return true};var kr=function(e){return Qe(e,"attribution")};var So=function(e){return Qe(e,"fileDownloads")};var wo=function(e){return Qe(e,"formInteractions")};var Nr=function(e){return Qe(e,"pageViews")};var Mr=function(e){return Qe(e,"sessions")};var Fr=function(e){if(typeof e==="boolean"){return e}if(typeof e==="object"&&(e.elementInteractions===true||typeof e.elementInteractions==="object")){return true}return false};var Ao=function(e){if(Fr(e.autocapture)&&typeof e.autocapture==="object"&&typeof e.autocapture.elementInteractions==="object"){return e.autocapture.elementInteractions}return void 0};var Po=function(e){var t=function(){return false};var r=void 0;var n;var o=e.pageCounter;var i=Nr(e.defaultTracking);if(i){t=void 0;n=void 0;if(e.defaultTracking&&typeof e.defaultTracking==="object"&&e.defaultTracking.pageViews&&typeof e.defaultTracking.pageViews==="object"){if("trackOn"in e.defaultTracking.pageViews){t=e.defaultTracking.pageViews.trackOn}if("trackHistoryChanges"in e.defaultTracking.pageViews){r=e.defaultTracking.pageViews.trackHistoryChanges}if("eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType){n=e.defaultTracking.pageViews.eventType}}}return{trackOn:t,trackHistoryChanges:r,eventType:n,pageCounter:o}};var Co=function(e){if(kr(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==="object"&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution==="object"){return x({},e.defaultTracking.attribution)}return{}};var mt=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=n.name,i=n.args,a=n.resolve;var u=e&&e[o];if(typeof u==="function"){var s=u.apply(e,i);if(typeof a==="function"){a(s===null||s===void 0?void 0:s.promise)}}}return e};var ht=function(e){var t=e;return t&&t._q!==void 0};var Lo="2.12.0";var Ro="amplitude-ts";var za="Web";var Za="$remote";var Oo=function(){function e(){this.name="@amplitude/plugin-context-browser";this.type="before";this.library="".concat(Ro,"/").concat(Lo);if(typeof navigator!=="undefined"){this.userAgent=navigator.userAgent}}e.prototype.setup=function(t){this.config=t;return Promise.resolve(void 0)};e.prototype.execute=function(t){return E(this,void 0,void 0,function(){var r,n,o,i;var a,u;return g(this,function(s){r=new Date().getTime();n=(a=this.config.lastEventId)!==null&&a!==void 0?a:-1;o=(u=t.event_id)!==null&&u!==void 0?u:n+1;this.config.lastEventId=o;if(!t.time){this.config.lastEventTime=r}i=x(x(x(x(x(x(x(x({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:za}),this.config.trackingOptions.language&&{language:Rr()}),this.config.trackingOptions.ipAddress&&{ip:Za}),{insert_id:te(),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}}),t),{event_id:o,library:this.library,user_agent:this.userAgent});return[2,i]})})};return e}();var gt=function(){function e(t){this.storage=t}e.prototype.isEnabled=function(){return E(this,void 0,void 0,function(){var t,r,n,o,i;return g(this,function(a){switch(a.label){case 0:if(!this.storage){return[2,false]}t=String(Date.now());r=new e(this.storage);n="AMP_TEST";a.label=1;case 1:a.trys.push([1,4,5,7]);return[4,r.set(n,t)];case 2:a.sent();return[4,r.get(n)];case 3:o=a.sent();return[2,o===t];case 4:i=a.sent();return[2,false];case 5:return[4,r.remove(n)];case 6:a.sent();return[7];case 7:return[2]}})})};e.prototype.get=function(t){return E(this,void 0,void 0,function(){var r,n;return g(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,this.getRaw(t)];case 1:r=o.sent();if(!r){return[2,void 0]}return[2,JSON.parse(r)];case 2:n=o.sent();console.error("[Amplitude] Error: Could not get value from storage");return[2,void 0];case 3:return[2]}})})};e.prototype.getRaw=function(t){return E(this,void 0,void 0,function(){var r;return g(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(t))||void 0]})})};e.prototype.set=function(t,r){return E(this,void 0,void 0,function(){var n;return g(this,function(o){try{(n=this.storage)===null||n===void 0?void 0:n.setItem(t,JSON.stringify(r))}catch(i){}return[2]})})};e.prototype.remove=function(t){return E(this,void 0,void 0,function(){var r;return g(this,function(n){try{(r=this.storage)===null||r===void 0?void 0:r.removeItem(t)}catch(o){}return[2]})})};e.prototype.reset=function(){return E(this,void 0,void 0,function(){var t;return g(this,function(r){try{(t=this.storage)===null||t===void 0?void 0:t.clear()}catch(n){}return[2]})})};return e}();var _t=1e3;var Vr=function(e){U(t,e);function t(r){var n;var o=e.call(this,(n=W())===null||n===void 0?void 0:n.localStorage)||this;o.loggerProvider=r===null||r===void 0?void 0:r.loggerProvider;return o}t.prototype.set=function(r,n){return E(this,void 0,void 0,function(){var o;var i;return g(this,function(a){switch(a.label){case 0:if(!(Array.isArray(n)&&n.length>_t))return[3,2];o=n.length-_t;return[4,e.prototype.set.call(this,r,n.slice(0,_t))];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(_t,"."));return[3,4];case 2:return[4,e.prototype.set.call(this,r,n)];case 3:a.sent();a.label=4;case 4:return[2]}})})};return t}(gt);var Do=function(e){U(t,e);function t(){var r;return e.call(this,(r=W())===null||r===void 0?void 0:r.sessionStorage)||this}return t}(gt);var Uo=function(e){U(t,e);function t(){var r=e.apply(this,O([],I(arguments),false))||this;r.state={done:4};return r}t.prototype.send=function(r,n){return E(this,void 0,void 0,function(){var o=this;return g(this,function(i){return[2,new Promise(function(a,u){if(typeof XMLHttpRequest==="undefined"){u(new Error("XHRTransport is not supported."))}var s=new XMLHttpRequest;s.open("POST",r,true);s.onreadystatechange=function(){if(s.readyState===o.state.done){var c=s.responseText;try{a(o.buildResponse(JSON.parse(c)))}catch(l){a(o.buildResponse({code:s.status}))}}};s.setRequestHeader("Content-Type","application/json");s.setRequestHeader("Accept","*/*");s.send(JSON.stringify(n))})]})})};return t}(_e);var ko=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.send=function(r,n){return E(this,void 0,void 0,function(){var o=this;return g(this,function(i){return[2,new Promise(function(a,u){var s=W();if(!(s===null||s===void 0?void 0:s.navigator.sendBeacon)){throw new Error("SendBeaconTransport is not supported")}try{var c=JSON.stringify(n);var l=s.navigator.sendBeacon(r,JSON.stringify(n));if(l){return a(o.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:c.length,server_upload_time:Date.now()}))}return a(o.buildResponse({code:500}))}catch(d){u(d)}})]})})};return t}(_e);var No=function(e,t){var r=[];for(var n=2;n<arguments.length;n++){r[n-2]=arguments[n]}return E(void 0,O([e,t],I(r),false),void 0,function(o,i,a){var u,s,c,l,d,f,p,v,_;if(a===void 0){a=true}return g(this,function(b){switch(b.label){case 0:u=Lr(o);return[4,i.getRaw(u)];case 1:s=b.sent();if(!s){return[2,{optOut:false}]}if(!a)return[3,3];return[4,i.remove(u)];case 2:b.sent();b.label=3;case 3:c=I(s.split("."),6),l=c[0],d=c[1],f=c[2],p=c[3],v=c[4],_=c[5];return[2,{deviceId:l,userId:Ja(d),sessionId:Gr(p),lastEventId:Gr(_),lastEventTime:Gr(v),optOut:Boolean(f)}]}})})};var Gr=function(e){var t=parseInt(e,32);if(isNaN(t)){return void 0}return t};var Ja=function(e){if(!atob||!escape||!e){return void 0}try{return decodeURIComponent(escape(atob(e)))}catch(t){return void 0}};var re="[Amplitude]";var Ql="".concat(re," Page Viewed");var qr="".concat(re," Form Started");var Mo="".concat(re," Form Submitted");var Fo="".concat(re," File Downloaded");var Br="session_start";var jr="session_end";var Vo="".concat(re," File Extension");var Go="".concat(re," File Name");var qo="".concat(re," Link ID");var Bo="".concat(re," Link Text");var jo="".concat(re," Link URL");var yt="".concat(re," Form ID");var Et="".concat(re," Form Name");var bt="".concat(re," Form Destination");var Xe="cookie";var Wo="US";var es=function(e){U(t,e);function t(r,n,o,i,a,u,s,c,l,d,f,p,v,_,b,h,m,y,T,P,S,w,A,R,z,Z,Q,J,se,pe,ve,Ve,Ge,we){if(o===void 0){o=new $e}if(i===void 0){i={domain:"",expiration:365,sameSite:"Lax",secure:false,upgrade:true}}if(c===void 0){c=1e3}if(l===void 0){l=5}if(d===void 0){d=30}if(f===void 0){f=Xe}if(h===void 0){h=new je}if(m===void 0){m=H.Warn}if(T===void 0){T=false}if(P===void 0){P=false}if(A===void 0){A=""}if(R===void 0){R=Wo}if(Z===void 0){Z=30*60*1e3}if(Q===void 0){Q=new Vr({loggerProvider:h})}if(J===void 0){J={ipAddress:true,language:true,platform:true}}if(se===void 0){se="fetch"}if(pe===void 0){pe=false}if(ve===void 0){ve=false}var C=e.call(this,{apiKey:r,storageProvider:Q,transportProvider:Wr(se)})||this;C.apiKey=r;C.appVersion=n;C.cookieOptions=i;C.defaultTracking=a;C.autocapture=u;C.flushIntervalMillis=c;C.flushMaxRetries=l;C.flushQueueSize=d;C.identityStorage=f;C.ingestionMetadata=p;C.instanceName=v;C.loggerProvider=h;C.logLevel=m;C.minIdLength=y;C.offline=T;C.partnerId=S;C.plan=w;C.serverUrl=A;C.serverZone=R;C.sessionTimeout=Z;C.storageProvider=Q;C.trackingOptions=J;C.transport=se;C.useBatch=pe;C.fetchRemoteConfig=ve;C._optOut=false;C._cookieStorage=o;C.deviceId=s;C.lastEventId=_;C.lastEventTime=b;C.optOut=P;C.sessionId=z;C.pageCounter=Ge;C.userId=Ve;C.debugLogsEnabled=we;C.loggerProvider.enable(we?H.Debug:C.logLevel);return C}Object.defineProperty(t.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(t.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(t.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(t.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(t.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(t.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(t.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(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){if(this._pageCounter!==r){this._pageCounter=r;this.updateStorage()}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(r){if(this._debugLogsEnabled!==r){this._debugLogsEnabled=r;this.updateStorage()}},enumerable:false,configurable:true});t.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,debugLogsEnabled:this._debugLogsEnabled};void this.cookieStorage.set(vt(this.apiKey),r)};return t}(Ir);var Ko=function(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}return E(void 0,O([e],I(t),false),void 0,function(n,o,i){var a,u,s,c,l,d,f,p,v,_,b,h,m,y,T,P,S,w;var A;var R,z,Z,Q,J,se,pe,ve,Ve,Ge,we,C,nr,or,ir,ar,sr,ur,cr,lr,fr,dr,pr,vr;if(o===void 0){o={}}return g(this,function(me){switch(me.label){case 0:a=o.identityStorage||Xe;A={};if(!(a!==Xe))return[3,1];s="";return[3,5];case 1:if(!((z=(R=o.cookieOptions)===null||R===void 0?void 0:R.domain)!==null&&z!==void 0))return[3,2];c=z;return[3,4];case 2:return[4,rs()];case 3:c=me.sent();me.label=4;case 4:s=c;me.label=5;case 5:u=x.apply(void 0,[(A.domain=s,A.expiration=365,A.sameSite="Lax",A.secure=false,A.upgrade=true,A),o.cookieOptions]);l=ts(o.identityStorage,u);return[4,No(n,l,(Q=(Z=o.cookieOptions)===null||Z===void 0?void 0:Z.upgrade)!==null&&Q!==void 0?Q:true)];case 6:d=me.sent();return[4,l.get(vt(n))];case 7:f=me.sent();p=de();v=(Ve=(ve=(pe=(se=(J=o.deviceId)!==null&&J!==void 0?J:p.ampDeviceId)!==null&&se!==void 0?se:p.deviceId)!==null&&pe!==void 0?pe:f===null||f===void 0?void 0:f.deviceId)!==null&&ve!==void 0?ve:d.deviceId)!==null&&Ve!==void 0?Ve:te();_=(Ge=f===null||f===void 0?void 0:f.lastEventId)!==null&&Ge!==void 0?Ge:d.lastEventId;b=(we=f===null||f===void 0?void 0:f.lastEventTime)!==null&&we!==void 0?we:d.lastEventTime;h=(nr=(C=o.optOut)!==null&&C!==void 0?C:f===null||f===void 0?void 0:f.optOut)!==null&&nr!==void 0?nr:d.optOut;m=(or=f===null||f===void 0?void 0:f.sessionId)!==null&&or!==void 0?or:d.sessionId;y=(ar=(ir=o.userId)!==null&&ir!==void 0?ir:f===null||f===void 0?void 0:f.userId)!==null&&ar!==void 0?ar:d.userId;i.previousSessionDeviceId=(sr=f===null||f===void 0?void 0:f.deviceId)!==null&&sr!==void 0?sr:d.deviceId;i.previousSessionUserId=(ur=f===null||f===void 0?void 0:f.userId)!==null&&ur!==void 0?ur:d.userId;T={ipAddress:(lr=(cr=o.trackingOptions)===null||cr===void 0?void 0:cr.ipAddress)!==null&&lr!==void 0?lr:true,language:(dr=(fr=o.trackingOptions)===null||fr===void 0?void 0:fr.language)!==null&&dr!==void 0?dr:true,platform:(vr=(pr=o.trackingOptions)===null||pr===void 0?void 0:pr.platform)!==null&&vr!==void 0?vr:true};P=f===null||f===void 0?void 0:f.pageCounter;S=f===null||f===void 0?void 0:f.debugLogsEnabled;if(o.autocapture!==void 0){o.defaultTracking=o.autocapture}w=new es(n,o.appVersion,l,u,o.defaultTracking,o.autocapture,v,o.flushIntervalMillis,o.flushMaxRetries,o.flushQueueSize,a,o.ingestionMetadata,o.instanceName,_,b,o.loggerProvider,o.logLevel,o.minIdLength,o.offline,h,o.partnerId,o.plan,o.serverUrl,o.serverZone,m,o.sessionTimeout,o.storageProvider,T,o.transport,o.useBatch,o.fetchRemoteConfig,y,P,S);return[4,w.storageProvider.isEnabled()];case 8:if(!me.sent()){w.loggerProvider.warn("Storage provider ".concat(w.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage."));w.storageProvider=new $e}return[2,w]}})})};var ts=function(e,t){if(e===void 0){e=Xe}if(t===void 0){t={}}switch(e){case"localStorage":return new Vr;case"sessionStorage":return new Do;case"none":return new $e;case"cookie":default:return new Ye(x(x({},t),{expirationDays:t.expiration}))}};var Wr=function(e){if(e==="xhr"){return new Uo}if(e==="beacon"){return new ko}return new Dr};var rs=function(e){return E(void 0,void 0,void 0,function(){var t,r,n,o,i,i,a,u,s,c;return g(this,function(l){switch(l.label){case 0:return[4,new Ye().isEnabled()];case 1:if(!l.sent()||!e&&(typeof location==="undefined"||!location.hostname)){return[2,""]}t=e!==null&&e!==void 0?e:location.hostname;r=t.split(".");n=[];o="AMP_TLDTEST";for(i=r.length-2;i>=0;--i){n.push(r.slice(i).join("."))}i=0;l.label=2;case 2:if(!(i<n.length))return[3,7];a=n[i];u={domain:"."+a};s=new Ye(u);return[4,s.set(o,1)];case 3:l.sent();return[4,s.get(o)];case 4:c=l.sent();if(!c)return[3,6];return[4,s.remove(o)];case 5:l.sent();return[2,"."+a];case 6:i++;return[3,2];case 7:return[2,""]}})})};var ze=function(){var e="ampIntegrationContext";if(typeof globalThis!=="undefined"&&typeof globalThis[e]!=="undefined"){return globalThis[e]}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 Kr=function(){var e;var t=ze();if(!((e=t===null||t===void 0?void 0:t.location)===null||e===void 0?void 0:e.search)){return{}}var r=t.location.search.substring(1).split("&").filter(Boolean);var n=r.reduce(function(o,i){var a=i.split("=",2);var u=Ho(a[0]);var s=Ho(a[1]);if(!s){return o}o[u]=s;return o},{});return n};var Ho=function(e){if(e===void 0){e=""}try{return decodeURIComponent(e)}catch(t){return""}};var $o="utm_campaign";var Yo="utm_content";var Qo="utm_id";var Xo="utm_medium";var zo="utm_source";var Zo="utm_term";var Hr="dclid";var $r="fbclid";var Yr="gbraid";var Qr="gclid";var Xr="ko_click_id";var zr="li_fat_id";var Zr="msclkid";var Jr="rtd_cid";var en="ttclid";var tn="twclid";var rn="wbraid";var Ze={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 nn=function(){function e(){}e.prototype.parse=function(){return E(this,void 0,void 0,function(){return g(this,function(t){return[2,x(x(x(x({},Ze),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})};e.prototype.getUtmParam=function(){var t=Kr();var r=t[$o];var n=t[Yo];var o=t[Qo];var i=t[Xo];var a=t[zo];var u=t[Zo];return{utm_campaign:r,utm_content:n,utm_id:o,utm_medium:i,utm_source:a,utm_term:u}};e.prototype.getReferrer=function(){var t,r;var n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0;n.referring_domain=(r=(t=n.referrer)===null||t===void 0?void 0:t.split("/")[2])!==null&&r!==void 0?r:void 0}catch(o){}return n};e.prototype.getClickIds=function(){var t;var r=Kr();return t={},t[Hr]=r[Hr],t[$r]=r[$r],t[Yr]=r[Yr],t[Qr]=r[Qr],t[Xr]=r[Xr],t[zr]=r[zr],t[Zr]=r[Zr],t[Jr]=r[Jr],t[en]=r[en],t[tn]=r[tn],t[rn]=r[rn],t};return e}();var Pe;(function(e){e["SET"]="$set";e["SET_ONCE"]="$setOnce";e["ADD"]="$add";e["APPEND"]="$append";e["PREPEND"]="$prepend";e["REMOVE"]="$remove";e["PREINSERT"]="$preInsert";e["POSTINSERT"]="$postInsert";e["UNSET"]="$unset";e["CLEAR_ALL"]="$clearAll"})(Pe||(Pe={}));var on;(function(e){e["REVENUE_PRODUCT_ID"]="$productId";e["REVENUE_QUANTITY"]="$quantity";e["REVENUE_PRICE"]="$price";e["REVENUE_TYPE"]="$revenueType";e["REVENUE_CURRENCY"]="$currency";e["REVENUE"]="$revenue"})(on||(on={}));var an;(function(e){e["IDENTIFY"]="$identify";e["GROUP_IDENTIFY"]="$groupidentify";e["REVENUE"]="revenue_amount"})(an||(an={}));var Jo=function(e){var t={};for(var r in e){var n=e[r];if(n){t[r]=n}}return t};var ns="[Amplitude] Page Viewed";var sn=function(e){if(e===void 0){e={}}var t;var r=ze();var n=void 0;var o;var i;var a=e.trackOn,u=e.trackHistoryChanges,s=e.eventType,c=s===void 0?ns:s;var l=function(h){var m=h;try{m=decodeURI(h)}catch(y){n===null||n===void 0?void 0:n.error("Malformed URI sequence: ",y)}return m};var d=function(){return E(void 0,void 0,void 0,function(){var h,m;var y;return g(this,function(T){switch(T.label){case 0:h=l(typeof location!=="undefined"&&location.href||"");y={event_type:c};m=[{}];return[4,os()];case 1:return[2,(y.event_properties=x.apply(void 0,[x.apply(void 0,m.concat([T.sent()])),{"[Amplitude] Page Domain":typeof location!=="undefined"&&location.hostname||"","[Amplitude] Page Location":h,"[Amplitude] Page Path":typeof location!=="undefined"&&l(location.pathname)||"","[Amplitude] Page Title":typeof document!=="undefined"&&document.title||"","[Amplitude] Page URL":h.split("?")[0]}]),y)]}})})};var f=function(){return typeof a==="undefined"||typeof a==="function"&&a()};var p=typeof location!=="undefined"?location.href:null;var v=function(){return E(void 0,void 0,void 0,function(){var h,m,y,T,P;return g(this,function(S){switch(S.label){case 0:h=location.href;m=as(u,h,p||"")&&f();p=h;if(!m)return[3,4];n===null||n===void 0?void 0:n.log("Tracking page view event");if(!(t===null||t===void 0))return[3,1];y=void 0;return[3,3];case 1:P=(T=t).track;return[4,d()];case 2:y=P.apply(T,[S.sent()]);S.label=3;case 3:y;S.label=4;case 4:return[2]}})})};var _=function(){void v()};var b={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(h,m){return E(void 0,void 0,void 0,function(){var y,T;return g(this,function(P){switch(P.label){case 0:t=m;i=h;n=h.loggerProvider;n.log("Installing @amplitude/plugin-page-view-tracking-browser");if(r){r.addEventListener("popstate",_);o=r.history.pushState;r.history.pushState=new Proxy(r.history.pushState,{apply:function(S,w,A){var R=I(A,3),z=R[0],Z=R[1],Q=R[2];S.apply(w,[z,Z,Q]);void v()}})}if(!f())return[3,2];n.log("Tracking page view event");T=(y=t).track;return[4,d()];case 1:T.apply(y,[P.sent()]);P.label=2;case 2:return[2]}})})},execute:function(h){return E(void 0,void 0,void 0,function(){var m;return g(this,function(y){switch(y.label){case 0:if(!(a==="attribution"&&is(h)))return[3,2];n===null||n===void 0?void 0:n.log("Enriching campaign event to page view event with campaign parameters");return[4,d()];case 1:m=y.sent();h.event_type=m.event_type;h.event_properties=x(x({},h.event_properties),m.event_properties);y.label=2;case 2:if(i&&h.event_type===c){i.pageCounter=!i.pageCounter?1:i.pageCounter+1;h.event_properties=x(x({},h.event_properties),{"[Amplitude] Page Counter":i.pageCounter})}return[2,h]}})})},teardown:function(){return E(void 0,void 0,void 0,function(){return g(this,function(h){if(r){r.removeEventListener("popstate",_);if(o){r.history.pushState=o}}return[2]})})}};return b};var os=function(){return E(void 0,void 0,void 0,function(){var e;return g(this,function(t){switch(t.label){case 0:e=Jo;return[4,new nn().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})};var is=function(e){if(e.event_type==="$identify"&&e.user_properties){var t=e.user_properties;var r=t[Pe.SET]||{};var n=t[Pe.UNSET]||{};var o=O(O([],I(Object.keys(r)),false),I(Object.keys(n)),false);return Object.keys(Ze).every(function(i){return o.includes(i)})}return false};var as=function(e,t,r){switch(e){case"pathOnly":{if(r=="")return true;var n=new URL(t);var o=new URL(r);var i=n.origin+n.pathname;var a=o.origin+o.pathname;return i!==a}default:return t!==r}};var ti=function(){var e;var t=[];var r=function(c,l,d){c.addEventListener(l,d);t.push({element:c,type:l,handler:d})};var n=function(){t.forEach(function(c){var l=c.element,d=c.type,f=c.handler;l===null||l===void 0?void 0:l.removeEventListener(d,f)});t=[]};var o="@amplitude/plugin-form-interaction-tracking-browser";var i="enrichment";var a=function(c,l){return E(void 0,void 0,void 0,function(){var d;return g(this,function(f){(d=W())===null||d===void 0?void 0:d.addEventListener("load",function(){if(!l){c.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return}if(typeof document==="undefined"){return}var p=function(_){var b=false;r(_,"change",function(){var h;var m=ei(_);if(!b){l.track(qr,(h={},h[yt]=Ce(_.id),h[Et]=Ce(_.name),h[bt]=m,h))}b=true});r(_,"submit",function(){var h,m;var y=ei(_);if(!b){l.track(qr,(h={},h[yt]=Ce(_.id),h[Et]=Ce(_.name),h[bt]=y,h))}l.track(Mo,(m={},m[yt]=Ce(_.id),m[Et]=Ce(_.name),m[bt]=y,m));b=false})};var v=Array.from(document.getElementsByTagName("form"));v.forEach(p);if(typeof MutationObserver!=="undefined"){e=new MutationObserver(function(_){_.forEach(function(b){b.addedNodes.forEach(function(h){if(h.nodeName==="FORM"){p(h)}if("querySelectorAll"in h&&typeof h.querySelectorAll==="function"){Array.from(h.querySelectorAll("form")).map(p)}})})});e.observe(document.body,{subtree:true,childList:true})}});return[2]})})};var u=function(c){return E(void 0,void 0,void 0,function(){return g(this,function(l){return[2,c]})})};var s=function(){return E(void 0,void 0,void 0,function(){return g(this,function(c){e===null||e===void 0?void 0:e.disconnect();n();return[2]})})};return{name:o,type:i,setup:a,execute:u,teardown:s}};var Ce=function(e){if(typeof e!=="string"){return void 0}return e};var ei=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(t!==null&&t!==void 0?t:""),window.location.href).href}catch(r){}return t};var ri=function(){var e;var t=[];var r=function(c,l,d){c.addEventListener(l,d);t.push({element:c,type:l,handler:d})};var n=function(){t.forEach(function(c){var l=c.element,d=c.type,f=c.handler;l===null||l===void 0?void 0:l.removeEventListener(d,f)});t=[]};var o="@amplitude/plugin-file-download-tracking-browser";var i="enrichment";var a=function(c,l){return E(void 0,void 0,void 0,function(){var d;return g(this,function(f){(d=W())===null||d===void 0?void 0:d.addEventListener("load",function(){if(!l){c.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return}if(typeof document==="undefined"){return}var p=function(b){var h;try{h=new URL(b.href,window.location.href)}catch(T){return}var m=v.exec(h.href);var y=m===null||m===void 0?void 0:m[1];if(y){r(b,"click",function(){var T;if(y){l.track(Fo,(T={},T[Vo]=y,T[Go]=h.pathname,T[qo]=b.id,T[Bo]=b.text,T[jo]=b.href,T))}})}};var 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)(\\?.+)?$/;var _=Array.from(document.getElementsByTagName("a"));_.forEach(p);if(typeof MutationObserver!=="undefined"){e=new MutationObserver(function(b){b.forEach(function(h){h.addedNodes.forEach(function(m){if(m.nodeName==="A"){p(m)}if("querySelectorAll"in m&&typeof m.querySelectorAll==="function"){Array.from(m.querySelectorAll("a")).map(p)}})})});e.observe(document.body,{subtree:true,childList:true})}});return[2]})})};var u=function(c){return E(void 0,void 0,void 0,function(){return g(this,function(l){return[2,c]})})};var s=function(){return E(void 0,void 0,void 0,function(){return g(this,function(c){e===null||e===void 0?void 0:e.disconnect();n();return[2]})})};return{name:o,type:i,setup:a,execute:u,teardown:s}};var ni=false;var oi=function(e){if(ni||e.defaultTracking!==void 0){return}var t="\`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.";e.loggerProvider.warn(t);ni=true};var ii=function(){var e="@amplitude/plugin-network-checker-browser";var t="before";var r=W();var n=[];var o=function(s,c){if(r){r.addEventListener(s,c);n.push({type:s,handler:c})}};var i=function(){n.forEach(function(s){var c=s.type,l=s.handler;if(r){r.removeEventListener(c,l)}});n=[]};var a=function(s,c){return E(void 0,void 0,void 0,function(){return g(this,function(l){if(typeof navigator==="undefined"){s.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available.");s.offline=false;return[2]}s.offline=!navigator.onLine;o("online",function(){s.loggerProvider.debug("Network connectivity changed to online.");s.offline=false;setTimeout(function(){c.flush()},s.flushIntervalMillis)});o("offline",function(){s.loggerProvider.debug("Network connectivity changed to offline.");s.offline=true});return[2]})})};var u=function(){return E(void 0,void 0,void 0,function(){return g(this,function(s){i();return[2]})})};return{name:e,type:t,setup:a,teardown:u}};var Le;(function(e){e["US"]="US";e["EU"]="EU";e["STAGING"]="STAGING"})(Le||(Le={}));var K;(function(e){e["Unknown"]="unknown";e["Skipped"]="skipped";e["Success"]="success";e["RateLimit"]="rate_limit";e["PayloadTooLarge"]="payload_too_large";e["Invalid"]="invalid";e["Failed"]="failed";e["Timeout"]="Timeout";e["SystemError"]="SystemError"})(K||(K={}));var un=function(){function e(){}e.prototype.send=function(t,r){return Promise.resolve(null)};e.prototype.buildResponse=function(t){var r,n,o,i,a,u,s,c,l,d,f,p,v,_,b,h,m,y,T,P,S,w;if(typeof t!=="object"){return null}var A=t.code||0;var R=this.buildStatus(A);switch(R){case K.Success:return{status:R,statusCode:A,body:{eventsIngested:(r=t.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=t.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(o=t.server_upload_time)!==null&&o!==void 0?o:0}};case K.Invalid:return{status:R,statusCode:A,body:{error:(i=t.error)!==null&&i!==void 0?i:"",missingField:(a=t.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(u=t.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(s=t.events_with_missing_fields)!==null&&s!==void 0?s:{},eventsWithInvalidIdLengths:(c=t.events_with_invalid_id_lengths)!==null&&c!==void 0?c:{},epsThreshold:(l=t.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(d=t.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(f=t.silenced_devices)!==null&&f!==void 0?f:[],silencedEvents:(p=t.silenced_events)!==null&&p!==void 0?p:[],throttledDevices:(v=t.throttled_devices)!==null&&v!==void 0?v:{},throttledEvents:(_=t.throttled_events)!==null&&_!==void 0?_:[]}};case K.PayloadTooLarge:return{status:R,statusCode:A,body:{error:(b=t.error)!==null&&b!==void 0?b:""}};case K.RateLimit:return{status:R,statusCode:A,body:{error:(h=t.error)!==null&&h!==void 0?h:"",epsThreshold:(m=t.eps_threshold)!==null&&m!==void 0?m:0,throttledDevices:(y=t.throttled_devices)!==null&&y!==void 0?y:{},throttledUsers:(T=t.throttled_users)!==null&&T!==void 0?T:{},exceededDailyQuotaDevices:(P=t.exceeded_daily_quota_devices)!==null&&P!==void 0?P:{},exceededDailyQuotaUsers:(S=t.exceeded_daily_quota_users)!==null&&S!==void 0?S:{},throttledEvents:(w=t.throttled_events)!==null&&w!==void 0?w:[]}};case K.Timeout:default:return{status:R,statusCode:A}}};e.prototype.buildStatus=function(t){if(t>=200&&t<300){return K.Success}if(t===429){return K.RateLimit}if(t===413){return K.PayloadTooLarge}if(t===408){return K.Timeout}if(t>=400&&t<500){return K.Invalid}if(t>=500){return K.Failed}return K.Unknown};return e}();var ss="Network error occurred, remote config fetch failed";var us="Remote config successfully fetched";var cs="Remote config fetch rejected due to exceeded retry count";var ai="Remote config fetch rejected due to timeout after 5 seconds";var si="Unexpected error occurred";var ls="https://sr-client-cfg.amplitude.com/config";var fs="https://sr-client-cfg.stag2.amplitude.com/config";var ds="https://sr-client-cfg.eu.amplitude.com/config";var ps=function(){function e(t){var r=t.localConfig,n=t.configKeys;var o=this;this.retryTimeout=1e3;this.attempts=0;this.sessionTargetingMatch=false;this.metrics={};this.getRemoteConfig=function(i,a,u){return E(o,void 0,void 0,function(){var s,c,l;return g(this,function(d){switch(d.label){case 0:s=Date.now();return[4,this.fetchWithTimeout(u)];case 1:c=d.sent();if(c){l=c.configs&&c.configs[i];if(l){this.metrics.fetchTimeAPISuccess=Date.now()-s;return[2,l[a]]}}this.metrics.fetchTimeAPIFail=Date.now()-s;return[2,void 0]}})})};this.fetchWithTimeout=function(i){return E(o,void 0,void 0,function(){var a,u,s;return g(this,function(c){switch(c.label){case 0:a=new AbortController;u=setTimeout(function(){return a.abort()},5e3);return[4,this.fetchRemoteConfig(a.signal,i)];case 1:s=c.sent();clearTimeout(u);return[2,s]}})})};this.fetchRemoteConfig=function(i,a){return E(o,void 0,void 0,function(){var u,s,c,l,d,f,p,v,_,b;var h,m;var y;return g(this,function(T){switch(T.label){case 0:if(a===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries){return[2,this.completeRequest({err:cs})]}else if(i.aborted){return[2,this.completeRequest({err:ai})]}else if(a!==this.lastFetchedSessionId){this.lastFetchedSessionId=a;this.attempts=0}T.label=1;case 1:T.trys.push([1,3,,4]);u=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(s=D(this.configKeys),c=s.next();!c.done;c=s.next()){l=c.value;u.append("config_keys",l)}}catch(P){h={error:P}}finally{try{if(c&&!c.done&&(m=s.return))m.call(s)}finally{if(h)throw h.error}}if(a){u.set("session_id",String(a))}d={headers:{Accept:"*/*"},method:"GET"};f="".concat(this.getServerUrl(),"?").concat(u.toString());this.attempts+=1;return[4,fetch(f,x(x({},d),{signal:i}))];case 2:p=T.sent();if(p===null){return[2,this.completeRequest({err:si})]}v=new un().buildStatus(p.status);switch(v){case K.Success:this.attempts=0;return[2,this.parseAndStoreConfig(p)];case K.Failed:return[2,this.retryFetch(i,a)];default:return[2,this.completeRequest({err:ss})]}return[3,4];case 3:_=T.sent();b=_;if(i.aborted){return[2,this.completeRequest({err:ai})]}return[2,this.completeRequest({err:(y=b.message)!==null&&y!==void 0?y:si})];case 4:return[2]}})})};this.retryFetch=function(i,a){return E(o,void 0,void 0,function(){var u=this;return g(this,function(s){switch(s.label){case 0:return[4,new Promise(function(c){return setTimeout(c,u.attempts*u.retryTimeout)})];case 1:s.sent();return[2,this.fetchRemoteConfig(i,a)]}})})};this.parseAndStoreConfig=function(i){return E(o,void 0,void 0,function(){var a;return g(this,function(u){switch(u.label){case 0:return[4,i.json()];case 1:a=u.sent();this.completeRequest({success:us});return[2,a]}})})};this.localConfig=r;this.configKeys=n}e.prototype.getServerUrl=function(){if(this.localConfig.serverZone===Le.STAGING){return fs}if(this.localConfig.serverZone===Le.EU){return ds}return ls};e.prototype.completeRequest=function(t){var r=t.err,n=t.success;if(r){throw new Error(r)}else if(n){this.localConfig.loggerProvider.log(n)}};return e}();var ui=function(e){var t=e.localConfig,r=e.configKeys;return E(void 0,void 0,void 0,function(){return g(this,function(n){return[2,new ps({localConfig:t,configKeys:r})]})})};var ci=ui;var ms=function(){function e(t){this.config=t;this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}e.prototype.initialize=function(){return E(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:t=this;return[4,ci({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:t.remoteConfigFetch=r.sent();return[2]}})})};e.prototype.generateJoinedConfig=function(){return E(this,void 0,void 0,function(){var t,r,n;var o,i,a;var u;return g(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);r=this.remoteConfigFetch;if(!r)return[3,2];return[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)];case 1:r=s.sent();s.label=2;case 2:t=r;this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(t,null,2));if(t&&"autocapture"in t){if(typeof t.autocapture==="boolean"){this.config.autocapture=t.autocapture}if(typeof t.autocapture==="object"){if(this.config.autocapture===void 0){this.config.autocapture=t.autocapture}if(typeof this.config.autocapture==="boolean"){this.config.autocapture=x({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},t.autocapture)}if(typeof this.config.autocapture==="object"){this.config.autocapture=x(x({},this.config.autocapture),t.autocapture)}}this.config.defaultTracking=this.config.autocapture}this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2));(o=(u=this.config).requestMetadata)!==null&&o!==void 0?o:u.requestMetadata=new We;if((i=this.remoteConfigFetch)===null||i===void 0?void 0:i.metrics.fetchTimeAPISuccess){this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess)}if((a=this.remoteConfigFetch)===null||a===void 0?void 0:a.metrics.fetchTimeAPIFail){this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail)}return[3,4];case 3:n=s.sent();this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",n);return[3,4];case 4:return[2,this.config]}})})};return e}();var li=function(e){return E(void 0,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:t=new ms(e);return[4,t.initialize()];case 1:r.sent();return[2,t]}})})};var cn=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"];var ln="data-amp-track-";var fn=["div","span","h1","h2","h3","h4","h5","h6"];var fi="@amplitude/plugin-autocapture-browser";var Je="[Amplitude] Element Clicked";var di="[Amplitude] Element Changed";var pi="[Amplitude] Element ID";var vi="[Amplitude] Element Class";var Tt="[Amplitude] Element Tag";var xt="[Amplitude] Element Text";var mi="[Amplitude] Element Hierarchy";var hi="[Amplitude] Element Href";var gi="[Amplitude] Element Position Left";var _i="[Amplitude] Element Position Top";var yi="[Amplitude] Element Aria Label";var Ei="[Amplitude] Element Attributes";var It="[Amplitude] Element Selector";var bi="[Amplitude] Element Parent Label";var St="[Amplitude] Page URL";var Ti="[Amplitude] Page Title";var xi="[Amplitude] Viewport Height";var Ii="[Amplitude] Viewport Width";var et="https://app.amplitude.com";var hs="https://app.eu.amplitude.com";var gs="https://apps.stag2.amplitude.com";var Si={US:et,EU:hs,STAGING:gs};var wi="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz";var tt="amp-visual-tagging-selector-highlight";function L(e){return typeof e==="function"}function wt(e){var t=function(n){Error.call(n);n.stack=new Error().stack};var r=e(t);r.prototype=Object.create(Error.prototype);r.prototype.constructor=r;return r}var At=wt(function(e){return function t(r){e(this);this.message=r?r.length+" errors occurred during unsubscription:\\n"+r.map(function(n,o){return o+1+") "+n.toString()}).join("\\n "):"";this.name="UnsubscriptionError";this.errors=r}});function rt(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Re=function(){function e(t){this.initialTeardown=t;this.closed=false;this._parentage=null;this._finalizers=null}e.prototype.unsubscribe=function(){var t,r,n,o;var i;if(!this.closed){this.closed=true;var a=this._parentage;if(a){this._parentage=null;if(Array.isArray(a)){try{for(var u=D(a),s=u.next();!s.done;s=u.next()){var c=s.value;c.remove(this)}}catch(_){t={error:_}}finally{try{if(s&&!s.done&&(r=u.return))r.call(u)}finally{if(t)throw t.error}}}else{a.remove(this)}}var l=this.initialTeardown;if(L(l)){try{l()}catch(_){i=_ instanceof At?_.errors:[_]}}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=D(d),p=f.next();!p.done;p=f.next()){var v=p.value;try{Pi(v)}catch(_){i=i!==null&&i!==void 0?i:[];if(_ instanceof At){i=O(O([],I(i)),I(_.errors))}else{i.push(_)}}}}catch(_){n={error:_}}finally{try{if(p&&!p.done&&(o=f.return))o.call(f)}finally{if(n)throw n.error}}}if(i){throw new At(i)}}};e.prototype.add=function(t){var r;if(t&&t!==this){if(this.closed){Pi(t)}else{if(t instanceof e){if(t.closed||t._hasParent(this)){return}t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}}};e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)};e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t};e.prototype._removeParent=function(t){var r=this._parentage;if(r===t){this._parentage=null}else if(Array.isArray(r)){rt(r,t)}};e.prototype.remove=function(t){var r=this._finalizers;r&&rt(r,t);if(t instanceof e){t._removeParent(this)}};e.EMPTY=function(){var t=new e;t.closed=true;return t}();return e}();var _d=Re.EMPTY;function Pt(e){return e instanceof Re||e&&"closed"in e&&L(e.remove)&&L(e.add)&&L(e.unsubscribe)}function Pi(e){if(L(e)){e()}else{e.unsubscribe()}}var oe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:false,useDeprecatedNextContext:false};var Oe={setTimeout:function(e,t){var r=[];for(var n=2;n<arguments.length;n++){r[n-2]=arguments[n]}var o=Oe.delegate;if(o===null||o===void 0?void 0:o.setTimeout){return o.setTimeout.apply(o,O([e,t],I(r)))}return setTimeout.apply(void 0,O([e,t],I(r)))},clearTimeout:function(e){var t=Oe.delegate;return((t===null||t===void 0?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Ct(e){Oe.setTimeout(function(){var t=oe.onUnhandledError;if(t){t(e)}else{throw e}})}function ye(){}var Ci=function(){return dn("C",void 0,void 0)}();function Li(e){return dn("E",void 0,e)}function Ri(e){return dn("N",e,void 0)}function dn(e,t,r){return{kind:e,value:t,error:r}}var Ee=null;function Oi(e){if(oe.useDeprecatedSynchronousErrorHandling){var t=!Ee;if(t){Ee={errorThrown:false,error:null}}e();if(t){var r=Ee,n=r.errorThrown,o=r.error;Ee=null;if(n){throw o}}}else{e()}}function Di(e){if(oe.useDeprecatedSynchronousErrorHandling&&Ee){Ee.errorThrown=true;Ee.error=e}}var nt=function(e){U(t,e);function t(r){var n=e.call(this)||this;n.isStopped=false;if(r){n.destination=r;if(Pt(r)){r.add(n)}}else{n.destination=bs}return n}t.create=function(r,n,o){return new Rt(r,n,o)};t.prototype.next=function(r){if(this.isStopped){vn(Ri(r),this)}else{this._next(r)}};t.prototype.error=function(r){if(this.isStopped){vn(Li(r),this)}else{this.isStopped=true;this._error(r)}};t.prototype.complete=function(){if(this.isStopped){vn(Ci,this)}else{this.isStopped=true;this._complete()}};t.prototype.unsubscribe=function(){if(!this.closed){this.isStopped=true;e.prototype.unsubscribe.call(this);this.destination=null}};t.prototype._next=function(r){this.destination.next(r)};t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}};t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}};return t}(Re);var _s=Function.prototype.bind;function pn(e,t){return _s.call(e,t)}var ys=function(){function e(t){this.partialObserver=t}e.prototype.next=function(t){var r=this.partialObserver;if(r.next){try{r.next(t)}catch(n){Lt(n)}}};e.prototype.error=function(t){var r=this.partialObserver;if(r.error){try{r.error(t)}catch(n){Lt(n)}}else{Lt(t)}};e.prototype.complete=function(){var t=this.partialObserver;if(t.complete){try{t.complete()}catch(r){Lt(r)}}};return e}();var Rt=function(e){U(t,e);function t(r,n,o){var i=e.call(this)||this;var a;if(L(r)||!r){a={next:r!==null&&r!==void 0?r:void 0,error:n!==null&&n!==void 0?n:void 0,complete:o!==null&&o!==void 0?o:void 0}}else{var u;if(i&&oe.useDeprecatedNextContext){u=Object.create(r);u.unsubscribe=function(){return i.unsubscribe()};a={next:r.next&&pn(r.next,u),error:r.error&&pn(r.error,u),complete:r.complete&&pn(r.complete,u)}}else{a=r}}i.destination=new ys(a);return i}return t}(nt);function Lt(e){if(oe.useDeprecatedSynchronousErrorHandling){Di(e)}else{Ct(e)}}function Es(e){throw e}function vn(e,t){var r=oe.onStoppedNotification;r&&Oe.setTimeout(function(){return r(e,t)})}var bs={closed:true,next:ye,error:Es,complete:ye};var De=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}();function Ot(e){return e}function Ui(e){if(e.length===0){return Ot}if(e.length===1){return e[0]}return function t(r){return e.reduce(function(n,o){return o(n)},r)}}var q=function(){function e(t){if(t){this._subscribe=t}}e.prototype.lift=function(t){var r=new e;r.source=this;r.operator=t;return r};e.prototype.subscribe=function(t,r,n){var o=this;var i=xs(t)?t:new Rt(t,r,n);Oi(function(){var a=o,u=a.operator,s=a.source;i.add(u?u.call(i,s):s?o._subscribe(i):o._trySubscribe(i))});return i};e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}};e.prototype.forEach=function(t,r){var n=this;r=ki(r);return new r(function(o,i){var a=new Rt({next:function(u){try{t(u)}catch(s){i(s);a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})};e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)};e.prototype[De]=function(){return this};e.prototype.pipe=function(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}return Ui(t)(this)};e.prototype.toPromise=function(t){var r=this;t=ki(t);return new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})};e.create=function(t){return new e(t)};return e}();function ki(e){var t;return(t=e!==null&&e!==void 0?e:oe.Promise)!==null&&t!==void 0?t:Promise}function Ts(e){return e&&L(e.next)&&L(e.error)&&L(e.complete)}function xs(e){return e&&e instanceof nt||Ts(e)&&Pt(e)}function Is(e){return L(e===null||e===void 0?void 0:e.lift)}function N(e){return function(t){if(Is(t)){return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}})}throw new TypeError("Unable to lift unknown Observable type")}}function k(e,t,r,n,o){return new Ss(e,t,r,n,o)}var Ss=function(e){U(t,e);function t(r,n,o,i,a,u){var s=e.call(this,r)||this;s.onFinalize=a;s.shouldUnsubscribe=u;s._next=n?function(c){try{n(c)}catch(l){r.error(l)}}:e.prototype._next;s._error=i?function(c){try{i(c)}catch(l){r.error(l)}finally{this.unsubscribe()}}:e.prototype._error;s._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete;return s}t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this);!n&&((r=this.onFinalize)===null||r===void 0?void 0:r.call(this))}};return t}(nt);var mn={now:function(){return(mn.delegate||Date).now()},delegate:void 0};var Ni=function(e){U(t,e);function t(r,n){return e.call(this)||this}t.prototype.schedule=function(r,n){if(n===void 0){n=0}return this};return t}(Re);var ot={setInterval:function(e,t){var r=[];for(var n=2;n<arguments.length;n++){r[n-2]=arguments[n]}var o=ot.delegate;if(o===null||o===void 0?void 0:o.setInterval){return o.setInterval.apply(o,O([e,t],I(r)))}return setInterval.apply(void 0,O([e,t],I(r)))},clearInterval:function(e){var t=ot.delegate;return((t===null||t===void 0?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0};var Mi=function(e){U(t,e);function t(r,n){var o=e.call(this,r,n)||this;o.scheduler=r;o.work=n;o.pending=false;return o}t.prototype.schedule=function(r,n){var o;if(n===void 0){n=0}if(this.closed){return this}this.state=r;var i=this.id;var a=this.scheduler;if(i!=null){this.id=this.recycleAsyncId(a,i,n)}this.pending=true;this.delay=n;this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(a,this.id,n);return this};t.prototype.requestAsyncId=function(r,n,o){if(o===void 0){o=0}return ot.setInterval(r.flush.bind(r,this),o)};t.prototype.recycleAsyncId=function(r,n,o){if(o===void 0){o=0}if(o!=null&&this.delay===o&&this.pending===false){return n}if(n!=null){ot.clearInterval(n)}return void 0};t.prototype.execute=function(r,n){if(this.closed){return new Error("executing a cancelled action")}this.pending=false;var o=this._execute(r,n);if(o){return o}else if(this.pending===false&&this.id!=null){this.id=this.recycleAsyncId(this.scheduler,this.id,null)}};t.prototype._execute=function(r,n){var o=false;var i;try{this.work(r)}catch(a){o=true;i=a?a:new Error("Scheduled action threw falsy error")}if(o){this.unsubscribe();return i}};t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,o=r.scheduler;var i=o.actions;this.work=this.state=this.scheduler=null;this.pending=false;rt(i,this);if(n!=null){this.id=this.recycleAsyncId(o,n,null)}this.delay=null;e.prototype.unsubscribe.call(this)}};return t}(Ni);var hn=function(){function e(t,r){if(r===void 0){r=e.now}this.schedulerActionCtor=t;this.now=r}e.prototype.schedule=function(t,r,n){if(r===void 0){r=0}return new this.schedulerActionCtor(this,t).schedule(n,r)};e.now=mn.now;return e}();var Fi=function(e){U(t,e);function t(r,n){if(n===void 0){n=hn.now}var o=e.call(this,r,n)||this;o.actions=[];o._active=false;return o}t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var o;this._active=true;do{if(o=r.execute(r.state,r.delay)){break}}while(r=n.shift());this._active=false;if(o){while(r=n.shift()){r.unsubscribe()}throw o}};return t}(hn);var be=new Fi(Mi);var Vi=be;var Te=new q(function(e){return e.complete()});function Dt(e){return e&&L(e.schedule)}function Gi(e){return e[e.length-1]}function Ut(e){return Dt(Gi(e))?e.pop():void 0}function qi(e,t){return typeof Gi(e)==="number"?e.pop():t}var Ue=function(e){return e&&typeof e.length==="number"&&typeof e!=="function"};function kt(e){return L(e===null||e===void 0?void 0:e.then)}function Nt(e){return L(e[De])}function Mt(e){return Symbol.asyncIterator&&L(e===null||e===void 0?void 0:e[Symbol.asyncIterator])}function Ft(e){return new TypeError("You provided "+(e!==null&&typeof e==="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ws(){if(typeof Symbol!=="function"||!Symbol.iterator){return"@@iterator"}return Symbol.iterator}var Vt=ws();function Gt(e){return L(e===null||e===void 0?void 0:e[Vt])}function qt(e){return to(this,arguments,function t(){var r,n,o,i;return g(this,function(a){switch(a.label){case 0:r=e.getReader();a.label=1;case 1:a.trys.push([1,,9,10]);a.label=2;case 2:if(false)return[3,8];return[4,he(r.read())];case 3:n=a.sent(),o=n.value,i=n.done;if(!i)return[3,5];return[4,he(void 0)];case 4:return[2,a.sent()];case 5:return[4,he(o)];case 6:return[4,a.sent()];case 7:a.sent();return[3,2];case 8:return[3,10];case 9:r.releaseLock();return[7];case 10:return[2]}})})}function Bt(e){return L(e===null||e===void 0?void 0:e.getReader)}function B(e){if(e instanceof q){return e}if(e!=null){if(Nt(e)){return As(e)}if(Ue(e)){return Ps(e)}if(kt(e)){return Cs(e)}if(Mt(e)){return Bi(e)}if(Gt(e)){return Ls(e)}if(Bt(e)){return Rs(e)}}throw Ft(e)}function As(e){return new q(function(t){var r=e[De]();if(L(r.subscribe)){return r.subscribe(t)}throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ps(e){return new q(function(t){for(var r=0;r<e.length&&!t.closed;r++){t.next(e[r])}t.complete()})}function Cs(e){return new q(function(t){e.then(function(r){if(!t.closed){t.next(r);t.complete()}},function(r){return t.error(r)}).then(null,Ct)})}function Ls(e){return new q(function(t){var r,n;try{for(var o=D(e),i=o.next();!i.done;i=o.next()){var a=i.value;t.next(a);if(t.closed){return}}}catch(u){r={error:u}}finally{try{if(i&&!i.done&&(n=o.return))n.call(o)}finally{if(r)throw r.error}}t.complete()})}function Bi(e){return new q(function(t){Os(e,t).catch(function(r){return t.error(r)})})}function Rs(e){return Bi(qt(e))}function Os(e,t){var r,n;var o,i;return E(this,void 0,void 0,function(){var a,u;return g(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]);r=ro(e);s.label=1;case 1:return[4,r.next()];case 2:if(!(n=s.sent(),!n.done))return[3,4];a=n.value;t.next(a);if(t.closed){return[2]}s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:u=s.sent();o={error:u};return[3,11];case 6:s.trys.push([6,,9,10]);if(!(n&&!n.done&&(i=r.return)))return[3,8];return[4,i.call(r)];case 7:s.sent();s.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:t.complete();return[2]}})})}function ee(e,t,r,n,o){if(n===void 0){n=0}if(o===void 0){o=false}var i=t.schedule(function(){r();if(o){e.add(this.schedule(null,n))}else{this.unsubscribe()}},n);e.add(i);if(!o){return i}}function jt(e,t){if(t===void 0){t=0}return N(function(r,n){r.subscribe(k(n,function(o){return ee(n,e,function(){return n.next(o)},t)},function(){return ee(n,e,function(){return n.complete()},t)},function(o){return ee(n,e,function(){return n.error(o)},t)}))})}function Wt(e,t){if(t===void 0){t=0}return N(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function ji(e,t){return B(e).pipe(Wt(t),jt(t))}function Wi(e,t){return B(e).pipe(Wt(t),jt(t))}function Ki(e,t){return new q(function(r){var n=0;return t.schedule(function(){if(n===e.length){r.complete()}else{r.next(e[n++]);if(!r.closed){this.schedule()}}})})}function Hi(e,t){return new q(function(r){var n;ee(r,t,function(){n=e[Vt]();ee(r,t,function(){var o;var i;var a;try{o=n.next(),i=o.value,a=o.done}catch(u){r.error(u);return}if(a){r.complete()}else{r.next(i)}},0,true)});return function(){return L(n===null||n===void 0?void 0:n.return)&&n.return()}})}function Kt(e,t){if(!e){throw new Error("Iterable cannot be null")}return new q(function(r){ee(r,t,function(){var n=e[Symbol.asyncIterator]();ee(r,t,function(){n.next().then(function(o){if(o.done){r.complete()}else{r.next(o.value)}})},0,true)})})}function $i(e,t){return Kt(qt(e),t)}function Yi(e,t){if(e!=null){if(Nt(e)){return ji(e,t)}if(Ue(e)){return Ki(e,t)}if(kt(e)){return Wi(e,t)}if(Mt(e)){return Kt(e,t)}if(Gt(e)){return Hi(e,t)}if(Bt(e)){return $i(e,t)}}throw Ft(e)}function Ht(e,t){return t?Yi(e,t):B(e)}function $t(e){return e instanceof Date&&!isNaN(e)}var Ds=wt(function(e){return function t(r){if(r===void 0){r=null}e(this);this.message="Timeout has occurred";this.name="TimeoutError";this.info=r}});function gn(e,t){var r=$t(e)?{first:e}:typeof e==="number"?{each:e}:e,n=r.first,o=r.each,i=r.with,a=i===void 0?Us:i,u=r.scheduler,s=u===void 0?t!==null&&t!==void 0?t:be:u,c=r.meta,l=c===void 0?null:c;if(n==null&&o==null){throw new TypeError("No timeout provided.")}return N(function(d,f){var p;var v;var _=null;var b=0;var h=function(m){v=ee(f,s,function(){try{p.unsubscribe();B(a({meta:l,lastValue:_,seen:b})).subscribe(f)}catch(y){f.error(y)}},m)};p=d.subscribe(k(f,function(m){v===null||v===void 0?void 0:v.unsubscribe();b++;f.next(_=m);o>0&&h(o)},void 0,void 0,function(){if(!(v===null||v===void 0?void 0:v.closed)){v===null||v===void 0?void 0:v.unsubscribe()}_=null}));!b&&h(n!=null?typeof n==="number"?n:+n-s.now():o)})}function Us(e){throw new Ds(e)}function Y(e,t){return N(function(r,n){var o=0;r.subscribe(k(n,function(i){n.next(e.call(t,i,o++))}))})}var ks=Array.isArray;function Ns(e,t){return ks(t)?e.apply(void 0,O([],I(t))):e(t)}function Qi(e){return Y(function(t){return Ns(e,t)})}function Xi(e,t,r,n,o,i,a,u){var s=[];var c=0;var l=0;var d=false;var f=function(){if(d&&!s.length&&!c){t.complete()}};var p=function(_){return c<n?v(_):s.push(_)};var v=function(_){i&&t.next(_);c++;var b=false;B(r(_,l++)).subscribe(k(t,function(h){o===null||o===void 0?void 0:o(h);if(i){p(h)}else{t.next(h)}},function(){b=true},void 0,function(){if(b){try{c--;var h=function(){var m=s.shift();if(a){ee(t,a,function(){return v(m)})}else{v(m)}};while(s.length&&c<n){h()}f()}catch(m){t.error(m)}}}))};e.subscribe(k(t,p,function(){d=true;f()}));return function(){u===null||u===void 0?void 0:u()}}function xe(e,t,r){if(r===void 0){r=Infinity}if(L(t)){return xe(function(n,o){return Y(function(i,a){return t(n,i,o,a)})(B(e(n,o)))},r)}else if(typeof t==="number"){r=t}return N(function(n,o){return Xi(n,o,e,r)})}function Yt(e){if(e===void 0){e=Infinity}return xe(Ot,e)}function zi(){return Yt(1)}function Zi(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return zi()(Ht(e,Ut(e)))}var Ms=["addListener","removeListener"];var Fs=["addEventListener","removeEventListener"];var Vs=["on","off"];function Ie(e,t,r,n){if(L(r)){n=r;r=void 0}if(n){return Ie(e,t,r).pipe(Qi(n))}var o=I(Bs(e)?Fs.map(function(u){return function(s){return e[u](t,s,r)}}):Gs(e)?Ms.map(Ji(e,t)):qs(e)?Vs.map(Ji(e,t)):[],2),i=o[0],a=o[1];if(!i){if(Ue(e)){return xe(function(u){return Ie(u,t,r)})(B(e))}}if(!i){throw new TypeError("Invalid event target")}return new q(function(u){var s=function(){var c=[];for(var l=0;l<arguments.length;l++){c[l]=arguments[l]}return u.next(1<c.length?c:c[0])};i(s);return function(){return a(s)}})}function Ji(e,t){return function(r){return function(n){return e[r](t,n)}}}function Gs(e){return L(e.addListener)&&L(e.removeListener)}function qs(e){return L(e.on)&&L(e.off)}function Bs(e){return L(e.addEventListener)&&L(e.removeEventListener)}function ea(e,t,r){if(e===void 0){e=0}if(r===void 0){r=Vi}var n=-1;if(t!=null){if(Dt(t)){r=t}else{n=t}}return new q(function(o){var i=$t(e)?+e-r.now():e;if(i<0){i=0}var a=0;return r.schedule(function(){if(!o.closed){o.next(a++);if(0<=n){this.schedule(void 0,n)}else{o.complete()}}},i)})}function it(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=Ut(e);var n=qi(e,Infinity);var o=e;return!o.length?Te:o.length===1?B(o[0]):Yt(n)(Ht(o,r))}function ne(e,t){return N(function(r,n){var o=0;r.subscribe(k(n,function(i){return e.call(t,i,o++)&&n.next(i)}))})}function _n(e){return N(function(t,r){var n=[];t.subscribe(k(r,function(o){return n.push(o)},function(){r.next(n);r.complete()}));B(e).subscribe(k(r,function(){var o=n;n=[];r.next(o)},ye));return function(){n=null}})}function yn(e,t){if(t===void 0){t=be}return N(function(r,n){var o=null;var i=null;var a=null;var u=function(){if(o){o.unsubscribe();o=null;var c=i;i=null;n.next(c)}};function s(){var c=a+e;var l=t.now();if(l<c){o=this.schedule(void 0,c-l);n.add(o);return}u()}r.subscribe(k(n,function(c){i=c;a=t.now();if(!o){o=t.schedule(s,e);n.add(o)}},function(){u();n.complete()},void 0,function(){i=o=null}))})}function ke(e){return e<=0?function(){return Te}:N(function(t,r){var n=0;t.subscribe(k(r,function(o){if(++n<=e){r.next(o);if(e<=n){r.complete()}}}))})}function ta(){return N(function(e,t){e.subscribe(k(t,ye))})}function ra(e){return Y(function(){return e})}function En(e,t){if(t){return function(r){return Zi(t.pipe(ke(1),ta()),r.pipe(En(e)))}}return xe(function(r,n){return B(e(r,n)).pipe(ke(1),ra(r))})}function bn(e,t){if(t===void 0){t=be}var r=ea(e,t);return En(function(){return r})}function Tn(){return N(function(e,t){var r;var n=false;e.subscribe(k(t,function(o){var i=r;r=o;n&&t.next([i,o]);n=true}))})}function xn(e,t){return N(function(r,n){var o=null;var i=0;var a=false;var u=function(){return a&&!o&&n.complete()};r.subscribe(k(n,function(s){o===null||o===void 0?void 0:o.unsubscribe();var c=0;var l=i++;B(e(s,l)).subscribe(o=k(n,function(d){return n.next(t?t(s,d,l,c++):d)},function(){o=null;u()}))},function(){a=true;u()}))})}var ae;var Sn;function aa(e,t){if(e.nodeType!==Node.ELEMENT_NODE){throw new Error("Can't generate CSS selector for non-element node type.")}if("html"===e.tagName.toLowerCase()){return"html"}var r={root:document.body,idName:function(i){return true},className:function(i){return true},tagName:function(i){return true},attr:function(i,a){return false},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};ae=x(x({},r),t);Sn=js(ae.root,r);var n=Qt(e,"all",function(){return Qt(e,"two",function(){return Qt(e,"one",function(){return Qt(e,"none")})})});if(n){var o=ca(la(n,e));if(o.length>0){n=o[0]}return Zt(n)}else{throw new Error("Selector was not found.")}}function js(e,t){if(e.nodeType===Node.DOCUMENT_NODE){return e}if(e===t.root){return e.ownerDocument}return e}function Qt(e,t,r){var n=null;var o=[];var i=e;var a=0;var u=function(){var c,l;var d=zt(Ws(i))||zt.apply(void 0,O([],I(Ks(i)),false))||zt.apply(void 0,O([],I(Hs(i)),false))||zt($s(i))||[ia()];var f=Ys(i);if(t=="all"){if(f){d=d.concat(d.filter(In).map(function(h){return Xt(h,f)}))}}else if(t=="two"){d=d.slice(0,1);if(f){d=d.concat(d.filter(In).map(function(h){return Xt(h,f)}))}}else if(t=="one"){var p=I(d=d.slice(0,1),1),v=p[0];if(f&&In(v)){d=[Xt(v,f)]}}else if(t=="none"){d=[ia()];if(f){d=[Xt(d[0],f)]}}try{for(var _=(c=void 0,D(d)),b=_.next();!b.done;b=_.next()){var v=b.value;v.level=a}}catch(h){c={error:h}}finally{try{if(b&&!b.done&&(l=_.return))l.call(_)}finally{if(c)throw c.error}}o.push(d);if(o.length>=ae.seedMinLength){n=na(o,r);if(n){return"break"}}i=i.parentElement;a++};while(i){var s=u();if(s==="break")break}if(!n){n=na(o,r)}if(!n&&r){return r()}return n}function na(e,t){var r,n;var o=e.reduce(function(c,l){return c*l.length},1);if(o>ae.threshold){return t?t():null}var i=ca(ua(e));try{for(var a=D(i),u=a.next();!u.done;u=a.next()){var s=u.value;if(sa(s)){return s}}}catch(c){r={error:c}}finally{try{if(u&&!u.done&&(n=a.return))n.call(a)}finally{if(r)throw r.error}}return null}function Zt(e){var t=e[0];var r=t.name;for(var n=1;n<e.length;n++){var o=e[n].level||0;if(t.level===o-1){r="".concat(e[n].name," > ").concat(r)}else{r="".concat(e[n].name," ").concat(r)}t=e[n]}return r}function oa(e){return e.map(function(t){return t.penalty}).reduce(function(t,r){return t+r},0)}function sa(e){var t=Zt(e);switch(Sn.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return true;default:return false}}function Ws(e){var t=e.getAttribute("id");if(t&&ae.idName(t)){return{name:"#"+CSS.escape(t),penalty:0}}return null}function Ks(e){var t=Array.from(e.attributes).filter(function(r){return ae.attr(r.name,r.value)});return t.map(function(r){return{name:"[".concat(CSS.escape(r.name),'="').concat(CSS.escape(r.value),'"]'),penalty:.5}})}function Hs(e){var t=Array.from(e.classList).filter(ae.className);return t.map(function(r){return{name:"."+CSS.escape(r),penalty:1}})}function $s(e){var t=e.tagName.toLowerCase();if(ae.tagName(t)){return{name:t,penalty:2}}return null}function ia(){return{name:"*",penalty:3}}function Ys(e){var t=e.parentNode;if(!t){return null}var r=t.firstChild;if(!r){return null}var n=0;while(r){if(r.nodeType===Node.ELEMENT_NODE){n++}if(r===e){break}r=r.nextSibling}return n}function Xt(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function In(e){return e.name!=="html"&&!e.name.startsWith("#")}function zt(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=e.filter(Qs);if(r.length>0){return r}return null}function Qs(e){return e!==null&&e!==void 0}function ua(e,t){var r,n,o,i;var a,u;if(t===void 0){t=[]}return g(this,function(s){switch(s.label){case 0:if(!(e.length>0))return[3,9];s.label=1;case 1:s.trys.push([1,6,7,8]);r=D(e[0]),n=r.next();s.label=2;case 2:if(!!n.done)return[3,5];o=n.value;return[5,D(ua(e.slice(1,e.length),t.concat(o)))];case 3:s.sent();s.label=4;case 4:n=r.next();return[3,2];case 5:return[3,8];case 6:i=s.sent();a={error:i};return[3,8];case 7:try{if(n&&!n.done&&(u=r.return))u.call(r)}finally{if(a)throw a.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:s.sent();s.label=11;case 11:return[2]}})}function ca(e){return O([],I(e),false).sort(function(t,r){return oa(t)-oa(r)})}function la(e,t,r){var n,o,i;if(r===void 0){r={counter:0,visited:new Map}}return g(this,function(a){switch(a.label){case 0:if(!(e.length>2&&e.length>ae.optimizedMinLength))return[3,5];n=1;a.label=1;case 1:if(!(n<e.length-1))return[3,5];if(r.counter>ae.maxNumberOfTries){return[2]}r.counter+=1;o=O([],I(e),false);o.splice(n,1);i=Zt(o);if(r.visited.has(i)){return[2]}if(!(sa(o)&&Xs(o,t)))return[3,4];return[4,o];case 2:a.sent();r.visited.set(i,true);return[5,D(la(o,t,r))];case 3:a.sent();a.label=4;case 4:n++;return[3,1];case 5:return[2]}})}function Xs(e,t){return Sn.querySelector(Zt(e))===t}var zs=["input","select","textarea"];var Jt=function(e,t){return function(r,n){var o,i,a;var u=e.pageUrlAllowlist,s=e.shouldTrackEventResolver;var c=(i=(o=n===null||n===void 0?void 0:n.tagName)===null||o===void 0?void 0:o.toLowerCase)===null||i===void 0?void 0:i.call(o);if(!c){return false}if(s){return s(r,n)}if(!Js(window.location.href,u)){return false}var l=String(n===null||n===void 0?void 0:n.getAttribute("type"))||"";if(typeof l==="string"){switch(l.toLowerCase()){case"hidden":return false;case"password":return false}}if(t){var d=t.some(function(p){var v;return!!((v=n===null||n===void 0?void 0:n.matches)===null||v===void 0?void 0:v.call(n,p))});if(!d){return false}}switch(c){case"input":case"select":case"textarea":return r==="change"||r==="click";default:{var f=(a=window===null||window===void 0?void 0:window.getComputedStyle)===null||a===void 0?void 0:a.call(window,n);if(f&&f.getPropertyValue("cursor")==="pointer"&&r==="click"){return true}return r==="click"}}}};var fa=function(e){if(e==null){return false}if(typeof e==="string"){var t=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(t.test((e||"").replace(/[- ]/g,""))){return false}var r=/(^\\d{3}-?\\d{2}-?\\d{4}$)/;if(r.test(e)){return false}}return true};var Zs=function(e){return!!e&&e.nodeType===3};var wn=function(e){var t,r,n;var o=(r=(t=e===null||e===void 0?void 0:e.tagName)===null||t===void 0?void 0:t.toLowerCase)===null||r===void 0?void 0:r.call(t);var i=e instanceof HTMLElement?((n=e.getAttribute("contenteditable"))===null||n===void 0?void 0:n.toLowerCase())==="true":false;return!zs.includes(o)&&!i};var er=function(e){var t="";if(wn(e)&&e.childNodes&&e.childNodes.length){e.childNodes.forEach(function(r){var n="";if(Zs(r)){if(r.textContent){n=r.textContent}}else{n=er(r)}t+=n.split(/(\\s+)/).filter(fa).join("").replace(/[\\r\\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})}return t};var An=function(e,t){var r,n;var o="";try{o=aa(e,{className:function(l){return l!==tt},maxNumberOfTries:1e3});return o}catch(l){if(t){var i=l;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var a=(n=(r=e===null||e===void 0?void 0:e.tagName)===null||r===void 0?void 0:r.toLowerCase)===null||n===void 0?void 0:n.call(r);if(a){o=a}var u=e.getAttribute("id");var s=e.getAttribute("class");if(u){o="#".concat(u)}else if(s){var c=s.split(" ").filter(function(l){return l!==tt}).join(".");if(c){o="".concat(o,".").concat(c)}}return o};var Js=function(e,t){if(!t||!t.length){return true}return t.some(function(r){if(typeof r==="string"){return e===r}return e.match(r)})};var da=function(e,t){return e.getAttributeNames().reduce(function(r,n){if(n.startsWith(t)){var o=n.replace(t,"");var i=e.getAttribute(n);if(o){r[o]=i||""}}return r},{})};var eu=function(e){return e===void 0||e===null||typeof e==="object"&&Object.keys(e).length===0||typeof e==="string"&&e.trim().length===0};var Pn=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];if(!eu(n)){t[r]=n}return t},{})};var Cn=function(e){var t=e.parentElement;if(!t){return""}var r;try{r=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(o){r=null}if(r){var n=r.textContent||"";return fa(n)?n:""}return Cn(t)};var at=function(e,t){if(!e){return null}if(t.some(function(r){var n;return(n=e===null||e===void 0?void 0:e.matches)===null||n===void 0?void 0:n.call(e,r)})){return e}return at(e===null||e===void 0?void 0:e.parentElement,t)};var pa=function(e,t){var r;var n,o;if(!e){return{}}var i=(o=(n=e===null||e===void 0?void 0:e.tagName)===null||n===void 0?void 0:n.toLowerCase)===null||o===void 0?void 0:o.call(n);var a=An(e,t);var u=(r={},r[Tt]=i,r[xt]=er(e),r[It]=a,r[St]=window.location.href.split("?")[0],r);return Pn(u)};var va=function(e){return new Promise(function(t,r){var n;try{var o=document.createElement("script");o.type="text/javascript";o.async=true;o.src=e;o.addEventListener("load",function(){t({status:true})},{once:true});o.addEventListener("error",function(){r({status:false,message:"Failed to load the script ".concat(e)})});(n=document.head)===null||n===void 0?void 0:n.appendChild(o)}catch(i){r(i)}})};function ma(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}var Ne=function(e){if(e.event.target===null||!e.closestTrackedAncestor){return false}return true};var ha=function(){function e(t){var r=t===void 0?{}:t,n=r.origin,o=n===void 0?et:n;var i=this;this.endpoint=et;this.requestCallbacks={};this.onSelect=function(a){i.notify({action:"element-selected",data:a})};this.onTrack=function(a,u){if(a==="selector-mode-changed"){i.notify({action:"track-selector-mode-changed",data:u})}else if(a==="selector-moved"){i.notify({action:"track-selector-moved",data:u})}};this.endpoint=o}e.prototype.notify=function(t){var r,n,o,i;(n=(r=this.logger)===null||r===void 0?void 0:r.debug)===null||n===void 0?void 0:n.call(r,"Message sent: ",JSON.stringify(t));(i=(o=window.opener)===null||o===void 0?void 0:o.postMessage)===null||i===void 0?void 0:i.call(o,t,this.endpoint)};e.prototype.sendRequest=function(t,r,n){var o=this;if(n===void 0){n={timeout:15e3}}var i=ma();var a={id:i,action:t,args:r};var u=new Promise(function(s,c){o.requestCallbacks[i]={resolve:s,reject:c};o.notify(a);if((n===null||n===void 0?void 0:n.timeout)>0){setTimeout(function(){c(new Error("".concat(t," timed out (id: ").concat(i,")")));delete o.requestCallbacks[i]},n.timeout)}});return u};e.prototype.handleResponse=function(t){var r;if(!this.requestCallbacks[t.id]){(r=this.logger)===null||r===void 0?void 0:r.warn("No callback found for request id: ".concat(t.id));return}this.requestCallbacks[t.id].resolve(t.responseData);delete this.requestCallbacks[t.id]};e.prototype.setup=function(t){var r=this;var n=t===void 0?{}:t,o=n.logger,i=n.endpoint,a=n.isElementSelectable,u=n.cssSelectorAllowlist,s=n.actionClickAllowlist;this.logger=o;if(i&&this.endpoint===et){this.endpoint=i}var c=null;window.addEventListener("message",function(l){var d,f,p,v,_;(f=(d=r.logger)===null||d===void 0?void 0:d.debug)===null||f===void 0?void 0:f.call(d,"Message received: ",JSON.stringify(l));if(r.endpoint!==l.origin){return}var b=l===null||l===void 0?void 0:l.data;var h=b===null||b===void 0?void 0:b.action;if(!h){return}if("id"in b){(v=(p=r.logger)===null||p===void 0?void 0:p.debug)===null||v===void 0?void 0:v.call(p,"Received Response to previous request: ",JSON.stringify(l));r.handleResponse(b)}else{if(h==="ping"){r.notify({action:"pong"})}else if(h==="initialize-visual-tagging-selector"){var m=b===null||b===void 0?void 0:b.data;va(wi).then(function(){var y;c=(y=window===null||window===void 0?void 0:window.amplitudeVisualTaggingSelector)===null||y===void 0?void 0:y.call(window,{getEventTagProps:pa,isElementSelectable:function(T){if(a){return a((m===null||m===void 0?void 0:m.actionType)||"click",T)}return true},onTrack:r.onTrack,onSelect:r.onSelect,visualHighlightClass:tt,messenger:r,cssSelectorAllowlist:u,actionClickAllowlist:s});r.notify({action:"selector-loaded"})}).catch(function(){var y;(y=r.logger)===null||y===void 0?void 0:y.warn("Failed to initialize visual tagging selector")})}else if(h==="close-visual-tagging-selector"){(_=c===null||c===void 0?void 0:c.close)===null||_===void 0?void 0:_.call(c)}}});this.notify({action:"page-loaded"})};return e}();var tu=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"];var ru=["type"];var nu=["svg","path","g"];var ou=["password","hidden"];var iu=128;var au=1024;function su(e){var t,r;var n,o,i,a;if(e===null){return null}var u=String(e.tagName).toLowerCase();var s={tag:u};var c=Array.from((o=(n=e.parentElement)===null||n===void 0?void 0:n.children)!==null&&o!==void 0?o:[]);if(c.length){s.index=c.indexOf(e);s.indexOfType=c.filter(function(T){return T.tagName===e.tagName}).indexOf(e)}var l=(a=(i=e.previousElementSibling)===null||i===void 0?void 0:i.tagName)===null||a===void 0?void 0:a.toLowerCase();if(l){s.prevSib=String(l)}var d=e.getAttribute("id");if(d){s.id=String(d)}var f=Array.from(e.classList);if(f.length){s.classes=f}var p={};var v=Array.from(e.attributes);var _=v.filter(function(T){return!tu.includes(T.name)});var b=!wn(e);if(!ou.includes(String(e.getAttribute("type")))&&!nu.includes(u)){try{for(var h=D(_),m=h.next();!m.done;m=h.next()){var y=m.value;if(b&&!ru.includes(y.name)){continue}p[y.name]=String(y.value).substring(0,iu)}}catch(T){t={error:T}}finally{try{if(m&&!m.done&&(r=h.return))r.call(h)}finally{if(t)throw t.error}}}if(Object.keys(p).length){s.attrs=p}return s}function uu(e){var t=[];if(!e){return t}t.push(e);var r=e.parentElement;while(r&&r.tagName!=="HTML"){t.push(r);r=r.parentElement}return t}var ga=function(e){var t=[];if(!e){return[]}var r=uu(e);t=cu(r.map(function(n){return su(n)}),au);return t};function cu(e,t){var r=0;for(var n=0;n<e.length;n++){var o=e[n];if(o===null){r+=4}else{var i=tr(o);r+=i?Array.from(i).length:4}if(r>t){return e.slice(0,n)}}return e}function tr(e,t){if(t===void 0){t=false}try{if(e==null){if(t){return"None"}return null}else if(typeof e==="string"){if(t){e=e.replace(/\\\\/g,"\\\\\\\\").replace(/\\n/g,"\\\\n").replace(/\\t/g,"\\\\t").replace(/\\r/g,"\\\\r");if(e.includes('"')){return"'".concat(e,"'")}if(e.includes("'")){return'"'.concat(e.replace(/'/g,"\\\\'"),'"')}return"'".concat(e,"'")}return e}else if(typeof e==="boolean"){return e?"True":"False"}else if(Array.isArray(e)){var r=e.map(function(i){return tr(i,true)});return"[".concat(r.join(", "),"]")}else if(typeof e==="object"){var n=Object.entries(e).filter(function(i){var a=I(i,1),u=a[0];return u!=null}).map(function(i){var a=I(i,2),u=a[0],s=a[1];return"".concat(String(tr(u,true)),": ").concat(String(tr(s,true)))});var o="{".concat(n.join(", "),"}");if(o.includes("\\\\'")){o=o.replace(/'/g,"'").replace(/'/g,"\\\\'")}return o}return e.toString()}catch(i){return null}}var lu=5;function _a(e){var t=e.amplitude,r=e.allObservables,n=e.options,o=e.shouldTrackEvent;var i=r.clickObservable;var a=i.pipe(Tn(),ne(function(l){var d=I(l,2),f=d[0],p=d[1];var v=f.event.target!==p.event.target;var _=Math.abs(p.event.screenX-f.event.screenX)<=20&&Math.abs(p.event.screenY-f.event.screenY)<=20;return v&&!_}));var u=i.pipe(yn(n.debounceTime),Y(function(){return"timeout"}));var s=it(a,u);var c=i.pipe(bn(0),ne(Ne),ne(function(l){return o("click",l.closestTrackedAncestor)}),_n(s));return c.subscribe(function(l){var d,f;var p=l.length>=lu?Je:Je;try{for(var v=D(l),_=v.next();!_.done;_=v.next()){var b=_.value;t===null||t===void 0?void 0:t.track(p,b.targetElementProperties)}}catch(h){d={error:h}}finally{try{if(_&&!_.done&&(f=v.return))f.call(v)}finally{if(d)throw d.error}}})}function ya(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,o=e.shouldTrackEvent;var i=r.changeObservable;var a=i.pipe(ne(Ne),ne(function(u){return o("change",u.closestTrackedAncestor)}));return a.subscribe(function(u){t===null||t===void 0?void 0:t.track(di,n("change",u.closestTrackedAncestor))})}function Ea(e){var t=e.amplitude,r=e.allObservables,n=e.options,o=e.getEventProperties,i=e.shouldTrackEvent,a=e.shouldTrackActionClick;var u=r.clickObservable,s=r.mutationObservable,c=r.navigateObservable;var l=u.pipe(ne(function(v){return!i("click",v.closestTrackedAncestor)}),Y(function(v){var _=at(v.event.target,n.actionClickAllowlist);v.closestTrackedAncestor=_;if(v.closestTrackedAncestor!==null){v.targetElementProperties=o(v.type,v.closestTrackedAncestor)}return v}),ne(Ne),ne(function(v){return a("click",v.closestTrackedAncestor)}));var d=[s];if(c){d.push(c)}var f=it.apply(void 0,O([],I(d),false));var p=l.pipe(xn(function(v){return f.pipe(ke(1),gn({first:500,with:function(){return Te}}),Y(function(){return v}))}));return p.subscribe(function(v){t===null||t===void 0?void 0:t.track(Je,o("click",v.closestTrackedAncestor))})}var Me;(function(e){e["ClickObservable"]="clickObservable";e["ChangeObservable"]="changeObservable";e["NavigateObservable"]="navigateObservable";e["MutationObservable"]="mutationObservable"})(Me||(Me={}));function fu(e){return e.type==="click"||e.type==="change"}var rr=function(e){var t,r,n;if(e===void 0){e={}}var o=e.dataAttributePrefix,i=o===void 0?ln:o,a=e.visualTaggingOptions,u=a===void 0?{enabled:true,messenger:new ha}:a;e.cssSelectorAllowlist=(t=e.cssSelectorAllowlist)!==null&&t!==void 0?t:cn;e.actionClickAllowlist=(r=e.actionClickAllowlist)!==null&&r!==void 0?r:fn;e.debounceTime=(n=e.debounceTime)!==null&&n!==void 0?n:0;var s=fi;var c="enrichment";var l=[];var d=void 0;var f=function(){var m;var y=Ie(document,"click",{capture:true}).pipe(Y(function(w){return v(w,"click")}));var T=Ie(document,"change",{capture:true}).pipe(Y(function(w){return v(w,"change")}));var P;if(window.navigation){P=Ie(window.navigation,"navigate").pipe(Y(function(w){return v(w,"navigate")}))}var S=new q(function(w){var A=new MutationObserver(function(R){w.next(R)});A.observe(document.body,{childList:true,attributes:true,characterData:true,subtree:true});return function(){return A.disconnect()}}).pipe(Y(function(w){return v(w,"mutation")}));return m={},m[Me.ClickObservable]=y,m[Me.ChangeObservable]=T,m[Me.NavigateObservable]=P,m[Me.MutationObservable]=S,m};var p=function(m,y){var T;var P,S;var w=(S=(P=y===null||y===void 0?void 0:y.tagName)===null||P===void 0?void 0:P.toLowerCase)===null||S===void 0?void 0:S.call(P);var A=typeof y.getBoundingClientRect==="function"?y.getBoundingClientRect():{left:null,top:null};var R=y.getAttribute("aria-label");var z=da(y,i);var Z=Cn(y);var Q=An(y,d);var J=(T={},T[pi]=y.getAttribute("id")||"",T[vi]=y.getAttribute("class"),T[mi]=ga(y),T[Tt]=w,T[xt]=er(y),T[gi]=A.left==null?null:Math.round(A.left),T[_i]=A.top==null?null:Math.round(A.top),T[yi]=R,T[Ei]=z,T[It]=Q,T[bi]=Z,T[St]=window.location.href.split("?")[0],T[Ti]=typeof document!=="undefined"&&document.title||"",T[xi]=window.innerHeight,T[Ii]=window.innerWidth,T);if(w==="a"&&m==="click"&&y instanceof HTMLAnchorElement){J[hi]=y.href}return Pn(J)};var v=function(m,y){var T={event:m,timestamp:Date.now(),type:y};if(fu(T)&&T.event.target!==null){var P=at(T.event.target,e.cssSelectorAllowlist);if(P){T.closestTrackedAncestor=P;T.targetElementProperties=p(T.type,P)}return T}return T};var _=function(m,y){return E(void 0,void 0,void 0,function(){var T,P,S,w,A,R,z,Z;var Q,J;return g(this,function(se){d=m.loggerProvider;if(typeof document==="undefined"){return[2]}T=Jt(e,e.cssSelectorAllowlist);P=Jt(e,e.actionClickAllowlist);S=f();w=_a({allObservables:S,options:e,amplitude:y,shouldTrackEvent:T});l.push(w);A=ya({allObservables:S,getEventProperties:p,amplitude:y,shouldTrackEvent:T});l.push(A);R=Ea({allObservables:S,options:e,getEventProperties:p,amplitude:y,shouldTrackEvent:T,shouldTrackActionClick:P});l.push(R);(Q=m===null||m===void 0?void 0:m.loggerProvider)===null||Q===void 0?void 0:Q.log("".concat(s," has been successfully added."));if(window.opener&&u.enabled){z=e.cssSelectorAllowlist;Z=e.actionClickAllowlist;(J=u.messenger)===null||J===void 0?void 0:J.setup(x(x({logger:m===null||m===void 0?void 0:m.loggerProvider},(m===null||m===void 0?void 0:m.serverZone)&&{endpoint:Si[m.serverZone]}),{isElementSelectable:Jt(e,O(O([],I(z),false),I(Z),false)),cssSelectorAllowlist:z,actionClickAllowlist:Z}))}return[2]})})};var b=function(m){return E(void 0,void 0,void 0,function(){return g(this,function(y){return[2,m]})})};var h=function(){return E(void 0,void 0,void 0,function(){var m,y,T;var P,S;return g(this,function(w){try{for(m=D(l),y=m.next();!y.done;y=m.next()){T=y.value;T.unsubscribe()}}catch(A){P={error:A}}finally{try{if(y&&!y.done&&(S=m.return))S.call(m)}finally{if(P)throw P.error}}return[2]})})};return{name:s,type:c,setup:_,execute:b,teardown:h}};var ba="utm_campaign";var Ta="utm_content";var xa="utm_id";var Ia="utm_medium";var Sa="utm_source";var wa="utm_term";var Ln="dclid";var Rn="fbclid";var On="gbraid";var Dn="gclid";var Un="ko_click_id";var kn="li_fat_id";var Nn="msclkid";var Mn="rtd_cid";var Fn="ttclid";var Vn="twclid";var Gn="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 Aa=function(e){var t=e.split(".");if(t.length<=2){return e}return t.slice(t.length-2,t.length).join(".")};var du=function(e){return Object.values(e).every(function(t){return!t})};var Pa=function(e,t,r,n,o){if(o===void 0){o=true}var i=e.referrer,a=e.referring_domain,u=qe(e,["referrer","referring_domain"]);var s=t||{},c=s.referrer,l=s.referring_domain,d=qe(s,["referrer","referring_domain"]);if(pu(r.excludeReferrers,e.referring_domain)){n.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list."));return false}if(!o&&du(e)&&t){n.debug("This is not a new campaign because this is a direct traffic in the same session.");return false}var f=JSON.stringify(u)!==JSON.stringify(d);var p=Aa(a||"")!==Aa(l||"");var v=!t||f||p;if(!v){n.debug("This is not a new campaign because it's the same as the previous one.")}else{n.debug("This is a new campaign. An $identify event will be sent.")}return v};var pu=function(e,t){if(e===void 0){e=[]}if(t===void 0){t=""}return e.some(function(r){return r instanceof RegExp?r.test(t):r===t})};var Ca=function(e,t){var r=x(x({},Fe),e);var n=Object.entries(r).reduce(function(o,i){var a;var u=I(i,2),s=u[0],c=u[1];o.setOnce("initial_".concat(s),(a=c!==null&&c!==void 0?c:t.initialEmptyValue)!==null&&a!==void 0?a:"EMPTY");if(c){return o.set(s,c)}return o.unset(s)},new ce);return Be(n)};var La=function(e){var t=e;if(t){if(t.startsWith(".")){t=t.substring(1)}return[new RegExp("".concat(t.replace(".","\\\\."),"$"))]}return[]};var Ra=function(){function e(){}e.prototype.parse=function(){return E(this,void 0,void 0,function(){return g(this,function(t){return[2,x(x(x(x({},Fe),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})};e.prototype.getUtmParam=function(){var t=de();var r=t[ba];var n=t[Ta];var o=t[xa];var i=t[Ia];var a=t[Sa];var u=t[wa];return{utm_campaign:r,utm_content:n,utm_id:o,utm_medium:i,utm_source:a,utm_term:u}};e.prototype.getReferrer=function(){var t,r;var n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0;n.referring_domain=(r=(t=n.referrer)===null||t===void 0?void 0:t.split("/")[2])!==null&&r!==void 0?r:void 0}catch(o){}return n};e.prototype.getClickIds=function(){var t;var r=de();return t={},t[Ln]=r[Ln],t[Rn]=r[Rn],t[On]=r[On],t[Dn]=r[Dn],t[Un]=r[Un],t[kn]=r[kn],t[Nn]=r[Nn],t[Mn]=r[Mn],t[Fn]=r[Fn],t[Vn]=r[Vn],t[Gn]=r[Gn],t};return e}();var Oa=function(){function e(t,r){var n;this.shouldTrackNewCampaign=false;this.options=x({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:false,excludeReferrers:La((n=r.cookieOptions)===null||n===void 0?void 0:n.domain)},t);this.storage=r.cookieStorage;this.storageKey=Or(r.apiKey,"MKTG");this.currentCampaign=Fe;this.sessionTimeout=r.sessionTimeout;this.lastEventTime=r.lastEventTime;this.logger=r.loggerProvider;r.loggerProvider.log("Installing web attribution tracking.")}e.prototype.init=function(){return E(this,void 0,void 0,function(){var t;var r;return g(this,function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:r=I.apply(void 0,[n.sent(),2]),this.currentCampaign=r[0],this.previousCampaign=r[1];t=!this.lastEventTime?true:He(this.sessionTimeout,this.lastEventTime);if(!Pa(this.currentCampaign,this.previousCampaign,this.options,this.logger,t))return[3,3];this.shouldTrackNewCampaign=true;return[4,this.storage.set(this.storageKey,this.currentCampaign)];case 2:n.sent();n.label=3;case 3:return[2]}})})};e.prototype.fetchCampaign=function(){return E(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,Promise.all([new Ra().parse(),this.storage.get(this.storageKey)])];case 1:return[2,t.sent()]}})})};e.prototype.generateCampaignEvent=function(t){this.shouldTrackNewCampaign=false;var r=Ca(this.currentCampaign,this.options);if(t){r.event_id=t}return r};e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign};return e}();var Da=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.init=function(r,n,o){if(r===void 0){r=""}var i;var a;if(arguments.length>2){i=n;a=o}else{if(typeof n==="string"){i=n;a=void 0}else{i=n===null||n===void 0?void 0:n.userId;a=n}}return $(this._init(x(x({},a),{userId:i,apiKey:r})))};t.prototype._init=function(r){return E(this,void 0,void 0,function(){var n,o,i,a,u,s;var c=this;var l,d,f;return g(this,function(p){switch(p.label){case 0:if(this.initializing){return[2]}this.initializing=true;return[4,Ko(r.apiKey,r,this)];case 1:n=p.sent();if(!r.fetchRemoteConfig)return[3,4];return[4,li(n)];case 2:o=p.sent();return[4,o.generateJoinedConfig()];case 3:n=p.sent();p.label=4;case 4:return[4,e.prototype._init.call(this,n)];case 5:p.sent();this.logBrowserOptions(n);if(!kr(this.config.defaultTracking))return[3,7];i=Co(this.config);this.webAttribution=new Oa(i,this.config);return[4,this.webAttribution.init()];case 6:p.sent();p.label=7;case 7:a=de();u=Number.isNaN(Number(a.ampSessionId))?void 0:Number(a.ampSessionId);this.setSessionId((f=(d=(l=r.sessionId)!==null&&l!==void 0?l:u)!==null&&d!==void 0?d:this.config.sessionId)!==null&&f!==void 0?f:Date.now());s=fe(r.instanceName);s.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId});if(!(this.config.offline!==Ur))return[3,9];return[4,this.add(ii()).promise];case 8:p.sent();p.label=9;case 9:return[4,this.add(new wr).promise];case 10:p.sent();return[4,this.add(new Oo).promise];case 11:p.sent();return[4,this.add(new Cr).promise];case 12:p.sent();oi(this.config);if(!So(this.config.defaultTracking))return[3,14];this.config.loggerProvider.debug("Adding file download tracking plugin");return[4,this.add(ri()).promise];case 13:p.sent();p.label=14;case 14:if(!wo(this.config.defaultTracking))return[3,16];this.config.loggerProvider.debug("Adding form interaction plugin");return[4,this.add(ti()).promise];case 15:p.sent();p.label=16;case 16:if(!Nr(this.config.defaultTracking))return[3,18];this.config.loggerProvider.debug("Adding page view tracking plugin");return[4,this.add(sn(Po(this.config))).promise];case 17:p.sent();p.label=18;case 18:if(!Fr(this.config.autocapture))return[3,20];this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)");return[4,this.add(rr(Ao(this.config))).promise];case 19:p.sent();p.label=20;case 20:this.initializing=false;return[4,this.runQueuedFunctions("dispatchQ")];case 21:p.sent();s.eventBridge.setEventReceiver(function(v){void c.track(v.eventType,v.eventProperties)});return[2]}})})};t.prototype.getUserId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.userId};t.prototype.setUserId=function(r){if(!this.config){this.q.push(this.setUserId.bind(this,r));return}this.config.loggerProvider.debug("function setUserId: ",r);if(r!==this.config.userId||r===void 0){this.config.userId=r;Ar(r,this.config.instanceName)}};t.prototype.getDeviceId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.deviceId};t.prototype.setDeviceId=function(r){if(!this.config){this.q.push(this.setDeviceId.bind(this,r));return}this.config.loggerProvider.debug("function setDeviceId: ",r);this.config.deviceId=r;Pr(r,this.config.instanceName)};t.prototype.reset=function(){this.setDeviceId(te());this.setUserId(void 0)};t.prototype.getSessionId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.sessionId};t.prototype.setSessionId=function(r){var n;var o=[];if(!this.config){this.q.push(this.setSessionId.bind(this,r));return $(Promise.resolve())}if(r===this.config.sessionId){return $(Promise.resolve())}this.config.loggerProvider.debug("function setSessionId: ",r);var i=this.getSessionId();var a=this.config.lastEventTime;var u=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1;this.config.sessionId=r;this.config.lastEventTime=void 0;this.config.pageCounter=0;if(Mr(this.config.defaultTracking)){if(i&&a){o.push(this.track(jr,void 0,{device_id:this.previousSessionDeviceId,event_id:++u,session_id:i,time:a+1,user_id:this.previousSessionUserId}).promise)}this.config.lastEventTime=this.config.sessionId}var s=this.trackCampaignEventIfNeeded(++u,o);if(Mr(this.config.defaultTracking)){o.push(this.track(Br,void 0,{event_id:s?++u:u,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise)}this.previousSessionDeviceId=this.config.deviceId;this.previousSessionUserId=this.config.userId;return $(Promise.all(o))};t.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()};t.prototype.setTransport=function(r){if(!this.config){this.q.push(this.setTransport.bind(this,r));return}this.config.transportProvider=Wr(r)};t.prototype.identify=function(r,n){if(ht(r)){var o=r._q;r._q=[];r=mt(new ce,o)}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 e.prototype.identify.call(this,r,n)};t.prototype.groupIdentify=function(r,n,o,i){if(ht(o)){var a=o._q;o._q=[];o=mt(new ce,a)}return e.prototype.groupIdentify.call(this,r,n,o,i)};t.prototype.revenue=function(r,n){if(ht(r)){var o=r._q;r._q=[];r=mt(new xr,o)}return e.prototype.revenue.call(this,r,n)};t.prototype.trackCampaignEventIfNeeded=function(r,n){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign){return false}var o=this.webAttribution.generateCampaignEvent(r);if(n){n.push(this.track(o).promise)}else{this.track(o)}this.config.loggerProvider.log("Tracking attribution.");return true};t.prototype.process=function(r){return E(this,void 0,void 0,function(){var n,o,i;return g(this,function(a){n=Date.now();o=He(this.config.sessionTimeout,this.config.lastEventTime);i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign();if(r.event_type!==Br&&r.event_type!==jr&&(!r.session_id||r.session_id===this.getSessionId())){if(o||i){this.setSessionId(n);if(i){this.config.loggerProvider.log("Created a new session for new campaign.")}}else if(!o){this.trackCampaignEventIfNeeded()}}return[2,e.prototype.process.call(this,r)]})})};t.prototype.logBrowserOptions=function(r){try{var n=x(x({},r),{apiKey:r.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(n))}catch(o){this.config.loggerProvider.error("Error logging browser config",o)}};return t}(Tr);var vu=function(){var e=new Da;return{init:G(e.init.bind(e),"init",F(e),V(e,["config"])),add:G(e.add.bind(e),"add",F(e),V(e,["config.apiKey","timeline.plugins"])),remove:G(e.remove.bind(e),"remove",F(e),V(e,["config.apiKey","timeline.plugins"])),track:G(e.track.bind(e),"track",F(e),V(e,["config.apiKey","timeline.queue.length"])),logEvent:G(e.logEvent.bind(e),"logEvent",F(e),V(e,["config.apiKey","timeline.queue.length"])),identify:G(e.identify.bind(e),"identify",F(e),V(e,["config.apiKey","timeline.queue.length"])),groupIdentify:G(e.groupIdentify.bind(e),"groupIdentify",F(e),V(e,["config.apiKey","timeline.queue.length"])),setGroup:G(e.setGroup.bind(e),"setGroup",F(e),V(e,["config.apiKey","timeline.queue.length"])),revenue:G(e.revenue.bind(e),"revenue",F(e),V(e,["config.apiKey","timeline.queue.length"])),flush:G(e.flush.bind(e),"flush",F(e),V(e,["config.apiKey","timeline.queue.length"])),getUserId:G(e.getUserId.bind(e),"getUserId",F(e),V(e,["config","config.userId"])),setUserId:G(e.setUserId.bind(e),"setUserId",F(e),V(e,["config","config.userId"])),getDeviceId:G(e.getDeviceId.bind(e),"getDeviceId",F(e),V(e,["config","config.deviceId"])),setDeviceId:G(e.setDeviceId.bind(e),"setDeviceId",F(e),V(e,["config","config.deviceId"])),reset:G(e.reset.bind(e),"reset",F(e),V(e,["config","config.userId","config.deviceId"])),getSessionId:G(e.getSessionId.bind(e),"getSessionId",F(e),V(e,["config"])),setSessionId:G(e.setSessionId.bind(e),"setSessionId",F(e),V(e,["config"])),extendSession:G(e.extendSession.bind(e),"extendSession",F(e),V(e,["config"])),setOptOut:G(e.setOptOut.bind(e),"setOptOut",F(e),V(e,["config"])),setTransport:G(e.setTransport.bind(e),"setTransport",F(e),V(e,["config"]))}};var j=vu();var f_=j.add;var d_=j.extendSession;var p_=j.flush;var v_=j.getDeviceId;var m_=j.getSessionId;var h_=j.getUserId;var g_=j.groupIdentify;var __=j.identify;var y_=j.init;var E_=j.logEvent;var b_=j.remove;var T_=j.reset;var x_=j.revenue;var I_=j.setDeviceId;var qn=j.setGroup;var S_=j.setOptOut;var w_=j.setSessionId;var A_=j.setTransport;var P_=j.setUserId;var Se=j.track;var Bn=(e,t)=>{setTimeout(()=>{const r=Array.from(document.querySelectorAll("section"));for(const n of r){n.setAttribute("aria-hidden",String(n.id!==e))}},t)};var Ua=e=>{Bn("success",500);if(e){_u()}setTimeout(mu,500)};var mu=()=>{const e=document.getElementById("step-update-app");e.className="highlight completed";const t=document.getElementById("step-setup-complete");t.className="highlight active"};var st=(e=[])=>{Bn("error",500);const t=document.getElementById("error-messages");t.innerHTML="";for(const r of e){const n=document.createElement("li");n.textContent=r;t.appendChild(n)}document.title=\`Error Connecting\`};var ka=()=>{Bn("restart-server",500);document.title=\`Restart Dev Server\`};var hu=async()=>{const e=new URL(location.href);const t=e.searchParams.get(mr);const r=e.searchParams.get(jn);const n=e.searchParams.get(Wn);const o=e.searchParams.get(hr);const i=e.searchParams.get(Hn)||"unknown";const a=e.searchParams.get($n);const u=e.searchParams.get(Yn);const s=e.searchParams.get(Xn)||null;try{console.info(\`framework: \${i}, platform: \${a}, node: \${u}\`);const c=new URL(location.pathname,location.origin);if(r){qn("organization",r);qn("space",r)}if(!t){window.history.replaceState({},"",c.href);st(["Missing preview url"]);Se("integration failed",{url:c.href,message:"missing preview url",framework:i});return}c.searchParams.set(mr,t);c.searchParams.set(hr,o);window.history.replaceState({},"",c.href);if(r&&n){let l=0;const d=async()=>{l++;try{const f=await Zn(r,n,s);if(f.success){const p=Na(t,f.pathname,o);Se("site integrated",{url:p,position:i});if(f.modifiedFiles.length>0){const v=document.getElementById("modified-files-list");f.modifiedFiles.forEach(b=>{const h=document.createElement("li");const m=document.createElement("a");m.textContent=b.displayFilePath||b.filePath;m.href=\`~launch#\${b.displayFilePath}\`;m.addEventListener("click",y=>{y.preventDefault();y.stopPropagation();eo({filePath:b.filePath})});h.appendChild(m);v.appendChild(h)});const _=document.getElementById("modified-files-message");_.removeAttribute("hidden")}if(s!=="vcp"&&(f.platform.os==="win32"||i==="@remix-run/react")){const v=document.getElementById("restart-warning");v.removeAttribute("hidden")}else if(s!=="vcp"&&(i==="react"||i==="@angular/core")){const v=document.getElementById("router-message");v.removeAttribute("hidden");if(i==="@angular/core"){Se("angular framework",{});const y=document.getElementById("angular-message-section");y?.removeAttribute("hidden")}if(i==="react"){Se("react framework",{});const y=document.getElementById("react-message-section");y?.removeAttribute("hidden")}const _=document.getElementById("router-checkbox-div");const b=document.createElement("input");b.type="checkbox";b.id="router-checkbox";const h=document.createElement("label");h.htmlFor="router-checkbox";h.textContent=\`I've updated my router files\`;_.appendChild(b);_.appendChild(h);const m=document.getElementById("router-finish-button");b.addEventListener("change",function(){if(b.checked){m.removeAttribute("hidden")}else{m.setAttribute("hidden","true")}})}else{const v=document.getElementById("go-to-app");v.removeAttribute("hidden");if(s!=="vcp"){const _=v.querySelector("p");if(_){_.removeAttribute("hidden")}const b=v.querySelector("#button-text");if(b){b.textContent="Go to your app"}}}setTimeout(()=>{Ua(true)},500)}else{Se("integration failed",{path:f.pathname,message:"error connecting to Builder.io",position:i});st([\`Error connecting to Builder.io\`])}}catch(f){const p=String(f.message||f);if(p.includes("Fetch Error")){if(l>3){ka()}setTimeout(d,1e3)}else{st([p])}}};d()}else{const l=await Jn();if(l.isValid){Na(t,l.pathname,o);const d=document.getElementById("go-to-app");d.removeAttribute("hidden");Ua(false)}else{st([\`Error connecting to Builder.io\`])}}}catch(c){Se("integration failed",{message:"uncaught error",details:String(c),position:JSON.stringify({framework:i,platform:a,nodeVersion:u})});console.error("integrationFailed",c);const l=String(c);if(l.includes("Fetch Error")){ka()}else{st([l])}}};var Na=(e,t,r)=>{const n=new URL(t,e);if(r){n.hash=\`\${Kn}=\${r}\`}const o=document.querySelectorAll(".next-step");for(const i of o){i.setAttribute("href",n.href)}console.debug("App Url",n.href);return n.href};var gu=()=>{return new Promise((e,t)=>{if(globalThis.confetti){return e(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=()=>e(globalThis.confetti);r.onerror=t;document.head.appendChild(r);r.remove()})};var _u=async()=>{const e={spread:360,ticks:50,gravity:0,decay:.95,startVelocity:30,colors:["19b4f4","a97ff2","fd6b3c","ffffff"]};const t=gu();const r=async()=>{const n=document.getElementById("button-icon");const o=n.getBoundingClientRect();const i=window.scrollX+o.left;const a=window.scrollY+o.top;const u={x:i/window.innerWidth,y:a/window.innerHeight};const s=await t;s({...e,origin:u,scalar:1.2});s({...e,origin:u,scalar:.75})};setTimeout(r,500);setTimeout(r,650);setTimeout(r,800);setTimeout(r,950)};hu();})();
244
248
  </script>
245
249
  </body>
246
250
  </html>
247
- `)}async function yi(e,t){let r=await Xo(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 Si=require("node:os");async function vi(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(gt,e.devToolsServerUrl);n.searchParams.set(wn,(0,Si.platform)()),n.searchParams.set(An,process.versions.node);let i=e.getFrameworks();return i.length>0&&(r.searchParams.set(bt,i[0].name),n.searchParams.set(bt,i[0].name)),r.searchParams.set("redirect_url",n.href),r.searchParams.set("preview_url",t),r.href}var fu=require("http");var du=require("node:os"),Dr=require("node:path"),Je=require("node:fs");var Ce=T(Bn(),1),Ln=require("node:process");var Rr=T(require("node:readline"),1),$i=require("node:tty");function Hu({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 Gu=Hu();function Li(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Gu,"")}function Oi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _i={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(n){var i=n.charCodeAt(0),a=n.length==2?n.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(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var i=r(n),a=0,o=0;o<i.length;o++)a=a+this.characterLength(i[o]);return a},t.slice=function(n,i,a){textLen=t.length(n),i=i||0,a=a||1,i<0&&(i=textLen+i),a<0&&(a=textLen+a);for(var o="",s=0,u=r(n),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}})(_i);var Qu=_i.exports,Yu=Oi(Qu),Xu=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},Zu=Oi(Xu);function Xt(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Li(e),e.length===0))return 0;e=e.replace(Zu()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(Yu.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Ir=10,Pi=(e=0)=>t=>`\x1B[${t+e}m`,Ti=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Ii=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,G={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(G.modifier);var el=Object.keys(G.color),tl=Object.keys(G.bgColor);[...el,...tl];function nl(){let e=new Map;for(let[t,r]of Object.entries(G)){for(let[n,i]of Object.entries(r))G[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=G[n],e.set(i[0],i[1]);Object.defineProperty(G,t,{value:r,enumerable:!1})}return Object.defineProperty(G,"codes",{value:e,enumerable:!1}),G.color.close="\x1B[39m",G.bgColor.close="\x1B[49m",G.color.ansi=Pi(),G.color.ansi256=Ti(),G.color.ansi16m=Ii(),G.bgColor.ansi=Pi(Ir),G.bgColor.ansi256=Ti(Ir),G.bgColor.ansi16m=Ii(Ir),Object.defineProperties(G,{rgbToAnsi256:{value:(t,r,n)=>t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(a=>a+a).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>G.rgbToAnsi256(...G.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let s=t%36;r=Math.floor(t/36)/5,n=Math.floor(s/6)/5,i=s%6/5}let a=Math.max(r,n,i)*2;if(a===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return a===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>G.ansi256ToAnsi(G.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>G.ansi256ToAnsi(G.hexToAnsi256(t)),enumerable:!1}}),G}var rl=nl(),On=new Set(["\x1B","\x9B"]),ol=39,kr="\x07",Mi="[",il="]",ji="m",$r=`${il}8;;`,Bi=e=>`${On.values().next().value}${Mi}${e}${ji}`,Ri=e=>`${On.values().next().value}${$r}${e}${kr}`,al=e=>e.split(" ").map(t=>Xt(t)),Br=(e,t,r)=>{let n=[...t],i=!1,a=!1,o=Xt(Li(e[e.length-1]));for(let[s,u]of n.entries()){let l=Xt(u);if(o+l<=r?e[e.length-1]+=u:(e.push(u),o=0),On.has(u)&&(i=!0,a=n.slice(s+1).join("").startsWith($r)),i){a?u===kr&&(i=!1,a=!1):u===ji&&(i=!1);continue}o+=l,o===r&&s<n.length-1&&(e.push(""),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},sl=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(Xt(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},ul=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,a,o=al(e),s=[""];for(let[l,c]of e.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=Xt(s[s.length-1]);if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&o[l]>t){let f=t-p,h=1+Math.floor((o[l]-f-1)/t);Math.floor((o[l]-1)/t)<h&&s.push(""),Br(s,c,t);continue}if(p+o[l]>t&&p>0&&o[l]>0){if(r.wordWrap===!1&&p<t){Br(s,c,t);continue}s.push("")}if(p+o[l]>t&&r.wordWrap===!1){Br(s,c,t);continue}s[s.length-1]+=c}r.trim!==!1&&(s=s.map(l=>sl(l)));let u=[...s.join(`
248
- `)];for(let[l,c]of u.entries()){if(n+=c,On.has(c)){let{groups:f}=new RegExp(`(?:\\${Mi}(?<code>\\d+)m|\\${$r}(?<uri>.*)${kr})`).exec(u.slice(l).join(""))||{groups:{}};if(f.code!==void 0){let h=Number.parseFloat(f.code);i=h===ol?void 0:h}else f.uri!==void 0&&(a=f.uri.length===0?void 0:f.uri)}let p=rl.codes.get(Number(i));u[l+1]===`
249
- `?(a&&(n+=Ri("")),i&&p&&(n+=Bi(p))):c===`
250
- `&&(i&&p&&(n+=Bi(i)),a&&(n+=Ri(a)))}return n};function Ni(e,t,r){return String(e).normalize().replace(/\r\n/g,`
251
+ `)}async function Di(e,t){let r=await qo(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 gi=require("os");async function hi(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(ht,e.devToolsServerUrl);n.searchParams.set(wn,(0,gi.platform)()),n.searchParams.set(bn,process.versions.node);let i=e.getFrameworks();return i.length>0&&(r.searchParams.set(Pt,i[0].name),n.searchParams.set(Pt,i[0].name)),r.searchParams.set("redirect_url",n.href),r.searchParams.set("preview_url",t),r.href}var ou=require("http");var iu=require("os"),pr=require("path"),Qe=require("fs");var Ee=I(Bn(),1),Ln=require("process");var Pr=I(require("readline"),1),Pi=require("tty");function Mu({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 Vu=Mu();function Ti(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Vu,"")}function Ii(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bi={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(n){var i=n.charCodeAt(0),a=n.length==2?n.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(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var i=r(n),a=0,o=0;o<i.length;o++)a=a+this.characterLength(i[o]);return a},t.slice=function(n,i,a){textLen=t.length(n),i=i||0,a=a||1,i<0&&(i=textLen+i),a<0&&(a=textLen+a);for(var o="",s=0,u=r(n),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}})(Bi);var Uu=Bi.exports,Ku=Ii(Uu),zu=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},qu=Ii(zu);function en(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Ti(e),e.length===0))return 0;e=e.replace(qu()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(Ku.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var br=10,Fi=(e=0)=>t=>`\x1B[${t+e}m`,yi=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Si=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,H={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(H.modifier);var Wu=Object.keys(H.color),Ju=Object.keys(H.bgColor);[...Wu,...Ju];function Gu(){let e=new Map;for(let[t,r]of Object.entries(H)){for(let[n,i]of Object.entries(r))H[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=H[n],e.set(i[0],i[1]);Object.defineProperty(H,t,{value:r,enumerable:!1})}return Object.defineProperty(H,"codes",{value:e,enumerable:!1}),H.color.close="\x1B[39m",H.bgColor.close="\x1B[49m",H.color.ansi=Fi(),H.color.ansi256=yi(),H.color.ansi16m=Si(),H.bgColor.ansi=Fi(br),H.bgColor.ansi256=yi(br),H.bgColor.ansi16m=Si(br),Object.defineProperties(H,{rgbToAnsi256:{value:(t,r,n)=>t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(a=>a+a).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>H.rgbToAnsi256(...H.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let s=t%36;r=Math.floor(t/36)/5,n=Math.floor(s/6)/5,i=s%6/5}let a=Math.max(r,n,i)*2;if(a===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return a===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>H.ansi256ToAnsi(H.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>H.ansi256ToAnsi(H.hexToAnsi256(t)),enumerable:!1}}),H}var Hu=Gu(),On=new Set(["\x1B","\x9B"]),Qu=39,Ir="\x07",Ri="[",Yu="]",Ni="m",Br=`${Yu}8;;`,vi=e=>`${On.values().next().value}${Ri}${e}${Ni}`,wi=e=>`${On.values().next().value}${Br}${e}${Ir}`,Xu=e=>e.split(" ").map(t=>en(t)),Ar=(e,t,r)=>{let n=[...t],i=!1,a=!1,o=en(Ti(e[e.length-1]));for(let[s,u]of n.entries()){let l=en(u);if(o+l<=r?e[e.length-1]+=u:(e.push(u),o=0),On.has(u)&&(i=!0,a=n.slice(s+1).join("").startsWith(Br)),i){a?u===Ir&&(i=!1,a=!1):u===Ni&&(i=!1);continue}o+=l,o===r&&s<n.length-1&&(e.push(""),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Zu=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(en(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},el=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,a,o=Xu(e),s=[""];for(let[l,c]of e.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=en(s[s.length-1]);if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&o[l]>t){let f=t-p,h=1+Math.floor((o[l]-f-1)/t);Math.floor((o[l]-1)/t)<h&&s.push(""),Ar(s,c,t);continue}if(p+o[l]>t&&p>0&&o[l]>0){if(r.wordWrap===!1&&p<t){Ar(s,c,t);continue}s.push("")}if(p+o[l]>t&&r.wordWrap===!1){Ar(s,c,t);continue}s[s.length-1]+=c}r.trim!==!1&&(s=s.map(l=>Zu(l)));let u=[...s.join(`
252
+ `)];for(let[l,c]of u.entries()){if(n+=c,On.has(c)){let{groups:f}=new RegExp(`(?:\\${Ri}(?<code>\\d+)m|\\${Br}(?<uri>.*)${Ir})`).exec(u.slice(l).join(""))||{groups:{}};if(f.code!==void 0){let h=Number.parseFloat(f.code);i=h===Qu?void 0:h}else f.uri!==void 0&&(a=f.uri.length===0?void 0:f.uri)}let p=Hu.codes.get(Number(i));u[l+1]===`
253
+ `?(a&&(n+=wi("")),i&&p&&(n+=vi(p))):c===`
254
+ `&&(i&&p&&(n+=vi(i)),a&&(n+=wi(a)))}return n};function bi(e,t,r){return String(e).normalize().replace(/\r\n/g,`
251
255
  `).split(`
252
- `).map(n=>ul(n,t,r)).join(`
253
- `)}var ll=Object.defineProperty,cl=(e,t,r)=>t in e?ll(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ye=(e,t,r)=>(cl(e,typeof t!="symbol"?t+"":t,r),r);function pl(e,t){if(e===t)return;let r=e.split(`
256
+ `).map(n=>el(n,t,r)).join(`
257
+ `)}var tl=Object.defineProperty,nl=(e,t,r)=>t in e?tl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ve=(e,t,r)=>(nl(e,typeof t!="symbol"?t+"":t,r),r);function rl(e,t){if(e===t)return;let r=e.split(`
254
258
  `),n=t.split(`
255
- `),i=[];for(let a=0;a<Math.max(r.length,n.length);a++)r[a]!==n[a]&&i.push(a);return i}var ml=Symbol("clack:cancel");function kn(e,t){e.isTTY&&e.setRawMode(t)}var ki=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),fl=new Set(["up","down","left","right","space","enter"]),Nr=class{constructor({render:t,input:r=Ln.stdin,output:n=Ln.stdout,...i},a=!0){ye(this,"input"),ye(this,"output"),ye(this,"rl"),ye(this,"opts"),ye(this,"_track",!1),ye(this,"_render"),ye(this,"_cursor",0),ye(this,"state","initial"),ye(this,"value"),ye(this,"error",""),ye(this,"subscribers",new Map),ye(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=r,this.output=n}prompt(){let t=new $i.WriteStream(0);return t._write=(r,n,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=Rr.default.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),Rr.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),kn(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((r,n)=>{this.once("submit",()=>{this.output.write(Ce.cursor.show),this.output.off("resize",this.render),kn(this.input,!1),r(this.value)}),this.once("cancel",()=>{this.output.write(Ce.cursor.show),this.output.off("resize",this.render),kn(this.input,!1),r(ml)})})}on(t,r){let n=this.subscribers.get(t)??[];n.push({cb:r}),this.subscribers.set(t,n)}once(t,r){let n=this.subscribers.get(t)??[];n.push({cb:r,once:!0}),this.subscribers.set(t,n)}emit(t,...r){let n=this.subscribers.get(t)??[],i=[];for(let a of n)a.cb(...r),a.once&&i.push(()=>n.splice(n.indexOf(a),1));for(let a of i)a()}unsubscribe(){this.subscribers.clear()}onKeypress(t,r){if(this.state==="error"&&(this.state="active"),r?.name&&!this._track&&ki.has(r.name)&&this.emit("cursor",ki.get(r.name)),r?.name&&fl.has(r.name)&&this.emit("cursor",r.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()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n,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
- `),kn(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=Ni(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
257
- `).length-1;this.output.write(Ce.cursor.move(-999,t*-1))}render(){let t=Ni(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(Ce.cursor.hide);else{let r=pl(this._prevFrame,t);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(Ce.cursor.move(0,n)),this.output.write(Ce.erase.lines(1));let i=t.split(`
258
- `);this.output.write(i[n]),this._prevFrame=t,this.output.write(Ce.cursor.move(0,i.length-n-1));return}else if(r&&r?.length>1){let n=r[0];this.output.write(Ce.cursor.move(0,n)),this.output.write(Ce.erase.down());let i=t.split(`
259
+ `),i=[];for(let a=0;a<Math.max(r.length,n.length);a++)r[a]!==n[a]&&i.push(a);return i}var ol=Symbol("clack:cancel");function kn(e,t){e.isTTY&&e.setRawMode(t)}var Ai=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),il=new Set(["up","down","left","right","space","enter"]),Tr=class{constructor({render:t,input:r=Ln.stdin,output:n=Ln.stdout,...i},a=!0){ve(this,"input"),ve(this,"output"),ve(this,"rl"),ve(this,"opts"),ve(this,"_track",!1),ve(this,"_render"),ve(this,"_cursor",0),ve(this,"state","initial"),ve(this,"value"),ve(this,"error",""),ve(this,"subscribers",new Map),ve(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=r,this.output=n}prompt(){let t=new Pi.WriteStream(0);return t._write=(r,n,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=Pr.default.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),Pr.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),kn(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((r,n)=>{this.once("submit",()=>{this.output.write(Ee.cursor.show),this.output.off("resize",this.render),kn(this.input,!1),r(this.value)}),this.once("cancel",()=>{this.output.write(Ee.cursor.show),this.output.off("resize",this.render),kn(this.input,!1),r(ol)})})}on(t,r){let n=this.subscribers.get(t)??[];n.push({cb:r}),this.subscribers.set(t,n)}once(t,r){let n=this.subscribers.get(t)??[];n.push({cb:r,once:!0}),this.subscribers.set(t,n)}emit(t,...r){let n=this.subscribers.get(t)??[],i=[];for(let a of n)a.cb(...r),a.once&&i.push(()=>n.splice(n.indexOf(a),1));for(let a of i)a()}unsubscribe(){this.subscribers.clear()}onKeypress(t,r){if(this.state==="error"&&(this.state="active"),r?.name&&!this._track&&Ai.has(r.name)&&this.emit("cursor",Ai.get(r.name)),r?.name&&il.has(r.name)&&this.emit("cursor",r.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()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n,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(`
260
+ `),kn(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=bi(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
261
+ `).length-1;this.output.write(Ee.cursor.move(-999,t*-1))}render(){let t=bi(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(Ee.cursor.hide);else{let r=rl(this._prevFrame,t);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(Ee.cursor.move(0,n)),this.output.write(Ee.erase.lines(1));let i=t.split(`
262
+ `);this.output.write(i[n]),this._prevFrame=t,this.output.write(Ee.cursor.move(0,i.length-n-1));return}else if(r&&r?.length>1){let n=r[0];this.output.write(Ee.cursor.move(0,n)),this.output.write(Ee.erase.down());let i=t.split(`
259
263
  `).slice(n);this.output.write(i.join(`
260
- `)),this._prevFrame=t;return}this.output.write(Ce.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}},$n=class extends Nr{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",r=>{this.output.write(Ce.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var sd=globalThis.process.platform.startsWith("win");var Se=T(require("node:process"),1),O=T(He(),1),Ki=T(Bn(),1);function dl(){return Se.default.platform!=="win32"?Se.default.env.TERM!=="linux":!!Se.default.env.CI||!!Se.default.env.WT_SESSION||!!Se.default.env.TERMINUS_SUBLIME||Se.default.env.ConEmuTask==="{cmd::Cmder}"||Se.default.env.TERM_PROGRAM==="Terminus-Sublime"||Se.default.env.TERM_PROGRAM==="vscode"||Se.default.env.TERM==="xterm-256color"||Se.default.env.TERM==="alacritty"||Se.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Dl=dl(),Y=(e,t)=>Dl?e:t,gl=Y("\u25C6","*"),hl=Y("\u25A0","x"),Cl=Y("\u25B2","x"),zi=Y("\u25C7","o"),xl=Y("\u250C","T"),Ge=Y("\u2502","|"),qi=Y("\u2514","\u2014"),Vi=Y("\u25CF",">"),Ui=Y("\u25CB"," "),hd=Y("\u25FB","[\u2022]"),Cd=Y("\u25FC","[+]"),xd=Y("\u25FB","[ ]"),Ed=Y("\u25AA","\u2022"),Fd=Y("\u2500","-"),yd=Y("\u256E","+"),Sd=Y("\u251C","+"),vd=Y("\u256F","+"),El=Y("\u25CF","\u2022"),Fl=Y("\u25C6","*"),yl=Y("\u25B2","!"),Sl=Y("\u25A0","x"),vl=e=>{switch(e){case"initial":case"active":return O.default.cyan(gl);case"cancel":return O.default.red(hl);case"error":return O.default.yellow(Cl);case"submit":return O.default.green(zi)}};var en=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new $n({active:t,inactive:r,initialValue:e.initialValue??!0,render(){let n=`${O.default.gray(Ge)}
261
- ${vl(this.state)} ${e.message}
262
- `,i=this.value?t:r;switch(this.state){case"submit":return`${n}${O.default.gray(Ge)} ${O.default.dim(i)}`;case"cancel":return`${n}${O.default.gray(Ge)} ${O.default.strikethrough(O.default.dim(i))}
263
- ${O.default.gray(Ge)}`;default:return`${n}${O.default.cyan(Ge)} ${this.value?`${O.default.green(Vi)} ${t}`:`${O.default.dim(Ui)} ${O.default.dim(t)}`} ${O.default.dim("/")} ${this.value?`${O.default.dim(Ui)} ${O.default.dim(r)}`:`${O.default.green(Vi)} ${r}`}
264
- ${O.default.cyan(qi)}
265
- `}}}).prompt()};var xt=(e="")=>{process.stdout.write(`${O.default.gray(xl)} ${e}
266
- `)},tn=(e="")=>{process.stdout.write(`${O.default.gray(Ge)}
267
- ${O.default.gray(qi)} ${e}
268
-
269
- `)},U={message:(e="",{symbol:t=O.default.gray(Ge)}={})=>{let r=[`${O.default.gray(Ge)}`];if(e){let[n,...i]=e.split(`
270
- `);r.push(`${t} ${n}`,...i.map(a=>`${O.default.gray(Ge)} ${a}`))}process.stdout.write(`${r.join(`
264
+ `)),this._prevFrame=t;return}this.output.write(Ee.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}},$n=class extends Tr{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",r=>{this.output.write(Ee.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var Yf=globalThis.process.platform.startsWith("win");var we=I(require("process"),1),O=I(Ye(),1),Li=I(Bn(),1);function al(){return we.default.platform!=="win32"?we.default.env.TERM!=="linux":!!we.default.env.CI||!!we.default.env.WT_SESSION||!!we.default.env.TERMINUS_SUBLIME||we.default.env.ConEmuTask==="{cmd::Cmder}"||we.default.env.TERM_PROGRAM==="Terminus-Sublime"||we.default.env.TERM_PROGRAM==="vscode"||we.default.env.TERM==="xterm-256color"||we.default.env.TERM==="alacritty"||we.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var sl=al(),Y=(e,t)=>sl?e:t,ul=Y("\u25C6","*"),ll=Y("\u25A0","x"),cl=Y("\u25B2","x"),Oi=Y("\u25C7","o"),pl=Y("\u250C","T"),Xe=Y("\u2502","|"),_i=Y("\u2514","\u2014"),ki=Y("\u25CF",">"),$i=Y("\u25CB"," "),sd=Y("\u25FB","[\u2022]"),ud=Y("\u25FC","[+]"),ld=Y("\u25FB","[ ]"),cd=Y("\u25AA","\u2022"),pd=Y("\u2500","-"),md=Y("\u256E","+"),fd=Y("\u251C","+"),dd=Y("\u256F","+"),ml=Y("\u25CF","\u2022"),fl=Y("\u25C6","*"),dl=Y("\u25B2","!"),Dl=Y("\u25A0","x"),gl=e=>{switch(e){case"initial":case"active":return O.default.cyan(ul);case"cancel":return O.default.red(ll);case"error":return O.default.yellow(cl);case"submit":return O.default.green(Oi)}};var nn=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new $n({active:t,inactive:r,initialValue:e.initialValue??!0,render(){let n=`${O.default.gray(Xe)}
265
+ ${gl(this.state)} ${e.message}
266
+ `,i=this.value?t:r;switch(this.state){case"submit":return`${n}${O.default.gray(Xe)} ${O.default.dim(i)}`;case"cancel":return`${n}${O.default.gray(Xe)} ${O.default.strikethrough(O.default.dim(i))}
267
+ ${O.default.gray(Xe)}`;default:return`${n}${O.default.cyan(Xe)} ${this.value?`${O.default.green(ki)} ${t}`:`${O.default.dim($i)} ${O.default.dim(t)}`} ${O.default.dim("/")} ${this.value?`${O.default.dim($i)} ${O.default.dim(r)}`:`${O.default.green(ki)} ${r}`}
268
+ ${O.default.cyan(_i)}
269
+ `}}}).prompt()};var Et=(e="")=>{process.stdout.write(`${O.default.gray(pl)} ${e}
270
+ `)},rn=(e="")=>{process.stdout.write(`${O.default.gray(Xe)}
271
+ ${O.default.gray(_i)} ${e}
272
+
273
+ `)},U={message:(e="",{symbol:t=O.default.gray(Xe)}={})=>{let r=[`${O.default.gray(Xe)}`];if(e){let[n,...i]=e.split(`
274
+ `);r.push(`${t} ${n}`,...i.map(a=>`${O.default.gray(Xe)} ${a}`))}process.stdout.write(`${r.join(`
271
275
  `)}
272
- `)},info:e=>{U.message(e,{symbol:O.default.blue(El)})},success:e=>{U.message(e,{symbol:O.default.green(Fl)})},step:e=>{U.message(e,{symbol:O.default.green(zi)})},warn:e=>{U.message(e,{symbol:O.default.yellow(yl)})},warning:e=>{U.warn(e)},error:e=>{U.message(e,{symbol:O.default.red(Sl)})}};var dt=T(He(),1),ot=T(require("@sentry/node"),1);var H=T(require("typescript"),1);var Uo=T(require("@sentry/node"),1);var Z=T(He(),1);async function Ne(e){let t=Wi(e),r=await e.readFile(t);return typeof r=="string"?JSON.parse(r):{}}async function ke(e,t){t=typeof t=="object"&&t!=null?t:{};let r=Wi(e);await e.writeFile(r,JSON.stringify(t??{},null,2))}function Wi(e){let t=e.getAppRootDir();return e.join(t,"node_modules",".builder","builder-cache.json")}async function it(e,t,r){let n={envKey:r,envValue:null,file:""};for(let i of t){let a=e.join(e.getAppRootDir(),i),o=await wl(e,a);if(o){let s=o[r];if(typeof s=="string"&&s.length>0&&s!=="YOUR_API_KEY")return n.envValue=s,n.file=a,n}}return n.file=e.join(e.getAppRootDir(),t[t.length-1]),n}async function wl(e,t){let r=await e.readFile(t);return typeof r=="string"?Ji(r):null}function Ji(e){let t={},r=e.replace(/\r\n?/gm,`
273
- `),n;for(;(n=Al.exec(r))!=null;){let i=n[1],a=n[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 Al=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;async function at(e,t,r,n){let i="# https://www.builder.io/c/docs/using-your-api-key",a=await e.readFile(t);if(a)if(a.includes(r))if(a.includes(n))e.debug(`"${r}" with "${n}" already set in ${t}`);else return e.debug(`Replace "${r}" in ${t}`),a=a.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await e.writeFile(t,a),"update";else return e.debug(`Append "${r}" to ${t}`),a+=`
276
+ `)},info:e=>{U.message(e,{symbol:O.default.blue(ml)})},success:e=>{U.message(e,{symbol:O.default.green(fl)})},step:e=>{U.message(e,{symbol:O.default.green(Oi)})},warn:e=>{U.message(e,{symbol:O.default.yellow(dl)})},warning:e=>{U.warn(e)},error:e=>{U.message(e,{symbol:O.default.red(Dl)})}};var Dt=I(Ye(),1);var G=I(require("typescript"),1);var Z=I(Ye(),1);async function Le(e){let t=ji(e),r=await e.readFile(t);return typeof r=="string"?JSON.parse(r):{}}async function Oe(e,t){t=typeof t=="object"&&t!=null?t:{};let r=ji(e);await e.writeFile(r,JSON.stringify(t??{},null,2))}function ji(e){let t=e.getAppRootDir();return e.join(t,"node_modules",".builder","builder-cache.json")}async function at(e,t,r){let n={envKey:r,envValue:null,file:""};for(let i of t){let a=e.join(e.getAppRootDir(),i),o=await hl(e,a);if(o){let s=o[r];if(typeof s=="string"&&s.length>0&&s!=="YOUR_API_KEY")return n.envValue=s,n.file=a,n}}return n.file=e.join(e.getAppRootDir(),t[t.length-1]),n}async function hl(e,t){let r=await e.readFile(t);return typeof r=="string"?Mi(r):null}function Mi(e){let t={},r=e.replace(/\r\n?/gm,`
277
+ `),n;for(;(n=Cl.exec(r))!=null;){let i=n[1],a=n[2]||"";a=a.trim();let o=a[0];a=a.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),o==='"'&&(a=a.replace(/\\n/g,`
278
+ `),a=a.replace(/\\r/g,"\r")),t[i]=a}return t}var Cl=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;async function st(e,t,r,n){let i="# https://www.builder.io/c/docs/using-your-api-key",a=await e.readFile(t);if(a)if(a.includes(r))if(a.includes(n))e.debug(`"${r}" with "${n}" already set in ${t}`);else return e.debug(`Replace "${r}" in ${t}`),a=a.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await e.writeFile(t,a),"update";else return e.debug(`Append "${r}" to ${t}`),a+=`
275
279
 
276
280
  ${i}
277
281
  ${r}=${n}
278
282
 
279
283
  `,await e.writeFile(t,a),"update";else return e.debug(`Creating new .env file with "${r}" at ${t}`),a=[i,`${r}=${n}`,""].join(`
280
- `),await e.writeFile(t,a),"create";return null}async function nn(e){return await it(e,[".env.local",".env.development.local",".env.production.local",".env.development",".env.production",".env"],$e)}async function Hi(e,t){let r=await nn(e),n=await at(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var $e="NEXT_PUBLIC_BUILDER_API_KEY";function $t(e,t,r,n,i=!0){let a=t.properties.filter(s=>e.ts.isPropertyAssignment(s)),o=bl(e,t,r);return o>-1?n==null&&i?e.ts.factory.updateObjectLiteralExpression(t,a.filter((s,u)=>u!==o)):(a[o]=e.ts.factory.updatePropertyAssignment(a[o],a[o].name,rn(e,n)),e.ts.factory.updateObjectLiteralExpression(t,a)):(n!=null&&a.push(e.ts.factory.createPropertyAssignment(r,rn(e,n))),e.ts.factory.updateObjectLiteralExpression(t,a))}function bl(e,t,r){return t.properties.findIndex(n=>j(e,n)===r)}function on(e,t){switch(t.kind){case e.ts.SyntaxKind.ArrayLiteralExpression:return Tl(e,t);case e.ts.SyntaxKind.ObjectLiteralExpression:return Pl(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 Pl(e,t){let r={};if(t&&e.ts.isObjectLiteralExpression(t)){for(let n of t.properties)if(e.ts.isPropertyAssignment(n)){let i=j(e,n);i&&(r[i]=on(e,n.initializer))}}return r}function Tl(e,t){return t&&e.ts.isArrayLiteralExpression(t)?t.elements.map(r=>on(e,r)):[]}function j(e,t){if(t&&e.ts.isPropertyAssignment(t)){let r=t.name;switch(r.kind){case e.ts.SyntaxKind.Identifier:return r.text;case e.ts.SyntaxKind.StringLiteral:case e.ts.SyntaxKind.NumericLiteral:return r.text;case e.ts.SyntaxKind.ComputedPropertyName:let n=r.expression;if(e.ts.isStringLiteral(n)||e.ts.isNumericLiteral(n))return r.expression.text}}}function rn(e,t){return Lr(e,t,new WeakSet)}function Lr(e,t,r){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)?Il(e,t,r):typeof t=="object"?Bl(e,t,r):e.ts.factory.createIdentifier(t)}function Il(e,t,r){let n=t.map(i=>Lr(e,i,r));return e.ts.factory.createArrayLiteralExpression(n,!0)}function Bl(e,t,r){if(r.has(t))return e.ts.factory.createIdentifier("undefined");r.add(t);let n=Object.keys(t).map(i=>e.ts.factory.createPropertyAssignment(i,Lr(e,t[i],r)));return e.ts.factory.createObjectLiteralExpression(n,!0)}function Et(e,t,r){let n=[];if(!r)return n;let i=null;if(e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r)||e.ts.isFunctionDeclaration(r)){let a=r.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(r)){let a=t.getTypeAtLocation(r),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 f=p[0];i=t.getTypeFromTypeNode(f).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],r).getProperties())}}}else if(e.ts.isExportSpecifier(r)){let a=t.getSymbolAtLocation(r.name);if(a){let s=t.getTypeOfSymbolAtLocation(a,r).getCallSignatures();if(s.length>0){let u=s[0].getParameters();u.length>0&&(i=t.getTypeOfSymbolAtLocation(u[0],r).getProperties())}}}if(i)for(let a of i){let o=Rl(e,t,a);o&&n.push(o)}return n=n.filter(Qi),n.length>0?n:Nl(e,r)}function Rl(e,t,r){let n=r.valueDeclaration,i=r.getName();if(n||(n=r.getDeclarations()?.[0]),n&&e.ts.isPropertySignature(n)){if(i!=="children"&&n.getSourceFile().fileName.includes("node_modules/@types/"))return null;let a="string",o;if(n?.type){let u=t.getTypeFromTypeNode(n.type),l=t.typeToString(u),c=Or(l);c.knownType?a=c.builderType:$l(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&&n.type){let u=Ml(e,t,t.getTypeFromTypeNode(n.type));s.meta=s.meta||{},u&&u.length>0&&s.type==="string"&&u.every(Ol)?s.enum=u.map(_l):s.meta.ts=o}return n.questionToken||(s.required=!0),s}return null}function Nl(e,t){let r=[],n=e.ts.getJSDocCommentsAndTags(t);for(let i of n)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 f="";switch(p.type.kind){case e.ts.SyntaxKind.StringKeyword:{f="string";break}case e.ts.SyntaxKind.NumberKeyword:{f="number";break}case e.ts.SyntaxKind.BooleanKeyword:{f="boolean";break}default:continue}let D={name:c.right.text,type:f,isRegistered:!1};r.push(D)}}return r.filter(Qi)}var kl=["ClassicComponent","FunctionComponent","IntrinsicElements","JSX","ReactNode","ReactElement","ReactPortal"];function $l(e){return typeof e!="string"?!1:!!kl.some(t=>e.includes(t))}function Or(e){return typeof e=="string"&&(e=e.trim(),Ll.some(t=>t.value===e))?{builderType:e,knownType:!0}:{builderType:"string",knownType:!1}}var Ll=[{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 Ol(e){return/^['"].*['"]$/.test(e)}function _l(e){return(e.startsWith('"')||e.startsWith("'"))&&(e.endsWith('"')||e.endsWith("'"))?e.slice(1,-1):e}var Ml=(e,t,r)=>{let n=new Set;Gi(e,t,r,n);let i=n.delete("true"),a=n.delete("false");(i||a)&&n.add("boolean");let o=Array.from(n.keys()).sort();if(o.length>1&&(o=o.map(s=>s.indexOf("=>")>=0?`(${s})`:s)),!(o.length>20))return o},jl=(e,t,r)=>{let n=e.ts.TypeFormatFlags.InElementType|e.ts.TypeFormatFlags.NoTruncation;return t.typeToString(r,void 0,n)},Gi=(e,t,r,n)=>{if(r.isUnion())r.types.forEach(i=>{Gi(e,t,i,n)});else if(r.isLiteral()){let i=jl(e,t,r);n.add(i)}};function Qi(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 r=t.charAt(2);if(r.toUpperCase()===r)return!1}return!Vl.has(t.toLowerCase())}var Vl=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 fe(e,t,r){for(let n of r.properties){if(!e.ts.isPropertyAssignment(n))continue;let i=j(e,n);if(i==="name"&&e.ts.isStringLiteral(n.initializer)){t.name=n.initializer.text;continue}if(i==="description"&&e.ts.isStringLiteral(n.initializer)){t.description=n.initializer.text;continue}if(i==="image"&&e.ts.isStringLiteral(n.initializer)){t.image=n.initializer.text;continue}if(i==="inputs"&&e.ts.isArrayLiteralExpression(n.initializer)){let a=Ul(e,n.initializer);xe(t,a);continue}if(i==="meta"&&e.ts.isObjectLiteralExpression(n.initializer)){let a=on(e,n.initializer);a&&typeof a=="object"&&(t.meta=a);continue}}return t}function Ul(e,t){let r=[];for(let n of t.elements)e.ts.isObjectLiteralExpression(n)&&r.push(Kl(e,n));return r}function Kl(e,t){let r=on(e,t),n=Ql(r);return n.isRegistered=!0,n}function te(e,t,r){let n=ql(r);return t=$t(e,t,"name",n.name,!1),t=$t(e,t,"description",n.description),t=$t(e,t,"image",n.image),t=$t(e,t,"meta",n.meta),t=zl(e,t,n),Yl(e,t)}function zl(e,t,r){let n=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=[...r.inputs??[]];if(a>-1){if(o.length===0)return $t(e,t,"inputs",null);let s=i[a];e.ts.isPropertyAssignment(s)&&e.ts.isArrayLiteralExpression(s.initializer)&&(n=s.initializer)}return o.length===0?t:(n=Jl(e,n||e.ts.factory.createArrayLiteralExpression(),o),a>-1?i[a]=e.ts.factory.updatePropertyAssignment(i[a],i[a].name,n):i.push(e.ts.factory.createPropertyAssignment("inputs",n)),e.ts.factory.updateObjectLiteralExpression(t,i))}function ql(e){return{name:e.name,description:e.description,image:e.image,inputs:(e.inputs||[]).filter(r=>r.isRegistered).map(Wl),...e.meta?{meta:{...e.meta}}:{}}}function Wl(e){let t={name:e.name,type:e.type};return(ce(e.defaultValue)||Jt(e.defaultValue)||Pt(e.defaultValue))&&(t.defaultValue=e.defaultValue),ce(e.friendlyName)&&(t.friendlyName=e.friendlyName),ce(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 Jl(e,t,r){let n=t.elements.filter(i=>{if(!e.ts.isObjectLiteralExpression(i))return!1;let a=i.properties.find(s=>j(e,s)==="name");if(!a)return!1;let o=a.initializer;return e.ts.isStringLiteral(o)?r.some(s=>s.name===o.text):!1});for(let i of r)n=Hl(e,n,i);return n.sort((i,a)=>{let o=i.properties.find(f=>j(e,f)==="name"),s=a.properties.find(f=>j(e,f)==="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,n)}function Hl(e,t,r){let n=t.findIndex(i=>i.properties.some(a=>{let o=j(e,a);return e.ts.isPropertyAssignment(a)&&o==="name"&&e.ts.isStringLiteral(a.initializer)&&a.initializer.text===r.name}));if(n>-1)t[n]=Yi(e,t[n],r);else{let i=Yi(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("name",e.ts.factory.createStringLiteral(r.name))],!0),r);t.push(i)}return t}function Yi(e,t,r){let n=t.properties.filter(a=>e.ts.isPropertyAssignment(a)),i=Object.keys(r).filter(a=>a!=="isRegistered");for(let a of i)n=Gl(e,n,r,a);return n=Xl(e,n.filter(a=>{let o=j(e,a);return i.includes(o)})),e.ts.factory.updateObjectLiteralExpression(t,n)}function Gl(e,t,r,n){let i=t.findIndex(a=>e.ts.isIdentifier(a.name)&&a.name.text===n);return i>-1?t[i]=e.ts.factory.updatePropertyAssignment(t[i],t[i].name,rn(e,r[n])):t.push(e.ts.factory.createPropertyAssignment(n,rn(e,r[n]))),t}function xe(e,t){for(let r of t){let n=e.inputs.findIndex(i=>i.name===r.name);n>-1?(r.isRegistered||!e.inputs[n].isRegistered)&&(e.inputs[n]=r):e.inputs.push(r)}e.acceptsChildren=_r(e)}function Ql(e){let t=Or(e.type),r={name:e.name.trim(),type:t.builderType};return ce(e.friendlyName)&&e.friendlyName.trim()!==e.name.trim()&&(r.friendlyName=e.friendlyName),(ce(e.defaultValue)||Jt(e.defaultValue)||Pt(e.defaultValue))&&(r.defaultValue=e.defaultValue),ce(e.helperText)&&(r.helperText=e.helperText),Pt(e.required)&&(r.required=e.required),typeof e.meta=="object"&&e.meta!=null&&Object.keys(e.meta).length>0&&(r.meta=e.meta),Array.isArray(e.enum)&&e.enum.length>0&&(r.enum=e.enum),e.hideFromUI===!0&&(r.hideFromUI=!0),Mr(r)}function _r(e){let t=e.inputs.some(n=>n.name==="children"),r=e.inputs.some(n=>n.meta?.ts==="ReactNode");return!!(t||r||e.acceptsChildren===!0)}function Mr(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 Yl(e,t){let r=[...t.properties].sort((n,i)=>{let a=j(e,n)||"zz",o=j(e,i)||"zz";if(a==="inputs")return 1;let s=Xi.indexOf(a),u=Xi.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,r)}var Xi=["component","name","description"];function Xl(e,t){return[...t].sort((n,i)=>{let a=j(e,n)||"zz",o=j(e,i)||"zz",s=Zi.indexOf(a),u=Zi.indexOf(o);return s>-1?u>-1&&s>u?1:-1:u>-1?s>-1&&u<s?-1:1:a.localeCompare(o)})}var Zi=["name","type"];function Lt(e,t){for(let r of t.properties){if(!e.ts.isPropertyAssignment(r)||!e.ts.isIdentifier(r.name))continue;if(j(e,r)==="canHaveChildren"){let{initializer:i}=r;return i.kind===e.ts.SyntaxKind.TrueKeyword}}return!1}function ea(e,t){let r=`Builder.registerComponent(
284
+ `),await e.writeFile(t,a),"create";return null}async function on(e){return await at(e,[".env.local",".env.development.local",".env.production.local",".env.development",".env.production",".env"],_e)}async function Vi(e,t){let r=await on(e),n=await st(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var _e="NEXT_PUBLIC_BUILDER_API_KEY";function Lt(e,t,r,n,i=!0){let a=t.properties.filter(s=>e.ts.isPropertyAssignment(s)),o=xl(e,t,r);return o>-1?n==null&&i?e.ts.factory.updateObjectLiteralExpression(t,a.filter((s,u)=>u!==o)):(a[o]=e.ts.factory.updatePropertyAssignment(a[o],a[o].name,an(e,n)),e.ts.factory.updateObjectLiteralExpression(t,a)):(n!=null&&a.push(e.ts.factory.createPropertyAssignment(r,an(e,n))),e.ts.factory.updateObjectLiteralExpression(t,a))}function xl(e,t,r){return t.properties.findIndex(n=>M(e,n)===r)}function sn(e,t){switch(t.kind){case e.ts.SyntaxKind.ArrayLiteralExpression:return Fl(e,t);case e.ts.SyntaxKind.ObjectLiteralExpression:return El(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 El(e,t){let r={};if(t&&e.ts.isObjectLiteralExpression(t)){for(let n of t.properties)if(e.ts.isPropertyAssignment(n)){let i=M(e,n);i&&(r[i]=sn(e,n.initializer))}}return r}function Fl(e,t){return t&&e.ts.isArrayLiteralExpression(t)?t.elements.map(r=>sn(e,r)):[]}function M(e,t){if(t&&e.ts.isPropertyAssignment(t)){let r=t.name;switch(r.kind){case e.ts.SyntaxKind.Identifier:return r.text;case e.ts.SyntaxKind.StringLiteral:case e.ts.SyntaxKind.NumericLiteral:return r.text;case e.ts.SyntaxKind.ComputedPropertyName:let n=r.expression;if(e.ts.isStringLiteral(n)||e.ts.isNumericLiteral(n))return r.expression.text}}}function an(e,t){return Rr(e,t,new WeakSet)}function Rr(e,t,r){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)?yl(e,t,r):typeof t=="object"?Sl(e,t,r):e.ts.factory.createIdentifier(t)}function yl(e,t,r){let n=t.map(i=>Rr(e,i,r));return e.ts.factory.createArrayLiteralExpression(n,!0)}function Sl(e,t,r){if(r.has(t))return e.ts.factory.createIdentifier("undefined");r.add(t);let n=Object.keys(t).map(i=>e.ts.factory.createPropertyAssignment(i,Rr(e,t[i],r)));return e.ts.factory.createObjectLiteralExpression(n,!0)}function Ft(e,t,r){let n=[];if(!r)return n;let i=null;if(e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r)||e.ts.isFunctionDeclaration(r)){let a=r.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(r)){let a=t.getTypeAtLocation(r),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 f=p[0];i=t.getTypeFromTypeNode(f).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],r).getProperties())}}}else if(e.ts.isExportSpecifier(r)){let a=t.getSymbolAtLocation(r.name);if(a){let s=t.getTypeOfSymbolAtLocation(a,r).getCallSignatures();if(s.length>0){let u=s[0].getParameters();u.length>0&&(i=t.getTypeOfSymbolAtLocation(u[0],r).getProperties())}}}if(i)for(let a of i){let o=vl(e,t,a);o&&n.push(o)}return n=n.filter(Ki),n.length>0?n:wl(e,r)}function vl(e,t,r){let n=r.valueDeclaration,i=r.getName();if(n||(n=r.getDeclarations()?.[0]),n&&e.ts.isPropertySignature(n)){if(i!=="children"&&n.getSourceFile().fileName.includes("node_modules/@types/"))return null;let a="string",o;if(n?.type){let u=t.getTypeFromTypeNode(n.type),l=t.typeToString(u),c=Nr(l);c.knownType?a=c.builderType:Al(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&&n.type){let u=Bl(e,t,t.getTypeFromTypeNode(n.type));s.meta=s.meta||{},u&&u.length>0&&s.type==="string"&&u.every(Tl)?s.enum=u.map(Il):s.meta.ts=o}return n.questionToken||(s.required=!0),s}return null}function wl(e,t){let r=[],n=e.ts.getJSDocCommentsAndTags(t);for(let i of n)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 f="";switch(p.type.kind){case e.ts.SyntaxKind.StringKeyword:{f="string";break}case e.ts.SyntaxKind.NumberKeyword:{f="number";break}case e.ts.SyntaxKind.BooleanKeyword:{f="boolean";break}default:continue}let D={name:c.right.text,type:f,isRegistered:!1};r.push(D)}}return r.filter(Ki)}var bl=["ClassicComponent","FunctionComponent","IntrinsicElements","JSX","ReactNode","ReactElement","ReactPortal"];function Al(e){return typeof e!="string"?!1:!!bl.some(t=>e.includes(t))}function Nr(e){return typeof e=="string"&&(e=e.trim(),Pl.some(t=>t.value===e))?{builderType:e,knownType:!0}:{builderType:"string",knownType:!1}}var Pl=[{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 Tl(e){return/^['"].*['"]$/.test(e)}function Il(e){return(e.startsWith('"')||e.startsWith("'"))&&(e.endsWith('"')||e.endsWith("'"))?e.slice(1,-1):e}var Bl=(e,t,r)=>{let n=new Set;Ui(e,t,r,n);let i=n.delete("true"),a=n.delete("false");(i||a)&&n.add("boolean");let o=Array.from(n.keys()).sort();if(o.length>1&&(o=o.map(s=>s.indexOf("=>")>=0?`(${s})`:s)),!(o.length>20))return o},Rl=(e,t,r)=>{let n=e.ts.TypeFormatFlags.InElementType|e.ts.TypeFormatFlags.NoTruncation;return t.typeToString(r,void 0,n)},Ui=(e,t,r,n)=>{if(r.isUnion())r.types.forEach(i=>{Ui(e,t,i,n)});else if(r.isLiteral()){let i=Rl(e,t,r);n.add(i)}};function Ki(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 r=t.charAt(2);if(r.toUpperCase()===r)return!1}return!Nl.has(t.toLowerCase())}var Nl=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 ge(e,t,r){for(let n of r.properties){if(!e.ts.isPropertyAssignment(n))continue;let i=M(e,n);if(i==="name"&&e.ts.isStringLiteral(n.initializer)){t.name=n.initializer.text;continue}if(i==="description"&&e.ts.isStringLiteral(n.initializer)){t.description=n.initializer.text;continue}if(i==="image"&&e.ts.isStringLiteral(n.initializer)){t.image=n.initializer.text;continue}if(i==="inputs"&&e.ts.isArrayLiteralExpression(n.initializer)){let a=kl(e,n.initializer);Fe(t,a);continue}if(i==="meta"&&e.ts.isObjectLiteralExpression(n.initializer)){let a=sn(e,n.initializer);a&&typeof a=="object"&&(t.meta=a);continue}}return t}function kl(e,t){let r=[];for(let n of t.elements)e.ts.isObjectLiteralExpression(n)&&r.push($l(e,n));return r}function $l(e,t){let r=sn(e,t),n=Ul(r);return n.isRegistered=!0,n}function te(e,t,r){let n=Ol(r);return t=Lt(e,t,"name",n.name,!1),t=Lt(e,t,"description",n.description),t=Lt(e,t,"image",n.image),t=Lt(e,t,"meta",n.meta),t=Ll(e,t,n),Kl(e,t)}function Ll(e,t,r){let n=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=[...r.inputs??[]];if(a>-1){if(o.length===0)return Lt(e,t,"inputs",null);let s=i[a];e.ts.isPropertyAssignment(s)&&e.ts.isArrayLiteralExpression(s.initializer)&&(n=s.initializer)}return o.length===0?t:(n=jl(e,n||e.ts.factory.createArrayLiteralExpression(),o),a>-1?i[a]=e.ts.factory.updatePropertyAssignment(i[a],i[a].name,n):i.push(e.ts.factory.createPropertyAssignment("inputs",n)),e.ts.factory.updateObjectLiteralExpression(t,i))}function Ol(e){return{name:e.name,description:e.description,image:e.image,inputs:(e.inputs||[]).filter(r=>r.isRegistered).map(_l),...e.meta?{meta:{...e.meta}}:{}}}function _l(e){let t={name:e.name,type:e.type};return(fe(e.defaultValue)||Ht(e.defaultValue)||Tt(e.defaultValue))&&(t.defaultValue=e.defaultValue),fe(e.friendlyName)&&(t.friendlyName=e.friendlyName),fe(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 jl(e,t,r){let n=t.elements.filter(i=>{if(!e.ts.isObjectLiteralExpression(i))return!1;let a=i.properties.find(s=>M(e,s)==="name");if(!a)return!1;let o=a.initializer;return e.ts.isStringLiteral(o)?r.some(s=>s.name===o.text):!1});for(let i of r)n=Ml(e,n,i);return n.sort((i,a)=>{let o=i.properties.find(f=>M(e,f)==="name"),s=a.properties.find(f=>M(e,f)==="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,n)}function Ml(e,t,r){let n=t.findIndex(i=>i.properties.some(a=>{let o=M(e,a);return e.ts.isPropertyAssignment(a)&&o==="name"&&e.ts.isStringLiteral(a.initializer)&&a.initializer.text===r.name}));if(n>-1)t[n]=zi(e,t[n],r);else{let i=zi(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("name",e.ts.factory.createStringLiteral(r.name))],!0),r);t.push(i)}return t}function zi(e,t,r){let n=t.properties.filter(a=>e.ts.isPropertyAssignment(a)),i=Object.keys(r).filter(a=>a!=="isRegistered");for(let a of i)n=Vl(e,n,r,a);return n=zl(e,n.filter(a=>{let o=M(e,a);return i.includes(o)})),e.ts.factory.updateObjectLiteralExpression(t,n)}function Vl(e,t,r,n){let i=t.findIndex(a=>e.ts.isIdentifier(a.name)&&a.name.text===n);return i>-1?t[i]=e.ts.factory.updatePropertyAssignment(t[i],t[i].name,an(e,r[n])):t.push(e.ts.factory.createPropertyAssignment(n,an(e,r[n]))),t}function Fe(e,t){for(let r of t){let n=e.inputs.findIndex(i=>i.name===r.name);n>-1?(r.isRegistered||!e.inputs[n].isRegistered)&&(e.inputs[n]=r):e.inputs.push(r)}e.acceptsChildren=kr(e)}function Ul(e){let t=Nr(e.type),r={name:e.name.trim(),type:t.builderType};return fe(e.friendlyName)&&e.friendlyName.trim()!==e.name.trim()&&(r.friendlyName=e.friendlyName),(fe(e.defaultValue)||Ht(e.defaultValue)||Tt(e.defaultValue))&&(r.defaultValue=e.defaultValue),fe(e.helperText)&&(r.helperText=e.helperText),Tt(e.required)&&(r.required=e.required),typeof e.meta=="object"&&e.meta!=null&&Object.keys(e.meta).length>0&&(r.meta=e.meta),Array.isArray(e.enum)&&e.enum.length>0&&(r.enum=e.enum),e.hideFromUI===!0&&(r.hideFromUI=!0),$r(r)}function kr(e){let t=e.inputs.some(n=>n.name==="children"),r=e.inputs.some(n=>n.meta?.ts==="ReactNode");return!!(t||r||e.acceptsChildren===!0)}function $r(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 Kl(e,t){let r=[...t.properties].sort((n,i)=>{let a=M(e,n)||"zz",o=M(e,i)||"zz";if(a==="inputs")return 1;let s=qi.indexOf(a),u=qi.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,r)}var qi=["component","name","description"];function zl(e,t){return[...t].sort((n,i)=>{let a=M(e,n)||"zz",o=M(e,i)||"zz",s=Wi.indexOf(a),u=Wi.indexOf(o);return s>-1?u>-1&&s>u?1:-1:u>-1?s>-1&&u<s?-1:1:a.localeCompare(o)})}var Wi=["name","type"];function Ot(e,t){for(let r of t.properties){if(!e.ts.isPropertyAssignment(r)||!e.ts.isIdentifier(r.name))continue;if(M(e,r)==="canHaveChildren"){let{initializer:i}=r;return i.kind===e.ts.SyntaxKind.TrueKeyword}}return!1}function Ji(e,t){let r=`Builder.registerComponent(
281
285
  `;if(e.appDir)t.acceptsChildren?r+=` withChildren(${t.importName}),
282
286
  `:r+=` ${t.importName},
283
287
  `;else{let i=t.externalImportPath?t.externalImportPath:L(e,e.registryPath,t.filePath);t.exportName==="default"?t.acceptsChildren?r+=` withChildren(dynamic(() => import(${JSON.stringify(i)}))),
@@ -287,7 +291,7 @@ ${r}=${n}
287
291
  `}r+=` {
288
292
  name: "${t.name}",
289
293
  }
290
- `,r+=");";let n=bn(e,r);return jr(e,n,t)}function jr(e,t,r){if(!e.ts.isExpressionStatement(t))return t;let n=t.expression;if(!e.ts.isCallExpression(n))return t;let i=[...n.arguments];if(i.length<2)return t;r.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]=te(e,a,r),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(n,n.expression,n.typeArguments,i))):t}function k(e,t,r,n="esm"){return Array.isArray(r.namedImports)&&r.namedImports.forEach(i=>{t=Zl(e,t,i,r.importPath,!!r.isTypeOnly,n)}),typeof r.defaultImport=="string"&&(t=ec(e,t,r.defaultImport,r.importPath,n)),t}function Zl(e,t,r,n,i,a){return a==="cjs"?na(e,t,null,r,n):ta(e,t,null,r,n,i)}function ec(e,t,r,n,i){return i==="cjs"?na(e,t,r,null,n):ta(e,t,r,null,n,!1)}function ta(e,t,r,n,i,a){let o=[...t.statements],s=0,u=!1,l=!1;for(let h=0;h<o.length;h++){let D=o[h];if(!e.ts.isImportDeclaration(D)||(s=h,!D.moduleSpecifier||!e.ts.isStringLiteral(D.moduleSpecifier))||D.moduleSpecifier.text!==i||!!D.importClause?.isTypeOnly!==a)continue;let d=[],g=D.importClause?.namedBindings;if(g&&e.ts.isNamedImports(g)&&g.elements&&d.push(...g.elements),typeof n=="string"){if(d.some(E=>E.name.text===n))return t;d.push(e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(n))),d.sort((E,x)=>E.name.text.localeCompare(x.name.text)),u=!0}let m=D.importClause?D.importClause.name:void 0;if(typeof r=="string"){if(m&&m.text===r)return t;m=e.ts.factory.createIdentifier(r),l=!0}if(u||l)return o[h]=e.ts.factory.updateImportDeclaration(D,void 0,e.ts.factory.createImportClause(a,m,e.ts.factory.createNamedImports(d)),D.moduleSpecifier,void 0),e.ts.factory.updateSourceFile(t,o)}let c,p;typeof r=="string"&&(c=e.ts.factory.createIdentifier(r)),typeof n=="string"&&(p=e.ts.factory.createNamedImports([e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(n))]));let f=e.ts.factory.createImportDeclaration(void 0,e.ts.factory.createImportClause(a,c,p),e.ts.factory.createStringLiteral(i));return o.splice(s,0,f),e.ts.factory.updateSourceFile(t,o)}function na(e,t,r,n,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],f=p.initializer;if(!f||!e.ts.isCallExpression(f))continue;let h=f.expression;if(!e.ts.isIdentifier(h)||h.text!=="require"||f.arguments.length!==1)continue;let D=f.arguments[0];if(e.ts.isStringLiteral(D)&&(o=s,D.text===i)){if(e.ts.isIdentifier(p.name)&&typeof r=="string")return p.name.text===r?t:(c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createIdentifier(r),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 n=="string"){let d=[...p.name.elements];return d.some(m=>!e.ts.isBindingElement(m)||!e.ts.isIdentifier(m.name)?!1:m.name.text===n)?t:(d.push(e.ts.factory.createBindingElement(void 0,void 0,n)),d.sort((m,E)=>!e.ts.isBindingElement(m)||!e.ts.isIdentifier(m.name)||!e.ts.isBindingElement(E)||!e.ts.isIdentifier(E.name)?0:m.name.text.localeCompare(E.name.text)),c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createObjectBindingPattern(d),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 r=="string"){let s=e.ts.factory.createVariableStatement(void 0,e.ts.factory.createVariableDeclarationList([e.ts.factory.createVariableDeclaration(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)}if(typeof n=="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,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)}return t}function Ft(e,t,r="esm"){return r==="cjs"?nc(e,t):tc(e,t)}function tc(e,t){let r=[];for(let n of t.statements){if(e.ts.isExportDeclaration(n)){if(n.exportClause&&e.ts.isNamedExports(n.exportClause)){for(let i of n.exportClause.elements)if(n.moduleSpecifier&&r.push({isDefaultExport:!1,statement:n,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&&r.push({isDefaultExport:!1,statement:o,node:o});else e.ts.isFunctionDeclaration(o)&&o.name&&o.name.text===a&&r.push({isDefaultExport:!1,statement:o,node:o})}}else!n.exportClause&&n.moduleSpecifier&&r.push({isDefaultExport:!1,statement:n,node:n});continue}if(e.ts.isExportAssignment(n)){let i=n.flags===e.ts.NodeFlags.None,a=n.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&&r.push({isDefaultExport:i,statement:s,node:s});e.ts.isFunctionDeclaration(s)&&s.name?.text===o&&r.push({isDefaultExport:i,statement:s,node:s})}}else(e.ts.isArrowFunction(a)||e.ts.isCallExpression(a)||e.ts.isFunctionDeclaration(a)||e.ts.isObjectLiteralExpression(a))&&r.push({isDefaultExport:i,statement:n,node:a});continue}if((e.ts.isVariableStatement(n)||e.ts.isFunctionDeclaration(n))&&n.modifiers&&n.modifiers.some(i=>i.kind===e.ts.SyntaxKind.ExportKeyword)){r.push({isDefaultExport:n.modifiers.some(i=>i.kind===e.ts.SyntaxKind.DefaultKeyword),statement:n,node:n});continue}}return r}function nc(e,t){let r=[];for(let n of t.statements)if(e.ts.isExpressionStatement(n)&&e.ts.isBinaryExpression(n.expression)&&e.ts.isPropertyAccessExpression(n.expression.left)){let i=n.expression.left,a=n.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&&r.push({isDefaultExport:!0,statement:s,node:s});else e.ts.isFunctionDeclaration(s)&&s.name&&s.name.text===o&&r.push({isDefaultExport:!0,statement:s,node:s})}else r.push({isDefaultExport:!0,statement:n,node:a});continue}}return r}function rc(e,t,r){for(let n of t.statements)if(e.ts.isImportDeclaration(n)&&n.importClause){if(n.importClause.namedBindings&&e.ts.isNamedImports(n.importClause.namedBindings)){for(let i of n.importClause.namedBindings.elements)if(e.ts.isIdentifier(i.name)&&i.name.text===r&&e.ts.isStringLiteral(n.moduleSpecifier))return{importPath:n.moduleSpecifier.text,exportType:"named"}}if(n.importClause.name&&n.importClause.name.text===r&&e.ts.isStringLiteral(n.moduleSpecifier))return{importPath:n.moduleSpecifier.text,exportType:"default"}}return null}async function Le(e,t,r,n){let i=rc(e,r,n);if(i){let a=await an(e,e.normalize(e.resolve(e.dirname(t),i.importPath))),o=e.relative(e.getAppRootDir(),a);return{displayFilePath:M(e,a),filePath:a,relFilePath:o,importPath:i.importPath,exportType:i.exportType}}return null}function Ot(e,t,r){for(let n=0;n<t.statements.length;n++){let i=t.statements[n];if(e.ts.isVariableStatement(i)){for(let a of i.declarationList.declarations)if(e.ts.isIdentifier(a.name)&&a.name.text===r)return{statement:i,statementIndex:n}}}return null}function X(e,t,r){let n=Ot(e,t,r);if(n&&n.statement.declarationList.declarations.length>0){let i=n.statement.declarationList.declarations[0];if(i.initializer&&e.ts.isArrayLiteralExpression(i.initializer))return{statement:n.statement,statementIndex:n.statementIndex,variableDeclaration:i,arrayLiteralExp:i.initializer}}return null}function _n(e,t){if(t){if(oc(e,t))return!0;let r=!1;if(t.forEachChild(n=>{_n(e,n)&&(r=!0)}),r)return!0}return!1}function oc(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 an(e,t){let r=e.extname(t).toLowerCase();if(r===""||!Vr.includes(r)){for(let n of Vr){let i=t+n;if(await e.exists(i))return i}for(let n of Vr){let i=e.join(t,"index"+n);if(await e.exists(i))return i}}return t}var Vr=[".tsx",".jsx",".ts",".js"];function _t(e,t,r){if(!r||!t)return;let n=t.getSymbolAtLocation(r);if(!n)return;let i=n.valueDeclaration;if(!i)return;let a=i.getSourceFile().fileName,o=ic(e,a);return o?[{name:o}]:void 0}function ic(e,t){if(typeof t=="string"){t=e.normalize(we(t));let r=t.split("/"),n=r.lastIndexOf("node_modules");if(n>-1){let i=r.slice(n+1),a=i[0];if(a)return a.startsWith("@")&&i[1]&&(a+="/"+i[1]),a}}}function Oe(e){let t=[];for(let r of e)if(r.dependencies)for(let n of r.dependencies)t.some(i=>i.name===n.name)||t.push({...n});return t.sort((r,n)=>r.name.localeCompare(n.name))}function ra(e,t,r="esm"){return r==="cjs"?uc(e,t):sc(e,t)}var ac=/^(@\w|\w)/;function sc(e,t){let r=[];for(let n of t.statements)if(e.ts.isImportDeclaration(n)&&e.ts.isLiteralExpression(n.moduleSpecifier)){if(!ac.test(n.moduleSpecifier.text)||n.importClause?.isTypeOnly)continue;if(n.importClause&&n.importClause.namedBindings&&e.ts.isNamedImports(n.importClause.namedBindings))for(let i of n.importClause.namedBindings.elements)i.isTypeOnly||r.push({isDefaultExport:!1,statement:n,node:i.name});n.importClause&&n.importClause.name&&r.push({isDefaultExport:!0,statement:n,node:n.importClause.name})}return r}function uc(e,t){return[]}async function Mt(e,t){if(!t.some(o=>!o.isRegistered))return t;let n=await ee(e,t.map(o=>o.filePath)),i=n.getTypeChecker();return await Promise.all(t.map(async o=>{let s=n.getSourceFile(o.filePath);if(s){let l=(await st(e,i,o.filePath,s,!1)).find(c=>c.cmpInfo.id===o.id);l&&(o.inputs=Et(e,i,l.node.fnNode))}return o}))}async function jt(e,t,r,n){if(t.node.fnNode){let{sourceFile:i,typeChecker:a}=await It(e,t.cmpInfo.filePath,r),s=(await st(e,a,t.cmpInfo.filePath,i,n)).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 Et(e,a,s.node.fnNode)}return[]}async function ia(e,t,r){let n=e.extname(t).toLowerCase();if(n===".tsx"||n===".jsx"||n===".ts"||n===".js"){let i=await e.readFile(t);if(i)return lc(e,t,i,r)}return null}function lc(e,t,r,n=!1){let i=N(e,r);return st(e,null,t,i,n)}async function st(e,t,r,n,i){let a=[];for(let s of n.statements)if(e.ts.isExpressionStatement(s)&&e.ts.isStringLiteral(s.expression)&&s.expression.text==="use server")return a;let o=Ft(e,n);return i&&o.push(...ra(e,n)),r=e.normalize(r),await Promise.all(o.map(async s=>{let u=await cc(e,t,r,s);a.push(...u)})),a}async function cc(e,t,r,n){let i=[],a=e.relative(e.getAppRootDir(),r),o=K(e,r);if(e.ts.isVariableStatement(n.node)){for(let s of n.node.declarationList.declarations){if(!e.ts.isIdentifier(s.name)||!Tt(s.name.text))continue;let u=Qe(e,t,s.initializer);if(u){let l=u.name||s.name.text,c=n.isDefaultExport?"default":l,p=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await z(e,r,c),displayFilePath:M(e,r),name:q(l),inputs:[],exportName:c,exportType:p,importName:l,filePath:r,relFilePath:a,importPath:o,dependencies:u.deps,framework:"react"},node:u})}}return i}if(e.ts.isArrowFunction(n.node)){let s=Qe(e,t,n.node);if(s){let u=Ee(e,r),l=n.isDefaultExport?"default":u,c=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await z(e,r,l),displayFilePath:M(e,r),name:u,inputs:[],exportName:l,exportType:c,importName:Ct(e,r),filePath:r,relFilePath:a,importPath:o,dependencies:s.deps,framework:"react"},node:s})}return i}if(e.ts.isFunctionExpression(n.node)||e.ts.isFunctionDeclaration(n.node)){let s=n.node.name?.text;if(s&&!Tt(s))return i;let u=Qe(e,t,n.node);if(u){let l=u.name||Ee(e,r),c=n.isDefaultExport||!u.name?"default":u.name,p=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await z(e,r,c),displayFilePath:M(e,r),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||Ct(e,r),filePath:r,relFilePath:a,importPath:o,dependencies:u.deps,framework:"react"},node:u})}return i}if((e.ts.isExportSpecifier(n.node)||e.ts.isIdentifier(n.node))&&Tt(n.node.getText())){let s,u=Qe(e,t,n.node);if(u){let l=u.name||Ee(e,r),c=n.isDefaultExport||!u.name?"default":u.name,p=n.isDefaultExport?"default":"named",f=pc(e,n.node)?.moduleSpecifier??mc(e,n.node)?.moduleSpecifier;if(f&&e.ts.isStringLiteral(f)){let h=t?.getSymbolAtLocation(f);if(h&&h.declarations&&h.declarations.length>0){let D=h.declarations[0];(!e.ts.isSourceFile(D)||e.ts.isSourceFile(D)&&D.fileName.includes("node_modules"))&&(s=f.text)}}i.push({cmpInfo:{id:await z(e,r,c,s),displayFilePath:M(e,r),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||Ct(e,r),filePath:r,relFilePath:a,importPath:s||o,externalImportPath:s,dependencies:u.deps,framework:"react"},node:u})}return i}if(e.ts.isExportDeclaration(n.node)&&n.node.exportClause===void 0){let s=n.node.moduleSpecifier;if(s&&e.ts.isStringLiteral(s)){let u=await dc(e,t,r,s);i.push(...u)}return i}return i}function pc(e,t){for(;t;){if(e.ts.isExportDeclaration(t))return t;t=t.parent}return null}function mc(e,t){for(;t;){if(e.ts.isImportDeclaration(t))return t;t=t.parent}return null}function Qe(e,t,r){if(!r)return null;if(e.ts.isArrowFunction(r))return _n(e,r.body)?{name:"",fnNode:r,deps:_t(e,t,r)}:null;if(e.ts.isFunctionExpression(r)||e.ts.isFunctionDeclaration(r))return _n(e,r.body)?{name:r.name?.text||"",fnNode:r,deps:_t(e,t,r)}:null;if(e.ts.isCallExpression(r)){let n=r.expression;if(e.ts.isPropertyAccessExpression(n)){let i=r.arguments;if(i.length===0)return null;let a=n.expression;if(!e.ts.isIdentifier(a)||a.text!=="React")return null;let o=n.name;return!e.ts.isIdentifier(o)||o.text!=="forwardRef"?null:Qe(e,t,i[0])}else if(e.ts.isIdentifier(n)&&n.text==="observer"){let i=r.arguments;return i.length===0?null:Qe(e,t,i[0])}return null}if(!t)return null;if(e.ts.isPropertyAccessExpression(r)){let n=r.expression,i=r.name;if(!e.ts.isIdentifier(n)||!e.ts.isIdentifier(i)||!Tt(i.text))return null;let o=t.getTypeAtLocation(i).getCallSignatures();if(o.length>0&&o[0].getParameters().length>0)return{name:"",fnNode:i,deps:_t(e,t,i)}}if(e.ts.isExportSpecifier(r)){let n=r.name;return{name:n.text||"",fnNode:n,deps:_t(e,t,n)}}if(e.ts.isIdentifier(r))return{name:r.text||"",fnNode:r,deps:_t(e,t,r)};if(e.ts.isExpressionStatement(r)){let n=r.expression;if(e.ts.isAsExpression(n)&&e.ts.isIdentifier(n.type)&&n.type.text==="default")return Qe(e,t,n.expression)}if(e.ts.isVariableStatement(r)){for(let n of r.declarationList.declarations)if(n.initializer&&e.ts.isAsExpression(n.initializer)){let i=n.initializer;if(e.ts.isIdentifier(i.type)&&i.type.text==="default"){let a=Qe(e,t,i.expression);if(a&&e.ts.isIdentifier(n.name))return{name:n.name.text,fnNode:a.fnNode,deps:a.deps}}}}return null}async function aa(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.normalize(a.fileName);if(Pn(e,fc,a.fileName)||o===e.reactConfigPath||o===e.builderComponentPath)return;let s=await st(e,i,o,a,o===e.registryPath);r.push(...s)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var fc=new Set(["node_modules","dist"]);async function dc(e,t,r,n){let i=[],a=n.text;if(!t)return i;try{let o=t.getSymbolAtLocation(n);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(!Tt(c)&&c!=="default"||!sa(e,t,l))continue;let p=Qe(e,t,l);if(p){let f=u.name,h=f==="default"?"default":"named",D=q(f),d=f==="default"?Ct(e,r):f;i.push({cmpInfo:{id:await z(e,r,f,a),displayFilePath:M(e,r),name:D,inputs:[],exportName:f,exportType:h,importName:d,filePath:r,relFilePath:e.relative(e.getAppRootDir(),r),importPath:a,externalImportPath:a,dependencies:p.deps,framework:"react"},node:p})}}}catch(o){console.error(`Error processing module ${a}:`,o)}return i}function sa(e,t,r){if(e.ts.isInterfaceDeclaration(r)||e.ts.isTypeAliasDeclaration(r))return!1;if(e.ts.isExportSpecifier(r)){let n=t.getSymbolAtLocation(r.name);if(n){let a=t.getAliasedSymbol(n).declarations?.[0];if(a)return sa(e,t,a)}return!1}if(e.ts.isFunctionDeclaration(r)||e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r)){let n=t.getSignatureFromDeclaration(r);if(n){let i=t.getReturnTypeOfSignature(n);return oa(i,t)}}return e.ts.isClassDeclaration(r)?r.heritageClauses?.some(i=>i.types.some(a=>a.expression.getText()==="React.Component"||a.expression.getText()==="Component"))??!1:e.ts.isVariableDeclaration(r)?t.getTypeAtLocation(r).getCallSignatures().some(a=>oa(t.getReturnTypeOfSignature(a),t)):!1}function oa(e,t){let r=t.typeToString(e);return r==="JSX.Element"||r==="Element"||r.includes("ReactElement")||r.includes("React.ReactElement")||r.includes("ReactNode")}async function ua(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(e.appDir&&Dc.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 st(e,i,s,a,s===e.registryPath||De(s));r.push(...u)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var Dc=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 _e(e,t){let r=[],n=[],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("/")){r.push(o);continue}}let s=o.importClause;if(s){if(s.namedBindings){n.push(o);continue}if(s.name){n.push(o);continue}}i.push(o);continue}a.push(o)}return e.ts.factory.updateSourceFile(t,[...Ur(e,r),...Ur(e,n),...Ur(e,i),...a])}function Ae(e){let t=e.split(`
294
+ `,r+=");";let n=An(e,r);return Lr(e,n,t)}function Lr(e,t,r){if(!e.ts.isExpressionStatement(t))return t;let n=t.expression;if(!e.ts.isCallExpression(n))return t;let i=[...n.arguments];if(i.length<2)return t;r.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]=te(e,a,r),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(n,n.expression,n.typeArguments,i))):t}function k(e,t,r,n="esm"){return Array.isArray(r.namedImports)&&r.namedImports.forEach(i=>{t=ql(e,t,i,r.importPath,!!r.isTypeOnly,n)}),typeof r.defaultImport=="string"&&(t=Wl(e,t,r.defaultImport,r.importPath,n)),t}function ql(e,t,r,n,i,a){return a==="cjs"?Hi(e,t,null,r,n):Gi(e,t,null,r,n,i)}function Wl(e,t,r,n,i){return i==="cjs"?Hi(e,t,r,null,n):Gi(e,t,r,null,n,!1)}function Gi(e,t,r,n,i,a){let o=[...t.statements],s=0,u=!1,l=!1;for(let h=0;h<o.length;h++){let D=o[h];if(!e.ts.isImportDeclaration(D)||(s=h,!D.moduleSpecifier||!e.ts.isStringLiteral(D.moduleSpecifier))||D.moduleSpecifier.text!==i||!!D.importClause?.isTypeOnly!==a)continue;let d=[],g=D.importClause?.namedBindings;if(g&&e.ts.isNamedImports(g)&&g.elements&&d.push(...g.elements),typeof n=="string"){if(d.some(E=>E.name.text===n))return t;d.push(e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(n))),d.sort((E,x)=>E.name.text.localeCompare(x.name.text)),u=!0}let m=D.importClause?D.importClause.name:void 0;if(typeof r=="string"){if(m&&m.text===r)return t;m=e.ts.factory.createIdentifier(r),l=!0}if(u||l)return o[h]=e.ts.factory.updateImportDeclaration(D,void 0,e.ts.factory.createImportClause(a,m,e.ts.factory.createNamedImports(d)),D.moduleSpecifier,void 0),e.ts.factory.updateSourceFile(t,o)}let c,p;typeof r=="string"&&(c=e.ts.factory.createIdentifier(r)),typeof n=="string"&&(p=e.ts.factory.createNamedImports([e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(n))]));let f=e.ts.factory.createImportDeclaration(void 0,e.ts.factory.createImportClause(a,c,p),e.ts.factory.createStringLiteral(i));return o.splice(s,0,f),e.ts.factory.updateSourceFile(t,o)}function Hi(e,t,r,n,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],f=p.initializer;if(!f||!e.ts.isCallExpression(f))continue;let h=f.expression;if(!e.ts.isIdentifier(h)||h.text!=="require"||f.arguments.length!==1)continue;let D=f.arguments[0];if(e.ts.isStringLiteral(D)&&(o=s,D.text===i)){if(e.ts.isIdentifier(p.name)&&typeof r=="string")return p.name.text===r?t:(c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createIdentifier(r),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 n=="string"){let d=[...p.name.elements];return d.some(m=>!e.ts.isBindingElement(m)||!e.ts.isIdentifier(m.name)?!1:m.name.text===n)?t:(d.push(e.ts.factory.createBindingElement(void 0,void 0,n)),d.sort((m,E)=>!e.ts.isBindingElement(m)||!e.ts.isIdentifier(m.name)||!e.ts.isBindingElement(E)||!e.ts.isIdentifier(E.name)?0:m.name.text.localeCompare(E.name.text)),c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createObjectBindingPattern(d),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 r=="string"){let s=e.ts.factory.createVariableStatement(void 0,e.ts.factory.createVariableDeclarationList([e.ts.factory.createVariableDeclaration(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)}if(typeof n=="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,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)}return t}function yt(e,t,r="esm"){return r==="cjs"?Gl(e,t):Jl(e,t)}function Jl(e,t){let r=[];for(let n of t.statements){if(e.ts.isExportDeclaration(n)){if(n.exportClause&&e.ts.isNamedExports(n.exportClause)){for(let i of n.exportClause.elements)if(n.moduleSpecifier&&r.push({isDefaultExport:!1,statement:n,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&&r.push({isDefaultExport:!1,statement:o,node:o});else e.ts.isFunctionDeclaration(o)&&o.name&&o.name.text===a&&r.push({isDefaultExport:!1,statement:o,node:o})}}else!n.exportClause&&n.moduleSpecifier&&r.push({isDefaultExport:!1,statement:n,node:n});continue}if(e.ts.isExportAssignment(n)){let i=n.flags===e.ts.NodeFlags.None,a=n.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&&r.push({isDefaultExport:i,statement:s,node:s});e.ts.isFunctionDeclaration(s)&&s.name?.text===o&&r.push({isDefaultExport:i,statement:s,node:s})}}else(e.ts.isArrowFunction(a)||e.ts.isCallExpression(a)||e.ts.isFunctionDeclaration(a)||e.ts.isObjectLiteralExpression(a))&&r.push({isDefaultExport:i,statement:n,node:a});continue}if((e.ts.isVariableStatement(n)||e.ts.isFunctionDeclaration(n))&&n.modifiers&&n.modifiers.some(i=>i.kind===e.ts.SyntaxKind.ExportKeyword)){r.push({isDefaultExport:n.modifiers.some(i=>i.kind===e.ts.SyntaxKind.DefaultKeyword),statement:n,node:n});continue}}return r}function Gl(e,t){let r=[];for(let n of t.statements)if(e.ts.isExpressionStatement(n)&&e.ts.isBinaryExpression(n.expression)&&e.ts.isPropertyAccessExpression(n.expression.left)){let i=n.expression.left,a=n.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&&r.push({isDefaultExport:!0,statement:s,node:s});else e.ts.isFunctionDeclaration(s)&&s.name&&s.name.text===o&&r.push({isDefaultExport:!0,statement:s,node:s})}else r.push({isDefaultExport:!0,statement:n,node:a});continue}}return r}function Hl(e,t,r){for(let n of t.statements)if(e.ts.isImportDeclaration(n)&&n.importClause){if(n.importClause.namedBindings&&e.ts.isNamedImports(n.importClause.namedBindings)){for(let i of n.importClause.namedBindings.elements)if(e.ts.isIdentifier(i.name)&&i.name.text===r&&e.ts.isStringLiteral(n.moduleSpecifier))return{importPath:n.moduleSpecifier.text,exportType:"named"}}if(n.importClause.name&&n.importClause.name.text===r&&e.ts.isStringLiteral(n.moduleSpecifier))return{importPath:n.moduleSpecifier.text,exportType:"default"}}return null}async function je(e,t,r,n){let i=Hl(e,r,n);if(i){let a=await un(e,e.normalize(e.resolve(e.dirname(t),i.importPath))),o=e.relative(e.getAppRootDir(),a);return{displayFilePath:j(e,a),filePath:a,relFilePath:o,importPath:i.importPath,exportType:i.exportType}}return null}function _t(e,t,r){for(let n=0;n<t.statements.length;n++){let i=t.statements[n];if(e.ts.isVariableStatement(i)){for(let a of i.declarationList.declarations)if(e.ts.isIdentifier(a.name)&&a.name.text===r)return{statement:i,statementIndex:n}}}return null}function X(e,t,r){let n=_t(e,t,r);if(n&&n.statement.declarationList.declarations.length>0){let i=n.statement.declarationList.declarations[0];if(i.initializer&&e.ts.isArrayLiteralExpression(i.initializer))return{statement:n.statement,statementIndex:n.statementIndex,variableDeclaration:i,arrayLiteralExp:i.initializer}}return null}function _n(e,t){if(t){if(Ql(e,t))return!0;let r=!1;if(t.forEachChild(n=>{_n(e,n)&&(r=!0)}),r)return!0}return!1}function Ql(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 un(e,t){let r=e.extname(t).toLowerCase();if(r===""||!Or.includes(r)){for(let n of Or){let i=t+n;if(await e.exists(i))return i}for(let n of Or){let i=e.join(t,"index"+n);if(await e.exists(i))return i}}return t}var Or=[".tsx",".jsx",".ts",".js"];function jt(e,t,r){if(!r||!t)return;let n=t.getSymbolAtLocation(r);if(!n)return;let i=n.valueDeclaration;if(!i)return;let a=i.getSourceFile().fileName,o=Yl(e,a);return o?[{name:o}]:void 0}function Yl(e,t){if(typeof t=="string"){t=e.normalize(Te(t));let r=t.split("/"),n=r.lastIndexOf("node_modules");if(n>-1){let i=r.slice(n+1),a=i[0];if(a)return a.startsWith("@")&&i[1]&&(a+="/"+i[1]),a}}}function Me(e){let t=[];for(let r of e)if(r.dependencies)for(let n of r.dependencies)t.some(i=>i.name===n.name)||t.push({...n});return t.sort((r,n)=>r.name.localeCompare(n.name))}function Qi(e,t,r="esm"){return r==="cjs"?ec(e,t):Zl(e,t)}var Xl=/^(@\w|\w)/;function Zl(e,t){let r=[];for(let n of t.statements)if(e.ts.isImportDeclaration(n)&&e.ts.isLiteralExpression(n.moduleSpecifier)){if(!Xl.test(n.moduleSpecifier.text)||n.importClause?.isTypeOnly)continue;if(n.importClause&&n.importClause.namedBindings&&e.ts.isNamedImports(n.importClause.namedBindings))for(let i of n.importClause.namedBindings.elements)i.isTypeOnly||r.push({isDefaultExport:!1,statement:n,node:i.name});n.importClause&&n.importClause.name&&r.push({isDefaultExport:!0,statement:n,node:n.importClause.name})}return r}function ec(e,t){return[]}async function Mt(e,t){if(!t.some(o=>!o.isRegistered))return t;let n=await ee(e,t.map(o=>o.filePath)),i=n.getTypeChecker();return await Promise.all(t.map(async o=>{let s=n.getSourceFile(o.filePath);if(s){let l=(await ut(e,i,o.filePath,s,!1)).find(c=>c.cmpInfo.id===o.id);l&&(o.inputs=Ft(e,i,l.node.fnNode))}return o}))}async function Vt(e,t,r,n){if(t.node.fnNode){let{sourceFile:i,typeChecker:a}=await Bt(e,t.cmpInfo.filePath,r),s=(await ut(e,a,t.cmpInfo.filePath,i,n)).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 Ft(e,a,s.node.fnNode)}return[]}async function Xi(e,t,r){let n=e.extname(t).toLowerCase();if(n===".tsx"||n===".jsx"||n===".ts"||n===".js"){let i=await e.readFile(t);if(i)return tc(e,t,i,r)}return null}function tc(e,t,r,n=!1){let i=N(e,r);return ut(e,null,t,i,n)}async function ut(e,t,r,n,i){let a=[];for(let s of n.statements)if(e.ts.isExpressionStatement(s)&&e.ts.isStringLiteral(s.expression)&&s.expression.text==="use server")return a;let o=yt(e,n);return i&&o.push(...Qi(e,n)),r=e.normalize(r),await Promise.all(o.map(async s=>{let u=await nc(e,t,r,s);a.push(...u)})),a}async function nc(e,t,r,n){let i=[],a=e.relative(e.getAppRootDir(),r),o=K(e,r);if(e.ts.isVariableStatement(n.node)){for(let s of n.node.declarationList.declarations){if(!e.ts.isIdentifier(s.name)||!It(s.name.text))continue;let u=Ze(e,t,s.initializer);if(u){let l=u.name||s.name.text,c=n.isDefaultExport?"default":l,p=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await z(e,r,c),displayFilePath:j(e,r),name:q(l),inputs:[],exportName:c,exportType:p,importName:l,filePath:r,relFilePath:a,importPath:o,dependencies:u.deps,framework:"react"},node:u})}}return i}if(e.ts.isArrowFunction(n.node)){let s=Ze(e,t,n.node);if(s){let u=ye(e,r),l=n.isDefaultExport?"default":u,c=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await z(e,r,l),displayFilePath:j(e,r),name:u,inputs:[],exportName:l,exportType:c,importName:xt(e,r),filePath:r,relFilePath:a,importPath:o,dependencies:s.deps,framework:"react"},node:s})}return i}if(e.ts.isFunctionExpression(n.node)||e.ts.isFunctionDeclaration(n.node)){let s=n.node.name?.text;if(s&&!It(s))return i;let u=Ze(e,t,n.node);if(u){let l=u.name||ye(e,r),c=n.isDefaultExport||!u.name?"default":u.name,p=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await z(e,r,c),displayFilePath:j(e,r),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||xt(e,r),filePath:r,relFilePath:a,importPath:o,dependencies:u.deps,framework:"react"},node:u})}return i}if((e.ts.isExportSpecifier(n.node)||e.ts.isIdentifier(n.node))&&It(n.node.getText())){let s,u=Ze(e,t,n.node);if(u){let l=u.name||ye(e,r),c=n.isDefaultExport||!u.name?"default":u.name,p=n.isDefaultExport?"default":"named",f=rc(e,n.node)?.moduleSpecifier??oc(e,n.node)?.moduleSpecifier;if(f&&e.ts.isStringLiteral(f)){let h=t?.getSymbolAtLocation(f);if(h&&h.declarations&&h.declarations.length>0){let D=h.declarations[0];(!e.ts.isSourceFile(D)||e.ts.isSourceFile(D)&&D.fileName.includes("node_modules"))&&(s=f.text)}}i.push({cmpInfo:{id:await z(e,r,c,s),displayFilePath:j(e,r),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||xt(e,r),filePath:r,relFilePath:a,importPath:s||o,externalImportPath:s,dependencies:u.deps,framework:"react"},node:u})}return i}if(e.ts.isExportDeclaration(n.node)&&n.node.exportClause===void 0){let s=n.node.moduleSpecifier;if(s&&e.ts.isStringLiteral(s)){let u=await ac(e,t,r,s);i.push(...u)}return i}return i}function rc(e,t){for(;t;){if(e.ts.isExportDeclaration(t))return t;t=t.parent}return null}function oc(e,t){for(;t;){if(e.ts.isImportDeclaration(t))return t;t=t.parent}return null}function Ze(e,t,r){if(!r)return null;if(e.ts.isArrowFunction(r))return _n(e,r.body)?{name:"",fnNode:r,deps:jt(e,t,r)}:null;if(e.ts.isFunctionExpression(r)||e.ts.isFunctionDeclaration(r))return _n(e,r.body)?{name:r.name?.text||"",fnNode:r,deps:jt(e,t,r)}:null;if(e.ts.isCallExpression(r)){let n=r.expression;if(e.ts.isPropertyAccessExpression(n)){let i=r.arguments;if(i.length===0)return null;let a=n.expression;if(!e.ts.isIdentifier(a)||a.text!=="React")return null;let o=n.name;return!e.ts.isIdentifier(o)||o.text!=="forwardRef"?null:Ze(e,t,i[0])}else if(e.ts.isIdentifier(n)&&n.text==="observer"){let i=r.arguments;return i.length===0?null:Ze(e,t,i[0])}return null}if(!t)return null;if(e.ts.isPropertyAccessExpression(r)){let n=r.expression,i=r.name;if(!e.ts.isIdentifier(n)||!e.ts.isIdentifier(i)||!It(i.text))return null;let o=t.getTypeAtLocation(i).getCallSignatures();if(o.length>0&&o[0].getParameters().length>0)return{name:"",fnNode:i,deps:jt(e,t,i)}}if(e.ts.isExportSpecifier(r)){let n=r.name;return{name:n.text||"",fnNode:n,deps:jt(e,t,n)}}if(e.ts.isIdentifier(r))return{name:r.text||"",fnNode:r,deps:jt(e,t,r)};if(e.ts.isExpressionStatement(r)){let n=r.expression;if(e.ts.isAsExpression(n)&&e.ts.isIdentifier(n.type)&&n.type.text==="default")return Ze(e,t,n.expression)}if(e.ts.isVariableStatement(r)){for(let n of r.declarationList.declarations)if(n.initializer&&e.ts.isAsExpression(n.initializer)){let i=n.initializer;if(e.ts.isIdentifier(i.type)&&i.type.text==="default"){let a=Ze(e,t,i.expression);if(a&&e.ts.isIdentifier(n.name))return{name:n.name.text,fnNode:a.fnNode,deps:a.deps}}}}return null}async function Zi(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.normalize(a.fileName);if(Pn(e,ic,a.fileName)||o===e.reactConfigPath||o===e.builderComponentPath)return;let s=await ut(e,i,o,a,o===e.registryPath);r.push(...s)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var ic=new Set(["node_modules","dist"]);async function ac(e,t,r,n){let i=[],a=n.text;if(!t)return i;try{let o=t.getSymbolAtLocation(n);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(!It(c)&&c!=="default"||!ea(e,t,l))continue;let p=Ze(e,t,l);if(p){let f=u.name,h=f==="default"?"default":"named",D=q(f),d=f==="default"?xt(e,r):f;i.push({cmpInfo:{id:await z(e,r,f,a),displayFilePath:j(e,r),name:D,inputs:[],exportName:f,exportType:h,importName:d,filePath:r,relFilePath:e.relative(e.getAppRootDir(),r),importPath:a,externalImportPath:a,dependencies:p.deps,framework:"react"},node:p})}}}catch(o){e.Sentry?.captureException(new Error(`Error processing module ${a}:`,{cause:o}),{extra:{modulePath:a,filePath:r}})}return i}function ea(e,t,r){if(e.ts.isInterfaceDeclaration(r)||e.ts.isTypeAliasDeclaration(r))return!1;if(e.ts.isExportSpecifier(r)){let n=t.getSymbolAtLocation(r.name);if(n){let a=t.getAliasedSymbol(n).declarations?.[0];if(a)return ea(e,t,a)}return!1}if(e.ts.isFunctionDeclaration(r)||e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r)){let n=t.getSignatureFromDeclaration(r);if(n){let i=t.getReturnTypeOfSignature(n);return Yi(i,t)}}return e.ts.isClassDeclaration(r)?r.heritageClauses?.some(i=>i.types.some(a=>a.expression.getText()==="React.Component"||a.expression.getText()==="Component"))??!1:e.ts.isVariableDeclaration(r)?t.getTypeAtLocation(r).getCallSignatures().some(a=>Yi(t.getReturnTypeOfSignature(a),t)):!1}function Yi(e,t){let r=t.typeToString(e);return r==="JSX.Element"||r==="Element"||r.includes("ReactElement")||r.includes("React.ReactElement")||r.includes("ReactNode")}async function ta(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(e.appDir&&sc.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 ut(e,i,s,a,s===e.registryPath||he(s));r.push(...u)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var sc=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 Ve(e,t){let r=[],n=[],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("/")){r.push(o);continue}}let s=o.importClause;if(s){if(s.namedBindings){n.push(o);continue}if(s.name){n.push(o);continue}}i.push(o);continue}a.push(o)}return e.ts.factory.updateSourceFile(t,[..._r(e,r),..._r(e,n),..._r(e,i),...a])}function Ie(e){let t=e.split(`
291
295
  `).map(n=>n.trimEnd());e="";let r=!1;for(let n=t.length-1;n>=0;n--){let i=t[n];!r&&i.startsWith("import ")&&(r=!0,i=i+`
292
296
  `),/^builder.init(.*)$/.test(i)&&(i=i+`
293
297
  `),t[n-1]&&!t[n-1].includes("*/")&&(i.trim().startsWith("Builder.registerComponent")&&(i=`
@@ -296,8 +300,8 @@ ${r}=${n}
296
300
  `+i),i.trim().startsWith("export ")&&(i=`
297
301
  `+i)),e=i+`
298
302
  `+e}return e.trim()+`
299
- `}function Ur(e,t){return t.sort((r,n)=>{let i=la(e,r),a=la(e,n);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())})}function la(e,t){let r=t.importClause;if(r){let n=r.namedBindings;if(n&&e.ts.isNamedImports(n)&&n.elements.length>0)return n.elements[0].name.text;if(r.name)return r.name.text}return t.moduleSpecifier&&e.ts.isStringLiteral(t.moduleSpecifier)?t.moduleSpecifier.text:""}function pa(e){return typeof e=="string"&&!e.includes("'use client'")&&!e.includes(`"use client"'`)&&(e=`"use client"
300
- ${e}`),e}function ma(e,t){let r=t.statements.filter(n=>!(e.ts.isExpressionStatement(n)&&e.ts.isStringLiteral(n.expression)&&e.ts.isStringLiteral(n.expression)&&n.expression.text==="use client"));return e.ts.factory.updateSourceFile(t,r)}function Me(e,t){return t.sort((r,n)=>{if(e.ts.isObjectLiteralExpression(r)&&e.ts.isObjectLiteralExpression(n)){let i=ca(e,r),a=ca(e,n);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())}return 1})}function ca(e,t){let r=t.properties.find(n=>j(e,n)==="name");return r&&e.ts.isPropertyAssignment(r)&&e.ts.isStringLiteral(r.initializer)?r.initializer.text:"zzzz"}async function fa(e){let t=await e.readFile(e.registryPath);return t?gc(e,t):{components:[],sourceFile:N(e,"")}}async function gc(e,t){let r=N(e,t);return e.sdkVersion===b.gen2?Cc(e,r):hc(e,r)}async function hc(e,t){let r=[];for(let n=0;n<t.statements.length;n++){let i=t.statements[n];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 f=e.ts.isIdentifier(p.expression)&&p.expression.text;if(f==="withChildren"){let D=qr(e,p.arguments[0]);if(e.ts.isCallExpression(D)){let d=await Kr(e,n,D,c,!0);d&&r.push(d)}else{let d=D;if(e.ts.isIdentifier(d)){let g=await zr(e,t,n,d,c,!0);g&&r.push(g)}}continue}if(f==="dynamic"){let D=await Kr(e,n,p,c,!1);D&&r.push(D);continue}let h=qr(e,p.arguments[0]);if(e.ts.isCallExpression(h)&&e.ts.isIdentifier(h.expression)&&h.expression.text==="dynamic"){let D=await Kr(e,n,h,c,!1);D&&r.push(D);continue}if(e.ts.isIdentifier(h)){let D=await zr(e,t,n,h,c,!1);D&&r.push(D);continue}continue}if(e.ts.isIdentifier(p)){let f=await zr(e,t,n,p,c,!1);f&&r.push(f);continue}}return{sourceFile:t,components:me(r)}}function qr(e,t){return e.ts.isCallExpression(t)?(e.ts.isIdentifier(t.expression)&&t.expression.text)==="dynamic"?t:qr(e,t.arguments[0]):t}async function Kr(e,t,r,n,i){let a={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:t,acceptsChildren:i,framework:"react"},o=r.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,f=await Vt(e,p);a.filePath=f,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(f)?a.importPath=K(e,a.filePath):(a.externalImportPath=p,a.importPath=a.externalImportPath),a.name=Ee(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 h=p.arguments[0];if(!e.ts.isStringLiteral(h)||!e.ts.isIdentifier(u.name))return null;let D=h.text,d=await Vt(e,D);a.filePath=d,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(d)?a.importPath=K(e,a.filePath):(a.externalImportPath=D,a.importPath=a.externalImportPath),a.name=q(u.name.text),a.importName=u.name.text,a.exportName=u.name.text,a.exportType="named"}else return null;return a=fe(e,a,n),a.displayFilePath=M(e,a.filePath),a.filePath&&a.exportName&&(a.id=await z(e,a.filePath,a.exportName,a.externalImportPath)),a}async function zr(e,t,r,n,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:r,acceptsChildren:a,framework:"react"},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===n.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;let c=await Vt(e,l.text);o.filePath=c,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(c)?o.importPath=K(e,o.filePath):(o.externalImportPath=l.text,o.importPath=o.externalImportPath),o.name=Ee(e,o.filePath),o.importName=n.text,o.exportName="default",o.exportType="default"}else{let l=s.find(f=>!f.importClause||!f.importClause.namedBindings||!e.ts.isNamedImports(f.importClause.namedBindings)?!1:f.importClause.namedBindings.elements.some(h=>h.name.text===n.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await Vt(e,c.text);o.filePath=p,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=K(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=q(n.text),o.importName=n.text,o.exportName=n.text,o.exportType="named"}return o=fe(e,o,i),o.displayFilePath=M(e,o.filePath),o.filePath&&o.exportName&&(o.id=await z(e,o.filePath,o.exportName,o.externalImportPath)),o}function Vt(e,t){return an(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}function da(e,t,r){let n=!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 f=p.expression;if(!e.ts.isPropertyAccessExpression(f))continue;let h=f.expression;if(!e.ts.isIdentifier(h)||h.text!=="builder")continue;if(f.name.text=="init"){n=!0;break}else continue}if(n)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($e)),s=r?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 Cc(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Wr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:me(r)}}async function Wr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};Lt(e,r)&&(n.acceptsChildren=!0);for(let a of r.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(j(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isCallExpression(u)&&(e.ts.isIdentifier(u.expression)&&u.expression.text)==="dynamic"){let h=u.arguments;if(h.length===0)return null;let D=h[0];if(!e.ts.isArrowFunction(D))return null;let d=D.body;if(e.ts.isCallExpression(d)){if(d.expression.kind!==e.ts.SyntaxKind.ImportKeyword||d.arguments.length!==1)return null;let m=d.arguments[0];if(!e.ts.isStringLiteral(m))return null;let E=m.text,x=await Vt(e,E);n.filePath=x,n.relFilePath=e.relative(e.getAppRootDir(),n.filePath),await e.exists(x)?n.importPath=K(e,n.filePath):(n.externalImportPath=E,n.importPath=n.externalImportPath),n.name=Ee(e,n.filePath),n.importName="default",n.exportName="default",n.exportType="default"}else if(e.ts.isPropertyAccessExpression(d)){let g=d.expression;if(!e.ts.isParenthesizedExpression(g))return null;let m=g.expression;if(!e.ts.isAwaitExpression(m))return null;let E=m.expression;if(!e.ts.isCallExpression(E)||E.expression.kind!==e.ts.SyntaxKind.ImportKeyword||E.arguments.length!==1)return null;let v=E.arguments[0];if(!e.ts.isStringLiteral(v)||!e.ts.isIdentifier(d.name))return null;let S=v.text,y=await Vt(e,S);n.filePath=y,n.relFilePath=e.relative(e.getAppRootDir(),n.filePath),await e.exists(y)?n.importPath=K(e,n.filePath):(n.externalImportPath=S,n.importPath=n.externalImportPath),n.name=q(d.name.text),n.importName=d.name.text,n.exportName=d.name.text,n.exportType="named"}else return null;return n=fe(e,n,r),n.displayFilePath=M(e,n.filePath),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;n.name===""&&(n.name=q(s)),n.importName=s;let l=await Le(e,e.registryPath,t,s);if(!l)continue;n.filePath=l.filePath,n.relFilePath=l.relFilePath,await e.exists(l.filePath)?n.importPath=K(e,l.filePath):(n.externalImportPath=l.importPath,n.importPath=n.externalImportPath),n.importPath=K(e,l.filePath),n.displayFilePath=l.displayFilePath,n.exportType=l.exportType;let c=t.statements.filter(f=>e.ts.isImportDeclaration(f)),p=c.find(f=>f.importClause&&f.importClause.name?.text===s);if(p){let f=p.moduleSpecifier;if(!e.ts.isStringLiteral(f))return null;n.exportName="default"}else{let f=c.find(D=>!D.importClause||!D.importClause.namedBindings||!e.ts.isNamedImports(D.importClause.namedBindings)?!1:D.importClause.namedBindings.elements.some(d=>d.name.text===s));if(!f)return null;let h=f.moduleSpecifier;if(!e.ts.isStringLiteral(h))return null;n.exportName=s}continue}}return n=fe(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}function je(e,t){let r=[...t.statements],n=!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 f=p.text;Da(e,t,f)||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);r[i]=c,n=!0}}else if(a.importClause.name&&e.ts.isIdentifier(a.importClause.name)){let u=a.importClause.name.text;Da(e,t,u)||(o=!0)}o&&(r.splice(i,1),n=!0)}}return n?e.ts.factory.updateSourceFile(t,r):t}function Da(e,t,r){let n=!1;function i(a){if(!e.ts.isImportDeclaration(a)){if(e.ts.isIdentifier(a)&&a.text===r){n=!0;return}e.ts.forEachChild(a,i)}}return e.ts.forEachChild(t,i),n}function Ve(e,t,r,n,i,a,o){let s=null,u=null,l=null,c=-1;t=ge(t),r=ge(r);let p=t.find(h=>h.id===e),f=r.find(h=>h.id===e);if(n)f||(s={...ge(p),inputs:ge(p.inputs).map(h=>(h.isRegistered=!0,h))},c=r.length,r.push(s));else if(typeof f?.nodeIndex=="number"&&f.nodeIndex>-1){if(i)c=f.nodeIndex,u=ge(f),r=r.filter(h=>h.id!==e);else if(a!=null)xc(f,a),c=f.nodeIndex,l=f;else if(o!=null){let h=f.inputs.find(D=>D.name===o.name);h&&(o.registerInput===!1?h.isRegistered=!1:(Ec(h,o),h.isRegistered=!0),l=f,c=f.nodeIndex)}}return{addCmpToRegistry:s,removeCmpFromRegistry:u,updateRegisteredCmp:l,nodeIndex:c,components:be(t,r)}}function be(e,t){let r=me([...t.map(n=>(n.isRegistered=!0,n)),...e.filter(n=>!t.some(i=>i.id===n.id)).map(n=>(n.isRegistered=!1,n))]);return r.forEach(n=>{n.inputs=n.inputs.map(Mr),n.inputs.sort((o,s)=>o.name.toLowerCase().localeCompare(s.name.toLowerCase()));let i=t.find(o=>o.id===n.id);i&&(i.acceptsChildren=_r(n));let a=e.find(o=>o.id===n.id&&o.externalImportPath);a&&(n.filePath=a.filePath,n.relFilePath=a.relFilePath)}),r}function xc(e,t){ce(t.name)?e.name=t.name:t.name===null&&(e.name=e.importName),ce(t.description)?e.description=t.description:t.description===null&&delete e.description,ce(t.image)?e.image=t.image:t.image===null&&delete e.image}function Ec(e,t){ce(t.type)&&(e.type=t.type),ce(t.friendlyName)?e.friendlyName=t.friendlyName:t.friendlyName===null&&delete e.friendlyName,ce(t.defaultValue)||Jt(t.defaultValue)||Pt(t.defaultValue)?e.defaultValue=t.defaultValue:t.defaultValue===null&&delete e.defaultValue,ce(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 ut(e){let t=new Set,r=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 r(s)}))};return await r(e.getAppRootDir()),await ee(e,[...t])}function Ue(e,t,r){return Ot(e,t,r.variableName)?t:Fc(e,t,r)}function Fc(e,t,r){let n=typeof r.arrayType=="string"?e.ts.factory.createArrayTypeNode(e.ts.factory.createTypeReferenceNode(r.arrayType,void 0)):void 0,i=e.ts.factory.createArrayLiteralExpression([]),a=e.ts.factory.createVariableDeclaration(r.variableName,void 0,n,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 Ke(e,t,r,n,i,a,o,s){let u=await ut(e),[l,c,p,f]=await Promise.all([ua(e,u),fa(e),he(e),nn(e)]),h=l.map(x=>x.cmpInfo),D=c.components,d={components:be(h,D),registryPath:e.registryPath,registryDisplayPath:M(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Oe(h),publicApiKey:f.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await Mt(e,d.components),d;let g=!1,m=c.sourceFile,E=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(E.length>0){let x=E.map(y=>{let B=l.find($=>$.cmpInfo.id===y);if(!B)throw new Error(`Component ${y} not found`);return B}),v=Array.from(new Set(x.map(y=>y.cmpInfo.filePath))),S=await ee(e,v);for(let y of x){let B=d.components.find(A=>A.id===y.cmpInfo.id),$=await jt(e,y,S,e.registryPath===y.cmpInfo.filePath||De(y.cmpInfo.filePath));xe(B,$);let _=h.findIndex(A=>A.id===y.cmpInfo.id);h[_].inputs=$;let w=Ve(y.cmpInfo.id,h,D,r,n,i,a);if(e.sdkVersion===b.gen2){let{elements:A,elmIndex:ue,statementIndex:ve,statement:ie,variableDeclaration:V}=await vc(e,m,y);if(w.addCmpToRegistry)A.push(Sc(e,w.addCmpToRegistry)),g=!0;else if(w.removeCmpFromRegistry)A.splice(ue,1),g=!0;else if(w.updateRegisteredCmp){let le=te(e,A[ue],w.updateRegisteredCmp);A[ue]=e.ts.factory.updateObjectLiteralExpression(le,[ha(e,w.updateRegisteredCmp),...le.properties.slice(1)]),g=!0}if(g&&o){let le=[...m.statements];le[ve]=e.ts.factory.updateVariableStatement(ie,ie.modifiers,e.ts.factory.updateVariableDeclarationList(ie.declarationList,[e.ts.factory.updateVariableDeclaration(V,V.name,V.exclamationToken,V.type,e.ts.factory.createArrayLiteralExpression(Me(e,A)))])),m=e.ts.factory.updateSourceFile(m,le),m=ga(e,w,m),m=k(e,m,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),m=Ue(e,m,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=w.components,D=w.components.filter(Dt=>Dt.isRegistered)}}else{let A=[...m.statements];w.addCmpToRegistry?(A.push(ea(e,w.addCmpToRegistry)),g=!0):w.removeCmpFromRegistry?(A.splice(w.nodeIndex,1),g=!0):w.updateRegisteredCmp&&(A[w.nodeIndex]=jr(e,A[w.nodeIndex],w.updateRegisteredCmp),g=!0),g&&o&&(m=e.ts.factory.updateSourceFile(m,A),m=k(e,m,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),m=da(e,m,p),m=ga(e,w,m),B?.acceptsChildren&&(m=k(e,m,{namedImports:["withChildren"],importPath:"@builder.io/react"})),d.components=w.components,D=w.components.filter(ue=>ue.isRegistered))}}}if(g&&o){m=je(e,m),m=_e(e,m),e.appDir&&(m=ma(e,m));let x=ne(e,m);x=Ae(x),e.appDir&&(x=pa(x)),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return d}function ha(e,t){let r=e.ts.factory.createIdentifier(t.importName);return e.appDir?e.ts.factory.createPropertyAssignment("component",r):e.ts.factory.createPropertyAssignment("component",wc(e,t))}function yc(e){return e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())}function Sc(e,t){return te(e,e.ts.factory.createObjectLiteralExpression([ha(e,t),...t.acceptsChildren?[yc(e)]:[]],!0),t)}async function vc(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Wr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}function ga(e,t,r){if(e.appDir){let n=t.addCmpToRegistry||t.updateRegisteredCmp;if(n){let i=n.externalImportPath?n.externalImportPath:L(e,e.registryPath,n.filePath);n.exportType==="default"?r=k(e,r,{defaultImport:n.importName,importPath:i}):n.exportType==="named"&&(r=k(e,r,{namedImports:[n.importName],importPath:i}))}}else r=k(e,r,{defaultImport:"dynamic",importPath:"next/dynamic"});return r}function wc(e,t){let r=t.externalImportPath?t.externalImportPath:L(e,e.registryPath,t.filePath),n=t.exportName!=="default",i;n?i=e.ts.factory.createPropertyAccessExpression(e.ts.factory.createAwaitExpression(e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(r)])),e.ts.factory.createIdentifier(t.exportName)):i=e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(r)]);let a=e.ts.factory.createArrowFunction(n?[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 xa(e){let t=[],r=await Ic(e,t);return await va(e,t,r),e.appDir?(e.debug(`ensure builder setup for next.js app ${e.appDir}`),await bc(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure builder setup for next.js pages ${e.pagesDir}`),await Pc(e,e.pagesDir,t)),t}async function Ea(e){let t=[];return await va(e,t),e.appDir?(e.debug(`ensure figma-imports setup for next.js app ${e.appDir}`),await Ac(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure figma-imports setup for next.js pages ${e.pagesDir}`),await Tc(e,e.pagesDir,t)),t}async function Ac(e,t,r){let n=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"figma-imports",n);if(!await e.exists(i)){let a=await e.formatCode(i,ya({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,Fa(e));await e.writeFile(e.builderComponentPath,a),r.push({filePath:e.builderComponentPath,modifiedType:"create"})}}async function bc(e,t,r){let n=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"[...page]",n);if(!await e.exists(i)){let a=await e.formatCode(i,ya({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,Fa(e));await e.writeFile(e.builderComponentPath,a),r.push({filePath:e.builderComponentPath,modifiedType:"create"})}}function Fa(e){let t=e.typescriptEnabled;return e.sdkVersion===b.gen2?`
303
+ `}function _r(e,t){return t.sort((r,n)=>{let i=na(e,r),a=na(e,n);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())})}function na(e,t){let r=t.importClause;if(r){let n=r.namedBindings;if(n&&e.ts.isNamedImports(n)&&n.elements.length>0)return n.elements[0].name.text;if(r.name)return r.name.text}return t.moduleSpecifier&&e.ts.isStringLiteral(t.moduleSpecifier)?t.moduleSpecifier.text:""}function oa(e){return typeof e=="string"&&!e.includes("'use client'")&&!e.includes(`"use client"'`)&&(e=`"use client"
304
+ ${e}`),e}function ia(e,t){let r=t.statements.filter(n=>!(e.ts.isExpressionStatement(n)&&e.ts.isStringLiteral(n.expression)&&e.ts.isStringLiteral(n.expression)&&n.expression.text==="use client"));return e.ts.factory.updateSourceFile(t,r)}function Ue(e,t){return t.sort((r,n)=>{if(e.ts.isObjectLiteralExpression(r)&&e.ts.isObjectLiteralExpression(n)){let i=ra(e,r),a=ra(e,n);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())}return 1})}function ra(e,t){let r=t.properties.find(n=>M(e,n)==="name");return r&&e.ts.isPropertyAssignment(r)&&e.ts.isStringLiteral(r.initializer)?r.initializer.text:"zzzz"}async function aa(e){let t=await e.readFile(e.registryPath);return t?uc(e,t):{components:[],sourceFile:N(e,"")}}async function uc(e,t){let r=N(e,t);return e.sdkVersion===A.gen2?cc(e,r):lc(e,r)}async function lc(e,t){let r=[];for(let n=0;n<t.statements.length;n++){let i=t.statements[n];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 f=e.ts.isIdentifier(p.expression)&&p.expression.text;if(f==="withChildren"){let D=Vr(e,p.arguments[0]);if(e.ts.isCallExpression(D)){let d=await jr(e,n,D,c,!0);d&&r.push(d)}else{let d=D;if(e.ts.isIdentifier(d)){let g=await Mr(e,t,n,d,c,!0);g&&r.push(g)}}continue}if(f==="dynamic"){let D=await jr(e,n,p,c,!1);D&&r.push(D);continue}let h=Vr(e,p.arguments[0]);if(e.ts.isCallExpression(h)&&e.ts.isIdentifier(h.expression)&&h.expression.text==="dynamic"){let D=await jr(e,n,h,c,!1);D&&r.push(D);continue}if(e.ts.isIdentifier(h)){let D=await Mr(e,t,n,h,c,!1);D&&r.push(D);continue}continue}if(e.ts.isIdentifier(p)){let f=await Mr(e,t,n,p,c,!1);f&&r.push(f);continue}}return{sourceFile:t,components:De(r)}}function Vr(e,t){return e.ts.isCallExpression(t)?(e.ts.isIdentifier(t.expression)&&t.expression.text)==="dynamic"?t:Vr(e,t.arguments[0]):t}async function jr(e,t,r,n,i){let a={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:t,acceptsChildren:i,framework:"react"},o=r.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,f=await Ut(e,p);a.filePath=f,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(f)?a.importPath=K(e,a.filePath):(a.externalImportPath=p,a.importPath=a.externalImportPath),a.name=ye(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 h=p.arguments[0];if(!e.ts.isStringLiteral(h)||!e.ts.isIdentifier(u.name))return null;let D=h.text,d=await Ut(e,D);a.filePath=d,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(d)?a.importPath=K(e,a.filePath):(a.externalImportPath=D,a.importPath=a.externalImportPath),a.name=q(u.name.text),a.importName=u.name.text,a.exportName=u.name.text,a.exportType="named"}else return null;return a=ge(e,a,n),a.displayFilePath=j(e,a.filePath),a.filePath&&a.exportName&&(a.id=await z(e,a.filePath,a.exportName,a.externalImportPath)),a}async function Mr(e,t,r,n,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:r,acceptsChildren:a,framework:"react"},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===n.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;let c=await Ut(e,l.text);o.filePath=c,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(c)?o.importPath=K(e,o.filePath):(o.externalImportPath=l.text,o.importPath=o.externalImportPath),o.name=ye(e,o.filePath),o.importName=n.text,o.exportName="default",o.exportType="default"}else{let l=s.find(f=>!f.importClause||!f.importClause.namedBindings||!e.ts.isNamedImports(f.importClause.namedBindings)?!1:f.importClause.namedBindings.elements.some(h=>h.name.text===n.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await Ut(e,c.text);o.filePath=p,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=K(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=q(n.text),o.importName=n.text,o.exportName=n.text,o.exportType="named"}return o=ge(e,o,i),o.displayFilePath=j(e,o.filePath),o.filePath&&o.exportName&&(o.id=await z(e,o.filePath,o.exportName,o.externalImportPath)),o}function Ut(e,t){return un(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}function sa(e,t,r){let n=!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 f=p.expression;if(!e.ts.isPropertyAccessExpression(f))continue;let h=f.expression;if(!e.ts.isIdentifier(h)||h.text!=="builder")continue;if(f.name.text=="init"){n=!0;break}else continue}if(n)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(_e)),s=r?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 cc(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Ur(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:De(r)}}async function Ur(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};Ot(e,r)&&(n.acceptsChildren=!0);for(let a of r.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(M(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isCallExpression(u)&&(e.ts.isIdentifier(u.expression)&&u.expression.text)==="dynamic"){let h=u.arguments;if(h.length===0)return null;let D=h[0];if(!e.ts.isArrowFunction(D))return null;let d=D.body;if(e.ts.isCallExpression(d)){if(d.expression.kind!==e.ts.SyntaxKind.ImportKeyword||d.arguments.length!==1)return null;let m=d.arguments[0];if(!e.ts.isStringLiteral(m))return null;let E=m.text,x=await Ut(e,E);n.filePath=x,n.relFilePath=e.relative(e.getAppRootDir(),n.filePath),await e.exists(x)?n.importPath=K(e,n.filePath):(n.externalImportPath=E,n.importPath=n.externalImportPath),n.name=ye(e,n.filePath),n.importName="default",n.exportName="default",n.exportType="default"}else if(e.ts.isPropertyAccessExpression(d)){let g=d.expression;if(!e.ts.isParenthesizedExpression(g))return null;let m=g.expression;if(!e.ts.isAwaitExpression(m))return null;let E=m.expression;if(!e.ts.isCallExpression(E)||E.expression.kind!==e.ts.SyntaxKind.ImportKeyword||E.arguments.length!==1)return null;let v=E.arguments[0];if(!e.ts.isStringLiteral(v)||!e.ts.isIdentifier(d.name))return null;let S=v.text,y=await Ut(e,S);n.filePath=y,n.relFilePath=e.relative(e.getAppRootDir(),n.filePath),await e.exists(y)?n.importPath=K(e,n.filePath):(n.externalImportPath=S,n.importPath=n.externalImportPath),n.name=q(d.name.text),n.importName=d.name.text,n.exportName=d.name.text,n.exportType="named"}else return null;return n=ge(e,n,r),n.displayFilePath=j(e,n.filePath),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;n.name===""&&(n.name=q(s)),n.importName=s;let l=await je(e,e.registryPath,t,s);if(!l)continue;n.filePath=l.filePath,n.relFilePath=l.relFilePath,await e.exists(l.filePath)?n.importPath=K(e,l.filePath):(n.externalImportPath=l.importPath,n.importPath=n.externalImportPath),n.importPath=K(e,l.filePath),n.displayFilePath=l.displayFilePath,n.exportType=l.exportType;let c=t.statements.filter(f=>e.ts.isImportDeclaration(f)),p=c.find(f=>f.importClause&&f.importClause.name?.text===s);if(p){let f=p.moduleSpecifier;if(!e.ts.isStringLiteral(f))return null;n.exportName="default"}else{let f=c.find(D=>!D.importClause||!D.importClause.namedBindings||!e.ts.isNamedImports(D.importClause.namedBindings)?!1:D.importClause.namedBindings.elements.some(d=>d.name.text===s));if(!f)return null;let h=f.moduleSpecifier;if(!e.ts.isStringLiteral(h))return null;n.exportName=s}continue}}return n=ge(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}function Ke(e,t){let r=[...t.statements],n=!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 f=p.text;ua(e,t,f)||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);r[i]=c,n=!0}}else if(a.importClause.name&&e.ts.isIdentifier(a.importClause.name)){let u=a.importClause.name.text;ua(e,t,u)||(o=!0)}o&&(r.splice(i,1),n=!0)}}return n?e.ts.factory.updateSourceFile(t,r):t}function ua(e,t,r){let n=!1;function i(a){if(!e.ts.isImportDeclaration(a)){if(e.ts.isIdentifier(a)&&a.text===r){n=!0;return}e.ts.forEachChild(a,i)}}return e.ts.forEachChild(t,i),n}function ze(e,t,r,n,i,a,o){let s=null,u=null,l=null,c=-1;t=Ce(t),r=Ce(r);let p=t.find(h=>h.id===e),f=r.find(h=>h.id===e);if(n)f||(s={...Ce(p),inputs:Ce(p.inputs).map(h=>(h.isRegistered=!0,h))},c=r.length,r.push(s));else if(typeof f?.nodeIndex=="number"&&f.nodeIndex>-1){if(i)c=f.nodeIndex,u=Ce(f),r=r.filter(h=>h.id!==e);else if(a!=null)pc(f,a),c=f.nodeIndex,l=f;else if(o!=null){let h=f.inputs.find(D=>D.name===o.name);h&&(o.registerInput===!1?h.isRegistered=!1:(mc(h,o),h.isRegistered=!0),l=f,c=f.nodeIndex)}}return{addCmpToRegistry:s,removeCmpFromRegistry:u,updateRegisteredCmp:l,nodeIndex:c,components:Be(t,r)}}function Be(e,t){let r=De([...t.map(n=>(n.isRegistered=!0,n)),...e.filter(n=>!t.some(i=>i.id===n.id)).map(n=>(n.isRegistered=!1,n))]);return r.forEach(n=>{n.inputs=n.inputs.map($r),n.inputs.sort((o,s)=>o.name.toLowerCase().localeCompare(s.name.toLowerCase()));let i=t.find(o=>o.id===n.id);i&&(i.acceptsChildren=kr(n));let a=e.find(o=>o.id===n.id&&o.externalImportPath);a&&(n.filePath=a.filePath,n.relFilePath=a.relFilePath)}),r}function pc(e,t){fe(t.name)?e.name=t.name:t.name===null&&(e.name=e.importName),fe(t.description)?e.description=t.description:t.description===null&&delete e.description,fe(t.image)?e.image=t.image:t.image===null&&delete e.image}function mc(e,t){fe(t.type)&&(e.type=t.type),fe(t.friendlyName)?e.friendlyName=t.friendlyName:t.friendlyName===null&&delete e.friendlyName,fe(t.defaultValue)||Ht(t.defaultValue)||Tt(t.defaultValue)?e.defaultValue=t.defaultValue:t.defaultValue===null&&delete e.defaultValue,fe(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 lt(e){let t=new Set,r=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 r(s)}))};return await r(e.getAppRootDir()),await ee(e,[...t])}function qe(e,t,r){return _t(e,t,r.variableName)?t:fc(e,t,r)}function fc(e,t,r){let n=typeof r.arrayType=="string"?e.ts.factory.createArrayTypeNode(e.ts.factory.createTypeReferenceNode(r.arrayType,void 0)):void 0,i=e.ts.factory.createArrayLiteralExpression([]),a=e.ts.factory.createVariableDeclaration(r.variableName,void 0,n,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 We(e,t,r,n,i,a,o,s){let u=await lt(e),[l,c,p,f]=await Promise.all([ta(e,u),aa(e),xe(e),on(e)]),h=l.map(x=>x.cmpInfo),D=c.components,d={components:Be(h,D),registryPath:e.registryPath,registryDisplayPath:j(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Me(h),publicApiKey:f.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await Mt(e,d.components),d;let g=!1,m=c.sourceFile,E=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(E.length>0){let x=E.map(y=>{let B=l.find($=>$.cmpInfo.id===y);if(!B)throw new Error(`Component ${y} not found`);return B}),v=Array.from(new Set(x.map(y=>y.cmpInfo.filePath))),S=await ee(e,v);for(let y of x){let B=d.components.find(b=>b.id===y.cmpInfo.id),$=await Vt(e,y,S,e.registryPath===y.cmpInfo.filePath||he(y.cmpInfo.filePath));Fe(B,$);let _=h.findIndex(b=>b.id===y.cmpInfo.id);h[_].inputs=$;let w=ze(y.cmpInfo.id,h,D,r,n,i,a);if(e.sdkVersion===A.gen2){let{elements:b,elmIndex:pe,statementIndex:Pe,statement:ie,variableDeclaration:V}=await gc(e,m,y);if(w.addCmpToRegistry)b.push(Dc(e,w.addCmpToRegistry)),g=!0;else if(w.removeCmpFromRegistry)b.splice(pe,1),g=!0;else if(w.updateRegisteredCmp){let me=te(e,b[pe],w.updateRegisteredCmp);b[pe]=e.ts.factory.updateObjectLiteralExpression(me,[ca(e,w.updateRegisteredCmp),...me.properties.slice(1)]),g=!0}if(g&&o){let me=[...m.statements];me[Pe]=e.ts.factory.updateVariableStatement(ie,ie.modifiers,e.ts.factory.updateVariableDeclarationList(ie.declarationList,[e.ts.factory.updateVariableDeclaration(V,V.name,V.exclamationToken,V.type,e.ts.factory.createArrayLiteralExpression(Ue(e,b)))])),m=e.ts.factory.updateSourceFile(m,me),m=la(e,w,m),m=k(e,m,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),m=qe(e,m,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=w.components,D=w.components.filter(gt=>gt.isRegistered)}}else{let b=[...m.statements];w.addCmpToRegistry?(b.push(Ji(e,w.addCmpToRegistry)),g=!0):w.removeCmpFromRegistry?(b.splice(w.nodeIndex,1),g=!0):w.updateRegisteredCmp&&(b[w.nodeIndex]=Lr(e,b[w.nodeIndex],w.updateRegisteredCmp),g=!0),g&&o&&(m=e.ts.factory.updateSourceFile(m,b),m=k(e,m,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),m=sa(e,m,p),m=la(e,w,m),B?.acceptsChildren&&(m=k(e,m,{namedImports:["withChildren"],importPath:"@builder.io/react"})),d.components=w.components,D=w.components.filter(pe=>pe.isRegistered))}}}if(g&&o){m=Ke(e,m),m=Ve(e,m),e.appDir&&(m=ia(e,m));let x=ne(e,m);x=Ie(x),e.appDir&&(x=oa(x)),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return d}function ca(e,t){let r=e.ts.factory.createIdentifier(t.importName);return e.appDir?e.ts.factory.createPropertyAssignment("component",r):e.ts.factory.createPropertyAssignment("component",hc(e,t))}function dc(e){return e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())}function Dc(e,t){return te(e,e.ts.factory.createObjectLiteralExpression([ca(e,t),...t.acceptsChildren?[dc(e)]:[]],!0),t)}async function gc(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Ur(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}function la(e,t,r){if(e.appDir){let n=t.addCmpToRegistry||t.updateRegisteredCmp;if(n){let i=n.externalImportPath?n.externalImportPath:L(e,e.registryPath,n.filePath);n.exportType==="default"?r=k(e,r,{defaultImport:n.importName,importPath:i}):n.exportType==="named"&&(r=k(e,r,{namedImports:[n.importName],importPath:i}))}}else r=k(e,r,{defaultImport:"dynamic",importPath:"next/dynamic"});return r}function hc(e,t){let r=t.externalImportPath?t.externalImportPath:L(e,e.registryPath,t.filePath),n=t.exportName!=="default",i;n?i=e.ts.factory.createPropertyAccessExpression(e.ts.factory.createAwaitExpression(e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(r)])),e.ts.factory.createIdentifier(t.exportName)):i=e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(r)]);let a=e.ts.factory.createArrowFunction(n?[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 ma(e){let t=[],r=await yc(e,t);return await ha(e,t,r),e.appDir?(e.debug(`ensure builder setup for next.js app ${e.appDir}`),await xc(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure builder setup for next.js pages ${e.pagesDir}`),await Ec(e,e.pagesDir,t)),t}async function fa(e){let t=[];return await ha(e,t),e.appDir?(e.debug(`ensure figma-imports setup for next.js app ${e.appDir}`),await Cc(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure figma-imports setup for next.js pages ${e.pagesDir}`),await Fc(e,e.pagesDir,t)),t}async function Cc(e,t,r){let n=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"figma-imports",n);if(!await e.exists(i)){let a=await e.formatCode(i,Da({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,da(e));await e.writeFile(e.builderComponentPath,a),r.push({filePath:e.builderComponentPath,modifiedType:"create"})}}async function xc(e,t,r){let n=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"[...page]",n);if(!await e.exists(i)){let a=await e.formatCode(i,Da({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,da(e));await e.writeFile(e.builderComponentPath,a),r.push({filePath:e.builderComponentPath,modifiedType:"create"})}}function da(e){let t=e.typescriptEnabled;return e.sdkVersion===A.gen2?`
301
305
  "use client";
302
306
  import { ${t?"BuilderContent, ":""} isPreviewing, Content } from "@builder.io/sdk-react";
303
307
  import DefaultErrorPage from "next/error";
@@ -309,7 +313,7 @@ interface BuilderPageProps {
309
313
  }`:""}
310
314
 
311
315
  // Builder Public API Key set in .env file
312
- const builderApiKey = process.env.${$e}${t?"!":""};
316
+ const builderApiKey = process.env.${_e}${t?"!":""};
313
317
 
314
318
  export function RenderBuilderContent({ content, model }${t?": BuilderPageProps":""}) {
315
319
  // Call the isPreviewing hook to determine if
@@ -340,7 +344,7 @@ ${t?`
340
344
  type BuilderPageProps = ComponentProps<typeof BuilderComponent>;`:""}
341
345
 
342
346
  // Builder Public API Key set in .env file
343
- builder.init(process.env.${$e}${t?"!":""});
347
+ builder.init(process.env.${_e}${t?"!":""});
344
348
 
345
349
  export function RenderBuilderContent({ content, model }${t?": BuilderPageProps":""}) {
346
350
  // Call the useIsPreviewing hook to determine if
@@ -356,7 +360,7 @@ export function RenderBuilderContent({ content, model }${t?": BuilderPageProps":
356
360
  // DefaultErrorPage with a 404.
357
361
  return <DefaultErrorPage statusCode={404} />;
358
362
  }
359
- `.trimStart()}function Ca(e){return e.features.asyncParams?`
363
+ `.trimStart()}function pa(e){return e.features.asyncParams?`
360
364
  interface PageProps {
361
365
  params: Promise<{
362
366
  page: string[];
@@ -366,14 +370,14 @@ interface PageProps {
366
370
  params: {
367
371
  page: string[];
368
372
  };
369
- }`}function ya({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled,i=L(e,t,e.builderComponentPath);return e.sdkVersion===b.gen2?`
373
+ }`}function Da({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled,i=L(e,t,e.builderComponentPath);return e.sdkVersion===A.gen2?`
370
374
  import { fetchOneEntry } from "@builder.io/sdk-react";
371
375
  import { RenderBuilderContent } from ${JSON.stringify(i)};
372
376
 
373
377
  // Builder Public API Key set in .env file
374
- const PUBLIC_API_KEY = process.env.${$e}${n?"!":""};
378
+ const PUBLIC_API_KEY = process.env.${_e}${n?"!":""};
375
379
 
376
- ${n?Ca(e):""}
380
+ ${n?pa(e):""}
377
381
 
378
382
  export default async function Page(props${n?": PageProps":""}) {
379
383
  const builderModelName = "${r}";
@@ -400,8 +404,8 @@ import { builder } from "@builder.io/sdk";
400
404
  import { RenderBuilderContent } from ${JSON.stringify(i)};
401
405
 
402
406
  // Builder Public API Key set in .env file
403
- builder.init(process.env.${$e}${n?"!":""});
404
- ${n?Ca(e):""}
407
+ builder.init(process.env.${_e}${n?"!":""});
408
+ ${n?pa(e):""}
405
409
 
406
410
  export default async function Page(props${n?": PageProps":""}) {
407
411
  const builderModelName = "${r}";
@@ -424,7 +428,7 @@ export default async function Page(props${n?": PageProps":""}) {
424
428
  </>
425
429
  );
426
430
  }
427
- `.trimStart()}async function Pc(e,t,r){let n=`[...page].${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,n);if(!await e.exists(i)){let a=await e.formatCode(i,Sa({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}}async function Tc(e,t,r){let n=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,n);if(!await e.exists(i)){let a=await e.formatCode(i,Sa({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}}function Sa({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled;return e.sdkVersion===b.gen2?`
431
+ `.trimStart()}async function Ec(e,t,r){let n=`[...page].${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,n);if(!await e.exists(i)){let a=await e.formatCode(i,ga({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}}async function Fc(e,t,r){let n=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,n);if(!await e.exists(i)){let a=await e.formatCode(i,ga({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}}function ga({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled;return e.sdkVersion===A.gen2?`
428
432
  import React from "react";
429
433
  import { useRouter } from "next/router";
430
434
  ${n?'import type { BuilderContent } from "@builder.io/sdk-react";':""}
@@ -439,7 +443,7 @@ import Head from "next/head";
439
443
  ${n?'import { GetStaticProps } from "next";':""}
440
444
  import { CUSTOM_COMPONENTS } from ${JSON.stringify(L(e,e.builderComponentPath,e.registryPath))};
441
445
 
442
- const BUILDER_API_KEY = process.env.${$e}${n?"!":""};
446
+ const BUILDER_API_KEY = process.env.${_e}${n?"!":""};
443
447
 
444
448
  // Define a function that fetches the Builder
445
449
  // content for a given page
@@ -523,7 +527,7 @@ import { BuilderContent } from "@builder.io/sdk";`:""}${n?`
523
527
  import { GetStaticProps } from "next";`:""}
524
528
  import ${JSON.stringify(L(e,t,e.registryPath))};
525
529
 
526
- builder.init(process.env.${$e}${n?"!":""});
530
+ builder.init(process.env.${_e}${n?"!":""});
527
531
 
528
532
  // Define a function that fetches the Builder
529
533
  // content for a given page
@@ -588,7 +592,7 @@ export default function Page({ page }${n?": { page: BuilderContent | null }":""}
588
592
  </>
589
593
  );
590
594
  }
591
- `.trimStart()}async function Ic(e,t){let n=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${n}`),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,r=`
595
+ `.trimStart()}async function yc(e,t){let n=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${n}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=Sc(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 Sc(e){let t=e.typescriptEnabled,r=`
592
596
  "use client"
593
597
  import React, { useState } from "react";
594
598
  import styles from "./styles.module.css";
@@ -651,19 +655,19 @@ export default Counter;
651
655
  font-size: 42px;
652
656
  text-align: center;
653
657
  }
654
- `.trimStart();return{component:r,styles:n}}async function va(e,t,r){if(!await e.exists(e.registryPath)){if(e.sdkVersion===b.gen2){let a=Rc(e);await e.writeFile(e.registryPath,a)}else await e.writeFile(e.registryPath,"");t.push({filePath:e.registryPath,modifiedType:"create"})}if(!r)return;let i=(await Ke(e,null,!1,!1,null,null,!1,!1)).components.find(a=>a.filePath===r);i&&await Ke(e,i.id,!0,!1,null,null,!0,!1)}function Rc(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-react";
658
+ `.trimStart();return{component:r,styles:n}}async function ha(e,t,r){if(!await e.exists(e.registryPath)){if(e.sdkVersion===A.gen2){let a=vc(e);await e.writeFile(e.registryPath,a)}else await e.writeFile(e.registryPath,"");t.push({filePath:e.registryPath,modifiedType:"create"})}if(!r)return;let i=(await We(e,null,!1,!1,null,null,!1,!1)).components.find(a=>a.filePath===r);i&&await We(e,i.id,!0,!1,null,null,!0,!1)}function vc(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-react";
655
659
 
656
660
  export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
657
661
  ];`:`export const CUSTOM_COMPONENTS = [
658
662
  ];
659
- `}async function Ut(e){let t=await Ht(e,e.getRepoRootDir());if(t&&typeof t=="object"){let r=new Set(Object.keys({...t.dependencies,...t.devDependencies}));if(r.has("@builder.io/sdk-react"))return b.gen2;if(r.has("@builder.io/react"))return b.gen1}return null}async function wa(e){let t=await Nc(e);return{builderPageOptions:async()=>({templateContentId:"3de2f13211234071a4b19a17b4fbc5a7",pathname:"/builder-demo",title:"Builder + Next.js Demo Page"}),ensureBuilderSetup:()=>xa(t),ensureFigmaImportPage:()=>Ea(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>Ke(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await Ke(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>Ke(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>Ke(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>Ke(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>Ke(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>nn(t),setPublicApiKey:n=>Hi(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===b.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:()=>Ne(t),setCache:n=>ke(t,n)}}async function Nc(e){let t=e.getAppRootDir(),r=e.join(t,"src"),n=await kc(e),i=await he(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:n,typescriptEnabled:i,features:o};if(e.sdkVersion?u.sdkVersion=e.sdkVersion:u.sdkVersion=await Ut(u),await e.exists(r)){u.srcDir=r,u.componentsDir=e.join(r,"components");let l=e.join(r,"app");await e.exists(l)&&(u.appDir=l);let c=e.join(r,"pages");await e.exists(c)&&(u.pagesDir=c),u.registryPath=await Fe(e,r)}else u.componentsDir=e.join(t,"components"),u.registryPath=await Fe(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 kc(e){let t=e.join(e.getAppRootDir(),"next.config.ts");if(await e.exists(t))return t;let r=e.join(e.getAppRootDir(),"next.config.mjs");if(await e.exists(r))return r;let n=e.join(e.getAppRootDir(),"next.config.js");if(await e.exists(n))return n;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 sn(e){return await it(e,[".env"],ba)}async function Aa(e,t){$c(t);let r=await sn(e),n=await at(e,r.file,r.envKey,t);return{...r,modifiedType:n}}function $c(e){typeof process<"u"&&(process.env[ba]=e)}var ba="PUBLIC_BUILDER_API_KEY";function Pa(e,t,r){if(r.length===0)return e;let n=e.split(`
663
+ `}async function Kt(e){let t=await Qt(e,e.getRepoRootDir());if(t&&typeof t=="object"){let r=new Set(Object.keys({...t.dependencies,...t.devDependencies}));if(r.has("@builder.io/sdk-react"))return A.gen2;if(r.has("@builder.io/react"))return A.gen1}return null}async function Ca(e){let t=await wc(e);return{builderPageOptions:async()=>({templateContentId:"3de2f13211234071a4b19a17b4fbc5a7",pathname:"/builder-demo",title:"Builder + Next.js Demo Page"}),ensureBuilderSetup:()=>ma(t),ensureFigmaImportPage:()=>fa(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>We(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await We(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>We(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>We(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>We(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>We(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>on(t),setPublicApiKey:n=>Vi(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===A.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:()=>Le(t),setCache:n=>Oe(t,n)}}async function wc(e){let t=e.getAppRootDir(),r=e.join(t,"src"),n=await bc(e),i=await xe(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:n,typescriptEnabled:i,features:o};if(e.sdkVersion?u.sdkVersion=e.sdkVersion:u.sdkVersion=await Kt(u),await e.exists(r)){u.srcDir=r,u.componentsDir=e.join(r,"components");let l=e.join(r,"app");await e.exists(l)&&(u.appDir=l);let c=e.join(r,"pages");await e.exists(c)&&(u.pagesDir=c),u.registryPath=await Se(e,r)}else u.componentsDir=e.join(t,"components"),u.registryPath=await Se(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&&!e.ignoreMissingConfig)throw new Error(`Could not find Next.js "app" or "pages" directory. Searched in "${t}".`);return u}async function bc(e){let t=e.join(e.getAppRootDir(),"next.config.ts");if(await e.exists(t))return t;let r=e.join(e.getAppRootDir(),"next.config.mjs");if(await e.exists(r))return r;let n=e.join(e.getAppRootDir(),"next.config.js");if(await e.exists(n))return n;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 ln(e){return await at(e,[".env"],Ea)}async function xa(e,t){Ac(t);let r=await ln(e),n=await st(e,r.file,r.envKey,t);return{...r,modifiedType:n}}function Ac(e){typeof process<"u"&&(process.env[Ea]=e)}var Ea="PUBLIC_BUILDER_API_KEY";function Fa(e,t,r){if(r.length===0)return e;let n=e.split(`
660
664
  `),i=n.findIndex(s=>s.includes(r));if(i===-1||n.some(s=>s.includes(t[0])))return e;let o=["/**",...t.map(s=>` * ${s.trim()}`)," */"];return n.splice(i,0,...o),n.join(`
661
- `)}async function Ia(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(o.startsWith(".")||_c.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await Mn(e,i,s,a);r.push(...u)})),r}async function Ba(e,t){if(e.extname(t).toLowerCase()===".tsx"){let n=await e.readFile(t);if(n)return Lc(e,t,n)}return null}function Lc(e,t,r){let n=N(e,r);return Mn(e,null,t,n)}async function Mn(e,t,r,n){r=e.normalize(r);let i=[],a=Ft(e,n);return await Promise.all(a.map(async o=>{let s=await Oc(e,t,r,o);s&&i.push(s)})),i}async function Oc(e,t,r,n){let i=e.relative(e.getAppRootDir(),r),a=K(e,r);if(e.ts.isVariableStatement(n.node))for(let o of n.node.declarationList.declarations){let s=Ta(e,o.initializer);if(s&&e.ts.isIdentifier(o.name)){let u=o.name.text;return{cmpInfo:{id:await z(e,r,u),displayFilePath:M(e,r),name:q(u),inputs:[],exportName:n.isDefaultExport?"default":u,exportType:n.isDefaultExport?"default":"named",importName:u,filePath:r,relFilePath:i,importPath:a,framework:"qwik"},node:s}}}else if(e.ts.isCallExpression(n.node)){let o=Ta(e,n.node);if(o)return{cmpInfo:{id:await z(e,r,"default"),displayFilePath:M(e,r),name:Ee(e,r),inputs:[],exportName:"default",exportType:"default",importName:Ct(e,r),filePath:r,relFilePath:i,importPath:a,framework:"qwik"},node:o}}return null}function Ta(e,t){if(t&&e.ts.isCallExpression(t)&&e.ts.isIdentifier(t.expression)&&t.expression.text==="component$"&&t.arguments.length>0){let r=t.arguments[0];if(e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r))return{callExpression:t,fnNode:r}}return null}var _c=new Set(["node_modules","layout.tsx","404.tsx","router-head.tsx"]);async function Ra(e,t){let r=t.node.fnNode;if((e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r))&&r.parameters.length>0){let{sourceFile:i,typeChecker:a}=await It(e,t.cmpInfo.filePath,null);if(!(await Mn(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 Et(e,a,r)}return[]}async function Na(e){return Jr(e)}async function Jr(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Mc),t.push({filePath:e.registryPath,modifiedType:"create"})),t}var Mc=`import type { RegisteredComponent } from "@builder.io/sdk-qwik";
665
+ `)}async function Sa(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(o.startsWith(".")||Ic.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await jn(e,i,s,a);r.push(...u)})),r}async function va(e,t){if(e.extname(t).toLowerCase()===".tsx"){let n=await e.readFile(t);if(n)return Pc(e,t,n)}return null}function Pc(e,t,r){let n=N(e,r);return jn(e,null,t,n)}async function jn(e,t,r,n){r=e.normalize(r);let i=[],a=yt(e,n);return await Promise.all(a.map(async o=>{let s=await Tc(e,t,r,o);s&&i.push(s)})),i}async function Tc(e,t,r,n){let i=e.relative(e.getAppRootDir(),r),a=K(e,r);if(e.ts.isVariableStatement(n.node))for(let o of n.node.declarationList.declarations){let s=ya(e,o.initializer);if(s&&e.ts.isIdentifier(o.name)){let u=o.name.text;return{cmpInfo:{id:await z(e,r,u),displayFilePath:j(e,r),name:q(u),inputs:[],exportName:n.isDefaultExport?"default":u,exportType:n.isDefaultExport?"default":"named",importName:u,filePath:r,relFilePath:i,importPath:a,framework:"qwik"},node:s}}}else if(e.ts.isCallExpression(n.node)){let o=ya(e,n.node);if(o)return{cmpInfo:{id:await z(e,r,"default"),displayFilePath:j(e,r),name:ye(e,r),inputs:[],exportName:"default",exportType:"default",importName:xt(e,r),filePath:r,relFilePath:i,importPath:a,framework:"qwik"},node:o}}return null}function ya(e,t){if(t&&e.ts.isCallExpression(t)&&e.ts.isIdentifier(t.expression)&&t.expression.text==="component$"&&t.arguments.length>0){let r=t.arguments[0];if(e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r))return{callExpression:t,fnNode:r}}return null}var Ic=new Set(["node_modules","layout.tsx","404.tsx","router-head.tsx"]);async function wa(e,t){let r=t.node.fnNode;if((e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r))&&r.parameters.length>0){let{sourceFile:i,typeChecker:a}=await Bt(e,t.cmpInfo.filePath,null);if(!(await jn(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 Ft(e,a,r)}return[]}async function ba(e){return Kr(e)}async function Kr(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Bc),t.push({filePath:e.registryPath,modifiedType:"create"})),t}var Bc=`import type { RegisteredComponent } from "@builder.io/sdk-qwik";
662
666
 
663
667
  export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
664
668
  ];
665
- `;async function ka(e){await Jr(e);let t=await e.readFile(e.registryPath);return t?jc(e,t):{components:[],sourceFile:N(e,"")}}async function jc(e,t){let r=N(e,t);return Vc(e,r)}async function Vc(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Hr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:me(r)}}async function Hr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],framework:"qwik"};for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(e,i)==="component"&&e.ts.isIdentifier(i.initializer)){let o=i.initializer.text;n.name===""&&(n.name=q(o)),n.importName=o;let s=await Le(e,e.registryPath,t,o);if(!s)continue;n.filePath=s.filePath,n.relFilePath=s.relFilePath,n.importPath=K(e,s.filePath),n.displayFilePath=s.displayFilePath,n.exportType=s.exportType;let u=await Ba(e,s.filePath);if(u&&u.length>0)if(u.length===1)n.exportName=u[0].cmpInfo.exportName;else{let l=u.find(c=>c.cmpInfo.exportName===o);l&&(n.exportName=l.cmpInfo.exportName)}continue}}return n=fe(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName)),n}async function $a(e){let t=new Set,r=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 r(s)}))};return await r(e.getAppRootDir()),await ee(e,[...t])}async function yt(e,t,r,n,i,a,o,s){let u=await $a(e),[l,c,p]=await Promise.all([Ia(e,u),ka(e),sn(e)]),f=l.map(d=>d.cmpInfo),h=c.components,D={components:be(f,h),registryPath:e.registryPath,registryDisplayPath:M(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Oe(f),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return D;if(t!=null){let d=l.find(w=>w.cmpInfo.id===t);if(!d)throw new Error(`Component ${t} not found`);let g=c.sourceFile,m=D.components.find(w=>w.id===t),E=await Ra(e,d);xe(m,E),t=Array.isArray(t)?t[0]:t;let x=Ve(t,f,h,r,n,i,a),{elements:v,elmIndex:S,statementIndex:y,statement:B,variableDeclaration:$}=await Kc(e,g,d),_=!1;if(x.addCmpToRegistry?(v.push(Uc(e,x.addCmpToRegistry)),_=!0):x.removeCmpFromRegistry?(v.splice(S,1),_=!0):x.updateRegisteredCmp&&(v[S]=te(e,v[S],x.updateRegisteredCmp),_=!0),_&&o){let w=[...g.statements];w[y]=e.ts.factory.updateVariableStatement(B,B.modifiers,e.ts.factory.updateVariableDeclarationList(B.declarationList,[e.ts.factory.updateVariableDeclaration($,$.name,$.exclamationToken,$.type,e.ts.factory.createArrayLiteralExpression(Me(e,v)))])),g=e.ts.factory.updateSourceFile(g,w),m.exportType==="named"?g=k(e,g,{namedImports:[m.importName],importPath:L(e,e.registryPath,m.filePath)}):g=k(e,g,{defaultImport:m.importName,importPath:L(e,e.registryPath,m.filePath)}),g=k(e,g,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-qwik",isTypeOnly:!0}),g=Ue(e,g,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),g=je(e,g),g=_e(e,g);let A=ne(e,g);A=Ae(A),A=Pa(A,zc,"CUSTOM_COMPONENTS"),A=await e.formatCode(e.registryPath,A),await e.writeFile(e.registryPath,A)}D.components=x.components}return D}function Uc(e,t){return te(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName))],!0),t)}async function Kc(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Hr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}var zc=["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 La(e){let t=await qc(e);return{builderPageOptions:async()=>({templateContentId:"dc70f1d979ad416d8fd357137eb9ddfb",pathname:"/",title:"Builder + Qwik Demo Page"}),ensureBuilderSetup:()=>Na(t),ensureFigmaImportPage:async()=>[],getRegistryPath:()=>t.registryPath,getRegistry:n=>yt(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:async n=>{},loadComponent:async n=>{let i=await yt(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>yt(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>yt(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>yt(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>yt(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>sn(t),setPublicApiKey:n=>Aa(t,n.publicApiKey),getDependencies:n=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-qwik"}],getDevRunCommand:()=>"dev",getCache:()=>Ne(t),setCache:n=>ke(t,n)}}async function qc(e){let t=await Gt(e,e.getAppRootDir(),"components");if(!t)throw new Error(`Could not find components directory within project: ${e.getAppRootDir()}`);let r=await Fe(e,t),n=e.join(e.getAppRootDir(),".env");return{...e,componentsDir:t,registryPath:r,envPath:n}}async function un(e){return await it(e,[".env"],ln)}async function Oa(e,t){let r=await un(e),n=await at(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var ln="PUBLIC_BUILDER_KEY";var Wc=new Set(["dist","node_modules"]);async function _a(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker(),a=e.join(e.getAppRootDir(),"build");return await Promise.all(n.map(async o=>{let s=e.basename(o.fileName);if(s.startsWith(".")||s==="node_modules"||Pn(e,Wc,o.fileName)||Jc.has(s)||s.includes("$."))return;let u=e.normalize(o.fileName);if(u===e.remixConfigPath||u===a)return;let l=await st(e,i,u,o,u===e.registryPath);r.push(...l)})),r}var Jc=new Set(["root.tsx","root.ts","root.jsx","root.js","_index.tsx","_index.jsx","_index.ts","_index.js"]);async function Ma(e){await jn(e);let t=await e.readFile(e.registryPath);return t?Hc(e,t):{components:[],sourceFile:N(e,"")}}async function Hc(e,t){let r=N(e,t);return Gc(e,r)}async function Gc(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Gr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:me(r)}}async function Gr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};e.sdkVersion===b.gen2&&Lt(e,r)&&(n.acceptsChildren=!0);for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(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"&&(n.acceptsChildren=!0);let c=s.arguments[0];e.ts.isIdentifier(c)&&(o=c.text)}if(!o)continue;n.name===""&&(n.name=q(o)),n.importName=o;let u=await Le(e,e.registryPath,t,o);if(!u)continue;if(n.filePath=u.filePath,n.relFilePath=u.relFilePath,await e.exists(u.filePath)?n.importPath=K(e,u.filePath):(n.externalImportPath=u.importPath,n.importPath=n.externalImportPath),n.displayFilePath=u.displayFilePath,n.exportType=u.exportType,n.externalImportPath)n.exportName=o;else{let l=await ia(e,u.filePath,e.registryPath===u.filePath||De(u.filePath));if(l&&l.length>0)if(l.length===1)n.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(n.exportName=c.cmpInfo.exportName)}}continue}}return n=fe(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}async function ze(e,t,r,n,i,a,o,s){let u=await ut(e),[l,c,p]=await Promise.all([_a(e,u),Ma(e),un(e)]),f=l.map(E=>E.cmpInfo),h=c.components,D={components:be(f,h),registryPath:e.registryPath,registryDisplayPath:M(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Oe(f),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return D.components=await Mt(e,D.components),D;let d=!1,g=c.sourceFile,m=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(m.length>0){let E=m.map(S=>{let y=l.find(B=>B.cmpInfo.id===S);if(!y)throw new Error(`Component ${S} not found`);return y}),x=Array.from(new Set(E.map(S=>S.cmpInfo.filePath))),v=await ee(e,x);for(let S of E){let y=D.components.find(V=>V.id===S.cmpInfo.id),B=await jt(e,S,v,e.registryPath===S.cmpInfo.filePath||De(S.cmpInfo.filePath));xe(y,B);let $=f.findIndex(V=>V.id===S.cmpInfo.id);f[$].inputs=B;let _=Ve(S.cmpInfo.id,f,h,r,n,i,a),{elements:w,elmIndex:A,statementIndex:ue,statement:ve,variableDeclaration:ie}=await Yc(e,g,S);if(_.addCmpToRegistry)w.push(Qc(e,_.addCmpToRegistry)),d=!0;else if(_.removeCmpFromRegistry)w.splice(A,1),d=!0;else if(_.updateRegisteredCmp){let V=te(e,w[A],_.updateRegisteredCmp);w[A]=e.ts.factory.updateObjectLiteralExpression(V,[ja(e,_.updateRegisteredCmp),...V.properties.slice(1)]),d=!0}if(d&&o){let V=[...g.statements];V[ue]=e.ts.factory.updateVariableStatement(ve,ve.modifiers,e.ts.factory.updateVariableDeclarationList(ve.declarationList,[e.ts.factory.updateVariableDeclaration(ie,ie.name,ie.exclamationToken,ie.type,e.ts.factory.createArrayLiteralExpression(Me(e,w)))])),g=e.ts.factory.updateSourceFile(g,V),y.exportType==="named"?g=k(e,g,{namedImports:[y.importName],importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}):g=k(e,g,{defaultImport:y.importName,importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)});let le=e.sdkVersion===b.gen2?"@builder.io/sdk-react":"@builder.io/react";g=k(e,g,{namedImports:["RegisteredComponent"],importPath:le,isTypeOnly:!0}),y.acceptsChildren&&e.sdkVersion!==b.gen2&&(g=k(e,g,{namedImports:["withChildren"],importPath:"@builder.io/react"})),g=Ue(e,g,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),D.components=_.components,h=_.components.filter(Dt=>Dt.isRegistered)}}}if(d&&o){g=je(e,g),g=_e(e,g);let E=ne(e,g);E=Ae(E),E=await e.formatCode(e.registryPath,E),await e.writeFile(e.registryPath,E)}return D}function ja(e,t){if(e.sdkVersion===b.gen2)return e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName));let r=e.ts.factory.createIdentifier(t.importName),n=t.acceptsChildren?e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("withChildren"),void 0,[r]):r;return e.ts.factory.createPropertyAssignment("component",n)}function Qc(e,t){return te(e,e.ts.factory.createObjectLiteralExpression([ja(e,t),...t.acceptsChildren&&e.sdkVersion===b.gen2?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}async function Yc(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Gr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}async function Va(e){let t=[],r=await ep(e,t);return t.push(...await jn(e)),await np(e,r),await Zc(e,t),t}async function Ua(e){let t=[];return t.push(...await jn(e)),await Xc(e,t),t}async function Xc(e,t){let r=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureFigmaImportRoute, hasLocaleParam"),r=`($locale).${r}`);let n=e.join(e.routesDir,r),i=await e.exists(n);e.debug(`remixEnsureFigmaImportRoute, hasRoute: ${i}`);let a=await e.formatCode(n,Ka({sys:e,routePath:n,modelName:"figma-imports"}));await e.writeFile(n,a),t.push({filePath:n,modifiedType:i?"update":"create"})}async function Zc(e,t){let r=`$.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureAppRoute, hasLocaleParam"),r=`($locale).${r}`),e.sdkVersion===b.gen2&&(r=`($slug)._index.${e.typescriptEnabled?"tsx":"jsx"}`);let n=e.join(e.routesDir,r),i=await e.exists(n);e.debug(`remixEnsureAppRoute, hasRoute: ${i}`);let a=await e.formatCode(n,Ka({sys:e,routePath:n,modelName:"page"}));await e.writeFile(n,a),t.push({filePath:n,modifiedType:i?"update":"create"})}function Ka({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled,i=L(e,t,e.registryPath),a="",o="";n&&(a="import type { LoaderArgs } from '@remix-run/server-runtime';",o=": LoaderArgs");let s=`process.env.${ln}`;return e.getFrameworks().some(u=>u.name==="@shopify/remix-oxygen")&&(s=`context.env.${ln}`),n&&(s+="!"),e.sdkVersion===b.gen2?`
666
-
669
+ `;async function Aa(e){await Kr(e);let t=await e.readFile(e.registryPath);return t?Rc(e,t):{components:[],sourceFile:N(e,"")}}async function Rc(e,t){let r=N(e,t);return Nc(e,r)}async function Nc(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await zr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:De(r)}}async function zr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],framework:"qwik"};for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(M(e,i)==="component"&&e.ts.isIdentifier(i.initializer)){let o=i.initializer.text;n.name===""&&(n.name=q(o)),n.importName=o;let s=await je(e,e.registryPath,t,o);if(!s)continue;n.filePath=s.filePath,n.relFilePath=s.relFilePath,n.importPath=K(e,s.filePath),n.displayFilePath=s.displayFilePath,n.exportType=s.exportType;let u=await va(e,s.filePath);if(u&&u.length>0)if(u.length===1)n.exportName=u[0].cmpInfo.exportName;else{let l=u.find(c=>c.cmpInfo.exportName===o);l&&(n.exportName=l.cmpInfo.exportName)}continue}}return n=ge(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName)),n}async function Pa(e){let t=new Set,r=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 r(s)}))};return await r(e.getAppRootDir()),await ee(e,[...t])}async function St(e,t,r,n,i,a,o,s){let u=await Pa(e),[l,c,p]=await Promise.all([Sa(e,u),Aa(e),ln(e)]),f=l.map(d=>d.cmpInfo),h=c.components,D={components:Be(f,h),registryPath:e.registryPath,registryDisplayPath:j(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Me(f),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return D;if(t!=null){let d=l.find(w=>w.cmpInfo.id===t);if(!d)throw new Error(`Component ${t} not found`);let g=c.sourceFile,m=D.components.find(w=>w.id===t),E=await wa(e,d);Fe(m,E),t=Array.isArray(t)?t[0]:t;let x=ze(t,f,h,r,n,i,a),{elements:v,elmIndex:S,statementIndex:y,statement:B,variableDeclaration:$}=await $c(e,g,d),_=!1;if(x.addCmpToRegistry?(v.push(kc(e,x.addCmpToRegistry)),_=!0):x.removeCmpFromRegistry?(v.splice(S,1),_=!0):x.updateRegisteredCmp&&(v[S]=te(e,v[S],x.updateRegisteredCmp),_=!0),_&&o){let w=[...g.statements];w[y]=e.ts.factory.updateVariableStatement(B,B.modifiers,e.ts.factory.updateVariableDeclarationList(B.declarationList,[e.ts.factory.updateVariableDeclaration($,$.name,$.exclamationToken,$.type,e.ts.factory.createArrayLiteralExpression(Ue(e,v)))])),g=e.ts.factory.updateSourceFile(g,w),m.exportType==="named"?g=k(e,g,{namedImports:[m.importName],importPath:L(e,e.registryPath,m.filePath)}):g=k(e,g,{defaultImport:m.importName,importPath:L(e,e.registryPath,m.filePath)}),g=k(e,g,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-qwik",isTypeOnly:!0}),g=qe(e,g,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),g=Ke(e,g),g=Ve(e,g);let b=ne(e,g);b=Ie(b),b=Fa(b,Lc,"CUSTOM_COMPONENTS"),b=await e.formatCode(e.registryPath,b),await e.writeFile(e.registryPath,b)}D.components=x.components}return D}function kc(e,t){return te(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName))],!0),t)}async function $c(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await zr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}var Lc=["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 Ta(e){let t=await Oc(e);return{builderPageOptions:async()=>({templateContentId:"dc70f1d979ad416d8fd357137eb9ddfb",pathname:"/",title:"Builder + Qwik Demo Page"}),ensureBuilderSetup:()=>ba(t),ensureFigmaImportPage:async()=>[],getRegistryPath:()=>t.registryPath,getRegistry:n=>St(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:async n=>{},loadComponent:async n=>{let i=await St(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>St(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>St(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>St(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>St(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>ln(t),setPublicApiKey:n=>xa(t,n.publicApiKey),getDependencies:n=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-qwik"}],getDevRunCommand:()=>"dev",getCache:()=>Le(t),setCache:n=>Oe(t,n)}}async function Oc(e){let t=await Yt(e,e.getAppRootDir(),"components");if(!t)throw new Error(`Could not find components directory within project: ${e.getAppRootDir()}`);let r=await Se(e,t),n=e.join(e.getAppRootDir(),".env");return{...e,componentsDir:t,registryPath:r,envPath:n}}async function cn(e){return await at(e,[".env"],pn)}async function Ia(e,t){let r=await cn(e),n=await st(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var pn="PUBLIC_BUILDER_KEY";var _c=new Set(["dist","node_modules"]);async function Ba(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker(),a=e.join(e.getAppRootDir(),"build");return await Promise.all(n.map(async o=>{let s=e.basename(o.fileName);if(s.startsWith(".")||s==="node_modules"||Pn(e,_c,o.fileName)||jc.has(s)||s.includes("$."))return;let u=e.normalize(o.fileName);if(u===e.remixConfigPath||u===a)return;let l=await ut(e,i,u,o,u===e.registryPath);r.push(...l)})),r}var jc=new Set(["root.tsx","root.ts","root.jsx","root.js","_index.tsx","_index.jsx","_index.ts","_index.js"]);async function Ra(e){await Mn(e);let t=await e.readFile(e.registryPath);return t?Mc(e,t):{components:[],sourceFile:N(e,"")}}async function Mc(e,t){let r=N(e,t);return Vc(e,r)}async function Vc(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await qr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:De(r)}}async function qr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};e.sdkVersion===A.gen2&&Ot(e,r)&&(n.acceptsChildren=!0);for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(M(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"&&(n.acceptsChildren=!0);let c=s.arguments[0];e.ts.isIdentifier(c)&&(o=c.text)}if(!o)continue;n.name===""&&(n.name=q(o)),n.importName=o;let u=await je(e,e.registryPath,t,o);if(!u)continue;if(n.filePath=u.filePath,n.relFilePath=u.relFilePath,await e.exists(u.filePath)?n.importPath=K(e,u.filePath):(n.externalImportPath=u.importPath,n.importPath=n.externalImportPath),n.displayFilePath=u.displayFilePath,n.exportType=u.exportType,n.externalImportPath)n.exportName=o;else{let l=await Xi(e,u.filePath,e.registryPath===u.filePath||he(u.filePath));if(l&&l.length>0)if(l.length===1)n.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(n.exportName=c.cmpInfo.exportName)}}continue}}return n=ge(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}async function Je(e,t,r,n,i,a,o,s){let u=await lt(e),[l,c,p]=await Promise.all([Ba(e,u),Ra(e),cn(e)]),f=l.map(E=>E.cmpInfo),h=c.components,D={components:Be(f,h),registryPath:e.registryPath,registryDisplayPath:j(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Me(f),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return D.components=await Mt(e,D.components),D;let d=!1,g=c.sourceFile,m=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(m.length>0){let E=m.map(S=>{let y=l.find(B=>B.cmpInfo.id===S);if(!y)throw new Error(`Component ${S} not found`);return y}),x=Array.from(new Set(E.map(S=>S.cmpInfo.filePath))),v=await ee(e,x);for(let S of E){let y=D.components.find(V=>V.id===S.cmpInfo.id),B=await Vt(e,S,v,e.registryPath===S.cmpInfo.filePath||he(S.cmpInfo.filePath));Fe(y,B);let $=f.findIndex(V=>V.id===S.cmpInfo.id);f[$].inputs=B;let _=ze(S.cmpInfo.id,f,h,r,n,i,a),{elements:w,elmIndex:b,statementIndex:pe,statement:Pe,variableDeclaration:ie}=await Kc(e,g,S);if(_.addCmpToRegistry)w.push(Uc(e,_.addCmpToRegistry)),d=!0;else if(_.removeCmpFromRegistry)w.splice(b,1),d=!0;else if(_.updateRegisteredCmp){let V=te(e,w[b],_.updateRegisteredCmp);w[b]=e.ts.factory.updateObjectLiteralExpression(V,[Na(e,_.updateRegisteredCmp),...V.properties.slice(1)]),d=!0}if(d&&o){let V=[...g.statements];V[pe]=e.ts.factory.updateVariableStatement(Pe,Pe.modifiers,e.ts.factory.updateVariableDeclarationList(Pe.declarationList,[e.ts.factory.updateVariableDeclaration(ie,ie.name,ie.exclamationToken,ie.type,e.ts.factory.createArrayLiteralExpression(Ue(e,w)))])),g=e.ts.factory.updateSourceFile(g,V),y.exportType==="named"?g=k(e,g,{namedImports:[y.importName],importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}):g=k(e,g,{defaultImport:y.importName,importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)});let me=e.sdkVersion===A.gen2?"@builder.io/sdk-react":"@builder.io/react";g=k(e,g,{namedImports:["RegisteredComponent"],importPath:me,isTypeOnly:!0}),y.acceptsChildren&&e.sdkVersion!==A.gen2&&(g=k(e,g,{namedImports:["withChildren"],importPath:"@builder.io/react"})),g=qe(e,g,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),D.components=_.components,h=_.components.filter(gt=>gt.isRegistered)}}}if(d&&o){g=Ke(e,g),g=Ve(e,g);let E=ne(e,g);E=Ie(E),E=await e.formatCode(e.registryPath,E),await e.writeFile(e.registryPath,E)}return D}function Na(e,t){if(e.sdkVersion===A.gen2)return e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName));let r=e.ts.factory.createIdentifier(t.importName),n=t.acceptsChildren?e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("withChildren"),void 0,[r]):r;return e.ts.factory.createPropertyAssignment("component",n)}function Uc(e,t){return te(e,e.ts.factory.createObjectLiteralExpression([Na(e,t),...t.acceptsChildren&&e.sdkVersion===A.gen2?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}async function Kc(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await qr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}async function ka(e){let t=[],r=await Wc(e,t);return t.push(...await Mn(e)),await Gc(e,r),await qc(e,t),t}async function $a(e){let t=[];return t.push(...await Mn(e)),await zc(e,t),t}async function zc(e,t){let r=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureFigmaImportRoute, hasLocaleParam"),r=`($locale).${r}`);let n=e.join(e.routesDir,r),i=await e.exists(n);e.debug(`remixEnsureFigmaImportRoute, hasRoute: ${i}`);let a=await e.formatCode(n,La({sys:e,routePath:n,modelName:"figma-imports"}));await e.writeFile(n,a),t.push({filePath:n,modifiedType:i?"update":"create"})}async function qc(e,t){let r=`$.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureAppRoute, hasLocaleParam"),r=`($locale).${r}`),e.sdkVersion===A.gen2&&(r=`($slug)._index.${e.typescriptEnabled?"tsx":"jsx"}`);let n=e.join(e.routesDir,r),i=await e.exists(n);e.debug(`remixEnsureAppRoute, hasRoute: ${i}`);let a=await e.formatCode(n,La({sys:e,routePath:n,modelName:"page"}));await e.writeFile(n,a),t.push({filePath:n,modifiedType:i?"update":"create"})}function La({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled,i=L(e,t,e.registryPath),a="",o="";n&&(a="import type { LoaderArgs } from '@remix-run/server-runtime';",o=": LoaderArgs");let s=`process.env.${pn}`,u="";return e.getFrameworks().some(l=>l.name==="@shopify/remix-oxygen")&&(s=`context.env.${pn}`,u=", context"),n&&(s+="!"),e.sdkVersion===A.gen2?`
670
+
667
671
  import {
668
672
  Content,
669
673
  fetchOneEntry,
@@ -672,10 +676,10 @@ import {
672
676
  } from "@builder.io/sdk-react";
673
677
  ${n?'import type { LoaderFunctionArgs } from "@remix-run/node";':""}
674
678
  import { useLoaderData } from "@remix-run/react";
675
- import { fetch ${n?"as webFetch":""}} from "@remix-run/web-fetch";
679
+ import { fetch as webFetch } from "@remix-run/web-fetch";
676
680
  import { CUSTOM_COMPONENTS } from ${JSON.stringify(i)};
677
681
 
678
- export const loader = async ({ params, request }${n?": LoaderFunctionArgs":""}) => {
682
+ export const loader = async ({ params, request${u} }${n?": LoaderFunctionArgs":""}) => {
679
683
  const builderApiKey = ${s};
680
684
  const url = new URL(request.url);
681
685
  const urlPath = \`/\${params["slug"] || ""}\`;
@@ -768,11 +772,11 @@ export default function Page() {
768
772
  ${n?`
769
773
  declare global {
770
774
  interface Env {
771
- ${ln}: string;
775
+ ${pn}: string;
772
776
  }
773
777
  }
774
778
  `:""}
775
- `}async function ep(e,t){let n=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${n}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=tp(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 tp(e){let t=e.typescriptEnabled,r=`
779
+ `}async function Wc(e,t){let n=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${n}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=Jc(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 Jc(e){let t=e.typescriptEnabled,r=`
776
780
  import { useState } from "react";
777
781
  import styles from "./styles.module.css";
778
782
  ${t?`
@@ -835,17 +839,17 @@ export default Counter;
835
839
  font-size: 42px;
836
840
  text-align: center;
837
841
  }
838
- `.trimStart();return{component:r,styles:n}}async function np(e,t){let n=(await ze(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);n&&await ze(e,n.id,!0,!1,null,null,!0,!1)}async function jn(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,rp(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}function rp(e){let t=e.sdkVersion===b.gen2;return e.typescriptEnabled?`import type { RegisteredComponent } from ${t?'"@builder.io/sdk-react"':'"@builder.io/react"'};
839
-
842
+ `.trimStart();return{component:r,styles:n}}async function Gc(e,t){let n=(await Je(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);n&&await Je(e,n.id,!0,!1,null,null,!0,!1)}async function Mn(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Hc(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}function Hc(e){let t=e.sdkVersion===A.gen2;return e.typescriptEnabled?`import type { RegisteredComponent } from ${t?'"@builder.io/sdk-react"':'"@builder.io/react"'};
843
+
840
844
  export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
841
845
  ];`:`export const CUSTOM_COMPONENTS = [
842
846
  ];
843
- `}async function za(e){let t=await op(e);return{builderPageOptions:async()=>{let n="/builder-demo",i=t.hasLocaleParam?`/en-us${n}`:void 0;return{templateContentId:"a5c9eef7909d4fc99554264a17de22c9",pathname:n,localePathname:i,title:"Builder + Remix Demo Page"}},ensureBuilderSetup:()=>Va(t),ensureFigmaImportPage:()=>Ua(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>ze(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await ze(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>ze(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>ze(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>ze(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>ze(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>un(t),setPublicApiKey:n=>Oa(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===b.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:()=>Ne(t),setCache:n=>ke(t,n)}}async function op(e){let t=await ap(e),r=e.getAppRootDir(),n=await sp(e),i=e.dirname(n),a=e.join(i,"components"),o=await he(e),s=await Fe(e,i),u={},l={...e,registryPath:s,remixConfigPath:t,typescriptEnabled:o,appDir:i,componentsDir:a,routesDir:n,hasLocaleParam:await ip(e,n),addExternalPackage:c=>{u[e.join(r,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===r?[...p,...Object.keys(u).map(f=>f.slice(r.length+1))]:p},readdir:async c=>{let p=await e.readdir(c);return c===r?[...p,...Object.keys(u).map(f=>f.slice(r.length+1))]:p}};return e.sdkVersion?l.sdkVersion=e.sdkVersion:l.sdkVersion=await Ut(l),l}async function ip(e,t){return(await e.readdir(t)).some(n=>n.startsWith("($locale)."))}async function ap(e){let t=["remix.config.ts","remix.config.js","vite.config.ts","vite.config.js"];for(let r of t){let n=e.join(e.getAppRootDir(),r);if(await e.exists(n))return n}throw new Error(`Could not find Remix config file. Searched for ${t.join(", ")} in "${e.getAppRootDir()}".`)}async function sp(e){let t=await Gt(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 cn(e){let t=[".env"],r=e.configType==="vite"?pn:Vn;return await it(e,t,r)}async function qa(e,t){let r=await cn(e),n=await at(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var pn="VITE_PUBLIC_BUILDER_KEY",Vn="YOUR_PUBLIC_BUILDER_KEY";function Wa(e,t){let r=`Builder.registerComponent(
847
+ `}async function Oa(e){let t=await Qc(e);return{builderPageOptions:async()=>{let n="/builder-demo",i=t.hasLocaleParam?`/en-us${n}`:void 0;return{templateContentId:"a5c9eef7909d4fc99554264a17de22c9",pathname:n,localePathname:i,title:"Builder + Remix Demo Page"}},ensureBuilderSetup:()=>ka(t),ensureFigmaImportPage:()=>$a(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>Je(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await Je(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>Je(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>Je(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>Je(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>Je(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>cn(t),setPublicApiKey:n=>Ia(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===A.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:()=>Le(t),setCache:n=>Oe(t,n)}}async function Qc(e){let t=await Xc(e),r=e.getAppRootDir(),n=await Zc(e),i=e.dirname(n),a=e.join(i,"components"),o=await xe(e),s=await Se(e,i),u={},l={...e,registryPath:s,remixConfigPath:t,typescriptEnabled:o,appDir:i,componentsDir:a,routesDir:n,hasLocaleParam:await Yc(e,n),addExternalPackage:c=>{u[e.join(r,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===r?[...p,...Object.keys(u).map(f=>f.slice(r.length+1))]:p},readdir:async c=>{let p=await e.readdir(c);return c===r?[...p,...Object.keys(u).map(f=>f.slice(r.length+1))]:p}};return e.sdkVersion?l.sdkVersion=e.sdkVersion:l.sdkVersion=await Kt(l),l}async function Yc(e,t){return(await e.readdir(t)).some(n=>n.startsWith("($locale)."))}async function Xc(e){let t=["remix.config.ts","remix.config.js","vite.config.ts","vite.config.js"];for(let r of t){let n=e.join(e.getAppRootDir(),r);if(await e.exists(n))return n}if(e.ignoreMissingConfig)return"";throw new Error(`Could not find Remix config file. Searched for ${t.join(", ")} in "${e.getAppRootDir()}".`)}async function Zc(e){let t=await Yt(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 mn(e){let t=[".env"],r=e.configType==="vite"?fn:Vn;return await at(e,t,r)}async function _a(e,t){let r=await mn(e),n=await st(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var fn="VITE_PUBLIC_BUILDER_KEY",Vn="YOUR_PUBLIC_BUILDER_KEY";function ja(e,t){let r=`Builder.registerComponent(
844
848
  `;r+=` ${t.importName},
845
849
  `,r+=` {
846
850
  name: "${t.name}",
847
851
  }
848
- `,r+=");";let n=bn(e,r);return Qr(e,n,t)}function Qr(e,t,r){if(!e.ts.isExpressionStatement(t))return t;let n=t.expression;if(!e.ts.isCallExpression(n))return t;let i=[...n.arguments];if(i.length<2)return t;let a=i[1];return e.ts.isObjectLiteralExpression(a)?(i[1]=te(e,a,r),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(n,n.expression,n.typeArguments,i))):t}async function Ja(e){let t=await e.readFile(e.registryPath);return t?up(e,t):{components:[],sourceFile:N(e,"")}}async function up(e,t){let r=N(e,t);return e.sdkVersion===b.gen2?pp(e,r):lp(e,r)}async function lp(e,t){let r=[];for(let n=0;n<t.statements.length;n++){let i=t.statements[n];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 f=await cp(e,t,n,p,c,!1);f&&r.push(f);continue}}return{sourceFile:t,components:me(r)}}async function cp(e,t,r,n,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:r,acceptsChildren:a,framework:"react"},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===n.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;o.filePath=await Yr(e,l.text),o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),o.importPath=K(e,o.filePath),o.name=Ee(e,o.filePath),o.importName=n.text,o.exportName="default",o.exportType="default"}else{let l=s.find(f=>!f.importClause||!f.importClause.namedBindings||!e.ts.isNamedImports(f.importClause.namedBindings)?!1:f.importClause.namedBindings.elements.some(h=>h.name.text===n.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await Yr(e,c.text);o.filePath=await Yr(e,c.text),o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=K(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=q(n.text),o.importName=n.text,o.exportName=n.text,o.exportType="named"}return o=fe(e,o,i),o.displayFilePath=M(e,o.filePath),o.filePath&&o.exportName&&(o.id=await z(e,o.filePath,o.exportName,o.externalImportPath)),o}function Yr(e,t){return an(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}async function pp(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Xr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:me(r)}}async function Xr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};Lt(e,r)&&(n.acceptsChildren=!0);for(let a of r.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(j(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;n.name===""&&(n.name=q(s)),n.importName=s;let l=await Le(e,e.registryPath,t,s);if(!l)continue;n.filePath=l.filePath,n.relFilePath=l.relFilePath,await e.exists(l.filePath)?n.importPath=K(e,l.filePath):(n.externalImportPath=l.importPath,n.importPath=n.externalImportPath),n.displayFilePath=l.displayFilePath,n.exportType=l.exportType;let c=t.statements.filter(f=>e.ts.isImportDeclaration(f)),p=c.find(f=>f.importClause&&f.importClause.name?.text===s);if(p){let f=p.moduleSpecifier;if(!e.ts.isStringLiteral(f))return null;n.exportName="default"}else{let f=c.find(D=>!D.importClause||!D.importClause.namedBindings||!e.ts.isNamedImports(D.importClause.namedBindings)?!1:D.importClause.namedBindings.elements.some(d=>d.name.text===s));if(!f)return null;let h=f.moduleSpecifier;if(!e.ts.isStringLiteral(h))return null;n.exportName=s}continue}}return n=fe(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}async function qe(e,t,r,n,i,a,o,s){let u=await ut(e),[l,c,p,f]=await Promise.all([aa(e,u),Ja(e),he(e),cn(e)]),h=l.map(x=>x.cmpInfo),D=c.components,d={components:be(h,D),registryPath:e.registryPath,registryDisplayPath:M(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Oe(h),publicApiKey:f.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await Mt(e,d.components),d;let g=!1,m=c.sourceFile,E=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(E.length>0){let x=E.map(y=>{let B=l.find($=>$.cmpInfo.id===y);if(!B)throw new Error(`Component ${y} not found`);return B}),v=Array.from(new Set(x.map(y=>y.cmpInfo.filePath))),S=await ee(e,v);for(let y of x){let B=d.components.find(A=>A.id===y.cmpInfo.id),$=await jt(e,y,S,e.registryPath===y.cmpInfo.filePath||De(y.cmpInfo.filePath));xe(B,$);let _=h.findIndex(A=>A.id===y.cmpInfo.id);h[_].inputs=$;let w=Ve(y.cmpInfo.id,h,D,r,n,i,a);if(e.sdkVersion===b.gen2){let{elements:A,elmIndex:ue,statementIndex:ve,statement:ie,variableDeclaration:V}=await mp(e,m,y);if(w.addCmpToRegistry)A.push(fp(e,w.addCmpToRegistry)),g=!0;else if(w.removeCmpFromRegistry)A.splice(ue,1),g=!0;else if(w.updateRegisteredCmp){let le=te(e,A[ue],w.updateRegisteredCmp),Dt=e.ts.factory.createIdentifier(w.updateRegisteredCmp.importName);A[ue]=e.ts.factory.updateObjectLiteralExpression(le,[e.ts.factory.createPropertyAssignment("component",Dt),...le.properties.slice(1)]),g=!0}if(g&&o){let le=[...m.statements];le[ve]=e.ts.factory.updateVariableStatement(ie,ie.modifiers,e.ts.factory.updateVariableDeclarationList(ie.declarationList,[e.ts.factory.updateVariableDeclaration(V,V.name,V.exclamationToken,V.type,e.ts.factory.createArrayLiteralExpression(Me(e,A)))])),m=e.ts.factory.updateSourceFile(m,le),m=Ha(e,w,m),m=k(e,m,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),m=Ue(e,m,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=w.components,D=w.components.filter(Dt=>Dt.isRegistered)}}else{let A=[...m.statements];w.addCmpToRegistry?(A.push(Wa(e,w.addCmpToRegistry)),g=!0):w.removeCmpFromRegistry?(A.splice(w.nodeIndex,1),g=!0):w.updateRegisteredCmp&&(A[w.nodeIndex]=Qr(e,A[w.nodeIndex],w.updateRegisteredCmp),g=!0),g&&o&&(m=e.ts.factory.updateSourceFile(m,A),m=k(e,m,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),m=Ha(e,w,m),B?.acceptsChildren&&(m=k(e,m,{namedImports:["withChildren"],importPath:"@builder.io/react"})),d.components=w.components,D=w.components.filter(ue=>ue.isRegistered))}}}if(g&&o){m=je(e,m),m=_e(e,m);let x=ne(e,m);x=Ae(x),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return d}async function mp(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Xr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}function fp(e,t){let r=e.ts.factory.createIdentifier(t.importName);return te(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",r),...t.acceptsChildren?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}function Ha(e,t,r){let n=t.addCmpToRegistry||t.updateRegisteredCmp;if(n){let i=n.externalImportPath?n.externalImportPath:L(e,e.registryPath,n.filePath);n.exportType==="default"?r=k(e,r,{defaultImport:n.importName,importPath:i}):n.exportType==="named"&&(r=k(e,r,{namedImports:[n.importName],importPath:i}))}return r}async function Ga(e){let t=[],r=await dp(e,t);if(await Xa(e,t,r),!await e.exists(e.builderComponentPath)){let n=await e.formatCode(e.builderComponentPath,Ya(e,e.builderComponentPath));await e.writeFile(e.builderComponentPath,n),t.push({filePath:e.builderComponentPath,modifiedType:"create"})}return t}async function Qa(e){let t=[];await Xa(e,t);let r=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`,n=e.join(e.componentsDir,r);if(!await e.exists(n)){let i=await e.formatCode(n,Ya(e,n,"figma-imports"));await e.writeFile(n,i),t.push({filePath:n,modifiedType:"create"})}return t}function Ya(e,t,r="page"){let n=e.typescriptEnabled;return e.sdkVersion===b.gen2?`
852
+ `,r+=");";let n=An(e,r);return Wr(e,n,t)}function Wr(e,t,r){if(!e.ts.isExpressionStatement(t))return t;let n=t.expression;if(!e.ts.isCallExpression(n))return t;let i=[...n.arguments];if(i.length<2)return t;let a=i[1];return e.ts.isObjectLiteralExpression(a)?(i[1]=te(e,a,r),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(n,n.expression,n.typeArguments,i))):t}async function Ma(e){let t=await e.readFile(e.registryPath);return t?ep(e,t):{components:[],sourceFile:N(e,"")}}async function ep(e,t){let r=N(e,t);return e.sdkVersion===A.gen2?rp(e,r):tp(e,r)}async function tp(e,t){let r=[];for(let n=0;n<t.statements.length;n++){let i=t.statements[n];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 f=await np(e,t,n,p,c,!1);f&&r.push(f);continue}}return{sourceFile:t,components:De(r)}}async function np(e,t,r,n,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:r,acceptsChildren:a,framework:"react"},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===n.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;o.filePath=await Jr(e,l.text),o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),o.importPath=K(e,o.filePath),o.name=ye(e,o.filePath),o.importName=n.text,o.exportName="default",o.exportType="default"}else{let l=s.find(f=>!f.importClause||!f.importClause.namedBindings||!e.ts.isNamedImports(f.importClause.namedBindings)?!1:f.importClause.namedBindings.elements.some(h=>h.name.text===n.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await Jr(e,c.text);o.filePath=await Jr(e,c.text),o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=K(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=q(n.text),o.importName=n.text,o.exportName=n.text,o.exportType="named"}return o=ge(e,o,i),o.displayFilePath=j(e,o.filePath),o.filePath&&o.exportName&&(o.id=await z(e,o.filePath,o.exportName,o.externalImportPath)),o}function Jr(e,t){return un(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}async function rp(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Gr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:De(r)}}async function Gr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};Ot(e,r)&&(n.acceptsChildren=!0);for(let a of r.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(M(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;n.name===""&&(n.name=q(s)),n.importName=s;let l=await je(e,e.registryPath,t,s);if(!l)continue;n.filePath=l.filePath,n.relFilePath=l.relFilePath,await e.exists(l.filePath)?n.importPath=K(e,l.filePath):(n.externalImportPath=l.importPath,n.importPath=n.externalImportPath),n.displayFilePath=l.displayFilePath,n.exportType=l.exportType;let c=t.statements.filter(f=>e.ts.isImportDeclaration(f)),p=c.find(f=>f.importClause&&f.importClause.name?.text===s);if(p){let f=p.moduleSpecifier;if(!e.ts.isStringLiteral(f))return null;n.exportName="default"}else{let f=c.find(D=>!D.importClause||!D.importClause.namedBindings||!e.ts.isNamedImports(D.importClause.namedBindings)?!1:D.importClause.namedBindings.elements.some(d=>d.name.text===s));if(!f)return null;let h=f.moduleSpecifier;if(!e.ts.isStringLiteral(h))return null;n.exportName=s}continue}}return n=ge(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}async function Ge(e,t,r,n,i,a,o,s){let u=await lt(e),[l,c,p,f]=await Promise.all([Zi(e,u),Ma(e),xe(e),mn(e)]),h=l.map(x=>x.cmpInfo),D=c.components,d={components:Be(h,D),registryPath:e.registryPath,registryDisplayPath:j(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Me(h),publicApiKey:f.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await Mt(e,d.components),d;let g=!1,m=c.sourceFile,E=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(E.length>0){let x=E.map(y=>{let B=l.find($=>$.cmpInfo.id===y);if(!B)throw new Error(`Component ${y} not found`);return B}),v=Array.from(new Set(x.map(y=>y.cmpInfo.filePath))),S=await ee(e,v);for(let y of x){let B=d.components.find(b=>b.id===y.cmpInfo.id),$=await Vt(e,y,S,e.registryPath===y.cmpInfo.filePath||he(y.cmpInfo.filePath));Fe(B,$);let _=h.findIndex(b=>b.id===y.cmpInfo.id);h[_].inputs=$;let w=ze(y.cmpInfo.id,h,D,r,n,i,a);if(e.sdkVersion===A.gen2){let{elements:b,elmIndex:pe,statementIndex:Pe,statement:ie,variableDeclaration:V}=await op(e,m,y);if(w.addCmpToRegistry)b.push(ip(e,w.addCmpToRegistry)),g=!0;else if(w.removeCmpFromRegistry)b.splice(pe,1),g=!0;else if(w.updateRegisteredCmp){let me=te(e,b[pe],w.updateRegisteredCmp),gt=e.ts.factory.createIdentifier(w.updateRegisteredCmp.importName);b[pe]=e.ts.factory.updateObjectLiteralExpression(me,[e.ts.factory.createPropertyAssignment("component",gt),...me.properties.slice(1)]),g=!0}if(g&&o){let me=[...m.statements];me[Pe]=e.ts.factory.updateVariableStatement(ie,ie.modifiers,e.ts.factory.updateVariableDeclarationList(ie.declarationList,[e.ts.factory.updateVariableDeclaration(V,V.name,V.exclamationToken,V.type,e.ts.factory.createArrayLiteralExpression(Ue(e,b)))])),m=e.ts.factory.updateSourceFile(m,me),m=Va(e,w,m),m=k(e,m,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),m=qe(e,m,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=w.components,D=w.components.filter(gt=>gt.isRegistered)}}else{let b=[...m.statements];w.addCmpToRegistry?(b.push(ja(e,w.addCmpToRegistry)),g=!0):w.removeCmpFromRegistry?(b.splice(w.nodeIndex,1),g=!0):w.updateRegisteredCmp&&(b[w.nodeIndex]=Wr(e,b[w.nodeIndex],w.updateRegisteredCmp),g=!0),g&&o&&(m=e.ts.factory.updateSourceFile(m,b),m=k(e,m,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),m=Va(e,w,m),B?.acceptsChildren&&(m=k(e,m,{namedImports:["withChildren"],importPath:"@builder.io/react"})),d.components=w.components,D=w.components.filter(pe=>pe.isRegistered))}}}if(g&&o){m=Ke(e,m),m=Ve(e,m);let x=ne(e,m);x=Ie(x),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return d}async function op(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Gr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}function ip(e,t){let r=e.ts.factory.createIdentifier(t.importName);return te(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",r),...t.acceptsChildren?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}function Va(e,t,r){let n=t.addCmpToRegistry||t.updateRegisteredCmp;if(n){let i=n.externalImportPath?n.externalImportPath:L(e,e.registryPath,n.filePath);n.exportType==="default"?r=k(e,r,{defaultImport:n.importName,importPath:i}):n.exportType==="named"&&(r=k(e,r,{namedImports:[n.importName],importPath:i}))}return r}async function Ua(e){let t=[],r=await ap(e,t);if(await qa(e,t,r),!await e.exists(e.builderComponentPath)){let n=await e.formatCode(e.builderComponentPath,za(e,e.builderComponentPath));await e.writeFile(e.builderComponentPath,n),t.push({filePath:e.builderComponentPath,modifiedType:"create"})}return t}async function Ka(e){let t=[];await qa(e,t);let r=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`,n=e.join(e.componentsDir,r);if(!await e.exists(n)){let i=await e.formatCode(n,za(e,n,"figma-imports"));await e.writeFile(n,i),t.push({filePath:n,modifiedType:"create"})}return t}function za(e,t,r="page"){let n=e.typescriptEnabled;return e.sdkVersion===A.gen2?`
849
853
  import React from "react";
850
854
  import {
851
855
  Content,
@@ -857,7 +861,7 @@ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
857
861
  import { CUSTOM_COMPONENTS } from ${JSON.stringify(L(e,t,e.registryPath))};
858
862
 
859
863
  // Builder Public API Key set in .env file
860
- const BUILDER_API_KEY = ${e.configType==="vite"?`import.meta.env.${pn};`:`${Vn};`}
864
+ const BUILDER_API_KEY = ${e.configType==="vite"?`import.meta.env.${fn};`:`${Vn};`}
861
865
  const MODEL_NAME = "${r}";
862
866
 
863
867
  export default function BuilderPage() {
@@ -910,7 +914,7 @@ import { BuilderComponent, builder, useIsPreviewing } from "@builder.io/react";
910
914
  import ${JSON.stringify(L(e,t,e.registryPath))};
911
915
 
912
916
  // Builder Public API Key set in .env file
913
- ${e.configType==="vite"?`builder.init(import.meta.env.${pn}${n?"!":""})`:`builder.init("${Vn}")`}
917
+ ${e.configType==="vite"?`builder.init(import.meta.env.${fn}${n?"!":""})`:`builder.init("${Vn}")`}
914
918
 
915
919
  export default function BuilderPage() {
916
920
  const isPreviewingInBuilder = useIsPreviewing();
@@ -955,7 +959,7 @@ export default function BuilderPage() {
955
959
  </>
956
960
  );
957
961
  }
958
- `.trimStart()}async function Xa(e,t,r){if(!await e.exists(e.registryPath)){if(e.sdkVersion===b.gen2){let a=gp(e);await e.writeFile(e.registryPath,a)}else await e.writeFile(e.registryPath,"");t.push({filePath:e.registryPath,modifiedType:"create"})}if(!r)return;let i=(await qe(e,null,!1,!1,null,null,!1,!1)).components.find(a=>a.filePath===r);i&&await qe(e,i.id,!0,!1,null,null,!0,!1)}async function dp(e,t){let n=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${n}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=Dp(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 Dp(e){let t=e.typescriptEnabled,r=`
962
+ `.trimStart()}async function qa(e,t,r){if(!await e.exists(e.registryPath)){if(e.sdkVersion===A.gen2){let a=up(e);await e.writeFile(e.registryPath,a)}else await e.writeFile(e.registryPath,"");t.push({filePath:e.registryPath,modifiedType:"create"})}if(!r)return;let i=(await Ge(e,null,!1,!1,null,null,!1,!1)).components.find(a=>a.filePath===r);i&&await Ge(e,i.id,!0,!1,null,null,!0,!1)}async function ap(e,t){let n=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${n}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=sp(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 sp(e){let t=e.typescriptEnabled,r=`
959
963
  "use client"
960
964
  import React, { useState } from "react";
961
965
  import styles from "./styles.module.css";
@@ -1018,18 +1022,18 @@ export default Counter;
1018
1022
  font-size: 42px;
1019
1023
  text-align: center;
1020
1024
  }
1021
- `.trimStart();return{component:r,styles:n}}function gp(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-react";
1025
+ `.trimStart();return{component:r,styles:n}}function up(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-react";
1022
1026
 
1023
1027
  export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
1024
1028
  ];`:`export const CUSTOM_COMPONENTS = [
1025
1029
  ];
1026
- `}async function Za(e){let t=await hp(e);return{builderPageOptions:async()=>({templateContentId:"2e36438034894a8abf279ea9e6d3596f",pathname:"/builder-demo",title:"Builder + React Demo Page"}),ensureBuilderSetup:()=>Ga(t),ensureFigmaImportPage:()=>Qa(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>qe(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await qe(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>qe(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>qe(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>qe(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>qe(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>cn(t),setPublicApiKey:n=>qa(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===b.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:()=>Ne(t),setCache:n=>ke(t,n)}}async function hp(e){let t=await Cp(e),r=e.getAppRootDir(),n=e.join(r,"src"),i=await he(e),a={},o={...e,srcDir:null,builderComponentPath:"",componentsDir:"",registryPath:"",reactConfigPath:t,typescriptEnabled:i,configType:"",addExternalPackage:s=>{a[e.join(r,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===r?[...u,...Object.keys(a).map(l=>l.slice(r.length+1))]:u},readdir:async s=>{let u=await e.readdir(s);return s===r?[...u,...Object.keys(a).map(l=>l.slice(r.length+1))]:u}};return e.sdkVersion?o.sdkVersion=e.sdkVersion:o.sdkVersion=await Ut(o),t.includes("webpack.config")&&(o.configType="webpack"),t.includes("vite.config")&&(o.configType="vite"),await e.exists(n)?(o.srcDir=n,o.componentsDir=e.join(n,"components"),o.registryPath=await Fe(e,n),o.builderComponentPath=e.join(o.srcDir,`builder-page.${i?"tsx":"jsx"}`)):(o.componentsDir=e.join(r,"components"),o.registryPath=await Fe(e,r),o.builderComponentPath=e.join(r,`builder-page.${i?"tsx":"jsx"}`)),o}async function Cp(e){let t=["vite.config.ts","vite.config.js","webpack.config.js","webpack.config.ts"];for(let r of t){let n=e.join(e.getAppRootDir(),r);if(await e.exists(n))return n}if(e.ignoreMissingConfig)return"";throw new Error(`Could not find React config file. Searched for ${t.join(", ")} in "${e.getAppRootDir()}".`)}async function mn(e){return await xp(e,["environment.ts"],Un)}async function es(e,t){let r=await mn(e),n=await Sp(e,r.file,r.envKey,t);return{...r,modifiedType:n}}async function xp(e,t,r){let n={envKey:r,envValue:null,file:""};for(let i of t){let a=e.join(e.getAppRootDir(),"src","environments",i),o=await Ep(e,a);if(typeof o=="string"&&o.length>0&&o!=="YOUR_API_KEY")return n.envValue=o,n.file=a,n}return n.file=e.join(e.getAppRootDir(),"src","environments",t[t.length-1]),n}async function Ep(e,t){let r=await e.readFile(t);return r?Fp(e,r):""}function Fp(e,t){let r=N(e,t),n="",a=Ot(e,r,"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===Un&&e.ts.isStringLiteral(u.initializer)&&(n=u.initializer.text)})}return n}async function yp(e,t,r,n){let i=N(e,t),o=Ot(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(r),e.ts.factory.createStringLiteral(n)),p=e.ts.factory.createNodeArray([...l.properties,c]),f=e.ts.factory.updateObjectLiteralExpression(l,p),h=e.ts.factory.updateVariableDeclaration(u,u.name,u.exclamationToken,u.type,f),D=e.ts.factory.updateVariableDeclarationList(s,[h]);return e.ts.factory.updateVariableStatement(o.statement,o.statement.modifiers,D)}return null}return null}async function Sp(e,t,r,n){let i=await e.readFile(t);if(i)if(i.includes(r))e.debug(`"${r}" already set in ${t}`);else{e.debug(`Add "${r}" to ${t}`);let a=await yp(e,i,r,n);if(a){let o=ne(e,a),s=await e.formatCode(t,o);await e.writeFile(t,s)}return"update"}else{e.debug(`Creating new env file with "${r}" at ${t}`);let a=`
1030
+ `}async function Wa(e){let t=await lp(e);return{builderPageOptions:async()=>({templateContentId:"2e36438034894a8abf279ea9e6d3596f",pathname:"/builder-demo",title:"Builder + React Demo Page"}),ensureBuilderSetup:()=>Ua(t),ensureFigmaImportPage:()=>Ka(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>Ge(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await Ge(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>Ge(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>Ge(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>Ge(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>Ge(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>mn(t),setPublicApiKey:n=>_a(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===A.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:()=>Le(t),setCache:n=>Oe(t,n)}}async function lp(e){let t=await cp(e),r=e.getAppRootDir(),n=e.join(r,"src"),i=await xe(e),a={},o={...e,srcDir:null,builderComponentPath:"",componentsDir:"",registryPath:"",reactConfigPath:t,typescriptEnabled:i,configType:"",addExternalPackage:s=>{a[e.join(r,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===r?[...u,...Object.keys(a).map(l=>l.slice(r.length+1))]:u},readdir:async s=>{let u=await e.readdir(s);return s===r?[...u,...Object.keys(a).map(l=>l.slice(r.length+1))]:u}};return e.sdkVersion?o.sdkVersion=e.sdkVersion:o.sdkVersion=await Kt(o),t.includes("webpack.config")&&(o.configType="webpack"),t.includes("vite.config")&&(o.configType="vite"),await e.exists(n)?(o.srcDir=n,o.componentsDir=e.join(n,"components"),o.registryPath=await Se(e,n),o.builderComponentPath=e.join(o.srcDir,`builder-page.${i?"tsx":"jsx"}`)):(o.componentsDir=e.join(r,"components"),o.registryPath=await Se(e,r),o.builderComponentPath=e.join(r,`builder-page.${i?"tsx":"jsx"}`)),o}async function cp(e){let t=["vite.config.ts","vite.config.js","webpack.config.js","webpack.config.ts"];for(let r of t){let n=e.join(e.getAppRootDir(),r);if(await e.exists(n))return n}if(e.ignoreMissingConfig)return"";throw new Error(`Could not find React config file. Searched for ${t.join(", ")} in "${e.getAppRootDir()}".`)}async function dn(e){return await pp(e,["environment.ts"],Un)}async function Ja(e,t){let r=await dn(e),n=await Dp(e,r.file,r.envKey,t);return{...r,modifiedType:n}}async function pp(e,t,r){let n={envKey:r,envValue:null,file:""};for(let i of t){let a=e.join(e.getAppRootDir(),"src","environments",i),o=await mp(e,a);if(typeof o=="string"&&o.length>0&&o!=="YOUR_API_KEY")return n.envValue=o,n.file=a,n}return n.file=e.join(e.getAppRootDir(),"src","environments",t[t.length-1]),n}async function mp(e,t){let r=await e.readFile(t);return r?fp(e,r):""}function fp(e,t){let r=N(e,t),n="",a=_t(e,r,"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===Un&&e.ts.isStringLiteral(u.initializer)&&(n=u.initializer.text)})}return n}async function dp(e,t,r,n){let i=N(e,t),o=_t(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(r),e.ts.factory.createStringLiteral(n)),p=e.ts.factory.createNodeArray([...l.properties,c]),f=e.ts.factory.updateObjectLiteralExpression(l,p),h=e.ts.factory.updateVariableDeclaration(u,u.name,u.exclamationToken,u.type,f),D=e.ts.factory.updateVariableDeclarationList(s,[h]);return e.ts.factory.updateVariableStatement(o.statement,o.statement.modifiers,D)}return null}return null}async function Dp(e,t,r,n){let i=await e.readFile(t);if(i)if(i.includes(r))e.debug(`"${r}" already set in ${t}`);else{e.debug(`Add "${r}" to ${t}`);let a=await dp(e,i,r,n);if(a){let o=ne(e,a),s=await e.formatCode(t,o);await e.writeFile(t,s)}return"update"}else{e.debug(`Creating new env file with "${r}" at ${t}`);let a=`
1027
1031
  // https://www.builder.io/c/docs/using-your-api-key
1028
1032
  export const environment = {
1029
1033
  production: false,
1030
1034
  builderApiKey: "${n}",
1031
1035
  };
1032
- `.trimStart(),o=await e.formatCode(t,a);return await e.writeFile(t,o),"create"}return null}var Un="builderApiKey";async function ns(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(Ap(e,a.fileName)||o.startsWith(".")||o==="node_modules"||vp.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await Kn(e,i,s,a);r.push(...u)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var vp=new Set([]),wp=new Set(["node_modules"]);function Ap(e,t){for(let r of wp)if(e.dirname(t).includes(r))return!0;return!1}async function rs(e,t){let r=e.extname(t).toLowerCase();if(r===".tsx"||r===".jsx"||r===".ts"||r===".js"){let n=await e.readFile(t);if(n)return bp(e,t,n)}return null}function bp(e,t,r){let n=N(e,r);return Kn(e,null,t,n)}async function Kn(e,t,r,n){let i=[],a={};r=e.normalize(r);let o=n.statements.filter(c=>e.ts.isClassDeclaration(c)&&Rp(e,c)),s=n.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(f=>(f.propertyName??f.name).text==="input");p&&(a.inputSignalImportName=p.name.text)}}let u=await Tp(e,t,r,n),l=Np(e,n);return await Promise.all(o.map(async c=>{let p=await Pp(e,t,r,c,l,a);i.push(...p)})),i.push(...u),i}async function Zr(e,t,r){if(t.node.fnNode){let{sourceFile:n,typeChecker:i}=await It(e,t.cmpInfo.filePath,r),o=(await Kn(e,i,t.cmpInfo.filePath,n)).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 os(e,t,r){let n=await ee(e,r.map(o=>o.filePath)),i=n.getTypeChecker();return await Promise.all(r.filter(o=>!(o.name.endsWith("Page")||o.name.endsWith("Module")||o.name==="AppComponent")).map(async o=>{if(!o.isRegistered){let s=n.getSourceFile(o.filePath);if(s){let l=(await Kn(e,i,o.filePath,s)).find(c=>c.cmpInfo.id===o.id);if(l){o.inputs=Et(e,i,l.node.fnNode);let c=t.find(p=>p.cmpInfo.id===o.id);if(c){let p=await Zr(e,c,n);xe(o,p)}}}}return o}))}async function Pp(e,t,r,n,i,a){let o=[],s=e.relative(e.getAppRootDir(),r),u=K(e,r),l=n.name?.text;if(!l)return o;let c=!1;n.modifiers&&(c=n.modifiers.some(D=>D.kind===e.ts.SyntaxKind.DefaultKeyword));let p=c?"default":l,f=c?"default":"named",h=[];return n.members.forEach(D=>{if(e.ts.isPropertyDeclaration(D)||e.ts.isGetAccessor(D)||e.ts.isSetAccessor(D)){let m=(e.ts.getDecorators(D)??[]).find(x=>Ip(e,x))!==void 0&&e.ts.isIdentifier(D.name),E=a?.inputSignalImportName!==void 0&&e.ts.isIdentifier(D.name)&&Bp(e,D,a.inputSignalImportName);if(m||E){let x="any";if(e.ts.isSetAccessor(D))x=ts(e,D.parameters[0].type);else if(D.type&&t){let S=t.getTypeAtLocation(D.type);x=t.typeToString(S)}else x=ts(e,D.type);let v={name:D.name.text,type:i[x]?"string":x};i[x]&&(v.enum=i[x]),h.push(v)}}}),o.push({cmpInfo:{id:await z(e,r,l),displayFilePath:M(e,r),name:q(l),inputs:h,exportName:p,exportType:f,importName:l,filePath:r,relFilePath:s,importPath:u,meta:{...$p(e,n)},framework:"angular"},node:{name:l,fnNode:n,deps:void 0}}),o}async function Tp(e,t,r,n){let i=[],a=e.relative(e.getAppRootDir(),r),o=K(e,r);for(let s of n.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",f=[];if(t){let d=t.getSymbolAtLocation(u.name);if(d){let g=t.getDeclaredTypeOfSymbol(d);t.getPropertiesOfType(g).forEach(E=>{let x=E.getDeclarations();x&&x.forEach(v=>{if(e.ts.isPropertyDeclaration(v)){let S=t.getTypeAtLocation(v),y={name:E.getName(),type:kp(e,t,S)};f.push(y)}})})}}let h=e.ts.isExportSpecifier(u)&&u.parent?u.parent.parent:void 0,D;if(h){let d=h.moduleSpecifier;if(d&&e.ts.isStringLiteral(d)){let g=t?.getSymbolAtLocation(d);if(g&&g.declarations&&g.declarations.length>0){let m=g.declarations[0];(!e.ts.isSourceFile(m)||e.ts.isSourceFile(m)&&m.fileName.includes("node_modules"))&&(D=d.text)}}}i.push({cmpInfo:{id:await z(e,r,l,D),displayFilePath:M(e,r),name:q(l),inputs:f,exportName:c,exportType:p,importName:l,filePath:r,relFilePath:a,importPath:D||o,externalImportPath:D,framework:"angular"},node:{name:l,fnNode:u,deps:void 0}})}return i}function Ip(e,t){return is(e,t,"Input")}function Bp(e,t,r){return e.ts.isPropertyDeclaration(t)&&t.initializer!==void 0&&e.ts.isCallExpression(t.initializer)&&e.ts.isIdentifier(t.initializer.expression)&&t.initializer.expression.text===r}function is(e,t,r){if(e.ts.isCallExpression(t.expression)){let n=t.expression;if(e.ts.isIdentifier(n.expression))return n.expression?.text===r}return!1}function Rp(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 ts(e,t){if(!t)return"any";let r="any";switch(t.kind){case e.ts.SyntaxKind.StringKeyword:r="string";break;case e.ts.SyntaxKind.NumberKeyword:r="number";break;case e.ts.SyntaxKind.BooleanKeyword:r="boolean";break;case e.ts.SyntaxKind.TypeReference:e.ts.isTypeReferenceNode(t)&&e.ts.isIdentifier(t.typeName)&&(r=t.typeName.text);break}return r.includes("|")?"string":r}function Np(e,t){let r={};return e.ts.forEachChild(t,n=>{e.ts.isTypeAliasDeclaration(n)&&e.ts.isUnionTypeNode(n.type)&&n.type.types.every(i=>e.ts.isLiteralTypeNode(i)&&e.ts.isStringLiteral(i.literal))&&(r[n.name.text]=n.type.types.map(i=>i.literal.text))}),r}function kp(e,t,r){let n=t.typeToString(r);if(n==="any"){let i=r.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&&(n=t.typeToString(t.getTypeAtLocation(s)))}}}}return n}function $p(e,t){let{getDecorators:r,isCallExpression:n,isIdentifier:i,isObjectLiteralExpression:a,isPropertyAssignment:o,isStringLiteral:s,SyntaxKind:u}=e.ts,l,c;return r(t)?.forEach(f=>{if(is(e,f,"Component")){let{expression:h}=f;if(n(h)){let[D]=h.arguments;a(D)&&D.properties.forEach(d=>{o(d)&&i(d.name)&&(d.name.escapedText==="selector"&&s(d.initializer)&&(l=d.initializer.text),d.name.escapedText==="standalone"&&(c=d.initializer.kind===u.TrueKeyword))})}}}),{selector:l,standalone:c}}async function zn(e,t,r){let n=e.typescriptEnabled?".ts":".js",i=`app.module${n}`,a=e.join(e.appDir,i),o=await e.readFile(a);if(!o){console.error(`Unable to read app.module.${n} at ${a}`);return}let s=await Lp(e,a,t,r,o);if(!s){console.error(`Unable to update app.module.${n} at ${a}`);return}return await e.writeFile(a,s),a}async function Lp(e,t,r,n,i){let a=i,o=N(e,i),s=L(e,t,n);o=k(e,o,{namedImports:[r],importPath:s}),o=k(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=Op(e,r,l);u.push(c)}else u.push(l);return o=e.ts.factory.updateSourceFile(o,u),a=ne(e,o),a}function Op(e,t,r){let n=e.ts.getDecorators(r);if(n){for(let i of n)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=as(e,a[0],"declarations",t);if(o){let s=as(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=[...n.map(p=>p===i?u:p),...e.ts.getModifiers(r)||[]];return e.ts.factory.updateClassDeclaration(r,c,r.name,r.typeParameters,r.heritageClauses,r.members)}}}}}return r}function as(e,t,r,n){let i=[...t.properties],a=i.findIndex(s=>j(e,s)===r);if(a>-1){let s=i[a];if(e.ts.isPropertyAssignment(s)&&s.initializer&&e.ts.isArrayLiteralExpression(s.initializer)){let u=ss(e,s.initializer,n);return u?(i[a]=e.ts.factory.updatePropertyAssignment(s,s.name,u),e.ts.factory.updateObjectLiteralExpression(t,i)):null}return null}let o=ss(e,e.ts.factory.createArrayLiteralExpression([],!0),n);return o?e.ts.factory.updateObjectLiteralExpression(t,[...i,e.ts.factory.createPropertyAssignment(r,o)]):null}function ss(e,t,r){return t.elements.some(i=>e.ts.isIdentifier(i)?i.text===r:!1)?null:e.ts.factory.updateArrayLiteralExpression(t,[...t.elements,e.ts.factory.createIdentifier(r)])}async function eo(e,t,r,n){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(f=>f.path===t))return;let p=e.magicast.builders.raw("{}");if(p.path=t,p.component=e.magicast.builders.raw(r),c.push(p),s.imports.$items.find(f=>f.imported===r))return;s.imports.$append({imported:r,from:n}),await e.magicast.writeFile(s,o)}}catch(i){console.error(i)}}var xs=T(Cs(),1);async function Es(e){let t=e.ts.findConfigFile(e.getAppRootDir(),e.existsSync);if(t){let r=await e.readFile(t);if(!r)return;let n=xs.default.parse(r);if(!n||typeof n!="object"||Array.isArray(n))return;let i=n.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(n,null,2))}}async function Fs(e){let t=[],r=await Hp(e,t);t.push(...await Gn(e)),await Wp(e,r);let n="BuilderPage";if(!await e.exists(e.builderPageComponentPath)){let i=await e.formatCode(e.builderPageComponentPath,Ss(e,n,e.builderPageComponentPath,"builder-page","page",!0));await e.writeFile(e.builderPageComponentPath,i),t.push({filePath:e.builderPageComponentPath,modifiedType:"create"})}if(e.hasAppModule){await zn(e,"Counter",r);let i=await zn(e,n,e.builderPageComponentPath);i&&t.push({filePath:i,modifiedType:"update"})}return await eo(e,"**",n,"./components/builder-page.component"),t}async function ys(e){let t=[];t.push(...await Gn(e));let r="FigmaImportsPage",n="figma-imports.component",i=e.join(e.componentsDir,`${n}.${e.typescriptEnabled?"ts":"js"}`);if(!await e.exists(i)){let a=await e.formatCode(i,Ss(e,r,i,"figma-imports","figma-imports",!1));await e.writeFile(i,a),t.push({filePath:i,modifiedType:"create"})}if(e.hasAppModule){let a=await zn(e,r,i);a&&t.push({filePath:a,modifiedType:"update"})}return await eo(e,"figma-imports",r,`./components/${n}`),await Es(e),t}async function Gn(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Jp(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}async function Wp(e,t){let n=(await We(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);n&&await We(e,n.id,!0,!1,null,null,!0,!1)}function Ss(e,t,r,n,i,a){let o=!e.hasAppModule,s=L(e,r,e.registryPath),u=e.join(e.getAppRootDir(),"src","environments","environment.ts"),l=L(e,r,u),c=a?` <ng-container *ngIf="content || isPreviewing; else notFound">
1036
+ `.trimStart(),o=await e.formatCode(t,a);return await e.writeFile(t,o),"create"}return null}var Un="builderApiKey";async function Ha(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(Cp(e,a.fileName)||o.startsWith(".")||o==="node_modules"||gp.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await Kn(e,i,s,a);r.push(...u)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var gp=new Set([]),hp=new Set(["node_modules"]);function Cp(e,t){for(let r of hp)if(e.dirname(t).includes(r))return!0;return!1}async function Qa(e,t){let r=e.extname(t).toLowerCase();if(r===".tsx"||r===".jsx"||r===".ts"||r===".js"){let n=await e.readFile(t);if(n)return xp(e,t,n)}return null}function xp(e,t,r){let n=N(e,r);return Kn(e,null,t,n)}async function Kn(e,t,r,n){let i=[],a={};r=e.normalize(r);let o=n.statements.filter(c=>e.ts.isClassDeclaration(c)&&vp(e,c)),s=n.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(f=>(f.propertyName??f.name).text==="input");p&&(a.inputSignalImportName=p.name.text)}}let u=await Fp(e,t,r,n),l=wp(e,n);return await Promise.all(o.map(async c=>{let p=await Ep(e,t,r,c,l,a);i.push(...p)})),i.push(...u),i}async function Hr(e,t,r){if(t.node.fnNode){let{sourceFile:n,typeChecker:i}=await Bt(e,t.cmpInfo.filePath,r),o=(await Kn(e,i,t.cmpInfo.filePath,n)).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 Ya(e,t,r){let n=await ee(e,r.map(o=>o.filePath)),i=n.getTypeChecker();return await Promise.all(r.filter(o=>!(o.name.endsWith("Page")||o.name.endsWith("Module")||o.name==="AppComponent")).map(async o=>{if(!o.isRegistered){let s=n.getSourceFile(o.filePath);if(s){let l=(await Kn(e,i,o.filePath,s)).find(c=>c.cmpInfo.id===o.id);if(l){o.inputs=Ft(e,i,l.node.fnNode);let c=t.find(p=>p.cmpInfo.id===o.id);if(c){let p=await Hr(e,c,n);Fe(o,p)}}}}return o}))}async function Ep(e,t,r,n,i,a){let o=[],s=e.relative(e.getAppRootDir(),r),u=K(e,r),l=n.name?.text;if(!l)return o;let c=!1;n.modifiers&&(c=n.modifiers.some(D=>D.kind===e.ts.SyntaxKind.DefaultKeyword));let p=c?"default":l,f=c?"default":"named",h=[];return n.members.forEach(D=>{if(e.ts.isPropertyDeclaration(D)||e.ts.isGetAccessor(D)||e.ts.isSetAccessor(D)){let m=(e.ts.getDecorators(D)??[]).find(x=>yp(e,x))!==void 0&&e.ts.isIdentifier(D.name),E=a?.inputSignalImportName!==void 0&&e.ts.isIdentifier(D.name)&&Sp(e,D,a.inputSignalImportName);if(m||E){let x="any";if(e.ts.isSetAccessor(D))x=Ga(e,D.parameters[0].type);else if(D.type&&t){let S=t.getTypeAtLocation(D.type);x=t.typeToString(S)}else x=Ga(e,D.type);let v={name:D.name.text,type:i[x]?"string":x};i[x]&&(v.enum=i[x]),h.push(v)}}}),o.push({cmpInfo:{id:await z(e,r,l),displayFilePath:j(e,r),name:q(l),inputs:h,exportName:p,exportType:f,importName:l,filePath:r,relFilePath:s,importPath:u,meta:{...Ap(e,n)},framework:"angular"},node:{name:l,fnNode:n,deps:void 0}}),o}async function Fp(e,t,r,n){let i=[],a=e.relative(e.getAppRootDir(),r),o=K(e,r);for(let s of n.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",f=[];if(t){let d=t.getSymbolAtLocation(u.name);if(d){let g=t.getDeclaredTypeOfSymbol(d);t.getPropertiesOfType(g).forEach(E=>{let x=E.getDeclarations();x&&x.forEach(v=>{if(e.ts.isPropertyDeclaration(v)){let S=t.getTypeAtLocation(v),y={name:E.getName(),type:bp(e,t,S)};f.push(y)}})})}}let h=e.ts.isExportSpecifier(u)&&u.parent?u.parent.parent:void 0,D;if(h){let d=h.moduleSpecifier;if(d&&e.ts.isStringLiteral(d)){let g=t?.getSymbolAtLocation(d);if(g&&g.declarations&&g.declarations.length>0){let m=g.declarations[0];(!e.ts.isSourceFile(m)||e.ts.isSourceFile(m)&&m.fileName.includes("node_modules"))&&(D=d.text)}}}i.push({cmpInfo:{id:await z(e,r,l,D),displayFilePath:j(e,r),name:q(l),inputs:f,exportName:c,exportType:p,importName:l,filePath:r,relFilePath:a,importPath:D||o,externalImportPath:D,framework:"angular"},node:{name:l,fnNode:u,deps:void 0}})}return i}function yp(e,t){return Xa(e,t,"Input")}function Sp(e,t,r){return e.ts.isPropertyDeclaration(t)&&t.initializer!==void 0&&e.ts.isCallExpression(t.initializer)&&e.ts.isIdentifier(t.initializer.expression)&&t.initializer.expression.text===r}function Xa(e,t,r){if(e.ts.isCallExpression(t.expression)){let n=t.expression;if(e.ts.isIdentifier(n.expression))return n.expression?.text===r}return!1}function vp(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 Ga(e,t){if(!t)return"any";let r="any";switch(t.kind){case e.ts.SyntaxKind.StringKeyword:r="string";break;case e.ts.SyntaxKind.NumberKeyword:r="number";break;case e.ts.SyntaxKind.BooleanKeyword:r="boolean";break;case e.ts.SyntaxKind.TypeReference:e.ts.isTypeReferenceNode(t)&&e.ts.isIdentifier(t.typeName)&&(r=t.typeName.text);break}return r.includes("|")?"string":r}function wp(e,t){let r={};return e.ts.forEachChild(t,n=>{e.ts.isTypeAliasDeclaration(n)&&e.ts.isUnionTypeNode(n.type)&&n.type.types.every(i=>e.ts.isLiteralTypeNode(i)&&e.ts.isStringLiteral(i.literal))&&(r[n.name.text]=n.type.types.map(i=>i.literal.text))}),r}function bp(e,t,r){let n=t.typeToString(r);if(n==="any"){let i=r.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&&(n=t.typeToString(t.getTypeAtLocation(s)))}}}}return n}function Ap(e,t){let{getDecorators:r,isCallExpression:n,isIdentifier:i,isObjectLiteralExpression:a,isPropertyAssignment:o,isStringLiteral:s,SyntaxKind:u}=e.ts,l,c;return r(t)?.forEach(f=>{if(Xa(e,f,"Component")){let{expression:h}=f;if(n(h)){let[D]=h.arguments;a(D)&&D.properties.forEach(d=>{o(d)&&i(d.name)&&(d.name.escapedText==="selector"&&s(d.initializer)&&(l=d.initializer.text),d.name.escapedText==="standalone"&&(c=d.initializer.kind===u.TrueKeyword))})}}}),{selector:l,standalone:c}}async function zn(e,t,r){let n=e.typescriptEnabled?".ts":".js",i=`app.module${n}`,a=e.join(e.appDir,i),o=await e.readFile(a);if(!o){e.Sentry?.captureException(new Error(`Unable to read app.module.${n} at ${a}`),{extra:{appModuleCode:o,appModulePath:a}});return}let s=await Pp(e,a,t,r,o);if(!s){e.Sentry?.captureException(new Error(`Unable to update app.module.${n} at ${a}`),{extra:{appModuleCode:o,appModulePath:a}});return}return await e.writeFile(a,s),a}async function Pp(e,t,r,n,i){let a=i,o=N(e,i),s=L(e,t,n);o=k(e,o,{namedImports:[r],importPath:s}),o=k(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=Tp(e,r,l);u.push(c)}else u.push(l);return o=e.ts.factory.updateSourceFile(o,u),a=ne(e,o),a}function Tp(e,t,r){let n=e.ts.getDecorators(r);if(n){for(let i of n)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=Za(e,a[0],"declarations",t);if(o){let s=Za(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=[...n.map(p=>p===i?u:p),...e.ts.getModifiers(r)||[]];return e.ts.factory.updateClassDeclaration(r,c,r.name,r.typeParameters,r.heritageClauses,r.members)}}}}}return r}function Za(e,t,r,n){let i=[...t.properties],a=i.findIndex(s=>M(e,s)===r);if(a>-1){let s=i[a];if(e.ts.isPropertyAssignment(s)&&s.initializer&&e.ts.isArrayLiteralExpression(s.initializer)){let u=es(e,s.initializer,n);return u?(i[a]=e.ts.factory.updatePropertyAssignment(s,s.name,u),e.ts.factory.updateObjectLiteralExpression(t,i)):null}return null}let o=es(e,e.ts.factory.createArrayLiteralExpression([],!0),n);return o?e.ts.factory.updateObjectLiteralExpression(t,[...i,e.ts.factory.createPropertyAssignment(r,o)]):null}function es(e,t,r){return t.elements.some(i=>e.ts.isIdentifier(i)?i.text===r:!1)?null:e.ts.factory.updateArrayLiteralExpression(t,[...t.elements,e.ts.factory.createIdentifier(r)])}async function Qr(e,t,r,n){let a=`app.routes${e.typescriptEnabled?".ts":".js"}`,o=e.join(e.appDir,a);try{if(e.magicast){let 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(f=>f.path===t))return;let p=e.magicast.builders.raw("{}");if(p.path=t,p.component=e.magicast.builders.raw(r),c.push(p),s.imports.$items.find(f=>f.imported===r))return;s.imports.$append({imported:r,from:n}),await e.magicast.writeFile(s,o)}}catch(s){let u=null;try{u=e.readFileSync(o)}catch(l){e.Sentry?.captureException(l,{level:"warning"})}e.Sentry?.captureException(s,{extra:{content:u,appRoutesPath:o,componentName:r,componentPath:n}})}}var ms=I(ps(),1);async function fs(e){let t=e.ts.findConfigFile(e.getAppRootDir(),e.existsSync);if(t){let r=await e.readFile(t);if(!r)return;let n=ms.default.parse(r);if(!n||typeof n!="object"||Array.isArray(n))return;let i=n.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(n,null,2))}}async function ds(e){let t=[],r=await Mp(e,t);t.push(...await Hn(e)),await _p(e,r);let n="BuilderPage";if(!await e.exists(e.builderPageComponentPath)){let i=await e.formatCode(e.builderPageComponentPath,gs(e,n,e.builderPageComponentPath,"builder-page","page",!0));await e.writeFile(e.builderPageComponentPath,i),t.push({filePath:e.builderPageComponentPath,modifiedType:"create"})}if(e.hasAppModule){await zn(e,"Counter",r);let i=await zn(e,n,e.builderPageComponentPath);i&&t.push({filePath:i,modifiedType:"update"})}return await Qr(e,"**",n,"./components/builder-page.component"),t}async function Ds(e){let t=[];t.push(...await Hn(e));let r="FigmaImportsPage",n="figma-imports.component",i=e.join(e.componentsDir,`${n}.${e.typescriptEnabled?"ts":"js"}`);if(!await e.exists(i)){let a=await e.formatCode(i,gs(e,r,i,"figma-imports","figma-imports",!1));await e.writeFile(i,a),t.push({filePath:i,modifiedType:"create"})}if(e.hasAppModule){let a=await zn(e,r,i);a&&t.push({filePath:a,modifiedType:"update"})}return await Qr(e,"figma-imports",r,`./components/${n}`),await fs(e),t}async function Hn(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,jp(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}async function _p(e,t){let n=(await He(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);n&&await He(e,n.id,!0,!1,null,null,!0,!1)}function gs(e,t,r,n,i,a){let o=!e.hasAppModule,s=L(e,r,e.registryPath),u=e.join(e.getAppRootDir(),"src","environments","environment.ts"),l=L(e,r,u),c=a?` <ng-container *ngIf="content || isPreviewing; else notFound">
1033
1037
  <builder-content
1034
1038
  [model]="model"
1035
1039
  [content]="content"
@@ -1095,12 +1099,12 @@ export class ${t} {
1095
1099
  }
1096
1100
  }
1097
1101
 
1098
- `.trimStart()}function Jp(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-angular";
1102
+ `.trimStart()}function jp(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-angular";
1099
1103
 
1100
1104
  export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
1101
1105
  ];`:`export const CUSTOM_COMPONENTS = [
1102
1106
  ];
1103
- `}async function Hp(e,t){let n=e.typescriptEnabled?"ts":"js",i=e.join(e.componentsDir,`counter.component.${n}`),a=await e.exists(i);e.debug(`angularEnsureCounterComponent, hasCounterCmp: ${a}`);let o=Gp(e);if(!a){let s=await e.formatCode(i,o);await e.writeFile(i,s),t.push({filePath:i,modifiedType:"create"})}return i}function Gp(e){return`
1107
+ `}async function Mp(e,t){let n=e.typescriptEnabled?"ts":"js",i=e.join(e.componentsDir,`counter.component.${n}`),a=await e.exists(i);e.debug(`angularEnsureCounterComponent, hasCounterCmp: ${a}`);let o=Vp(e);if(!a){let s=await e.formatCode(i,o);await e.writeFile(i,s),t.push({filePath:i,modifiedType:"create"})}return i}function Vp(e){return`
1104
1108
  import { Component, Input } from '@angular/core';
1105
1109
 
1106
1110
  @Component({
@@ -1168,31 +1172,27 @@ export class Counter {
1168
1172
  }
1169
1173
  }
1170
1174
 
1171
- `.trimStart()}async function vs(e){await Gn(e);let t=await e.readFile(e.registryPath);return t?Qp(e,t):{components:[],sourceFile:N(e,"")}}async function Qp(e,t){let r=N(e,t);return Yp(e,r)}async function Yp(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await lo(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:me(r)}}async function lo(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],framework:"angular"};for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(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;n.name===""&&(n.name=q(o)),n.importName=o;let u=await Le(e,e.registryPath,t,o);if(!u)continue;if(n.filePath=u.filePath,n.relFilePath=u.relFilePath,await e.exists(u.filePath)?n.importPath=K(e,u.filePath):(n.externalImportPath=u.importPath,n.importPath=n.externalImportPath),n.displayFilePath=u.displayFilePath,n.exportType=u.exportType,n.externalImportPath)n.exportName=o;else{let l=await rs(e,u.filePath);if(l&&l.length>0)if(l.length===1)n.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(n.exportName=c.cmpInfo.exportName)}}continue}}return n=fe(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}async function We(e,t,r,n,i,a,o,s){let u=await ut(e),[l,c,p]=await Promise.all([ns(e,u),vs(e),mn(e)]),f=l.map(E=>E.cmpInfo),h=c.components,D={components:be(f,h),registryPath:e.registryPath,registryDisplayPath:M(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Oe(f),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return D.components=await os(e,l,D.components),D;let d=!1,g=c.sourceFile,m=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(m.length>0){let E=m.map(S=>{let y=l.find(B=>B.cmpInfo.id===S);if(!y)throw new Error(`Component ${S} not found`);return y}),x=Array.from(new Set(E.map(S=>S.cmpInfo.filePath))),v=await ee(e,x);for(let S of E){let y=D.components.find(V=>V.id===S.cmpInfo.id),B=await Zr(e,S,v);xe(y,B);let $=f.findIndex(V=>V.id===S.cmpInfo.id);f[$].inputs=B;let _=Ve(S.cmpInfo.id,f,h,r,n,i,a),{elements:w,elmIndex:A,statementIndex:ue,statement:ve,variableDeclaration:ie}=await Zp(e,g,S);if(_.addCmpToRegistry)w.push(Xp(e,_.addCmpToRegistry)),d=!0;else if(_.removeCmpFromRegistry)w.splice(A,1),d=!0;else if(_.updateRegisteredCmp){let V=te(e,w[A],_.updateRegisteredCmp);w[A]=e.ts.factory.updateObjectLiteralExpression(V,[ws(e,_.updateRegisteredCmp),...V.properties.slice(1)]),d=!0}if(d&&o){let V=[...g.statements];V[ue]=e.ts.factory.updateVariableStatement(ve,ve.modifiers,e.ts.factory.updateVariableDeclarationList(ve.declarationList,[e.ts.factory.updateVariableDeclaration(ie,ie.name,ie.exclamationToken,ie.type,e.ts.factory.createArrayLiteralExpression(Me(e,w)))])),g=e.ts.factory.updateSourceFile(g,V),y.exportType==="named"?g=k(e,g,{namedImports:[y.importName],importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}):g=k(e,g,{defaultImport:y.importName,importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}),g=k(e,g,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-angular",isTypeOnly:!0}),g=Ue(e,g,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),D.components=_.components,h=_.components.filter(le=>le.isRegistered)}}}if(d&&o){g=je(e,g),g=_e(e,g);let E=ne(e,g);E=Ae(E),E=await e.formatCode(e.registryPath,E),await e.writeFile(e.registryPath,E)}return D}function ws(e,t){let r=e.ts.factory.createIdentifier(t.importName);return e.ts.factory.createPropertyAssignment("component",r)}function Xp(e,t){return te(e,e.ts.factory.createObjectLiteralExpression([ws(e,t)],!0),t)}async function Zp(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await lo(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}async function As(e){let t=await em(e),r={};return{builderPageOptions:async()=>({templateContentId:"f0b8016ac92e474699293211a268ebaa",pathname:"/builder-demo",title:"Builder + Angular Demo Page"}),ensureBuilderSetup:()=>Fs(t),ensureFigmaImportPage:()=>ys(t),getRegistryPath:()=>t.registryPath,getRegistry:i=>We(t,null,!1,!1,null,null,!1,!!i?.readAllInputTypes),addExternalPackage:async i=>{r[i]||(r[i]=`export * from "${i}";`)},loadComponent:async i=>{let a=await We(t,i.cmpId,!1,!1,null,null,!1,!1);return{...a,component:a.components.find(o=>o.id===i.cmpId)}},registerComponent:i=>We(t,i.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:i=>We(t,i.cmpId,!1,!1,i,null,!0,!1),setRegisteredComponentInput:i=>We(t,i.cmpId,!1,!1,null,i,!0,!1),unregisterComponent:i=>We(t,i.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>mn(t),setPublicApiKey:i=>es(t,i.publicApiKey),getDependencies:i=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-angular"},{name:"concurrently"}],getDevRunCommand:()=>"builder-dev",getCache:()=>Ne(t),setCache:i=>ke(t,i)}}async function em(e){let t=await tm(e),r=e.getAppRootDir(),n=e.join(r,"src"),i=await he(e),a=e.join(n,"app"),o=await Fe(e,a),s={...e,srcDir:"",appDir:"",componentsDir:"",registryPath:o,angularConfigPath:t,typescriptEnabled:i,builderPageComponentPath:"",hasAppModule:!1};if(!await e.exists(n))throw new Error(`Could not find src directory. Searched for src in "${e.getAppRootDir()}".`);s.srcDir=n,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 tm(e){let t=e.join(e.getAppRootDir(),"angular.json");if(await e.exists(t))return t;let r=e.join(e.getAppRootDir(),"project.json");if(await e.exists(r))return r;throw new Error(`Could not find Angular config file. Searched for angular.json & project.json in "${e.getAppRootDir()}".`)}var tr=T(Ms(),1);async function js(e,t){let n={components:(await t.getRegistry()).components.filter(a=>a.isRegistered).map(a=>{let o={filePath:we(e.relative(e.getAppRootDir(),a.filePath)),name:a.name,image:a.image,description:a.description,exportName:a.exportName,inputs:ge(a.inputs)};return ge(o)}),version:1};e.debug("exporting registry components:",n.components.length);let i=(0,tr.compress)(n);return btoa(JSON.stringify(i))}async function Vs(e,t,r){if(typeof r!="string")throw new Error("Invalid registry to import");let n=await t.getRegistry(),i=JSON.parse(atob(r)),a=(0,tr.decompress)(i),o=ge(n);e.debug("importing registry components:",a.components.length);for(let s of a.components){let u=we(e.normalize(s.filePath)),l=n.components.find(p=>we(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=ge(c)}return o}var Te={react:"react",remix:"remix",angular:"angular",next:"next",qwik:"qwik"},Y0={[Te.react]:[{version:b.gen1,recommended:!0},{version:b.gen2,recommended:!1}],[Te.remix]:[{version:b.gen1,recommended:!1},{version:b.gen2,recommended:!0}],[Te.angular]:[{version:b.gen2,recommended:!0}],[Te.next]:[{version:b.gen1,recommended:!0},{version:b.gen2,recommended:!1}],[Te.qwik]:[{version:b.gen2,recommended:!0}]};async function Us(e,t){let r=[],n=new Set;async function i(a){let o=e.join(a,"package.json");try{if(!await e.exists(o))return null;let u=await e.readFile(o);if(u===null)throw new Error(`Failed to read package.json at ${o}`);let l=JSON.parse(u);if(n.has(l.name))return null;n.add(l.name);let c={name:l.name,subPackages:[]},p=await e.readdir(a);for(let f of p)f!=="node_modules"&&(await e.stat(e.join(a,f))).isDirectory()&&c.subPackages.push(f);return r.push(c),c}catch(s){return e.Sentry?.captureException(s),null}}try{let a=e.join(t,"package.json");if(await e.exists(a)){let s=await e.readFile(a);if(s!==null){let u=JSON.parse(s),l={...u.dependencies,...u.devDependencies};for(let c of Object.keys(l)){let p=e.join(t,"node_modules",c);await i(p)}if(u.workspaces)for(let c of u.workspaces){let p=await e.readdir(e.join(t,c));for(let f of p){let h=e.join(t,c,f);await i(h)}}}}}catch(a){e.Sentry?.captureException(a)}return r}var wm={"@builder.io/qwik-city":La,next:wa,"@remix-run/react":za,react:Za,"@angular/core":As},Am={"@builder.io/qwik-city":Te.qwik,next:Te.next,"@remix-run/react":Te.remix,react:Te.react,"@angular/core":Te.angular};async function nr(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 Bt(e)),e.frameworks.length===0)throw new Error("Supported Devtools framework for not found");for(let t of e.frameworks){let r=wm[t.name];if(r){let n=await r(e);return{...n,exportRegistry:()=>js(e,n),importRegistry:a=>Vs(e,n,a),framework:Am[t.name],findAllDependencies:async()=>await Us(e,e.getRepoRootDir())}}}throw new Error(`Devtools framework not found for ${e.getAppRootDir()}, ${JSON.stringify(e.frameworks,null,2)}`)}var Jx=`
1175
+ `.trimStart()}async function hs(e){await Hn(e);let t=await e.readFile(e.registryPath);return t?Up(e,t):{components:[],sourceFile:N(e,"")}}async function Up(e,t){let r=N(e,t);return Kp(e,r)}async function Kp(e,t){let r=[],n=X(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await io(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:De(r)}}async function io(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],framework:"angular"};for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(M(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;n.name===""&&(n.name=q(o)),n.importName=o;let u=await je(e,e.registryPath,t,o);if(!u)continue;if(n.filePath=u.filePath,n.relFilePath=u.relFilePath,await e.exists(u.filePath)?n.importPath=K(e,u.filePath):(n.externalImportPath=u.importPath,n.importPath=n.externalImportPath),n.displayFilePath=u.displayFilePath,n.exportType=u.exportType,n.externalImportPath)n.exportName=o;else{let l=await Qa(e,u.filePath);if(l&&l.length>0)if(l.length===1)n.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(n.exportName=c.cmpInfo.exportName)}}continue}}return n=ge(e,n,r),n.filePath&&n.exportName&&(n.id=await z(e,n.filePath,n.exportName,n.externalImportPath)),n}async function He(e,t,r,n,i,a,o,s){let u=await lt(e),[l,c,p]=await Promise.all([Ha(e,u),hs(e),dn(e)]),f=l.map(E=>E.cmpInfo),h=c.components,D={components:Be(f,h),registryPath:e.registryPath,registryDisplayPath:j(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:Me(f),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return D.components=await Ya(e,l,D.components),D;let d=!1,g=c.sourceFile,m=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(m.length>0){let E=m.map(S=>{let y=l.find(B=>B.cmpInfo.id===S);if(!y)throw new Error(`Component ${S} not found`);return y}),x=Array.from(new Set(E.map(S=>S.cmpInfo.filePath))),v=await ee(e,x);for(let S of E){let y=D.components.find(V=>V.id===S.cmpInfo.id),B=await Hr(e,S,v);Fe(y,B);let $=f.findIndex(V=>V.id===S.cmpInfo.id);f[$].inputs=B;let _=ze(S.cmpInfo.id,f,h,r,n,i,a),{elements:w,elmIndex:b,statementIndex:pe,statement:Pe,variableDeclaration:ie}=await qp(e,g,S);if(_.addCmpToRegistry)w.push(zp(e,_.addCmpToRegistry)),d=!0;else if(_.removeCmpFromRegistry)w.splice(b,1),d=!0;else if(_.updateRegisteredCmp){let V=te(e,w[b],_.updateRegisteredCmp);w[b]=e.ts.factory.updateObjectLiteralExpression(V,[Cs(e,_.updateRegisteredCmp),...V.properties.slice(1)]),d=!0}if(d&&o){let V=[...g.statements];V[pe]=e.ts.factory.updateVariableStatement(Pe,Pe.modifiers,e.ts.factory.updateVariableDeclarationList(Pe.declarationList,[e.ts.factory.updateVariableDeclaration(ie,ie.name,ie.exclamationToken,ie.type,e.ts.factory.createArrayLiteralExpression(Ue(e,w)))])),g=e.ts.factory.updateSourceFile(g,V),y.exportType==="named"?g=k(e,g,{namedImports:[y.importName],importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}):g=k(e,g,{defaultImport:y.importName,importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}),g=k(e,g,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-angular",isTypeOnly:!0}),g=qe(e,g,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),D.components=_.components,h=_.components.filter(me=>me.isRegistered)}}}if(d&&o){g=Ke(e,g),g=Ve(e,g);let E=ne(e,g);E=Ie(E),E=await e.formatCode(e.registryPath,E),await e.writeFile(e.registryPath,E)}return D}function Cs(e,t){let r=e.ts.factory.createIdentifier(t.importName);return e.ts.factory.createPropertyAssignment("component",r)}function zp(e,t){return te(e,e.ts.factory.createObjectLiteralExpression([Cs(e,t)],!0),t)}async function qp(e,t,r){let n=X(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await io(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}async function xs(e){let t=await Wp(e),r={};return{builderPageOptions:async()=>({templateContentId:"f0b8016ac92e474699293211a268ebaa",pathname:"/builder-demo",title:"Builder + Angular Demo Page"}),ensureBuilderSetup:()=>ds(t),ensureFigmaImportPage:()=>Ds(t),getRegistryPath:()=>t.registryPath,getRegistry:i=>He(t,null,!1,!1,null,null,!1,!!i?.readAllInputTypes),addExternalPackage:async i=>{r[i]||(r[i]=`export * from "${i}";`)},loadComponent:async i=>{let a=await He(t,i.cmpId,!1,!1,null,null,!1,!1);return{...a,component:a.components.find(o=>o.id===i.cmpId)}},registerComponent:i=>He(t,i.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:i=>He(t,i.cmpId,!1,!1,i,null,!0,!1),setRegisteredComponentInput:i=>He(t,i.cmpId,!1,!1,null,i,!0,!1),unregisterComponent:i=>He(t,i.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>dn(t),setPublicApiKey:i=>Ja(t,i.publicApiKey),getDependencies:i=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-angular"},{name:"concurrently"}],getDevRunCommand:()=>"builder-dev",getCache:()=>Le(t),setCache:i=>Oe(t,i)}}async function Wp(e){let t=await Jp(e),r=e.getAppRootDir(),n=e.join(r,"src"),i=await xe(e),a=e.join(n,"app"),o=await Se(e,a),s={...e,srcDir:"",appDir:"",componentsDir:"",registryPath:o,angularConfigPath:t,typescriptEnabled:i,builderPageComponentPath:"",hasAppModule:!1};if(!await e.exists(n))throw new Error(`Could not find src directory. Searched for src in "${e.getAppRootDir()}".`);s.srcDir=n,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 Jp(e){let t=e.join(e.getAppRootDir(),"angular.json");if(await e.exists(t))return t;let r=e.join(e.getAppRootDir(),"project.json");if(await e.exists(r))return r;if(e.ignoreMissingConfig)return"";throw new Error(`Could not find Angular config file. Searched for angular.json & project.json in "${e.getAppRootDir()}".`)}var Zn=I(Rs(),1);async function Ns(e,t){let n={components:(await t.getRegistry()).components.filter(a=>a.isRegistered).map(a=>{let o={filePath:Te(e.relative(e.getAppRootDir(),a.filePath)),name:a.name,image:a.image,description:a.description,exportName:a.exportName,inputs:Ce(a.inputs)};return Ce(o)}),version:1};e.debug("exporting registry components:",n.components.length);let i=(0,Zn.compress)(n);return btoa(JSON.stringify(i))}async function ks(e,t,r){if(typeof r!="string")throw new Error("Invalid registry to import");let n=await t.getRegistry(),i=JSON.parse(atob(r)),a=(0,Zn.decompress)(i),o=Ce(n);e.debug("importing registry components:",a.components.length);for(let s of a.components){let u=Te(e.normalize(s.filePath)),l=n.components.find(p=>Te(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=Ce(c)}return o}var Ne={react:"react",remix:"remix",angular:"angular",next:"next",qwik:"qwik"},V0={[Ne.react]:[{version:A.gen1,recommended:!0},{version:A.gen2,recommended:!1}],[Ne.remix]:[{version:A.gen1,recommended:!1},{version:A.gen2,recommended:!0}],[Ne.angular]:[{version:A.gen2,recommended:!0}],[Ne.next]:[{version:A.gen1,recommended:!0},{version:A.gen2,recommended:!1}],[Ne.qwik]:[{version:A.gen2,recommended:!0}]};async function $s(e,t){let r=[],n=new Set;async function i(a){let o=e.join(a,"package.json");try{if(!await e.exists(o))return null;let u=await e.readFile(o);if(u===null)throw new Error(`Failed to read package.json at ${o}`);let l=JSON.parse(u);if(n.has(l.name))return null;n.add(l.name);let c={name:l.name,subPackages:[]},p=await e.readdir(a);for(let f of p)f!=="node_modules"&&(await e.stat(e.join(a,f))).isDirectory()&&c.subPackages.push(f);return r.push(c),c}catch(s){return e.Sentry?.captureException(s,{level:"warning"}),null}}try{let a=e.join(t,"package.json");if(await e.exists(a)){let s=await e.readFile(a);if(s!==null){let u=JSON.parse(s),l={...u.dependencies,...u.devDependencies};for(let c of Object.keys(l)){let p=e.join(t,"node_modules",c);await i(p)}if(u.workspaces)for(let c of u.workspaces){let p=await e.readdir(e.join(t,c));for(let f of p){let h=e.join(t,c,f);await i(h)}}}}}catch(a){e.Sentry?.captureException(a,{level:"warning"})}return r}var hm={"@builder.io/qwik-city":Ta,next:Ca,"@remix-run/react":Oa,react:Wa,"@angular/core":xs},Cm={"@builder.io/qwik-city":Ne.qwik,next:Ne.next,"@remix-run/react":Ne.remix,react:Ne.react,"@angular/core":Ne.angular};async function er(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 Rt(e)),e.frameworks.length===0)throw new Error("Supported Devtools framework for not found");for(let t of e.frameworks){let r=hm[t.name];if(r)try{let n=await r(e);return{...n,exportRegistry:()=>Ns(e,n),importRegistry:a=>ks(e,n,a),framework:Cm[t.name],findAllDependencies:async()=>await $s(e,e.getRepoRootDir())}}catch(n){e.Sentry?.captureException(n,{level:"warning"})}}throw new Error(`Devtools framework not found for ${e.getAppRootDir()}, ${JSON.stringify(e.frameworks,null,2)}`)}var Ox=`
1172
1176
  /** @type {import('next').NextConfig} */
1173
1177
  const nextConfig = {
1174
1178
  }
1175
1179
 
1176
1180
  module.exports = nextConfig
1177
- `.trimStart();var Ks=T(require("@sentry/node"),1),zs=T(require("@amplitude/analytics-node"),1);async function pt(e){if(process.env.NODE_ENV!=="test")try{await Promise.allSettled([Ks.flush(2e3),zs.flush().promise])}catch(t){console.error(t)}process.exit(e)}var Cn=process.env.AIR_HOST||"https://ai.builder.io";var zt=T(require("@amplitude/analytics-node"),1),xn=T(require("@sentry/node"),1);var qs=T(require("crypto")),or=new Uint8Array(256),rr=or.length;function vo(){return rr>or.length-16&&(qs.default.randomFillSync(or),rr=0),or.slice(rr,rr+=16)}var ae=[];for(let e=0;e<256;++e)ae.push((e+256).toString(16).slice(1));function Ws(e,t=0){return ae[e[t+0]]+ae[e[t+1]]+ae[e[t+2]]+ae[e[t+3]]+"-"+ae[e[t+4]]+ae[e[t+5]]+"-"+ae[e[t+6]]+ae[e[t+7]]+"-"+ae[e[t+8]]+ae[e[t+9]]+"-"+ae[e[t+10]]+ae[e[t+11]]+ae[e[t+12]]+ae[e[t+13]]+ae[e[t+14]]+ae[e[t+15]]}var Js=T(require("crypto")),wo={randomUUID:Js.default.randomUUID};function bm(e,t,r){if(wo.randomUUID&&!t&&!e)return wo.randomUUID();e=e||{};let n=e.random||(e.rng||vo)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Ws(n)}var Ao=bm;async function ar(e,t){let r={...t,app:"dev-tools-cli",package:"cli"},n=await Pm(),i=await Tm();return await zt.track(e,r,{user_id:n,device_id:i}).promise}var ir,bo;async function Hs(e){ir=e;let t=await Rt();await wr({...t,userId:e})}async function Pm(){if(ir)return ir;let e=await Rt(),t;return vr(e,"userId")&&(t=e.userId),ir=t,t}async function Tm(){if(bo)return bo;let e=await Rt(),t=Ao();return vr(e,"deviceId")?t=e.deviceId:await wr({...e,deviceId:t}),bo=t,t}var Qs=T(He(),1),Ys=require("undici");var Xs=T(He(),1);var Gs="0.0.1";var Po=T(require("node:process"),1),mt=async(e,t)=>{let r="fetch"in globalThis?globalThis.fetch:Ys.fetch;try{let n=await r(e,{...t,headers:{...t?.headers,...Bm()}});if(!n.ok)if(n.status===429){let i=await n.json(),a=i.severity??"high",o=i.message??"Rate limit exceeded. Please try again later.";return console.log(),a==="high"?n.error((0,Qs.red)(`${n.status} ${o}
1178
-
1179
- `)):n.warn((0,Xs.yellow)(`${n.status} ${o}
1180
-
1181
- `)),await pt(1)}else throw new Error(`Failed to generate completion:
1182
- `+await n.text());return n}catch(n){let i=typeof e=="string"?e:e instanceof URL?e.toString():e.url,a=t?.method||"GET",o=n instanceof Error?n.message:String(n),s=new Error(`Fetch failed for ${a} ${i}: ${o}`);throw n instanceof Error&&(s.cause=n),s.requestContext={url:i,method:a,headers:t?.headers},s}};function Bm(){let t={darwin:"Macintosh",win32:"Windows NT",linux:"Linux",android:"Android",ios:"iPhone"}[Po.default.platform]||"Unknown",r=Po.default.platform==="win32"?"10.0":"";return{"User-Agent":`Mozilla/5.0 (${t}${r?"; "+r:""}) builder-cli/${Gs}`,"Sec-Ch-Ua-Platform":t}}var qt=process.env.OVERRIDE_VERSION??"1.6.10";var Zs=T(require("@sentry/node"),1);var Rm=T(require("@sentry/node"),1);var Nm=/[^\x00-\x7F]/g;function eu(e){return e=e.replace(Nm,""),e=e.replace(/[\W\d]/g," "),e=e.trim(),e=km(e),e=e.charAt(0).toUpperCase()+e.slice(1),e}function km(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,function(t,r){return r===0?t.toLowerCase():t.toUpperCase()}).replace(/\s+/g,"")}var _m=require("glob");var $m=T(require("prettier"),1);var Mm=T(require("chokidar"),1),jm=T(require("ignore"),1);function Ie(){}Ie.prototype={diff:function(t,r){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={});var o=this;function s(v){return v=o.postProcess(v,i),a?(setTimeout(function(){a(v)},0),!0):v}t=this.castInput(t,i),r=this.castInput(r,i),t=this.removeEmpty(this.tokenize(t,i)),r=this.removeEmpty(this.tokenize(r,i));var u=r.length,l=t.length,c=1,p=u+l;i.maxEditLength!=null&&(p=Math.min(p,i.maxEditLength));var f=(n=i.timeout)!==null&&n!==void 0?n:1/0,h=Date.now()+f,D=[{oldPos:-1,lastComponent:void 0}],d=this.extractCommon(D[0],r,t,0,i);if(D[0].oldPos+1>=l&&d+1>=u)return s(nu(o,D[0].lastComponent,r,t,o.useLongestToken));var g=-1/0,m=1/0;function E(){for(var v=Math.max(g,-c);v<=Math.min(m,c);v+=2){var S=void 0,y=D[v-1],B=D[v+1];y&&(D[v-1]=void 0);var $=!1;if(B){var _=B.oldPos-v;$=B&&0<=_&&_<u}var w=y&&y.oldPos+1<l;if(!$&&!w){D[v]=void 0;continue}if(!w||$&&y.oldPos<B.oldPos?S=o.addToPath(B,!0,!1,0,i):S=o.addToPath(y,!1,!0,1,i),d=o.extractCommon(S,r,t,v,i),S.oldPos+1>=l&&d+1>=u)return s(nu(o,S.lastComponent,r,t,o.useLongestToken));D[v]=S,S.oldPos+1>=l&&(m=Math.min(m,v-1)),d+1>=u&&(g=Math.max(g,v+1))}c++}if(a)(function v(){setTimeout(function(){if(c>p||Date.now()>h)return a();E()||v()},0)})();else for(;c<=p&&Date.now()<=h;){var x=E();if(x)return x}},addToPath:function(t,r,n,i,a){var o=t.lastComponent;return o&&!a.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}},extractCommon:function(t,r,n,i,a){for(var o=r.length,s=n.length,u=t.oldPos,l=u-i,c=0;l+1<o&&u+1<s&&this.equals(n[u+1],r[l+1],a);)l++,u++,c++,a.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return c&&!a.oneChangePerToken&&(t.lastComponent={count:c,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=u,l},equals:function(t,r,n){return n.comparator?n.comparator(t,r):t===r||n.ignoreCase&&t.toLowerCase()===r.toLowerCase()},removeEmpty:function(t){for(var r=[],n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r},castInput:function(t){return t},tokenize:function(t){return Array.from(t)},join:function(t){return t.join("")},postProcess:function(t){return t}};function nu(e,t,r,n,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,u=a.length,l=0,c=0;s<u;s++){var p=a[s];if(p.removed)p.value=e.join(n.slice(c,c+p.count)),c+=p.count;else{if(!p.added&&i){var f=r.slice(l,l+p.count);f=f.map(function(h,D){var d=n[c+D];return d.length>h.length?d:h}),p.value=e.join(f)}else p.value=e.join(r.slice(l,l+p.count));l+=p.count,p.added||(c+=p.count)}}return a}var aF=new Ie;function ru(e,t){var r;for(r=0;r<e.length&&r<t.length;r++)if(e[r]!=t[r])return e.slice(0,r);return e.slice(0,r)}function ou(e,t){var r;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(r=0;r<e.length&&r<t.length;r++)if(e[e.length-(r+1)]!=t[t.length-(r+1)])return e.slice(-r);return e.slice(-r)}function Io(e,t,r){if(e.slice(0,t.length)!=t)throw Error("string ".concat(JSON.stringify(e)," doesn't start with prefix ").concat(JSON.stringify(t),"; this is a bug"));return r+e.slice(t.length)}function Bo(e,t,r){if(!t)return e+r;if(e.slice(-t.length)!=t)throw Error("string ".concat(JSON.stringify(e)," doesn't end with suffix ").concat(JSON.stringify(t),"; this is a bug"));return e.slice(0,-t.length)+r}function En(e,t){return Io(e,t,"")}function ur(e,t){return Bo(e,t,"")}function iu(e,t){return t.slice(0,Vm(e,t))}function Vm(e,t){var r=0;e.length>t.length&&(r=e.length-t.length);var n=t.length;e.length<t.length&&(n=e.length);var i=Array(n),a=0;i[0]=0;for(var o=1;o<n;o++){for(t[o]==t[a]?i[o]=i[a]:i[o]=a;a>0&&t[o]!=t[a];)a=i[a];t[o]==t[a]&&a++}a=0;for(var s=r;s<e.length;s++){for(;a>0&&e[s]!=t[a];)a=i[a];e[s]==t[a]&&a++}return a}var lr="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Um=new RegExp("[".concat(lr,"]+|\\s+|[^").concat(lr,"]"),"ug"),cr=new Ie;cr.equals=function(e,t,r){return r.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()};cr.tokenize=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(t.intlSegmenter){if(t.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(t.intlSegmenter.segment(e),function(a){return a.segment})}else r=e.match(Um)||[];var n=[],i=null;return r.forEach(function(a){/\s/.test(a)?i==null?n.push(a):n.push(n.pop()+a):/\s/.test(i)?n[n.length-1]==i?n.push(n.pop()+a):n.push(i+a):n.push(a),i=a}),n};cr.join=function(e){return e.map(function(t,r){return r==0?t:t.replace(/^\s+/,"")}).join("")};cr.postProcess=function(e,t){if(!e||t.oneChangePerToken)return e;var r=null,n=null,i=null;return e.forEach(function(a){a.added?n=a:a.removed?i=a:((n||i)&&au(r,i,n,a),r=a,n=null,i=null)}),(n||i)&&au(r,i,n,null),e};function au(e,t,r,n){if(t&&r){var i=t.value.match(/^\s*/)[0],a=t.value.match(/\s*$/)[0],o=r.value.match(/^\s*/)[0],s=r.value.match(/\s*$/)[0];if(e){var u=ru(i,o);e.value=Bo(e.value,o,u),t.value=En(t.value,u),r.value=En(r.value,u)}if(n){var l=ou(a,s);n.value=Io(n.value,s,l),t.value=ur(t.value,l),r.value=ur(r.value,l)}}else if(r)e&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(e&&n){var c=n.value.match(/^\s*/)[0],p=t.value.match(/^\s*/)[0],f=t.value.match(/\s*$/)[0],h=ru(c,p);t.value=En(t.value,h);var D=ou(En(c,h),f);t.value=ur(t.value,D),n.value=Io(n.value,c,D),e.value=Bo(e.value,c,c.slice(0,c.length-D.length))}else if(n){var d=n.value.match(/^\s*/)[0],g=t.value.match(/\s*$/)[0],m=iu(g,d);t.value=ur(t.value,m)}else if(e){var E=e.value.match(/\s*$/)[0],x=t.value.match(/^\s*/)[0],v=iu(E,x);t.value=En(t.value,v)}}var Km=new Ie;Km.tokenize=function(e){var t=new RegExp("(\\r?\\n)|[".concat(lr,"]+|[^\\S\\n\\r]+|[^").concat(lr,"]"),"ug");return e.match(t)||[]};var $o=new Ie;$o.tokenize=function(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1183
- `));var r=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var i=0;i<n.length;i++){var a=n[i];i%2&&!t.newlineIsToken?r[r.length-1]+=a:r.push(a)}return r};$o.equals=function(e,t,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
1184
- `))&&(e=e.trim()),(!r.newlineIsToken||!t.includes(`
1185
- `))&&(t=t.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
1186
- `)&&(e=e.slice(0,-1)),t.endsWith(`
1187
- `)&&(t=t.slice(0,-1))),Ie.prototype.equals.call(this,e,t,r)};var zm=new Ie;zm.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var qm=new Ie;qm.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Ro(e){"@babel/helpers - typeof";return Ro=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ro(e)}var Fn=new Ie;Fn.useLongestToken=!0;Fn.tokenize=$o.tokenize;Fn.castInput=function(e,t){var r=t.undefinedReplacement,n=t.stringifyReplacer,i=n===void 0?function(a,o){return typeof o>"u"?r:o}:n;return typeof e=="string"?e:JSON.stringify(No(e,null,null,i),i," ")};Fn.equals=function(e,t,r){return Ie.prototype.equals.call(Fn,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"),r)};function No(e,t,r,n,i){t=t||[],r=r||[],n&&(e=n(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return r[a];var o;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),o=new Array(e.length),r.push(o),a=0;a<e.length;a+=1)o[a]=No(e[a],t,r,n,i);return t.pop(),r.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),Ro(e)==="object"&&e!==null){t.push(e),o={},r.push(o);var s=[],u;for(u in e)Object.prototype.hasOwnProperty.call(e,u)&&s.push(u);for(s.sort(),a=0;a<s.length;a+=1)u=s[a],o[u]=No(e[u],t,r,n,u);t.pop(),r.pop()}else o=e;return o}var ko=new Ie;ko.tokenize=function(e){return e.slice()};ko.join=ko.removeEmpty=function(e){return e};var Lo=T(require("node:process"),1);function Oo(){let{env:e}=Lo.default,{TERM:t,TERM_PROGRAM:r}=e;return Lo.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var _o=T(He(),1),rt=T(Bn(),1),pr=require("node:process"),ft=T(require("node:readline"),1),yn=T(He(),1),mr=()=>{let e=Mo?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=Mo?80:120,r,n,i=!1,a="",o="",s="",u=m=>{let E=m>1?"Something went wrong":"Canceled";i&&D(E,m)},l=(m,E)=>{console.error(E,m),u(2)},c=()=>u(1),p=()=>{process.on("uncaughtExceptionMonitor",l),process.on("unhandledRejection",l),process.on("SIGINT",c),process.on("SIGTERM",c),process.on("exit",u)},f=()=>{process.removeListener("uncaughtExceptionMonitor",l),process.removeListener("unhandledRejection",l),process.removeListener("SIGINT",c),process.removeListener("SIGTERM",c),process.removeListener("exit",u)},h=(m="")=>{i=!0,r=Ym(),a=m.replace(/\.+$/,""),process.stdout.write(`${_o.default.gray(Wm)}
1188
- `);let E=0,x=0;p(),process.env.CI||(n=setInterval(()=>{let v=_o.default.magenta(e[E]),S=".".repeat(Math.floor(x)).slice(0,3);process.stdout.write(rt.cursor.move(-999,-s.split(`
1189
- `).length+1)),process.stdout.write(rt.erase.down(s.split(`
1190
- `).length));let y=`${v} ${a}${S}${o}`;process.stdout.write(y),E=E+1<e.length?E+1:0,x=x<e.length?x+.125:0,s=y},t))},D=(m,E=0)=>{a=m??a,i=!1,clearInterval(n);let x=E===0?(0,yn.green)(Gm):E===1?(0,yn.red)(Jm):(0,yn.red)(Hm);process.stdout.write(rt.cursor.move(-999,-s.split(`
1191
- `).length+1)),process.stdout.write(rt.erase.down(s.split(`
1181
+ `.trimStart();var Ls=I(require("@sentry/node"),1),Os=I(require("@amplitude/analytics-node"),1);async function ft(e){if(process.env.NODE_ENV!=="test")try{await Promise.allSettled([Ls.flush(2e3),Os.flush().promise])}catch(t){console.error(t)}process.exit(e)}var xn=process.env.AIR_HOST||"https://ai.builder.io";var Wt=I(require("@amplitude/analytics-node"),1),En=I(require("@sentry/node"),1);var ae=[];for(let e=0;e<256;++e)ae.push((e+256).toString(16).slice(1));function _s(e,t=0){return(ae[e[t+0]]+ae[e[t+1]]+ae[e[t+2]]+ae[e[t+3]]+"-"+ae[e[t+4]]+ae[e[t+5]]+"-"+ae[e[t+6]]+ae[e[t+7]]+"-"+ae[e[t+8]]+ae[e[t+9]]+"-"+ae[e[t+10]]+ae[e[t+11]]+ae[e[t+12]]+ae[e[t+13]]+ae[e[t+14]]+ae[e[t+15]]).toLowerCase()}var js=I(require("crypto")),nr=new Uint8Array(256),tr=nr.length;function yo(){return tr>nr.length-16&&(js.default.randomFillSync(nr),tr=0),nr.slice(tr,tr+=16)}var Ms=I(require("crypto")),So={randomUUID:Ms.default.randomUUID};function xm(e,t,r){if(So.randomUUID&&!t&&!e)return So.randomUUID();e=e||{};let n=e.random||(e.rng||yo)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return _s(n)}var vo=xm;async function or(e,t){let r={...t,app:"dev-tools-cli",package:"cli"},n=await Em(),i=await Fm();return await Wt.track(e,r,{user_id:n,device_id:i}).promise}var rr,wo;async function Vs(e){rr=e;let t=await Nt();await Fr({...t,userId:e})}async function Em(){if(rr)return rr;let e=await Nt(),t;return Er(e,"userId")&&(t=e.userId),rr=t,t}async function Fm(){if(wo)return wo;let e=await Nt(),t=vo();return Er(e,"deviceId")?t=e.deviceId:await Fr({...e,deviceId:t}),wo=t,t}var Ks=I(Ye(),1),zs=require("undici");var qs=I(Ye(),1);var Us="0.0.0";var bo=I(require("process"),1),At=async(e,t)=>{let r="fetch"in globalThis?globalThis.fetch:zs.fetch;try{let n=await r(e,{...t,headers:{...t?.headers,...Sm()}});if(!n.ok)if(n.status===429){let i=await n.json(),a=i.severity??"high",o=i.message??"Rate limit exceeded. Please try again later.";return console.log(),a==="high"?n.error((0,Ks.red)(`${n.status} ${o}
1182
+
1183
+ `)):n.warn((0,qs.yellow)(`${n.status} ${o}
1184
+
1185
+ `)),await ft(1)}else throw new Error(`Failed to generate completion:
1186
+ `+await n.text());return n}catch(n){let i=typeof e=="string"?e:e instanceof URL?e.toString():e.url,a=t?.method||"GET",o=n instanceof Error?n.message:String(n),s=new Error(`Fetch failed for ${a} ${i}: ${o}`);throw n instanceof Error&&(s.cause=n),s.requestContext={url:i,method:a,headers:t?.headers},s}};function Sm(){let t={darwin:"Macintosh",win32:"Windows NT",linux:"Linux",android:"Android",ios:"iPhone"}[bo.default.platform]||"Unknown",r=bo.default.platform==="win32"?"10.0":"";return{"User-Agent":`Mozilla/5.0 (${t}${r?"; "+r:""}) builder-cli/${Us}`,"Sec-Ch-Ua-Platform":t}}var Jt=process.env.OVERRIDE_VERSION??"1.6.12";var vm=I(require("@sentry/node"),1);var wm=/[^\x00-\x7F]/g;function Ws(e){return e=e.replace(wm,""),e=e.replace(/[\W\d]/g," "),e=e.trim(),e=bm(e),e=e.charAt(0).toUpperCase()+e.slice(1),e}function bm(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,function(t,r){return r===0?t.toLowerCase():t.toUpperCase()}).replace(/\s+/g,"")}var Im=require("glob");var Am=I(require("prettier"),1);var Bm=I(require("chokidar"),1),Rm=I(require("ignore"),1);function ot(){}ot.prototype={diff:function(t,r){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={}),this.options=i;var o=this;function s(v){return a?(setTimeout(function(){a(void 0,v)},0),!0):v}t=this.castInput(t),r=this.castInput(r),t=this.removeEmpty(this.tokenize(t)),r=this.removeEmpty(this.tokenize(r));var u=r.length,l=t.length,c=1,p=u+l;i.maxEditLength&&(p=Math.min(p,i.maxEditLength));var f=(n=i.timeout)!==null&&n!==void 0?n:1/0,h=Date.now()+f,D=[{oldPos:-1,lastComponent:void 0}],d=this.extractCommon(D[0],r,t,0);if(D[0].oldPos+1>=l&&d+1>=u)return s([{value:this.join(r),count:r.length}]);var g=-1/0,m=1/0;function E(){for(var v=Math.max(g,-c);v<=Math.min(m,c);v+=2){var S=void 0,y=D[v-1],B=D[v+1];y&&(D[v-1]=void 0);var $=!1;if(B){var _=B.oldPos-v;$=B&&0<=_&&_<u}var w=y&&y.oldPos+1<l;if(!$&&!w){D[v]=void 0;continue}if(!w||$&&y.oldPos+1<B.oldPos?S=o.addToPath(B,!0,void 0,0):S=o.addToPath(y,void 0,!0,1),d=o.extractCommon(S,r,t,v),S.oldPos+1>=l&&d+1>=u)return s(Nm(o,S.lastComponent,r,t,o.useLongestToken));D[v]=S,S.oldPos+1>=l&&(m=Math.min(m,v-1)),d+1>=u&&(g=Math.max(g,v+1))}c++}if(a)(function v(){setTimeout(function(){if(c>p||Date.now()>h)return a();E()||v()},0)})();else for(;c<=p&&Date.now()<=h;){var x=E();if(x)return x}},addToPath:function(t,r,n,i){var a=t.lastComponent;return a&&a.added===r&&a.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:a.count+1,added:r,removed:n,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:a}}},extractCommon:function(t,r,n,i){for(var a=r.length,o=n.length,s=t.oldPos,u=s-i,l=0;u+1<a&&s+1<o&&this.equals(r[u+1],n[s+1]);)u++,s++,l++;return l&&(t.lastComponent={count:l,previousComponent:t.lastComponent}),t.oldPos=s,u},equals:function(t,r){return this.options.comparator?this.options.comparator(t,r):t===r||this.options.ignoreCase&&t.toLowerCase()===r.toLowerCase()},removeEmpty:function(t){for(var r=[],n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r},castInput:function(t){return t},tokenize:function(t){return t.split("")},join:function(t){return t.join("")}};function Nm(e,t,r,n,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,u=a.length,l=0,c=0;s<u;s++){var p=a[s];if(p.removed){if(p.value=e.join(n.slice(c,c+p.count)),c+=p.count,s&&a[s-1].added){var h=a[s-1];a[s-1]=a[s],a[s]=h}}else{if(!p.added&&i){var f=r.slice(l,l+p.count);f=f.map(function(d,g){var m=n[c+g];return m.length>d.length?m:d}),p.value=e.join(f)}else p.value=e.join(r.slice(l,l+p.count));l+=p.count,p.added||(c+=p.count)}}var D=a[u-1];return u>1&&typeof D.value=="string"&&(D.added||D.removed)&&e.equals("",D.value)&&(a[u-2].value+=D.value,a.pop()),a}var WE=new ot;var Gs=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Hs=/\S/,Qs=new ot;Qs.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Hs.test(e)&&!Hs.test(t)};Qs.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),r=0;r<t.length-1;r++)!t[r+1]&&t[r+2]&&Gs.test(t[r])&&Gs.test(t[r+2])&&(t[r]+=t[r+2],t.splice(r+1,2),r--);return t};var Ys=new ot;Ys.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1187
+ `));var t=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var n=0;n<r.length;n++){var i=r[n];n%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var km=new ot;km.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var $m=new ot;$m.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function ar(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ar=function(t){return typeof t}:ar=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ar(e)}var Lm=Object.prototype.toString,Fn=new ot;Fn.useLongestToken=!0;Fn.tokenize=Ys.tokenize;Fn.castInput=function(e){var t=this.options,r=t.undefinedReplacement,n=t.stringifyReplacer,i=n===void 0?function(a,o){return typeof o>"u"?r:o}:n;return typeof e=="string"?e:JSON.stringify(Po(e,null,null,i),i," ")};Fn.equals=function(e,t){return ot.prototype.equals.call(Fn,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function Po(e,t,r,n,i){t=t||[],r=r||[],n&&(e=n(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return r[a];var o;if(Lm.call(e)==="[object Array]"){for(t.push(e),o=new Array(e.length),r.push(o),a=0;a<e.length;a+=1)o[a]=Po(e[a],t,r,n,i);return t.pop(),r.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),ar(e)==="object"&&e!==null){t.push(e),o={},r.push(o);var s=[],u;for(u in e)e.hasOwnProperty(u)&&s.push(u);for(s.sort(),a=0;a<s.length;a+=1)u=s[a],o[u]=Po(e[u],t,r,n,u);t.pop(),r.pop()}else o=e;return o}var To=new ot;To.tokenize=function(e){return e.slice()};To.join=To.removeEmpty=function(e){return e};var Io=I(require("process"),1);function Bo(){let{env:e}=Io.default,{TERM:t,TERM_PROGRAM:r}=e;return Io.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ro=I(Ye(),1),it=I(Bn(),1),sr=require("process"),dt=I(require("readline"),1),yn=I(Ye(),1),ur=()=>{let e=No?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=No?80:120,r,n,i=!1,a="",o="",s="",u=m=>{let E=m>1?"Something went wrong":"Canceled";i&&D(E,m)},l=(m,E)=>{console.error(E,m),u(2)},c=()=>u(1),p=()=>{process.on("uncaughtExceptionMonitor",l),process.on("unhandledRejection",l),process.on("SIGINT",c),process.on("SIGTERM",c),process.on("exit",u)},f=()=>{process.removeListener("uncaughtExceptionMonitor",l),process.removeListener("unhandledRejection",l),process.removeListener("SIGINT",c),process.removeListener("SIGTERM",c),process.removeListener("exit",u)},h=(m="")=>{i=!0,r=Um(),a=m.replace(/\.+$/,""),process.stdout.write(`${Ro.default.gray(Om)}
1188
+ `);let E=0,x=0;p(),process.env.CI||(n=setInterval(()=>{let v=Ro.default.magenta(e[E]),S=".".repeat(Math.floor(x)).slice(0,3);process.stdout.write(it.cursor.move(-999,-s.split(`
1189
+ `).length+1)),process.stdout.write(it.erase.down(s.split(`
1190
+ `).length));let y=`${v} ${a}${S}${o}`;process.stdout.write(y),E=E+1<e.length?E+1:0,x=x<e.length?x+.125:0,s=y},t))},D=(m,E=0)=>{a=m??a,i=!1,clearInterval(n);let x=E===0?(0,yn.green)(Mm):E===1?(0,yn.red)(_m):(0,yn.red)(jm);process.stdout.write(it.cursor.move(-999,-s.split(`
1191
+ `).length+1)),process.stdout.write(it.erase.down(s.split(`
1192
1192
  `).length)),process.stdout.write(`${x} ${a}
1193
- `),s=a,f(),r()};return{start:h,stop:D,message:(m="")=>{a=m??a},extra:(m="")=>{o=m}}},Mo=Oo(),fr=(e,t)=>Mo?e:t,Wm=fr("\u2502","|"),Jm=fr("\u25A0","x"),Hm=fr("\u25B2","x"),Gm=fr("\u25C7","o"),Qm=globalThis.process.platform.startsWith("win");function Ym({input:e=pr.stdin,output:t=pr.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let i=ft.createInterface({input:e,output:t,prompt:"",tabSize:1});ft.emitKeypressEvents(e,i),e.isTTY&&e.setRawMode(!0);let a=(o,{name:s})=>{if(String(o)===""){n&&t.write(rt.cursor.show),process.exit(0);return}if(!r)return;ft.moveCursor(t,s==="return"?0:-1,s==="return"?-1:0,()=>{ft.clearLine(t,1,()=>{e.once("keypress",a)})})};return n&&t.write(rt.cursor.hide),e.once("keypress",a),()=>{e.off("keypress",a),n&&t.write(rt.cursor.show),e.isTTY&&!Qm&&e.setRawMode(!1),i.terminal=!1,i.close()}}var F=T(He(),1);function jo(e){switch(ar("cli help",{subcommand:e}),console.log(""),xt((0,F.bgCyan)((0,F.bold)((0,F.white)(" help ")))+" "+(0,F.dim)(qt)),e){case"add":case"generate":case"gen":case"g":xt(`${(0,F.cyan)("\u2192")} ${(0,F.bold)("Generate Figma Components")}
1193
+ `),s=a,f(),r()};return{start:h,stop:D,message:(m="")=>{a=m??a},extra:(m="")=>{o=m}}},No=Bo(),lr=(e,t)=>No?e:t,Om=lr("\u2502","|"),_m=lr("\u25A0","x"),jm=lr("\u25B2","x"),Mm=lr("\u25C7","o"),Vm=globalThis.process.platform.startsWith("win");function Um({input:e=sr.stdin,output:t=sr.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let i=dt.createInterface({input:e,output:t,prompt:"",tabSize:1});dt.emitKeypressEvents(e,i),e.isTTY&&e.setRawMode(!0);let a=(o,{name:s})=>{if(String(o)===""){n&&t.write(it.cursor.show),process.exit(0);return}if(!r)return;dt.moveCursor(t,s==="return"?0:-1,s==="return"?-1:0,()=>{dt.clearLine(t,1,()=>{e.once("keypress",a)})})};return n&&t.write(it.cursor.hide),e.once("keypress",a),()=>{e.off("keypress",a),n&&t.write(it.cursor.show),e.isTTY&&!Vm&&e.setRawMode(!1),i.terminal=!1,i.close()}}var F=I(Ye(),1);function ko(e){switch(or("cli help",{subcommand:e}),console.log(""),Et((0,F.bgCyan)((0,F.bold)((0,F.white)(" help ")))+" "+(0,F.dim)(Jt)),e){case"add":case"generate":case"gen":case"g":Et(`${(0,F.cyan)("\u2192")} ${(0,F.bold)("Generate Figma Components")}
1194
1194
 
1195
- ${(0,F.bgGreen)((0,F.white)(` npx ${Be()} figma generate URL [URL ...] `))}
1195
+ ${(0,F.bgGreen)((0,F.white)(` npx ${ke()} figma generate URL [URL ...] `))}
1196
1196
 
1197
1197
  Start the auto-mapping wizard for the Figma Component URLs pasted in.
1198
1198
 
@@ -1210,7 +1210,7 @@ ${(0,F.yellow)("Arguments:")}
1210
1210
  ${(0,F.cyan)("--skipInstallation")} Skip the package installation step
1211
1211
  ${(0,F.cyan)("--yes")} Auto-confirm all prompts`);break;case"auth":U.info(`${(0,F.cyan)("\u2192")} ${(0,F.bold)("Authentication")}
1212
1212
 
1213
- ${(0,F.bgGreen)((0,F.white)(` npx ${Be()} auth `))}
1213
+ ${(0,F.bgGreen)((0,F.white)(` npx ${ke()} auth `))}
1214
1214
 
1215
1215
  Re-authenticate with Figma and Builder.io.
1216
1216
 
@@ -1226,7 +1226,7 @@ ${(0,F.yellow)("Non-Interactive Authentication:")}
1226
1226
  Example using environment variables:
1227
1227
  ${(0,F.dim)('export BUILDER_PRIVATE_KEY="your-private-key"')}
1228
1228
  ${(0,F.dim)('export FIGMA_PERSONAL_TOKEN="your-figma-token"')}
1229
- ${(0,F.dim)(`npx ${Be()} figma generate <url> --ci`)}
1229
+ ${(0,F.dim)(`npx ${ke()} figma generate <url> --ci`)}
1230
1230
 
1231
1231
  ${(0,F.yellow)("Arguments:")}
1232
1232
  ${(0,F.cyan)("--figmaToken")} Figma access token for authentication
@@ -1238,7 +1238,7 @@ ${(0,F.yellow)("Learn More:")}
1238
1238
  \u2022 Figma access token: https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens
1239
1239
  \u2022 CI setup guide: https://www.builder.io/c/docs/integrating-builder-figma`);break;case"publish":U.info(`${(0,F.cyan)("\u2192")} ${(0,F.bold)("Publish Mappings")}
1240
1240
 
1241
- ${(0,F.bgGreen)((0,F.white)(` npx ${Be()} figma publish `))}
1241
+ ${(0,F.bgGreen)((0,F.white)(` npx ${ke()} figma publish `))}
1242
1242
 
1243
1243
  Publish your Figma Mappings to Builder.io.
1244
1244
 
@@ -1250,7 +1250,7 @@ ${(0,F.yellow)("Arguments:")}
1250
1250
  ${(0,F.cyan)("--dryrun")} Run without making changes
1251
1251
  ${(0,F.cyan)("--yes")} Auto-confirm all prompts`);break;case"migrate":U.info(`${(0,F.cyan)("\u2192")} ${(0,F.bold)("Migrate Mappings")}
1252
1252
 
1253
- ${(0,F.bgGreen)((0,F.white)(` npx ${Be()} figma migrate `))}
1253
+ ${(0,F.bgGreen)((0,F.white)(` npx ${ke()} figma migrate `))}
1254
1254
 
1255
1255
  Migrate your existing Figma Mappings into the repo as local files.
1256
1256
 
@@ -1262,7 +1262,7 @@ ${(0,F.yellow)("Arguments:")}
1262
1262
  ${(0,F.cyan)("--force")} Force migration even if there are warnings
1263
1263
  ${(0,F.cyan)("--yes")} Auto-confirm all prompts`);break;case"code":U.info(`${(0,F.cyan)("\u2192")} ${(0,F.bold)("Code Generation")}
1264
1264
 
1265
- ${(0,F.bgGreen)((0,F.white)(` npx ${Be()} code --url URL `))}
1265
+ ${(0,F.bgGreen)((0,F.white)(` npx ${ke()} code --url URL `))}
1266
1266
 
1267
1267
  Generate or modify code based on Figma designs.
1268
1268
 
@@ -1278,27 +1278,27 @@ ${(0,F.yellow)("Configuration Files:")}
1278
1278
  ${(0,F.cyan)(".builderrules")} Add custom instructions that will be injected into the LLM prompt
1279
1279
  ${(0,F.cyan)(".cursorrules")} Cursor's settings are automatically supported for consistent behavior`);break;case"indexing":U.info(`${(0,F.cyan)("\u2192")} ${(0,F.bold)("Code Indexing")}
1280
1280
 
1281
- ${(0,F.bgGreen)((0,F.white)(` npx ${Be()} code indexing `))}
1281
+ ${(0,F.bgGreen)((0,F.white)(` npx ${ke()} code indexing `))}
1282
1282
 
1283
1283
  Index your codebase to improve code generation results.
1284
1284
 
1285
1285
  ${(0,F.yellow)("Arguments:")}
1286
1286
  ${(0,F.cyan)("--spaceId")} Builder.io space ID to use
1287
1287
  ${(0,F.cyan)("--cwd")} Working directory to run commands from`);break;default:U.info(`${(0,F.bold)("Available Commands:")}
1288
- `),[{command:"generate URL [URL ...]",description:"Start the auto-mapping wizard for Figma Component URLs"},{command:"publish",description:"Publish your Figma Mappings to Builder.io"},{command:"migrate",description:"Migrate existing Figma Mappings into the repo as local files"},{command:"auth",description:"Re-authenticate with Figma and Builder.io"},{command:"code",description:"Generate or modify code based on Figma designs"},{command:"indexing",description:"Index your codebase to improve code generation results"}].forEach(({command:r,description:n})=>{U.info(`${(0,F.cyan)("\u2192")} ${(0,F.bgGreen)((0,F.white)(` npx ${Be()} figma ${r} `))}
1288
+ `),[{command:"generate URL [URL ...]",description:"Start the auto-mapping wizard for Figma Component URLs"},{command:"publish",description:"Publish your Figma Mappings to Builder.io"},{command:"migrate",description:"Migrate existing Figma Mappings into the repo as local files"},{command:"auth",description:"Re-authenticate with Figma and Builder.io"},{command:"code",description:"Generate or modify code based on Figma designs"},{command:"indexing",description:"Index your codebase to improve code generation results"}].forEach(({command:r,description:n})=>{U.info(`${(0,F.cyan)("\u2192")} ${(0,F.bgGreen)((0,F.white)(` npx ${ke()} figma ${r} `))}
1289
1289
  ${(0,F.dim)(n)}
1290
1290
  `)}),U.info(`
1291
- Use ${(0,F.cyan)(`npx ${Be()} figma help <command>`)} for detailed help about a command`)}tn("bye \u{1F44B}")}var ef=T(require("prompts"),1);var tf=T(require("prettier"),1);var de=T(require("typescript"),1);function su(e){return!(e.category!==de.DiagnosticCategory.Error||!e.file||e.code===6133||e.code===6138||e.code===6305||e.code===6196||e.code===6192||e.code===6198||e.code===6199||e.code===6205||e.code===1449||e.code===2578||e.code===7006||e.code===5074||e.code===7026||e.code===2503||e.code===2695||e.code===2322)}var $F={getCanonicalFileName:e=>e,getCurrentDirectory:de.sys.getCurrentDirectory,getNewLine:()=>de.sys.newLine};async function nf(e,t,r){let n=[],i=[t],a=e.relative(e.getAppRootDir(),t.fileName);for(;i.length>0;){let o=i.shift();if(uf(o,t)){let s=of(e,o,t,r),{line:u,character:l}=t.getLineAndCharacterOfPosition(o.getStart());s&&(s.loc=`${a}:${u+1}:${l+1}`,n.push(s))}i.push(...o.getChildren(t))}return n}var rf="figmaMapping";function of(e,t,r,n){let[i]=t.arguments;if(!i)throw new Error("Invalid figmaMapping call, no arguments found");if(!H.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(r.fileName).replace(/\.mapper\.[tsxjm]+$/,""),p,f,h,D;if(t.typeArguments&&t.typeArguments.length>0){let m=uu(t.typeArguments[0].getText(r));m&&(c=m)}for(let m of a){let E=m.name?.getText(r);if(!E)throw new Error("Invalid figmaMapping call, property has no name");switch(E){case"url":{if(!("initializer"in m))throw new Error("Invalid figmaMapping call, url has no initializer");let x=m.initializer;if(!H.default.isStringLiteral(x))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");D=x.text;break}case"componentKey":{if(!("initializer"in m))throw new Error("Invalid figmaMapping call, componentKey has no initializer");let x=m.initializer;if(!H.default.isStringLiteral(x))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");o=x.text;break}case"mapper":if(H.default.isMethodDeclaration(m)){let x=function(S){let B=n.getSymbolAtLocation(S)?.getDeclarations()?.[0];if(B){let $=sf(B);if($?.importClause)return $.importClause.name?.getText(r)===l?p="default":$.importClause.namedBindings&&(p="named"),f=l,H.default.isStringLiteral($.moduleSpecifier)&&(h=$.moduleSpecifier.text),!0}return!1},v=function(S){if((H.default.isJsxOpeningElement(S)||H.default.isJsxSelfClosingElement(S))&&H.default.isIdentifier(S.tagName)){if(x(S.tagName))return l=S.tagName.getText(r)}else if(H.default.isTaggedTemplateExpression(S)&&H.default.isIdentifier(S.tag)&&S.tag.escapedText==="html"){if(H.default.isTemplateExpression(S.template)){let B=S.template.templateSpans.find($=>H.default.isIdentifier($.expression)&&af($.expression.text)&&x($.expression));if(B&&H.default.isIdentifier(B.expression)){l=B.expression.text;return}}let y=S.template.getText(r).match(/^`<([^\s]+)/);if(y){l=y[1];return}}else H.default.forEachChild(S,v)};var d=x,g=v;if(m.parameters[0].type){let S=m.parameters[0].type.getText(r),y=uu(S);y&&(c=y)}H.default.forEachChild(m,v),u=m.getText(r).replace(/^mapper/,"function Mapper"),s=Vo(u);break}case"designTokenMapper":if(H.default.isMethodDeclaration(m)){u=m.getText(r).replace(/^designTokenMapper/,"function Mapper"),s=Vo(u),o="design-tokens";break}case"genericMapper":if(H.default.isMethodDeclaration(m)){u=m.getText(r).replace(/^genericMapper/,"function Mapper"),s=Vo(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:f,importPath:h,originalInputMapper:u,source:"cli"}}function af(e){return e.charAt(0)===e.charAt(0).toUpperCase()}function Vo(e){return H.default.transpile(e,{target:H.default.ScriptTarget.Latest,allowNonTsExtensions:!0,moduleResolution:H.default.ModuleResolutionKind.NodeJs,module:H.default.ModuleKind.CommonJS,noImplicitAny:!1,esModuleInterop:!0,noUnusedLocals:!1,noUnusedParameters:!1,jsx:H.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 sf(e){let t=e;for(;t;){if(H.default.isImportDeclaration(t))return t;t=t.parent}}function uf(e,t){return H.default.isCallExpression(e)&&e.expression.getText(t).includes(rf)}async function lu(e){let t=["node_modules","dist","build","public"];return(await e.readdirRecursive(e.getAppRootDir(),t)).filter(n=>De(n))}function uu(e){let t=e.match(/^Figma(\w+)Props$/);if(t&&typeof t[1]=="string")return t[1]}async function cu(e,t,r,n=!1){try{return r||(r=await nr(e)),await r.setPublicApiKey({publicApiKey:t}),n&&await r.ensureFigmaImportPage(),!0}catch(i){return Uo.captureException(i),!1}}async function pu({force:e,mappingFiles:t,print:r,sys:n}){if(!t.length)return{figmaBuilderLinks:[],figmaLinksToResolve:[],foundErrors:!1};let i=[],a=await ee(n,t),o=a.getTypeChecker(),s=[...a.getSyntacticDiagnostics(),...a.getGlobalDiagnostics(),...a.getSemanticDiagnostics(),...a.getDeclarationDiagnostics()].filter(su),u=new Set,l=!1;for(let p of t)try{let f=a.getSourceFile(p);if(!f)throw new Error(`Could not find source file for ${p}`);let h=f?.fileName;if(h){let d=s.filter(g=>g.file?.fileName===h);if(d.length>0&&(l=!0,e!==!0)){U.error((0,Z.red)(`TypeScript errors in ${(0,Z.dim)(n.relative(n.getAppRootDir(),p))}:
1292
- `)+d.map(g=>` \u2022 ${lf(g)}`).join(`
1293
- `));continue}}let D=await nf(n,f,o);if(i.push(...D),r){let d=!1,g=`${(0,Z.dim)(n.relative(n.getAppRootDir(),p))}:
1294
- `+D.map(m=>{let E=!1;m.figmaKey?(E||(E=u.has(m.figmaKey)),u.add(m.figmaKey)):m.figmaUrl&&(E||(E=u.has(m.figmaUrl)),u.add(m.figmaUrl));let x="";switch(m.figmaKey){case"design-tokens":x=" "+(0,Z.cyan)("\u2747\uFE0E Design tokens mapper");break;case"*":x=" "+(0,Z.yellow)("\u25CF Generic mapper");break;default:x=` ${(0,Z.magenta)("\u2756 "+eu(m.figmaName))} ${(0,Z.dim)("\u2192")} ${m.builderName==="-"?"-":"<"+m.builderName+">"}`;break}return E&&(d=!0,x=(0,Z.bgRed)(x+(0,Z.bold)(" <= duplicated"))),x}).join(`
1295
- `);d?(l=!0,U.error(g)):U.info(g)}}catch(f){return Uo.captureException(f),console.error(f),await pt(1)}let c=i.filter(p=>p.figmaUrl&&!p.figmaKey).map(p=>p.figmaUrl);return{figmaBuilderLinks:i,figmaLinksToResolve:c,foundErrors:l}}function lf(e){let{messageText:t}=e;if(typeof t=="string")return t;let{next:r}=t,n=[t.messageText];return r&&n.push(r.map(i=>i.messageText).join(`
1291
+ Use ${(0,F.cyan)(`npx ${ke()} figma help <command>`)} for detailed help about a command`)}rn("bye \u{1F44B}")}var qm=I(require("prompts"),1);var Wm=I(require("prettier"),1);var Ae=I(require("typescript"),1);function Xs(e){return!(e.category!==Ae.DiagnosticCategory.Error||!e.file||e.code===6133||e.code===6138||e.code===6305||e.code===6196||e.code===6192||e.code===6198||e.code===6199||e.code===6205||e.code===1449||e.code===2578||e.code===7006||e.code===5074||e.code===7026||e.code===2503||e.code===2695||e.code===2322)}async function Jm(e,t,r){let n=[],i=[t],a=e.relative(e.getAppRootDir(),t.fileName);for(;i.length>0;){let o=i.shift();if(Xm(o,t)){let s=Hm(e,o,t,r),{line:u,character:l}=t.getLineAndCharacterOfPosition(o.getStart());s&&(s.loc=`${a}:${u+1}:${l+1}`,n.push(s))}i.push(...o.getChildren(t))}return n}var Gm="figmaMapping";function Hm(e,t,r,n){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(r.fileName).replace(/\.mapper\.[tsxjm]+$/,""),p,f,h,D;if(t.typeArguments&&t.typeArguments.length>0){let m=Zs(t.typeArguments[0].getText(r));m&&(c=m)}for(let m of a){let E=m.name?.getText(r);if(!E)throw new Error("Invalid figmaMapping call, property has no name");switch(E){case"url":{if(!("initializer"in m))throw new Error("Invalid figmaMapping call, url has no initializer");let x=m.initializer;if(!G.default.isStringLiteral(x))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");D=x.text;break}case"componentKey":{if(!("initializer"in m))throw new Error("Invalid figmaMapping call, componentKey has no initializer");let x=m.initializer;if(!G.default.isStringLiteral(x))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");o=x.text;break}case"mapper":if(G.default.isMethodDeclaration(m)){let x=function(S){let B=n.getSymbolAtLocation(S)?.getDeclarations()?.[0];if(B){let $=Ym(B);if($?.importClause)return $.importClause.name?.getText(r)===l?p="default":$.importClause.namedBindings&&(p="named"),f=l,G.default.isStringLiteral($.moduleSpecifier)&&(h=$.moduleSpecifier.text),!0}return!1},v=function(S){if((G.default.isJsxOpeningElement(S)||G.default.isJsxSelfClosingElement(S))&&G.default.isIdentifier(S.tagName)){if(x(S.tagName))return l=S.tagName.getText(r)}else if(G.default.isTaggedTemplateExpression(S)&&G.default.isIdentifier(S.tag)&&S.tag.escapedText==="html"){if(G.default.isTemplateExpression(S.template)){let B=S.template.templateSpans.find($=>G.default.isIdentifier($.expression)&&Qm($.expression.text)&&x($.expression));if(B&&G.default.isIdentifier(B.expression)){l=B.expression.text;return}}let y=S.template.getText(r).match(/^`\s*<([^\s]+)/);if(y){l=y[1];return}}else G.default.forEachChild(S,v)};var d=x,g=v;if(m.parameters[0].type){let S=m.parameters[0].type.getText(r),y=Zs(S);y&&(c=y)}G.default.forEachChild(m,v),u=m.getText(r).replace(/^mapper/,"function Mapper"),s=$o(u);break}case"designTokenMapper":if(G.default.isMethodDeclaration(m)){u=m.getText(r).replace(/^designTokenMapper/,"function Mapper"),s=$o(u),o="design-tokens";break}case"genericMapper":if(G.default.isMethodDeclaration(m)){u=m.getText(r).replace(/^genericMapper/,"function Mapper"),s=$o(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:f,importPath:h,originalInputMapper:u,source:"cli"}}function Qm(e){return e.charAt(0)===e.charAt(0).toUpperCase()}function $o(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 Ym(e){let t=e;for(;t;){if(G.default.isImportDeclaration(t))return t;t=t.parent}}function Xm(e,t){return G.default.isCallExpression(e)&&e.expression.getText(t).includes(Gm)}async function eu(e){let t=["node_modules","dist","build","public"];return(await e.readdirRecursive(e.getAppRootDir(),t)).filter(n=>he(n))}function Zs(e){let t=e.match(/^Figma(\w+)Props$/);if(t&&typeof t[1]=="string")return t[1]}async function tu(e,t,r,n=!1){try{return r||(r=await er(e)),await r.setPublicApiKey({publicApiKey:t}),n&&await r.ensureFigmaImportPage(),!0}catch(i){return e.Sentry?.captureException(i,{level:"warning"}),!1}}async function nu({sys:e,force:t,mappingFiles:r,print:n}){if(e.Sentry?.setContext("findMappings",{mappingFiles:r}),!r.length)return{figmaBuilderLinks:[],figmaLinksToResolve:[],foundErrors:!1};let i=[],a=await ee(e,r),o=a.getTypeChecker(),s=[...a.getSyntacticDiagnostics(),...a.getGlobalDiagnostics(),...a.getSemanticDiagnostics(),...a.getDeclarationDiagnostics()].filter(Xs),u=new Set,l=!1;for(let p of r)try{let f=a.getSourceFile(p);if(!f){e.Sentry?.captureException(new Error("Could not find source file"),{extra:{file:p,sourceFiles:a.getSourceFiles().map(d=>d.fileName)},level:"warning"});continue}let h=f?.fileName;if(h){let d=s.filter(g=>g.file?.fileName===h);if(d.length>0&&(l=!0,t!==!0)){U.error((0,Z.red)(`TypeScript errors in ${(0,Z.dim)(e.relative(e.getAppRootDir(),p))}:
1292
+ `)+d.map(g=>` \u2022 ${Zm(g)}`).join(`
1293
+ `));continue}}let D=await Jm(e,f,o);if(i.push(...D),n){let d=!1,g=`${(0,Z.dim)(e.relative(e.getAppRootDir(),p))}:
1294
+ `+D.map(m=>{let E=!1;m.figmaKey?(E||(E=u.has(m.figmaKey)),u.add(m.figmaKey)):m.figmaUrl&&(E||(E=u.has(m.figmaUrl)),u.add(m.figmaUrl));let x="";switch(m.figmaKey){case"design-tokens":x=" "+(0,Z.cyan)("\u2747\uFE0E Design tokens mapper");break;case"*":x=" "+(0,Z.yellow)("\u25CF Generic mapper");break;default:x=` ${(0,Z.magenta)("\u2756 "+Ws(m.figmaName))} ${(0,Z.dim)("\u2192")} ${m.builderName==="-"?"-":"<"+m.builderName+">"}`;break}return E&&(d=!0,x=(0,Z.bgRed)(x+(0,Z.bold)(" <= duplicated"))),x}).join(`
1295
+ `);d?(l=!0,U.error(g)):U.info(g)}}catch(f){return e.Sentry?.captureException(f),await ft(1)}let c=i.filter(p=>p.figmaUrl&&!p.figmaKey).map(p=>p.figmaUrl);return{figmaBuilderLinks:i,figmaLinksToResolve:c,foundErrors:l}}function Zm(e){let{messageText:t}=e;if(typeof t=="string")return t;let{next:r}=t,n=[t.messageText];return r&&n.push(r.map(i=>i.messageText).join(`
1296
1296
  `)),n.join(`
1297
- `)}var Du=require("crypto");var Ko=e=>!!(process.env.CI||e.ci),dr=async(e,t,r)=>{let n=Ko(t)?{}:ff(e),i=n.spaceName,a=n.userId,o,s=process.env.BUILDER_PUBLIC_KEY??n.builderPublicKey,u=process.env.BUILDER_PRIVATE_KEY??n.builderPrivateKey,l=process.env.FIGMA_PERSONAL_TOKEN??t.figmaToken;if(l?o={access_token:l,oauth:!1}:o=n.figmaAuth,r.forceSpaceId&&!t.yes&&s&&s!==r.forceSpaceId&&(U.warning(`CLI is currently logged in space ${(0,dt.yellow)(s)},
1298
- However the command required --spaceId=${(0,dt.green)(r.forceSpaceId)}`),await en({message:"Do you wanna switch spaces?",active:"Yes",inactive:`Stay in current ${i} space`})?(s=r.forceSpaceId,u=void 0,i=void 0,a=void 0):U.warning("Staying in the current space. Some other auth issues might occur.")),Ko(t)){if(!o&&r.figmaAuth)throw new Error(`No Figma personal token found.
1297
+ `)}var au=require("crypto");var Lo=e=>!!(process.env.CI||e.ci),cr=async(e,t,r)=>{let n=Lo(t)?{}:rf(e),i=n.spaceName,a=n.userId,o,s=process.env.BUILDER_PUBLIC_KEY??n.builderPublicKey,u=process.env.BUILDER_PRIVATE_KEY??n.builderPrivateKey,l=process.env.FIGMA_PERSONAL_TOKEN??t.figmaToken;if(l?o={access_token:l,oauth:!1}:o=n.figmaAuth,r.forceSpaceId&&!t.yes&&s&&s!==r.forceSpaceId&&(U.warning(`CLI is currently logged in space ${(0,Dt.yellow)(s)},
1298
+ However the command required --spaceId=${(0,Dt.green)(r.forceSpaceId)}`),await nn({message:"Do you wanna switch spaces?",active:"Yes",inactive:`Stay in current ${i} space`})?(s=r.forceSpaceId,u=void 0,i=void 0,a=void 0):U.warning("Staying in the current space. Some other auth issues might occur.")),Lo(t)){if(!o&&r.figmaAuth)throw new Error(`No Figma personal token found.
1299
1299
  Please set the FIGMA_PERSONAL_TOKEN environment variable.`);if(!u&&r.builderPrivateKey)throw new Error(`No Builder private key found.
1300
1300
  Please set the BUILDER_PRIVATE_KEY environment variable.`);if(!s&&r.builderPublicKey)throw new Error(`No Builder public key found.
1301
- Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u}}if((r.force||!o&&r.figmaAuth)&&(o=await pf(),mu(e,{figmaAuth:o})),r.force||!u&&r.builderPrivateKey||!s&&r.builderPublicKey){let{privateKey:c,spaceId:p,spaceName:f,userId:h}=await mf(e,r.forceSpaceId);if(r.forceSpaceId&&p!==r.forceSpaceId)throw new Error(`OAuth flow returned space ${(0,dt.yellow)(p)}, however the command specified --spaceId=${(0,dt.green)(r.forceSpaceId)}`);s=p,u=c,i=f,a=h,await Hs(a),await cu(e,p,void 0,!1),mu(e,{builderPublicKey:s,builderPrivateKey:u,spaceName:i,userId:a})}return a&&ot.setUser({id:a,username:process.env.USER||process.env.USERNAME||"unknown"}),(i||s)&&ot.setContext("builder",{spaceId:s,spaceName:i}),{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u,spaceName:i,userId:a}},cf="RHr2ed743waC2g2ZHMEJSn6O0NQ08L";async function pf(){let e=(0,Du.randomUUID)();return gu({name:"Figma",port:5283,requestListener:async(t,r,n,i,a)=>{let o=new URL(r.url||"",`http://localhost:${t}`);if(o.pathname==="/figma-connect"){let s=o.searchParams.get("code"),u=o.searchParams.get("state"),l="nrGCqw6TLl95QJhVDi097A",c=cf,f=`Basic ${Buffer.from(`${l}:${c}`).toString("base64")}`;if(s&&e===u){let h=await mt("https://api.figma.com/v1/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:f},body:new URLSearchParams({redirect_uri:"http://localhost:5283/figma-connect",code:s,grant_type:"authorization_code"}).toString()});h.ok||a(new Error("Failed to get figma access token"));let D=await h.json();n.end(`<!DOCTYPE html>
1301
+ Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u}}if((r.force||!o&&r.figmaAuth)&&(o=await tf(e),ru(e,{figmaAuth:o})),r.force||!u&&r.builderPrivateKey||!s&&r.builderPublicKey){let{privateKey:c,spaceId:p,spaceName:f,userId:h}=await nf(e,r.forceSpaceId);if(r.forceSpaceId&&p!==r.forceSpaceId)throw new Error(`OAuth flow returned space ${(0,Dt.yellow)(p)}, however the command specified --spaceId=${(0,Dt.green)(r.forceSpaceId)}`);s=p,u=c,i=f,a=h,await Vs(a),await tu(e,p,void 0,!1),ru(e,{builderPublicKey:s,builderPrivateKey:u,spaceName:i,userId:a})}return a&&e.Sentry?.setUser({id:a,username:process.env.USER||process.env.USERNAME||"unknown"}),(i||s)&&e.Sentry?.setContext("builder",{spaceId:s,spaceName:i,userId:a}),{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u,spaceName:i,userId:a}},ef="RHr2ed743waC2g2ZHMEJSn6O0NQ08L";async function tf(e){let t=(0,au.randomUUID)();return su({sys:e,name:"Figma",port:5283,requestListener:async(r,n,i,a,o)=>{let s=new URL(n.url||"",`http://localhost:${r}`);if(s.pathname==="/figma-connect"){let u=s.searchParams.get("code"),l=s.searchParams.get("state"),c="nrGCqw6TLl95QJhVDi097A",p=ef,h=`Basic ${Buffer.from(`${c}:${p}`).toString("base64")}`;if(u&&t===l){let D=await At("https://api.figma.com/v1/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:h},body:new URLSearchParams({redirect_uri:"http://localhost:5283/figma-connect",code:u,grant_type:"authorization_code"}).toString()});D.ok||o(new Error("Failed to get figma access token"));let d=await D.json();i.end(`<!doctype html>
1302
1302
  <html lang="en" dir="ltr">
1303
1303
  <head>
1304
1304
  <meta charset="utf-8" />
@@ -1407,7 +1407,7 @@ Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,bui
1407
1407
  <!--SCRIPT_PLACEHOLDER-->
1408
1408
  </body>
1409
1409
  </html>
1410
- `.replace("{{MESSAGE}}","The CLI has authenticated correctly with Figma"),()=>{i({...D,oauth:!0})})}}},onListen:t=>{let r=new URL("https://www.figma.com/oauth");return r.searchParams.set("client_id","nrGCqw6TLl95QJhVDi097A"),r.searchParams.set("redirect_uri",`http://localhost:${t}/figma-connect`),r.searchParams.set("scope","files:read,file_dev_resources:read,file_variables:read"),r.searchParams.set("state",e),r.searchParams.set("response_type","code"),r.href}})}async function mf(e,t){let r=await e.getDeviceId();return gu({name:"Builder.io",port:5284,requestListener:async(n,i,a,o)=>{let s=new URL(i.url||"",`http://localhost:${n}`);s.pathname===gt&&a.end(`<!DOCTYPE html>
1410
+ `.replace("{{MESSAGE}}","The CLI has authenticated correctly with Figma"),()=>{a({...d,oauth:!0})})}}},onListen:r=>{let n=new URL("https://www.figma.com/oauth");return n.searchParams.set("client_id","nrGCqw6TLl95QJhVDi097A"),n.searchParams.set("redirect_uri",`http://localhost:${r}/figma-connect`),n.searchParams.set("scope","files:read,file_dev_resources:read,file_variables:read"),n.searchParams.set("state",t),n.searchParams.set("response_type","code"),n.href}})}async function nf(e,t){let r=await e.getDeviceId();return su({sys:e,name:"Builder.io",port:5284,requestListener:async(n,i,a,o)=>{let s=new URL(i.url||"",`http://localhost:${n}`);s.pathname===ht&&a.end(`<!doctype html>
1411
1411
  <html lang="en" dir="ltr">
1412
1412
  <head>
1413
1413
  <meta charset="utf-8" />
@@ -1516,5 +1516,5 @@ Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,bui
1516
1516
  <!--SCRIPT_PLACEHOLDER-->
1517
1517
  </body>
1518
1518
  </html>
1519
- `.replace("{{MESSAGE}}","The CLI has authenticated correctly with Builder.io"),()=>{o({privateKey:s.searchParams.get("p-key")||"",spaceId:s.searchParams.get("api-key")||"",spaceName:s.searchParams.get("org-name")||"",userId:s.searchParams.get("user-id")||""})})},onListen:n=>{let i=new URL("/cli-auth","https://builder.io");i.searchParams.set("client_id","builder-dev-tools-cli"),i.searchParams.set("host",r),i.searchParams.set("response_type","code"),i.searchParams.set("cli","true"),t&&i.searchParams.set("space_id",t);let a=new URL(gt,`http://localhost:${n}`);a.searchParams.set(wn,(0,du.platform)()),a.searchParams.set(An,process.versions.node);let o=e.getFrameworks();return o.length>0&&(i.searchParams.set(bt,o[0].name),a.searchParams.set(bt,o[0].name)),i.searchParams.set("redirect_url",a.href),i.href}})}function mu(e,t){let r=e.getAppRootDir(),n=(0,Dr.join)(r,"node_modules",".builder"),i=(0,Dr.join)(n,"data.json");if((0,Je.existsSync)(i))try{let a=(0,Je.readFileSync)(i,"utf8"),o=JSON.parse(a);t=Object.assign(o.credentials,t)}catch(a){ot.captureException(a),console.error("Failed to store credentials",a)}else(0,Je.mkdirSync)(n,{recursive:!0});(0,Je.writeFileSync)(i,JSON.stringify({credentials:t},null,2))}function ff(e){let t=e.getAppRootDir(),r=(0,Dr.join)(t,"node_modules",".builder","data.json");if((0,Je.existsSync)(r))try{let n=(0,Je.readFileSync)(r,"utf8");return JSON.parse(n).credentials}catch(n){ot.captureException(n),console.error("Failed to load credentials",n)}return{}}async function gu(e){let{default:t}=await import("open"),r,n,i,a=new Promise((l,c)=>{r=l,n=c}),o=(0,fu.createServer)((l,c)=>e.requestListener(e.port,l,c,r,n)),s=()=>{u(),o&&("closeAllConnections"in o&&o.closeAllConnections(),o.close(l=>{l&&(ot.captureException(l),console.error(l))}))};process.on("uncaughtExceptionMonitor",s),process.on("unhandledRejection",s),process.on("SIGINT",s),process.on("SIGTERM",s),process.on("exit",s);let u=()=>{process.removeListener("uncaughtExceptionMonitor",s),process.removeListener("unhandledRejection",s),process.removeListener("SIGINT",s),process.removeListener("SIGTERM",s),process.removeListener("exit",s)};try{o.listen(e.port,()=>{let c=e.onListen(e.port);U.warn(`Required authenticating with ${e.name}
1520
- OPEN: ${(0,dt.dim)(c)}`),i=mr(),i.start(`Waiting for ${e.name} authentication`),t(c,{wait:!1})});let l=await a;return i&&i.stop(`Authenticated with ${e.name} successfully`),l}catch(l){throw i&&(i.stop(`Failed to authenticate with ${e.name}.`,-1),jo("auth")),console.error(l),ot.captureException(l),s(),l}finally{s()}}async function Cu(e,t,r,n){try{if(!e)return Wt(r,n,400,"Builder context closed");let i=Cf(r);if(i.pathname===Cr){if(r.method==="POST"){let a=await hf(r);if(a)try{let o=await xi(e,JSON.parse(a));return hu(r,n,200,o)}catch(o){e.debug("Dev API Error",o.stack||o.message||o);let s={errors:[String(o.message||o)]};return hu(r,n,500,s)}}else if(r.method==="OPTIONS"){let a={"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"?xu(new URL(o))&&(a["Access-Control-Allow-Origin"]=o):a["Access-Control-Allow-Origin"]="*",n.writeHead(200,a),n.end();return}return Wt(r,n,405,`${Cr} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(i.pathname===xr)return df(r,n,200,await Ei(e));if(i.pathname===Wo){let a=i.searchParams.get(hr);return a?gf(n,302,await vi(e,a)):Wt(r,n,400,`Missing ${hr} querystring`)}if(i.pathname===gt)return Df(r,n,200,await Fi(e));if(i.pathname===Jo){await dr(e,{_:[]},{});let a=await lu(e),{figmaBuilderLinks:o,foundErrors:s}=await pu({force:!0,mappingFiles:a,sys:e,print:!1});return Sn(r,n,200,"application/json",JSON.stringify({figmaBuilderLinks:o,foundErrors:s,version:2,local:!0},null,2))}return i.pathname===ht?(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),Wt(r,n,200,"Closing Dev Tools Server")):Wt(r,n,404,"Not found")}catch(i){return console.error("Dev Server Error",i),Wt(r,n,500,`Dev Server Error: ${i}`)}}function hu(e,t,r,n){Sn(e,t,r,"application/json",JSON.stringify(n))}function df(e,t,r,n){Sn(e,t,r,"application/javascript",n)}function Df(e,t,r,n){Sn(e,t,r,"text/html",n)}function Wt(e,t,r,n){Sn(e,t,r,"text/plain",n)}function Sn(e,t,r,n,i){let a={"Content-Type":`${n}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.6.10"},o=e.headers.origin;o&&o!=="null"?xu(new URL(o))&&(a["Access-Control-Allow-Origin"]=o):a["Access-Control-Allow-Origin"]="*",t.writeHead(r,a),t.end(i)}function xu(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 gf(e,t,r){e.writeHead(t,{Location:r}),e.end()}async function hf(e){let t="";for await(let r of e)t+=r;return t}function Cf(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function Eu(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await xf(e),r=(0,gr.createServer)((i,a)=>{Cu(e,r,i,a)}),n=()=>new Promise((i,a)=>{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}`),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",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 xf(e){return new Promise(t=>{let r=e.port;try{(0,gr.request)({hostname:"localhost",port:r,path:ht,method:"GET"},i=>{i.on("end",()=>{e.debug(`${ht} - Response ended`),t(r)})}).on("error",i=>{e.debug(`${ht} - No response ${i}`),t(r)}).end()}catch(n){e.debug(`${ht} - Error ${n}`),t(r)}})}async function To(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},r=e.getFrameworks().map(a=>a.name).join(", ");t.debug(`create devtools ${zo} [${r}]`);let n=await Eu(t);return t.devToolsServerUrl=n.url,t.port=n.port,{getUrl:()=>t.devToolsServerUrl}}var zo="1.6.10";0&&(module.exports={createDevToolsServer,version});
1519
+ `.replace("{{MESSAGE}}","The CLI has authenticated correctly with Builder.io"),()=>{o({privateKey:s.searchParams.get("p-key")||"",spaceId:s.searchParams.get("api-key")||"",spaceName:s.searchParams.get("org-name")||"",userId:s.searchParams.get("user-id")||""})})},onListen:n=>{let i=new URL("/cli-auth","https://builder.io");i.searchParams.set("client_id","builder-dev-tools-cli"),i.searchParams.set("host",r),i.searchParams.set("response_type","code"),i.searchParams.set("cli","true"),t&&i.searchParams.set("space_id",t);let a=new URL(ht,`http://localhost:${n}`);a.searchParams.set(wn,(0,iu.platform)()),a.searchParams.set(bn,process.versions.node);let o=e.getFrameworks();return o.length>0&&(i.searchParams.set(Pt,o[0].name),a.searchParams.set(Pt,o[0].name)),i.searchParams.set("redirect_url",a.href),i.href}})}function ru(e,t){let r=e.getAppRootDir(),n=(0,pr.join)(r,"node_modules",".builder"),i=(0,pr.join)(n,"data.json");if((0,Qe.existsSync)(i))try{let a=(0,Qe.readFileSync)(i,"utf8"),o=JSON.parse(a);t=Object.assign(o.credentials,t)}catch(a){e.Sentry?.captureException(a)}else(0,Qe.mkdirSync)(n,{recursive:!0});(0,Qe.writeFileSync)(i,JSON.stringify({credentials:t},null,2))}function rf(e){let t=e.getAppRootDir(),r=(0,pr.join)(t,"node_modules",".builder","data.json");if((0,Qe.existsSync)(r))try{let n=(0,Qe.readFileSync)(r,"utf8");return JSON.parse(n).credentials}catch(n){e.Sentry?.captureException(n)}return{}}async function su(e){let{default:t}=await import("open"),r,n,i,a=new Promise((l,c)=>{r=l,n=c}),o=(0,ou.createServer)((l,c)=>e.requestListener(e.port,l,c,r,n)),s=()=>{u(),o&&("closeAllConnections"in o&&o.closeAllConnections(),o.close(l=>{l&&e.sys.Sentry?.captureException(l)}))};process.on("uncaughtExceptionMonitor",s),process.on("unhandledRejection",s),process.on("SIGINT",s),process.on("SIGTERM",s),process.on("exit",s);let u=()=>{process.removeListener("uncaughtExceptionMonitor",s),process.removeListener("unhandledRejection",s),process.removeListener("SIGINT",s),process.removeListener("SIGTERM",s),process.removeListener("exit",s)};try{o.listen(e.port,()=>{let c=e.onListen(e.port);U.warn(`Required authenticating with ${e.name}
1520
+ OPEN: ${(0,Dt.dim)(c)}`),i=ur(),i.start(`Waiting for ${e.name} authentication`),t(c,{wait:!1})});let l=await a;return i&&i.stop(`Authenticated with ${e.name} successfully`),l}catch(l){throw i&&(i.stop(`Failed to authenticate with ${e.name}.`,-1),ko("auth")),e.sys.Sentry?.captureException(l),s(),l}finally{s()}}async function lu(e,t,r,n){try{if(!e)return Gt(r,n,400,"Builder context closed");let i=lf(r);if(i.pathname===dr){if(r.method==="POST"){let a=await uf(r);if(a)try{let o=await mi(e,JSON.parse(a));return uu(r,n,200,o)}catch(o){e.debug("Dev API Error",o.stack||o.message||o);let s={errors:[String(o.message||o)]};return uu(r,n,500,s)}}else if(r.method==="OPTIONS"){let a={"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"?cu(new URL(o))&&(a["Access-Control-Allow-Origin"]=o):a["Access-Control-Allow-Origin"]="*",n.writeHead(200,a),n.end();return}return Gt(r,n,405,`${dr} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(i.pathname===Dr)return of(r,n,200,await fi(e));if(i.pathname===jo){let a=i.searchParams.get(fr);return a?sf(n,302,await hi(e,a)):Gt(r,n,400,`Missing ${fr} querystring`)}if(i.pathname===ht)return af(r,n,200,await di(e));if(i.pathname===Mo){await cr(e,{_:[]},{});let a=await eu(e),{figmaBuilderLinks:o,foundErrors:s}=await nu({force:!0,mappingFiles:a,sys:e,print:!1});return Sn(r,n,200,"application/json",JSON.stringify({figmaBuilderLinks:o,foundErrors:s,version:2,local:!0},null,2))}return i.pathname===Ct?(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),Gt(r,n,200,"Closing Dev Tools Server")):Gt(r,n,404,"Not found")}catch(i){return e?.Sentry?.captureException(i),Gt(r,n,500,`Dev Server Error: ${i}`)}}function uu(e,t,r,n){Sn(e,t,r,"application/json",JSON.stringify(n))}function of(e,t,r,n){Sn(e,t,r,"application/javascript",n)}function af(e,t,r,n){Sn(e,t,r,"text/html",n)}function Gt(e,t,r,n){Sn(e,t,r,"text/plain",n)}function Sn(e,t,r,n,i){let a={"Content-Type":`${n}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.6.12"},o=e.headers.origin;o&&o!=="null"?cu(new URL(o))&&(a["Access-Control-Allow-Origin"]=o):a["Access-Control-Allow-Origin"]="*",t.writeHead(r,a),t.end(i)}function cu(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 sf(e,t,r){e.writeHead(t,{Location:r}),e.end()}async function uf(e){let t="";for await(let r of e)t+=r;return t}function lf(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function pu(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await cf(e),r=(0,mr.createServer)((i,a)=>{lu(e,r,i,a)}),n=()=>new Promise((i,a)=>{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}`),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",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 cf(e){return new Promise(t=>{let r=e.port;try{(0,mr.request)({hostname:"localhost",port:r,path:Ct,method:"GET"},i=>{i.on("end",()=>{e.debug(`${Ct} - Response ended`),t(r)})}).on("error",i=>{e.debug(`${Ct} - No response ${i}`),t(r)}).end()}catch(n){e.debug(`${Ct} - Error ${n}`),t(r)}})}async function Ao(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},r=e.getFrameworks().map(a=>a.name).join(", ");t.debug(`create devtools ${Oo} [${r}]`);let n=await pu(t);return t.devToolsServerUrl=n.url,t.port=n.port,{getUrl:()=>t.devToolsServerUrl}}var Oo="1.6.12";0&&(module.exports={createDevToolsServer,version});