@hanzo/browser-extension 1.9.69 → 1.9.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chrome/background.js +21 -15
- package/chrome/content-script.js +13 -13
- package/chrome/manifest.json +1 -1
- package/chrome/newtab.css +1 -543
- package/chrome/newtab.js +74 -62
- package/chrome/onboarding.js +3 -3
- package/chrome/popup.css +974 -484
- package/chrome/popup.html +496 -327
- package/chrome/popup.js +15 -14
- package/chrome/sidebar.html +14 -16
- package/chrome/sidebar.js +88 -76
- package/firefox/background.js +40 -38
- package/firefox/content-script.js +13 -13
- package/firefox/manifest.json +1 -1
- package/firefox/newtab.css +1 -543
- package/firefox/newtab.js +74 -62
- package/firefox/onboarding.js +3 -3
- package/firefox/popup.css +974 -484
- package/firefox/popup.html +496 -327
- package/firefox/popup.js +15 -14
- package/firefox/sidebar.html +14 -16
- package/firefox/sidebar.js +88 -76
- package/package.json +1 -1
package/firefox/onboarding.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";(()=>{var He=Object.create;var ie=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty;var Xe=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Qe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of qe(t))!Je.call(e,s)&&s!==n&&ie(e,s,{get:()=>t[s],enumerable:!(r=Ze(t,s))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?He(Ye(e)):{},Qe(t||!e||!e.__esModule?ie(n,"default",{value:e,enumerable:!0}):n,e));var ae=Xe((G,oe)=>{(function(e,t){if(typeof define=="function"&&define.amd)define("webextension-polyfill",["module"],t);else if(typeof G<"u")t(oe);else{var n={exports:{}};t(n),e.browser=n.exports}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:G,function(e){"use strict";if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)e.exports=globalThis.browser;else{let t="The message port closed before a response was received.",n=r=>{let s={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(s).length===0)throw new Error("api-metadata.json has not been included in browser-polyfill");class o extends WeakMap{constructor(a,u=void 0){super(u),this.createItem=a}get(a){return this.has(a)||this.set(a,this.createItem(a)),super.get(a)}}let c=i=>i&&typeof i=="object"&&typeof i.then=="function",f=(i,a)=>(...u)=>{r.runtime.lastError?i.reject(new Error(r.runtime.lastError.message)):a.singleCallbackArg||u.length<=1&&a.singleCallbackArg!==!1?i.resolve(u[0]):i.resolve(u)},p=i=>i==1?"argument":"arguments",_=(i,a)=>function(m,...A){if(A.length<a.minArgs)throw new Error(`Expected at least ${a.minArgs} ${p(a.minArgs)} for ${i}(), got ${A.length}`);if(A.length>a.maxArgs)throw new Error(`Expected at most ${a.maxArgs} ${p(a.maxArgs)} for ${i}(), got ${A.length}`);return new Promise((y,b)=>{if(a.fallbackToNoCallback)try{m[i](...A,f({resolve:y,reject:b},a))}catch(l){console.warn(`${i} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,l),m[i](...A),a.fallbackToNoCallback=!1,a.noCallback=!0,y()}else a.noCallback?(m[i](...A),y()):m[i](...A,f({resolve:y,reject:b},a))})},E=(i,a,u)=>new Proxy(a,{apply(m,A,y){return u.call(A,i,...y)}}),k=Function.call.bind(Object.prototype.hasOwnProperty),S=(i,a={},u={})=>{let m=Object.create(null),A={has(b,l){return l in i||l in m},get(b,l,T){if(l in m)return m[l];if(!(l in i))return;let h=i[l];if(typeof h=="function")if(typeof a[l]=="function")h=E(i,i[l],a[l]);else if(k(u,l)){let N=_(l,u[l]);h=E(i,i[l],N)}else h=h.bind(i);else if(typeof h=="object"&&h!==null&&(k(a,l)||k(u,l)))h=S(h,a[l],u[l]);else if(k(u,"*"))h=S(h,a[l],u["*"]);else return Object.defineProperty(m,l,{configurable:!0,enumerable:!0,get(){return i[l]},set(N){i[l]=N}}),h;return m[l]=h,h},set(b,l,T,h){return l in m?m[l]=T:i[l]=T,!0},defineProperty(b,l,T){return Reflect.defineProperty(m,l,T)},deleteProperty(b,l){return Reflect.deleteProperty(m,l)}},y=Object.create(i);return new Proxy(y,A)},C=i=>({addListener(a,u,...m){a.addListener(i.get(u),...m)},hasListener(a,u){return a.hasListener(i.get(u))},removeListener(a,u){a.removeListener(i.get(u))}}),Ke=new o(i=>typeof i!="function"?i:function(u){let m=S(u,{},{getContent:{minArgs:0,maxArgs:0}});i(m)}),re=new o(i=>typeof i!="function"?i:function(u,m,A){let y=!1,b,l=new Promise(D=>{b=function(x){y=!0,D(x)}}),T;try{T=i(u,m,b)}catch(D){T=Promise.reject(D)}let h=T!==!0&&c(T);if(T!==!0&&!h&&!y)return!1;let N=D=>{D.then(x=>{A(x)},x=>{let F;x&&(x instanceof Error||typeof x.message=="string")?F=x.message:F="An unexpected error occurred",A({__mozWebExtensionPolyfillReject__:!0,message:F})}).catch(x=>{console.error("Failed to send onMessage rejected reply",x)})};return N(h?T:l),!0}),Ve=({reject:i,resolve:a},u)=>{r.runtime.lastError?r.runtime.lastError.message===t?a():i(new Error(r.runtime.lastError.message)):u&&u.__mozWebExtensionPolyfillReject__?i(new Error(u.message)):a(u)},se=(i,a,u,...m)=>{if(m.length<a.minArgs)throw new Error(`Expected at least ${a.minArgs} ${p(a.minArgs)} for ${i}(), got ${m.length}`);if(m.length>a.maxArgs)throw new Error(`Expected at most ${a.maxArgs} ${p(a.maxArgs)} for ${i}(), got ${m.length}`);return new Promise((A,y)=>{let b=Ve.bind(null,{resolve:A,reject:y});m.push(b),u.sendMessage(...m)})},We={devtools:{network:{onRequestFinished:C(Ke)}},runtime:{onMessage:C(re),onMessageExternal:C(re),sendMessage:se.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:se.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},B={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return s.privacy={network:{"*":B},services:{"*":B},websites:{"*":B}},S(r,We,s)};e.exports=n(chrome)}})});var Dn=et(ae());var g={SIGNUP_VIEWED:"signup_viewed",SIGNUP_SUBMITTED:"signup_submitted",SIGNUP_VERIFIED:"signup_verified",SIGNUP_COMPLETED:"signup_completed",LOGIN_COMPLETED:"login_completed",FIRST_ACTION:"first_action",WAITLIST_JOINED:"waitlist_joined",WAITLIST_SHARED:"waitlist_shared",REFERRAL_USED:"referral_used",REFERRAL_CLAIMED:"referral_claimed",PRICING_VIEWED:"pricing_viewed",PLAN_CLICKED:"plan_clicked",CHECKOUT_STARTED:"checkout_started",ORDER_COMPLETED:"order_completed",FEATURE_USED:"feature_used",API_KEY_CREATED:"api_key_created",APP_CREATED:"app_created",PROJECT_CREATED:"project_created",AGENT_CREATED:"agent_created",CHAT_STARTED:"chat_started",CHAT_MESSAGE_SENT:"chat_message_sent",MODEL_SWITCHED:"model_switched",TASK_STARTED:"task_started",TASK_COMPLETED:"task_completed",BUILD_STARTED:"build_started",GENERATION_COMPLETED:"generation_completed",GENERATION_FAILED:"generation_failed",DEPLOY_STARTED:"deploy_started",DEPLOY_SUCCEEDED:"deploy_succeeded",DEPLOY_FAILED:"deploy_failed"},w="$pageview",O="$exception";var d=(e,t,n)=>({event:e,label:t,...n??{}}),j={signup:{label:"Signup",products:["site","id"],join:"aggregate",steps:[d(w,"Landed",{product:"site"}),d(g.SIGNUP_VIEWED,"Opened signup",{product:"site"}),d(g.SIGNUP_SUBMITTED,"Redirected to Hanzo ID",{product:"site"}),d(g.SIGNUP_VIEWED,"Saw the form",{product:"id"}),d(g.SIGNUP_SUBMITTED,"Submitted the form",{product:"id"}),d(g.SIGNUP_COMPLETED,"Account created",{product:"site"})]},apiActivation:{label:"API activation",products:["site","cloud"],join:"person",steps:[d(g.SIGNUP_COMPLETED,"Account created"),d(g.API_KEY_CREATED,"Key minted"),d(g.FIRST_ACTION,"First successful API call",{where:{property:"action",equals:"api_call"}})]},upgrade:{label:"Upgrade",products:["site","app","console","billing","pay"],join:"person",steps:[d(g.PRICING_VIEWED,"Viewed pricing"),d(g.PLAN_CLICKED,"Chose a plan"),d(g.CHECKOUT_STARTED,"Left for checkout",{product:"billing"}),d(g.CHECKOUT_STARTED,"Reached the card form",{product:"pay"}),d(g.ORDER_COMPLETED,"Paid")]},appShip:{label:"Describe \u2192 ship",products:["app"],join:"person",steps:[d(w,"Landed"),d(g.BUILD_STARTED,"Described an app"),d(g.GENERATION_COMPLETED,"Got a working build"),d(g.DEPLOY_STARTED,"Hit publish"),d(g.DEPLOY_SUCCEEDED,"Live URL")]},chatEngage:{label:"Chat engagement",products:["chat"],join:"person",steps:[d(w,"Landed"),d(g.CHAT_STARTED,"Started a conversation"),d(g.CHAT_MESSAGE_SENT,"Sent a message"),d(g.GENERATION_COMPLETED,"Got an answer")]},siteToChat:{label:"Site \u2192 Chat handoff",products:["site","chat"],join:"aggregate",steps:[d(g.CHAT_STARTED,"Submitted the hanzo.ai composer",{product:"site",where:{property:"source",equals:"composer"}}),d(g.CHAT_STARTED,"Landed in hanzo.chat",{product:"chat",where:{property:"referrerProduct",equals:"site"}}),d(g.GENERATION_COMPLETED,"Got an answer")]}};function I(e){return j[e].steps.map(t=>t.event)}var An=Object.freeze(Object.values(g)),_n=Object.freeze([w,O]);var rt=["facebook.","instagram.","twitter.","x.com","t.co","linkedin.","reddit.","youtube.","tiktok.","pinterest.","news.ycombinator.com"],st=["google.","bing.","duckduckgo.","yahoo.","baidu.","ecosia."];function it(e,t){let n=new URLSearchParams(e||""),r=o=>{let c=n.get(o);return c?c.trim():void 0},s={utm:{source:r("utm_source"),medium:r("utm_medium"),campaign:r("utm_campaign"),term:r("utm_term"),content:r("utm_content")},referrer:t?t.trim():void 0,refCode:r("ref")||r("refCode")||r("ref_code")||void 0};return s.channel=ve(s),s}function ve(e){let t=(e.utm.medium||"").toLowerCase();if(/(cpc|ppc|paid|paidsearch|display|cpm)/.test(t))return"paid";if(e.utm.source||e.utm.campaign)return"campaign";if(e.refCode)return"referral";let n=xe(e.referrer);return n?rt.some(r=>n.includes(r))?"social":st.some(r=>n.includes(r))?"organic":"referral":"direct"}function xe(e){if(!e)return"";let t=e.trim(),n=t.indexOf("://");n>=0&&(t=t.slice(n+3));let r=t.search(/[/?#]/);r>=0&&(t=t.slice(0,r));let s=t.indexOf("@");s>=0&&(t=t.slice(s+1));let o=t.indexOf(":");return o>=0&&(t=t.slice(0,o)),t.toLowerCase().trim()}function ot(e){return!!(e.utm.source||e.utm.medium||e.utm.campaign||e.utm.term||e.utm.content||e.refCode||e.referrer&&xe(e.referrer))}var at=Object.freeze({console:"019fa40b-94ae-7f1d-8f7b-e92f123fad42",app:"019f9b1e-57eb-7171-9d92-72c0b85e4b4b",site:"019f9b1e-5785-7359-ad0b-f75db8e58c99"});function ce(e,t){if(!e||!t)return;let n=at[e];if(n)return`https://${t}@api.hanzo.ai/v1/event/${n}`}var ct=Object.freeze({hanzo:Object.freeze(["hanzo.ai","hanzo.app","hanzo.bot","hanzo.chat","hanzo.codes","hanzo.id","hanzo.sh","hanzo.team","hanzo.ventures","hanzo.works","hanzoskills.com"]),lux:Object.freeze(["lux.network","lux.exchange","lux.market","lux.finance","lux.financial","lux.credit","lux.fund","lux.id"]),zoo:Object.freeze(["zoo.ngo","zoo.network","zoolabs.id","zoolabs.io"])}),we=Object.freeze({hanzo:"pk-rM_CdaF2MQckGCrla113SrR1oH4zvqN8xh2I95Z9tY8",lux:"pk-gUZp6ZVfhJzSwK-rb4oLbVkpCnMBx5uSCpxf_5yEhQk",zoo:"pk-3TKpKnERV9AQSsBUERWkZejC1O1mUxc1jRzsP3MPbs4"}),lt="pk-",gt=e=>e.trim().toLowerCase().replace(/\.$/,"").split(":")[0]??"";function ut(e){let t=gt(e);if(!t)return;let n,r=0;for(let[s,o]of Object.entries(ct))for(let c of o)(t===c||t.endsWith(`.${c}`))&&c.length>r&&(n=s,r=c.length);return n}function mt(e,t=we){let n=ut(e);if(!n)return;let r=t[n];if(typeof r!="string")return;let s=r.trim();return s.startsWith(lt)?s:void 0}function dt(e=we){if(!(typeof location>"u"))return mt(location.hostname,e)}var q="[redacted]",ft="[email]",le="[ip]",pt=[/-----BEGIN[ A-Z]*PRIVATE KEY-----[\s\S]*?-----END[ A-Z]*PRIVATE KEY-----/g,/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/g,/\bbearer\s+[A-Za-z0-9._~+/-]{12,}=*/gi,/\b(?:sk|pk|rk)-[A-Za-z0-9]{2,}-?[A-Za-z0-9]{12,}/g,/\b(?:sk|pk)_(?:live|test)_[A-Za-z0-9]{16,}/g,/\bhk-[A-Za-z0-9]{16,}/g,/\bAKIA[0-9A-Z]{16}\b/g,/\bASIA[0-9A-Z]{16}\b/g,/\bAIza[0-9A-Za-z_-]{20,}/g,/\bgh[posru]_[A-Za-z0-9]{20,}/g,/\bxox[baprs]-[A-Za-z0-9-]{10,}/g,/[a-zA-Z][a-zA-Z0-9+.-]{0,32}:\/\/[^\s:@/]{1,256}:[^\s@/]{1,256}@/g],ht=/\b(?:\d[ -]?){13,19}\b/g;function At(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let s=e.charCodeAt(r)-48;n&&(s*=2,s>9&&(s-=9)),t+=s,n=!n}return t%10===0}function _t(e){return e.replace(ht,t=>{let n=t.replace(/[ -]/g,"");return n.length<13||n.length>19?t:At(n)?q:t})}var Et=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,yt=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,bt=/\b(?:[0-9A-Fa-f]{1,4}:){2,7}[0-9A-Fa-f]{1,4}\b/g,Tt=["code","state","token","access_token","id_token","refresh_token","auth","authorization","secret","client_secret","password","passwd","pwd","api_key","apikey","key","session","session_id","sid","sig","signature","nonce","otp","invite","invitation","reset_token","confirmation_token","magic","ticket","assertion"],vt=new RegExp("([?&#;](?:"+Tt.join("|")+")=)[^&#;\\s]{1,4096}","gi");function xt(e){return e.replace(vt,(t,n)=>n+q)}function wt(e){e=xt(e);for(let t of pt)e=e.replace(t,q);return _t(e)}function kt(e){return e=e.replace(Et,ft),e=e.replace(bt,le),e=e.replace(yt,le),e}var St=8192;function Ct(e,t=St){return e.length>t?e.slice(0,t)+"\u2026 [truncated]":e}function z(e,t=!1){return e?(e=Ct(e),e=wt(e),t||(e=kt(e)),e):e??""}var L="iam-anon-id",K=["hz_anon_id","hz_id"],V="hanzo.ai",It=2*365*24*60*60,ge;function U(e){var t=new Uint8Array(16),n,r=typeof crypto<"u"?crypto:void 0;if(r&&typeof r.getRandomValues=="function")r.getRandomValues(t);else for(n=0;n<16;n++)t[n]=Math.random()*256|0;var s=Math.floor(e===void 0?Date.now():e);for(n=5;n>=0;n--)t[n]=s%256,s=Math.floor(s/256);t[6]=112|t[6]&15,t[8]=128|t[8]&63;var o="";for(n=0;n<16;n++)o+=(t[n]+256).toString(16).slice(1),(n===3||n===5||n===7||n===9)&&(o+="-");return o}function ke(){try{return typeof document>"u"||typeof document.cookie!="string"?null:document}catch{return null}}function Pt(){try{return typeof window>"u"||!window.localStorage?null:window.localStorage}catch{return null}}function Se(e,t){try{return e&&e.getItem(t)||""}catch{return""}}function Ce(e){var t=ke();if(!t)return"";for(var n=t.cookie.split(";"),r=0;r<n.length;r++){var s=n[r].indexOf("=");if(!(s<0||n[r].slice(0,s).trim()!==e)){var o=n[r].slice(s+1).trim();if(o)try{return decodeURIComponent(o)}catch{return o}}}return""}function Nt(e,t){var n=ke();if(n){var r="",s=!1;try{typeof window<"u"&&window.location&&(r=window.location.hostname||"",s=window.location.protocol==="https:")}catch{}var o=e+"="+encodeURIComponent(t);o+="; Path=/; Max-Age="+It+"; SameSite=Lax",("."+r).slice(-(V.length+1))==="."+V&&(o+="; Domain="+V),s&&(o+="; Secure");try{n.cookie=o}catch{}}}function Ot(e){for(var t=0;t<K.length;t++){var n=Ce(K[t])||Se(e,K[t]);if(n)return n}return""}function Rt(){if(typeof window>"u")return"";var e=Pt(),t=Ce(L)||Se(e,L)||Ot(e)||ge||U();ge=t,Nt(L,t);try{e&&e.getItem(L)!==t&&e.setItem(L,t)}catch{}return t}var Dt="0.3.41",Ie=Dt,ue=50,Lt=500,zt=2048,me=1024,Ut=50;function Mt(){return U().replace(/-/g,"")}function $t(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e).length:typeof Buffer<"u"?Buffer.byteLength(e,"utf8"):e.length}function de(e){if(!e)return null;let t=/^(https?):\/\/([^@]+)@([^/]+)(\/.*)?$/.exec(e.trim());if(!t)return null;let n=t[1],r=t[2],s=t[3],o=t[4]??"";if(!r||!s)return null;let c=o.split("/").filter(Boolean),f=c.length>0?c[c.length-1]:"";if(!f)return null;let p=`${n}://${s}`,_=`${p}/${c.map(encodeURIComponent).join("/")}`,E=`${_}/envelope/?sentry_key=${encodeURIComponent(r)}`;return{publicKey:r,origin:p,projectId:f,base:_,ingestUrl:E}}var Bt=/^\s*at\s+(?:(.+?)\s+\()?(?:(.+?):(\d+):(\d+)|([^)]+))\)?\s*$/,Ft=/^\s*(?:(.*?)@)?(.+?):(\d+):(\d+)\s*$/;function Gt(e){return e?!(e.includes("node_modules")||e.startsWith("webpack-internal")||e.startsWith("webpack://")||e.startsWith("chrome-extension://")||e.startsWith("moz-extension://")):!1}function Pe(e){if(!e)return[];let t=e.split(`
|
|
2
|
-
`,
|
|
1
|
+
"use strict";(()=>{var He=Object.create;var ie=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty;var Xe=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Qe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of qe(t))!Je.call(e,s)&&s!==n&&ie(e,s,{get:()=>t[s],enumerable:!(r=Ze(t,s))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?He(Ye(e)):{},Qe(t||!e||!e.__esModule?ie(n,"default",{value:e,enumerable:!0}):n,e));var ae=Xe((G,oe)=>{(function(e,t){if(typeof define=="function"&&define.amd)define("webextension-polyfill",["module"],t);else if(typeof G<"u")t(oe);else{var n={exports:{}};t(n),e.browser=n.exports}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:G,function(e){"use strict";if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)e.exports=globalThis.browser;else{let t="The message port closed before a response was received.",n=r=>{let s={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(s).length===0)throw new Error("api-metadata.json has not been included in browser-polyfill");class o extends WeakMap{constructor(a,u=void 0){super(u),this.createItem=a}get(a){return this.has(a)||this.set(a,this.createItem(a)),super.get(a)}}let c=i=>i&&typeof i=="object"&&typeof i.then=="function",f=(i,a)=>(...u)=>{r.runtime.lastError?i.reject(new Error(r.runtime.lastError.message)):a.singleCallbackArg||u.length<=1&&a.singleCallbackArg!==!1?i.resolve(u[0]):i.resolve(u)},p=i=>i==1?"argument":"arguments",_=(i,a)=>function(m,...A){if(A.length<a.minArgs)throw new Error(`Expected at least ${a.minArgs} ${p(a.minArgs)} for ${i}(), got ${A.length}`);if(A.length>a.maxArgs)throw new Error(`Expected at most ${a.maxArgs} ${p(a.maxArgs)} for ${i}(), got ${A.length}`);return new Promise((y,b)=>{if(a.fallbackToNoCallback)try{m[i](...A,f({resolve:y,reject:b},a))}catch(l){console.warn(`${i} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,l),m[i](...A),a.fallbackToNoCallback=!1,a.noCallback=!0,y()}else a.noCallback?(m[i](...A),y()):m[i](...A,f({resolve:y,reject:b},a))})},E=(i,a,u)=>new Proxy(a,{apply(m,A,y){return u.call(A,i,...y)}}),k=Function.call.bind(Object.prototype.hasOwnProperty),S=(i,a={},u={})=>{let m=Object.create(null),A={has(b,l){return l in i||l in m},get(b,l,T){if(l in m)return m[l];if(!(l in i))return;let h=i[l];if(typeof h=="function")if(typeof a[l]=="function")h=E(i,i[l],a[l]);else if(k(u,l)){let N=_(l,u[l]);h=E(i,i[l],N)}else h=h.bind(i);else if(typeof h=="object"&&h!==null&&(k(a,l)||k(u,l)))h=S(h,a[l],u[l]);else if(k(u,"*"))h=S(h,a[l],u["*"]);else return Object.defineProperty(m,l,{configurable:!0,enumerable:!0,get(){return i[l]},set(N){i[l]=N}}),h;return m[l]=h,h},set(b,l,T,h){return l in m?m[l]=T:i[l]=T,!0},defineProperty(b,l,T){return Reflect.defineProperty(m,l,T)},deleteProperty(b,l){return Reflect.deleteProperty(m,l)}},y=Object.create(i);return new Proxy(y,A)},C=i=>({addListener(a,u,...m){a.addListener(i.get(u),...m)},hasListener(a,u){return a.hasListener(i.get(u))},removeListener(a,u){a.removeListener(i.get(u))}}),Ke=new o(i=>typeof i!="function"?i:function(u){let m=S(u,{},{getContent:{minArgs:0,maxArgs:0}});i(m)}),re=new o(i=>typeof i!="function"?i:function(u,m,A){let y=!1,b,l=new Promise(D=>{b=function(x){y=!0,D(x)}}),T;try{T=i(u,m,b)}catch(D){T=Promise.reject(D)}let h=T!==!0&&c(T);if(T!==!0&&!h&&!y)return!1;let N=D=>{D.then(x=>{A(x)},x=>{let F;x&&(x instanceof Error||typeof x.message=="string")?F=x.message:F="An unexpected error occurred",A({__mozWebExtensionPolyfillReject__:!0,message:F})}).catch(x=>{console.error("Failed to send onMessage rejected reply",x)})};return N(h?T:l),!0}),Ve=({reject:i,resolve:a},u)=>{r.runtime.lastError?r.runtime.lastError.message===t?a():i(new Error(r.runtime.lastError.message)):u&&u.__mozWebExtensionPolyfillReject__?i(new Error(u.message)):a(u)},se=(i,a,u,...m)=>{if(m.length<a.minArgs)throw new Error(`Expected at least ${a.minArgs} ${p(a.minArgs)} for ${i}(), got ${m.length}`);if(m.length>a.maxArgs)throw new Error(`Expected at most ${a.maxArgs} ${p(a.maxArgs)} for ${i}(), got ${m.length}`);return new Promise((A,y)=>{let b=Ve.bind(null,{resolve:A,reject:y});m.push(b),u.sendMessage(...m)})},We={devtools:{network:{onRequestFinished:C(Ke)}},runtime:{onMessage:C(re),onMessageExternal:C(re),sendMessage:se.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:se.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},B={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return s.privacy={network:{"*":B},services:{"*":B},websites:{"*":B}},S(r,We,s)};e.exports=n(chrome)}})});var Dn=et(ae());var g={SIGNUP_VIEWED:"signup_viewed",SIGNUP_SUBMITTED:"signup_submitted",SIGNUP_VERIFIED:"signup_verified",SIGNUP_COMPLETED:"signup_completed",LOGIN_COMPLETED:"login_completed",FIRST_ACTION:"first_action",WAITLIST_JOINED:"waitlist_joined",WAITLIST_SHARED:"waitlist_shared",REFERRAL_USED:"referral_used",REFERRAL_CLAIMED:"referral_claimed",PRICING_VIEWED:"pricing_viewed",PLAN_CLICKED:"plan_clicked",CHECKOUT_STARTED:"checkout_started",ORDER_COMPLETED:"order_completed",FEATURE_USED:"feature_used",API_KEY_CREATED:"api_key_created",APP_CREATED:"app_created",PROJECT_CREATED:"project_created",AGENT_CREATED:"agent_created",CHAT_STARTED:"chat_started",CHAT_MESSAGE_SENT:"chat_message_sent",MODEL_SWITCHED:"model_switched",TASK_STARTED:"task_started",TASK_COMPLETED:"task_completed",BUILD_STARTED:"build_started",GENERATION_COMPLETED:"generation_completed",GENERATION_FAILED:"generation_failed",DEPLOY_STARTED:"deploy_started",DEPLOY_SUCCEEDED:"deploy_succeeded",DEPLOY_FAILED:"deploy_failed"},w="$pageview",O="$exception";var d=(e,t,n)=>({event:e,label:t,...n??{}}),j={signup:{label:"Signup",products:["site","id"],join:"aggregate",steps:[d(w,"Landed",{product:"site"}),d(g.SIGNUP_VIEWED,"Opened signup",{product:"site"}),d(g.SIGNUP_SUBMITTED,"Redirected to Hanzo ID",{product:"site"}),d(g.SIGNUP_VIEWED,"Saw the form",{product:"id"}),d(g.SIGNUP_SUBMITTED,"Submitted the form",{product:"id"}),d(g.SIGNUP_COMPLETED,"Account created",{product:"site"})]},apiActivation:{label:"API activation",products:["site","cloud"],join:"person",steps:[d(g.SIGNUP_COMPLETED,"Account created"),d(g.API_KEY_CREATED,"Key minted"),d(g.FIRST_ACTION,"First successful API call",{where:{property:"action",equals:"api_call"}})]},upgrade:{label:"Upgrade",products:["site","app","console","billing","pay"],join:"person",steps:[d(g.PRICING_VIEWED,"Viewed pricing"),d(g.PLAN_CLICKED,"Chose a plan"),d(g.CHECKOUT_STARTED,"Left for checkout",{product:"billing"}),d(g.CHECKOUT_STARTED,"Reached the card form",{product:"pay"}),d(g.ORDER_COMPLETED,"Paid")]},appShip:{label:"Describe \u2192 ship",products:["app"],join:"person",steps:[d(w,"Landed"),d(g.BUILD_STARTED,"Described an app"),d(g.GENERATION_COMPLETED,"Got a working build"),d(g.DEPLOY_STARTED,"Hit publish"),d(g.DEPLOY_SUCCEEDED,"Live URL")]},chatEngage:{label:"Chat engagement",products:["chat"],join:"person",steps:[d(w,"Landed"),d(g.CHAT_STARTED,"Started a conversation"),d(g.CHAT_MESSAGE_SENT,"Sent a message"),d(g.GENERATION_COMPLETED,"Got an answer")]},siteToChat:{label:"Site \u2192 Chat handoff",products:["site","chat"],join:"aggregate",steps:[d(g.CHAT_STARTED,"Submitted the hanzo.ai composer",{product:"site",where:{property:"source",equals:"composer"}}),d(g.CHAT_STARTED,"Landed in hanzo.chat",{product:"chat",where:{property:"referrerProduct",equals:"site"}}),d(g.GENERATION_COMPLETED,"Got an answer")]}};function I(e){return j[e].steps.map(t=>t.event)}var An=Object.freeze(Object.values(g)),_n=Object.freeze([w,O]);var rt=["facebook.","instagram.","twitter.","x.com","t.co","linkedin.","reddit.","youtube.","tiktok.","pinterest.","news.ycombinator.com"],st=["google.","bing.","duckduckgo.","yahoo.","baidu.","ecosia."];function it(e,t){let n=new URLSearchParams(e||""),r=o=>{let c=n.get(o);return c?c.trim():void 0},s={utm:{source:r("utm_source"),medium:r("utm_medium"),campaign:r("utm_campaign"),term:r("utm_term"),content:r("utm_content")},referrer:t?t.trim():void 0,refCode:r("ref")||r("refCode")||r("ref_code")||void 0};return s.channel=ve(s),s}function ve(e){let t=(e.utm.medium||"").toLowerCase();if(/(cpc|ppc|paid|paidsearch|display|cpm)/.test(t))return"paid";if(e.utm.source||e.utm.campaign)return"campaign";if(e.refCode)return"referral";let n=xe(e.referrer);return n?rt.some(r=>n.includes(r))?"social":st.some(r=>n.includes(r))?"organic":"referral":"direct"}function xe(e){if(!e)return"";let t=e.trim(),n=t.indexOf("://");n>=0&&(t=t.slice(n+3));let r=t.search(/[/?#]/);r>=0&&(t=t.slice(0,r));let s=t.indexOf("@");s>=0&&(t=t.slice(s+1));let o=t.indexOf(":");return o>=0&&(t=t.slice(0,o)),t.toLowerCase().trim()}function ot(e){return!!(e.utm.source||e.utm.medium||e.utm.campaign||e.utm.term||e.utm.content||e.refCode||e.referrer&&xe(e.referrer))}var at=Object.freeze({console:"019fa40b-94ae-7f1d-8f7b-e92f123fad42",app:"019f9b1e-57eb-7171-9d92-72c0b85e4b4b",site:"019f9b1e-5785-7359-ad0b-f75db8e58c99"});function ce(e,t){if(!e||!t)return;let n=at[e];if(n)return`https://${t}@api.hanzo.ai/v1/event/${n}`}var ct=Object.freeze({hanzo:Object.freeze(["hanzo.ai","hanzo.app","hanzo.bot","hanzo.chat","hanzo.codes","hanzo.id","hanzo.sh","hanzo.team","hanzo.ventures","hanzo.works","hanzoskills.com"]),lux:Object.freeze(["lux.network","lux.exchange","lux.market","lux.finance","lux.financial","lux.credit","lux.fund","lux.id"]),zoo:Object.freeze(["zoo.ngo","zoo.network","zoolabs.id","zoolabs.io"])}),we=Object.freeze({hanzo:"pk-rM_CdaF2MQckGCrla113SrR1oH4zvqN8xh2I95Z9tY8",lux:"pk-gUZp6ZVfhJzSwK-rb4oLbVkpCnMBx5uSCpxf_5yEhQk",zoo:"pk-3TKpKnERV9AQSsBUERWkZejC1O1mUxc1jRzsP3MPbs4"}),lt="pk-",gt=e=>e.trim().toLowerCase().replace(/\.$/,"").split(":")[0]??"";function ut(e){let t=gt(e);if(!t)return;let n,r=0;for(let[s,o]of Object.entries(ct))for(let c of o)(t===c||t.endsWith(`.${c}`))&&c.length>r&&(n=s,r=c.length);return n}function mt(e,t=we){let n=ut(e);if(!n)return;let r=t[n];if(typeof r!="string")return;let s=r.trim();return s.startsWith(lt)?s:void 0}function dt(e=we){if(!(typeof location>"u"))return mt(location.hostname,e)}var q="[redacted]",ft="[email]",le="[ip]",pt=[/-----BEGIN[ A-Z]*PRIVATE KEY-----[\s\S]*?-----END[ A-Z]*PRIVATE KEY-----/g,/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/g,/\bbearer\s+[A-Za-z0-9._~+/-]{12,}=*/gi,/\b(?:sk|pk|rk)-[A-Za-z0-9]{2,}-?[A-Za-z0-9]{12,}/g,/\b(?:sk|pk)_(?:live|test)_[A-Za-z0-9]{16,}/g,/\bhk-[A-Za-z0-9]{16,}/g,/\bAKIA[0-9A-Z]{16}\b/g,/\bASIA[0-9A-Z]{16}\b/g,/\bAIza[0-9A-Za-z_-]{20,}/g,/\bgh[posru]_[A-Za-z0-9]{20,}/g,/\bxox[baprs]-[A-Za-z0-9-]{10,}/g,/[a-zA-Z][a-zA-Z0-9+.-]{0,32}:\/\/[^\s:@/]{1,256}:[^\s@/]{1,256}@/g],ht=/\b(?:\d[ -]?){13,19}\b/g;function At(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let s=e.charCodeAt(r)-48;n&&(s*=2,s>9&&(s-=9)),t+=s,n=!n}return t%10===0}function _t(e){return e.replace(ht,t=>{let n=t.replace(/[ -]/g,"");return n.length<13||n.length>19?t:At(n)?q:t})}var Et=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,yt=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,bt=/\b(?:[0-9A-Fa-f]{1,4}:){2,7}[0-9A-Fa-f]{1,4}\b/g,Tt=["code","state","token","access_token","id_token","refresh_token","auth","authorization","secret","client_secret","password","passwd","pwd","api_key","apikey","key","session","session_id","sid","sig","signature","nonce","otp","invite","invitation","reset_token","confirmation_token","magic","ticket","assertion"],vt=new RegExp("([?&#;](?:"+Tt.join("|")+")=)[^&#;\\s]{1,4096}","gi");function xt(e){return e.replace(vt,(t,n)=>n+q)}function wt(e){e=xt(e);for(let t of pt)e=e.replace(t,q);return _t(e)}function kt(e){return e=e.replace(Et,ft),e=e.replace(bt,le),e=e.replace(yt,le),e}var St=8192;function Ct(e,t=St){return e.length>t?e.slice(0,t)+"\u2026 [truncated]":e}function L(e,t=!1){return e?(e=Ct(e),e=wt(e),t||(e=kt(e)),e):e??""}var z="iam-anon-id",K=["hz_anon_id","hz_id"],V="hanzo.ai",It=2*365*24*60*60,ge;function U(e){var t=new Uint8Array(16),n,r=typeof crypto<"u"?crypto:void 0;if(r&&typeof r.getRandomValues=="function")r.getRandomValues(t);else for(n=0;n<16;n++)t[n]=Math.random()*256|0;var s=Math.floor(e===void 0?Date.now():e);for(n=5;n>=0;n--)t[n]=s%256,s=Math.floor(s/256);t[6]=112|t[6]&15,t[8]=128|t[8]&63;var o="";for(n=0;n<16;n++)o+=(t[n]+256).toString(16).slice(1),(n===3||n===5||n===7||n===9)&&(o+="-");return o}function ke(){try{return typeof document>"u"||typeof document.cookie!="string"?null:document}catch{return null}}function Pt(){try{return typeof window>"u"||!window.localStorage?null:window.localStorage}catch{return null}}function Se(e,t){try{return e&&e.getItem(t)||""}catch{return""}}function Ce(e){var t=ke();if(!t)return"";for(var n=t.cookie.split(";"),r=0;r<n.length;r++){var s=n[r].indexOf("=");if(!(s<0||n[r].slice(0,s).trim()!==e)){var o=n[r].slice(s+1).trim();if(o)try{return decodeURIComponent(o)}catch{return o}}}return""}function Nt(e,t){var n=ke();if(n){var r="",s=!1;try{typeof window<"u"&&window.location&&(r=window.location.hostname||"",s=window.location.protocol==="https:")}catch{}var o=e+"="+encodeURIComponent(t);o+="; Path=/; Max-Age="+It+"; SameSite=Lax",("."+r).slice(-(V.length+1))==="."+V&&(o+="; Domain="+V),s&&(o+="; Secure");try{n.cookie=o}catch{}}}function Ot(e){for(var t=0;t<K.length;t++){var n=Ce(K[t])||Se(e,K[t]);if(n)return n}return""}function Rt(){if(typeof window>"u")return"";var e=Pt(),t=Ce(z)||Se(e,z)||Ot(e)||ge||U();ge=t,Nt(z,t);try{e&&e.getItem(z)!==t&&e.setItem(z,t)}catch{}return t}var Dt="0.3.41",Ie=Dt,ue=50,zt=500,Lt=2048,me=1024,Ut=50;function Mt(){return U().replace(/-/g,"")}function $t(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e).length:typeof Buffer<"u"?Buffer.byteLength(e,"utf8"):e.length}function de(e){if(!e)return null;let t=/^(https?):\/\/([^@]+)@([^/]+)(\/.*)?$/.exec(e.trim());if(!t)return null;let n=t[1],r=t[2],s=t[3],o=t[4]??"";if(!r||!s)return null;let c=o.split("/").filter(Boolean),f=c.length>0?c[c.length-1]:"";if(!f)return null;let p=`${n}://${s}`,_=`${p}/${c.map(encodeURIComponent).join("/")}`,E=`${_}/envelope/?sentry_key=${encodeURIComponent(r)}`;return{publicKey:r,origin:p,projectId:f,base:_,ingestUrl:E}}var Bt=/^\s*at\s+(?:(.+?)\s+\()?(?:(.+?):(\d+):(\d+)|([^)]+))\)?\s*$/,Ft=/^\s*(?:(.*?)@)?(.+?):(\d+):(\d+)\s*$/;function Gt(e){return e?!(e.includes("node_modules")||e.startsWith("webpack-internal")||e.startsWith("webpack://")||e.startsWith("chrome-extension://")||e.startsWith("moz-extension://")):!1}function Pe(e){if(!e)return[];let t=e.split(`
|
|
2
|
+
`,zt),n=[];for(let r of t){if(r.length>Lt)continue;let s=r.trimEnd();if(!s)continue;let o,c="",f=0,p=0,_=Bt.exec(s);if(_)o=_[1],_[2]?(c=_[2],f=Number(_[3])||0,p=Number(_[4])||0):c=(_[5]||"").trim();else{let E=Ft.exec(s);if(!E)continue;o=E[1],c=E[2],f=Number(E[3])||0,p=Number(E[4])||0}!c&&!o||n.push({function:o||"<anonymous>",filename:c,abs_path:c,lineno:f,colno:p,in_app:Gt(c)})}return n.reverse(),n.length>ue?n.slice(n.length-ue):n}function Y(e){if(e instanceof Error){let t=W(e,"name"),n=W(e,"message"),r=W(e,"stack");return{name:typeof t=="string"&&t?t:"Error",message:typeof n=="string"&&n?n:H(e),stack:typeof r=="string"?r:void 0}}if(typeof e=="string")return{name:"Error",message:e};try{return{name:"Error",message:JSON.stringify(e)??H(e)}}catch{return{name:"Error",message:H(e)}}}function W(e,t){try{return e[t]}catch{return}}function H(e){try{return String(e)}catch{return"[unstringifiable]"}}function jt(e){let t=typeof e=="string"?e:(()=>{try{return JSON.stringify(e)??String(e)}catch{try{return String(e)}catch{return"[unstringifiable]"}}})();return t.length>me?t.slice(0,me):t}function Kt(e){let{error:t,options:n={},identity:r,capturePII:s=!1}=e,o=Y(t),c=n.handled!==!1,f=n.level??(c?"error":"fatal"),p={handled:String(c)};r.product&&(p.product=r.product),r.sessionId&&(p.session=r.sessionId);try{let E=n.properties??{},k=0;for(let S of Object.keys(E)){if(k>=Ut)break;try{let C=E[S];if(C==null)continue;p[S]=L(jt(C),s),k++}catch{continue}}}catch{}let _={event_id:e.id??Mt(),timestamp:(e.now??Date.now())/1e3,platform:"javascript",level:f,logger:r.product,environment:r.environment,release:r.release,exception:{values:[{type:o.name,value:L(o.message,s),stacktrace:{frames:Pe(o.stack)}}]},tags:p,sdk:{name:"@hanzo/event",version:Ie}};return r.userId&&(_.user={id:r.userId}),_}function Vt(e,t,n){let r=JSON.stringify(e),s=JSON.stringify({event_id:e.event_id,dsn:t.base,sent_at:n??new Date().toISOString()}),o=JSON.stringify({type:"event",content_type:"application/json",length:$t(r)});return`${s}
|
|
3
3
|
${o}
|
|
4
4
|
${r}
|
|
5
5
|
`}var Wt=4096;function Ne(e){let t="";for(let n of[2166136261,16777619,2654435769,2246822507]){let r=n>>>0;for(let s=0;s<e.length;s++)r^=e.charCodeAt(s),r=r+(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24)>>>0;t+=r.toString(16).padStart(8,"0")}return t}function Ht(e){let t=e.filename??"",n=e.function??"<anonymous>",r=e.lineno??0,s=e.colno??0;return{raw_id:`${Ne(`${t}|${n}|${r}|${s}`)}/0`,mangled_name:n,source:t,line:r,column:s,in_app:e.in_app??!1,lang:"javascript",resolved:!1,resolve_failure:"no symbol set uploaded for this release",resolved_name:null,module:null}}function Zt(e,t){if(e.length<=t)return e;let n=t,r=e.charCodeAt(n-1);return r>=55296&&r<=56319&&n--,e.slice(0,n)}function qt(e,t){let n=Y(e),r=Pe(n.stack).slice(-50),s={id:t.id,type:n.name,value:Zt(n.message,Wt),mechanism:{type:"generic",handled:t.handled,synthetic:!(e instanceof Error)}};return r.length>0&&(s.stacktrace={type:"resolved",frames:r.map(Ht)}),s}function Yt(e){var r;let n=(((r=e.stacktrace)==null?void 0:r.frames)??[]).filter(s=>s.in_app).map(s=>`${s.mangled_name}@${s.source}`);return Ne([e.type,...n].join(`
|
|
6
|
-
`))}function Jt(e,t){var o,c;let n=qt(e,t),r=((o=n.stacktrace)==null?void 0:o.frames)??[],s=Yt(n);return{$exception_list:[n],$exception_fingerprint:s,$exception_fingerprint_record:[{type:"manual"}],$exception_type:n.type,$exception_message:n.value,$exception_level:t.level??"error",$exception_handled:t.handled,$exception_synthetic:((c=n.mechanism)==null?void 0:c.synthetic)??!1,$exception_types:[n.type],$exception_values:[n.value],$exception_sources:r.map(f=>f.source).filter(f=>!!f),$exception_functions:r.map(f=>f.resolved_name??f.mangled_name).filter(f=>!!f)}}var R={session:"hz_session",firstTouch:"hz_first_touch",cohort:"hz_cohort"},Xt=1800*1e3;function M(){try{return typeof window>"u"||!window.localStorage?void 0:window.localStorage}catch{return}}function fe(){return Rt()||void 0}function pe(e=Date.now()){let t=M();if(!t)return;let n=null;try{n=JSON.parse(t.getItem(R.session)||"null")}catch{n=null}return!n||e-n.last>Xt?n={id:U(e),last:e}:n.last=e,t.setItem(R.session,JSON.stringify(n)),n.id}function Oe(){let e=M();if(e)try{let t=e.getItem(R.firstTouch);return t?JSON.parse(t):void 0}catch{return}}function Qt(e){let t=M(),n=Oe();return n||(t&&t.setItem(R.firstTouch,JSON.stringify(e)),e)}function en(){let e=M();if(e)try{let t=e.getItem(R.cohort);return t?JSON.parse(t):void 0}catch{return}}function he(e){let t=M(),n=en()||{},r={signupWeek:n.signupWeek||e.signupWeek,channel:e.channel||n.channel,refCode:n.refCode||e.refCode};return t&&t.setItem(R.cohort,JSON.stringify(r)),r}var Ae="/v1/event",Re="https://api.hanzo.ai",tn="application/x-sentry-envelope",_e="text/plain";function Ee(){try{if(typeof process<"u"&&process.env)return process.env.NEXT_PUBLIC_HANZO_EVENT_DSN||process.env.HANZO_EVENT_DSN||void 0}catch{}}function Z(e){try{if(typeof process<"u"&&process.env)return process.env[e]||void 0}catch{}}function ye(e,t,n){return e+(e.includes("?")?"&":"?")+t+"="+encodeURIComponent(n)}function nn(e){let t=Y(e);return{type:t.name,message:t.message,stack:t.stack}}var P=()=>typeof window<"u"&&typeof document<"u";function rn(e){try{return JSON.stringify({batch:e})}catch{}let t=[];for(let n of e)try{t.push(JSON.stringify(n))}catch{try{t.push(JSON.stringify({...n,properties:{$unserializable:!0}}))}catch{}}return t.length>0?'{"batch":['+t.join(",")+"]}":null}var sn=class{send(e,t,n){if(n.beacon&&P()&&typeof navigator.sendBeacon=="function"){let c=n.ingestKey?ye(e,"ingest_key",n.ingestKey):e;try{if(navigator.sendBeacon(c,new Blob([t],{type:_e})))return;n.debug&&console.warn("[event] beacon refused, falling back to fetch")}catch{}}if(typeof fetch!="function")return;let r=n.ingestKey!==void 0&&n.contentType===void 0,s={"Content-Type":r?_e:n.contentType??"application/json"},o=r?void 0:n.ingestKey??n.token;o&&(s.Authorization=`Bearer ${o}`),fetch(r?ye(e,"ingest_key",n.ingestKey):e,{method:"POST",headers:s,body:t,keepalive:!0,credentials:r?"omit":"include"}).then(c=>{!c.ok&&n.debug&&console.warn("[event] ingest rejected",c.status,e.split("?")[0])}).catch(c=>{n.debug&&console.warn("[event] ingest failed",e.split("?")[0],c)})}},be=class{constructor(e){this.queue=[],this.timer=null,this.attribution={utm:{}},this.cohort={},this.started=!1,this.reentrant=!1,this.cfg={host:Re,batchSize:20,flushIntervalMs:5e3,enabled:!0,captureErrors:!0,...e,ingestKey:e.ingestKey??Z("NEXT_PUBLIC_PUBLISHABLE_KEY")??dt()},this.transport=e.transport??new sn,this.dsn=de(e.dsn??Ee()??ce(this.cfg.product,this.cfg.ingestKey))}adopt(e){e.ingestKey&&!this.cfg.ingestKey&&(this.cfg.ingestKey=e.ingestKey),e.getToken&&!this.cfg.getToken&&(this.cfg.getToken=e.getToken),this.dsn||(this.dsn=de(e.dsn??Ee()??ce(this.cfg.product,this.cfg.ingestKey)))}get errorPlaneEnabled(){return this.dsn!==null}get errorIngestUrl(){var e;return(e=this.dsn)==null?void 0:e.ingestUrl}init(){if(this.started||!this.cfg.enabled||(this.started=!0,!P()))return;let e=it(window.location.search,document.referrer);this.attribution=ot(e)?Qt(e):Oe()??e,this.cohort=he({channel:this.attribution.channel??ve(this.attribution),refCode:this.attribution.refCode});let t=()=>{document.visibilityState==="hidden"&&this.flush(!0)};window.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>this.flush(!0)),this.cfg.captureErrors&&(window.addEventListener("error",n=>{this.captureError(n.error??n.message,{handled:!1})}),window.addEventListener("unhandledrejection",n=>{this.captureError(n.reason,{handled:!1})}))}identify(e,t){this.personId=e,this.enqueue("identify",void 0,{properties:t})}group(e,t){this.enqueue("group",void 0,{groupId:e,properties:t})}pageview(e,t){let n=e??(P()?window.location.pathname:void 0),r=(n??"")+"\0"+(P()?window.location.href:"");r!==this.counted&&(this.counted=r,this.enqueue("pageview",w,{path:n,properties:t}))}capture(e,t,n){this.enqueue("event",e,{properties:t,...n})}captureError(e,t){if(!this.reentrant){this.reentrant=!0;try{try{this.sendError(e,t)}catch{}try{let n=(t==null?void 0:t.handled)??!0,r=nn(e);r.handled=n,this.enqueue("event",O,{error:r,properties:{...t==null?void 0:t.properties,...Jt(e,{handled:n,id:U(),level:t==null?void 0:t.level})}}),this.flush()}catch{}}finally{this.reentrant=!1}}}setCohort(e){this.cohort=he(e)}flush(e=!1){var c,f,p;if(!this.cfg.enabled||this.queue.length===0)return;let t=this.queue;this.queue=[],this.clearTimer();let n=((f=(c=this.cfg).getToken)==null?void 0:f.call(c))??void 0,r=n?void 0:((p=this.cfg.ingestKey)==null?void 0:p.trim())||void 0,s=e&&!n,o=rn(t);if(o===null){this.cfg.debug&&console.debug("[event] flush \u2192 dropped, batch unserializable");return}this.cfg.debug&&console.debug("[event] flush \u2192",Ae,t.length),this.transport.send(this.cfg.host+Ae,o,{beacon:s,token:n,ingestKey:r,debug:this.cfg.debug})}sendError(e,t){if(!this.cfg.enabled||!this.dsn)return;let n=Kt({error:e,options:t,identity:this.errorIdentity(),capturePII:this.cfg.capturePII??!1}),r=Vt(n,this.dsn);this.cfg.debug&&console.debug("[event] error \u2192",this.dsn.ingestUrl,n.event_id),this.transport.send(this.dsn.ingestUrl,r,{beacon:!1,contentType:tn,debug:this.cfg.debug})}errorIdentity(){return{userId:this.personId??fe(),sessionId:pe(),product:this.cfg.product,release:this.cfg.release??Z("NEXT_PUBLIC_HANZO_RELEASE"),environment:this.cfg.environment??Z("NODE_ENV")}}enqueue(e,t,n){this.cfg.enabled&&(this.started||this.init(),this.queue.push(this.build(e,t,n)),this.queue.length>=this.cfg.batchSize?this.flush():this.schedule())}build(e,t,n){let r=fe(),s={messageId:U(),type:e,event:t,timestamp:new Date().toISOString(),distinctId:this.personId??r,anonymousId:r,personId:this.personId,sessionId:pe(),product:this.cfg.product,referrer:this.attribution.referrer,utm:this.attribution.utm,refCode:this.cohort.refCode??this.attribution.refCode,channel:this.cohort.channel??this.attribution.channel,signupWeek:this.cohort.signupWeek,url:P()?window.location.href:void 0,path:P()?window.location.pathname:void 0,library:"@hanzo/event",libraryVersion:Ie,...n},o=this.cfg.capturePII??!1;return s.url&&(s.url=z(s.url,o)),s.path&&(s.path=z(s.path,o)),s.referrer&&(s.referrer=z(s.referrer,o)),s}schedule(){this.timer||!this.cfg.enabled||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},this.cfg.flushIntervalMs))}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}},Te=Symbol.for("hanzo.event.clients");function on(){let e=globalThis,t=e[Te];if(t)return t;let n=new Map;return e[Te]=n,n}function De(e){if(!P()||e.enabled===!1)return new be(e);let t=(e.host??Re)+"\0"+e.product,n=on(),r=n.get(t);if(r)return r.adopt(e),r;let s=new be(e);return n.set(t,s),s}var xn={signup:{label:"Signup",event:g.SIGNUP_COMPLETED,funnelId:"signup",funnel:I("signup")},sale:{label:"Sale",event:g.ORDER_COMPLETED,funnelId:"upgrade",funnel:I("upgrade"),filter:{property:"kind",equals:"plan"}},upgradeIntent:{label:"Upgrade Intent",event:g.PLAN_CLICKED,funnelId:"upgrade",funnel:I("upgrade")},activation:{label:"Activation",event:g.FIRST_ACTION,funnelId:"apiActivation",funnel:I("apiActivation")}};var $="https://api.hanzo.ai";var Le=void 0;var In=60*1e3;var v={insights:"hanzo_insights_enabled",training:"hanzo_share_training",onboarded:"hanzo_onboarded"},J=globalThis.browser??globalThis.chrome;function ze(){var e,t,n,r;return((t=(e=globalThis.chrome)==null?void 0:e.storage)==null?void 0:t.local)??((r=(n=globalThis.browser)==null?void 0:n.storage)==null?void 0:r.local)}function Ue(e){return new Promise(t=>{let n=ze();if(!n)return t({});try{n.get(e,r=>t(r||{}))}catch{t({})}})}function Q(e){return new Promise(t=>{let n=ze();if(!n)return t();try{n.set(e,()=>t())}catch{t()}})}async function Me(){var e,t;try{let n=await((t=(e=J==null?void 0:J.runtime)==null?void 0:e.sendMessage)==null?void 0:t.call(e,{action:"auth.getToken"}));return(n==null?void 0:n.token)??null}catch{return null}}function $e(e){return{insights:e[v.insights]!==!1,shareTraining:e[v.training]===!0}}async function an(){let e=$e(await Ue([v.insights,v.training])),t=await Me();if(!t)return e;try{let n=await fetch(`${$}/v1/iam/consent`,{headers:{authorization:`Bearer ${t}`}});if(n.ok){let r=await n.json(),s={insights:r.insights!==!1,shareTraining:r.shareTraining===!0};return await Q({[v.insights]:s.insights,[v.training]:s.shareTraining}),s}}catch{}return e}async function Be(e){let t=$e(await Ue([v.insights,v.training])),n={insights:e.insights??t.insights,shareTraining:e.shareTraining??t.shareTraining};await Q({[v.insights]:n.insights,[v.training]:n.shareTraining});let r=await Me();if(r)try{await fetch(`${$}/v1/iam/consent`,{method:"PUT",headers:{"content-type":"application/json",authorization:`Bearer ${r}`},body:JSON.stringify(n),keepalive:!0}).catch(()=>{})}catch{}}async function Fe(){await Q({[v.onboarded]:!0})}function cn(){if(typeof navigator>"u")return!0;let e=navigator,t=e.doNotTrack??e.msDoNotTrack;return!(t==="1"||t==="yes"||e.globalPrivacyControl)}var X=null;function ln(){return X||(X=De({product:"extension",host:$,ingestKey:Le,captureErrors:!1})),X}async function Ge(e,t){try{if(!cn()||!(await an()).insights)return;let r=ln();r.capture(e,t),r.flush(!0)}catch{}}var je=globalThis.browser??globalThis.chrome,ee=document.getElementById("ob-insights"),te=document.getElementById("ob-training"),ne=document.getElementById("ob-continue");ne==null||ne.addEventListener("click",async()=>{let e={insights:(ee==null?void 0:ee.checked)??!0,shareTraining:(te==null?void 0:te.checked)??!1};await Be(e),await Fe(),await Ge("onboarding_complete",{shareTraining:e.shareTraining});try{let t=await je.tabs.getCurrent();t!=null&&t.id?await je.tabs.remove(t.id):window.close()}catch{window.close()}});})();
|
|
6
|
+
`))}function Jt(e,t){var o,c;let n=qt(e,t),r=((o=n.stacktrace)==null?void 0:o.frames)??[],s=Yt(n);return{$exception_list:[n],$exception_fingerprint:s,$exception_fingerprint_record:[{type:"manual"}],$exception_type:n.type,$exception_message:n.value,$exception_level:t.level??"error",$exception_handled:t.handled,$exception_synthetic:((c=n.mechanism)==null?void 0:c.synthetic)??!1,$exception_types:[n.type],$exception_values:[n.value],$exception_sources:r.map(f=>f.source).filter(f=>!!f),$exception_functions:r.map(f=>f.resolved_name??f.mangled_name).filter(f=>!!f)}}var R={session:"hz_session",firstTouch:"hz_first_touch",cohort:"hz_cohort"},Xt=1800*1e3;function M(){try{return typeof window>"u"||!window.localStorage?void 0:window.localStorage}catch{return}}function fe(){return Rt()||void 0}function pe(e=Date.now()){let t=M();if(!t)return;let n=null;try{n=JSON.parse(t.getItem(R.session)||"null")}catch{n=null}return!n||e-n.last>Xt?n={id:U(e),last:e}:n.last=e,t.setItem(R.session,JSON.stringify(n)),n.id}function Oe(){let e=M();if(e)try{let t=e.getItem(R.firstTouch);return t?JSON.parse(t):void 0}catch{return}}function Qt(e){let t=M(),n=Oe();return n||(t&&t.setItem(R.firstTouch,JSON.stringify(e)),e)}function en(){let e=M();if(e)try{let t=e.getItem(R.cohort);return t?JSON.parse(t):void 0}catch{return}}function he(e){let t=M(),n=en()||{},r={signupWeek:n.signupWeek||e.signupWeek,channel:e.channel||n.channel,refCode:n.refCode||e.refCode};return t&&t.setItem(R.cohort,JSON.stringify(r)),r}var Ae="/v1/event",Re="https://api.hanzo.ai",tn="application/x-sentry-envelope",_e="text/plain";function Ee(){try{if(typeof process<"u"&&process.env)return process.env.NEXT_PUBLIC_HANZO_EVENT_DSN||process.env.HANZO_EVENT_DSN||void 0}catch{}}function Z(e){try{if(typeof process<"u"&&process.env)return process.env[e]||void 0}catch{}}function ye(e,t,n){return e+(e.includes("?")?"&":"?")+t+"="+encodeURIComponent(n)}function nn(e){let t=Y(e);return{type:t.name,message:t.message,stack:t.stack}}var P=()=>typeof window<"u"&&typeof document<"u";function rn(e){try{return JSON.stringify({batch:e})}catch{}let t=[];for(let n of e)try{t.push(JSON.stringify(n))}catch{try{t.push(JSON.stringify({...n,properties:{$unserializable:!0}}))}catch{}}return t.length>0?'{"batch":['+t.join(",")+"]}":null}var sn=class{send(e,t,n){if(n.beacon&&P()&&typeof navigator.sendBeacon=="function"){let c=n.ingestKey?ye(e,"ingest_key",n.ingestKey):e;try{if(navigator.sendBeacon(c,new Blob([t],{type:_e})))return;n.debug&&console.warn("[event] beacon refused, falling back to fetch")}catch{}}if(typeof fetch!="function")return;let r=n.ingestKey!==void 0&&n.contentType===void 0,s={"Content-Type":r?_e:n.contentType??"application/json"},o=r?void 0:n.ingestKey??n.token;o&&(s.Authorization=`Bearer ${o}`),fetch(r?ye(e,"ingest_key",n.ingestKey):e,{method:"POST",headers:s,body:t,keepalive:!0,credentials:r?"omit":"include"}).then(c=>{!c.ok&&n.debug&&console.warn("[event] ingest rejected",c.status,e.split("?")[0])}).catch(c=>{n.debug&&console.warn("[event] ingest failed",e.split("?")[0],c)})}},be=class{constructor(e){this.queue=[],this.timer=null,this.attribution={utm:{}},this.cohort={},this.started=!1,this.reentrant=!1,this.cfg={host:Re,batchSize:20,flushIntervalMs:5e3,enabled:!0,captureErrors:!0,...e,ingestKey:e.ingestKey??Z("NEXT_PUBLIC_PUBLISHABLE_KEY")??dt()},this.transport=e.transport??new sn,this.dsn=de(e.dsn??Ee()??ce(this.cfg.product,this.cfg.ingestKey))}adopt(e){e.ingestKey&&!this.cfg.ingestKey&&(this.cfg.ingestKey=e.ingestKey),e.getToken&&!this.cfg.getToken&&(this.cfg.getToken=e.getToken),this.dsn||(this.dsn=de(e.dsn??Ee()??ce(this.cfg.product,this.cfg.ingestKey)))}get errorPlaneEnabled(){return this.dsn!==null}get errorIngestUrl(){var e;return(e=this.dsn)==null?void 0:e.ingestUrl}init(){if(this.started||!this.cfg.enabled||(this.started=!0,!P()))return;let e=it(window.location.search,document.referrer);this.attribution=ot(e)?Qt(e):Oe()??e,this.cohort=he({channel:this.attribution.channel??ve(this.attribution),refCode:this.attribution.refCode});let t=()=>{document.visibilityState==="hidden"&&this.flush(!0)};window.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>this.flush(!0)),this.cfg.captureErrors&&(window.addEventListener("error",n=>{this.captureError(n.error??n.message,{handled:!1})}),window.addEventListener("unhandledrejection",n=>{this.captureError(n.reason,{handled:!1})}))}identify(e,t){this.personId=e,this.enqueue("identify",void 0,{properties:t})}group(e,t){this.enqueue("group",void 0,{groupId:e,properties:t})}pageview(e,t){let n=e??(P()?window.location.pathname:void 0),r=(n??"")+"\0"+(P()?window.location.href:"");r!==this.counted&&(this.counted=r,this.enqueue("pageview",w,{path:n,properties:t}))}capture(e,t,n){this.enqueue("event",e,{properties:t,...n})}captureError(e,t){if(!this.reentrant){this.reentrant=!0;try{try{this.sendError(e,t)}catch{}try{let n=(t==null?void 0:t.handled)??!0,r=nn(e);r.handled=n,this.enqueue("event",O,{error:r,properties:{...t==null?void 0:t.properties,...Jt(e,{handled:n,id:U(),level:t==null?void 0:t.level})}}),this.flush()}catch{}}finally{this.reentrant=!1}}}setCohort(e){this.cohort=he(e)}flush(e=!1){var c,f,p;if(!this.cfg.enabled||this.queue.length===0)return;let t=this.queue;this.queue=[],this.clearTimer();let n=((f=(c=this.cfg).getToken)==null?void 0:f.call(c))??void 0,r=n?void 0:((p=this.cfg.ingestKey)==null?void 0:p.trim())||void 0,s=e&&!n,o=rn(t);if(o===null){this.cfg.debug&&console.debug("[event] flush \u2192 dropped, batch unserializable");return}this.cfg.debug&&console.debug("[event] flush \u2192",Ae,t.length),this.transport.send(this.cfg.host+Ae,o,{beacon:s,token:n,ingestKey:r,debug:this.cfg.debug})}sendError(e,t){if(!this.cfg.enabled||!this.dsn)return;let n=Kt({error:e,options:t,identity:this.errorIdentity(),capturePII:this.cfg.capturePII??!1}),r=Vt(n,this.dsn);this.cfg.debug&&console.debug("[event] error \u2192",this.dsn.ingestUrl,n.event_id),this.transport.send(this.dsn.ingestUrl,r,{beacon:!1,contentType:tn,debug:this.cfg.debug})}errorIdentity(){return{userId:this.personId??fe(),sessionId:pe(),product:this.cfg.product,release:this.cfg.release??Z("NEXT_PUBLIC_HANZO_RELEASE"),environment:this.cfg.environment??Z("NODE_ENV")}}enqueue(e,t,n){this.cfg.enabled&&(this.started||this.init(),this.queue.push(this.build(e,t,n)),this.queue.length>=this.cfg.batchSize?this.flush():this.schedule())}build(e,t,n){let r=fe(),s={messageId:U(),type:e,event:t,timestamp:new Date().toISOString(),distinctId:this.personId??r,anonymousId:r,personId:this.personId,sessionId:pe(),product:this.cfg.product,referrer:this.attribution.referrer,utm:this.attribution.utm,refCode:this.cohort.refCode??this.attribution.refCode,channel:this.cohort.channel??this.attribution.channel,signupWeek:this.cohort.signupWeek,url:P()?window.location.href:void 0,path:P()?window.location.pathname:void 0,library:"@hanzo/event",libraryVersion:Ie,...n},o=this.cfg.capturePII??!1;return s.url&&(s.url=L(s.url,o)),s.path&&(s.path=L(s.path,o)),s.referrer&&(s.referrer=L(s.referrer,o)),s}schedule(){this.timer||!this.cfg.enabled||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},this.cfg.flushIntervalMs))}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}},Te=Symbol.for("hanzo.event.clients");function on(){let e=globalThis,t=e[Te];if(t)return t;let n=new Map;return e[Te]=n,n}function De(e){if(!P()||e.enabled===!1)return new be(e);let t=(e.host??Re)+"\0"+e.product,n=on(),r=n.get(t);if(r)return r.adopt(e),r;let s=new be(e);return n.set(t,s),s}var xn={signup:{label:"Signup",event:g.SIGNUP_COMPLETED,funnelId:"signup",funnel:I("signup")},sale:{label:"Sale",event:g.ORDER_COMPLETED,funnelId:"upgrade",funnel:I("upgrade"),filter:{property:"kind",equals:"plan"}},upgradeIntent:{label:"Upgrade Intent",event:g.PLAN_CLICKED,funnelId:"upgrade",funnel:I("upgrade")},activation:{label:"Activation",event:g.FIRST_ACTION,funnelId:"apiActivation",funnel:I("apiActivation")}};var $="https://api.hanzo.ai";var ze=void 0;var In=60*1e3;var v={insights:"hanzo_insights_enabled",training:"hanzo_share_training",onboarded:"hanzo_onboarded"},J=globalThis.browser??globalThis.chrome;function Le(){var e,t,n,r;return((t=(e=globalThis.chrome)==null?void 0:e.storage)==null?void 0:t.local)??((r=(n=globalThis.browser)==null?void 0:n.storage)==null?void 0:r.local)}function Ue(e){return new Promise(t=>{let n=Le();if(!n)return t({});try{n.get(e,r=>t(r||{}))}catch{t({})}})}function Q(e){return new Promise(t=>{let n=Le();if(!n)return t();try{n.set(e,()=>t())}catch{t()}})}async function Me(){var e,t;try{let n=await((t=(e=J==null?void 0:J.runtime)==null?void 0:e.sendMessage)==null?void 0:t.call(e,{action:"auth.getToken"}));return(n==null?void 0:n.token)??null}catch{return null}}function $e(e){return{insights:e[v.insights]!==!1,shareTraining:e[v.training]===!0}}async function an(){let e=$e(await Ue([v.insights,v.training])),t=await Me();if(!t)return e;try{let n=await fetch(`${$}/v1/iam/consent`,{headers:{authorization:`Bearer ${t}`}});if(n.ok){let r=await n.json(),s={insights:r.insights!==!1,shareTraining:r.shareTraining===!0};return await Q({[v.insights]:s.insights,[v.training]:s.shareTraining}),s}}catch{}return e}async function Be(e){let t=$e(await Ue([v.insights,v.training])),n={insights:e.insights??t.insights,shareTraining:e.shareTraining??t.shareTraining};await Q({[v.insights]:n.insights,[v.training]:n.shareTraining});let r=await Me();if(r)try{await fetch(`${$}/v1/iam/consent`,{method:"PUT",headers:{"content-type":"application/json",authorization:`Bearer ${r}`},body:JSON.stringify(n),keepalive:!0}).catch(()=>{})}catch{}}async function Fe(){await Q({[v.onboarded]:!0})}function cn(){if(typeof navigator>"u")return!0;let e=navigator,t=e.doNotTrack??e.msDoNotTrack;return!(t==="1"||t==="yes"||e.globalPrivacyControl)}var X=null;function ln(){return X||(X=De({product:"extension",host:$,ingestKey:ze,captureErrors:!1})),X}async function Ge(e,t){try{if(!cn()||!(await an()).insights)return;let r=ln();r.capture(e,t),r.flush(!0)}catch{}}var je=globalThis.browser??globalThis.chrome,ee=document.getElementById("ob-insights"),te=document.getElementById("ob-training"),ne=document.getElementById("ob-continue");ne==null||ne.addEventListener("click",async()=>{let e={insights:(ee==null?void 0:ee.checked)??!0,shareTraining:(te==null?void 0:te.checked)??!1};await Be(e),await Fe(),await Ge("onboarding_complete",{shareTraining:e.shareTraining});try{let t=await je.tabs.getCurrent();t!=null&&t.id?await je.tabs.remove(t.id):window.close()}catch{window.close()}});})();
|
|
7
7
|
/*! Bundled license information:
|
|
8
8
|
|
|
9
9
|
@hanzo/event/dist/index.mjs:
|