@kanorio/elements 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/AudioPlayer-DKUAB5KE.js +2 -0
- package/dist/AudioPlayer-S7YF7A2E.js +2 -0
- package/dist/CustomerAccountPanel-DJKV7LT4.js +2 -0
- package/dist/CustomerAccountPanel-RWEHWBJY.js +2 -0
- package/dist/FormAddressField-C6VN7J6I.js +2 -0
- package/dist/FormAddressField-QR7ZCH77.js +2 -0
- package/dist/FormChoiceDropdown-SJXD26CC.js +2 -0
- package/dist/FormChoiceDropdown-U3NIOOHG.js +2 -0
- package/dist/FormFileField-LZDCXI2Z.js +2 -0
- package/dist/FormFileField-ONL4Q55V.js +2 -0
- package/dist/FormTaxIdField-K34MDUPW.js +2 -0
- package/dist/FormTaxIdField-XMK5WRQO.js +2 -0
- package/dist/KanorioAccount-EN3TM67X.js +2 -0
- package/dist/KanorioAccount-XGVSGVYN.js +2 -0
- package/dist/KanorioAnalytics-NEKTFQEE.js +2 -0
- package/dist/KanorioAnalytics-UMCUWQM7.js +2 -0
- package/dist/KanorioCurriculum-3QSCOHK7.js +2 -0
- package/dist/KanorioCurriculum-RUIGZ5X7.js +2 -0
- package/dist/KanorioForm-GUA5GEJY.js +2 -0
- package/dist/KanorioForm-KXV7D2TU.js +2 -0
- package/dist/KanorioLightbox-M72HNQQX.js +2 -0
- package/dist/KanorioLightbox-TQ3Q73TD.js +2 -0
- package/dist/KanorioLogin-5XFN3YEE.js +2 -0
- package/dist/KanorioLogin-AJHHVQGV.js +2 -0
- package/dist/KanorioMedia-ADKUDH5C.js +2 -0
- package/dist/KanorioMedia-DLBSXCKA.js +2 -0
- package/dist/KanorioReviews-42FZSXTI.js +2 -0
- package/dist/KanorioReviews-7LD5WKFG.js +2 -0
- package/dist/KanorioUnit-NWBX5DEI.js +2 -0
- package/dist/KanorioUnit-SIM3344J.js +2 -0
- package/dist/MediaPlayer-F43FPK4E.js +2 -0
- package/dist/MediaPlayer-JHFZFOOG.js +2 -0
- package/dist/{PDFViewerFull-KMUVT2BL.js → PDFViewerFull-CB44M7GW.js} +3 -3
- package/dist/{PDFViewerFull-FBLYNUDX.js → PDFViewerFull-INVHZL4V.js} +2 -2
- package/dist/VideoPlayer-FWZF4DQK.js +2 -0
- package/dist/VideoPlayer-LNS7XJ4C.js +2 -0
- package/dist/account.d.ts +165 -0
- package/dist/account.js +2 -0
- package/dist/analytics.d.ts +44 -0
- package/dist/analytics.js +2 -0
- package/dist/bot-protection.d.ts +297 -0
- package/dist/bot-protection.js +2 -0
- package/dist/chunk-2E6RCDAA.js +2 -0
- package/dist/chunk-2FSD3N7F.js +6 -0
- package/dist/chunk-2J5XQK4H.js +2 -0
- package/dist/chunk-2LOQXVFI.js +2 -0
- package/dist/chunk-2ONAW3CA.js +2 -0
- package/dist/chunk-33AQQY6T.js +69 -0
- package/dist/chunk-36YEGBKK.js +2 -0
- package/dist/chunk-4BBERZ6T.js +2 -0
- package/dist/chunk-4BEKWYEW.js +2 -0
- package/dist/chunk-4DPSNQEI.js +2 -0
- package/dist/chunk-4KA3HSRQ.js +2 -0
- package/dist/chunk-4MOCTNN7.js +2 -0
- package/dist/chunk-5AUWUK5R.js +2 -0
- package/dist/chunk-5G3PQI25.js +2 -0
- package/dist/chunk-5HWAL7VK.js +2 -0
- package/dist/chunk-63XJWMJG.js +2 -0
- package/dist/chunk-66XN5RR4.js +2 -0
- package/dist/chunk-6RZBXZFP.js +2 -0
- package/dist/chunk-763LNERD.js +2 -0
- package/dist/chunk-7XWBVRXP.js +15 -0
- package/dist/chunk-A4DPHHAP.js +42 -0
- package/dist/chunk-AF46NLXK.js +2 -0
- package/dist/chunk-AFNEGNVJ.js +2 -0
- package/dist/chunk-AQ6F6MIJ.js +2 -0
- package/dist/chunk-ARU5PTJV.js +2 -0
- package/dist/chunk-B7KLKVIM.js +2 -0
- package/dist/chunk-BGVTMWPN.js +2 -0
- package/dist/chunk-BKNL7ZCI.js +2 -0
- package/dist/chunk-BU7KUHZK.js +8 -0
- package/dist/chunk-C7HUM2EN.js +2 -0
- package/dist/chunk-CU2JJTXI.js +2 -0
- package/dist/{chunk-5U2SZE3H.js → chunk-CUQUEGX2.js} +2 -2
- package/dist/chunk-D7K3YCBR.js +2 -0
- package/dist/chunk-DLJDYXKL.js +2 -0
- package/dist/chunk-DTBRUBPG.js +2 -0
- package/dist/chunk-E77WGXYW.js +2 -0
- package/dist/chunk-EE4S6NRV.js +3 -0
- package/dist/chunk-ET57PWXC.js +2 -0
- package/dist/chunk-EZMTUAQX.js +2 -0
- package/dist/chunk-FFAWYDLJ.js +2 -0
- package/dist/chunk-FQCA2VGY.js +2 -0
- package/dist/chunk-FSY5GB5E.js +3 -0
- package/dist/chunk-G4U6BFZY.js +2 -0
- package/dist/chunk-GJY6AQIS.js +2 -0
- package/dist/chunk-GMW7AUSG.js +2 -0
- package/dist/chunk-GZCED6V3.js +2 -0
- package/dist/chunk-H2XQYT62.js +2 -0
- package/dist/chunk-H7VP4BYY.js +2 -0
- package/dist/chunk-HFYLTH5B.js +2 -0
- package/dist/chunk-IAXVJLJ3.js +2 -0
- package/dist/chunk-IXDKZO42.js +2 -0
- package/dist/chunk-J37D44SX.js +2 -0
- package/dist/chunk-JH5D6YJX.js +2 -0
- package/dist/chunk-JREL5347.js +2 -0
- package/dist/chunk-K2XZKV3Q.js +2 -0
- package/dist/chunk-K4VRRKYJ.js +2 -0
- package/dist/chunk-KBKDMTYF.js +2 -0
- package/dist/chunk-KDNGDR64.js +2 -0
- package/dist/chunk-KNNN5V3T.js +2 -0
- package/dist/chunk-LWKCGUHS.js +2 -0
- package/dist/chunk-LWRWKZBC.js +2 -0
- package/dist/chunk-LXNMHQFN.js +2 -0
- package/dist/chunk-MC63CLSM.js +2 -0
- package/dist/chunk-MIQK3T3Y.js +2 -0
- package/dist/chunk-MQ7PBFUM.js +4 -0
- package/dist/chunk-MWPRTK32.js +2 -0
- package/dist/chunk-MXGMJAWS.js +2 -0
- package/dist/chunk-N4BGAMWD.js +2 -0
- package/dist/chunk-N5PIQM4L.js +3 -0
- package/dist/chunk-NBDRYQZV.js +2 -0
- package/dist/chunk-NGRNPVON.js +2 -0
- package/dist/chunk-NSY72ZYX.js +15 -0
- package/dist/chunk-O2SYHUQF.js +2 -0
- package/dist/chunk-OIKRLEW6.js +2 -0
- package/dist/chunk-OTK4YNSG.js +2 -0
- package/dist/chunk-OU4IOHLN.js +15 -0
- package/dist/chunk-PR2NRUEI.js +2 -0
- package/dist/chunk-QGR3QAQB.js +3 -0
- package/dist/chunk-QOQQCCID.js +2 -0
- package/dist/chunk-RG5JA44V.js +2 -0
- package/dist/chunk-RKEHHJDU.js +2 -0
- package/dist/chunk-S2NFWI7C.js +69 -0
- package/dist/chunk-S7FE2XRA.js +2 -0
- package/dist/chunk-SUXTLVTX.js +2 -0
- package/dist/chunk-SVWEVSYJ.js +2 -0
- package/dist/chunk-TEUQV3AT.js +2 -0
- package/dist/chunk-U7H3W23Q.js +2 -0
- package/dist/chunk-U7KVGD47.js +2 -0
- package/dist/chunk-UIHBR4NU.js +3 -0
- package/dist/chunk-UM74DXPE.js +2 -0
- package/dist/chunk-VKSYPXNL.js +2 -0
- package/dist/chunk-VUTODQFX.js +2 -0
- package/dist/chunk-VYSRVTYI.js +2 -0
- package/dist/chunk-W32ZFOPN.js +2 -0
- package/dist/chunk-W63RJF6Q.js +2 -0
- package/dist/chunk-WM5S3YN5.js +2 -0
- package/dist/chunk-WP7UEAIB.js +2 -0
- package/dist/chunk-WXIUWMFR.js +2 -0
- package/dist/chunk-Z4A5NQWJ.js +2 -0
- package/dist/chunk-Z4OV6QHI.js +2 -0
- package/dist/curriculum.d.ts +20 -0
- package/dist/curriculum.js +2 -0
- package/dist/deliverables-BDS7WMBC.js +99 -0
- package/dist/deliverables-C5RD2ASE.js +131 -0
- package/dist/elements.css +1 -1
- package/dist/events-CJeBru-H.d.ts +11 -0
- package/dist/form.d.ts +775 -0
- package/dist/form.js +2 -0
- package/dist/forms-answers-address-7P6EVFY5.js +2 -0
- package/dist/forms-answers-address-IQV2Y56H.js +2 -0
- package/dist/forms-answers-phone-2VZ46OME.js +2 -0
- package/dist/forms-answers-phone-5PUB5WKD.js +2 -0
- package/dist/forms-answers-tax-id-D4GOUC6N.js +2 -0
- package/dist/forms-answers-tax-id-WJD7K3PG.js +2 -0
- package/dist/index.d.ts +17 -3045
- package/dist/index.js +1 -1
- package/dist/kanorio-elements.js +9 -73
- package/dist/lightbox-DEvsB5dB.d.ts +100 -0
- package/dist/lightbox.d.ts +5 -0
- package/dist/lightbox.js +2 -0
- package/dist/login.d.ts +14 -0
- package/dist/login.js +2 -0
- package/dist/media.d.ts +85 -0
- package/dist/media.js +2 -0
- package/dist/phone-input-Q5AV6KSW.js +2 -0
- package/dist/phone-input-T6QX2TDS.js +2 -0
- package/dist/provider-CMLzyAjJ.d.ts +1277 -0
- package/dist/provider.d.ts +4 -0
- package/dist/provider.js +2 -0
- package/dist/reviews.d.ts +42 -0
- package/dist/reviews.js +2 -0
- package/dist/unit.d.ts +118 -0
- package/dist/unit.js +2 -0
- package/dist/{vidstack-BmcqUMKx-XYI2YLUH.js → vidstack-BmcqUMKx-FXVV4FRB.js} +2 -2
- package/dist/{vidstack-GkTzay8D-PBE5ZIYA.js → vidstack-GkTzay8D-53C3FRCO.js} +2 -2
- package/dist/web-components.d.ts +13 -1
- package/dist/web-components.js +1 -1
- package/dist/wire-ofSodpi1.d.ts +176 -0
- package/package.json +46 -2
- package/dist/MediaPlayer-7IBSXL7Q.js +0 -2
- package/dist/MediaPlayer-HTXF4T2V.js +0 -2
- package/dist/chunk-2UVUNYL6.js +0 -2
- package/dist/chunk-3OGF7I4H.js +0 -2
- package/dist/chunk-5AWUTOK7.js +0 -2
- package/dist/chunk-DTDUK36B.js +0 -8
- package/dist/chunk-JZXJO62T.js +0 -15
- package/dist/chunk-LLHBSWTL.js +0 -2
- package/dist/chunk-NOCGHD2O.js +0 -2
- package/dist/chunk-S4ZA2INU.js +0 -415
- package/dist/chunk-TLBIYET7.js +0 -404
- package/dist/chunk-TLRFFLH4.js +0 -94
- package/dist/chunk-U3U5KVR6.js +0 -2
- package/dist/chunk-UBMXRFSK.js +0 -4
- package/dist/deliverables-FBCRGMTB.js +0 -93
- package/dist/deliverables-FMKPDHJH.js +0 -92
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as m,d as f,e as c}from"./chunk-D7K3YCBR.js";import{a as l,b as a,c as u}from"./chunk-VYSRVTYI.js";import{ba as s}from"./chunk-S2NFWI7C.js";import{a as i}from"./chunk-OU4IOHLN.js";import{a as N}from"./chunk-6LGTFWQS.js";import{c as r}from"./chunk-CDG7S4P5.js";var d=r(N());var p=r(i()),O=s("flex h-11 w-full rounded-md border px-3 py-2 text-[length:var(--site-input-text,16px)] file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors",f,m),S=d.forwardRef(({className:C,type:e,onKeyDown:b,onCompositionStart:g,onCompositionEnd:R,...o},h)=>{let x=o["aria-invalid"]===!0,A=l({onKeyDown:b,onCompositionStart:g,onCompositionEnd:R}),n=u(h);a(n.ref,o.onChange);let L=(()=>{let t={};return e==="email"?t.autoComplete="email":e==="tel"||e==="phone"?t.autoComplete="tel":e==="password"?t.autoComplete="current-password":(o.name==="name"||o.name==="username")&&(t.autoComplete="name"),e==="password"||e==="email"||e==="tel"?t.spellCheck=!1:t.spellCheck=e==="text"||e==="search"||!e,e==="tel"?t.inputMode="tel":e==="email"?t.inputMode="email":e==="url"?t.inputMode="url":e==="number"&&(t.inputMode="numeric"),t})();return(0,p.jsx)("input",{type:e,className:c(O,{hasError:x,className:C,ring:!0}),ref:n.setRef,...L,...A.props,...o})});S.displayName="Input";export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KDNGDR64.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function pickSiteLabels(messages,locale){return{locale,ui:messages.ui,search:messages.search,shop:messages.shop,blog:messages.blog,productInfo:messages.productInfo,delivery:messages.delivery,paymentMethods:messages.orderStatus.methodTypes,cookieSettings:messages.cookieConsent.settings,curriculum:{contentUnitsCount:messages.account.contentUnitsCount,contentPreviewBadge:messages.account.contentPreviewBadge,contentLocked:messages.account.contentLocked,contentOptional:messages.account.contentOptional,contentLoadError:messages.account.contentLoadError,contentNoUnits:messages.account.contentNoUnits}}}function fillLabel(template,vars){let text=template;for(const[name,value]of Object.entries(vars))text=text.replaceAll(`{${name}}`,value);return text}export{pickSiteLabels,fillLabel};
|
|
2
|
+
//# sourceMappingURL=chunk-KNNN5V3T.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var LOGIN_EVENT="kanorio:login";var LOGOUT_EVENT="kanorio:logout";var FORM_SUBMIT_EVENT="kanorio:form-submit";var UNIT_CHANGE_EVENT="kanorio:unit-change";var PROGRESS_EVENT="kanorio:progress";export{LOGIN_EVENT,LOGOUT_EVENT,FORM_SUBMIT_EVENT,UNIT_CHANGE_EVENT,PROGRESS_EVENT};
|
|
2
|
+
//# sourceMappingURL=chunk-LWKCGUHS.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useKanorioSiteUrl}from"./chunk-MIQK3T3Y.js";import{useEffect,useRef}from"react";function normalizeExclude(exclude){const list=typeof exclude==="string"?exclude.split(","):exclude??[];return list.map(p=>p.trim().replace(/\/+$/,"")).filter(p=>p.startsWith("/"))}function isExcludedPath(path,exclude){return normalizeExclude(exclude).some(prefix=>path===prefix||path.startsWith(`${prefix}/`))}var SESSION_GAP_MS=30*60*1e3;var SESSION_LAST_SEEN_KEY="kanorio-analytics-last";var ATTRIBUTION_PARAMS=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","fbclid","oppref"];var MAX_ATTRIBUTION_VALUE_LENGTH=200;var memoryLastSeenAt=null;function markSessionEntry(now=Date.now()){try{const raw=window.sessionStorage.getItem(SESSION_LAST_SEEN_KEY);const last=raw?Number(raw):NaN;window.sessionStorage.setItem(SESSION_LAST_SEEN_KEY,String(now));return!Number.isFinite(last)||now-last>SESSION_GAP_MS}catch{const isEntry=memoryLastSeenAt===null||now-memoryLastSeenAt>SESSION_GAP_MS;memoryLastSeenAt=now;return isEntry}}function externalReferrer(){if(typeof document==="undefined"||!document.referrer)return void 0;try{const sameHost=new URL(document.referrer).hostname.toLowerCase()===window.location.hostname.toLowerCase();return sameHost?void 0:document.referrer}catch{return void 0}}function readAttribution(search){if(!search)return void 0;try{const params=new URLSearchParams(search);const out={};for(const key of ATTRIBUTION_PARAMS){const value=params.get(key)?.trim();if(value)out[key]=value.slice(0,MAX_ATTRIBUTION_VALUE_LENGTH)}return Object.keys(out).length>0?out:void 0}catch{return void 0}}function reportKanorioPageview(params){const base=params.siteUrl.replace(/\/+$/,"");const cleanPath=params.path.startsWith("/")?params.path:`/${params.path}`;const url=`${base}/api/v1/analytics/pageview`;const payload=JSON.stringify({path:cleanPath,...params.title?{title:params.title}:{},...params.referrer?{referrer:params.referrer}:{},...params.entry!==void 0?{entry:params.entry}:{},...params.utm?{utm:params.utm}:{}});if(!params.fetch&&typeof navigator!=="undefined"&&typeof navigator.sendBeacon==="function"){try{const queued=navigator.sendBeacon(url,new Blob([payload],{type:"text/plain;charset=UTF-8"}));if(queued)return Promise.resolve(true)}catch{}}const fetchImpl=params.fetch??globalThis.fetch;return fetchImpl(url,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:payload,keepalive:true}).then(r=>r.ok).catch(()=>false)}var NAVIGATION_EVENT="kanorio:navigation";var historyPatched=false;function ensureHistoryPatched(){if(historyPatched||typeof window==="undefined"||typeof window.history==="undefined")return;historyPatched=true;for(const method of["pushState","replaceState"]){const original=window.history[method];if(typeof original!=="function")continue;window.history[method]=function patched(...args){const result=original.apply(this,args);window.dispatchEvent(new Event(NAVIGATION_EVENT));return result}}}function KanorioAnalytics({siteUrl:propSiteUrl,path,title,referrer,exclude}){const siteUrl=useKanorioSiteUrl(propSiteUrl);const lastSeenPathRef=useRef(null);const hasReportedRef=useRef(false);const overridesRef=useRef({title,referrer,exclude});overridesRef.current={title,referrer,exclude};useEffect(()=>{if(typeof window==="undefined")return;ensureHistoryPatched();const send=targetPath=>{if(!targetPath||lastSeenPathRef.current===targetPath)return;lastSeenPathRef.current=targetPath;if(isExcludedPath(targetPath,overridesRef.current.exclude))return;const isFirst=!hasReportedRef.current;hasReportedRef.current=true;const entry=markSessionEntry();const{title:titleOverride,referrer:referrerOverride}=overridesRef.current;const fire=()=>void reportKanorioPageview({siteUrl,path:targetPath,title:titleOverride??(typeof document!=="undefined"?document.title:void 0),referrer:referrerOverride??(isFirst&&entry?externalReferrer():void 0),entry,utm:readAttribution(window.location.search)});if(typeof window.requestAnimationFrame==="function")window.requestAnimationFrame(fire);else setTimeout(fire,0)};const onNavigate=()=>send(path??window.location.pathname);onNavigate();window.addEventListener("popstate",onNavigate);window.addEventListener(NAVIGATION_EVENT,onNavigate);return()=>{window.removeEventListener("popstate",onNavigate);window.removeEventListener(NAVIGATION_EVENT,onNavigate)}},[siteUrl,path]);return null}export{isExcludedPath,reportKanorioPageview,KanorioAnalytics};
|
|
2
|
+
//# sourceMappingURL=chunk-LWRWKZBC.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var c=new Map,l=new Map;function o(r,t,e){let n=r.get(t);return n||(n=e(),r.set(t,n)),n}function m(r,t={}){return o(c,`${r}|${JSON.stringify(t)}`,()=>{try{return new Intl.NumberFormat(r,t)}catch{return new Intl.NumberFormat("en",t)}})}function g(r,t){return o(l,`${r}|${JSON.stringify(t)}`,()=>{try{return new Intl.DateTimeFormat(r,t)}catch{return new Intl.DateTimeFormat("en",{...t,timeZone:"UTC"})}})}var f="\u2014";var u=["B","KB","MB","GB","TB"];function I(r,t){if(r==null||!Number.isFinite(r)||r<0)return f;let e=r,n=0;for(;e>=1024&&n<u.length-1;)e/=1024,n+=1;return`${m(t.locale,{maximumFractionDigits:n===0?0:1}).format(e)} ${u[n]}`}function N(r){let t=Math.max(0,Math.floor(r)),e=Math.floor(t/3600),n=Math.floor(t%3600/60),i=t%60,a=s=>String(s).padStart(2,"0");return e>0?`${e}:${a(n)}:${a(i)}`:`${n}:${a(i)}`}export{g as a,f as b,I as c,N as d};
|
|
2
|
+
//# sourceMappingURL=chunk-LXNMHQFN.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function deliverablePlayerLabels(a){return{locked:a.contentLocked,lockedBy:a.contentLockedBy,preview:a.contentPreviewBadge,unlocksAt:a.contentUnlocksAt,open:a.contentOpen,download:a.contentDownload,completed:a.contentCompleted,markComplete:a.contentMarkComplete,optional:a.contentOptional,continueLearning:a.contentContinue,start:a.contentStart,nextUnit:a.contentNextUnit,previousUnit:a.contentPreviousUnit,progress:a.contentProgress,unitsCount:a.contentUnitsCount,loadError:a.contentLoadError,noUnits:a.contentNoUnits,quizSubmit:a.contentQuizSubmit,quizScore:a.contentQuizScore,quizPassed:a.contentQuizPassed,quizFailed:a.contentQuizFailed,quizAttemptsLeft:a.contentQuizAttemptsLeft,quizNoAttempts:a.contentQuizNoAttempts,quizRetry:a.contentQuizRetry,quizPassingScore:a.contentQuizPassingScore,quizNotReady:a.contentQuizNotReady,quizSelectAll:a.contentQuizSelectAll,quizCorrectCount:a.contentQuizCorrectCount,quizPracticeHint:a.contentQuizPracticeHint,quizPracticeAgain:a.contentQuizPracticeAgain,quizAcceptedAnswers:a.contentQuizAcceptedAnswers,quizTextPlaceholder:a.contentQuizTextPlaceholder,quizNumericPlaceholder:a.contentQuizNumericPlaceholder,quizCorrectMark:a.contentQuizCorrectMark,quizWrongMark:a.contentQuizWrongMark,certificateDownload:a.contentCertificateDownload,autoplayNext:a.contentAutoplayNext,completeAndContinue:a.contentCompleteAndContinue,completeToContinue:a.contentCompleteToContinue,outline:a.contentOutline,showOutline:a.contentShowOutline,hideOutline:a.contentHideOutline,closeOutline:a.contentCloseOutline,settings:a.contentSettings,minutes:a.contentMinutes,pages:a.contentPages,unitEmpty:a.contentUnitEmpty,retry:a.contentRetry,lastViewed:a.contentLastViewed,courseCompletedTitle:a.contentCourseCompletedTitle,courseCompletedOn:a.contentCourseCompletedOn,keepBrowsing:a.contentKeepBrowsing,attachments:a.contentAttachments,transcript:a.contentTranscript,transcriptShow:a.contentTranscriptShow,transcriptHide:a.contentTranscriptHide,transcriptSearch:a.contentTranscriptSearch,transcriptMatches:a.contentTranscriptMatches,transcriptNoResults:a.contentTranscriptNoResults,transcriptDownload:a.contentTranscriptDownload,transcriptLanguage:a.contentTranscriptLanguage,transcriptFollow:a.contentTranscriptFollow,transcriptAutoGenerated:a.contentTranscriptAutoGenerated,transcriptAutoTranslated:a.contentTranscriptAutoTranslated,downloadFile:a.contentDownloadFile}}export{deliverablePlayerLabels};
|
|
2
|
+
//# sourceMappingURL=chunk-MC63CLSM.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ELEMENTS_PDFJS_BASE_URL,setPdfjsAssetBase}from"./chunk-CU2JJTXI.js";var SERVER_KEY_HEADER="X-Kanorio-Server-Key";var SERVER_KEY_VISITOR_IP_HEADER="X-Kanorio-Visitor-IP";var SERVER_KEY_PREFIX="knr_sk_";var PROBE_FAKE_SERVER_KEY=`${SERVER_KEY_PREFIX}${"0".repeat(43)}`;function parseIpv4(value){const parts=value.split(".");if(parts.length!==4)return null;const out=[];for(const part of parts){if(!/^\d{1,3}$/.test(part))return null;const n=Number(part);if(n>255)return null;out.push(n)}return out}function parseIpv6(value){if(!value.includes(":")||value.includes("%"))return null;let head=value;let tailV4=null;const lastColon=value.lastIndexOf(":");const maybeV4=value.slice(lastColon+1);if(maybeV4.includes(".")){tailV4=parseIpv4(maybeV4);if(!tailV4)return null;head=`${value.slice(0,lastColon)}:0:0`}const doubleColon=head.indexOf("::");if(doubleColon!==head.lastIndexOf("::"))return null;let groups;if(doubleColon>=0){const left=head.slice(0,doubleColon).split(":").filter(Boolean);const right=head.slice(doubleColon+2).split(":").filter(Boolean);const missing=8-left.length-right.length;if(missing<1)return null;groups=[...left,...Array(missing).fill("0"),...right]}else{groups=head.split(":")}if(groups.length!==8)return null;const bytes=[];for(const group of groups){if(!/^[0-9a-fA-F]{1,4}$/.test(group))return null;const n=parseInt(group,16);bytes.push(n>>8,n&255)}if(tailV4)bytes.splice(12,4,...tailV4);return bytes}function parseIp(raw){const value=raw.trim();if(!value||value.length>45)return null;const v4=parseIpv4(value);if(v4)return{version:4,bytes:v4};const v6=parseIpv6(value);if(!v6)return null;const mapped=v6.slice(0,10).every(b=>b===0)&&v6[10]===255&&v6[11]===255;if(mapped)return{version:4,bytes:v6.slice(12)};return{version:6,bytes:v6}}function inPrefix(bytes,prefix,bits){const full=Math.floor(bits/8);for(let i=0;i<full;i++)if(bytes[i]!==prefix[i])return false;const rest=bits%8;if(rest===0)return true;const mask=255<<8-rest&255;return((bytes[full]??0)&mask)===((prefix[full]??0)&mask)}var NON_PUBLIC_V4=[[[0,0,0,0],8],[[10,0,0,0],8],[[100,64,0,0],10],[[127,0,0,0],8],[[169,254,0,0],16],[[172,16,0,0],12],[[192,0,0,0],24],[[192,0,2,0],24],[[192,168,0,0],16],[[198,18,0,0],15],[[198,51,100,0],24],[[203,0,113,0],24],[[224,0,0,0],3]];var NON_PUBLIC_V6=[[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],127],[[252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],7],[[254,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0],10],[[255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],8],[[32,1,13,184,0,0,0,0,0,0,0,0,0,0,0,0],32]];function isPublicIp(ip){const table=ip.version===4?NON_PUBLIC_V4:NON_PUBLIC_V6;return!table.some(([prefix,bits])=>inPrefix(ip.bytes,prefix,bits))}function formatIp(ip){if(ip.version===4)return ip.bytes.join(".");const groups=[];for(let i=0;i<16;i+=2)groups.push(((ip.bytes[i]??0)<<8|(ip.bytes[i+1]??0)).toString(16));return groups.join(":")}function normalizeVisitorIp(raw){if(!raw)return null;const parsed=parseIp(raw);if(!parsed||!isPublicIp(parsed))return null;return formatIp(parsed)}var LOCAL_HOST_RE=/^(localhost|127\.0\.0\.1|\[::1\])$/i;function isBrowser(){return typeof window!=="undefined"&&typeof document!=="undefined"}async function serverKeyRequest(options,targetUrl){const key=options.serverKey?.trim();if(!key)return null;if(isBrowser()){throw new Error("@kanorio/sdk: `serverKey` must never be used in the browser. Call Kanorio from your server (route handler, server action, middleware) and keep the key in an environment variable.")}const url=new URL(targetUrl);if(url.protocol!=="https:"&&!LOCAL_HOST_RE.test(url.hostname)){throw new Error("@kanorio/sdk: `serverKey` requires an https site URL.")}const headers={[SERVER_KEY_HEADER]:key};const raw=typeof options.visitorIp==="function"?await options.visitorIp():options.visitorIp;const visitorIp=normalizeVisitorIp(raw);if(visitorIp)headers[SERVER_KEY_VISITOR_IP_HEADER]=visitorIp;return{headers,redirect:"error"}}function isEdgeChallenge(response){return response.headers.get("cf-mitigated")==="challenge"}var EDGE_CHALLENGE_CODE="EDGE_CHALLENGE";function edgeChallengeMessage(hasServerKey){if(isBrowser()){return"Kanorio's edge challenged this request. In a browser this usually clears after the visitor passes the check; retry the request."}return hasServerKey?`Kanorio's edge challenged this server-side request even though a server key was sent. Check that the key is a server key (starts with knr_sk_, purpose "Website server") and that it is sent to the site's own hostname.`:'Kanorio\'s edge challenged this server-side request. Server-side writes need a server key: create one under Site settings > Developer (purpose "Website server"), store it as KANORIO_SERVER_KEY, and pass `serverKey` to the client. Do not paste the key into chat or commit it.'}var KANORIO_SDK_VERSION="1.2.0";var SDK_VERSION_HEADER="x-kanorio-sdk-version";function isErrorEnvelope(value){if(typeof value!=="object"||value===null)return false;const error=value.error;if(typeof error!=="object"||error===null)return false;const{code,message}=error;return typeof code==="string"&&typeof message==="string"}var KanorioApiError=class extends Error{constructor(code,status,message,details,retryAfter,availableAt){super(message);this.code=code;this.status=status;this.details=details;this.retryAfter=retryAfter;this.availableAt=availableAt;this.name="KanorioApiError"}};var KanorioEdgeChallengeError=class extends KanorioApiError{constructor(message){super(EDGE_CHALLENGE_CODE,403,message);this.name="KanorioEdgeChallengeError"}};function toApiError(status,body,headers){const retryHeader=headers.get("retry-after");const retryAfter=retryHeader?Number.parseInt(retryHeader,10):void 0;if(isErrorEnvelope(body)){const details=body.error.details;const detailRetry=typeof details?.retryAfter==="number"?details.retryAfter:void 0;const availableAt=typeof details?.availableAt==="string"?details.availableAt:void 0;return new KanorioApiError(body.error.code,status,body.error.message,body.error.details,retryAfter??detailRetry,availableAt)}const code=status===401?"UNAUTHENTICATED":status===404?"NOT_FOUND":status===429?"RATE_LIMITED":status>=500?"UPSTREAM_ERROR":"HTTP_ERROR";const text=typeof body==="string"?body.slice(0,200):"";return new KanorioApiError(code,status,text||`Request failed with HTTP ${status}.`,void 0,retryAfter)}function parseDeprecation(headers,method,path){if(!headers.has("deprecation"))return null;const link=headers.get("link")??"";const rel=name=>{const match=link.match(new RegExp(`<([^>]+)>;\\s*rel="${name}"`));return match?.[1]??null};return{method,path,sunset:headers.get("sunset"),successor:rel("successor-version"),policy:rel("deprecation")}}function buildUrl(baseUrl,path,query){const url=new URL(path.replace(/^\//,""),baseUrl.endsWith("/")?baseUrl:`${baseUrl}/`);if(query){for(const[key,raw]of Object.entries(query)){const values=Array.isArray(raw)?raw:[raw];for(const v of values){if(v===void 0||v===null)continue;url.searchParams.append(key,String(v))}}}return url.toString()}function createHttpClient(options){const fetchImpl=options.fetch??globalThis.fetch;if(!fetchImpl)throw new Error("@kanorio/sdk: global fetch is not available; pass `fetch` in options.");const warned=new Set;const onDeprecation=options.onDeprecation??(notice=>{const key=`${notice.method} ${notice.path}`;if(warned.has(key))return;warned.add(key);console.warn(`[kanorio] ${key} is deprecated${notice.sunset?` (sunset ${notice.sunset})`:""}${notice.successor?`; use ${notice.successor}`:""}.`)});async function raw(method,path,req={}){const headers=new Headers(typeof options.headers==="function"?await options.headers():options.headers);new Headers(req.headers).forEach((v,k)=>headers.set(k,v));headers.set("accept","application/json");if(typeof document==="undefined"){headers.set(SDK_VERSION_HEADER,KANORIO_SDK_VERSION);if(options.userAgent)headers.set("user-agent",options.userAgent)}let body;if(req.body!==void 0){headers.set("content-type","application/json");body=JSON.stringify(req.body)}const url=buildUrl(options.baseUrl,path,req.query);const viaServerKey=await serverKeyRequest(options,url);if(viaServerKey)for(const[name,value]of Object.entries(viaServerKey.headers))headers.set(name,value);const controller=options.timeoutMs?new AbortController:null;const timer=controller?setTimeout(()=>controller.abort(),options.timeoutMs):null;if(controller&&req.signal)req.signal.addEventListener("abort",()=>controller.abort(),{once:true});try{return await fetchImpl(url,{method,headers,body,signal:controller?.signal??req.signal,...viaServerKey?{redirect:viaServerKey.redirect}:{}})}finally{if(timer)clearTimeout(timer)}}async function request(method,path,req={}){const res=await raw(method,path,req);if(isEdgeChallenge(res))throw new KanorioEdgeChallengeError(edgeChallengeMessage(Boolean(options.serverKey)));const notice=parseDeprecation(res.headers,method,path);if(notice)onDeprecation(notice);const text=await res.text();let parsed=text;if(text){try{parsed=JSON.parse(text)}catch{parsed=text}}else{parsed=void 0}if(!res.ok)throw toApiError(res.status,parsed,res.headers);return parsed}return{request,raw}}var SEO_REWRITE_PATHS=[{source:"/sitemap.xml",apiPath:"/seo/sitemap.xml"},{source:"/robots.txt",apiPath:"/seo/robots.txt"},{source:"/llms.txt",apiPath:"/seo/llms.txt"},{source:"/llms-full.txt",apiPath:"/seo/llms-full.txt"},{source:"/feed.xml",apiPath:"/feed"},{source:"/rss.xml",apiPath:"/feed"},{source:"/feed.atom",apiPath:"/feed.atom"}];function seoRewrites(options){const base=deliveryBaseUrl(options.siteUrl);const rules=SEO_REWRITE_PATHS.map(r=>({source:r.source,destination:`${base}${r.apiPath}`}));if(options.framework==="astro"){return Object.fromEntries(rules.map(r=>[r.source,r.destination]))}rules.push({source:"/:key([a-f0-9]{32}).txt",destination:`${base}/seo/indexnow-key.txt`});return rules}function escapeJsonForScript(json){return json.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}async function fetchDeliveryJsonLd(options){const fetchImpl=options.fetch??globalThis.fetch;const rawPath=(options.path??"/").trim();const normalizedPath=rawPath.startsWith("/")?rawPath:`/${rawPath}`;const url=`${deliveryBaseUrl(options.siteUrl)}/seo/jsonld?path=${encodeURIComponent(normalizedPath)}`;const res=await fetchImpl(url);if(!res.ok)return null;const jsonLd=await res.json();return{jsonLd,scriptJson:escapeJsonForScript(JSON.stringify(jsonLd)),cacheTags:parseDeliveryCacheTags(res.headers)}}async function fetchSitemapEntries(options){const fetchImpl=options.fetch??globalThis.fetch;try{const res=await fetchImpl(`${deliveryBaseUrl(options.siteUrl)}/seo/sitemap`);if(!res.ok)return null;const body=await res.json();if(typeof body.siteUrl!=="string"||!Array.isArray(body.urls))return null;return{siteUrl:body.siteUrl,urls:body.urls,cacheTags:parseDeliveryCacheTags(res.headers)}}catch{return null}}function createSeoHelpers(options){function rewrites(opts){return seoRewrites({siteUrl:options.siteUrl,framework:opts.framework})}return{rewrites,jsonLd:(path="/")=>fetchDeliveryJsonLd({siteUrl:options.siteUrl,path,fetch:options.fetch}),sitemapEntries:()=>fetchSitemapEntries({siteUrl:options.siteUrl,fetch:options.fetch})}}function fillPath(template,params){return template.replace(/\{([^}]+)\}/g,(_,name)=>{const value=params?.[name];if(value===void 0||value===null)throw new Error(`@kanorio/sdk: missing path parameter "${name}" for ${template}`);return encodeURIComponent(String(value))})}function createTypedClient(http){const call=method=>(path,req)=>{const r=req??{};const options={query:r.query,body:r.body,headers:r.headers,signal:r.signal};return http.request(method,fillPath(path,r.params),options)};return{get:call("GET"),post:call("POST"),put:call("PUT"),patch:call("PATCH"),delete:call("DELETE"),http}}var DELIVERY_CACHE_TAGS_HEADER="x-kanorio-cache-tags";function unique(tags){const out=[];const seen=new Set;for(const tag of tags){const trimmed=tag.trim();if(!trimmed||seen.has(trimmed))continue;seen.add(trimmed);out.push(trimmed)}return out}function parseCacheTagsHeader(raw){if(!raw)return[];return unique(raw.split(/\s+/))}var DELIVERY_PREVIEW_HEADER="x-kanorio-preview";function deliveryBaseUrl(siteUrl){return`${siteUrl.replace(/\/+$/,"")}/api/v1`}function createDeliveryClient(options){const{siteUrl,previewToken,headers:baseHeaders,...rest}=options;const headers=previewToken===void 0?baseHeaders:async()=>{const merged=new Headers(typeof baseHeaders==="function"?await baseHeaders():baseHeaders);const token=typeof previewToken==="function"?await previewToken():previewToken;if(token)merged.set(DELIVERY_PREVIEW_HEADER,token);return merged};const baseClient=createTypedClient(createHttpClient({...rest,headers,baseUrl:deliveryBaseUrl(siteUrl)}));const seoHelpers=createSeoHelpers({siteUrl,fetch:rest.fetch});return Object.assign(baseClient,{seo:seoHelpers})}var DELIVERY_CACHE_TAGS_HEADER2=DELIVERY_CACHE_TAGS_HEADER;function parseDeliveryCacheTags(headers){if(!headers)return[];const raw=typeof headers.get==="function"?headers.get(DELIVERY_CACHE_TAGS_HEADER2):headers[DELIVERY_CACHE_TAGS_HEADER2]??headers["X-Kanorio-Cache-Tags"];return parseCacheTagsHeader(raw)}function customerBaseUrl(siteUrl){return`${siteUrl.replace(/\/+$/,"")}/api/v1/customer`}async function resolveToken(source){const value=typeof source==="function"?await source():source;return value?value:null}function createCustomerClient(options){const{siteUrl,token,headers,...rest}=options;const http=createHttpClient({...rest,baseUrl:customerBaseUrl(siteUrl),headers:async()=>{const h=new Headers(headers);const value=await resolveToken(token);if(value)h.set("authorization",`Bearer ${value}`);return h}});return createTypedClient(http)}var CUSTOMER_TOKEN_STORAGE_KEY="kanorio.customer.token";function defaultStorage(){try{return typeof localStorage==="undefined"?void 0:localStorage}catch{return void 0}}function writeStoredCustomerToken(token,storage=defaultStorage()){try{if(token)storage?.setItem(CUSTOMER_TOKEN_STORAGE_KEY,token);else storage?.removeItem(CUSTOMER_TOKEN_STORAGE_KEY)}catch{}}function succeed(body){return{...body,ok:true}}function createCustomerContentClient(options){const client=createCustomerClient(options);const anonymous=createHttpClient({...options,baseUrl:`${options.siteUrl.replace(/\/+$/,"")}/api/v1`});const toFail=error=>{if(error instanceof KanorioApiError)return{ok:false,code:error.code,...error.availableAt?{availableAt:error.availableAt}:{}};return{ok:false,code:"NETWORK_ERROR"}};return{async openUnit(unitId,mode,openOptions){try{const token=await resolveToken(options.token);if(!token)return succeed(await anonymous.request("POST",`units/${encodeURIComponent(unitId)}/open`,{body:{mode}}));const body=openOptions?.attachmentId?{mode,attachmentId:openOptions.attachmentId}:{mode};return succeed(await client.post("/units/{id}/open",{params:{id:unitId},query:options.locale?{locale:options.locale}:{},body}))}catch(error){return toFail(error)}},async reportProgress(input){try{return succeed(await client.post("/progress",{body:input}))}catch(error){return toFail(error)}},async submitQuiz(input){try{return succeed(await client.post("/units/{id}/quiz",{params:{id:input.unitId},body:{answers:input.answers}}))}catch(error){return toFail(error)}},async getCertificate(deliverableId){try{return succeed(await client.get("/deliverables/{deliverableId}/certificate",{params:{deliverableId}}))}catch(error){return toFail(error)}},async getTranscript(unitId,locale){try{const wanted=locale??options.locale;return succeed(await client.get("/units/{id}/transcript",{params:{id:unitId},query:wanted?{locale:wanted}:{}}))}catch(error){return toFail(error)}}}}var PKCE_STORAGE_KEY="kanorio.customer.pkce";function toGrant(wire){return{accessToken:wire.access_token,tokenType:wire.token_type,expiresIn:wire.expires_in,expiresAt:wire.expires_at,refreshToken:wire.refresh_token,refreshTokenExpiresIn:wire.refresh_token_expires_in,contactId:wire.contactId}}function base64url(bytes){let binary="";for(const byte of bytes)binary+=String.fromCharCode(byte);return btoa(binary).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function randomString(bytes=32){const buffer=new Uint8Array(bytes);crypto.getRandomValues(buffer);return base64url(buffer)}async function createPkcePair(){const verifier=randomString(32);const digest=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(verifier));return{verifier,challenge:base64url(new Uint8Array(digest)),method:"S256"}}function buildHostedLoginUrl(params){const base=params.siteUrl.replace(/\/+$/,"");const url=new URL(`${base}${params.localeRoot??""}/account/login`);url.searchParams.set("client_id",params.clientId);url.searchParams.set("redirect_uri",params.redirectUri);url.searchParams.set("code_challenge",params.codeChallenge);url.searchParams.set("code_challenge_method","S256");url.searchParams.set("state",params.state);return url.toString()}function currentRedirectUri(){const url=new URL(window.location.href);url.searchParams.delete("code");url.searchParams.delete("state");url.hash="";return url.toString()}async function startHostedCustomerLogin(options){const storage=options.storage??sessionStorage;const redirectUri=options.redirectUri??currentRedirectUri();const pkce=await createPkcePair();const state=randomString(16);storage.setItem(PKCE_STORAGE_KEY,JSON.stringify({verifier:pkce.verifier,state,redirectUri}));const url=buildHostedLoginUrl({siteUrl:options.siteUrl,clientId:options.clientId,redirectUri,codeChallenge:pkce.challenge,state,localeRoot:options.localeRoot});(options.navigate??(target=>window.location.assign(target)))(url)}async function completeHostedCustomerLogin(options){const url=new URL(window.location.href);const code=url.searchParams.get("code");const state=url.searchParams.get("state");if(!code)return null;const storage=options.storage??sessionStorage;const raw=storage.getItem(PKCE_STORAGE_KEY);storage.removeItem(PKCE_STORAGE_KEY);const saved=raw?JSON.parse(raw):null;if(!saved||saved.state!==state)throw new Error("Hosted sign-in state mismatch; start the sign-in again.");if(options.cleanUrl!==false){url.searchParams.delete("code");url.searchParams.delete("state");window.history.replaceState(window.history.state,"",url.toString())}const grant=await exchangeHostedLoginCode({siteUrl:options.siteUrl,clientId:options.clientId,code,codeVerifier:saved.verifier,redirectUri:saved.redirectUri});if(options.storeToken!==false)writeStoredCustomerToken(grant.accessToken);return grant}async function exchangeHostedLoginCode(params){const client=createCustomerClient({siteUrl:params.siteUrl,serverKey:params.serverKey,visitorIp:params.visitorIp});const wire=await client.post("/auth/oauth2/token",{body:{grant_type:"authorization_code",code:params.code,code_verifier:params.codeVerifier,redirect_uri:params.redirectUri,client_id:params.clientId}});return toGrant(wire)}import{createContext,useCallback,useContext,useEffect,useLayoutEffect,useMemo,useState,useSyncExternalStore}from"react";var FALLBACK_LOCALE="en-US";var LOADERS={ar:()=>import("./ar-3VA7IUCO.js"),bg:()=>import("./bg-IRGRVWOG.js"),bn:()=>import("./bn-DM5WNGJ5.js"),cs:()=>import("./cs-3IX2ZQKJ.js"),da:()=>import("./da-AFMLFM32.js"),de:()=>import("./de-5JPEK4HF.js"),el:()=>import("./el-SMBF7FG4.js"),"en-AU":()=>import("./en-AU-LB5UVGIW.js"),"en-CA":()=>import("./en-CA-AZDOY7PW.js"),"en-GB":()=>import("./en-GB-2N4WB6SL.js"),"en-US":()=>import("./en-US-74L4OI3J.js"),en:()=>import("./en-AIAENVLI.js"),"es-419":()=>import("./es-419-Q5IH6W5F.js"),"es-ES":()=>import("./es-ES-ETSYFLPQ.js"),fa:()=>import("./fa-WRJCKGS3.js"),fi:()=>import("./fi-44ST6B6Q.js"),"fr-CA":()=>import("./fr-CA-KXRNFZBP.js"),"fr-FR":()=>import("./fr-FR-MQAFE7IX.js"),gu:()=>import("./gu-RNCZTEOA.js"),he:()=>import("./he-GNC45OCB.js"),hi:()=>import("./hi-DKG5TPYX.js"),hu:()=>import("./hu-3Y5YEIFL.js"),id:()=>import("./id-7DWHYYFC.js"),it:()=>import("./it-7RASZ4SK.js"),ja:()=>import("./ja-4V7QJLTM.js"),km:()=>import("./km-HPCMYWAG.js"),kn:()=>import("./kn-QAWBGLHG.js"),ko:()=>import("./ko-55JV4VQK.js"),lo:()=>import("./lo-JNUKFIQV.js"),ml:()=>import("./ml-3LXSDTNF.js"),mr:()=>import("./mr-PLM72664.js"),ms:()=>import("./ms-N544Y63H.js"),my:()=>import("./my-6IKSM3XW.js"),nb:()=>import("./nb-345ACUTX.js"),ne:()=>import("./ne-ASFNHMO3.js"),"nl-BE":()=>import("./nl-BE-WK4C6XRZ.js"),"nl-NL":()=>import("./nl-NL-2YLHGJZL.js"),nn:()=>import("./nn-I5A2LCBH.js"),pa:()=>import("./pa-VX5TUNDP.js"),pl:()=>import("./pl-4Y4BWTLT.js"),"pt-BR":()=>import("./pt-BR-CW3MRSRP.js"),"pt-PT":()=>import("./pt-PT-ZTPCI2K6.js"),ro:()=>import("./ro-ANISGUFX.js"),ru:()=>import("./ru-PKSZKOLH.js"),si:()=>import("./si-5F7RWQIE.js"),sv:()=>import("./sv-HZVCM7LG.js"),sw:()=>import("./sw-5XU65KFC.js"),ta:()=>import("./ta-R73RBA23.js"),te:()=>import("./te-GVW56XDM.js"),th:()=>import("./th-G6SY3D2Q.js"),tl:()=>import("./tl-PZNXANIM.js"),tr:()=>import("./tr-2BDM6H5Q.js"),uk:()=>import("./uk-OQRACKKD.js"),ur:()=>import("./ur-J5HV4NTW.js"),vi:()=>import("./vi-MQSOSIUY.js"),"zh-CN":()=>import("./zh-CN-RNW2BEY7.js"),"zh-HK":()=>import("./zh-HK-RKREDSAO.js"),"zh-Hant":()=>import("./zh-Hant-T6KHSA5B.js")};var VISITOR_MESSAGE_LOCALES=Object.keys(LOADERS);function resolveVisitorLocale(locale){return locale&&locale in LOADERS?locale:FALLBACK_LOCALE}async function loadVisitorMessages(locale){const mod=await LOADERS[resolveVisitorLocale(locale)]();return mod.default}var ELEMENTS_ROOT_CLASS="kanorio-elements";var ELEMENTS_POPUP_CLASS="kanorio-popup";var ELEMENTS_PART_CLASS="kanorio-part";var BRAND_ATTRIBUTE="data-kanorio-brand";function markScope(element,theme,brandScope){if(theme)element.setAttribute("data-kanorio-theme",theme);else element.removeAttribute("data-kanorio-theme");if(brandScope)element.setAttribute(BRAND_ATTRIBUTE,brandScope);else element.removeAttribute(BRAND_ATTRIBUTE)}var SCOPE_SELECTOR=`:is(.${ELEMENTS_ROOT_CLASS}, .${ELEMENTS_POPUP_CLASS}, .${ELEMENTS_PART_CLASS})`;var HOST_DARK_MARKS=[".dark",'[data-theme="dark"]'];var HOST_DARK_MARK_SELECTOR=HOST_DARK_MARKS.join(", ");var HOST_DARK_DESCENDANT_SELECTOR=HOST_DARK_MARKS.map(mark=>`${mark} *`).join(", ");var DARK_SELECTOR=['[data-kanorio-theme="dark"]','[data-kanorio-theme="dark"] *',`[data-kanorio-theme="auto"]:where(${HOST_DARK_DESCENDANT_SELECTOR})`,`[data-kanorio-theme="auto"]:where(${HOST_DARK_DESCENDANT_SELECTOR}) *`].join(", ");var SYSTEM_DARK_SELECTOR='[data-kanorio-theme="auto"], [data-kanorio-theme="auto"] *';import{jsx}from"react/jsx-runtime";setPdfjsAssetBase(ELEMENTS_PDFJS_BASE_URL);var TOKEN_CHANGE_EVENT="kanorio:token-change";function resolveSiteUrl(siteUrl){const given=siteUrl?.replace(/\/+$/,"");if(given)return given;if(typeof window!=="undefined")return window.location.origin;if(siteUrl)return"";throw new Error("@kanorio/elements: siteUrl is required outside the browser.")}function optionalSiteUrl(siteUrl){const given=siteUrl?.replace(/\/+$/,"");if(given)return given;return typeof window!=="undefined"?window.location.origin:null}function resolveLocale(locale){if(locale)return locale;if(typeof document!=="undefined"&&document.documentElement.lang)return document.documentElement.lang;return"en"}var noSubscription=()=>()=>{};var NO_ENTRY=Object.freeze({value:null,failures:0,round:0});var serverEntry=()=>NO_ENTRY;function createLoadedStore(fetchValue){const entries=new Map;const pending=new Map;const listeners=new Set;let generation=0;const emit=()=>{for(const listener of[...listeners])listener()};return{entry:key=>entries.get(key)??NO_ENTRY,subscribe(listener){listeners.add(listener);return()=>{listeners.delete(listener)}},load(key){const current=entries.get(key);if(current&¤t.value!==null)return Promise.resolve(current.value);const inFlight=pending.get(key);if(inFlight)return inFlight;const started=generation;const request=Promise.resolve().then(()=>fetchValue(key)).catch(()=>null).then(value=>{if(pending.get(key)===request)pending.delete(key);if(started!==generation)return value;const before=entries.get(key)??NO_ENTRY;entries.set(key,value===null?{...before,failures:before.failures+1}:{value,failures:before.failures,round:before.round});emit();return value});pending.set(key,request);return request},clear(){generation+=1;for(const[key,entry]of entries)entries.set(key,{value:null,failures:entry.failures,round:entry.round+1});for(const key of pending.keys())if(!entries.has(key))entries.set(key,{...NO_ENTRY,round:1});pending.clear();emit()},retryFailed(){let changed=false;for(const[key,entry]of entries){if(entry.value!==null||pending.has(key))continue;entries.set(key,{...entry,round:entry.round+1});changed=true}if(changed)emit()},reset(){generation+=1;entries.clear();pending.clear();emit()}}}function useLoaded(store,key){const entry=useSyncExternalStore(key===null?noSubscription:store.subscribe,()=>key===null?NO_ENTRY:store.entry(key),serverEntry);const[since,setSince]=useState(()=>({key,failures:key===null?0:store.entry(key).failures}));let baseline=since;if(since.key!==key){baseline={key,failures:key===null?0:store.entry(key).failures};setSince(baseline)}const wanted=key!==null&&entry.value===null;useEffect(()=>{if(wanted&&key!==null)void store.load(key)},[store,key,wanted,entry.round]);const error=key!==null&&entry.value===null&&entry.failures>baseline.failures;return useMemo(()=>({value:entry.value,error}),[entry.value,error])}var messagesStore=createLoadedStore(locale=>loadVisitorMessages(locale));var siteStore=createLoadedStore(siteUrl=>createDeliveryClient({siteUrl}).get("/site").then(site=>typeof site?.id==="string"?site:null));if(typeof window!=="undefined"){window.addEventListener("online",()=>{messagesStore.retryFailed();siteStore.retryFailed()})}function loadElementsMessages(locale){return messagesStore.load(locale).then(messages=>messages??Promise.reject(new Error(`@kanorio/elements: the visitor text for "${locale}" could not be loaded.`)))}function useElementsMessages(locale,enabled=true){const{value,error}=useLoaded(messagesStore,enabled?locale:null);const[shown,setShown]=useState(null);if(value!==null&&(shown===null||shown.messages!==value||shown.locale!==locale))setShown({messages:value,locale});const messages=value??shown?.messages??null;const shownLocale=value!==null?locale:shown?.locale??locale;return useMemo(()=>({messages,locale:shownLocale,error}),[messages,shownLocale,error])}function loadSiteMeta(siteUrl){return siteStore.load(siteUrl)}function clearSiteMetaCache(){siteStore.clear()}function useSiteMeta(siteUrl,enabled=true){const{value,error}=useLoaded(siteStore,enabled?siteUrl:null);const[shown,setShown]=useState(null);if(value!==null&&(shown===null||shown.site!==value||shown.siteUrl!==siteUrl))setShown({site:value,siteUrl});const site=value??(enabled&&shown?.siteUrl===siteUrl?shown.site:null);return useMemo(()=>({site,error}),[site,error])}function brandFontLocale(locale){const normalized=locale.toLowerCase();if(normalized.startsWith("zh-hans")||normalized.startsWith("zh-cn")||normalized.startsWith("zh-sg"))return"zh-Hans";if(normalized.startsWith("zh"))return"zh-Hant";if(normalized.startsWith("ja"))return"ja";if(normalized.startsWith("ko"))return"ko";return"en"}function brandRules(brand,locale,target){const light=brand.colors.primary.light;const dark=brand.colors.primary.dark;const radius=Object.entries(brand.radius).map(([key,value])=>`--site-radius-${key}: ${value};`).join(" ");const fontLocale=brandFontLocale(locale);const font=brand.fonts.find(entry=>entry.locales.includes(fontLocale))??brand.fonts[0];const fontVar=font?`--site-font-family: ${font.family};`:"";const darkVars=`--brand-color: ${dark.background}; --brand-foreground: ${dark.foreground};`;return[`:where(${target}) { --brand-color: ${light.background}; --brand-foreground: ${light.foreground}; ${radius} ${fontVar} font-family: var(--site-font-family, inherit); }`,`:where(${target}):where(${DARK_SELECTOR}) { ${darkVars} }`,`@media (prefers-color-scheme: dark) { :where(${target}):where(${SYSTEM_DARK_SELECTOR}) { ${darkVars} } }`].join("\n")}function brandCss(brand,locale){return brandRules(brand,locale,SCOPE_SELECTOR)}function brandScopeOf(siteId,locale){return`${siteId}-${brandFontLocale(locale)}`}var useBeforePaintEffect=typeof window==="undefined"?useEffect:useLayoutEffect;var writtenBrands=new Map;function useBrandStyle(site,locale,enabled){const scope=enabled&&site?.brand?brandScopeOf(site.id,locale):null;useBeforePaintEffect(()=>{if(!scope||!site?.brand||typeof document==="undefined")return;const written=writtenBrands.get(scope);if(written&&written.site===site&&written.style.isConnected)return;const id=`kanorio-brand-${scope}`;const css=brandRules(site.brand,locale,`[${BRAND_ATTRIBUTE}="${scope}"]`);let style=document.getElementById(id);if(!style){style=document.createElement("style");style.id=id;document.head.appendChild(style)}if(style.textContent!==css)style.textContent=css;for(const font of site.brand.fonts){if(!font.stylesheetUrl)continue;const selector=`link[data-kanorio-font="${CSS.escape(font.stylesheetUrl)}"]`;if(document.head.querySelector(selector))continue;const link=document.createElement("link");link.rel="stylesheet";link.href=font.stylesheetUrl;link.dataset.kanorioFont=font.stylesheetUrl;document.head.appendChild(link)}writtenBrands.set(scope,{site,style})},[scope,site,locale]);return scope}var tokenListeners=new Set;function emitToken(){for(const listener of[...tokenListeners])listener()}function subscribeToken(listener){tokenListeners.add(listener);if(tokenListeners.size===1){window.addEventListener("storage",emitToken);window.addEventListener(TOKEN_CHANGE_EVENT,emitToken)}return()=>{tokenListeners.delete(listener);if(tokenListeners.size===0){window.removeEventListener("storage",emitToken);window.removeEventListener(TOKEN_CHANGE_EVENT,emitToken)}}}var memoryToken=null;function readToken(){try{return localStorage.getItem(CUSTOMER_TOKEN_STORAGE_KEY)}catch{return memoryToken}}var noToken=()=>null;function writeToken(token){memoryToken=token;try{writeStoredCustomerToken(token)}catch{}if(typeof window!=="undefined")window.dispatchEvent(new CustomEvent(TOKEN_CHANGE_EVENT,{detail:{token}}))}function useExplicitToken(explicit){const[state,setState]=useState({given:explicit,written:null});let written=state.written;if(state.given!==explicit){written=null;setState({given:explicit,written:null})}const setToken=useCallback(token=>{setState(current=>({given:current.given,written:{token}}));writeToken(token)},[]);return useMemo(()=>{if(explicit===void 0)return null;return{token:written?written.token:explicit,setToken}},[explicit,written,setToken])}function useElementToken(own,inherited){const ownSource=useExplicitToken(own);const explicit=ownSource??inherited;const stored=useSyncExternalStore(explicit?noSubscription:subscribeToken,explicit?noToken:readToken,noToken);return useMemo(()=>explicit??{token:stored,setToken:writeToken},[explicit,stored])}var ProviderContext=createContext(null);function KanorioProvider({children,siteUrl,token,locale,theme,timeZone,brand}){const tokenSource=useExplicitToken(token);const config=useMemo(()=>({siteUrl,token,locale,theme,timeZone,brand}),[siteUrl,token,locale,theme,timeZone,brand]);const value=useMemo(()=>({config,token:tokenSource}),[config,tokenSource]);return jsx(ProviderContext.Provider,{value,children})}function useKanorioProviderConfig(){return useContext(ProviderContext)?.config??null}function useKanorioSiteUrl(siteUrl){const parent=useContext(ProviderContext);return resolveSiteUrl(siteUrl??parent?.config.siteUrl)}function useElementContext(overrides,options={}){const parent=useContext(ProviderContext);const config={...parent?.config,...stripUndefined(overrides)};const siteUrl=resolveSiteUrl(config.siteUrl);const theme=config.theme??"auto";const timeZone=config.timeZone??null;const brand=config.brand!==false;const{token,setToken}=useElementToken(overrides.token,parent?.token??null);const text=useElementsMessages(resolveLocale(config.locale));const locale=text.locale;const{site,error:siteError}=useSiteMeta(siteUrl,brand||options.needsSite===true);const brandScope=useBrandStyle(site,locale,brand);const client=useMemo(()=>createCustomerContentClient({siteUrl,token:()=>token,locale}),[siteUrl,token,locale]);const messages=text.messages;const messagesError=text.error;return useMemo(()=>({siteUrl,token,setToken,locale,theme,timeZone,messages,messagesError,client,brandScope,site,siteError}),[siteUrl,token,setToken,locale,theme,timeZone,messages,messagesError,client,brandScope,site,siteError])}function useKanorio(overrides={}){return useElementContext(overrides)}function stripUndefined(obj){return Object.fromEntries(Object.entries(obj).filter(([,v])=>v!==void 0))}export{KanorioApiError,createDeliveryClient,createCustomerClient,startHostedCustomerLogin,completeHostedCustomerLogin,resolveVisitorLocale,ELEMENTS_ROOT_CLASS,ELEMENTS_POPUP_CLASS,ELEMENTS_PART_CLASS,BRAND_ATTRIBUTE,markScope,HOST_DARK_MARK_SELECTOR,TOKEN_CHANGE_EVENT,optionalSiteUrl,resolveLocale,loadElementsMessages,useElementsMessages,loadSiteMeta,clearSiteMetaCache,useSiteMeta,brandCss,useBrandStyle,KanorioProvider,useKanorioProviderConfig,useKanorioSiteUrl,useElementContext,useKanorio};
|
|
2
|
+
//# sourceMappingURL=chunk-MIQK3T3Y.js.map
|