@semiont/cli 0.4.21 → 0.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +24356 -23305
- package/dist/frontend/dist/assets/{CookiePreferences-CWvTznuy.js → CookiePreferences-CPbRK2Nf.js} +2 -2
- package/dist/frontend/dist/assets/{CookiePreferences-CWvTznuy.js.map → CookiePreferences-CPbRK2Nf.js.map} +1 -1
- package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-6ZGFEN2N-Dnq2pEeZ.js → PdfAnnotationCanvas.client-5QESNO5H-CprYrfHh.js} +2 -2
- package/dist/frontend/dist/assets/PdfAnnotationCanvas.client-5QESNO5H-CprYrfHh.js.map +1 -0
- package/dist/frontend/dist/assets/ToolbarPanels-CPoZvoTB.js +2 -0
- package/dist/frontend/dist/assets/ToolbarPanels-CPoZvoTB.js.map +1 -0
- package/dist/frontend/dist/assets/client-CCxdaxo8.js +2 -0
- package/dist/frontend/dist/assets/client-CCxdaxo8.js.map +1 -0
- package/dist/frontend/dist/assets/client-CPOjL49o.js +2 -0
- package/dist/frontend/dist/assets/client-CPOjL49o.js.map +1 -0
- package/dist/frontend/dist/assets/{client-9KMfqezG.js → client-D04WIU14.js} +2 -2
- package/dist/frontend/dist/assets/{client-9KMfqezG.js.map → client-D04WIU14.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-Bvrf4lLa.js → client-kS15_T5U.js} +2 -2
- package/dist/frontend/dist/assets/{client-Bvrf4lLa.js.map → client-kS15_T5U.js.map} +1 -1
- package/dist/frontend/dist/assets/index-Bsr9DJ3G.js +169 -0
- package/dist/frontend/dist/assets/index-Bsr9DJ3G.js.map +1 -0
- package/dist/frontend/dist/assets/layout-B-lufx1s.js +2 -0
- package/dist/frontend/dist/assets/layout-B-lufx1s.js.map +1 -0
- package/dist/frontend/dist/assets/layout-BWesrQWr.js +2 -0
- package/dist/frontend/dist/assets/{layout-easR0slx.js.map → layout-BWesrQWr.js.map} +1 -1
- package/dist/frontend/dist/assets/{layout-BgHlzaj1.js → layout-DqFHhLVw.js} +2 -2
- package/dist/frontend/dist/assets/layout-DqFHhLVw.js.map +1 -0
- package/dist/frontend/dist/assets/layout-w9wtEpkI.js +2 -0
- package/dist/frontend/dist/assets/layout-w9wtEpkI.js.map +1 -0
- package/dist/frontend/dist/assets/{not-found-nC4IaXPt.js → not-found-C0HTZoKU.js} +2 -2
- package/dist/frontend/dist/assets/{not-found-nC4IaXPt.js.map → not-found-C0HTZoKU.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-8zC_t3l-.js → page--QmNUvGH.js} +2 -2
- package/dist/frontend/dist/assets/{page-8zC_t3l-.js.map → page--QmNUvGH.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-DB1HZ_Jr.js → page-BIyG0SOs.js} +2 -2
- package/dist/frontend/dist/assets/{page-DB1HZ_Jr.js.map → page-BIyG0SOs.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-DoqFVg4p.js → page-BMeXKClk.js} +2 -2
- package/dist/frontend/dist/assets/{page-DoqFVg4p.js.map → page-BMeXKClk.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-jr_Rqa0A.js → page-BS88Xh4W.js} +2 -2
- package/dist/frontend/dist/assets/page-BS88Xh4W.js.map +1 -0
- package/dist/frontend/dist/assets/{page-By8BIN8Q.js → page-BkEdFy5p.js} +2 -2
- package/dist/frontend/dist/assets/{page-By8BIN8Q.js.map → page-BkEdFy5p.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BDMxGD5Z.js → page-BoFYscYi.js} +2 -2
- package/dist/frontend/dist/assets/{page-BDMxGD5Z.js.map → page-BoFYscYi.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-btIB2WK4.js → page-BzkBmeDS.js} +2 -2
- package/dist/frontend/dist/assets/page-BzkBmeDS.js.map +1 -0
- package/dist/frontend/dist/assets/{page-BwiRQxa7.js → page-C43cKrO_.js} +2 -2
- package/dist/frontend/dist/assets/{page-BwiRQxa7.js.map → page-C43cKrO_.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BD9EKRMV.js → page-CHCWv8gH.js} +2 -2
- package/dist/frontend/dist/assets/{page-BD9EKRMV.js.map → page-CHCWv8gH.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CTvUxWH5.js → page-CN1zC8Ky.js} +2 -2
- package/dist/frontend/dist/assets/{page-CTvUxWH5.js.map → page-CN1zC8Ky.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-DBoIW_-n.js → page-CPL87vBZ.js} +2 -2
- package/dist/frontend/dist/assets/{page-DBoIW_-n.js.map → page-CPL87vBZ.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CQsfujTh.js → page-CU11Rd_F.js} +2 -2
- package/dist/frontend/dist/assets/{page-CQsfujTh.js.map → page-CU11Rd_F.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-kLVTeA46.js → page-CryPHwXI.js} +2 -2
- package/dist/frontend/dist/assets/{page-kLVTeA46.js.map → page-CryPHwXI.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-DWS9ulKD.js → page-DYOj954J.js} +2 -2
- package/dist/frontend/dist/assets/{page-DWS9ulKD.js.map → page-DYOj954J.js.map} +1 -1
- package/dist/frontend/dist/assets/page-Du1JP0jA.js +2 -0
- package/dist/frontend/dist/assets/{page-D8JSCVFI.js.map → page-Du1JP0jA.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-C8zOqZ8M.js → page-Dvw2I_gp.js} +2 -2
- package/dist/frontend/dist/assets/{page-C8zOqZ8M.js.map → page-Dvw2I_gp.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-ChjwiTJ8.js → page-JI9gNkHU.js} +2 -2
- package/dist/frontend/dist/assets/page-JI9gNkHU.js.map +1 -0
- package/dist/frontend/dist/assets/{page-DEHEdU59.js → page-haUujHsJ.js} +2 -2
- package/dist/frontend/dist/assets/{page-DEHEdU59.js.map → page-haUujHsJ.js.map} +1 -1
- package/dist/frontend/dist/assets/{privacy-mpF0jllH.js → privacy-CZ8NTWnp.js} +2 -2
- package/dist/frontend/dist/assets/{privacy-mpF0jllH.js.map → privacy-CZ8NTWnp.js.map} +1 -1
- package/dist/frontend/dist/assets/{routing-BmJG4tNe.js → routing-D4iNsc7y.js} +2 -2
- package/dist/frontend/dist/assets/{routing-BmJG4tNe.js.map → routing-D4iNsc7y.js.map} +1 -1
- package/dist/frontend/dist/assets/{routing-JYkXODZK.js → routing-DCIgrT7s.js} +2 -2
- package/dist/frontend/dist/assets/{routing-JYkXODZK.js.map → routing-DCIgrT7s.js.map} +1 -1
- package/dist/frontend/dist/assets/web-Ua5dIRkZ.js +2 -0
- package/dist/frontend/dist/assets/web-Ua5dIRkZ.js.map +1 -0
- package/dist/frontend/dist/index.html +1 -1
- package/dist/frontend/package.json +1 -1
- package/package.json +8 -7
- package/dist/frontend/dist/assets/PdfAnnotationCanvas.client-6ZGFEN2N-Dnq2pEeZ.js.map +0 -1
- package/dist/frontend/dist/assets/ToolbarPanels-DQrfch_k.js +0 -2
- package/dist/frontend/dist/assets/ToolbarPanels-DQrfch_k.js.map +0 -1
- package/dist/frontend/dist/assets/client-D9qa8fAn.js +0 -2
- package/dist/frontend/dist/assets/client-D9qa8fAn.js.map +0 -1
- package/dist/frontend/dist/assets/client-kIBNRH2w.js +0 -2
- package/dist/frontend/dist/assets/client-kIBNRH2w.js.map +0 -1
- package/dist/frontend/dist/assets/index-DaA8-3Y1.js +0 -169
- package/dist/frontend/dist/assets/index-DaA8-3Y1.js.map +0 -1
- package/dist/frontend/dist/assets/layout-BLGpzYwk.js +0 -2
- package/dist/frontend/dist/assets/layout-BLGpzYwk.js.map +0 -1
- package/dist/frontend/dist/assets/layout-BgHlzaj1.js.map +0 -1
- package/dist/frontend/dist/assets/layout-Dj1MEjN6.js +0 -2
- package/dist/frontend/dist/assets/layout-Dj1MEjN6.js.map +0 -1
- package/dist/frontend/dist/assets/layout-easR0slx.js +0 -2
- package/dist/frontend/dist/assets/page-ChjwiTJ8.js.map +0 -1
- package/dist/frontend/dist/assets/page-D8JSCVFI.js +0 -2
- package/dist/frontend/dist/assets/page-btIB2WK4.js.map +0 -1
- package/dist/frontend/dist/assets/page-jr_Rqa0A.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-JI9gNkHU.js","sources":["../../src/app/[locale]/know/discover/page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useRouter } from '@/i18n/routing';\nimport {\n useTheme,\n useLineNumbers,\n useEventSubscriptions,\n useObservable,\n useSemiont,\n useViewModel,\n ResourceDiscoveryPage,\n} from '@semiont/react-ui';\nimport { ToolbarPanels } from '@/components/toolbar/ToolbarPanels';\nimport { useShellVM } from '@semiont/react-ui';\nimport { createDiscoverVM } from '@semiont/sdk';\nexport default function DiscoverPage() {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`Discover.${k}`, p as any) as string;\n const router = useRouter();\n const semiont = useObservable(useSemiont().activeSession$)?.client;\n\n const browseVM = useShellVM();\n const vm = useViewModel(() => createDiscoverVM(semiont!, browseVM));\n\n const activePanel = useObservable(vm.browse.activePanel$) ?? null;\n const recentDocuments = useObservable(vm.recentResources$) ?? [];\n const entityTypes = useObservable(vm.entityTypes$) ?? [];\n const isLoadingRecent = useObservable(vm.isLoadingRecent$) ?? true;\n const searchQuery = useObservable(vm.search.query$) ?? '';\n const searchState = useObservable(vm.search.state$);\n const searchDocuments = searchState?.results ?? [];\n const isSearching = searchState?.isSearching ?? false;\n\n const { theme, setTheme, resolvedTheme } = useTheme();\n const { showLineNumbers, toggleLineNumbers } = useLineNumbers();\n\n useEventSubscriptions({\n 'settings:theme-changed': useCallback(({ theme }: { theme: 'light' | 'dark' | 'system' }) => setTheme(theme), [setTheme]),\n 'settings:line-numbers-toggled': useCallback(() => toggleLineNumbers(), [toggleLineNumbers]),\n });\n\n return (\n <ResourceDiscoveryPage\n recentDocuments={recentDocuments}\n searchDocuments={searchDocuments}\n entityTypes={entityTypes}\n isLoadingRecent={isLoadingRecent}\n isSearching={isSearching}\n searchQuery={searchQuery}\n onSearchQueryChange={vm.search.setQuery}\n theme={resolvedTheme}\n showLineNumbers={showLineNumbers}\n activePanel={activePanel}\n onNavigateToResource={(resourceId) => router.push(`/know/resource/${encodeURIComponent(resourceId)}`)}\n onNavigateToCompose={() => router.push('/know/compose')}\n translations={{\n title: t('title'),\n subtitle: t('subtitle'),\n searchPlaceholder: t('searchPlaceholder'),\n searchButton: t('searchButton'),\n searching: t('searching'),\n filterByEntityType: t('filterByEntityType'),\n all: t('all'),\n recentResources: t('recentResources'),\n searchResults: (count: number) => t('searchResults', { count }),\n documentsTaggedWith: (entityType: string) => t('documentsTaggedWith', { entityType }),\n noResultsFound: (query: string) => t('noResultsFound', { query }),\n noResourcesAvailable: t('noResourcesAvailable'),\n composeFirstResource: t('composeFirstResource'),\n archived: t('archived'),\n created: t('created'),\n loadingKnowledgeBase: t('loadingKnowledgeBase'),\n }}\n ToolbarPanels={ToolbarPanels}\n />\n );\n}\n"],"names":["DiscoverPage","_t","useTranslation","t","k","p","router","useRouter","semiont","_a","useObservable","useSemiont","browseVM","useShellVM","vm","useViewModel","createDiscoverVM","activePanel","recentDocuments","entityTypes","isLoadingRecent","searchQuery","searchState","searchDocuments","isSearching","theme","setTheme","resolvedTheme","useTheme","showLineNumbers","toggleLineNumbers","useLineNumbers","useEventSubscriptions","useCallback","jsx","ResourceDiscoveryPage","resourceId","count","entityType","query","ToolbarPanels"],"mappings":"iTAiBA,SAAwBA,GAAe,OACrC,KAAM,CAAE,EAAGC,CAAA,EAAOC,EAAA,EACZC,EAAI,CAACC,EAAWC,IAAgCJ,EAAG,YAAYG,CAAC,GAAIC,CAAQ,EAC5EC,EAASC,EAAA,EACTC,GAAUC,EAAAC,EAAcC,EAAA,EAAa,cAAc,IAAzC,YAAAF,EAA4C,OAEtDG,EAAWC,EA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AAiBA,EAAE,iBAAiB,EACpC,cAAgBkC,GAAkBlC,EAAE,gBAAiB,CAAE,MAAAkC,EAAO,EAC9D,oBAAsBC,GAAuBnC,EAAE,sBAAuB,CAAE,WAAAmC,EAAY,EACpF,eAAiBC,GAAkBpC,EAAE,iBAAkB,CAAE,MAAAoC,EAAO,EAChE,qBAAsBpC,EAAE,sBAAsB,EAC9C,qBAAsBA,EAAE,sBAAsB,EAC9C,SAAUA,EAAE,UAAU,EACtB,QAASA,EAAE,SAAS,EACpB,qBAAsBA,EAAE,sBAAsB,CAAA,EAEhD,cAAAqC,CAAA,CAAA,CAGN"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as o}from"./vendor-DJo4KD8w.js";import{u as t}from"./routing-
|
|
2
|
-
//# sourceMappingURL=page-
|
|
1
|
+
import{r as o}from"./vendor-DJo4KD8w.js";import{u as t}from"./routing-DCIgrT7s.js";import"./index-Bsr9DJ3G.js";import"./i18n-BbpF47i1.js";function a(){const r=t();return o.useEffect(()=>{r.replace("/know/discover")},[r]),null}export{a as default};
|
|
2
|
+
//# sourceMappingURL=page-haUujHsJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-
|
|
1
|
+
{"version":3,"file":"page-haUujHsJ.js","sources":["../../src/app/[locale]/auth/connect/page.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useRouter } from '@/i18n/routing';\n\n/**\n * Legacy connect page — redirects to /know/discover.\n * Authentication is now handled inline in the Knowledge Base Panel.\n */\nexport default function ConnectPage() {\n const router = useRouter();\n\n useEffect(() => {\n router.replace('/know/discover');\n }, [router]);\n\n return null;\n}\n"],"names":["ConnectPage","router","useRouter","useEffect"],"mappings":"0IAOA,SAAwBA,GAAc,CACpC,MAAMC,EAASC,EAAA,EAEfC,OAAAA,EAAAA,UAAU,IAAM,CACdF,EAAO,QAAQ,gBAAgB,CACjC,EAAG,CAACA,CAAM,CAAC,EAEJ,IACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as l,
|
|
2
|
-
//# sourceMappingURL=privacy-
|
|
1
|
+
import{j as l,X as C,Y as S,Z as b,_ as O}from"./index-Bsr9DJ3G.js";import{r as c}from"./vendor-DJo4KD8w.js";import{u as m}from"./routing-DCIgrT7s.js";import{u as v}from"./i18n-BbpF47i1.js";function E({isOpen:e,onClose:t}){const o=m(),{t:n}=v(),s=(r,a)=>n(`Search.${r}`,a),i=(r,a)=>{r==="resource"?o.push(`/know/resource/${encodeURIComponent(a)}`):o.push(`/know/entity/${a}`)};return l.jsx(C,{isOpen:e,onClose:t,onNavigate:i,translations:{placeholder:s("placeholder"),searching:s("searching"),noResults:s("noResults"),startTyping:s("startTyping"),navigate:s("navigate"),select:s("select"),close:s("close"),enter:s("enter"),esc:s("esc")}})}const T=c.createContext(null);function K({children:e}){const t=m(),[o,n]=c.useState(!1),[s,i]=c.useState(!1),[r,a]=c.useState([]),u=c.useCallback(()=>{n(!0)},[]),f=c.useCallback(()=>{i(!0)},[]),h=c.useCallback(()=>{n(!1),i(!1),r.forEach(w=>w()),a([])},[r]);S([{key:"k",ctrlOrCmd:!0,handler:()=>{u()},description:"Open global search"},{key:"n",ctrlOrCmd:!0,handler:()=>{t.push("/know/compose")},description:"Create new resource"},{key:"/",handler:()=>{u()},description:"Open global search (alternative)"},{key:"?",shift:!0,handler:()=>{f()},description:"Show keyboard shortcuts help"}]),b("Escape",h,300);const k={openGlobalSearch:u,openKeyboardHelp:f,closeAllOverlays:h};return l.jsxs(T.Provider,{value:k,children:[e,o&&l.jsx(E,{isOpen:o,onClose:()=>n(!1)}),s&&l.jsx(O,{isOpen:s,onClose:()=>i(!1)})]})}const _=[{id:"necessary",name:"Strictly Necessary",description:"These cookies are essential for the website to function properly. They enable core functionality such as security, network management, and accessibility.",required:!0,cookies:["semiont-token","consent-preferences"]},{id:"analytics",name:"Analytics",description:"These cookies help us understand how visitors interact with our website by collecting and reporting information anonymously.",required:!1,cookies:["_ga","_ga_*","_gid","_gat","lighthouse-*"]},{id:"marketing",name:"Marketing",description:"These cookies are used to track visitors across websites to display relevant advertisements and measure campaign effectiveness.",required:!1,cookies:["_fbp","_fbc","fr","ads-*"]},{id:"preferences",name:"Preferences",description:"These cookies remember your choices and preferences to provide a more personalized experience.",required:!1,cookies:["theme-preference","language-preference","ui-settings"]}],p="1.0",g="semiont-cookie-consent",x={necessary:!0,analytics:!1,marketing:!1,preferences:!1,timestamp:new Date().toISOString(),version:p},A=e=>{typeof window>"u"||_.forEach(t=>{if(t.required)return;e[t.id]||t.cookies.forEach(n=>{if(n.includes("*")){const s=n.replace("*","");document.cookie.split(";").forEach(i=>{var a;const r=(a=i.split("=")[0])==null?void 0:a.trim();r&&r.startsWith(s)&&d(r)})}else d(n)})})},d=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`,document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${window.location.hostname}`;const t=window.location.hostname.split(".").slice(-2).join(".");document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${t}`},I=()=>{if(typeof window>"u")return null;try{const e=localStorage.getItem(g);if(!e)return null;const t=JSON.parse(e);return t.version!==p?null:t}catch(e){return console.warn("Failed to parse cookie consent:",e),null}},U=e=>{if(typeof window>"u")return;const t={...x,...e,necessary:!0,timestamp:new Date().toISOString(),version:p};try{localStorage.setItem(g,JSON.stringify(t)),A(t),window.dispatchEvent(new CustomEvent("cookieConsentChanged",{detail:t}))}catch(o){console.error("Failed to save cookie consent:",o)}},D=()=>{const e=I();if(!e)return!1;const t=new Date(e.timestamp),o=new Date;return o.setMonth(o.getMonth()-13),t>o},j=()=>typeof window>"u"?!1:!D(),y=async()=>{try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return e.includes("Europe/")?"EU":e.includes("America/Los_Angeles")||e.includes("America/Vancouver")?"CA":e.includes("America/")?"US":"OTHER"}catch{return"OTHER"}},G=async()=>await y()==="CA",H=async()=>await y()==="EU",P=()=>{if(typeof window>"u")return{};const e={};document.cookie.split(";").forEach(t=>{const[o,n]=t.trim().split("=");o&&n&&(e[`cookie_${o}`]=decodeURIComponent(n))});for(let t=0;t<localStorage.length;t++){const o=localStorage.key(t);o&&(e[`localStorage_${o}`]=localStorage.getItem(o)||"")}for(let t=0;t<sessionStorage.length;t++){const o=sessionStorage.key(t);o&&(e[`sessionStorage_${o}`]=sessionStorage.getItem(o)||"")}return e},q=()=>{typeof window>"u"||(localStorage.clear(),sessionStorage.clear(),document.cookie.split(";").forEach(e=>{var o;const t=(o=e.split("=")[0])==null?void 0:o.trim();t&&d(t)}),window.location.reload())};export{_ as C,T as K,K as a,j as b,G as c,q as d,P as e,I as g,H as i,U as s};
|
|
2
|
+
//# sourceMappingURL=privacy-CZ8NTWnp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"privacy-mpF0jllH.js","sources":["../../src/components/modals/GlobalSearchModal.tsx","../../src/contexts/KeyboardShortcutsContext.tsx","../../src/lib/cookies/constants.ts","../../src/lib/cookies/cleanup.ts","../../src/lib/cookies/consent.ts","../../src/lib/cookies/privacy.ts"],"sourcesContent":["import React from 'react';\nimport { useRouter } from '@/i18n/routing';\nimport { SearchModal } from '@semiont/react-ui';\nimport { useTranslation } from 'react-i18next';\n\ninterface GlobalSearchModalProps {\n isOpen: boolean;\n onClose: () => void;\n}\n\nexport function GlobalSearchModal({ isOpen, onClose }: GlobalSearchModalProps) {\n const router = useRouter();\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`Search.${k}`, p as any) as string;\n\n const handleNavigate = (type: 'resource' | 'entity', id: string) => {\n if (type === 'resource') {\n router.push(`/know/resource/${encodeURIComponent(id)}`);\n } else {\n router.push(`/know/entity/${id}`);\n }\n };\n\n return (\n <SearchModal\n isOpen={isOpen}\n onClose={onClose}\n onNavigate={handleNavigate}\n translations={{\n placeholder: t('placeholder'),\n searching: t('searching'),\n noResults: t('noResults'),\n startTyping: t('startTyping'),\n navigate: t('navigate'),\n select: t('select'),\n close: t('close'),\n enter: t('enter'),\n esc: t('esc'),\n }}\n />\n );\n}","import React, { createContext, useContext, useState, useCallback } from 'react';\nimport { useRouter } from '@/i18n/routing';\nimport { useKeyboardShortcuts, useDoubleKeyPress, KeyboardShortcutsHelpModal } from '@semiont/react-ui';\nimport { GlobalSearchModal } from '../components/modals/GlobalSearchModal';\n\ninterface KeyboardShortcutsContextType {\n openGlobalSearch: () => void;\n openKeyboardHelp: () => void;\n closeAllOverlays: () => void;\n}\n\nexport const KeyboardShortcutsContext = createContext<KeyboardShortcutsContextType | null>(null);\n\nexport function useKeyboardShortcutsContext() {\n const context = useContext(KeyboardShortcutsContext);\n if (!context) {\n throw new Error('useKeyboardShortcutsContext must be used within KeyboardShortcutsProvider');\n }\n return context;\n}\n\ninterface KeyboardShortcutsProviderProps {\n children: React.ReactNode;\n}\n\nexport function KeyboardShortcutsProvider({ children }: KeyboardShortcutsProviderProps) {\n const router = useRouter();\n const [isSearchOpen, setIsSearchOpen] = useState(false);\n const [isHelpOpen, setIsHelpOpen] = useState(false);\n const [overlayCloseCallbacks, setOverlayCloseCallbacks] = useState<(() => void)[]>([]);\n\n // Open global search\n const openGlobalSearch = useCallback(() => {\n setIsSearchOpen(true);\n }, []);\n\n // Open keyboard help\n const openKeyboardHelp = useCallback(() => {\n setIsHelpOpen(true);\n }, []);\n\n // Close all overlays\n const closeAllOverlays = useCallback(() => {\n // Close all modals\n setIsSearchOpen(false);\n setIsHelpOpen(false);\n\n // Call all registered overlay close callbacks\n overlayCloseCallbacks.forEach(callback => callback());\n\n // Clear the callbacks\n setOverlayCloseCallbacks([]);\n }, [overlayCloseCallbacks]);\n\n // Register global keyboard shortcuts\n useKeyboardShortcuts([\n {\n key: 'k',\n ctrlOrCmd: true,\n handler: () => {\n openGlobalSearch();\n },\n description: 'Open global search'\n },\n {\n key: 'n',\n ctrlOrCmd: true,\n handler: () => {\n // Navigate to compose page to create new resource\n router.push('/know/compose');\n },\n description: 'Create new resource'\n },\n {\n key: '/',\n handler: () => {\n // Alternative search trigger (like GitHub)\n openGlobalSearch();\n },\n description: 'Open global search (alternative)'\n },\n {\n key: '?',\n shift: true,\n handler: () => {\n // Open keyboard shortcuts help\n openKeyboardHelp();\n },\n description: 'Show keyboard shortcuts help'\n }\n ]);\n\n // Double Escape to close all overlays\n useDoubleKeyPress('Escape', closeAllOverlays, 300);\n\n const contextValue: KeyboardShortcutsContextType = {\n openGlobalSearch,\n openKeyboardHelp,\n closeAllOverlays\n };\n\n return (\n <KeyboardShortcutsContext.Provider value={contextValue}>\n {children}\n {isSearchOpen && (\n <GlobalSearchModal\n isOpen={isSearchOpen}\n onClose={() => setIsSearchOpen(false)}\n />\n )}\n {isHelpOpen && (\n <KeyboardShortcutsHelpModal\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n />\n )}\n </KeyboardShortcutsContext.Provider>\n );\n}","import type { CookieCategory, CookieConsent } from './types';\n\n// Cookie categories with descriptions\nexport const COOKIE_CATEGORIES: CookieCategory[] = [\n {\n id: 'necessary',\n name: 'Strictly Necessary',\n description: 'These cookies are essential for the website to function properly. They enable core functionality such as security, network management, and accessibility.',\n required: true,\n cookies: ['semiont-token', 'consent-preferences']\n },\n {\n id: 'analytics',\n name: 'Analytics',\n description: 'These cookies help us understand how visitors interact with our website by collecting and reporting information anonymously.',\n required: false,\n cookies: ['_ga', '_ga_*', '_gid', '_gat', 'lighthouse-*']\n },\n {\n id: 'marketing',\n name: 'Marketing',\n description: 'These cookies are used to track visitors across websites to display relevant advertisements and measure campaign effectiveness.',\n required: false,\n cookies: ['_fbp', '_fbc', 'fr', 'ads-*']\n },\n {\n id: 'preferences',\n name: 'Preferences',\n description: 'These cookies remember your choices and preferences to provide a more personalized experience.',\n required: false,\n cookies: ['theme-preference', 'language-preference', 'ui-settings']\n }\n];\n\n// Current consent version (increment when privacy policy changes)\nexport const CONSENT_VERSION = '1.0';\n\n// Cookie names\nexport const CONSENT_COOKIE_NAME = 'semiont-cookie-consent';\nexport const PREFERENCES_COOKIE_NAME = 'semiont-cookie-preferences';\n\n// Default consent state\nexport const DEFAULT_CONSENT: CookieConsent = {\n necessary: true, // Always true, required for functionality\n analytics: false,\n marketing: false,\n preferences: false,\n timestamp: new Date().toISOString(),\n version: CONSENT_VERSION\n};\n","import type { CookieConsent } from './types';\nimport { COOKIE_CATEGORIES } from './constants';\n\n// Clean up cookies based on consent\nexport const cleanupCookies = (consent: CookieConsent): void => {\n if (typeof window === 'undefined') return;\n\n COOKIE_CATEGORIES.forEach(category => {\n if (category.required) return; // Never clean up required cookies\n\n const hasConsent = consent[category.id];\n if (!hasConsent) {\n // Remove cookies for this category\n category.cookies.forEach(cookieName => {\n if (cookieName.includes('*')) {\n // Handle wildcard cookies\n const prefix = cookieName.replace('*', '');\n document.cookie.split(';').forEach(cookie => {\n const name = cookie.split('=')[0]?.trim();\n if (name && name.startsWith(prefix)) {\n deleteCookie(name);\n }\n });\n } else {\n deleteCookie(cookieName);\n }\n });\n }\n });\n};\n\n// Delete a specific cookie\nexport const deleteCookie = (name: string): void => {\n // Delete for current domain\n document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n // Delete for parent domain\n document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${window.location.hostname}`;\n // Delete for root domain\n const rootDomain = window.location.hostname.split('.').slice(-2).join('.');\n document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${rootDomain}`;\n};\n","import type { CookieConsent } from './types';\nimport { CONSENT_COOKIE_NAME, CONSENT_VERSION, DEFAULT_CONSENT } from './constants';\nimport { cleanupCookies } from './cleanup';\n\nexport const getCookieConsent = (): CookieConsent | null => {\n if (typeof window === 'undefined') return null;\n\n try {\n const consent = localStorage.getItem(CONSENT_COOKIE_NAME);\n if (!consent) return null;\n\n const parsed = JSON.parse(consent) as CookieConsent;\n\n // Check if consent is for current version\n if (parsed.version !== CONSENT_VERSION) {\n return null; // Force re-consent for new version\n }\n\n return parsed;\n } catch (error) {\n console.warn('Failed to parse cookie consent:', error);\n return null;\n }\n};\n\nexport const setCookieConsent = (consent: Partial<CookieConsent>): void => {\n if (typeof window === 'undefined') return;\n\n const fullConsent: CookieConsent = {\n ...DEFAULT_CONSENT,\n ...consent,\n necessary: true, // Always true\n timestamp: new Date().toISOString(),\n version: CONSENT_VERSION\n };\n\n try {\n localStorage.setItem(CONSENT_COOKIE_NAME, JSON.stringify(fullConsent));\n\n // Clean up cookies based on consent\n cleanupCookies(fullConsent);\n\n // Dispatch custom event for components to react to consent changes\n window.dispatchEvent(new CustomEvent('cookieConsentChanged', {\n detail: fullConsent\n }));\n } catch (error) {\n console.error('Failed to save cookie consent:', error);\n }\n};\n\nexport const hasValidConsent = (): boolean => {\n const consent = getCookieConsent();\n if (!consent) return false;\n\n // Check if consent is less than 13 months old (GDPR requirement)\n const consentDate = new Date(consent.timestamp);\n const thirteenMonthsAgo = new Date();\n thirteenMonthsAgo.setMonth(thirteenMonthsAgo.getMonth() - 13);\n\n return consentDate > thirteenMonthsAgo;\n};\n\nexport const shouldShowBanner = (): boolean => {\n if (typeof window === 'undefined') return false;\n return !hasValidConsent();\n};\n","import { deleteCookie } from './cleanup';\n\n// Get user's location for CCPA vs GDPR detection (simplified)\nexport const getUserLocation = async (): Promise<'EU' | 'CA' | 'US' | 'OTHER'> => {\n try {\n // In a real implementation, you'd use a geolocation service\n // For now, we'll detect based on timezone as a rough approximation\n const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n if (timezone.includes('Europe/')) return 'EU';\n if (timezone.includes('America/Los_Angeles') || timezone.includes('America/Vancouver')) return 'CA';\n if (timezone.includes('America/')) return 'US';\n\n return 'OTHER';\n } catch {\n return 'OTHER';\n }\n};\n\n// Check if CCPA applies (California residents)\nexport const isCCPAApplicable = async (): Promise<boolean> => {\n const location = await getUserLocation();\n return location === 'CA';\n};\n\n// Check if GDPR applies (EU residents)\nexport const isGDPRApplicable = async (): Promise<boolean> => {\n const location = await getUserLocation();\n return location === 'EU';\n};\n\n// Export all cookies currently set\nexport const exportUserData = (): Record<string, string> => {\n if (typeof window === 'undefined') return {};\n\n const data: Record<string, string> = {};\n\n // Get all cookies\n document.cookie.split(';').forEach(cookie => {\n const [name, value] = cookie.trim().split('=');\n if (name && value) {\n data[`cookie_${name}`] = decodeURIComponent(value);\n }\n });\n\n // Get localStorage data\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key) {\n data[`localStorage_${key}`] = localStorage.getItem(key) || '';\n }\n }\n\n // Get sessionStorage data\n for (let i = 0; i < sessionStorage.length; i++) {\n const key = sessionStorage.key(i);\n if (key) {\n data[`sessionStorage_${key}`] = sessionStorage.getItem(key) || '';\n }\n }\n\n return data;\n};\n\n// Delete all user data (GDPR right to be forgotten)\nexport const deleteAllUserData = (): void => {\n if (typeof window === 'undefined') return;\n\n // Clear all localStorage\n localStorage.clear();\n\n // Clear all sessionStorage\n sessionStorage.clear();\n\n // Delete all cookies\n document.cookie.split(';').forEach(cookie => {\n const name = cookie.split('=')[0]?.trim();\n if (name) {\n deleteCookie(name);\n }\n });\n\n // Reload page to ensure clean state\n window.location.reload();\n};\n"],"names":["GlobalSearchModal","isOpen","onClose","router","useRouter","_t","useTranslation","t","k","p","handleNavigate","type","id","jsx","SearchModal","KeyboardShortcutsContext","createContext","KeyboardShortcutsProvider","children","isSearchOpen","setIsSearchOpen","useState","isHelpOpen","setIsHelpOpen","overlayCloseCallbacks","setOverlayCloseCallbacks","openGlobalSearch","useCallback","openKeyboardHelp","closeAllOverlays","callback","useKeyboardShortcuts","useDoubleKeyPress","contextValue","jsxs","KeyboardShortcutsHelpModal","COOKIE_CATEGORIES","CONSENT_VERSION","CONSENT_COOKIE_NAME","DEFAULT_CONSENT","cleanupCookies","consent","category","cookieName","prefix","cookie","name","_a","deleteCookie","rootDomain","getCookieConsent","parsed","error","setCookieConsent","fullConsent","hasValidConsent","consentDate","thirteenMonthsAgo","shouldShowBanner","getUserLocation","timezone","isCCPAApplicable","isGDPRApplicable","exportUserData","data","value","i","key","deleteAllUserData"],"mappings":"8LAUO,SAASA,EAAkB,CAAE,OAAAC,EAAQ,QAAAC,GAAmC,CAC7E,MAAMC,EAASC,EAAA,EACT,CAAE,EAAGC,CAAA,EAAOC,EAAA,EACZC,EAAI,CAACC,EAAWC,IAAgCJ,EAAG,UAAUG,CAAC,GAAIC,CAAQ,EAE1EC,EAAiB,CAACC,EAA6BC,IAAe,CAC9DD,IAAS,WACXR,EAAO,KAAK,kBAAkB,mBAAmBS,CAAE,CAAC,EAAE,EAEtDT,EAAO,KAAK,gBAAgBS,CAAE,EAAE,CAEpC,EAEA,OACEC,EAAAA,IAACC,EAAA,CACC,OAAAb,EACA,QAAAC,EACA,WAAYQ,EACZ,aAAc,CACZ,YAAaH,EAAE,aAAa,EAC5B,UAAWA,EAAE,WAAW,EACxB,UAAWA,EAAE,WAAW,EACxB,YAAaA,EAAE,aAAa,EAC5B,SAAUA,EAAE,UAAU,EACtB,OAAQA,EAAE,QAAQ,EAClB,MAAOA,EAAE,OAAO,EAChB,MAAOA,EAAE,OAAO,EAChB,IAAKA,EAAE,KAAK,CAAA,CACd,CAAA,CAGN,CC9BO,MAAMQ,EAA2BC,EAAAA,cAAmD,IAAI,EAcxF,SAASC,EAA0B,CAAE,SAAAC,GAA4C,CACtF,MAAMf,EAASC,EAAA,EACT,CAACe,EAAcC,CAAe,EAAIC,EAAAA,SAAS,EAAK,EAChD,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAK,EAC5C,CAACG,EAAuBC,CAAwB,EAAIJ,EAAAA,SAAyB,CAAA,CAAE,EAG/EK,EAAmBC,EAAAA,YAAY,IAAM,CACzCP,EAAgB,EAAI,CACtB,EAAG,CAAA,CAAE,EAGCQ,EAAmBD,EAAAA,YAAY,IAAM,CACzCJ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AACC,EAAMmB,CAAK,EAAIpB,EAAO,KAAA,EAAO,MAAM,GAAG,EACzCC,GAAQmB,IACVD,EAAK,UAAUlB,CAAI,EAAE,EAAI,mBAAmBmB,CAAK,EAErD,CAAC,EAGD,QAASC,EAAI,EAAGA,EAAI,aAAa,OAAQA,IAAK,CAC5C,MAAMC,EAAM,aAAa,IAAID,CAAC,EAC1BC,IACFH,EAAK,gBAAgBG,CAAG,EAAE,EAAI,aAAa,QAAQA,CAAG,GAAK,GAE/D,CAGA,QAASD,EAAI,EAAGA,EAAI,eAAe,OAAQA,IAAK,CAC9C,MAAMC,EAAM,eAAe,IAAID,CAAC,EAC5BC,IACFH,EAAK,kBAAkBG,CAAG,EAAE,EAAI,eAAe,QAAQA,CAAG,GAAK,GAEnE,CAEA,OAAOH,CACT,EAGaI,EAAoB,IAAY,CACvC,OAAO,OAAW,MAGtB,aAAa,MAAA,EAGb,eAAe,MAAA,EAGf,SAAS,OAAO,MAAM,GAAG,EAAE,QAAQvB,GAAU,OAC3C,MAAMC,GAAOC,EAAAF,EAAO,MAAM,GAAG,EAAE,CAAC,IAAnB,YAAAE,EAAsB,OAC/BD,GACFE,EAAaF,CAAI,CAErB,CAAC,EAGD,OAAO,SAAS,OAAA,EAClB"}
|
|
1
|
+
{"version":3,"file":"privacy-CZ8NTWnp.js","sources":["../../src/components/modals/GlobalSearchModal.tsx","../../src/contexts/KeyboardShortcutsContext.tsx","../../src/lib/cookies/constants.ts","../../src/lib/cookies/cleanup.ts","../../src/lib/cookies/consent.ts","../../src/lib/cookies/privacy.ts"],"sourcesContent":["import React from 'react';\nimport { useRouter } from '@/i18n/routing';\nimport { SearchModal } from '@semiont/react-ui';\nimport { useTranslation } from 'react-i18next';\n\ninterface GlobalSearchModalProps {\n isOpen: boolean;\n onClose: () => void;\n}\n\nexport function GlobalSearchModal({ isOpen, onClose }: GlobalSearchModalProps) {\n const router = useRouter();\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`Search.${k}`, p as any) as string;\n\n const handleNavigate = (type: 'resource' | 'entity', id: string) => {\n if (type === 'resource') {\n router.push(`/know/resource/${encodeURIComponent(id)}`);\n } else {\n router.push(`/know/entity/${id}`);\n }\n };\n\n return (\n <SearchModal\n isOpen={isOpen}\n onClose={onClose}\n onNavigate={handleNavigate}\n translations={{\n placeholder: t('placeholder'),\n searching: t('searching'),\n noResults: t('noResults'),\n startTyping: t('startTyping'),\n navigate: t('navigate'),\n select: t('select'),\n close: t('close'),\n enter: t('enter'),\n esc: t('esc'),\n }}\n />\n );\n}","import React, { createContext, useContext, useState, useCallback } from 'react';\nimport { useRouter } from '@/i18n/routing';\nimport { useKeyboardShortcuts, useDoubleKeyPress, KeyboardShortcutsHelpModal } from '@semiont/react-ui';\nimport { GlobalSearchModal } from '../components/modals/GlobalSearchModal';\n\ninterface KeyboardShortcutsContextType {\n openGlobalSearch: () => void;\n openKeyboardHelp: () => void;\n closeAllOverlays: () => void;\n}\n\nexport const KeyboardShortcutsContext = createContext<KeyboardShortcutsContextType | null>(null);\n\nexport function useKeyboardShortcutsContext() {\n const context = useContext(KeyboardShortcutsContext);\n if (!context) {\n throw new Error('useKeyboardShortcutsContext must be used within KeyboardShortcutsProvider');\n }\n return context;\n}\n\ninterface KeyboardShortcutsProviderProps {\n children: React.ReactNode;\n}\n\nexport function KeyboardShortcutsProvider({ children }: KeyboardShortcutsProviderProps) {\n const router = useRouter();\n const [isSearchOpen, setIsSearchOpen] = useState(false);\n const [isHelpOpen, setIsHelpOpen] = useState(false);\n const [overlayCloseCallbacks, setOverlayCloseCallbacks] = useState<(() => void)[]>([]);\n\n // Open global search\n const openGlobalSearch = useCallback(() => {\n setIsSearchOpen(true);\n }, []);\n\n // Open keyboard help\n const openKeyboardHelp = useCallback(() => {\n setIsHelpOpen(true);\n }, []);\n\n // Close all overlays\n const closeAllOverlays = useCallback(() => {\n // Close all modals\n setIsSearchOpen(false);\n setIsHelpOpen(false);\n\n // Call all registered overlay close callbacks\n overlayCloseCallbacks.forEach(callback => callback());\n\n // Clear the callbacks\n setOverlayCloseCallbacks([]);\n }, [overlayCloseCallbacks]);\n\n // Register global keyboard shortcuts\n useKeyboardShortcuts([\n {\n key: 'k',\n ctrlOrCmd: true,\n handler: () => {\n openGlobalSearch();\n },\n description: 'Open global search'\n },\n {\n key: 'n',\n ctrlOrCmd: true,\n handler: () => {\n // Navigate to compose page to create new resource\n router.push('/know/compose');\n },\n description: 'Create new resource'\n },\n {\n key: '/',\n handler: () => {\n // Alternative search trigger (like GitHub)\n openGlobalSearch();\n },\n description: 'Open global search (alternative)'\n },\n {\n key: '?',\n shift: true,\n handler: () => {\n // Open keyboard shortcuts help\n openKeyboardHelp();\n },\n description: 'Show keyboard shortcuts help'\n }\n ]);\n\n // Double Escape to close all overlays\n useDoubleKeyPress('Escape', closeAllOverlays, 300);\n\n const contextValue: KeyboardShortcutsContextType = {\n openGlobalSearch,\n openKeyboardHelp,\n closeAllOverlays\n };\n\n return (\n <KeyboardShortcutsContext.Provider value={contextValue}>\n {children}\n {isSearchOpen && (\n <GlobalSearchModal\n isOpen={isSearchOpen}\n onClose={() => setIsSearchOpen(false)}\n />\n )}\n {isHelpOpen && (\n <KeyboardShortcutsHelpModal\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n />\n )}\n </KeyboardShortcutsContext.Provider>\n );\n}","import type { CookieCategory, CookieConsent } from './types';\n\n// Cookie categories with descriptions\nexport const COOKIE_CATEGORIES: CookieCategory[] = [\n {\n id: 'necessary',\n name: 'Strictly Necessary',\n description: 'These cookies are essential for the website to function properly. They enable core functionality such as security, network management, and accessibility.',\n required: true,\n cookies: ['semiont-token', 'consent-preferences']\n },\n {\n id: 'analytics',\n name: 'Analytics',\n description: 'These cookies help us understand how visitors interact with our website by collecting and reporting information anonymously.',\n required: false,\n cookies: ['_ga', '_ga_*', '_gid', '_gat', 'lighthouse-*']\n },\n {\n id: 'marketing',\n name: 'Marketing',\n description: 'These cookies are used to track visitors across websites to display relevant advertisements and measure campaign effectiveness.',\n required: false,\n cookies: ['_fbp', '_fbc', 'fr', 'ads-*']\n },\n {\n id: 'preferences',\n name: 'Preferences',\n description: 'These cookies remember your choices and preferences to provide a more personalized experience.',\n required: false,\n cookies: ['theme-preference', 'language-preference', 'ui-settings']\n }\n];\n\n// Current consent version (increment when privacy policy changes)\nexport const CONSENT_VERSION = '1.0';\n\n// Cookie names\nexport const CONSENT_COOKIE_NAME = 'semiont-cookie-consent';\nexport const PREFERENCES_COOKIE_NAME = 'semiont-cookie-preferences';\n\n// Default consent state\nexport const DEFAULT_CONSENT: CookieConsent = {\n necessary: true, // Always true, required for functionality\n analytics: false,\n marketing: false,\n preferences: false,\n timestamp: new Date().toISOString(),\n version: CONSENT_VERSION\n};\n","import type { CookieConsent } from './types';\nimport { COOKIE_CATEGORIES } from './constants';\n\n// Clean up cookies based on consent\nexport const cleanupCookies = (consent: CookieConsent): void => {\n if (typeof window === 'undefined') return;\n\n COOKIE_CATEGORIES.forEach(category => {\n if (category.required) return; // Never clean up required cookies\n\n const hasConsent = consent[category.id];\n if (!hasConsent) {\n // Remove cookies for this category\n category.cookies.forEach(cookieName => {\n if (cookieName.includes('*')) {\n // Handle wildcard cookies\n const prefix = cookieName.replace('*', '');\n document.cookie.split(';').forEach(cookie => {\n const name = cookie.split('=')[0]?.trim();\n if (name && name.startsWith(prefix)) {\n deleteCookie(name);\n }\n });\n } else {\n deleteCookie(cookieName);\n }\n });\n }\n });\n};\n\n// Delete a specific cookie\nexport const deleteCookie = (name: string): void => {\n // Delete for current domain\n document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n // Delete for parent domain\n document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${window.location.hostname}`;\n // Delete for root domain\n const rootDomain = window.location.hostname.split('.').slice(-2).join('.');\n document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${rootDomain}`;\n};\n","import type { CookieConsent } from './types';\nimport { CONSENT_COOKIE_NAME, CONSENT_VERSION, DEFAULT_CONSENT } from './constants';\nimport { cleanupCookies } from './cleanup';\n\nexport const getCookieConsent = (): CookieConsent | null => {\n if (typeof window === 'undefined') return null;\n\n try {\n const consent = localStorage.getItem(CONSENT_COOKIE_NAME);\n if (!consent) return null;\n\n const parsed = JSON.parse(consent) as CookieConsent;\n\n // Check if consent is for current version\n if (parsed.version !== CONSENT_VERSION) {\n return null; // Force re-consent for new version\n }\n\n return parsed;\n } catch (error) {\n console.warn('Failed to parse cookie consent:', error);\n return null;\n }\n};\n\nexport const setCookieConsent = (consent: Partial<CookieConsent>): void => {\n if (typeof window === 'undefined') return;\n\n const fullConsent: CookieConsent = {\n ...DEFAULT_CONSENT,\n ...consent,\n necessary: true, // Always true\n timestamp: new Date().toISOString(),\n version: CONSENT_VERSION\n };\n\n try {\n localStorage.setItem(CONSENT_COOKIE_NAME, JSON.stringify(fullConsent));\n\n // Clean up cookies based on consent\n cleanupCookies(fullConsent);\n\n // Dispatch custom event for components to react to consent changes\n window.dispatchEvent(new CustomEvent('cookieConsentChanged', {\n detail: fullConsent\n }));\n } catch (error) {\n console.error('Failed to save cookie consent:', error);\n }\n};\n\nexport const hasValidConsent = (): boolean => {\n const consent = getCookieConsent();\n if (!consent) return false;\n\n // Check if consent is less than 13 months old (GDPR requirement)\n const consentDate = new Date(consent.timestamp);\n const thirteenMonthsAgo = new Date();\n thirteenMonthsAgo.setMonth(thirteenMonthsAgo.getMonth() - 13);\n\n return consentDate > thirteenMonthsAgo;\n};\n\nexport const shouldShowBanner = (): boolean => {\n if (typeof window === 'undefined') return false;\n return !hasValidConsent();\n};\n","import { deleteCookie } from './cleanup';\n\n// Get user's location for CCPA vs GDPR detection (simplified)\nexport const getUserLocation = async (): Promise<'EU' | 'CA' | 'US' | 'OTHER'> => {\n try {\n // In a real implementation, you'd use a geolocation service\n // For now, we'll detect based on timezone as a rough approximation\n const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n if (timezone.includes('Europe/')) return 'EU';\n if (timezone.includes('America/Los_Angeles') || timezone.includes('America/Vancouver')) return 'CA';\n if (timezone.includes('America/')) return 'US';\n\n return 'OTHER';\n } catch {\n return 'OTHER';\n }\n};\n\n// Check if CCPA applies (California residents)\nexport const isCCPAApplicable = async (): Promise<boolean> => {\n const location = await getUserLocation();\n return location === 'CA';\n};\n\n// Check if GDPR applies (EU residents)\nexport const isGDPRApplicable = async (): Promise<boolean> => {\n const location = await getUserLocation();\n return location === 'EU';\n};\n\n// Export all cookies currently set\nexport const exportUserData = (): Record<string, string> => {\n if (typeof window === 'undefined') return {};\n\n const data: Record<string, string> = {};\n\n // Get all cookies\n document.cookie.split(';').forEach(cookie => {\n const [name, value] = cookie.trim().split('=');\n if (name && value) {\n data[`cookie_${name}`] = decodeURIComponent(value);\n }\n });\n\n // Get localStorage data\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key) {\n data[`localStorage_${key}`] = localStorage.getItem(key) || '';\n }\n }\n\n // Get sessionStorage data\n for (let i = 0; i < sessionStorage.length; i++) {\n const key = sessionStorage.key(i);\n if (key) {\n data[`sessionStorage_${key}`] = sessionStorage.getItem(key) || '';\n }\n }\n\n return data;\n};\n\n// Delete all user data (GDPR right to be forgotten)\nexport const deleteAllUserData = (): void => {\n if (typeof window === 'undefined') return;\n\n // Clear all localStorage\n localStorage.clear();\n\n // Clear all sessionStorage\n sessionStorage.clear();\n\n // Delete all cookies\n document.cookie.split(';').forEach(cookie => {\n const name = cookie.split('=')[0]?.trim();\n if (name) {\n deleteCookie(name);\n }\n });\n\n // Reload page to ensure clean state\n window.location.reload();\n};\n"],"names":["GlobalSearchModal","isOpen","onClose","router","useRouter","_t","useTranslation","t","k","p","handleNavigate","type","id","jsx","SearchModal","KeyboardShortcutsContext","createContext","KeyboardShortcutsProvider","children","isSearchOpen","setIsSearchOpen","useState","isHelpOpen","setIsHelpOpen","overlayCloseCallbacks","setOverlayCloseCallbacks","openGlobalSearch","useCallback","openKeyboardHelp","closeAllOverlays","callback","useKeyboardShortcuts","useDoubleKeyPress","contextValue","jsxs","KeyboardShortcutsHelpModal","COOKIE_CATEGORIES","CONSENT_VERSION","CONSENT_COOKIE_NAME","DEFAULT_CONSENT","cleanupCookies","consent","category","cookieName","prefix","cookie","name","_a","deleteCookie","rootDomain","getCookieConsent","parsed","error","setCookieConsent","fullConsent","hasValidConsent","consentDate","thirteenMonthsAgo","shouldShowBanner","getUserLocation","timezone","isCCPAApplicable","isGDPRApplicable","exportUserData","data","value","i","key","deleteAllUserData"],"mappings":"8LAUO,SAASA,EAAkB,CAAE,OAAAC,EAAQ,QAAAC,GAAmC,CAC7E,MAAMC,EAASC,EAAA,EACT,CAAE,EAAGC,CAAA,EAAOC,EAAA,EACZC,EAAI,CAACC,EAAWC,IAAgCJ,EAAG,UAAUG,CAAC,GAAIC,CAAQ,EAE1EC,EAAiB,CAACC,EAA6BC,IAAe,CAC9DD,IAAS,WACXR,EAAO,KAAK,kBAAkB,mBAAmBS,CAAE,CAAC,EAAE,EAEtDT,EAAO,KAAK,gBAAgBS,CAAE,EAAE,CAEpC,EAEA,OACEC,EAAAA,IAACC,EAAA,CACC,OAAAb,EACA,QAAAC,EACA,WAAYQ,EACZ,aAAc,CACZ,YAAaH,EAAE,aAAa,EAC5B,UAAWA,EAAE,WAAW,EACxB,UAAWA,EAAE,WAAW,EACxB,YAAaA,EAAE,aAAa,EAC5B,SAAUA,EAAE,UAAU,EACtB,OAAQA,EAAE,QAAQ,EAClB,MAAOA,EAAE,OAAO,EAChB,MAAOA,EAAE,OAAO,EAChB,IAAKA,EAAE,KAAK,CAAA,CACd,CAAA,CAGN,CC9BO,MAAMQ,EAA2BC,EAAAA,cAAmD,IAAI,EAcxF,SAASC,EAA0B,CAAE,SAAAC,GAA4C,CACtF,MAAMf,EAASC,EAAA,EACT,CAACe,EAAcC,CAAe,EAAIC,EAAAA,SAAS,EAAK,EAChD,CAAC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GaC,EAAmB,SACb,MAAMF,EAAA,IACH,KAITG,EAAmB,SACb,MAAMH,EAAA,IACH,KAITI,EAAiB,IAA8B,CAC1D,GAAI,OAAO,OAAW,IAAa,MAAO,CAAA,EAE1C,MAAMC,EAA+B,CAAA,EAGrC,SAAS,OAAO,MAAM,GAAG,EAAE,QAAQnB,GAAU,CAC3C,KAAM,CAACC,EAAMmB,CAAK,EAAIpB,EAAO,KAAA,EAAO,MAAM,GAAG,EACzCC,GAAQmB,IACVD,EAAK,UAAUlB,CAAI,EAAE,EAAI,mBAAmBmB,CAAK,EAErD,CAAC,EAGD,QAASC,EAAI,EAAGA,EAAI,aAAa,OAAQA,IAAK,CAC5C,MAAMC,EAAM,aAAa,IAAID,CAAC,EAC1BC,IACFH,EAAK,gBAAgBG,CAAG,EAAE,EAAI,aAAa,QAAQA,CAAG,GAAK,GAE/D,CAGA,QAASD,EAAI,EAAGA,EAAI,eAAe,OAAQA,IAAK,CAC9C,MAAMC,EAAM,eAAe,IAAID,CAAC,EAC5BC,IACFH,EAAK,kBAAkBG,CAAG,EAAE,EAAI,eAAe,QAAQA,CAAG,GAAK,GAEnE,CAEA,OAAOH,CACT,EAGaI,EAAoB,IAAY,CACvC,OAAO,OAAW,MAGtB,aAAa,MAAA,EAGb,eAAe,MAAA,EAGf,SAAS,OAAO,MAAM,GAAG,EAAE,QAAQvB,GAAU,OAC3C,MAAMC,GAAOC,EAAAF,EAAO,MAAM,GAAG,EAAE,CAAC,IAAnB,YAAAE,EAAsB,OAC/BD,GACFE,EAAaF,CAAI,CAErB,CAAC,EAGD,OAAO,SAAS,OAAA,EAClB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as s}from"./index-
|
|
2
|
-
//# sourceMappingURL=routing-
|
|
1
|
+
import{j as s}from"./index-Bsr9DJ3G.js";import{R as a}from"./vendor-DJo4KD8w.js";import{L as n}from"./routing-DCIgrT7s.js";const i=a.forwardRef(function({href:e,...o},t){return s.jsx(n,{ref:t,to:e,...o})}),u=i,d={resourceDetail:r=>`/know/resource/${r}`,userProfile:r=>`/users/${r}`,search:r=>`/search?q=${encodeURIComponent(r)}`,home:()=>"/",about:()=>"/about",privacy:()=>"/privacy",terms:()=>"/terms",knowledge:()=>"/know",moderate:()=>"/moderate",admin:()=>"/admin"};export{u as L,d as r};
|
|
2
|
+
//# sourceMappingURL=routing-D4iNsc7y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing-
|
|
1
|
+
{"version":3,"file":"routing-D4iNsc7y.js","sources":["../../src/lib/routing.tsx"],"sourcesContent":["/**\n * Routing configuration for Semiont frontend\n *\n * This module provides the concrete implementation of the RoutingContext\n * interface for the React Router-based frontend application.\n */\n\nimport React from 'react';\nimport { Link as NextLink } from '@/i18n/routing';\nimport type { RouteBuilder, LinkComponentProps } from '@semiont/react-ui';\nimport type { ComponentType } from 'react';\n\n/**\n * Adapter: react-ui components pass `href`, but React Router Link expects `to`.\n */\nconst LinkAdapter = React.forwardRef<HTMLAnchorElement, LinkComponentProps>(\n function LinkAdapter({ href, ...props }, ref) {\n return <NextLink ref={ref} to={href} {...props} />;\n }\n);\nexport const Link: ComponentType<LinkComponentProps> = LinkAdapter as any;\n\n/**\n * Route builder for Semiont frontend\n */\nexport const routes: RouteBuilder = {\n resourceDetail: (id: string) => `/know/resource/${id}`,\n userProfile: (id: string) => `/users/${id}`,\n search: (query: string) => `/search?q=${encodeURIComponent(query)}`,\n home: () => '/',\n about: () => '/about',\n privacy: () => '/privacy',\n terms: () => '/terms',\n knowledge: () => '/know',\n moderate: () => '/moderate',\n admin: () => '/admin',\n};\n"],"names":["LinkAdapter","React","href","props","ref","NextLink","Link","routes","id","query"],"mappings":"2HAeA,MAAMA,EAAcC,EAAM,WACxB,SAAqB,CAAE,KAAAC,EAAM,GAAGC,CAAA,EAASC,EAAK,CAC5C,aAAQC,EAAA,CAAS,IAAAD,EAAU,GAAIF,EAAO,GAAGC,EAAO,CAClD,CACF,EACaG,EAA0CN,EAK1CO,EAAuB,CAClC,eAAiBC,GAAe,kBAAkBA,CAAE,GACpD,YAAcA,GAAe,UAAUA,CAAE,GACzC,OAASC,GAAkB,aAAa,mBAAmBA,CAAK,CAAC,GACjE,KAAM,IAAM,IACZ,MAAO,IAAM,SACb,QAAS,IAAM,WACf,MAAO,IAAM,SACb,UAAW,IAAM,QACjB,SAAU,IAAM,YAChB,MAAO,IAAM,QACf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{F as c,j as f,G as m}from"./index-
|
|
2
|
-
//# sourceMappingURL=routing-
|
|
1
|
+
import{F as c,j as f,G as m}from"./index-Bsr9DJ3G.js";import{b as g,a as o,R as L,L as h,c as p}from"./vendor-DJo4KD8w.js";import{u}from"./i18n-BbpF47i1.js";const R=L.forwardRef(function({to:a,...t},s){const{i18n:n}=u(),e=o(),l=n.language||e.locale||c,i=typeof a=="string"?`/${l}${a.startsWith("/")?a:`/${a}`}`:a;return f.jsx(h,{ref:s,to:i,...t})});function k(){const r=g(),{i18n:a}=u(),t=o();function s(n,e){return`/${e||a.language||t.locale||c}${n.startsWith("/")?n:`/${n}`}`}return{push(n,e){r(s(n,e==null?void 0:e.locale))},replace(n,e){r(s(n,e==null?void 0:e.locale),{replace:!0})},back(){r(-1)},forward(){r(1)},refresh(){window.location.reload()},prefetch(n){}}}function w(){const{pathname:r}=p(),a=r.match(/^\/[a-z]{2}(\/.*)?$/);return a?a[1]??"/":r}function b(){const r=o(),{i18n:a}=u(),t=r.locale;return t&&m(t)?t:a.language||c}export{R as L,b as a,w as b,k as u};
|
|
2
|
+
//# sourceMappingURL=routing-DCIgrT7s.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing-
|
|
1
|
+
{"version":3,"file":"routing-DCIgrT7s.js","sources":["../../src/i18n/routing.tsx"],"sourcesContent":["/**\n * Routing abstraction layer — React Router implementation\n *\n * All call sites import from @/i18n/routing and do not need to change\n * when the underlying router changes.\n *\n * Key behaviours:\n * - Link: locale-prefixed anchor rendered via react-router-dom\n * - useRouter: locale-aware push/replace/back\n * - usePathname: returns path WITHOUT locale prefix\n * - redirect: programmatic navigation without locale prefix\n */\n\nimport React from 'react';\nimport {\n Link as RouterLink,\n useNavigate,\n useLocation,\n useParams,\n Navigate,\n} from 'react-router-dom';\nimport { useTranslation } from 'react-i18next';\nimport { SUPPORTED_LOCALES, DEFAULT_LOCALE, isSupportedLocale } from './config';\n\nexport { SUPPORTED_LOCALES, DEFAULT_LOCALE };\n\n// ── Link ─────────────────────────────────────────────────────────────────────\n\ntype LinkProps = React.ComponentProps<typeof RouterLink>;\n\n/**\n * Locale-aware Link. Prepends the current locale to the href.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function Link({ to, ...props }, ref) {\n const { i18n } = useTranslation();\n const params = useParams<{ locale?: string }>();\n const locale = i18n.language || params.locale || DEFAULT_LOCALE;\n const target = typeof to === 'string' ? `/${locale}${to.startsWith('/') ? to : `/${to}`}` : to;\n return <RouterLink ref={ref} to={target} {...props} />;\n },\n);\n\n// ── useRouter ─────────────────────────────────────────────────────────────────\n\ntype RouterOptions = { locale?: string };\n\nexport function useRouter() {\n const navigate = useNavigate();\n const { i18n } = useTranslation();\n const params = useParams<{ locale?: string }>();\n\n function prefixLocale(path: string, locale?: string): string {\n const lang = locale || i18n.language || params.locale || DEFAULT_LOCALE;\n return `/${lang}${path.startsWith('/') ? path : `/${path}`}`;\n }\n\n return {\n push(path: string, options?: RouterOptions) {\n navigate(prefixLocale(path, options?.locale));\n },\n replace(path: string, options?: RouterOptions) {\n navigate(prefixLocale(path, options?.locale), { replace: true });\n },\n back() {\n navigate(-1);\n },\n forward() {\n navigate(1);\n },\n refresh() {\n window.location.reload();\n },\n prefetch(_path: string) {\n // No-op: Vite/React Router handles prefetching differently\n },\n };\n}\n\n// ── usePathname ───────────────────────────────────────────────────────────────\n\n/**\n * Returns the path WITHOUT the locale prefix.\n * e.g. /en/know/discover → /know/discover\n */\nexport function usePathname(): string {\n const { pathname } = useLocation();\n // Strip leading /{locale}\n const match = pathname.match(/^\\/[a-z]{2}(\\/.*)?$/);\n if (match) {\n return match[1] ?? '/';\n }\n return pathname;\n}\n\n// ── redirect ─────────────────────────────────────────────────────────────────\n\n/**\n * Render a redirect component. Pass { href, locale } to redirect with locale,\n * or just a string href to redirect to an absolute path.\n */\nexport function redirect(target: string | { href: string; locale?: string }): React.ReactElement {\n const { i18n } = useTranslation();\n const locale = typeof target === 'string' ? (i18n.language || DEFAULT_LOCALE) : (target.locale || i18n.language || DEFAULT_LOCALE);\n const href = typeof target === 'string' ? target : target.href;\n const to = `/${locale}${href.startsWith('/') ? href : `/${href}`}`;\n return <Navigate to={to} replace />;\n}\n\n// ── useParams with locale ────────────────────────────────────────────────────\n\nexport function useLocale(): string {\n const params = useParams<{ locale?: string }>();\n const { i18n } = useTranslation();\n const localeFromParams = params.locale;\n if (localeFromParams && isSupportedLocale(localeFromParams)) {\n return localeFromParams;\n }\n return i18n.language || DEFAULT_LOCALE;\n}\n"],"names":["Link","React","to","props","ref","i18n","useTranslation","params","useParams","locale","DEFAULT_LOCALE","target","RouterLink","useRouter","navigate","useNavigate","prefixLocale","path","options","_path","usePathname","pathname","useLocation","match","useLocale","localeFromParams","isSupportedLocale"],"mappings":"6JAiCO,MAAMA,EAAOC,EAAM,WACxB,SAAc,CAAE,GAAAC,EAAI,GAAGC,CAAA,EAASC,EAAK,CACnC,KAAM,CAAE,KAAAC,CAAA,EAASC,EAAA,EACXC,EAASC,EAAA,EACTC,EAASJ,EAAK,UAAYE,EAAO,QAAUG,EAC3CC,EAAS,OAAOT,GAAO,SAAW,IAAIO,CAAM,GAAGP,EAAG,WAAW,GAAG,EAAIA,EAAK,IAAIA,CAAE,EAAE,GAAKA,EAC5F,aAAQU,EAAA,CAAW,IAAAR,EAAU,GAAIO,EAAS,GAAGR,EAAO,CACtD,CACF,EAMO,SAASU,GAAY,CAC1B,MAAMC,EAAWC,EAAA,EACX,CAAE,KAAAV,CAAA,EAASC,EAAA,EACXC,EAASC,EAAA,EAEf,SAASQ,EAAaC,EAAcR,EAAyB,CAE3D,MAAO,IADMA,GAAUJ,EAAK,UAAYE,EAAO,QAAUG,CAC1C,GAAGO,EAAK,WAAW,GAAG,EAAIA,EAAO,IAAIA,CAAI,EAAE,EAC5D,CAEA,MAAO,CACL,KAAKA,EAAcC,EAAyB,CAC1CJ,EAASE,EAAaC,EAAMC,GAAA,YAAAA,EAAS,MAAM,CAAC,CAC9C,EACA,QAAQD,EAAcC,EAAyB,CAC7CJ,EAASE,EAAaC,EAAMC,GAAA,YAAAA,EAAS,MAAM,EAAG,CAAE,QAAS,GAAM,CACjE,EACA,MAAO,CACLJ,EAAS,EAAE,CACb,EACA,SAAU,CACRA,EAAS,CAAC,CACZ,EACA,SAAU,CACR,OAAO,SAAS,OAAA,CAClB,EACA,SAASK,EAAe,CAExB,CAAA,CAEJ,CAQO,SAASC,GAAsB,CACpC,KAAM,CAAE,SAAAC,CAAA,EAAaC,EAAA,EAEfC,EAAQF,EAAS,MAAM,qBAAqB,EAClD,OAAIE,EACKA,EAAM,CAAC,GAAK,IAEdF,CACT,CAkBO,SAASG,GAAoB,CAClC,MAAMjB,EAASC,EAAA,EACT,CAAE,KAAAH,CAAA,EAASC,EAAA,EACXmB,EAAmBlB,EAAO,OAChC,OAAIkB,GAAoBC,EAAkBD,CAAgB,EACjDA,EAEFpB,EAAK,UAAYK,CAC1B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var qt=Object.defineProperty;var Wt=(e,t,r)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var o=(e,t,r)=>Wt(e,typeof t!="symbol"?t+"":t,r);import{aj as Jt,ak as Zt,al as te,am as I,an as S,ao as It,ap as P,aq as D,ar as ee,as as T,at as re,au as ne,av as se,aw as R}from"./index-Bsr9DJ3G.js";import"./vendor-DJo4KD8w.js";import"./i18n-BbpF47i1.js";var k;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(k||(k={}));var d=Jt.instance();class ie{constructor(t){o(this,"_delegate");this._delegate=t}export(t,r){this._delegate.export(t,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class ht extends Error{constructor(r,n,s){super(r);o(this,"code");o(this,"name","OTLPExporterError");o(this,"data");this.data=s,this.code=n}}function oe(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function ae(e){if(e!=null)return async()=>e}function ce(e,t,r){return{timeoutMillis:oe(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function ue(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class le{constructor(t){o(this,"_concurrencyLimit");o(this,"_sendingPromises",[]);this._concurrencyLimit=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);const r=()=>{const n=this._sendingPromises.indexOf(t);this._sendingPromises.splice(n,1)};t.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function de(e){return new le(e.concurrencyLimit)}const Nt=Zt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function he(e){return e.setValue(Nt,!0)}function ut(e){return e.getValue(Nt)===!0}const pe="=",Mt=";",nt=",",X="baggage",fe=180,_e=4096,me=8192;function Se(e){return e.reduce((t,r)=>{const n=`${t}${t!==""?nt:""}${r}`;return n.length>me?t:n},"")}function ge(e){return e.getAllEntries().map(([t,r])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=Mt+r.metadata.toString()),n})}function Ee(e){if(!e)return;const t=e.indexOf(Mt),r=t===-1?e:e.substring(0,t),n=r.indexOf(pe);if(n<=0)return;const s=r.substring(0,n).trim(),i=r.substring(n+1).trim();if(!s||!i)return;let a,c;try{a=decodeURIComponent(s),c=decodeURIComponent(i)}catch{return}let u;if(t!==-1&&t<e.length-1){const l=e.substring(t+1);u=te(l)}return{key:a,value:c,metadata:u}}class Ae{inject(t,r,n){const s=I.getBaggage(t);if(!s||ut(t))return;const i=ge(s).filter(c=>c.length<=_e).slice(0,fe),a=Se(i);a.length>0&&n.set(r,X,a)}extract(t,r,n){const s=n.get(r,X),i=Array.isArray(s)?s.join(nt):s;if(!i)return t;const a={};return i.length===0||(i.split(nt).forEach(u=>{const l=Ee(u);if(l){const h={value:l.value};l.metadata&&(h.metadata=l.metadata),a[l.key]=h}}),Object.entries(a).length===0)?t:I.setBaggage(t,I.createBaggage(a))}fields(){return[X]}}function N(e){const t={};if(typeof e!="object"||e==null)return t;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!be(r)){d.warn(`Invalid attribute key: ${r}`);continue}const n=e[r];if(!Dt(n)){d.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function be(e){return typeof e=="string"&&e!==""}function Dt(e){return e==null?!0:Array.isArray(e)?Te(e):vt(typeof e)}function Te(e){let t;for(const r of e){if(r==null)continue;const n=typeof r;if(n!==t){if(!t){if(vt(n)){t=n;continue}return!1}return!1}}return!0}function vt(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function ye(){return e=>{d.error(we(e))}}function we(e){return typeof e=="string"?e:JSON.stringify(Le(e))}function Le(e){const t={};let r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;const s=r[n];s&&(t[n]=String(s))}),r=Object.getPrototypeOf(r);return t}let Pe=ye();function C(e){try{Pe(e)}catch{}}const Ce="2.7.0",Q="exception.message",Re="exception.stacktrace",Y="exception.type",Ut="service.name",Oe="service.version",st="telemetry.sdk.language",xe="webjs",it="telemetry.sdk.name",ot="telemetry.sdk.version",Ie="process.runtime.name",q={[it]:"opentelemetry",[Ie]:"browser",[st]:xe,[ot]:Ce},y=performance,Ne=9,Me=6,De=Math.pow(10,Me),F=Math.pow(10,Ne);function w(e){const t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*De);return[r,n]}function ve(e){const t=w(y.timeOrigin),r=w(typeof e=="number"?e:y.now());return $t(t,r)}function Ue(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=F),[r,n]}function Be(e){return e[0]*F+e[1]}function pt(e){return e[0]*1e6+e[1]/1e3}function Bt(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function ft(e){return Bt(e)||typeof e=="number"||e instanceof Date}function $t(e,t){const r=[e[0]+t[0],e[1]+t[1]];return r[1]>=F&&(r[1]-=F,r[0]+=1),r}var _;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(_||(_={}));class $e{constructor(t={}){o(this,"_propagators");o(this,"_fields");this._propagators=t.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(t,r,n){for(const s of this._propagators)try{s.inject(t,r,n)}catch(i){d.warn(`Failed to inject with ${s.constructor.name}. Err: ${i.message}`)}}extract(t,r,n){return this._propagators.reduce((s,i)=>{try{return i.extract(s,r,n)}catch(a){d.warn(`Failed to extract with ${i.constructor.name}. Err: ${a.message}`)}return s},t)}fields(){return this._fields.slice()}}const at="[_0-9a-z-*/]",ke=`[a-z]${at}{0,255}`,Fe=`[a-z0-9]${at}{0,240}@[a-z]${at}{0,13}`,je=new RegExp(`^(?:${ke}|${Fe})$`),ze=/^[ -~]{0,255}[!-~]$/,Ve=/,|=/;function Ge(e){return je.test(e)}function He(e){return ze.test(e)&&!Ve.test(e)}const _t=32,Ke=512,mt=",",St="=";class lt{constructor(t){o(this,"_internalState",new Map);t&&this._parse(t)}set(t,r){const n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,r),n}unset(t){const r=this._clone();return r._internalState.delete(t),r}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce((t,r)=>(t.push(r+St+this.get(r)),t),[]).join(mt)}_parse(t){t.length>Ke||(this._internalState=t.split(mt).reverse().reduce((r,n)=>{const s=n.trim(),i=s.indexOf(St);if(i!==-1){const a=s.slice(0,i),c=s.slice(i+1,n.length);Ge(a)&&He(c)&&r.set(a,c)}return r},new Map),this._internalState.size>_t&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,_t))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const t=new lt;return t._internalState=new Map(this._internalState),t}}const W="traceparent",J="tracestate",Xe="00",Qe="(?!ff)[\\da-f]{2}",Ye="(?![0]{32})[\\da-f]{32}",qe="(?![0]{16})[\\da-f]{16}",We="[\\da-f]{2}",Je=new RegExp(`^\\s?(${Qe})-(${Ye})-(${qe})-(${We})(-.*)?\\s?$`);function Ze(e){const t=Je.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}class tr{inject(t,r,n){const s=S.getSpanContext(t);if(!s||ut(t)||!It(s))return;const i=`${Xe}-${s.traceId}-${s.spanId}-0${Number(s.traceFlags||P.NONE).toString(16)}`;n.set(r,W,i),s.traceState&&n.set(r,J,s.traceState.serialize())}extract(t,r,n){const s=n.get(r,W);if(!s)return t;const i=Array.isArray(s)?s[0]:s;if(typeof i!="string")return t;const a=Ze(i);if(!a)return t;a.isRemote=!0;const c=n.get(r,J);if(c){const u=Array.isArray(c)?c.join(","):c;a.traceState=new lt(typeof u=="string"?u:void 0)}return S.setSpanContext(t,a)}fields(){return[W,J]}}const er="[object Object]",rr="[object Null]",nr="[object Undefined]",sr=Function.prototype,kt=sr.toString,ir=kt.call(Object),or=Object.getPrototypeOf,Ft=Object.prototype,jt=Ft.hasOwnProperty,A=Symbol?Symbol.toStringTag:void 0,zt=Ft.toString;function gt(e){if(!ar(e)||cr(e)!==er)return!1;const t=or(e);if(t===null)return!0;const r=jt.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&kt.call(r)===ir}function ar(e){return e!=null&&typeof e=="object"}function cr(e){return e==null?e===void 0?nr:rr:A&&A in Object(e)?ur(e):lr(e)}function ur(e){const t=jt.call(e,A),r=e[A];let n=!1;try{e[A]=void 0,n=!0}catch{}const s=zt.call(e);return n&&(t?e[A]=r:delete e[A]),s}function lr(e){return zt.call(e)}const dr=20;function hr(...e){let t=e.shift();const r=new WeakMap;for(;e.length>0;)t=Vt(t,e.shift(),0,r);return t}function Z(e){return j(e)?e.slice():e}function Vt(e,t,r=0,n){let s;if(!(r>dr)){if(r++,$(e)||$(t)||Gt(t))s=Z(t);else if(j(e)){if(s=e.slice(),j(t))for(let i=0,a=t.length;i<a;i++)s.push(Z(t[i]));else if(O(t)){const i=Object.keys(t);for(let a=0,c=i.length;a<c;a++){const u=i[a];u==="__proto__"||u==="constructor"||u==="prototype"||(s[u]=Z(t[u]))}}}else if(O(e))if(O(t)){if(!pr(e,t))return t;s=Object.assign({},e);const i=Object.keys(t);for(let a=0,c=i.length;a<c;a++){const u=i[a];if(u==="__proto__"||u==="constructor"||u==="prototype")continue;const l=t[u];if($(l))typeof l>"u"?delete s[u]:s[u]=l;else{const h=s[u],p=l;if(Et(e,u,n)||Et(t,u,n))delete s[u];else{if(O(h)&&O(p)){const E=n.get(h)||[],f=n.get(p)||[];E.push({obj:e,key:u}),f.push({obj:t,key:u}),n.set(h,E),n.set(p,f)}s[u]=Vt(s[u],l,r,n)}}}}else s=t;return s}}function Et(e,t,r){const n=r.get(e[t])||[];for(let s=0,i=n.length;s<i;s++){const a=n[s];if(a.key===t&&a.obj===e)return!0}return!1}function j(e){return Array.isArray(e)}function Gt(e){return typeof e=="function"}function O(e){return!$(e)&&!j(e)&&!Gt(e)&&typeof e=="object"}function $(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function pr(e,t){return!(!gt(e)||!gt(t))}class fr{constructor(){o(this,"_promise");o(this,"_resolve");o(this,"_reject");this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}}class _r{constructor(t,r){o(this,"_isCalled",!1);o(this,"_deferred",new fr);o(this,"_callback");o(this,"_that");this._callback=t,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}function mr(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function Sr(){return{handleResponse(e){e==null||!mr(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||d.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class gr{constructor(t,r,n,s,i){o(this,"_diagLogger");o(this,"_transport");o(this,"_serializer");o(this,"_responseHandler");o(this,"_promiseQueue");o(this,"_timeout");this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=s,this._timeout=i,this._diagLogger=d.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:_.FAILED,error:new Error("Concurrent export limit reached")});return}const n=this._serializer.serializeRequest(t);if(n==null){r({code:_.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(s=>{if(s.status==="success"){if(s.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(s.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,s.data)}r({code:_.SUCCESS});return}else if(s.status==="failure"&&s.error){r({code:_.FAILED,error:s.error});return}else s.status==="retryable"?r({code:_.FAILED,error:s.error??new ht("Export failed with retryable status")}):r({code:_.FAILED,error:new ht("Export failed with unknown error")})},s=>r({code:_.FAILED,error:s})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function Er(e,t){return new gr(e.transport,e.serializer,Sr(),e.promiseHandler,t.timeout)}function Ar(e,t,r){return Er({transport:r,serializer:t,promiseHandler:de(e)},{timeout:e.timeoutMillis})}let v;function br(){if(v===void 0)try{const e=globalThis.process.argv0;v=e?`unknown_service:${e}`:"unknown_service"}catch{v="unknown_service"}return v}const x=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";class z{constructor(t,r){o(this,"_rawAttributes");o(this,"_asyncAttributesPending",!1);o(this,"_schemaUrl");o(this,"_memoizedAttributes");const n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([s,i])=>(x(i)&&(this._asyncAttributesPending=!0),[s,i])),this._rawAttributes=At(this._rawAttributes),this._schemaUrl=yr(r==null?void 0:r.schemaUrl)}static FromAttributeList(t,r){const n=new z({},r);return n._rawAttributes=At(t),n._asyncAttributesPending=t.filter(([s,i])=>x(i)).length>0,n}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){const[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,x(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&d.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const t={};for(const[r,n]of this._rawAttributes){if(x(n)){d.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(t[r]??(t[r]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;const r=wr(this,t),n=r?{schemaUrl:r}:void 0;return z.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}}function Ht(e,t){return z.FromAttributeList(Object.entries(e),t)}function Tr(){return Ht({[Ut]:br(),[st]:q[st],[it]:q[it],[ot]:q[ot]})}function At(e){return e.map(([t,r])=>x(r)?[t,r.catch(n=>{d.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function yr(e){if(typeof e=="string"||e===void 0)return e;d.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function wr(e,t){const r=e==null?void 0:e.schemaUrl,n=t==null?void 0:t.schemaUrl,s=r===void 0||r==="",i=n===void 0||n==="";if(s)return n;if(i||r===n)return r;d.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}function Lr(e,t){const r={attributes:G(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function Pr(e){return{name:e.name,version:e.version}}function G(e,t){return Object.keys(e).map(r=>Cr(r,e[r],t))}function Cr(e,t,r){return{key:e,value:ct(t,r)}}function ct(e,t){const r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=ct(e[s],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){const n=Object.keys(e),s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]={key:n[i],value:ct(e[n[i]],t)};return{kvlistValue:{values:s}}}return{}}function Rr(e){const t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Or(e){return Rr(e).toString()}const xr=typeof BigInt<"u"?Or:Be;function bt(e){return e}const Ir={encodeHrTime:xr,encodeSpanContext:bt,encodeOptionalSpanContext:bt,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");const t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}},Nr=256,Mr=512;function Kt(e,t){let r=e&255|Nr;return t&&(r|=Mr),r}function Dr(e,t){var i,a,c,u;const r=e.spanContext(),n=e.status,s=(i=e.parentSpanContext)!=null&&i.spanId?t.encodeSpanContext((a=e.parentSpanContext)==null?void 0:a.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:s,traceState:(c=r.traceState)==null?void 0:c.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:G(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(l=>Ur(l,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(l=>vr(l,t)),droppedLinksCount:e.droppedLinksCount,flags:Kt(r.traceFlags,(u=e.parentSpanContext)==null?void 0:u.isRemote)}}function vr(e,t){var r;return{attributes:e.attributes?G(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(r=e.context.traceState)==null?void 0:r.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Kt(e.context.traceFlags,e.context.isRemote)}}function Ur(e,t){return{attributes:e.attributes?G(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Br(e,t){return{resourceSpans:kr(e,t)}}function $r(e){const t=new Map;for(const r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));const s=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`;let i=n.get(s);i||(i=[],n.set(s,i)),i.push(r)}return t}function kr(e,t){const r=$r(e),n=[],s=r.entries();let i=s.next();for(;!i.done;){const[a,c]=i.value,u=[],l=c.values();let h=l.next();for(;!h.done;){const f=h.value;if(f.length>0){const H=f.map(K=>Dr(K,t));u.push({scope:Pr(f[0].instrumentationScope),spans:H,schemaUrl:f[0].instrumentationScope.schemaUrl})}h=l.next()}const p=Lr(a,t),E={resource:p,scopeSpans:u,schemaUrl:p.schemaUrl};n.push(E),i=s.next()}return n}const Fr={serializeRequest:e=>{const t=Br(e,Ir);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return d.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}},tt=5,jr=1e3,zr=5e3,Vr=1.5,Tt=.2;function Gr(){return Math.random()*(2*Tt)-Tt}class Hr{constructor(t){o(this,"_transport");this._transport=t}retry(t,r,n){return new Promise((s,i)=>{setTimeout(()=>{this._transport.send(t,r).then(s,i)},n)})}async send(t,r){let n=tt,s=jr;const i=Date.now()+r;let a=await this._transport.send(t,r);for(;a.status==="retryable"&&n>0;){n--;const c=Math.max(Math.min(s*(1+Gr()),zr),0);s=s*Vr;const u=a.retryInMillis??c,l=i-Date.now();if(u>l)return d.info(`Export retry time ${Math.round(u)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),a;d.verbose(`Scheduling export retry in ${Math.round(u)}ms`),a=await this.retry(t,l,u)}return a.status==="success"?d.verbose(`Export succeeded after ${tt-n} retry attempts.`):a.status==="retryable"?d.info(`Export failed after maximum retry attempts (${tt}).`):d.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}}function Kr(e){return new Hr(e.transport)}function Xr(e){return e===429||e===502||e===503||e===504}function Qr(e){if(e==null)return;const t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;const r=new Date(e).getTime()-Date.now();return r>=0?r:0}const Yr=60*1024,qr=9;let et=0,U=0;class Wr{constructor(t){o(this,"_parameters");this._parameters=t}async send(t,r){const n=new AbortController,s=setTimeout(()=>n.abort(),r);let i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);const a=t.byteLength,c=et+a>Yr,u=U>=qr,l=!c&&!u;if(l)et+=a,U++;else{const h=c?"size limit":"count limit";d.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${U} pending (${h})`)}try{const h=new URL(this._parameters.url),p=await i(h.href,{method:"POST",headers:await this._parameters.headers(),body:t,signal:n.signal,keepalive:l,mode:globalThis.location?globalThis.location.origin===h.origin?"same-origin":"cors":"no-cors"});if(p.status>=200&&p.status<=299)return d.debug(`export response success (status: ${p.status})`),{status:"success"};if(Xr(p.status)){d.warn(`export response retryable (status: ${p.status})`);const E=p.headers.get("Retry-After");return{status:"retryable",retryInMillis:Qr(E)}}return d.error(`export response failure (status: ${p.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${p.status}`)}}catch(h){return Zr(h)?(d.warn(`export request retryable (network error: ${h})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:h})}):(d.error(`export request failure (error: ${h})`),{status:"failure",error:new Error("Fetch request errored",{cause:h})})}finally{clearTimeout(s),l&&(et-=a,U--)}}shutdown(){}}function Jr(e){return new Wr(e)}function Zr(e){return e instanceof TypeError&&!e.cause}function tn(e,t){return Ar(e,t,Kr({transport:Jr(e)}))}function en(e){const t={};return Object.entries(e??{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):d.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}function rn(e,t,r){return async()=>{const n={...await r()},s={};return t!=null&&Object.assign(s,await t()),e!=null&&Object.assign(s,en(await e())),Object.assign(s,n)}}function nn(e){var t;if(e!=null)try{const r=(t=globalThis.location)==null?void 0:t.href;return new URL(e,r).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function sn(e,t,r){return{...ce(e,t,r),headers:rn(e.headers,t.headers,r.headers),url:nn(e.url)??t.url??r.url}}function on(e,t){return{...ue(),headers:async()=>e,url:"http://localhost:4318/"+t}}function an(e){return typeof e.headers=="function"?e.headers:ae(e.headers)}function cn(e,t,r){return sn({url:e.url,timeoutMillis:e.timeoutMillis,headers:an(e),concurrencyLimit:e.concurrencyLimit},{},on(r,t))}function un(e,t,r,n){const s=cn(e,r,n);return tn(s,t)}class ln extends ie{constructor(t={}){super(un(t,Fr,"v1/traces",{"Content-Type":"application/json"}))}}const dn="exception";class hn{constructor(t){o(this,"_spanContext");o(this,"kind");o(this,"parentSpanContext");o(this,"attributes",{});o(this,"links",[]);o(this,"events",[]);o(this,"startTime");o(this,"resource");o(this,"instrumentationScope");o(this,"_droppedAttributesCount",0);o(this,"_droppedEventsCount",0);o(this,"_droppedLinksCount",0);o(this,"_attributesCount",0);o(this,"name");o(this,"status",{code:D.UNSET});o(this,"endTime",[0,0]);o(this,"_ended",!1);o(this,"_duration",[-1,-1]);o(this,"_spanProcessor");o(this,"_spanLimits");o(this,"_attributeValueLengthLimit");o(this,"_recordEndMetrics");o(this,"_performanceStartTime");o(this,"_performanceOffset");o(this,"_startTimeProvided");const r=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=y.now(),this._performanceOffset=r-(this._performanceStartTime+y.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(const n of t.links)this.addLink(n);this.startTime=this._getTime(t.startTime??r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return d.warn(`Invalid attribute key: ${t}`),this;if(!Dt(r))return d.warn(`Invalid attribute value set for key: ${t}`),this;const{attributeCountLimit:n}=this._spanLimits,s=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&s?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),s&&this._attributesCount++,this)}setAttributes(t){for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.setAttribute(r,t[r]);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;const{eventCountLimit:s}=this._spanLimits;if(s===0)return d.warn("No events allowed."),this._droppedEventsCount++,this;s!==void 0&&this.events.length>=s&&(this._droppedEventsCount===0&&d.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),ft(r)&&(ft(n)||(n=r),r=void 0);const i=N(r),{attributePerEventCountLimit:a}=this._spanLimits,c={};let u=0,l=0;for(const h in i){if(!Object.prototype.hasOwnProperty.call(i,h))continue;const p=i[h];if(a!==void 0&&l>=a){u++;continue}c[h]=this._truncateToSize(p),l++}return this.events.push({name:t,attributes:c,time:this._getTime(n),droppedAttributesCount:u}),this}addLink(t){if(this._isSpanEnded())return this;const{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&d.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);const{attributePerLinkCountLimit:n}=this._spanLimits,s=N(t.attributes),i={};let a=0,c=0;for(const l in s){if(!Object.prototype.hasOwnProperty.call(s,l))continue;const h=s[l];if(n!==void 0&&c>=n){a++;continue}i[l]=this._truncateToSize(h),c++}const u={context:t.context};return c>0&&(u.attributes=i),a>0&&(u.droppedAttributesCount=a),this.links.push(u),this}addLinks(t){for(const r of t)this.addLink(r);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===D.UNSET)return this;if(this.status.code===D.OK)return this;const r={code:t.code};return t.code===D.ERROR&&(typeof t.message=="string"?r.message=t.message:t.message!=null&&d.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=r,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){var r;if(this._isSpanEnded()){d.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=Ue(this.startTime,this.endTime),this._duration[0]<0&&(d.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&d.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&d.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(r=this._recordEndMetrics)==null||r.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=y.now())return ve(t+this._performanceOffset);if(typeof t=="number")return w(t);if(t instanceof Date)return w(t.getTime());if(Bt(t))return t;if(this._startTimeProvided)return w(Date.now());const r=y.now()-this._performanceStartTime;return $t(this.startTime,w(r))}isRecording(){return this._ended===!1}recordException(t,r){const n={};typeof t=="string"?n[Q]=t:t&&(t.code?n[Y]=t.code.toString():t.name&&(n[Y]=t.name),t.message&&(n[Q]=t.message),t.stack&&(n[Re]=t.stack)),n[Y]||n[Q]?this.addEvent(dn,n,r):d.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);d.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_truncateToSize(t){const r=this._attributeValueLengthLimit;return r<=0?(d.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):t}}var g;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(g||(g={}));class V{shouldSample(){return{decision:g.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class L{shouldSample(){return{decision:g.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class B{constructor(t){o(this,"_root");o(this,"_remoteParentSampled");o(this,"_remoteParentNotSampled");o(this,"_localParentSampled");o(this,"_localParentNotSampled");this._root=t.root,this._root||(C(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new L),this._remoteParentSampled=t.remoteParentSampled??new L,this._remoteParentNotSampled=t.remoteParentNotSampled??new V,this._localParentSampled=t.localParentSampled??new L,this._localParentNotSampled=t.localParentNotSampled??new V}shouldSample(t,r,n,s,i,a){const c=S.getSpanContext(t);return!c||!It(c)?this._root.shouldSample(t,r,n,s,i,a):c.isRemote?c.traceFlags&P.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,s,i,a):this._remoteParentNotSampled.shouldSample(t,r,n,s,i,a):c.traceFlags&P.SAMPLED?this._localParentSampled.shouldSample(t,r,n,s,i,a):this._localParentNotSampled.shouldSample(t,r,n,s,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class yt{constructor(t=0){o(this,"_ratio");o(this,"_upperBound");this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:ee(r)&&this._accumulate(r)<this._upperBound?g.RECORD_AND_SAMPLED:g.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<t.length/8;n++){const s=n*8,i=parseInt(t.slice(s,s+8),16);r=(r^i)>>>0}return r}}var m;(function(e){e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(m||(m={}));const wt=1;function Xt(){return{sampler:Qt(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Qt(){const e=m.ParentBasedAlwaysOn;switch(e){case m.AlwaysOn:return new L;case m.AlwaysOff:return new V;case m.ParentBasedAlwaysOn:return new B({root:new L});case m.ParentBasedAlwaysOff:return new B({root:new V});case m.TraceIdRatio:return new yt(Lt());case m.ParentBasedTraceIdRatio:return new B({root:new yt(Lt())});default:return d.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${m.ParentBasedAlwaysOn}".`),new B({root:new L})}}function Lt(){return d.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${wt}.`),wt}const pn=128,fn=1/0;function _n(e){const t={sampler:Qt()},r=Xt(),n=Object.assign({},r,t,e);return n.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),n}function mn(e){var r,n,s,i;const t=Object.assign({},e.spanLimits);return t.attributeCountLimit=((r=e.spanLimits)==null?void 0:r.attributeCountLimit)??((n=e.generalLimits)==null?void 0:n.attributeCountLimit)??void 0??void 0??pn,t.attributeValueLengthLimit=((s=e.spanLimits)==null?void 0:s.attributeValueLengthLimit)??((i=e.generalLimits)==null?void 0:i.attributeValueLengthLimit)??void 0??void 0??fn,Object.assign({},e,{spanLimits:t})}class Sn{constructor(t,r){o(this,"_maxExportBatchSize");o(this,"_maxQueueSize");o(this,"_scheduledDelayMillis");o(this,"_exportTimeoutMillis");o(this,"_exporter");o(this,"_isExporting",!1);o(this,"_finishedSpans",[]);o(this,"_timer");o(this,"_shutdownOnce");o(this,"_droppedSpansCount",0);this._exporter=t,this._maxExportBatchSize=typeof(r==null?void 0:r.maxExportBatchSize)=="number"?r.maxExportBatchSize:512,this._maxQueueSize=typeof(r==null?void 0:r.maxQueueSize)=="number"?r.maxQueueSize:2048,this._scheduledDelayMillis=typeof(r==null?void 0:r.scheduledDelayMillis)=="number"?r.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof(r==null?void 0:r.exportTimeoutMillis)=="number"?r.exportTimeoutMillis:3e4,this._shutdownOnce=new _r(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(d.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&P.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&d.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(d.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{const n=[],s=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,a=s;i<a;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{const n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);T.with(he(T.active()),()=>{let s;this._finishedSpans.length<=this._maxExportBatchSize?(s=this._finishedSpans,this._finishedSpans=[]):s=this._finishedSpans.splice(0,this._maxExportBatchSize);const i=()=>this._exporter.export(s,c=>{clearTimeout(n),c.code===_.SUCCESS?t():r(c.error??new Error("BatchSpanProcessor: span export failed"))});let a=null;for(let c=0,u=s.length;c<u;c++){const l=s[c];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(a??(a=[]),a.push(l.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,c=>{C(c),r(c)})})})}_maybeStartTimer(){if(this._isExporting)return;const t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,C(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}class gn extends Sn{constructor(r,n){super(r,n);o(this,"_visibilityChangeListener");o(this,"_pageHideListener");this.onInit(n)}onInit(r){(r==null?void 0:r.disableAutoFlushOnDocumentHide)!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(n=>{C(n)})},this._pageHideListener=()=>{this.forceFlush().catch(n=>{C(n)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}const En=16,An=8,Pt=new Uint8Array(En),Ct=new Uint8Array(An),bn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Rt(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Ot(e){let t="";for(let r=0;r<e.length;r++)t+=bn[e[r]];return t}class Tn{generateTraceId(){return Rt(Pt),Ot(Pt)}generateSpanId(){return Rt(Ct),Ot(Ct)}}const yn="otel.span.parent.origin",xt="otel.span.sampling_result",wn="otel.sdk.span.live",Ln="otel.sdk.span.started";class Pn{constructor(t){o(this,"startedSpans");o(this,"liveSpans");this.startedSpans=t.createCounter(Ln,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(wn,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){const n=Rn(r);if(this.startedSpans.add(1,{[yn]:Cn(t),[xt]:n}),r===g.NOT_RECORD)return()=>{};const s={[xt]:n};return this.liveSpans.add(1,s),()=>{this.liveSpans.add(-1,s)}}}function Cn(e){return e?e.isRemote?"remote":"local":"none"}function Rn(e){switch(e){case g.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case g.RECORD:return"RECORD_ONLY";case g.NOT_RECORD:return"DROP"}}const On="2.7.0";class xn{constructor(t,r,n,s){o(this,"_sampler");o(this,"_generalLimits");o(this,"_spanLimits");o(this,"_idGenerator");o(this,"instrumentationScope");o(this,"_resource");o(this,"_spanProcessor");o(this,"_tracerMetrics");const i=_n(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new Tn,this._resource=n,this._spanProcessor=s,this.instrumentationScope=t;const a=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",On):re();this._tracerMetrics=new Pn(a)}startSpan(t,r={},n=T.active()){r.root&&(n=S.deleteSpan(n));const s=S.getSpan(n);if(ut(n))return d.debug("Instrumentation suppressed, returning Noop Span"),S.wrapSpanContext(ne);const i=s==null?void 0:s.spanContext(),a=this._idGenerator.generateSpanId();let c,u,l;!i||!S.isSpanContextValid(i)?u=this._idGenerator.generateTraceId():(u=i.traceId,l=i.traceState,c=i);const h=r.kind??se.INTERNAL,p=(r.links??[]).map(M=>({context:M.context,attributes:N(M.attributes)})),E=N(r.attributes),f=this._sampler.shouldSample(n,u,t,h,E,p),H=this._tracerMetrics.startSpan(i,f.decision);l=f.traceState??l;const K=f.decision===k.RECORD_AND_SAMPLED?P.SAMPLED:P.NONE,dt={traceId:u,spanId:a,traceFlags:K,traceState:l};if(f.decision===k.NOT_RECORD)return d.debug("Recording is off, propagating context in a non-recording span"),S.wrapSpanContext(dt);const Yt=N(Object.assign(E,f.attributes));return new hn({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:dt,name:t,kind:h,links:p,parentSpanContext:c,attributes:Yt,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:H})}startActiveSpan(t,r,n,s){let i,a,c;if(arguments.length<2)return;arguments.length===2?c=r:arguments.length===3?(i=r,c=n):(i=r,a=n,c=s);const u=a??T.active(),l=this.startSpan(t,i,u),h=S.setSpan(u,l);return T.with(h,c,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class In{constructor(t){o(this,"_spanProcessors");this._spanProcessors=t}forceFlush(){const t=[];for(const r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(n=>{C(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(const n of this._spanProcessors)n.onStart(t,r)}onEnding(t){for(const r of this._spanProcessors)r.onEnding&&r.onEnding(t)}onEnd(t){for(const r of this._spanProcessors)r.onEnd(t)}shutdown(){const t=[];for(const r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,n)=>{Promise.all(t).then(()=>{r()},n)})}}var b;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(b||(b={}));class Nn{constructor(t={}){o(this,"_config");o(this,"_tracers",new Map);o(this,"_resource");o(this,"_activeSpanProcessor");var s;const r=hr({},Xt(),mn(t));this._resource=r.resource??Tr(),this._config=Object.assign({},r,{resource:this._resource});const n=[];(s=t.spanProcessors)!=null&&s.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new In(n)}getTracer(t,r,n){const s=`${t}@${r||""}:${(n==null?void 0:n.schemaUrl)||""}`;return this._tracers.has(s)||this._tracers.set(s,new xn({name:t,version:r,schemaUrl:n==null?void 0:n.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(s)}forceFlush(){const t=this._config.forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(s=>{let i;const a=setTimeout(()=>{s(new Error(`Span processor did not completed within timeout period of ${t} ms`)),i=b.timeout},t);n.forceFlush().then(()=>{clearTimeout(a),i!==b.timeout&&(i=b.resolved,s(i))}).catch(c=>{clearTimeout(a),i=b.error,s(c)})}));return new Promise((n,s)=>{Promise.all(r).then(i=>{const a=i.filter(c=>c!==b.resolved);a.length>0?s(a):n()}).catch(i=>s([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class Mn{export(t,r){return this._sendSpans(t,r)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(t){var r;return{resource:{attributes:t.resource.attributes},instrumentationScope:t.instrumentationScope,traceId:t.spanContext().traceId,parentSpanContext:t.parentSpanContext,traceState:(r=t.spanContext().traceState)==null?void 0:r.serialize(),name:t.name,id:t.spanContext().spanId,kind:t.kind,timestamp:pt(t.startTime),duration:pt(t.duration),attributes:t.attributes,status:t.status,events:t.events,links:t.links}}_sendSpans(t,r){for(const n of t)console.dir(this._exportInfo(n),{depth:3});if(r)return r({code:_.SUCCESS})}}class Dn{constructor(){o(this,"_enabled",!1);o(this,"_currentContext",R)}_bindFunction(t=R,r){const n=this,s=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(s,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),s}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=R,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=R,this)}with(t,r,n,...s){const i=this._currentContext;this._currentContext=t||R;try{return r.call(n,...s)}finally{this._currentContext=i}}}function vn(e){if(e!==null){if(e===void 0){const t=new Dn;t.enable(),T.setGlobalContextManager(t);return}e.enable(),T.setGlobalContextManager(e)}}function Un(e){if(e!==null){if(e===void 0){I.setGlobalPropagator(new $e({propagators:[new tr,new Ae]}));return}I.setGlobalPropagator(e)}}class Bn extends Nn{constructor(t={}){super(t)}register(t={}){S.setGlobalTracerProvider(this),Un(t.propagator),vn(t.contextManager)}}var rt;function Vn(e){if(rt||!(e.enabled??!!e.otlpEndpoint))return!1;const r=e.otlpEndpoint?new ln({url:e.otlpEndpoint,...e.otlpHeaders?{headers:e.otlpHeaders}:{}}):new Mn,n=Ht({[Ut]:e.serviceName,[Oe]:e.serviceVersion??"0.0.0"});return rt=new Bn({resource:n,spanProcessors:[new gn(r)]}),rt.register(),!0}export{Vn as initObservabilityWeb};
|
|
2
|
+
//# sourceMappingURL=web-Ua5dIRkZ.js.map
|