@semiont/cli 0.5.4 → 0.5.5
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 +27 -12
- package/dist/frontend/dist/assets/{CookiePreferences-CMgprW9V.js → CookiePreferences-Vt05bBY7.js} +2 -2
- package/dist/frontend/dist/assets/{CookiePreferences-CMgprW9V.js.map → CookiePreferences-Vt05bBY7.js.map} +1 -1
- package/dist/frontend/dist/assets/{KeyboardShortcutsContext-BRLeqQUj.js → KeyboardShortcutsContext-CK7NFEft.js} +2 -2
- package/dist/frontend/dist/assets/{KeyboardShortcutsContext-BRLeqQUj.js.map → KeyboardShortcutsContext-CK7NFEft.js.map} +1 -1
- package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-CN3C3S55-DsCya3j0.js → PdfAnnotationCanvas.client-CN3C3S55-DZ2osbg-.js} +2 -2
- package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-CN3C3S55-DsCya3j0.js.map → PdfAnnotationCanvas.client-CN3C3S55-DZ2osbg-.js.map} +1 -1
- package/dist/frontend/dist/assets/{ToolbarPanels-CRGQDX-L.js → ToolbarPanels-wzZqAqCQ.js} +2 -2
- package/dist/frontend/dist/assets/{ToolbarPanels-CRGQDX-L.js.map → ToolbarPanels-wzZqAqCQ.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-DvALJ3DL.js → client-C54EWgTc.js} +2 -2
- package/dist/frontend/dist/assets/{client-DvALJ3DL.js.map → client-C54EWgTc.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-uEoQ8iJO.js → client-D5yyxFbt.js} +2 -2
- package/dist/frontend/dist/assets/{client-uEoQ8iJO.js.map → client-D5yyxFbt.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-DkMJxPA7.js → client-DgzjF497.js} +2 -2
- package/dist/frontend/dist/assets/{client-DkMJxPA7.js.map → client-DgzjF497.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-DxlEW_QJ.js → client-myF3ozNf.js} +2 -2
- package/dist/frontend/dist/assets/{client-DxlEW_QJ.js.map → client-myF3ozNf.js.map} +1 -1
- package/dist/frontend/dist/assets/{index-DjtRDlfn.js → index-DojEUBpq.js} +6 -6
- package/dist/frontend/dist/assets/index-DojEUBpq.js.map +1 -0
- package/dist/frontend/dist/assets/{layout-xDEqzpvE.js → layout-CpxxVgZl.js} +2 -2
- package/dist/frontend/dist/assets/{layout-xDEqzpvE.js.map → layout-CpxxVgZl.js.map} +1 -1
- package/dist/frontend/dist/assets/{layout-BhnmJA6O.js → layout-DGddEk2F.js} +2 -2
- package/dist/frontend/dist/assets/{layout-BhnmJA6O.js.map → layout-DGddEk2F.js.map} +1 -1
- package/dist/frontend/dist/assets/{layout-e6QyrD0Y.js → layout-WUjhuEFR.js} +2 -2
- package/dist/frontend/dist/assets/{layout-e6QyrD0Y.js.map → layout-WUjhuEFR.js.map} +1 -1
- package/dist/frontend/dist/assets/{layout-DolG9tOf.js → layout-osn4jTJF.js} +2 -2
- package/dist/frontend/dist/assets/{layout-DolG9tOf.js.map → layout-osn4jTJF.js.map} +1 -1
- package/dist/frontend/dist/assets/{not-found-4iuCkpA7.js → not-found-CXjr3aHk.js} +2 -2
- package/dist/frontend/dist/assets/{not-found-4iuCkpA7.js.map → not-found-CXjr3aHk.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-DVCVvH_S.js → page-3_orURnj.js} +2 -2
- package/dist/frontend/dist/assets/{page-DVCVvH_S.js.map → page-3_orURnj.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CXhfUrZM.js → page-A0bP7R9_.js} +2 -2
- package/dist/frontend/dist/assets/{page-CXhfUrZM.js.map → page-A0bP7R9_.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BrSlkHj9.js → page-BXDwcCLI.js} +2 -2
- package/dist/frontend/dist/assets/{page-BrSlkHj9.js.map → page-BXDwcCLI.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-D0bYoQZI.js → page-CR97hIaP.js} +2 -2
- package/dist/frontend/dist/assets/{page-D0bYoQZI.js.map → page-CR97hIaP.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-C5gTlI4M.js → page-ClOO6d4L.js} +2 -2
- package/dist/frontend/dist/assets/{page-C5gTlI4M.js.map → page-ClOO6d4L.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-8sXDEos5.js → page-CoU19X7P.js} +2 -2
- package/dist/frontend/dist/assets/{page-8sXDEos5.js.map → page-CoU19X7P.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CXVPWK3i.js → page-Crea7MLa.js} +2 -2
- package/dist/frontend/dist/assets/{page-CXVPWK3i.js.map → page-Crea7MLa.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-7cCGgkUd.js → page-D3vt40lt.js} +2 -2
- package/dist/frontend/dist/assets/{page-7cCGgkUd.js.map → page-D3vt40lt.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-6YupxiP8.js → page-D74-p81B.js} +2 -2
- package/dist/frontend/dist/assets/{page-6YupxiP8.js.map → page-D74-p81B.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CkHE2rPM.js → page-D9VjQ4Ci.js} +2 -2
- package/dist/frontend/dist/assets/{page-CkHE2rPM.js.map → page-D9VjQ4Ci.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BioSV21A.js → page-DAaiG0_S.js} +2 -2
- package/dist/frontend/dist/assets/{page-BioSV21A.js.map → page-DAaiG0_S.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BOhOKDMk.js → page-DGGXDS8h.js} +2 -2
- package/dist/frontend/dist/assets/{page-BOhOKDMk.js.map → page-DGGXDS8h.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-A6_MoyUb2.js → page-DWTT4pP82.js} +2 -2
- package/dist/frontend/dist/assets/{page-A6_MoyUb2.js.map → page-DWTT4pP82.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-D1veR3Kp.js → page-Db8QDovL.js} +2 -2
- package/dist/frontend/dist/assets/{page-D1veR3Kp.js.map → page-Db8QDovL.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-DbwiMF1N.js → page-V3GB89Xa.js} +2 -2
- package/dist/frontend/dist/assets/{page-DbwiMF1N.js.map → page-V3GB89Xa.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-Bl8sZu8k.js → page-pid5J2JR.js} +2 -2
- package/dist/frontend/dist/assets/{page-Bl8sZu8k.js.map → page-pid5J2JR.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-D6oe9LkY.js → page-vxSCIznX.js} +2 -2
- package/dist/frontend/dist/assets/{page-D6oe9LkY.js.map → page-vxSCIznX.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-B9EYfbrY.js → page-yaV9evoV.js} +2 -2
- package/dist/frontend/dist/assets/{page-B9EYfbrY.js.map → page-yaV9evoV.js.map} +1 -1
- package/dist/frontend/dist/assets/{routing-DW1ehi64.js → routing-CcetIVef.js} +2 -2
- package/dist/frontend/dist/assets/{routing-DW1ehi64.js.map → routing-CcetIVef.js.map} +1 -1
- package/dist/frontend/dist/assets/{routing-Bcj1FhkC.js → routing-Dqgz2rV4.js} +2 -2
- package/dist/frontend/dist/assets/{routing-Bcj1FhkC.js.map → routing-Dqgz2rV4.js.map} +1 -1
- package/dist/frontend/dist/assets/{web-Dr6mdA1A.js → web-DAgGdiC_.js} +2 -2
- package/dist/frontend/dist/assets/{web-Dr6mdA1A.js.map → web-DAgGdiC_.js.map} +1 -1
- package/dist/frontend/dist/index.html +1 -1
- package/dist/frontend/package.json +1 -1
- package/package.json +8 -8
- package/dist/frontend/dist/assets/index-DjtRDlfn.js.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -16962,7 +16962,13 @@ async function busRequest(bus, emitChannel, payload, resultChannel, failureChann
|
|
|
16962
16962
|
})
|
|
16963
16963
|
);
|
|
16964
16964
|
const resultPromise = (0, import_rxjs.firstValueFrom)(result$);
|
|
16965
|
-
|
|
16965
|
+
try {
|
|
16966
|
+
await bus.emit(emitChannel, fullPayload);
|
|
16967
|
+
} catch (err) {
|
|
16968
|
+
resultPromise.catch(() => {
|
|
16969
|
+
});
|
|
16970
|
+
throw err;
|
|
16971
|
+
}
|
|
16966
16972
|
const result = await resultPromise;
|
|
16967
16973
|
if (!result.ok) {
|
|
16968
16974
|
throw result.error;
|
|
@@ -17580,6 +17586,7 @@ var init_dist = __esm({
|
|
|
17580
17586
|
resetPollTimer(jobId);
|
|
17581
17587
|
}
|
|
17582
17588
|
}).catch((error) => {
|
|
17589
|
+
if (done) return;
|
|
17583
17590
|
cleanup();
|
|
17584
17591
|
subscriber.error(error);
|
|
17585
17592
|
});
|
|
@@ -17633,9 +17640,14 @@ var init_dist = __esm({
|
|
|
17633
17640
|
const jobType = jobTypeMap[motivation];
|
|
17634
17641
|
if (!jobType) throw new Error(`Unsupported motivation: ${motivation}`);
|
|
17635
17642
|
if (motivation === "tagging") {
|
|
17636
|
-
if (!options.schemaId
|
|
17643
|
+
if (!options.schemaId) {
|
|
17644
|
+
throw new Error('mark.assist with motivation "tagging" requires options.schemaId');
|
|
17645
|
+
}
|
|
17646
|
+
if (!options.categories?.length) {
|
|
17647
|
+
throw new Error('mark.assist with motivation "tagging" requires a non-empty options.categories array');
|
|
17648
|
+
}
|
|
17637
17649
|
} else if (motivation === "linking") {
|
|
17638
|
-
if (!options.entityTypes?.length) throw new Error("
|
|
17650
|
+
if (!options.entityTypes?.length) throw new Error('mark.assist with motivation "linking" requires a non-empty entityTypes array');
|
|
17639
17651
|
}
|
|
17640
17652
|
const params = {};
|
|
17641
17653
|
if (options.entityTypes) params.entityTypes = options.entityTypes;
|
|
@@ -17710,6 +17722,7 @@ var init_dist = __esm({
|
|
|
17710
17722
|
resourceId: resourceId22,
|
|
17711
17723
|
options: { contextWindow: options?.contextWindow ?? 2e3 }
|
|
17712
17724
|
}).catch((error) => {
|
|
17725
|
+
if (subscriber.closed) return;
|
|
17713
17726
|
subscriber.error(error);
|
|
17714
17727
|
});
|
|
17715
17728
|
return () => {
|
|
@@ -17755,6 +17768,7 @@ var init_dist = __esm({
|
|
|
17755
17768
|
limit: options?.limit ?? 10,
|
|
17756
17769
|
useSemanticScoring: options?.useSemanticScoring ?? true
|
|
17757
17770
|
}).catch((error) => {
|
|
17771
|
+
if (subscriber.closed) return;
|
|
17758
17772
|
subscriber.error(error);
|
|
17759
17773
|
});
|
|
17760
17774
|
return () => {
|
|
@@ -17927,6 +17941,7 @@ var init_dist = __esm({
|
|
|
17927
17941
|
resetPollTimer(jobId);
|
|
17928
17942
|
}
|
|
17929
17943
|
}).catch((error) => {
|
|
17944
|
+
if (done) return;
|
|
17930
17945
|
cleanup();
|
|
17931
17946
|
subscriber.error(error);
|
|
17932
17947
|
});
|
|
@@ -33050,7 +33065,7 @@ var require_package = __commonJS({
|
|
|
33050
33065
|
"package.json"(exports, module) {
|
|
33051
33066
|
module.exports = {
|
|
33052
33067
|
name: "@semiont/cli",
|
|
33053
|
-
version: "0.5.
|
|
33068
|
+
version: "0.5.5",
|
|
33054
33069
|
description: "Semiont CLI - Unified environment management tool",
|
|
33055
33070
|
_comment: "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
33056
33071
|
type: "module",
|
|
@@ -33097,13 +33112,13 @@ var require_package = __commonJS({
|
|
|
33097
33112
|
"test:watch:unit": "vitest --watch --config vitest.config.unit.ts"
|
|
33098
33113
|
},
|
|
33099
33114
|
dependencies: {
|
|
33100
|
-
"@semiont/api-client": "0.5.
|
|
33101
|
-
"@semiont/content": "0.5.
|
|
33102
|
-
"@semiont/core": "0.5.
|
|
33103
|
-
"@semiont/event-sourcing": "0.5.
|
|
33104
|
-
"@semiont/graph": "0.5.
|
|
33105
|
-
"@semiont/sdk": "0.5.
|
|
33106
|
-
"@semiont/make-meaning": "0.5.
|
|
33115
|
+
"@semiont/api-client": "0.5.5",
|
|
33116
|
+
"@semiont/content": "0.5.5",
|
|
33117
|
+
"@semiont/core": "0.5.5",
|
|
33118
|
+
"@semiont/event-sourcing": "0.5.5",
|
|
33119
|
+
"@semiont/graph": "0.5.5",
|
|
33120
|
+
"@semiont/sdk": "0.5.5",
|
|
33121
|
+
"@semiont/make-meaning": "0.5.5",
|
|
33107
33122
|
arg: "^5.0.2",
|
|
33108
33123
|
argon2: "^0.44.0",
|
|
33109
33124
|
express: "^5.2.1",
|
|
@@ -38115,7 +38130,7 @@ async function generateGlobalHelp() {
|
|
|
38115
38130
|
}
|
|
38116
38131
|
|
|
38117
38132
|
// src/cli.ts
|
|
38118
|
-
var VERSION = "0.5.
|
|
38133
|
+
var VERSION = "0.5.5";
|
|
38119
38134
|
function printVersion() {
|
|
38120
38135
|
console.log(`Semiont CLI v${VERSION}`);
|
|
38121
38136
|
}
|
package/dist/frontend/dist/assets/{CookiePreferences-CMgprW9V.js → CookiePreferences-Vt05bBY7.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{c as i,i as a,r as o,s,u as c}from"./KeyboardShortcutsContext-BRLeqQUj.js";import{n as l,t as u}from"./XMarkIcon-CddZGiiz.js";var d=e(t());function f({title:e,titleId:t,...n},r){return d.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?d.createElement(`title`,{id:t},e):null,d.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3`}))}var p=d.forwardRef(f);function m({title:e,titleId:t,...n},r){return d.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?d.createElement(`title`,{id:t},e):null,d.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495`}))}var h=d.forwardRef(m);function g({title:e,titleId:t,...n},r){return d.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?d.createElement(`title`,{id:t},e):null,d.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z`}))}var _=d.forwardRef(g),v=r();function y({isOpen:e,onClose:t}){let{t:r}=n(),f=(e,t)=>r(`CookiePreferences.${e}`,t),[m,g]=(0,d.useState)(null),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(!1),C=(0,d.useRef)(t);(0,d.useEffect)(()=>{C.current=t}),(0,d.useEffect)(()=>{e&&g(s()||{necessary:!0,analytics:!1,marketing:!1,preferences:!1,timestamp:new Date().toISOString(),version:`1.0`})},[e]),(0,d.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&C.current()};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e]);let w=async()=>{m&&(b(!0),i(m),b(!1),t())},T=e=>{e===`necessary`||!m||g(t=>t?{...t,[e]:!t[e]}:null)};return!e||!m?null:(0,v.jsxs)(`div`,{className:`fixed inset-0 z-50 overflow-y-auto`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0`,children:[(0,v.jsx)(`div`,{className:`fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75`,onClick:t}),(0,v.jsxs)(`div`,{className:`inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6 relative`,children:[(0,v.jsx)(`button`,{onClick:t,className:`absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 rounded-lg p-1`,"aria-label":`Close`,children:(0,v.jsx)(u,{className:`h-6 w-6`})}),(0,v.jsxs)(`div`,{className:`sm:flex sm:items-start`,children:[(0,v.jsx)(`div`,{className:`mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10`,children:(0,v.jsx)(h,{className:`h-6 w-6 text-blue-600`})}),(0,v.jsxs)(`div`,{className:`mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1 pr-8`,children:[(0,v.jsx)(`h3`,{className:`text-lg leading-6 font-medium text-gray-900`,children:f(`title`)}),(0,v.jsx)(`div`,{className:`mt-2`,children:(0,v.jsx)(`p`,{className:`text-sm text-gray-500`,children:f(`description`)})})]})]}),(0,v.jsx)(`div`,{className:`mt-6`,children:(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{className:`bg-gray-50 rounded-lg p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center`,children:[(0,v.jsx)(_,{className:`h-5 w-5 text-green-500 mr-2`}),(0,v.jsx)(`span`,{className:`text-sm font-medium text-gray-900`,children:f(`currentSettings`)})]}),(0,v.jsxs)(`div`,{className:`mt-2 text-xs text-gray-600`,children:[(0,v.jsx)(`p`,{children:f(`lastUpdated`,{date:new Date(m.timestamp).toLocaleDateString()})}),(0,v.jsx)(`p`,{children:f(`version`,{version:m.version})})]})]}),(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(`h4`,{className:`text-base font-medium text-gray-900`,children:f(`cookieCategories`)}),c.map(e=>(0,v.jsx)(`div`,{className:`border border-gray-200 rounded-lg p-4`,children:(0,v.jsx)(`div`,{className:`flex items-start justify-between`,children:(0,v.jsxs)(`div`,{className:`flex-1`,children:[(0,v.jsxs)(`div`,{className:`flex items-center`,children:[(0,v.jsx)(`input`,{id:`pref-${e.id}`,type:`checkbox`,checked:m[e.id]||!1,onChange:()=>T(e.id),disabled:e.required||y,className:`h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded-sm disabled:opacity-50`}),(0,v.jsxs)(`label`,{htmlFor:`pref-${e.id}`,className:`ml-3 text-sm font-medium text-gray-900 cursor-pointer`,children:[e.name,e.required&&(0,v.jsx)(`span`,{className:`text-xs text-gray-500 ml-1`,children:f(`required`)})]})]}),(0,v.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:e.description}),(0,v.jsxs)(`details`,{className:`mt-2`,children:[(0,v.jsx)(`summary`,{className:`text-xs text-blue-600 cursor-pointer hover:text-blue-800`,children:f(`viewCookies`,{count:e.cookies.length})}),(0,v.jsx)(`div`,{className:`mt-1 text-xs text-gray-500 bg-gray-50 rounded-sm p-2`,children:(0,v.jsx)(`ul`,{className:`list-disc list-inside space-y-1`,children:e.cookies.map(e=>(0,v.jsx)(`li`,{children:e},e))})})]})]})})},e.id))]}),(0,v.jsxs)(`div`,{className:`border-t border-gray-200 pt-6`,children:[(0,v.jsx)(`h4`,{className:`text-base font-medium text-gray-900 mb-4`,children:f(`dataManagement`)}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,v.jsxs)(`button`,{onClick:()=>{let e=a(),t=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`semiont-user-data-${new Date().toISOString().split(`T`)[0]}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},className:`flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-xs text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500`,children:[(0,v.jsx)(p,{className:`h-4 w-4 mr-2`}),f(`exportMyData`)]}),(0,v.jsxs)(`button`,{onClick:()=>S(!0),className:`flex items-center justify-center px-4 py-2 border border-red-300 rounded-md shadow-xs text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500`,children:[(0,v.jsx)(l,{className:`h-4 w-4 mr-2`}),f(`deleteAllData`)]})]}),(0,v.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:f(`dataManagementDescription`)})]})]})}),(0,v.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 justify-center`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>{g(e=>e?{...e,necessary:!0,analytics:!1,marketing:!1,preferences:!1}:null)},disabled:y,className:`px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors`,children:f(`rejectAll`)}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>{g(e=>e?{...e,necessary:!0,analytics:!0,marketing:!0,preferences:!0}:null)},disabled:y,className:`px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors`,children:f(`acceptAll`)})]}),(0,v.jsxs)(`div`,{className:`mt-6 sm:flex sm:flex-row-reverse`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:w,disabled:y,className:`w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:opacity-50`,children:f(y?`saving`:`saveChanges`)}),(0,v.jsx)(`button`,{type:`button`,onClick:t,className:`mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm`,children:f(`cancel`)})]})]})]}),x&&(0,v.jsx)(`div`,{className:`fixed inset-0 z-60 overflow-y-auto`,children:(0,v.jsxs)(`div`,{className:`flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0`,children:[(0,v.jsx)(`div`,{className:`fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75`}),(0,v.jsxs)(`div`,{className:`inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6`,children:[(0,v.jsxs)(`div`,{className:`sm:flex sm:items-start`,children:[(0,v.jsx)(`div`,{className:`mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10`,children:(0,v.jsx)(l,{className:`h-6 w-6 text-red-600`})}),(0,v.jsxs)(`div`,{className:`mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left`,children:[(0,v.jsx)(`h3`,{className:`text-lg leading-6 font-medium text-gray-900`,children:f(`deleteConfirmTitle`)}),(0,v.jsx)(`div`,{className:`mt-2`,children:(0,v.jsx)(`p`,{className:`text-sm text-gray-500`,children:f(`deleteConfirmDescription`)})})]})]}),(0,v.jsxs)(`div`,{className:`mt-5 sm:mt-4 sm:flex sm:flex-row-reverse`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>{o()},className:`w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm`,children:f(`deleteAllData`)}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>S(!1),className:`mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm`,children:f(`cancel`)})]})]})]})})]})}export{_ as n,y as t};
|
|
2
|
-
//# sourceMappingURL=CookiePreferences-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{c as i,i as a,r as o,s,u as c}from"./KeyboardShortcutsContext-CK7NFEft.js";import{n as l,t as u}from"./XMarkIcon-CddZGiiz.js";var d=e(t());function f({title:e,titleId:t,...n},r){return d.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?d.createElement(`title`,{id:t},e):null,d.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3`}))}var p=d.forwardRef(f);function m({title:e,titleId:t,...n},r){return d.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?d.createElement(`title`,{id:t},e):null,d.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495`}))}var h=d.forwardRef(m);function g({title:e,titleId:t,...n},r){return d.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?d.createElement(`title`,{id:t},e):null,d.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z`}))}var _=d.forwardRef(g),v=r();function y({isOpen:e,onClose:t}){let{t:r}=n(),f=(e,t)=>r(`CookiePreferences.${e}`,t),[m,g]=(0,d.useState)(null),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(!1),C=(0,d.useRef)(t);(0,d.useEffect)(()=>{C.current=t}),(0,d.useEffect)(()=>{e&&g(s()||{necessary:!0,analytics:!1,marketing:!1,preferences:!1,timestamp:new Date().toISOString(),version:`1.0`})},[e]),(0,d.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&C.current()};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e]);let w=async()=>{m&&(b(!0),i(m),b(!1),t())},T=e=>{e===`necessary`||!m||g(t=>t?{...t,[e]:!t[e]}:null)};return!e||!m?null:(0,v.jsxs)(`div`,{className:`fixed inset-0 z-50 overflow-y-auto`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0`,children:[(0,v.jsx)(`div`,{className:`fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75`,onClick:t}),(0,v.jsxs)(`div`,{className:`inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6 relative`,children:[(0,v.jsx)(`button`,{onClick:t,className:`absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 rounded-lg p-1`,"aria-label":`Close`,children:(0,v.jsx)(u,{className:`h-6 w-6`})}),(0,v.jsxs)(`div`,{className:`sm:flex sm:items-start`,children:[(0,v.jsx)(`div`,{className:`mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10`,children:(0,v.jsx)(h,{className:`h-6 w-6 text-blue-600`})}),(0,v.jsxs)(`div`,{className:`mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1 pr-8`,children:[(0,v.jsx)(`h3`,{className:`text-lg leading-6 font-medium text-gray-900`,children:f(`title`)}),(0,v.jsx)(`div`,{className:`mt-2`,children:(0,v.jsx)(`p`,{className:`text-sm text-gray-500`,children:f(`description`)})})]})]}),(0,v.jsx)(`div`,{className:`mt-6`,children:(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{className:`bg-gray-50 rounded-lg p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center`,children:[(0,v.jsx)(_,{className:`h-5 w-5 text-green-500 mr-2`}),(0,v.jsx)(`span`,{className:`text-sm font-medium text-gray-900`,children:f(`currentSettings`)})]}),(0,v.jsxs)(`div`,{className:`mt-2 text-xs text-gray-600`,children:[(0,v.jsx)(`p`,{children:f(`lastUpdated`,{date:new Date(m.timestamp).toLocaleDateString()})}),(0,v.jsx)(`p`,{children:f(`version`,{version:m.version})})]})]}),(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(`h4`,{className:`text-base font-medium text-gray-900`,children:f(`cookieCategories`)}),c.map(e=>(0,v.jsx)(`div`,{className:`border border-gray-200 rounded-lg p-4`,children:(0,v.jsx)(`div`,{className:`flex items-start justify-between`,children:(0,v.jsxs)(`div`,{className:`flex-1`,children:[(0,v.jsxs)(`div`,{className:`flex items-center`,children:[(0,v.jsx)(`input`,{id:`pref-${e.id}`,type:`checkbox`,checked:m[e.id]||!1,onChange:()=>T(e.id),disabled:e.required||y,className:`h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded-sm disabled:opacity-50`}),(0,v.jsxs)(`label`,{htmlFor:`pref-${e.id}`,className:`ml-3 text-sm font-medium text-gray-900 cursor-pointer`,children:[e.name,e.required&&(0,v.jsx)(`span`,{className:`text-xs text-gray-500 ml-1`,children:f(`required`)})]})]}),(0,v.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:e.description}),(0,v.jsxs)(`details`,{className:`mt-2`,children:[(0,v.jsx)(`summary`,{className:`text-xs text-blue-600 cursor-pointer hover:text-blue-800`,children:f(`viewCookies`,{count:e.cookies.length})}),(0,v.jsx)(`div`,{className:`mt-1 text-xs text-gray-500 bg-gray-50 rounded-sm p-2`,children:(0,v.jsx)(`ul`,{className:`list-disc list-inside space-y-1`,children:e.cookies.map(e=>(0,v.jsx)(`li`,{children:e},e))})})]})]})})},e.id))]}),(0,v.jsxs)(`div`,{className:`border-t border-gray-200 pt-6`,children:[(0,v.jsx)(`h4`,{className:`text-base font-medium text-gray-900 mb-4`,children:f(`dataManagement`)}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,v.jsxs)(`button`,{onClick:()=>{let e=a(),t=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`semiont-user-data-${new Date().toISOString().split(`T`)[0]}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},className:`flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-xs text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500`,children:[(0,v.jsx)(p,{className:`h-4 w-4 mr-2`}),f(`exportMyData`)]}),(0,v.jsxs)(`button`,{onClick:()=>S(!0),className:`flex items-center justify-center px-4 py-2 border border-red-300 rounded-md shadow-xs text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500`,children:[(0,v.jsx)(l,{className:`h-4 w-4 mr-2`}),f(`deleteAllData`)]})]}),(0,v.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:f(`dataManagementDescription`)})]})]})}),(0,v.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 justify-center`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>{g(e=>e?{...e,necessary:!0,analytics:!1,marketing:!1,preferences:!1}:null)},disabled:y,className:`px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors`,children:f(`rejectAll`)}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>{g(e=>e?{...e,necessary:!0,analytics:!0,marketing:!0,preferences:!0}:null)},disabled:y,className:`px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors`,children:f(`acceptAll`)})]}),(0,v.jsxs)(`div`,{className:`mt-6 sm:flex sm:flex-row-reverse`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:w,disabled:y,className:`w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:opacity-50`,children:f(y?`saving`:`saveChanges`)}),(0,v.jsx)(`button`,{type:`button`,onClick:t,className:`mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm`,children:f(`cancel`)})]})]})]}),x&&(0,v.jsx)(`div`,{className:`fixed inset-0 z-60 overflow-y-auto`,children:(0,v.jsxs)(`div`,{className:`flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0`,children:[(0,v.jsx)(`div`,{className:`fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75`}),(0,v.jsxs)(`div`,{className:`inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6`,children:[(0,v.jsxs)(`div`,{className:`sm:flex sm:items-start`,children:[(0,v.jsx)(`div`,{className:`mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10`,children:(0,v.jsx)(l,{className:`h-6 w-6 text-red-600`})}),(0,v.jsxs)(`div`,{className:`mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left`,children:[(0,v.jsx)(`h3`,{className:`text-lg leading-6 font-medium text-gray-900`,children:f(`deleteConfirmTitle`)}),(0,v.jsx)(`div`,{className:`mt-2`,children:(0,v.jsx)(`p`,{className:`text-sm text-gray-500`,children:f(`deleteConfirmDescription`)})})]})]}),(0,v.jsxs)(`div`,{className:`mt-5 sm:mt-4 sm:flex sm:flex-row-reverse`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>{o()},className:`w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm`,children:f(`deleteAllData`)}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>S(!1),className:`mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm`,children:f(`cancel`)})]})]})]})})]})}export{_ as n,y as t};
|
|
2
|
+
//# sourceMappingURL=CookiePreferences-Vt05bBY7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookiePreferences-CMgprW9V.js","names":["ForwardRef","ForwardRef"],"sources":["../../../../node_modules/@heroicons/react/24/outline/esm/ArrowDownTrayIcon.js","../../../../node_modules/@heroicons/react/24/outline/esm/CogIcon.js","../../../../node_modules/@heroicons/react/24/outline/esm/ShieldCheckIcon.js","../../src/components/CookiePreferences.tsx"],"sourcesContent":["import * as React from \"react\";\nfunction ArrowDownTrayIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ArrowDownTrayIcon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction CogIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(CogIcon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction ShieldCheckIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ShieldCheckIcon);\nexport default ForwardRef;","\"use client\";\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n getCookieConsent,\n setCookieConsent,\n COOKIE_CATEGORIES,\n CookieConsent,\n exportUserData,\n deleteAllUserData,\n type CookieCategory\n} from '@/lib/cookies';\nimport {\n CogIcon,\n TrashIcon,\n ArrowDownTrayIcon,\n ShieldCheckIcon,\n XMarkIcon\n} from '@heroicons/react/24/outline';\n\ninterface CookiePreferencesProps {\n isOpen: boolean;\n onClose: () => void;\n}\n\nexport function CookiePreferences({ isOpen, onClose }: CookiePreferencesProps) {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`CookiePreferences.${k}`, p as any) as string;\n const [consent, setConsent] = useState<CookieConsent | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n\n // Store callback in ref to avoid including in dependency arrays\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onCloseRef.current = onClose;\n });\n\n useEffect(() => {\n if (isOpen) {\n const currentConsent = getCookieConsent();\n setConsent(currentConsent || {\n necessary: true,\n analytics: false,\n marketing: false,\n preferences: false,\n timestamp: new Date().toISOString(),\n version: '1.0'\n });\n }\n }, [isOpen]);\n\n // Handle ESC key to close modal\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onCloseRef.current();\n }\n };\n\n document.addEventListener('keydown', handleEsc);\n return () => {\n document.removeEventListener('keydown', handleEsc);\n };\n }, [isOpen]);\n\n const handleSave = async () => {\n if (!consent) return;\n \n setIsLoading(true);\n setCookieConsent(consent);\n setIsLoading(false);\n onClose();\n };\n\n const handleCategoryToggle = (categoryId: keyof Omit<CookieConsent, 'timestamp' | 'version'>) => {\n if (categoryId === 'necessary' || !consent) return;\n \n setConsent(prev => prev ? {\n ...prev,\n [categoryId]: !prev[categoryId]\n } : null);\n };\n\n const handleExportData = () => {\n const data = exportUserData();\n const blob = new Blob([JSON.stringify(data, null, 2)], { \n type: 'application/json' \n });\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = `semiont-user-data-${new Date().toISOString().split('T')[0]}.json`;\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n URL.revokeObjectURL(url);\n };\n\n const handleDeleteAllData = () => {\n deleteAllUserData();\n };\n\n if (!isOpen || !consent) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 overflow-y-auto\">\n <div className=\"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\">\n {/* Background overlay */}\n <div \n className=\"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75\"\n onClick={onClose}\n />\n\n {/* Modal panel */}\n <div className=\"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6 relative\">\n {/* Close button in upper right */}\n <button\n onClick={onClose}\n className=\"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 rounded-lg p-1\"\n aria-label=\"Close\"\n >\n <XMarkIcon className=\"h-6 w-6\" />\n </button>\n\n <div className=\"sm:flex sm:items-start\">\n <div className=\"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10\">\n <CogIcon className=\"h-6 w-6 text-blue-600\" />\n </div>\n <div className=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1 pr-8\">\n <h3 className=\"text-lg leading-6 font-medium text-gray-900\">\n {t('title')}\n </h3>\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-500\">\n {t('description')}\n </p>\n </div>\n </div>\n </div>\n\n <div className=\"mt-6\">\n <div className=\"space-y-6\">\n {/* Current consent info */}\n <div className=\"bg-gray-50 rounded-lg p-4\">\n <div className=\"flex items-center\">\n <ShieldCheckIcon className=\"h-5 w-5 text-green-500 mr-2\" />\n <span className=\"text-sm font-medium text-gray-900\">\n {t('currentSettings')}\n </span>\n </div>\n <div className=\"mt-2 text-xs text-gray-600\">\n <p>{t('lastUpdated', { date: new Date(consent.timestamp).toLocaleDateString() })}</p>\n <p>{t('version', { version: consent.version })}</p>\n </div>\n </div>\n\n {/* Cookie categories */}\n <div className=\"space-y-4\">\n <h4 className=\"text-base font-medium text-gray-900\">\n {t('cookieCategories')}\n </h4>\n \n {COOKIE_CATEGORIES.map((category: CookieCategory) => (\n <div key={category.id} className=\"border border-gray-200 rounded-lg p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1\">\n <div className=\"flex items-center\">\n <input\n id={`pref-${category.id}`}\n type=\"checkbox\"\n checked={consent[category.id] || false}\n onChange={() => handleCategoryToggle(category.id)}\n disabled={category.required || isLoading}\n className=\"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded-sm disabled:opacity-50\"\n />\n <label\n htmlFor={`pref-${category.id}`}\n className=\"ml-3 text-sm font-medium text-gray-900 cursor-pointer\"\n >\n {category.name}\n {category.required && (\n <span className=\"text-xs text-gray-500 ml-1\">{t('required')}</span>\n )}\n </label>\n </div>\n <p className=\"mt-1 text-sm text-gray-600\">\n {category.description}\n </p>\n <details className=\"mt-2\">\n <summary className=\"text-xs text-blue-600 cursor-pointer hover:text-blue-800\">\n {t('viewCookies', { count: category.cookies.length })}\n </summary>\n <div className=\"mt-1 text-xs text-gray-500 bg-gray-50 rounded-sm p-2\">\n <ul className=\"list-disc list-inside space-y-1\">\n {category.cookies.map(cookie => (\n <li key={cookie}>{cookie}</li>\n ))}\n </ul>\n </div>\n </details>\n </div>\n </div>\n </div>\n ))}\n </div>\n\n {/* Data management section */}\n <div className=\"border-t border-gray-200 pt-6\">\n <h4 className=\"text-base font-medium text-gray-900 mb-4\">\n {t('dataManagement')}\n </h4>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <button\n onClick={handleExportData}\n className=\"flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-xs text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500\"\n >\n <ArrowDownTrayIcon className=\"h-4 w-4 mr-2\" />\n {t('exportMyData')}\n </button>\n\n <button\n onClick={() => setShowDeleteConfirm(true)}\n className=\"flex items-center justify-center px-4 py-2 border border-red-300 rounded-md shadow-xs text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500\"\n >\n <TrashIcon className=\"h-4 w-4 mr-2\" />\n {t('deleteAllData')}\n </button>\n </div>\n\n <p className=\"mt-2 text-xs text-gray-500\">\n {t('dataManagementDescription')}\n </p>\n </div>\n </div>\n </div>\n\n {/* Quick Actions */}\n <div className=\"mt-6 flex flex-wrap gap-2 justify-center\">\n <button\n type=\"button\"\n onClick={() => {\n setConsent(prev => prev ? {\n ...prev,\n necessary: true,\n analytics: false,\n marketing: false,\n preferences: false\n } : null);\n }}\n disabled={isLoading}\n className=\"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors\"\n >\n {t('rejectAll')}\n </button>\n <button\n type=\"button\"\n onClick={() => {\n setConsent(prev => prev ? {\n ...prev,\n necessary: true,\n analytics: true,\n marketing: true,\n preferences: true\n } : null);\n }}\n disabled={isLoading}\n className=\"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors\"\n >\n {t('acceptAll')}\n </button>\n </div>\n\n {/* Action buttons */}\n <div className=\"mt-6 sm:flex sm:flex-row-reverse\">\n <button\n type=\"button\"\n onClick={handleSave}\n disabled={isLoading}\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:opacity-50\"\n >\n {isLoading ? t('saving') : t('saveChanges')}\n </button>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm\"\n >\n {t('cancel')}\n </button>\n </div>\n </div>\n </div>\n\n {/* Delete confirmation modal */}\n {showDeleteConfirm && (\n <div className=\"fixed inset-0 z-60 overflow-y-auto\">\n <div className=\"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\">\n <div className=\"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75\" />\n <div className=\"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6\">\n <div className=\"sm:flex sm:items-start\">\n <div className=\"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10\">\n <TrashIcon className=\"h-6 w-6 text-red-600\" />\n </div>\n <div className=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left\">\n <h3 className=\"text-lg leading-6 font-medium text-gray-900\">\n {t('deleteConfirmTitle')}\n </h3>\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-500\">\n {t('deleteConfirmDescription')}\n </p>\n </div>\n </div>\n </div>\n <div className=\"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse\">\n <button\n type=\"button\"\n onClick={handleDeleteAllData}\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm\"\n >\n {t('deleteAllData')}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowDeleteConfirm(false)}\n className=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm\"\n >\n {t('cancel')}\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport default CookiePreferences;"],"x_google_ignoreList":[0,1,2],"mappings":"uRACA,SAAS,EAAkB,CACzB,QACA,UACA,GAAG,GACF,EAAQ,CACT,OAAoB,EAAM,cAAc,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAK,EACL,kBAAmB,EACpB,CAAE,EAAM,CAAE,EAAqB,EAAM,cAAc,QAAS,CAC3D,GAAI,EACL,CAAE,EAAM,CAAG,KAAmB,EAAM,cAAc,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,+GACJ,CAAC,CAAC,CAEL,IAAMA,EAA2B,EAAM,WAAW,EAAkB,CCvBpE,SAAS,EAAQ,CACf,QACA,UACA,GAAG,GACF,EAAQ,CACT,OAAoB,EAAM,cAAc,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAK,EACL,kBAAmB,EACpB,CAAE,EAAM,CAAE,EAAqB,EAAM,cAAc,QAAS,CAC3D,GAAI,EACL,CAAE,EAAM,CAAG,KAAmB,EAAM,cAAc,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,ocACJ,CAAC,CAAC,CAEL,IAAMC,EAA2B,EAAM,WAAW,EAAQ,CCvB1D,SAAS,EAAgB,CACvB,QACA,UACA,GAAG,GACF,EAAQ,CACT,OAAoB,EAAM,cAAc,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAK,EACL,kBAAmB,EACpB,CAAE,EAAM,CAAE,EAAqB,EAAM,cAAc,QAAS,CAC3D,GAAI,EAC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Z,CAAA,EACT,EAAA,EAAA,KAAC,SAAD,CACE,KAAK,SACL,YAAe,EAAqB,GAAM,CAC1C,UAAU,+QAET,EAAE,SAAS,CACL,CAAA,CACL,GACF,GACF,GACF,CAAA,CAEJ"}
|
|
1
|
+
{"version":3,"file":"CookiePreferences-Vt05bBY7.js","names":["ForwardRef","ForwardRef"],"sources":["../../../../node_modules/@heroicons/react/24/outline/esm/ArrowDownTrayIcon.js","../../../../node_modules/@heroicons/react/24/outline/esm/CogIcon.js","../../../../node_modules/@heroicons/react/24/outline/esm/ShieldCheckIcon.js","../../src/components/CookiePreferences.tsx"],"sourcesContent":["import * as React from \"react\";\nfunction ArrowDownTrayIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ArrowDownTrayIcon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction CogIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(CogIcon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction ShieldCheckIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ShieldCheckIcon);\nexport default ForwardRef;","\"use client\";\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n getCookieConsent,\n setCookieConsent,\n COOKIE_CATEGORIES,\n CookieConsent,\n exportUserData,\n deleteAllUserData,\n type CookieCategory\n} from '@/lib/cookies';\nimport {\n CogIcon,\n TrashIcon,\n ArrowDownTrayIcon,\n ShieldCheckIcon,\n XMarkIcon\n} from '@heroicons/react/24/outline';\n\ninterface CookiePreferencesProps {\n isOpen: boolean;\n onClose: () => void;\n}\n\nexport function CookiePreferences({ isOpen, onClose }: CookiePreferencesProps) {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`CookiePreferences.${k}`, p as any) as string;\n const [consent, setConsent] = useState<CookieConsent | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n\n // Store callback in ref to avoid including in dependency arrays\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onCloseRef.current = onClose;\n });\n\n useEffect(() => {\n if (isOpen) {\n const currentConsent = getCookieConsent();\n setConsent(currentConsent || {\n necessary: true,\n analytics: false,\n marketing: false,\n preferences: false,\n timestamp: new Date().toISOString(),\n version: '1.0'\n });\n }\n }, [isOpen]);\n\n // Handle ESC key to close modal\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onCloseRef.current();\n }\n };\n\n document.addEventListener('keydown', handleEsc);\n return () => {\n document.removeEventListener('keydown', handleEsc);\n };\n }, [isOpen]);\n\n const handleSave = async () => {\n if (!consent) return;\n \n setIsLoading(true);\n setCookieConsent(consent);\n setIsLoading(false);\n onClose();\n };\n\n const handleCategoryToggle = (categoryId: keyof Omit<CookieConsent, 'timestamp' | 'version'>) => {\n if (categoryId === 'necessary' || !consent) return;\n \n setConsent(prev => prev ? {\n ...prev,\n [categoryId]: !prev[categoryId]\n } : null);\n };\n\n const handleExportData = () => {\n const data = exportUserData();\n const blob = new Blob([JSON.stringify(data, null, 2)], { \n type: 'application/json' \n });\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = `semiont-user-data-${new Date().toISOString().split('T')[0]}.json`;\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n URL.revokeObjectURL(url);\n };\n\n const handleDeleteAllData = () => {\n deleteAllUserData();\n };\n\n if (!isOpen || !consent) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 overflow-y-auto\">\n <div className=\"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\">\n {/* Background overlay */}\n <div \n className=\"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75\"\n onClick={onClose}\n />\n\n {/* Modal panel */}\n <div className=\"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6 relative\">\n {/* Close button in upper right */}\n <button\n onClick={onClose}\n className=\"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 rounded-lg p-1\"\n aria-label=\"Close\"\n >\n <XMarkIcon className=\"h-6 w-6\" />\n </button>\n\n <div className=\"sm:flex sm:items-start\">\n <div className=\"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10\">\n <CogIcon className=\"h-6 w-6 text-blue-600\" />\n </div>\n <div className=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1 pr-8\">\n <h3 className=\"text-lg leading-6 font-medium text-gray-900\">\n {t('title')}\n </h3>\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-500\">\n {t('description')}\n </p>\n </div>\n </div>\n </div>\n\n <div className=\"mt-6\">\n <div className=\"space-y-6\">\n {/* Current consent info */}\n <div className=\"bg-gray-50 rounded-lg p-4\">\n <div className=\"flex items-center\">\n <ShieldCheckIcon className=\"h-5 w-5 text-green-500 mr-2\" />\n <span className=\"text-sm font-medium text-gray-900\">\n {t('currentSettings')}\n </span>\n </div>\n <div className=\"mt-2 text-xs text-gray-600\">\n <p>{t('lastUpdated', { date: new Date(consent.timestamp).toLocaleDateString() })}</p>\n <p>{t('version', { version: consent.version })}</p>\n </div>\n </div>\n\n {/* Cookie categories */}\n <div className=\"space-y-4\">\n <h4 className=\"text-base font-medium text-gray-900\">\n {t('cookieCategories')}\n </h4>\n \n {COOKIE_CATEGORIES.map((category: CookieCategory) => (\n <div key={category.id} className=\"border border-gray-200 rounded-lg p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1\">\n <div className=\"flex items-center\">\n <input\n id={`pref-${category.id}`}\n type=\"checkbox\"\n checked={consent[category.id] || false}\n onChange={() => handleCategoryToggle(category.id)}\n disabled={category.required || isLoading}\n className=\"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded-sm disabled:opacity-50\"\n />\n <label\n htmlFor={`pref-${category.id}`}\n className=\"ml-3 text-sm font-medium text-gray-900 cursor-pointer\"\n >\n {category.name}\n {category.required && (\n <span className=\"text-xs text-gray-500 ml-1\">{t('required')}</span>\n )}\n </label>\n </div>\n <p className=\"mt-1 text-sm text-gray-600\">\n {category.description}\n </p>\n <details className=\"mt-2\">\n <summary className=\"text-xs text-blue-600 cursor-pointer hover:text-blue-800\">\n {t('viewCookies', { count: category.cookies.length })}\n </summary>\n <div className=\"mt-1 text-xs text-gray-500 bg-gray-50 rounded-sm p-2\">\n <ul className=\"list-disc list-inside space-y-1\">\n {category.cookies.map(cookie => (\n <li key={cookie}>{cookie}</li>\n ))}\n </ul>\n </div>\n </details>\n </div>\n </div>\n </div>\n ))}\n </div>\n\n {/* Data management section */}\n <div className=\"border-t border-gray-200 pt-6\">\n <h4 className=\"text-base font-medium text-gray-900 mb-4\">\n {t('dataManagement')}\n </h4>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <button\n onClick={handleExportData}\n className=\"flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-xs text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500\"\n >\n <ArrowDownTrayIcon className=\"h-4 w-4 mr-2\" />\n {t('exportMyData')}\n </button>\n\n <button\n onClick={() => setShowDeleteConfirm(true)}\n className=\"flex items-center justify-center px-4 py-2 border border-red-300 rounded-md shadow-xs text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500\"\n >\n <TrashIcon className=\"h-4 w-4 mr-2\" />\n {t('deleteAllData')}\n </button>\n </div>\n\n <p className=\"mt-2 text-xs text-gray-500\">\n {t('dataManagementDescription')}\n </p>\n </div>\n </div>\n </div>\n\n {/* Quick Actions */}\n <div className=\"mt-6 flex flex-wrap gap-2 justify-center\">\n <button\n type=\"button\"\n onClick={() => {\n setConsent(prev => prev ? {\n ...prev,\n necessary: true,\n analytics: false,\n marketing: false,\n preferences: false\n } : null);\n }}\n disabled={isLoading}\n className=\"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors\"\n >\n {t('rejectAll')}\n </button>\n <button\n type=\"button\"\n onClick={() => {\n setConsent(prev => prev ? {\n ...prev,\n necessary: true,\n analytics: true,\n marketing: true,\n preferences: true\n } : null);\n }}\n disabled={isLoading}\n className=\"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors\"\n >\n {t('acceptAll')}\n </button>\n </div>\n\n {/* Action buttons */}\n <div className=\"mt-6 sm:flex sm:flex-row-reverse\">\n <button\n type=\"button\"\n onClick={handleSave}\n disabled={isLoading}\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:opacity-50\"\n >\n {isLoading ? t('saving') : t('saveChanges')}\n </button>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm\"\n >\n {t('cancel')}\n </button>\n </div>\n </div>\n </div>\n\n {/* Delete confirmation modal */}\n {showDeleteConfirm && (\n <div className=\"fixed inset-0 z-60 overflow-y-auto\">\n <div className=\"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\">\n <div className=\"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75\" />\n <div className=\"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6\">\n <div className=\"sm:flex sm:items-start\">\n <div className=\"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10\">\n <TrashIcon className=\"h-6 w-6 text-red-600\" />\n </div>\n <div className=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left\">\n <h3 className=\"text-lg leading-6 font-medium text-gray-900\">\n {t('deleteConfirmTitle')}\n </h3>\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-500\">\n {t('deleteConfirmDescription')}\n </p>\n </div>\n </div>\n </div>\n <div className=\"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse\">\n <button\n type=\"button\"\n onClick={handleDeleteAllData}\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm\"\n >\n {t('deleteAllData')}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowDeleteConfirm(false)}\n className=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm\"\n >\n {t('cancel')}\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport default CookiePreferences;"],"x_google_ignoreList":[0,1,2],"mappings":"uRACA,SAAS,EAAkB,CACzB,QACA,UACA,GAAG,GACF,EAAQ,CACT,OAAoB,EAAM,cAAc,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAK,EACL,kBAAmB,EACpB,CAAE,EAAM,CAAE,EAAqB,EAAM,cAAc,QAAS,CAC3D,GAAI,EACL,CAAE,EAAM,CAAG,KAAmB,EAAM,cAAc,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,+GACJ,CAAC,CAAC,CAEL,IAAMA,EAA2B,EAAM,WAAW,EAAkB,CCvBpE,SAAS,EAAQ,CACf,QACA,UACA,GAAG,GACF,EAAQ,CACT,OAAoB,EAAM,cAAc,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAK,EACL,kBAAmB,EACpB,CAAE,EAAM,CAAE,EAAqB,EAAM,cAAc,QAAS,CAC3D,GAAI,EACL,CAAE,EAAM,CAAG,KAAmB,EAAM,cAAc,OAAQ,CACzD,cA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AA,EAAA,KAAC,KAAD,CAAI,UAAU,uDACX,EAAE,qBAAqB,CACrB,CAAA,EACL,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,iBACb,EAAA,EAAA,KAAC,IAAD,CAAG,UAAU,iCACV,EAAE,2BAA2B,CAC5B,CAAA,CACA,CAAA,CACF,GACF,IACN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,oDAAf,EACE,EAAA,EAAA,KAAC,SAAD,CACE,KAAK,SACL,YA5NkB,CAChC,GAAmB,EA4NL,UAAU,yQAET,EAAE,gBAAgB,CACZ,CAAA,EACT,EAAA,EAAA,KAAC,SAAD,CACE,KAAK,SACL,YAAe,EAAqB,GAAM,CAC1C,UAAU,+QAET,EAAE,SAAS,CACL,CAAA,CACL,GACF,GACF,GACF,CAAA,CAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{C as i,K as a,Y as o,d as s}from"./index-
|
|
2
|
-
//# sourceMappingURL=KeyboardShortcutsContext-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{C as i,K as a,Y as o,d as s}from"./index-DojEUBpq.js";import{i as c}from"./routing-Dqgz2rV4.js";var l=[{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`]}],u=`semiont-cookie-consent`,d={necessary:!0,analytics:!1,marketing:!1,preferences:!1,timestamp:new Date().toISOString(),version:`1.0`},f=e=>{typeof window>`u`||l.forEach(t=>{t.required||e[t.id]||t.cookies.forEach(e=>{if(e.includes(`*`)){let t=e.replace(`*`,``);document.cookie.split(`;`).forEach(e=>{let n=e.split(`=`)[0]?.trim();n&&n.startsWith(t)&&p(n)})}else p(e)})})},p=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}`;let t=window.location.hostname.split(`.`).slice(-2).join(`.`);document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${t}`},m=()=>{if(typeof window>`u`)return null;try{let e=localStorage.getItem(u);if(!e)return null;let t=JSON.parse(e);return t.version===`1.0`?t:null}catch(e){return console.warn(`Failed to parse cookie consent:`,e),null}},h=e=>{if(typeof window>`u`)return;let t={...d,...e,necessary:!0,timestamp:new Date().toISOString(),version:`1.0`};try{localStorage.setItem(u,JSON.stringify(t)),f(t),window.dispatchEvent(new CustomEvent(`cookieConsentChanged`,{detail:t}))}catch(e){console.error(`Failed to save cookie consent:`,e)}},g=()=>{let e=m();if(!e)return!1;let t=new Date(e.timestamp),n=new Date;return n.setMonth(n.getMonth()-13),t>n},_=()=>typeof window>`u`?!1:!g(),v=async()=>{try{let 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`}},y=async()=>await v()===`CA`,b=async()=>await v()===`EU`,x=()=>{if(typeof window>`u`)return{};let e={};document.cookie.split(`;`).forEach(t=>{let[n,r]=t.trim().split(`=`);n&&r&&(e[`cookie_${n}`]=decodeURIComponent(r))});for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&(e[`localStorage_${n}`]=localStorage.getItem(n)||``)}for(let t=0;t<sessionStorage.length;t++){let n=sessionStorage.key(t);n&&(e[`sessionStorage_${n}`]=sessionStorage.getItem(n)||``)}return e},S=()=>{typeof window>`u`||(localStorage.clear(),sessionStorage.clear(),document.cookie.split(`;`).forEach(e=>{let t=e.split(`=`)[0]?.trim();t&&p(t)}),window.location.reload())},C=e(t()),w=r();function T({isOpen:e,onClose:t}){let r=c(),{t:a}=n(),o=(e,t)=>a(`Search.${e}`,t);return(0,w.jsx)(i,{isOpen:e,onClose:t,onNavigate:(e,t)=>{e===`resource`?r.push(`/know/resource/${encodeURIComponent(t)}`):r.push(`/know/entity/${t}`)},translations:{placeholder:o(`placeholder`),searching:o(`searching`),noResults:o(`noResults`),startTyping:o(`startTyping`),navigate:o(`navigate`),select:o(`select`),close:o(`close`),enter:o(`enter`),esc:o(`esc`)}})}var E=(0,C.createContext)(null);function D({children:e}){let t=c(),[n,r]=(0,C.useState)(!1),[i,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)([]),f=(0,C.useCallback)(()=>{r(!0)},[]),p=(0,C.useCallback)(()=>{l(!0)},[]),m=(0,C.useCallback)(()=>{r(!1),l(!1),u.forEach(e=>e()),d([])},[u]);o([{key:`k`,ctrlOrCmd:!0,handler:()=>{f()},description:`Open global search`},{key:`n`,ctrlOrCmd:!0,handler:()=>{t.push(`/know/compose`)},description:`Create new resource`},{key:`/`,handler:()=>{f()},description:`Open global search (alternative)`},{key:`?`,shift:!0,handler:()=>{p()},description:`Show keyboard shortcuts help`}]),a(`Escape`,m,300);let h={openGlobalSearch:f,openKeyboardHelp:p,closeAllOverlays:m};return(0,w.jsxs)(E.Provider,{value:h,children:[e,n&&(0,w.jsx)(T,{isOpen:n,onClose:()=>r(!1)}),i&&(0,w.jsx)(s,{isOpen:i,onClose:()=>l(!1)})]})}export{y as a,h as c,x as i,_ as l,D as n,b as o,S as r,m as s,E as t,l as u};
|
|
2
|
+
//# sourceMappingURL=KeyboardShortcutsContext-CK7NFEft.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardShortcutsContext-BRLeqQUj.js","names":[],"sources":["../../src/lib/cookies/constants.ts","../../src/lib/cookies/cleanup.ts","../../src/lib/cookies/consent.ts","../../src/lib/cookies/privacy.ts","../../src/components/modals/GlobalSearchModal.tsx","../../src/contexts/KeyboardShortcutsContext.tsx"],"sourcesContent":["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","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}"],"mappings":"4OAGA,IAAa,EAAsC,CACjD,CACE,GAAI,YACJ,KAAM,qBACN,YAAa,4JACb,SAAU,GACV,QAAS,CAAC,gBAAiB,sBAAsB,CAClD,CACD,CACE,GAAI,YACJ,KAAM,YACN,YAAa,+HACb,SAAU,GACV,QAAS,CAAC,MAAO,QAAS,OAAQ,OAAQ,eAAe,CAC1D,CACD,CACE,GAAI,YACJ,KAAM,YACN,YAAa,kIACb,SAAU,GACV,QAAS,CAAC,OAAQ,OAAQ,KAAM,QAAQ,CACzC,CACD,CACE,GAAI,cACJ,KAAM,cACN,YAAa,iGACb,SAAU,GACV,QAAS,CAAC,mBAAoB,sBAAuB,cAAc,CACpE,CACF,CAMY,EAAsB,yBAItB,EAAiC,CAC5C,UAAW,GACX,UAAW,GACX,UAAW,GACX,YAAa,GACb,UAAW,IAAI,MAAM,CAAC,aAAa,CACnC,QAAA,MACD,CC7CY,EAAkB,GAAiC,CAC1D,OAAO,OAAW,KAEtB,EAAkB,QAAQ,GAAY,CAChC,EAAS,UAEM,EAAQ,EAAS,KAGlC,EAAS,QAAQ,QAAQ,GAAc,CACrC,GAAI,EAAW,SAAS,IAAI,CAAE,CAE5B,IAAM,EAAS,EAAW,QAAQ,IAAK,GAAG,CAC1C,SAAS,OAAO,MAAM,IAAI,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Eb,GAAkB,EAEpB,YAAa,mCACd,CACD,CACE,IAAK,IACL,MAAO,GACP,YAAe,CAEb,GAAkB,EAEpB,YAAa,+BACd,CACF,CAAC,CAGF,EAAkB,SAAU,EAAkB,IAAI,CAElD,IAAM,EAA6C,CACjD,mBACA,mBACA,mBACD,CAED,OACE,EAAA,EAAA,MAAC,EAAyB,SAA1B,CAAmC,MAAO,WAA1C,CACG,EACA,IACC,EAAA,EAAA,KAAC,EAAD,CACE,OAAQ,EACR,YAAe,EAAgB,GAAM,CACrC,CAAA,CAEH,IACC,EAAA,EAAA,KAAC,EAAD,CACE,OAAQ,EACR,YAAe,EAAc,GAAM,CACnC,CAAA,CAE8B"}
|
|
1
|
+
{"version":3,"file":"KeyboardShortcutsContext-CK7NFEft.js","names":[],"sources":["../../src/lib/cookies/constants.ts","../../src/lib/cookies/cleanup.ts","../../src/lib/cookies/consent.ts","../../src/lib/cookies/privacy.ts","../../src/components/modals/GlobalSearchModal.tsx","../../src/contexts/KeyboardShortcutsContext.tsx"],"sourcesContent":["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","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}"],"mappings":"4OAGA,IAAa,EAAsC,CACjD,CACE,GAAI,YACJ,KAAM,qBACN,YAAa,4JACb,SAAU,GACV,QAAS,CAAC,gBAAiB,sBAAsB,CAClD,CACD,CACE,GAAI,YACJ,KAAM,YACN,YAAa,+HACb,SAAU,GACV,QAAS,CAAC,MAAO,QAAS,OAAQ,OAAQ,eAAe,CAC1D,CACD,CACE,GAAI,YACJ,KAAM,YACN,YAAa,kIACb,SAAU,GACV,QAAS,CAAC,OAAQ,OAAQ,KAAM,QAAQ,CACzC,CACD,CACE,GAAI,cACJ,KAAM,cACN,YAAa,iGACb,SAAU,GACV,QAAS,CAAC,mBAAoB,sBAAuB,cAAc,CACpE,CACF,CAMY,EAAsB,yBAItB,EAAiC,CAC5C,UAAW,GACX,UAAW,GACX,UAAW,GACX,YAAa,GACb,UAAW,IA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B,EAAsB,QAAQ,GAAY,GAAU,CAAC,CAGrD,EAAyB,EAAE,CAAC,EAC3B,CAAC,EAAsB,CAAC,CAG3B,EAAqB,CACnB,CACE,IAAK,IACL,UAAW,GACX,YAAe,CACb,GAAkB,EAEpB,YAAa,qBACd,CACD,CACE,IAAK,IACL,UAAW,GACX,YAAe,CAEb,EAAO,KAAK,gBAAgB,EAE9B,YAAa,sBACd,CACD,CACE,IAAK,IACL,YAAe,CAEb,GAAkB,EAEpB,YAAa,mCACd,CACD,CACE,IAAK,IACL,MAAO,GACP,YAAe,CAEb,GAAkB,EAEpB,YAAa,+BACd,CACF,CAAC,CAGF,EAAkB,SAAU,EAAkB,IAAI,CAElD,IAAM,EAA6C,CACjD,mBACA,mBACA,mBACD,CAED,OACE,EAAA,EAAA,MAAC,EAAyB,SAA1B,CAAmC,MAAO,WAA1C,CACG,EACA,IACC,EAAA,EAAA,KAAC,EAAD,CACE,OAAQ,EACR,YAAe,EAAgB,GAAM,CACrC,CAAA,CAEH,IACC,EAAA,EAAA,KAAC,EAAD,CACE,OAAQ,EACR,YAAe,EAAc,GAAM,CACnC,CAAA,CAE8B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t}from"./i18n-B53Yefbh.js";import{t as n}from"./vendor-0HjOURbh.js";import{kt as r,lt as i}from"./index-
|
|
2
|
-
//# sourceMappingURL=PdfAnnotationCanvas.client-CN3C3S55-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t}from"./i18n-B53Yefbh.js";import{t as n}from"./vendor-0HjOURbh.js";import{kt as r,lt as i}from"./index-DojEUBpq.js";var a=e(t(),1),o=n();function s(e,t,n,r,i=1){let a=Math.min(e.startX,e.endX),o=Math.min(e.startY,e.endY),s=Math.max(e.startX,e.endX),c=Math.max(e.startY,e.endY),l=a/i,u=(s-a)/i,d=r-c/i,f=(c-o)/i;return{page:t,x:Math.round(l),y:Math.round(d),width:Math.round(u),height:Math.round(f)}}function c(e,t,n=1){let r=e.x*n,i=e.width*n;return{x:r,y:(t-e.y-e.height)*n,width:i,height:e.height*n}}function l(e){return`page=${e.page}&viewrect=${e.x},${e.y},${e.width},${e.height}`}function u(e){try{let t=e.match(/page=(\d+)/);if(!t)return null;let n=parseInt(t[1],10),r=e.match(/viewrect=([\d.]+),([\d.]+),([\d.]+),([\d.]+)/);return r?{page:n,x:parseFloat(r[1]),y:parseFloat(r[2]),width:parseFloat(r[3]),height:parseFloat(r[4])}:null}catch{return null}}function d(e){let t=e.match(/page=(\d+)/);return t?parseInt(t[1],10):null}async function f(){return typeof window<`u`&&window.pdfjsLib?window.pdfjsLib:new Promise((e,t)=>{let n=document.createElement(`script`);n.src=`/pdfjs/pdf.min.mjs`,n.type=`module`,n.onload=()=>{let n=window.pdfjsLib;if(!n){t(Error(`PDF.js loaded but pdfjsLib not available`));return}n.GlobalWorkerOptions.workerSrc=`/pdfjs/pdf.worker.min.mjs`,e(n)},n.onerror=()=>{t(Error(`Failed to load PDF.js from /pdfjs/pdf.min.mjs`))},document.head.appendChild(n)})}async function p(e){return(await f()).getDocument({url:e}).promise}async function m(e,t=1){let n=e.getViewport({scale:t}),r=document.createElement(`canvas`),i=r.getContext(`2d`);if(!i)throw Error(`Failed to get 2D context`);return r.width=n.width,r.height=n.height,await e.render({canvasContext:i,viewport:n}).promise,{dataUrl:r.toDataURL(`image/png`),width:n.width,height:n.height}}function h(e){if(!e)return{stroke:`rgb(156, 163, 175)`,fill:`rgba(156, 163, 175, 0.2)`};switch(e){case`highlighting`:return{stroke:`rgb(250, 204, 21)`,fill:`rgba(250, 204, 21, 0.3)`};case`linking`:return{stroke:`rgb(59, 130, 246)`,fill:`rgba(59, 130, 246, 0.2)`};case`assessing`:return{stroke:`rgb(239, 68, 68)`,fill:`rgba(239, 68, 68, 0.2)`};case`commenting`:return{stroke:`rgb(255, 255, 255)`,fill:`rgba(255, 255, 255, 0.2)`};default:return{stroke:`rgb(156, 163, 175)`,fill:`rgba(156, 163, 175, 0.2)`}}}function g({pdfUrl:e,existingAnnotations:t=[],drawingMode:n,selectedMotivation:f,session:g,hoveredAnnotationId:_,selectedAnnotationId:v,hoverDelayMs:y=150}){let[b,x]=(0,a.useState)(null),[S,C]=(0,a.useState)(0),[w,T]=(0,a.useState)(1),[E,D]=(0,a.useState)(null),[O,k]=(0,a.useState)(!0),[A,j]=(0,a.useState)(null),[M,N]=(0,a.useState)(null),[P,F]=(0,a.useState)(null),[I]=(0,a.useState)(1.5),[L,R]=(0,a.useState)(!1),[z,B]=(0,a.useState)(null),V=(0,a.useRef)(null),H=(0,a.useRef)(null);(0,a.useEffect)(()=>{let t=!1;async function n(){try{k(!0),j(null);let n=await p(e);if(t)return;x(n),C(n.numPages),k(!1)}catch(e){if(t)return;console.error(`Error loading PDF:`,e),j(`Failed to load PDF`),k(!1)}}return n(),()=>{t=!0}},[e]),(0,a.useEffect)(()=>{if(!b)return;let e=!1,t=b;async function n(){try{let n=await t.getPage(w);if(e)return;let r=n.getViewport({scale:1});N({width:r.width,height:r.height});let{dataUrl:i}=await m(n,I);if(e)return;D(i)}catch(t){if(e)return;console.error(`Error loading page:`,t),j(`Failed to load page`)}}return n(),()=>{e=!0}},[b,w,I]),(0,a.useEffect)(()=>{let e=()=>{H.current&&F({width:H.current.clientWidth,height:H.current.clientHeight})};e();let t=null;try{t=new ResizeObserver(e),H.current&&t.observe(H.current)}catch{console.warn(`ResizeObserver not supported, falling back to window resize listener`),window.addEventListener(`resize`,e)}return()=>{t?t.disconnect():window.removeEventListener(`resize`,e)}},[E]);let U=(0,a.useCallback)(e=>{if(!n||!H.current)return;let t=H.current.getBoundingClientRect(),r=e.clientX-t.left,i=e.clientY-t.top;R(!0),B({startX:r,startY:i,endX:r,endY:i})},[n]),W=(0,a.useCallback)(e=>{if(!L||!z||!H.current)return;let t=H.current.getBoundingClientRect();B({...z,endX:e.clientX-t.left,endY:e.clientY-t.top})},[L,z]),G=(0,a.useCallback)(()=>{if(!L||!z||!M||!P||!g){R(!1),B(null);return}if(Math.sqrt((z.endX-z.startX)**2+(z.endY-z.startY)**2)<10){if(t.length>0){let e=q.find(e=>{let t=K(e.target);if(!t)return!1;let n=u(t.value);if(!n)return!1;let r=c(n,M.height,1),i=P.width/M.width,a=P.height/M.height,o=r.x*i,s=r.y*a,l=r.width*i,d=r.height*a;return z.endX>=o&&z.endX<=o+l&&z.endY>=s&&z.endY<=s+d});if(e){g?.client.browse.click(e.id,e.motivation),R(!1),B(null);return}}R(!1),B(null);return}let e=M.width/P.width,n=M.height/P.height,r=l(s({startX:z.startX*e,startY:z.startY*n,endX:z.endX*e,endY:z.endY*n},w,M.width,M.height,1));f&&g.client.mark.request({type:`FragmentSelector`,conformsTo:`http://tools.ietf.org/rfc/rfc3778`,value:r},f),R(!1)},[L,z,w,M,P,f,t]),K=e=>{let t=r(e);if(!t)return null;let n=(Array.isArray(t)?t:[t]).find(e=>e.type===`FragmentSelector`);return!n||n.type!==`FragmentSelector`?null:n},q=t.filter(e=>{let t=K(e.target);return t?d(t.value)===w:!1}),{handleMouseEnter:J,handleMouseLeave:Y}=(0,a.useMemo)(()=>i(e=>g?.client.beckon.hover(e),y),[g,y]),{stroke:X,fill:Z}=h(f??null);return A?(0,o.jsx)(`div`,{className:`semiont-pdf-annotation-canvas__error`,children:A}):(0,o.jsxs)(`div`,{className:`semiont-pdf-annotation-canvas`,children:[O&&(0,o.jsx)(`div`,{className:`semiont-pdf-annotation-canvas__loading`,children:`Loading PDF...`}),(0,o.jsxs)(`div`,{ref:V,className:`semiont-pdf-annotation-canvas__container`,style:{display:O?`none`:void 0},onMouseDown:U,onMouseMove:W,onMouseUp:G,onMouseLeave:()=>{L&&(R(!1),B(null))},"data-drawing-mode":n||`none`,children:[E&&(0,o.jsx)(`img`,{ref:H,src:E,alt:`PDF page ${w}`,className:`semiont-pdf-annotation-canvas__image`,draggable:!1,style:{pointerEvents:`none`},onLoad:()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{H.current&&F({width:H.current.clientWidth,height:H.current.clientHeight})})})}}),P&&M&&(0,o.jsx)(`div`,{className:`semiont-pdf-annotation-canvas__overlay-container`,children:(0,o.jsx)(`div`,{className:`semiont-pdf-annotation-canvas__overlay`,children:(0,o.jsxs)(`svg`,{className:`semiont-pdf-annotation-canvas__svg`,width:P.width,height:P.height,children:[q.map(e=>{let t=K(e.target);if(!t)return null;let n=u(t.value);if(!n)return null;let r=c(n,M.height,1),i=P.width/M.width,a=P.height/M.height,s=e.id===_,l=e.id===v,d=e.motivation,{stroke:f,fill:p}=h(d);return(0,o.jsx)(`rect`,{x:r.x*i,y:r.y*a,width:r.width*i,height:r.height*a,stroke:f,strokeWidth:l?4:s?3:2,fill:p,style:{pointerEvents:`auto`,cursor:`pointer`,opacity:l?1:s?.9:.7},onClick:()=>g?.client.browse.click(e.id,e.motivation),onMouseEnter:()=>J(e.id),onMouseLeave:Y},e.id)}),z&&(0,o.jsx)(`rect`,{x:Math.min(z.startX,z.endX),y:Math.min(z.startY,z.endY),width:Math.abs(z.endX-z.startX),height:Math.abs(z.endY-z.startY),stroke:X,strokeWidth:2,strokeDasharray:`5,5`,fill:Z,pointerEvents:`none`})]})})})]}),S>0&&(0,o.jsxs)(`div`,{className:`semiont-pdf-annotation-canvas__controls`,children:[(0,o.jsx)(`button`,{disabled:w<=1,onClick:()=>T(w-1),className:`semiont-pdf-annotation-canvas__button`,children:`Previous`}),(0,o.jsxs)(`span`,{className:`semiont-pdf-annotation-canvas__page-info`,children:[`Page `,w,` of `,S]}),(0,o.jsx)(`button`,{disabled:w>=S,onClick:()=>T(w+1),className:`semiont-pdf-annotation-canvas__button`,children:`Next`})]})]})}export{g as PdfAnnotationCanvas};
|
|
2
|
+
//# sourceMappingURL=PdfAnnotationCanvas.client-CN3C3S55-DZ2osbg-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfAnnotationCanvas.client-CN3C3S55-DsCya3j0.js","names":[],"sources":["../../../../packages/react-ui/dist/PdfAnnotationCanvas.client-CN3C3S55.js"],"sourcesContent":["'use client';\n\"use client\";\nimport \"./chunk-K6BJDL2I.js\";\n\n// src/components/pdf-annotation/PdfAnnotationCanvas.tsx\nimport { useRef, useState, useCallback, useEffect, useMemo } from \"react\";\nimport { getTargetSelector } from \"@semiont/core\";\nimport { createHoverHandlers } from \"@semiont/sdk\";\n\n// src/lib/pdf-coordinates.ts\nfunction canvasToPdfCoordinates(canvasRect, page, _pageWidth, pageHeight, scale = 1) {\n const x1 = Math.min(canvasRect.startX, canvasRect.endX);\n const y1 = Math.min(canvasRect.startY, canvasRect.endY);\n const x2 = Math.max(canvasRect.startX, canvasRect.endX);\n const y2 = Math.max(canvasRect.startY, canvasRect.endY);\n const pdfX = x1 / scale;\n const pdfWidth = (x2 - x1) / scale;\n const pdfY = pageHeight - y2 / scale;\n const pdfHeight = (y2 - y1) / scale;\n return {\n page,\n x: Math.round(pdfX),\n y: Math.round(pdfY),\n width: Math.round(pdfWidth),\n height: Math.round(pdfHeight)\n };\n}\nfunction pdfToCanvasCoordinates(pdfCoord, pageHeight, scale = 1) {\n const canvasX = pdfCoord.x * scale;\n const canvasWidth = pdfCoord.width * scale;\n const canvasY = (pageHeight - pdfCoord.y - pdfCoord.height) * scale;\n const canvasHeight = pdfCoord.height * scale;\n return {\n x: canvasX,\n y: canvasY,\n width: canvasWidth,\n height: canvasHeight\n };\n}\nfunction createFragmentSelector(coord) {\n return `page=${coord.page}&viewrect=${coord.x},${coord.y},${coord.width},${coord.height}`;\n}\nfunction parseFragmentSelector(fragment) {\n try {\n const pageMatch = fragment.match(/page=(\\d+)/);\n if (!pageMatch) return null;\n const page = parseInt(pageMatch[1], 10);\n const viewrectMatch = fragment.match(/viewrect=([\\d.]+),([\\d.]+),([\\d.]+),([\\d.]+)/);\n if (!viewrectMatch) return null;\n return {\n page,\n x: parseFloat(viewrectMatch[1]),\n y: parseFloat(viewrectMatch[2]),\n width: parseFloat(viewrectMatch[3]),\n height: parseFloat(viewrectMatch[4])\n };\n } catch {\n return null;\n }\n}\nfunction getPageFromFragment(fragment) {\n const match = fragment.match(/page=(\\d+)/);\n return match ? parseInt(match[1], 10) : null;\n}\n\n// src/lib/browser-pdfjs.ts\nasync function ensurePdfJs() {\n if (typeof window !== \"undefined\" && window.pdfjsLib) {\n return window.pdfjsLib;\n }\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"/pdfjs/pdf.min.mjs\";\n script.type = \"module\";\n script.onload = () => {\n const pdfjsLib = window.pdfjsLib;\n if (!pdfjsLib) {\n reject(new Error(\"PDF.js loaded but pdfjsLib not available\"));\n return;\n }\n pdfjsLib.GlobalWorkerOptions.workerSrc = \"/pdfjs/pdf.worker.min.mjs\";\n resolve(pdfjsLib);\n };\n script.onerror = () => {\n reject(new Error(\"Failed to load PDF.js from /pdfjs/pdf.min.mjs\"));\n };\n document.head.appendChild(script);\n });\n}\nasync function loadPdfDocument(url) {\n const pdfjsLib = await ensurePdfJs();\n const loadingTask = pdfjsLib.getDocument({ url });\n return loadingTask.promise;\n}\nasync function renderPdfPageToDataUrl(page, scale = 1) {\n const viewport = page.getViewport({ scale });\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n if (!context) {\n throw new Error(\"Failed to get 2D context\");\n }\n canvas.width = viewport.width;\n canvas.height = viewport.height;\n const renderTask = page.render({\n canvasContext: context,\n viewport\n });\n await renderTask.promise;\n return {\n dataUrl: canvas.toDataURL(\"image/png\"),\n width: viewport.width,\n height: viewport.height\n };\n}\n\n// src/components/pdf-annotation/PdfAnnotationCanvas.tsx\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nfunction getMotivationColor(motivation) {\n if (!motivation) {\n return { stroke: \"rgb(156, 163, 175)\", fill: \"rgba(156, 163, 175, 0.2)\" };\n }\n switch (motivation) {\n case \"highlighting\":\n return { stroke: \"rgb(250, 204, 21)\", fill: \"rgba(250, 204, 21, 0.3)\" };\n case \"linking\":\n return { stroke: \"rgb(59, 130, 246)\", fill: \"rgba(59, 130, 246, 0.2)\" };\n case \"assessing\":\n return { stroke: \"rgb(239, 68, 68)\", fill: \"rgba(239, 68, 68, 0.2)\" };\n case \"commenting\":\n return { stroke: \"rgb(255, 255, 255)\", fill: \"rgba(255, 255, 255, 0.2)\" };\n default:\n return { stroke: \"rgb(156, 163, 175)\", fill: \"rgba(156, 163, 175, 0.2)\" };\n }\n}\nfunction PdfAnnotationCanvas({\n pdfUrl,\n existingAnnotations = [],\n drawingMode,\n selectedMotivation,\n session,\n hoveredAnnotationId,\n selectedAnnotationId,\n hoverDelayMs = 150\n}) {\n const [pdfDoc, setPdfDoc] = useState(null);\n const [numPages, setNumPages] = useState(0);\n const [pageNumber, setPageNumber] = useState(1);\n const [pageImageUrl, setPageImageUrl] = useState(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState(null);\n const [pageDimensions, setPageDimensions] = useState(null);\n const [displayDimensions, setDisplayDimensions] = useState(null);\n const [scale] = useState(1.5);\n const [isDrawing, setIsDrawing] = useState(false);\n const [selection, setSelection] = useState(null);\n const containerRef = useRef(null);\n const imageRef = useRef(null);\n useEffect(() => {\n let cancelled = false;\n async function loadPdf() {\n try {\n setIsLoading(true);\n setError(null);\n const doc = await loadPdfDocument(pdfUrl);\n if (cancelled) return;\n setPdfDoc(doc);\n setNumPages(doc.numPages);\n setIsLoading(false);\n } catch (err) {\n if (cancelled) return;\n console.error(\"Error loading PDF:\", err);\n setError(\"Failed to load PDF\");\n setIsLoading(false);\n }\n }\n loadPdf();\n return () => {\n cancelled = true;\n };\n }, [pdfUrl]);\n useEffect(() => {\n if (!pdfDoc) return;\n let cancelled = false;\n const doc = pdfDoc;\n async function loadPage() {\n try {\n const page = await doc.getPage(pageNumber);\n if (cancelled) return;\n const viewport = page.getViewport({ scale: 1 });\n setPageDimensions({\n width: viewport.width,\n height: viewport.height\n });\n const { dataUrl } = await renderPdfPageToDataUrl(page, scale);\n if (cancelled) return;\n setPageImageUrl(dataUrl);\n } catch (err) {\n if (cancelled) return;\n console.error(\"Error loading page:\", err);\n setError(\"Failed to load page\");\n }\n }\n loadPage();\n return () => {\n cancelled = true;\n };\n }, [pdfDoc, pageNumber, scale]);\n useEffect(() => {\n const updateDisplayDimensions = () => {\n if (imageRef.current) {\n setDisplayDimensions({\n width: imageRef.current.clientWidth,\n height: imageRef.current.clientHeight\n });\n }\n };\n updateDisplayDimensions();\n let resizeObserver = null;\n try {\n resizeObserver = new ResizeObserver(updateDisplayDimensions);\n if (imageRef.current) {\n resizeObserver.observe(imageRef.current);\n }\n } catch (error2) {\n console.warn(\"ResizeObserver not supported, falling back to window resize listener\");\n window.addEventListener(\"resize\", updateDisplayDimensions);\n }\n return () => {\n if (resizeObserver) {\n resizeObserver.disconnect();\n } else {\n window.removeEventListener(\"resize\", updateDisplayDimensions);\n }\n };\n }, [pageImageUrl]);\n const handleMouseDown = useCallback((e) => {\n if (!drawingMode) return;\n if (!imageRef.current) return;\n const rect = imageRef.current.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n setIsDrawing(true);\n setSelection({\n startX: x,\n startY: y,\n endX: x,\n endY: y\n });\n }, [drawingMode]);\n const handleMouseMove = useCallback((e) => {\n if (!isDrawing || !selection || !imageRef.current) return;\n const rect = imageRef.current.getBoundingClientRect();\n setSelection({\n ...selection,\n endX: e.clientX - rect.left,\n endY: e.clientY - rect.top\n });\n }, [isDrawing, selection]);\n const handleMouseUp = useCallback(() => {\n if (!isDrawing || !selection || !pageDimensions || !displayDimensions || !session) {\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n const dragDistance = Math.sqrt(\n Math.pow(selection.endX - selection.startX, 2) + Math.pow(selection.endY - selection.startY, 2)\n );\n const MIN_DRAG_DISTANCE = 10;\n if (dragDistance < MIN_DRAG_DISTANCE) {\n if (existingAnnotations.length > 0) {\n const clickedAnnotation = pageAnnotations.find((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return false;\n const pdfCoord2 = parseFragmentSelector(fragmentSel.value);\n if (!pdfCoord2) return false;\n const rect = pdfToCanvasCoordinates(pdfCoord2, pageDimensions.height, 1);\n const scaleX2 = displayDimensions.width / pageDimensions.width;\n const scaleY2 = displayDimensions.height / pageDimensions.height;\n const displayX = rect.x * scaleX2;\n const displayY = rect.y * scaleY2;\n const displayWidth = rect.width * scaleX2;\n const displayHeight = rect.height * scaleY2;\n return selection.endX >= displayX && selection.endX <= displayX + displayWidth && selection.endY >= displayY && selection.endY <= displayY + displayHeight;\n });\n if (clickedAnnotation) {\n session?.client.browse.click(clickedAnnotation.id, clickedAnnotation.motivation);\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n }\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n const scaleX = pageDimensions.width / displayDimensions.width;\n const scaleY = pageDimensions.height / displayDimensions.height;\n const nativeSelection = {\n startX: selection.startX * scaleX,\n startY: selection.startY * scaleY,\n endX: selection.endX * scaleX,\n endY: selection.endY * scaleY\n };\n const pdfCoord = canvasToPdfCoordinates(\n nativeSelection,\n pageNumber,\n pageDimensions.width,\n pageDimensions.height,\n 1\n // Use scale 1.0 since we already scaled to native coords\n );\n const fragmentSelector = createFragmentSelector(pdfCoord);\n if (selectedMotivation) {\n session.client.mark.request(\n {\n type: \"FragmentSelector\",\n conformsTo: \"http://tools.ietf.org/rfc/rfc3778\",\n value: fragmentSelector\n },\n selectedMotivation\n );\n }\n setIsDrawing(false);\n }, [isDrawing, selection, pageNumber, pageDimensions, displayDimensions, selectedMotivation, existingAnnotations]);\n const getFragmentSelector = (target) => {\n const selector = getTargetSelector(target);\n if (!selector) return null;\n const selectors = Array.isArray(selector) ? selector : [selector];\n const found = selectors.find((s) => s.type === \"FragmentSelector\");\n if (!found || found.type !== \"FragmentSelector\") return null;\n return found;\n };\n const pageAnnotations = existingAnnotations.filter((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return false;\n const page = getPageFromFragment(fragmentSel.value);\n return page === pageNumber;\n });\n const { handleMouseEnter, handleMouseLeave } = useMemo(\n () => createHoverHandlers((id) => session?.client.beckon.hover(id), hoverDelayMs),\n [session, hoverDelayMs]\n );\n const { stroke, fill } = getMotivationColor(selectedMotivation ?? null);\n if (error) {\n return /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__error\", children: error });\n }\n return /* @__PURE__ */ jsxs(\"div\", { className: \"semiont-pdf-annotation-canvas\", children: [\n isLoading && /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__loading\", children: \"Loading PDF...\" }),\n /* @__PURE__ */ jsxs(\n \"div\",\n {\n ref: containerRef,\n className: \"semiont-pdf-annotation-canvas__container\",\n style: { display: isLoading ? \"none\" : void 0 },\n onMouseDown: handleMouseDown,\n onMouseMove: handleMouseMove,\n onMouseUp: handleMouseUp,\n onMouseLeave: () => {\n if (isDrawing) {\n setIsDrawing(false);\n setSelection(null);\n }\n },\n \"data-drawing-mode\": drawingMode || \"none\",\n children: [\n pageImageUrl && /* @__PURE__ */ jsx(\n \"img\",\n {\n ref: imageRef,\n src: pageImageUrl,\n alt: `PDF page ${pageNumber}`,\n className: \"semiont-pdf-annotation-canvas__image\",\n draggable: false,\n style: { pointerEvents: \"none\" },\n onLoad: () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (imageRef.current) {\n setDisplayDimensions({\n width: imageRef.current.clientWidth,\n height: imageRef.current.clientHeight\n });\n }\n });\n });\n }\n }\n ),\n displayDimensions && pageDimensions && /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__overlay-container\", children: /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__overlay\", children: /* @__PURE__ */ jsxs(\n \"svg\",\n {\n className: \"semiont-pdf-annotation-canvas__svg\",\n width: displayDimensions.width,\n height: displayDimensions.height,\n children: [\n pageAnnotations.map((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return null;\n const pdfCoord = parseFragmentSelector(fragmentSel.value);\n if (!pdfCoord) return null;\n const rect = pdfToCanvasCoordinates(pdfCoord, pageDimensions.height, 1);\n const scaleX = displayDimensions.width / pageDimensions.width;\n const scaleY = displayDimensions.height / pageDimensions.height;\n const isHovered = ann.id === hoveredAnnotationId;\n const isSelected = ann.id === selectedAnnotationId;\n const annMotivation = ann.motivation;\n const { stroke: annStroke, fill: annFill } = getMotivationColor(annMotivation);\n return /* @__PURE__ */ jsx(\n \"rect\",\n {\n x: rect.x * scaleX,\n y: rect.y * scaleY,\n width: rect.width * scaleX,\n height: rect.height * scaleY,\n stroke: annStroke,\n strokeWidth: isSelected ? 4 : isHovered ? 3 : 2,\n fill: annFill,\n style: {\n pointerEvents: \"auto\",\n cursor: \"pointer\",\n opacity: isSelected ? 1 : isHovered ? 0.9 : 0.7\n },\n onClick: () => session?.client.browse.click(ann.id, ann.motivation),\n onMouseEnter: () => handleMouseEnter(ann.id),\n onMouseLeave: handleMouseLeave\n },\n ann.id\n );\n }),\n selection && (() => {\n const rectX = Math.min(selection.startX, selection.endX);\n const rectY = Math.min(selection.startY, selection.endY);\n const rectWidth = Math.abs(selection.endX - selection.startX);\n const rectHeight = Math.abs(selection.endY - selection.startY);\n return /* @__PURE__ */ jsx(\n \"rect\",\n {\n x: rectX,\n y: rectY,\n width: rectWidth,\n height: rectHeight,\n stroke,\n strokeWidth: 2,\n strokeDasharray: \"5,5\",\n fill,\n pointerEvents: \"none\"\n }\n );\n })()\n ]\n }\n ) }) })\n ]\n }\n ),\n numPages > 0 && /* @__PURE__ */ jsxs(\"div\", { className: \"semiont-pdf-annotation-canvas__controls\", children: [\n /* @__PURE__ */ jsx(\n \"button\",\n {\n disabled: pageNumber <= 1,\n onClick: () => setPageNumber(pageNumber - 1),\n className: \"semiont-pdf-annotation-canvas__button\",\n children: \"Previous\"\n }\n ),\n /* @__PURE__ */ jsxs(\"span\", { className: \"semiont-pdf-annotation-canvas__page-info\", children: [\n \"Page \",\n pageNumber,\n \" of \",\n numPages\n ] }),\n /* @__PURE__ */ jsx(\n \"button\",\n {\n disabled: pageNumber >= numPages,\n onClick: () => setPageNumber(pageNumber + 1),\n className: \"semiont-pdf-annotation-canvas__button\",\n children: \"Next\"\n }\n )\n ] })\n ] });\n}\nexport {\n PdfAnnotationCanvas\n};\n//# sourceMappingURL=PdfAnnotationCanvas.client-CN3C3S55.js.map"],"mappings":"yMAUA,SAAS,EAAuB,EAAY,EAAM,EAAY,EAAY,EAAQ,EAAG,CACnF,IAAM,EAAK,KAAK,IAAI,EAAW,OAAQ,EAAW,KAAK,CACjD,EAAK,KAAK,IAAI,EAAW,OAAQ,EAAW,KAAK,CACjD,EAAK,KAAK,IAAI,EAAW,OAAQ,EAAW,KAAK,CACjD,EAAK,KAAK,IAAI,EAAW,OAAQ,EAAW,KAAK,CACjD,EAAO,EAAK,EACZ,GAAY,EAAK,GAAM,EACvB,EAAO,EAAa,EAAK,EACzB,GAAa,EAAK,GAAM,EAC9B,MAAO,CACL,OACA,EAAG,KAAK,MAAM,EAAK,CACnB,EAAG,KAAK,MAAM,EAAK,CACnB,MAAO,KAAK,MAAM,EAAS,CAC3B,OAAQ,KAAK,MAAM,EAAU,CAC9B,CAEH,SAAS,EAAuB,EAAU,EAAY,EAAQ,EAAG,CAC/D,IAAM,EAAU,EAAS,EAAI,EACvB,EAAc,EAAS,MAAQ,EAGrC,MAAO,CACL,EAAG,EACH,GAJe,EAAa,EAAS,EAAI,EAAS,QAAU,EAK5D,MAAO,EACP,OALmB,EAAS,OAAS,EAMtC,CAEH,SAAS,EAAuB,EAAO,CACrC,MAAO,QAAQ,EAAM,KAAK,YAAY,EAAM,EAAE,GAAG,EAAM,EAAE,GAAG,EAAM,MAAM,GAAG,EAAM,SAEnF,SAAS,EAAsB,EAAU,CACvC,GAAI,CACF,IAAM,EAAY,EAAS,MAAM,aAAa,CAC9C,GAAI,CAAC,EAAW,OAAO,KACvB,I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AnnotationCanvas.client-CN3C3S55-DZ2osbg-.js","names":[],"sources":["../../../../packages/react-ui/dist/PdfAnnotationCanvas.client-CN3C3S55.js"],"sourcesContent":["'use client';\n\"use client\";\nimport \"./chunk-K6BJDL2I.js\";\n\n// src/components/pdf-annotation/PdfAnnotationCanvas.tsx\nimport { useRef, useState, useCallback, useEffect, useMemo } from \"react\";\nimport { getTargetSelector } from \"@semiont/core\";\nimport { createHoverHandlers } from \"@semiont/sdk\";\n\n// src/lib/pdf-coordinates.ts\nfunction canvasToPdfCoordinates(canvasRect, page, _pageWidth, pageHeight, scale = 1) {\n const x1 = Math.min(canvasRect.startX, canvasRect.endX);\n const y1 = Math.min(canvasRect.startY, canvasRect.endY);\n const x2 = Math.max(canvasRect.startX, canvasRect.endX);\n const y2 = Math.max(canvasRect.startY, canvasRect.endY);\n const pdfX = x1 / scale;\n const pdfWidth = (x2 - x1) / scale;\n const pdfY = pageHeight - y2 / scale;\n const pdfHeight = (y2 - y1) / scale;\n return {\n page,\n x: Math.round(pdfX),\n y: Math.round(pdfY),\n width: Math.round(pdfWidth),\n height: Math.round(pdfHeight)\n };\n}\nfunction pdfToCanvasCoordinates(pdfCoord, pageHeight, scale = 1) {\n const canvasX = pdfCoord.x * scale;\n const canvasWidth = pdfCoord.width * scale;\n const canvasY = (pageHeight - pdfCoord.y - pdfCoord.height) * scale;\n const canvasHeight = pdfCoord.height * scale;\n return {\n x: canvasX,\n y: canvasY,\n width: canvasWidth,\n height: canvasHeight\n };\n}\nfunction createFragmentSelector(coord) {\n return `page=${coord.page}&viewrect=${coord.x},${coord.y},${coord.width},${coord.height}`;\n}\nfunction parseFragmentSelector(fragment) {\n try {\n const pageMatch = fragment.match(/page=(\\d+)/);\n if (!pageMatch) return null;\n const page = parseInt(pageMatch[1], 10);\n const viewrectMatch = fragment.match(/viewrect=([\\d.]+),([\\d.]+),([\\d.]+),([\\d.]+)/);\n if (!viewrectMatch) return null;\n return {\n page,\n x: parseFloat(viewrectMatch[1]),\n y: parseFloat(viewrectMatch[2]),\n width: parseFloat(viewrectMatch[3]),\n height: parseFloat(viewrectMatch[4])\n };\n } catch {\n return null;\n }\n}\nfunction getPageFromFragment(fragment) {\n const match = fragment.match(/page=(\\d+)/);\n return match ? parseInt(match[1], 10) : null;\n}\n\n// src/lib/browser-pdfjs.ts\nasync function ensurePdfJs() {\n if (typeof window !== \"undefined\" && window.pdfjsLib) {\n return window.pdfjsLib;\n }\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"/pdfjs/pdf.min.mjs\";\n script.type = \"module\";\n script.onload = () => {\n const pdfjsLib = window.pdfjsLib;\n if (!pdfjsLib) {\n reject(new Error(\"PDF.js loaded but pdfjsLib not available\"));\n return;\n }\n pdfjsLib.GlobalWorkerOptions.workerSrc = \"/pdfjs/pdf.worker.min.mjs\";\n resolve(pdfjsLib);\n };\n script.onerror = () => {\n reject(new Error(\"Failed to load PDF.js from /pdfjs/pdf.min.mjs\"));\n };\n document.head.appendChild(script);\n });\n}\nasync function loadPdfDocument(url) {\n const pdfjsLib = await ensurePdfJs();\n const loadingTask = pdfjsLib.getDocument({ url });\n return loadingTask.promise;\n}\nasync function renderPdfPageToDataUrl(page, scale = 1) {\n const viewport = page.getViewport({ scale });\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n if (!context) {\n throw new Error(\"Failed to get 2D context\");\n }\n canvas.width = viewport.width;\n canvas.height = viewport.height;\n const renderTask = page.render({\n canvasContext: context,\n viewport\n });\n await renderTask.promise;\n return {\n dataUrl: canvas.toDataURL(\"image/png\"),\n width: viewport.width,\n height: viewport.height\n };\n}\n\n// src/components/pdf-annotation/PdfAnnotationCanvas.tsx\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nfunction getMotivationColor(motivation) {\n if (!motivation) {\n return { stroke: \"rgb(156, 163, 175)\", fill: \"rgba(156, 163, 175, 0.2)\" };\n }\n switch (motivation) {\n case \"highlighting\":\n return { stroke: \"rgb(250, 204, 21)\", fill: \"rgba(250, 204, 21, 0.3)\" };\n case \"linking\":\n return { stroke: \"rgb(59, 130, 246)\", fill: \"rgba(59, 130, 246, 0.2)\" };\n case \"assessing\":\n return { stroke: \"rgb(239, 68, 68)\", fill: \"rgba(239, 68, 68, 0.2)\" };\n case \"commenting\":\n return { stroke: \"rgb(255, 255, 255)\", fill: \"rgba(255, 255, 255, 0.2)\" };\n default:\n return { stroke: \"rgb(156, 163, 175)\", fill: \"rgba(156, 163, 175, 0.2)\" };\n }\n}\nfunction PdfAnnotationCanvas({\n pdfUrl,\n existingAnnotations = [],\n drawingMode,\n selectedMotivation,\n session,\n hoveredAnnotationId,\n selectedAnnotationId,\n hoverDelayMs = 150\n}) {\n const [pdfDoc, setPdfDoc] = useState(null);\n const [numPages, setNumPages] = useState(0);\n const [pageNumber, setPageNumber] = useState(1);\n const [pageImageUrl, setPageImageUrl] = useState(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState(null);\n const [pageDimensions, setPageDimensions] = useState(null);\n const [displayDimensions, setDisplayDimensions] = useState(null);\n const [scale] = useState(1.5);\n const [isDrawing, setIsDrawing] = useState(false);\n const [selection, setSelection] = useState(null);\n const containerRef = useRef(null);\n const imageRef = useRef(null);\n useEffect(() => {\n let cancelled = false;\n async function loadPdf() {\n try {\n setIsLoading(true);\n setError(null);\n const doc = await loadPdfDocument(pdfUrl);\n if (cancelled) return;\n setPdfDoc(doc);\n setNumPages(doc.numPages);\n setIsLoading(false);\n } catch (err) {\n if (cancelled) return;\n console.error(\"Error loading PDF:\", err);\n setError(\"Failed to load PDF\");\n setIsLoading(false);\n }\n }\n loadPdf();\n return () => {\n cancelled = true;\n };\n }, [pdfUrl]);\n useEffect(() => {\n if (!pdfDoc) return;\n let cancelled = false;\n const doc = pdfDoc;\n async function loadPage() {\n try {\n const page = await doc.getPage(pageNumber);\n if (cancelled) return;\n const viewport = page.getViewport({ scale: 1 });\n setPageDimensions({\n width: viewport.width,\n height: viewport.height\n });\n const { dataUrl } = await renderPdfPageToDataUrl(page, scale);\n if (cancelled) return;\n setPageImageUrl(dataUrl);\n } catch (err) {\n if (cancelled) return;\n console.error(\"Error loading page:\", err);\n setError(\"Failed to load page\");\n }\n }\n loadPage();\n return () => {\n cancelled = true;\n };\n }, [pdfDoc, pageNumber, scale]);\n useEffect(() => {\n const updateDisplayDimensions = () => {\n if (imageRef.current) {\n setDisplayDimensions({\n width: imageRef.current.clientWidth,\n height: imageRef.current.clientHeight\n });\n }\n };\n updateDisplayDimensions();\n let resizeObserver = null;\n try {\n resizeObserver = new ResizeObserver(updateDisplayDimensions);\n if (imageRef.current) {\n resizeObserver.observe(imageRef.current);\n }\n } catch (error2) {\n console.warn(\"ResizeObserver not supported, falling back to window resize listener\");\n window.addEventListener(\"resize\", updateDisplayDimensions);\n }\n return () => {\n if (resizeObserver) {\n resizeObserver.disconnect();\n } else {\n window.removeEventListener(\"resize\", updateDisplayDimensions);\n }\n };\n }, [pageImageUrl]);\n const handleMouseDown = useCallback((e) => {\n if (!drawingMode) return;\n if (!imageRef.current) return;\n const rect = imageRef.current.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n setIsDrawing(true);\n setSelection({\n startX: x,\n startY: y,\n endX: x,\n endY: y\n });\n }, [drawingMode]);\n const handleMouseMove = useCallback((e) => {\n if (!isDrawing || !selection || !imageRef.current) return;\n const rect = imageRef.current.getBoundingClientRect();\n setSelection({\n ...selection,\n endX: e.clientX - rect.left,\n endY: e.clientY - rect.top\n });\n }, [isDrawing, selection]);\n const handleMouseUp = useCallback(() => {\n if (!isDrawing || !selection || !pageDimensions || !displayDimensions || !session) {\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n const dragDistance = Math.sqrt(\n Math.pow(selection.endX - selection.startX, 2) + Math.pow(selection.endY - selection.startY, 2)\n );\n const MIN_DRAG_DISTANCE = 10;\n if (dragDistance < MIN_DRAG_DISTANCE) {\n if (existingAnnotations.length > 0) {\n const clickedAnnotation = pageAnnotations.find((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return false;\n const pdfCoord2 = parseFragmentSelector(fragmentSel.value);\n if (!pdfCoord2) return false;\n const rect = pdfToCanvasCoordinates(pdfCoord2, pageDimensions.height, 1);\n const scaleX2 = displayDimensions.width / pageDimensions.width;\n const scaleY2 = displayDimensions.height / pageDimensions.height;\n const displayX = rect.x * scaleX2;\n const displayY = rect.y * scaleY2;\n const displayWidth = rect.width * scaleX2;\n const displayHeight = rect.height * scaleY2;\n return selection.endX >= displayX && selection.endX <= displayX + displayWidth && selection.endY >= displayY && selection.endY <= displayY + displayHeight;\n });\n if (clickedAnnotation) {\n session?.client.browse.click(clickedAnnotation.id, clickedAnnotation.motivation);\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n }\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n const scaleX = pageDimensions.width / displayDimensions.width;\n const scaleY = pageDimensions.height / displayDimensions.height;\n const nativeSelection = {\n startX: selection.startX * scaleX,\n startY: selection.startY * scaleY,\n endX: selection.endX * scaleX,\n endY: selection.endY * scaleY\n };\n const pdfCoord = canvasToPdfCoordinates(\n nativeSelection,\n pageNumber,\n pageDimensions.width,\n pageDimensions.height,\n 1\n // Use scale 1.0 since we already scaled to native coords\n );\n const fragmentSelector = createFragmentSelector(pdfCoord);\n if (selectedMotivation) {\n session.client.mark.request(\n {\n type: \"FragmentSelector\",\n conformsTo: \"http://tools.ietf.org/rfc/rfc3778\",\n value: fragmentSelector\n },\n selectedMotivation\n );\n }\n setIsDrawing(false);\n }, [isDrawing, selection, pageNumber, pageDimensions, displayDimensions, selectedMotivation, existingAnnotations]);\n const getFragmentSelector = (target) => {\n const selector = getTargetSelector(target);\n if (!selector) return null;\n const selectors = Array.isArray(selector) ? selector : [selector];\n const found = selectors.find((s) => s.type === \"FragmentSelector\");\n if (!found || found.type !== \"FragmentSelector\") return null;\n return found;\n };\n const pageAnnotations = existingAnnotations.filter((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return false;\n const page = getPageFromFragment(fragmentSel.value);\n return page === pageNumber;\n });\n const { handleMouseEnter, handleMouseLeave } = useMemo(\n () => createHoverHandlers((id) => session?.client.beckon.hover(id), hoverDelayMs),\n [session, hoverDelayMs]\n );\n const { stroke, fill } = getMotivationColor(selectedMotivation ?? null);\n if (error) {\n return /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__error\", children: error });\n }\n return /* @__PURE__ */ jsxs(\"div\", { className: \"semiont-pdf-annotation-canvas\", children: [\n isLoading && /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__loading\", children: \"Loading PDF...\" }),\n /* @__PURE__ */ jsxs(\n \"div\",\n {\n ref: containerRef,\n className: \"semiont-pdf-annotation-canvas__container\",\n style: { display: isLoading ? \"none\" : void 0 },\n onMouseDown: handleMouseDown,\n onMouseMove: handleMouseMove,\n onMouseUp: handleMouseUp,\n onMouseLeave: () => {\n if (isDrawing) {\n setIsDrawing(false);\n setSelection(null);\n }\n },\n \"data-drawing-mode\": drawingMode || \"none\",\n children: [\n pageImageUrl && /* @__PURE__ */ jsx(\n \"img\",\n {\n ref: imageRef,\n src: pageImageUrl,\n alt: `PDF page ${pageNumber}`,\n className: \"semiont-pdf-annotation-canvas__image\",\n draggable: false,\n style: { pointerEvents: \"none\" },\n onLoad: () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (imageRef.current) {\n setDisplayDimensions({\n width: imageRef.current.clientWidth,\n height: imageRef.current.clientHeight\n });\n }\n });\n });\n }\n }\n ),\n displayDimensions && pageDimensions && /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__overlay-container\", children: /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__overlay\", children: /* @__PURE__ */ jsxs(\n \"svg\",\n {\n className: \"semiont-pdf-annotation-canvas__svg\",\n width: displayDimensions.width,\n height: displayDimensions.height,\n children: [\n pageAnnotations.map((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return null;\n const pdfCoord = parseFragmentSelector(fragmentSel.value);\n if (!pdfCoord) return null;\n const rect = pdfToCanvasCoordinates(pdfCoord, pageDimensions.height, 1);\n const scaleX = displayDimensions.width / pageDimensions.width;\n const scaleY = displayDimensions.height / pageDimensions.height;\n const isHovered = ann.id === hoveredAnnotationId;\n const isSelected = ann.id === selectedAnnotationId;\n const annMotivation = ann.motivation;\n const { stroke: annStroke, fill: annFill } = getMotivationColor(annMotivation);\n return /* @__PURE__ */ jsx(\n \"rect\",\n {\n x: rect.x * scaleX,\n y: rect.y * scaleY,\n width: rect.width * scaleX,\n height: rect.height * scaleY,\n stroke: annStroke,\n strokeWidth: isSelected ? 4 : isHovered ? 3 : 2,\n fill: annFill,\n style: {\n pointerEvents: \"auto\",\n cursor: \"pointer\",\n opacity: isSelected ? 1 : isHovered ? 0.9 : 0.7\n },\n onClick: () => session?.client.browse.click(ann.id, ann.motivation),\n onMouseEnter: () => handleMouseEnter(ann.id),\n onMouseLeave: handleMouseLeave\n },\n ann.id\n );\n }),\n selection && (() => {\n const rectX = Math.min(selection.startX, selection.endX);\n const rectY = Math.min(selection.startY, selection.endY);\n const rectWidth = Math.abs(selection.endX - selection.startX);\n const rectHeight = Math.abs(selection.endY - selection.startY);\n return /* @__PURE__ */ jsx(\n \"rect\",\n {\n x: rectX,\n y: rectY,\n width: rectWidth,\n height: rectHeight,\n stroke,\n strokeWidth: 2,\n strokeDasharray: \"5,5\",\n fill,\n pointerEvents: \"none\"\n }\n );\n })()\n ]\n }\n ) }) })\n ]\n }\n ),\n numPages > 0 && /* @__PURE__ */ jsxs(\"div\", { className: \"semiont-pdf-annotation-canvas__controls\", children: [\n /* @__PURE__ */ jsx(\n \"button\",\n {\n disabled: pageNumber <= 1,\n onClick: () => setPageNumber(pageNumber - 1),\n className: \"semiont-pdf-annotation-canvas__button\",\n children: \"Previous\"\n }\n ),\n /* @__PURE__ */ jsxs(\"span\", { className: \"semiont-pdf-annotation-canvas__page-info\", children: [\n \"Page \",\n pageNumber,\n \" of \",\n numPages\n ] }),\n /* @__PURE__ */ jsx(\n \"button\",\n {\n disabled: pageNumber >= numPages,\n onClick: () => setPageNumber(pageNumber + 1),\n className: \"semiont-pdf-annotation-canvas__button\",\n children: \"Next\"\n }\n )\n ] })\n ] });\n}\nexport {\n PdfAnnotationCanvas\n};\n//# sourceMappingURL=PdfAnnotationCanvas.client-CN3C3S55.js.map"],"mappings":"yMAUA,SAAS,EAAuB,EAAY,EAAM,EAAY,EAAY,EAAQ,EAAG,CACnF,IAAM,EAAK,KAAK,IAAI,EAAW,OAAQ,EAAW,KAAK,CACjD,EAAK,KAAK,IAAI,EAAW,OAAQ,EAAW,KAAK,CACjD,EAAK,KAAK,IAAI,EAAW,OAAQ,EAAW,KAAK,CACjD,EAAK,KAAK,IAAI,EAAW,OAAQ,EAAW,KAAK,CACjD,EAAO,EAAK,EACZ,GAAY,EAAK,GAAM,EACvB,EAAO,EAAa,EAAK,EACzB,GAAa,EAAK,GAAM,EAC9B,MAAO,CACL,OACA,EAAG,KAAK,MAAM,EAAK,CACnB,EAAG,KAAK,MAAM,EAAK,CACnB,MAAO,KAAK,MAAM,EAAS,CAC3B,OAAQ,KAAK,MAAM,EAAU,CAC9B,CAEH,SAAS,EAAuB,EAAU,EAAY,EAAQ,EAAG,CAC/D,IAAM,EAAU,EAAS,EAAI,EACvB,EAAc,EAAS,MAAQ,EAGrC,MAAO,CACL,EAAG,EACH,GAJe,EAAa,EAAS,EAAI,EAAS,QAAU,EAK5D,MAAO,EACP,OALmB,EAAS,OAAS,EAMtC,CAEH,SAAS,EAAuB,EAAO,CACrC,MAAO,QAAQ,EAAM,KAAK,YAAY,EAAM,EAAE,GAAG,EAAM,EAAE,GAAG,EAAM,MAAM,GAAG,EAAM,SAEnF,SAAS,EAAsB,EAAU,CACvC,GAAI,CACF,IAAM,EAAY,EAAS,MAAM,aAAa,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