lynkow 1.32.1 → 1.32.21

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/index.d.mts CHANGED
@@ -290,24 +290,33 @@ declare class CategoriesService extends BaseService {
290
290
  * @example
291
291
  * ```typescript
292
292
  * const lynkow = createClient({ siteId: '...' })
293
- * const { data } = await lynkow.tags.list()
293
+ * const { data, meta } = await lynkow.tags.list({ limit: 50 })
294
294
  * ```
295
295
  */
296
296
  declare class TagsService extends BaseService {
297
297
  /**
298
- * Retrieves the complete list of tags available on the site.
299
- * Returns all tags (no pagination). Cached for 5 minutes per locale.
298
+ * Retrieves a paginated list of tags available on the site.
300
299
  *
300
+ * Cached for 5 minutes per (locale + pagination) combination. The cache
301
+ * key splits on `page` and `limit` so adjacent pages do not collide.
302
+ *
303
+ * @param filters - Pagination filters: `page` (1-based), `limit` (1-100), `perPage` (deprecated alias)
301
304
  * @param options - Request options; use `locale` to fetch localized tag names
302
- * @returns An object containing `data` (array of `Tag` with id, name, slug, and locale)
305
+ * @returns `{ data: Tag[], meta: PaginationMeta }`. Server defaults to 20 items per page (ADR-0022 D3); pass `{ limit: 100 }` to recover pre-1.32.2 behavior.
303
306
  *
304
307
  * @example
305
308
  * ```typescript
306
- * const { data } = await lynkow.tags.list()
307
- * data.forEach(tag => console.log(tag.name)) // "Featured", "Tutorial", etc.
309
+ * // Default: first 20 tags.
310
+ * const { data, meta } = await lynkow.tags.list()
311
+ *
312
+ * // Page through everything.
313
+ * for (let page = 1; page <= meta.lastPage; page++) {
314
+ * const { data } = await lynkow.tags.list({ page, limit: 50 })
315
+ * data.forEach(t => console.log(t.name))
316
+ * }
308
317
  * ```
309
318
  */
310
- list(options?: BaseRequestOptions): Promise<TagsListResponse>;
319
+ list(filters?: TagsListFilters, options?: BaseRequestOptions): Promise<TagsListResponse>;
311
320
  /**
312
321
  * Invalidate every cached tag response (lists, tag-filtered contents).
313
322
  * Call after an admin mutation or on receipt of a `tag.*` webhook so
@@ -2376,6 +2385,18 @@ interface Category {
2376
2385
  * list projections (e.g. when categories are embedded in content responses).
2377
2386
  */
2378
2387
  contentMode?: 'standard' | 'structured';
2388
+ /**
2389
+ * Parent category in the hierarchy. Present when the API eagerly loads
2390
+ * the parent relation (e.g. `GET /public/contents/slug/:slug` returns
2391
+ * each category's parent so consumers can build a breadcrumb in a single
2392
+ * request). `null` for root-level categories. `undefined` when the
2393
+ * endpoint did not include parent data.
2394
+ *
2395
+ * The relation is depth-bound to one level: `parent.parent` is never
2396
+ * populated by the public API, even when the underlying hierarchy is
2397
+ * deeper.
2398
+ */
2399
+ parent?: Category | null;
2379
2400
  }
2380
2401
  /**
2381
2402
  * Category with URL path, description, image, and content count.
@@ -4765,14 +4786,21 @@ interface CategoryDetailResponse {
4765
4786
  }
4766
4787
  /**
4767
4788
  * Response from `tags.list()`.
4768
- * Returns all tags in a single non-paginated response.
4789
+ * Paginated since SDK 1.32.2 (the wire was already returning `meta`; the SDK
4790
+ * type now exposes it). Server-side default is 20 items per page on
4791
+ * `/v1/tags` and `/public/.../tags`, with `maxLimit=100` (ADR-0022 D3).
4769
4792
  */
4770
4793
  interface TagsListResponse {
4771
4794
  /**
4772
- * Flat array of all tags for the current locale.
4773
- * Not paginated -- all tags are returned at once.
4795
+ * Tags for the current page in the current locale.
4796
+ * Empty array when no tags match (or when paging past the last page).
4774
4797
  */
4775
4798
  data: Tag[];
4799
+ /**
4800
+ * Pagination metadata describing total count, page position, and navigation
4801
+ * flags. See {@link PaginationMeta}.
4802
+ */
4803
+ meta: PaginationMeta;
4776
4804
  }
4777
4805
  /**
4778
4806
  * Response from `pages.list()`.
@@ -5049,7 +5077,11 @@ interface BaseRequestOptions {
5049
5077
  }
5050
5078
  /**
5051
5079
  * Pagination options for list endpoints.
5052
- * All values are 1-based integers. The API defaults to page 1 with 15 items per page.
5080
+ *
5081
+ * All values are 1-based integers. The server default is 20 items per page
5082
+ * on public-tier endpoints (`/public`, `/v1`) and 50 on admin-tier
5083
+ * endpoints (`/api`, `/admin`), per ADR-0022 D3. Documented exceptions:
5084
+ * SSG endpoints like `/public/.../categories/:slug` default to 500.
5053
5085
  */
5054
5086
  interface PaginationOptions {
5055
5087
  /**
@@ -5060,8 +5092,10 @@ interface PaginationOptions {
5060
5092
  page?: number;
5061
5093
  /**
5062
5094
  * Maximum number of items per page.
5063
- * Defaults to 15. Maximum allowed value is 100.
5064
- * Values above 100 are silently capped by the API.
5095
+ * Server default is 20 on public-tier endpoints (`/public`, `/v1`).
5096
+ * Maximum allowed value is 100 (except documented SSG exceptions like
5097
+ * `/public/.../categories/:slug` which permit up to 500).
5098
+ * Values above the per-endpoint maximum are silently capped by the API.
5065
5099
  */
5066
5100
  limit?: number;
5067
5101
  /**
@@ -5148,6 +5182,25 @@ interface CategoryOptions extends PaginationOptions {
5148
5182
  */
5149
5183
  locale?: string;
5150
5184
  }
5185
+ /**
5186
+ * Filters for the `tags.list()` endpoint.
5187
+ *
5188
+ * Pagination + locale. The public `/v1/tags` endpoint does not expose
5189
+ * search or sort on its public surface. `limit` defaults to 20 server-side
5190
+ * on the public-tier mounts (`/public/.../tags`, `/v1/tags`) per
5191
+ * ADR-0022 D3, with `maxLimit=100`.
5192
+ */
5193
+ interface TagsListFilters extends PaginationOptions {
5194
+ /**
5195
+ * Locale override for this request.
5196
+ * When omitted, uses the client's default locale or the site's default locale.
5197
+ * If both `filters.locale` and `options.locale` are passed, `options.locale`
5198
+ * wins (mirrors `contents.list()` precedence).
5199
+ *
5200
+ * @example 'fr'
5201
+ */
5202
+ locale?: string;
5203
+ }
5151
5204
  /**
5152
5205
  * Filters for the `reviews.list()` endpoint.
5153
5206
  * Only approved reviews are returned; these filters further narrow the result set.
@@ -6841,4 +6894,4 @@ declare function renderJsonLdGraph(nodes: object[] | null | undefined): string;
6841
6894
  */
6842
6895
  declare function mergeIntoGraph(server: object[] | null | undefined, custom: object[] | null | undefined): object[];
6843
6896
 
6844
- export { type Alternate, AnalyticsService, type ApiErrorDetail, type Author, type BaseRequestOptions, BlocksService, BrandingService, type CategoriesListResponse, CategoriesService, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, ConsentService, type Content, type ContentBody, type ContentResolveResponse, type ContentSchema, type ContentSummary, type ContentsFilters, type ContentsListResponse, ContentsService, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, CookiesService, type EnhancementsInitOptions, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormCondition, type FormField, type FormFieldOption, type FormFieldPhoneOptions, type FormFieldType, type FormFieldValidation, type FormPage, type FormSchema, type FormSchemaSettings, type FormSettings, type FormSubmitData, type FormSubmitResponse, FormsService, type GlobalBlock, type GlobalBlockResponse, type ImageVariants, type JsonLdGraphConfig, type JsonLdNode, type JsonLdNodeSource, type LegalDocument, LegalService, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, MediaHelperService, type Page, type PageSeo, type PageSummary, type PagesListResponse, PagesService, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, PathsService, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, ReviewsService, type SchemaField, type SchemaFieldOption, type SchemaFieldType, type SchemaFieldValidation, type SearchConfig, type SearchHit, type SearchOptions, type SearchProfilePublic, type SearchResponse, SearchService, SeoService, type SiteConfig, type SiteConfigResponse, SiteService, type SortOptions, type SrcsetOptions, type SubmitOptions, type Tag, type TagsListResponse, TagsService, type TipTapMark, type TipTapNode, type TransformOptions, browserOnly, browserOnlyAsync, createClient, createLynkowClient, detectSiteTheme, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer, mergeIntoGraph, onSiteThemeChange, renderJsonLdGraph };
6897
+ export { type Alternate, AnalyticsService, type ApiErrorDetail, type Author, type BaseRequestOptions, BlocksService, BrandingService, type CategoriesListResponse, CategoriesService, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, ConsentService, type Content, type ContentBody, type ContentResolveResponse, type ContentSchema, type ContentSummary, type ContentsFilters, type ContentsListResponse, ContentsService, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, CookiesService, type EnhancementsInitOptions, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormCondition, type FormField, type FormFieldOption, type FormFieldPhoneOptions, type FormFieldType, type FormFieldValidation, type FormPage, type FormSchema, type FormSchemaSettings, type FormSettings, type FormSubmitData, type FormSubmitResponse, FormsService, type GlobalBlock, type GlobalBlockResponse, type ImageVariants, type JsonLdGraphConfig, type JsonLdNode, type JsonLdNodeSource, type LegalDocument, LegalService, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, MediaHelperService, type Page, type PageSeo, type PageSummary, type PagesListResponse, PagesService, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, PathsService, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, ReviewsService, type SchemaField, type SchemaFieldOption, type SchemaFieldType, type SchemaFieldValidation, type SearchConfig, type SearchHit, type SearchOptions, type SearchProfilePublic, type SearchResponse, SearchService, SeoService, type SiteConfig, type SiteConfigResponse, SiteService, type SortOptions, type SrcsetOptions, type SubmitOptions, type Tag, type TagsListFilters, type TagsListResponse, TagsService, type TipTapMark, type TipTapNode, type TransformOptions, browserOnly, browserOnlyAsync, createClient, createLynkowClient, detectSiteTheme, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer, mergeIntoGraph, onSiteThemeChange, renderJsonLdGraph };
package/dist/index.d.ts CHANGED
@@ -290,24 +290,33 @@ declare class CategoriesService extends BaseService {
290
290
  * @example
291
291
  * ```typescript
292
292
  * const lynkow = createClient({ siteId: '...' })
293
- * const { data } = await lynkow.tags.list()
293
+ * const { data, meta } = await lynkow.tags.list({ limit: 50 })
294
294
  * ```
295
295
  */
296
296
  declare class TagsService extends BaseService {
297
297
  /**
298
- * Retrieves the complete list of tags available on the site.
299
- * Returns all tags (no pagination). Cached for 5 minutes per locale.
298
+ * Retrieves a paginated list of tags available on the site.
300
299
  *
300
+ * Cached for 5 minutes per (locale + pagination) combination. The cache
301
+ * key splits on `page` and `limit` so adjacent pages do not collide.
302
+ *
303
+ * @param filters - Pagination filters: `page` (1-based), `limit` (1-100), `perPage` (deprecated alias)
301
304
  * @param options - Request options; use `locale` to fetch localized tag names
302
- * @returns An object containing `data` (array of `Tag` with id, name, slug, and locale)
305
+ * @returns `{ data: Tag[], meta: PaginationMeta }`. Server defaults to 20 items per page (ADR-0022 D3); pass `{ limit: 100 }` to recover pre-1.32.2 behavior.
303
306
  *
304
307
  * @example
305
308
  * ```typescript
306
- * const { data } = await lynkow.tags.list()
307
- * data.forEach(tag => console.log(tag.name)) // "Featured", "Tutorial", etc.
309
+ * // Default: first 20 tags.
310
+ * const { data, meta } = await lynkow.tags.list()
311
+ *
312
+ * // Page through everything.
313
+ * for (let page = 1; page <= meta.lastPage; page++) {
314
+ * const { data } = await lynkow.tags.list({ page, limit: 50 })
315
+ * data.forEach(t => console.log(t.name))
316
+ * }
308
317
  * ```
309
318
  */
310
- list(options?: BaseRequestOptions): Promise<TagsListResponse>;
319
+ list(filters?: TagsListFilters, options?: BaseRequestOptions): Promise<TagsListResponse>;
311
320
  /**
312
321
  * Invalidate every cached tag response (lists, tag-filtered contents).
313
322
  * Call after an admin mutation or on receipt of a `tag.*` webhook so
@@ -2376,6 +2385,18 @@ interface Category {
2376
2385
  * list projections (e.g. when categories are embedded in content responses).
2377
2386
  */
2378
2387
  contentMode?: 'standard' | 'structured';
2388
+ /**
2389
+ * Parent category in the hierarchy. Present when the API eagerly loads
2390
+ * the parent relation (e.g. `GET /public/contents/slug/:slug` returns
2391
+ * each category's parent so consumers can build a breadcrumb in a single
2392
+ * request). `null` for root-level categories. `undefined` when the
2393
+ * endpoint did not include parent data.
2394
+ *
2395
+ * The relation is depth-bound to one level: `parent.parent` is never
2396
+ * populated by the public API, even when the underlying hierarchy is
2397
+ * deeper.
2398
+ */
2399
+ parent?: Category | null;
2379
2400
  }
2380
2401
  /**
2381
2402
  * Category with URL path, description, image, and content count.
@@ -4765,14 +4786,21 @@ interface CategoryDetailResponse {
4765
4786
  }
4766
4787
  /**
4767
4788
  * Response from `tags.list()`.
4768
- * Returns all tags in a single non-paginated response.
4789
+ * Paginated since SDK 1.32.2 (the wire was already returning `meta`; the SDK
4790
+ * type now exposes it). Server-side default is 20 items per page on
4791
+ * `/v1/tags` and `/public/.../tags`, with `maxLimit=100` (ADR-0022 D3).
4769
4792
  */
4770
4793
  interface TagsListResponse {
4771
4794
  /**
4772
- * Flat array of all tags for the current locale.
4773
- * Not paginated -- all tags are returned at once.
4795
+ * Tags for the current page in the current locale.
4796
+ * Empty array when no tags match (or when paging past the last page).
4774
4797
  */
4775
4798
  data: Tag[];
4799
+ /**
4800
+ * Pagination metadata describing total count, page position, and navigation
4801
+ * flags. See {@link PaginationMeta}.
4802
+ */
4803
+ meta: PaginationMeta;
4776
4804
  }
4777
4805
  /**
4778
4806
  * Response from `pages.list()`.
@@ -5049,7 +5077,11 @@ interface BaseRequestOptions {
5049
5077
  }
5050
5078
  /**
5051
5079
  * Pagination options for list endpoints.
5052
- * All values are 1-based integers. The API defaults to page 1 with 15 items per page.
5080
+ *
5081
+ * All values are 1-based integers. The server default is 20 items per page
5082
+ * on public-tier endpoints (`/public`, `/v1`) and 50 on admin-tier
5083
+ * endpoints (`/api`, `/admin`), per ADR-0022 D3. Documented exceptions:
5084
+ * SSG endpoints like `/public/.../categories/:slug` default to 500.
5053
5085
  */
5054
5086
  interface PaginationOptions {
5055
5087
  /**
@@ -5060,8 +5092,10 @@ interface PaginationOptions {
5060
5092
  page?: number;
5061
5093
  /**
5062
5094
  * Maximum number of items per page.
5063
- * Defaults to 15. Maximum allowed value is 100.
5064
- * Values above 100 are silently capped by the API.
5095
+ * Server default is 20 on public-tier endpoints (`/public`, `/v1`).
5096
+ * Maximum allowed value is 100 (except documented SSG exceptions like
5097
+ * `/public/.../categories/:slug` which permit up to 500).
5098
+ * Values above the per-endpoint maximum are silently capped by the API.
5065
5099
  */
5066
5100
  limit?: number;
5067
5101
  /**
@@ -5148,6 +5182,25 @@ interface CategoryOptions extends PaginationOptions {
5148
5182
  */
5149
5183
  locale?: string;
5150
5184
  }
5185
+ /**
5186
+ * Filters for the `tags.list()` endpoint.
5187
+ *
5188
+ * Pagination + locale. The public `/v1/tags` endpoint does not expose
5189
+ * search or sort on its public surface. `limit` defaults to 20 server-side
5190
+ * on the public-tier mounts (`/public/.../tags`, `/v1/tags`) per
5191
+ * ADR-0022 D3, with `maxLimit=100`.
5192
+ */
5193
+ interface TagsListFilters extends PaginationOptions {
5194
+ /**
5195
+ * Locale override for this request.
5196
+ * When omitted, uses the client's default locale or the site's default locale.
5197
+ * If both `filters.locale` and `options.locale` are passed, `options.locale`
5198
+ * wins (mirrors `contents.list()` precedence).
5199
+ *
5200
+ * @example 'fr'
5201
+ */
5202
+ locale?: string;
5203
+ }
5151
5204
  /**
5152
5205
  * Filters for the `reviews.list()` endpoint.
5153
5206
  * Only approved reviews are returned; these filters further narrow the result set.
@@ -6841,4 +6894,4 @@ declare function renderJsonLdGraph(nodes: object[] | null | undefined): string;
6841
6894
  */
6842
6895
  declare function mergeIntoGraph(server: object[] | null | undefined, custom: object[] | null | undefined): object[];
6843
6896
 
6844
- export { type Alternate, AnalyticsService, type ApiErrorDetail, type Author, type BaseRequestOptions, BlocksService, BrandingService, type CategoriesListResponse, CategoriesService, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, ConsentService, type Content, type ContentBody, type ContentResolveResponse, type ContentSchema, type ContentSummary, type ContentsFilters, type ContentsListResponse, ContentsService, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, CookiesService, type EnhancementsInitOptions, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormCondition, type FormField, type FormFieldOption, type FormFieldPhoneOptions, type FormFieldType, type FormFieldValidation, type FormPage, type FormSchema, type FormSchemaSettings, type FormSettings, type FormSubmitData, type FormSubmitResponse, FormsService, type GlobalBlock, type GlobalBlockResponse, type ImageVariants, type JsonLdGraphConfig, type JsonLdNode, type JsonLdNodeSource, type LegalDocument, LegalService, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, MediaHelperService, type Page, type PageSeo, type PageSummary, type PagesListResponse, PagesService, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, PathsService, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, ReviewsService, type SchemaField, type SchemaFieldOption, type SchemaFieldType, type SchemaFieldValidation, type SearchConfig, type SearchHit, type SearchOptions, type SearchProfilePublic, type SearchResponse, SearchService, SeoService, type SiteConfig, type SiteConfigResponse, SiteService, type SortOptions, type SrcsetOptions, type SubmitOptions, type Tag, type TagsListResponse, TagsService, type TipTapMark, type TipTapNode, type TransformOptions, browserOnly, browserOnlyAsync, createClient, createLynkowClient, detectSiteTheme, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer, mergeIntoGraph, onSiteThemeChange, renderJsonLdGraph };
6897
+ export { type Alternate, AnalyticsService, type ApiErrorDetail, type Author, type BaseRequestOptions, BlocksService, BrandingService, type CategoriesListResponse, CategoriesService, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, ConsentService, type Content, type ContentBody, type ContentResolveResponse, type ContentSchema, type ContentSummary, type ContentsFilters, type ContentsListResponse, ContentsService, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, CookiesService, type EnhancementsInitOptions, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormCondition, type FormField, type FormFieldOption, type FormFieldPhoneOptions, type FormFieldType, type FormFieldValidation, type FormPage, type FormSchema, type FormSchemaSettings, type FormSettings, type FormSubmitData, type FormSubmitResponse, FormsService, type GlobalBlock, type GlobalBlockResponse, type ImageVariants, type JsonLdGraphConfig, type JsonLdNode, type JsonLdNodeSource, type LegalDocument, LegalService, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, MediaHelperService, type Page, type PageSeo, type PageSummary, type PagesListResponse, PagesService, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, PathsService, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, ReviewsService, type SchemaField, type SchemaFieldOption, type SchemaFieldType, type SchemaFieldValidation, type SearchConfig, type SearchHit, type SearchOptions, type SearchProfilePublic, type SearchResponse, SearchService, SeoService, type SiteConfig, type SiteConfigResponse, SiteService, type SortOptions, type SrcsetOptions, type SubmitOptions, type Tag, type TagsListFilters, type TagsListResponse, TagsService, type TipTapMark, type TipTapNode, type TransformOptions, browserOnly, browserOnlyAsync, createClient, createLynkowClient, detectSiteTheme, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer, mergeIntoGraph, onSiteThemeChange, renderJsonLdGraph };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var v=class s extends Error{name="LynkowError";code;status;details;cause;constructor(e,t,n,o,r){super(e),this.code=t,this.status=n,this.details=o,this.cause=r,Error.captureStackTrace&&Error.captureStackTrace(this,s);}static async fromResponse(e){let t=e.status,n=`HTTP ${t}`,o;try{let i=await e.json();i.errors&&Array.isArray(i.errors)?(o=i.errors,n=i.errors[0]?.message||n):i.error?n=i.error:i.message&&(n=i.message);}catch{n=e.statusText||n;}let r=s.statusToCode(t);return new s(n,r,t,o)}static fromNetworkError(e){return e.name==="AbortError"?new s("Request timed out","TIMEOUT",void 0,void 0,e):e.name==="TypeError"?new s("Network error - please check your connection","NETWORK_ERROR",void 0,void 0,e):new s(e.message||"Unknown error","UNKNOWN",void 0,void 0,e)}static statusToCode(e){switch(e){case 400:return "VALIDATION_ERROR";case 401:return "UNAUTHORIZED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 429:return "RATE_LIMITED";default:return "UNKNOWN"}}toJSON(){return {name:this.name,message:this.message,code:this.code,status:this.status,details:this.details}}};function be(s){return s instanceof v}function ke(s){switch(s){case 400:return "BAD_REQUEST";case 401:return "UNAUTHORIZED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 422:return "VALIDATION_ERROR";case 429:return "TOO_MANY_REQUESTS";case 503:return "SERVICE_UNAVAILABLE";default:return "INTERNAL_ERROR"}}async function W(s,e){let t;try{t=await fetch(s,e);}catch(a){throw new v("Network error: Unable to reach the server","NETWORK_ERROR",0,[{message:a instanceof Error?a.message:"Unknown error"}])}if(t.ok)return t.json();let n={};try{n=await t.json();}catch{}let o=ke(t.status),r=n.error||n.message||`HTTP error: ${t.status}`,i=n.errors||[{message:r}];throw new v(r,o,t.status,i)}function ie(s){let e=new URLSearchParams;for(let[t,n]of Object.entries(s))n!=null&&n!==""&&e.append(t,String(n));return e.toString()}var d={SHORT:300*1e3,MEDIUM:600*1e3,LONG:1800*1e3},m=class{config;cache;constructor(e){this.config=e,this.cache=e.cache;}buildEndpointUrl(e,t){let n=`${this.config.baseUrl}/public/${this.config.siteId}${e}`;if(t&&Object.keys(t).length>0){let o=ie(t);return `${n}?${o}`}return n}async get(e,t,n){let o=n?.locale||this.config.locale,r=o?{...t,locale:o}:t,i=this.buildEndpointUrl(e,r),a=this.mergeFetchOptions(n?.fetchOptions);return W(i,{method:"GET",...a})}async getWithCache(e,t,n,o,r=d.SHORT){return this.cache?this.cache.getOrSet(e,()=>this.get(t,n,o),r):this.get(t,n,o)}invalidateCache(e){this.cache?.invalidate(e);}async post(e,t,n){let o=this.buildEndpointUrl(e),r=this.mergeFetchOptions(n?.fetchOptions);return W(o,{method:"POST",...r,headers:{"Content-Type":"application/json",...r.headers},body:JSON.stringify(t)})}async getText(e,t){let n=this.buildEndpointUrl(e),o=this.mergeFetchOptions(t?.fetchOptions),r=await fetch(n,{method:"GET",...o});if(!r.ok)throw new Error(`HTTP error: ${r.status}`);return r.text()}mergeFetchOptions(e){return {...this.config.fetchOptions,...e,headers:{...this.config.fetchOptions.headers,...e?.headers}}}};var G="contents_",b=class extends m{async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.category&&(n.category=e.category),e?.tag&&(n.tag=e.tag),e?.search&&(n.search=e.search),e?.sort&&(n.sort=e.sort),e?.order&&(n.order=e.order),e?.locale&&(n.locale=e.locale);let o=`${G}list_${JSON.stringify(e||{})}`;return this.getWithCache(o,"/contents",n,t,d.SHORT)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${G}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/contents/slug/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(G);}};var j="categories_",k=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${j}list_${t||"default"}`;return this.getWithCache(n,"/categories",void 0,e,d.SHORT)}async tree(e){let t=e?.locale||this.config.locale,n=`${j}tree_${t||"default"}`;return this.getWithCache(n,"/categories/tree",void 0,e,d.SHORT)}async getBySlug(e,t){let n={};t?.page&&(n.page=t.page),(t?.limit??t?.perPage)&&(n.limit=t?.limit??t?.perPage);let o=`${j}slug_${e}_${JSON.stringify(t||{})}`;return this.getWithCache(o,`/categories/${encodeURIComponent(e)}`,n,t,d.SHORT)}clearCache(){this.invalidateCache(j);}};var ae="tags_",x=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${ae}list_${t||"default"}`;return this.getWithCache(n,"/tags",void 0,e,d.SHORT)}clearCache(){this.invalidateCache(ae);}};var F="pages_",R=class extends m{async list(e){let t=e?.locale||this.config.locale,n={};e?.tag&&(n.tag=e.tag);let o=`${F}list_${t||"default"}_${e?.tag||"all"}`;return this.getWithCache(o,"/pages",n,e,d.SHORT)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${F}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}async getByPath(e,t){let n=t?.locale||this.config.locale,o=`${F}path_${e}_${n||"default"}`;return (await this.getWithCache(o,"/page-by-path",{path:e},t,d.SHORT)).data}async getJsonLd(e,t){let n=t?.locale||this.config.locale,o=`${F}jsonld_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}/json-ld`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(F);}};var J="globals_",E=class extends m{async siteConfig(e){let t=e?.locale||this.config.locale,n=`${J}siteconfig_${t||"default"}`;return this.getWithCache(n,"/site-config",void 0,e,d.MEDIUM)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${J}${e}_${n||"default"}`;return this.getWithCache(o,`/global/${encodeURIComponent(e)}`,void 0,t,d.MEDIUM)}async global(e,t){return this.getBySlug(e,t)}clearCache(){this.invalidateCache(J);}};function K(s){return {_hp:"",_ts:s}}var ce="forms_",S=class extends m{sessionStartTime;constructor(e){super(e),this.sessionStartTime=Date.now();}async getBySlug(e){let t=`${ce}${e}`;return (await this.getWithCache(t,`/forms/${encodeURIComponent(e)}`,void 0,void 0,d.MEDIUM)).data}async submit(e,t,n){let o=K(this.sessionStartTime),r={data:t,honeypot:o._hp,...o};return n?.recaptchaToken&&(r.recaptchaToken=n.recaptchaToken),(await this.post(`/forms/${encodeURIComponent(e)}/submit`,r,n)).data}clearCache(){this.invalidateCache(ce);}};var D="reviews_",T=class extends m{sessionStartTime;constructor(e){super(e),this.sessionStartTime=Date.now();}async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.minRating&&(n.minRating=e.minRating),e?.maxRating&&(n.maxRating=e.maxRating),e?.sort&&(n.sort=e.sort),e?.order&&(n.order=e.order);let o=`${D}list_${JSON.stringify(e||{})}`;return this.getWithCache(o,"/reviews",n,t,d.SHORT)}async getBySlug(e){let t=`${D}slug_${e}`;return (await this.getWithCache(t,`/reviews/${encodeURIComponent(e)}`,void 0,void 0,d.SHORT)).data}async settings(){let e=`${D}settings`;return (await this.getWithCache(e,"/reviews/settings",void 0,void 0,d.MEDIUM)).data}async submit(e,t){let n=K(this.sessionStartTime),o={...e,...n};t?.recaptchaToken&&(o._recaptcha_token=t.recaptchaToken);let r=await this.post("/reviews",o,t);return this.invalidateCache(D),r.data}clearCache(){this.invalidateCache(D);}};var le="site_",L=class extends m{async getConfig(){let e=`${le}config`;return (await this.getWithCache(e,"/site",void 0,void 0,d.MEDIUM)).data}clearCache(){this.invalidateCache(le);}};var V="legal_",O=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${V}list_${t||"default"}`;return (await this.getWithCache(n,"/pages",{tag:"legal"},e,d.SHORT)).data}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${V}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(V);}};var de="cookies_",I=class extends m{async getConfig(){let e=`${de}config`;return (await this.getWithCache(e,"/cookie-consent/config",void 0,void 0,d.MEDIUM)).data}async logConsent(e,t){return this.post("/cookie-consent/log",{preferences:e},t)}clearCache(){this.invalidateCache(de);}};var P=class extends m{async sitemap(e){return this.getText("/sitemap.xml",e)}async sitemapPart(e,t){return this.getText(`/sitemap-${e}.xml`,t)}async robots(e){return this.getText("/robots.txt",e)}async llmsTxt(e){let t=e?.locale,n=t?`/${t}/llms.txt`:"/llms.txt";return this.getText(n,e)}async llmsFullTxt(e){let t=e?.locale,n=t?`/${t}/llms-full.txt`:"/llms-full.txt";return this.getText(n,e)}async getMarkdown(e,t){let n=e.startsWith("/")?e:`/${e}`;return this.getText(`${n}.md`,t)}};var X="paths_",B=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${X}list_${t||"all"}`;return this.getWithCache(n,"/paths",void 0,e,d.SHORT)}async resolve(e,t){let n=t?.locale||this.config.locale,o=`${X}resolve_${e}_${n||"default"}`;return this.getWithCache(o,"/resolve",{path:e},t,d.SHORT)}async matchRedirect(e,t){try{return (await this.get("/redirects/match",{path:e},t)).data}catch(n){if(n instanceof v&&n.status===404)return null;throw n}}clearCache(){this.invalidateCache(X);}};var c=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xe=!c;function Re(s,e){return c?s():e}async function Ee(s,e){return c?s():e}var Y="lynkow-tracker",q=class{config;enabled=true;initialized=false;loading=false;loadPromise=null;constructor(e){this.config=e;}getTrackerUrl(){return `${this.config.baseUrl}/analytics/tracker.js`}loadTracker(){return !c||window.LynkowAnalytics?Promise.resolve():this.loadPromise?this.loadPromise:(this.loading=true,this.loadPromise=new Promise((e,t)=>{if(document.getElementById(Y)){let o=setInterval(()=>{window.LynkowAnalytics&&(clearInterval(o),this.loading=false,e());},50);setTimeout(()=>{clearInterval(o),this.loading=false,t(new Error("Tracker script load timeout"));},1e4);return}let n=document.createElement("script");n.id=Y,n.src=this.getTrackerUrl(),n.async=true,n.setAttribute("data-site-id",this.config.siteId),this.config.baseUrl&&n.setAttribute("data-api-url",this.config.baseUrl);try{let o=localStorage.getItem("_lkw_consent_mode");o&&n.setAttribute("data-consent-mode",o);}catch{}n.onload=()=>{this.loading=false,setTimeout(()=>{window.LynkowAnalytics?e():t(new Error("Tracker script loaded but LynkowAnalytics not found"));},0);},n.onerror=()=>{this.loading=false,t(new Error("Failed to load tracker script"));},document.head.appendChild(n);}),this.loadPromise)}async init(){if(!(!c||this.initialized))try{await this.loadTracker(),window.LynkowAnalytics&&!this.initialized&&(this.initialized=!0);}catch(e){console.error("[Lynkow] Failed to initialize analytics:",e);}}async trackEvent(e){!c||!this.enabled||(await this.init(),window.LynkowAnalytics&&window.LynkowAnalytics.track(e));}async trackPageview(e){!c||!this.enabled||(await this.init(),window.LynkowAnalytics&&window.LynkowAnalytics.track({type:"pageview",path:e?.path||window.location.pathname,title:e?.title||document.title,referrer:e?.referrer||document.referrer}));}enable(){this.enabled=true;}disable(){this.enabled=false;}isEnabled(){return this.enabled}isInitialized(){return this.initialized&&!!window.LynkowAnalytics}getTracker(){if(c)return window.LynkowAnalytics}destroy(){if(!c)return;document.getElementById(Y)?.remove(),this.initialized=false,this.loadPromise=null;}};function Se(s){let e=s.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(!e||(e[4]!==void 0?parseFloat(e[4]):1)===0)return null;let n=parseInt(e[1],10),o=parseInt(e[2],10),r=parseInt(e[3],10);return (.299*n+.587*o+.114*r)/255}function w(){if(!c)return "light";let s=document.documentElement,e=document.body;for(let t of [s,e])for(let n of ["data-theme","data-mode","data-color-scheme"]){let o=t.getAttribute(n)?.toLowerCase();if(o){if(o.includes("dark"))return "dark";if(o.includes("light"))return "light"}}if(s.classList.contains("dark")||e.classList.contains("dark"))return "dark";try{let t=getComputedStyle(s).colorScheme;if(t){let n=t.toLowerCase().trim();if(n.startsWith("dark"))return "dark";if(n.startsWith("light"))return "light"}}catch{}try{let t=getComputedStyle(e).backgroundColor,n=Se(t);if(n!==null)return n<.5?"dark":"light"}catch{}try{if(window.matchMedia("(prefers-color-scheme: dark)").matches)return "dark"}catch{}return "light"}function $(s){if(!c)return ()=>{};let e=w(),t=[],n=()=>{let i=w();i!==e&&(e=i,s(i));},o=new MutationObserver(n),r={attributes:true,attributeFilter:["data-theme","data-mode","data-color-scheme","class","style"]};o.observe(document.documentElement,r),o.observe(document.body,r),t.push(()=>o.disconnect());try{let i=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>n();i.addEventListener("change",a),t.push(()=>i.removeEventListener("change",a));}catch{}return ()=>t.forEach(i=>i())}var z="_lkw_consent",Te=365*24*60*60*1e3,pe="lkw-script-",Q={necessary:true,analytics:false,marketing:false,preferences:false},N=class{config;events;bannerElement=null;preferencesElement=null;configCache=null;injectedScriptIds=new Set;themeCleanup=null;constructor(e,t){this.config=e,this.events=t;}async getConfig(){if(this.configCache)return this.configCache;let e=`${this.config.baseUrl}/public/${this.config.siteId}/cookie-consent/config`,t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"},...this.config.fetchOptions});if(!t.ok)throw new Error(`Failed to fetch consent config: ${t.status}`);let n=await t.json();return this.configCache=n.data,this.configCache}async logConsent(e,t){let n=`${this.config.baseUrl}/public/${this.config.siteId}/cookie-consent/log`;await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitorId:this.getOrCreateVisitorId(),action:t||this.inferAction(e),consentGiven:e,pageUrl:c?window.location.href:void 0}),...this.config.fetchOptions}).catch(()=>{});}getOrCreateVisitorId(){if(!c)return "server";let e="_lkw_vid";try{let t=localStorage.getItem(e);return t||(t=crypto.randomUUID(),localStorage.setItem(e,t)),t}catch{return crypto.randomUUID()}}inferAction(e){let t=Object.entries(e).filter(([r])=>r!=="necessary"),n=t.every(([,r])=>r===true),o=t.every(([,r])=>r===false);return n?"accept_all":o?"reject_all":"customize"}getStoredConsent(){if(!c)return null;try{let e=localStorage.getItem(z);if(e){let t=JSON.parse(e);return t.choices?t.timestamp&&Date.now()-t.timestamp>Te?(localStorage.removeItem(z),null):t.choices:t}}catch{}return null}saveConsent(e){if(c){try{localStorage.setItem(z,JSON.stringify({choices:e,timestamp:Date.now()}));}catch{}this.events.emit("consent-changed",e),document.dispatchEvent(new CustomEvent("lynkow:consent:update",{detail:e}));}}show(){c&&this.getConfig().then(e=>{if(!e.enabled)return;try{e.consentMode&&localStorage.setItem("_lkw_consent_mode",e.consentMode);}catch{}let t=this.getStoredConsent();if(t){this.activateScripts(t);return}if(this.bannerElement)return;this.injectBannerStylesOnce();let n=document.createElement("div");n.innerHTML=this.createBannerHTML(e),this.bannerElement=n.firstElementChild,document.body.appendChild(this.bannerElement),this.attachBannerEvents(),e.theme==="auto"&&!this.themeCleanup&&(this.themeCleanup=$(o=>{this.updateConsentTheme(o);}));});}hide(){c&&(this.bannerElement?.remove(),this.bannerElement=null,this.cleanupThemeObserverIfIdle());}showPreferences(){c&&(this.preferencesElement||this.getConfig().then(e=>{let t=this.getCategories(),n=document.createElement("div");n.innerHTML=this.createPreferencesHTML(e,t),this.preferencesElement=n.firstElementChild,document.body.appendChild(this.preferencesElement),this.attachPreferencesEvents(e),e.theme==="auto"&&!this.themeCleanup&&(this.themeCleanup=$(o=>{this.updateConsentTheme(o);}));}));}getCategories(){return c?this.getStoredConsent()||{...Q}:{...Q}}hasConsented(){return c?this.getStoredConsent()!==null:false}acceptAll(){if(!c)return;let e={necessary:true,analytics:true,marketing:true,preferences:true};this.saveConsent(e),this.logConsent(e,"accept_all"),this.activateScripts(e),this.hide();}rejectAll(){if(!c)return;let e={necessary:true,analytics:false,marketing:false,preferences:false};this.saveConsent(e),this.logConsent(e,"reject_all"),this.hide();}setCategories(e){if(!c)return;let n={...this.getCategories(),...e,necessary:true};this.saveConsent(n),this.logConsent(n,"customize"),this.activateScripts(n);}reset(){if(c){this.removeInjectedScripts();try{localStorage.removeItem(z);}catch{}this.events.emit("consent-changed",{...Q}),this.show();}}activateScripts(e){if(this.configCache?.thirdPartyScripts?.length)for(let[t,n]of Object.entries(e))n&&this.injectScriptsForCategory(t,this.configCache.thirdPartyScripts);}injectScriptsForCategory(e,t){for(let n of t){if(n.category!==e||this.injectedScriptIds.has(n.id))continue;this.injectedScriptIds.add(n.id);let o=document.createElement("div");o.innerHTML=n.script;let r=Array.from(o.children);for(let i=0;i<r.length;i++){let a=r[i],p=`${pe}${n.id}-${i}`;if(a.tagName==="SCRIPT"){let g=document.createElement("script");for(let u of Array.from(a.attributes))g.setAttribute(u.name,u.value);a.textContent&&(g.textContent=a.textContent),g.id=p,document.head.appendChild(g);}else a.id=p,document.body.appendChild(a);}}}removeInjectedScripts(){for(let e of this.injectedScriptIds){let t=0,n;for(;n=document.getElementById(`${pe}${e}-${t}`);)n.remove(),t++;}this.injectedScriptIds.clear();}cleanupThemeObserverIfIdle(){!this.bannerElement&&!this.preferencesElement&&(this.themeCleanup?.(),this.themeCleanup=null);}updateConsentTheme(e){let t=this.configCache?this.resolveColors(this.configCache,e):{bgColor:e==="dark"?"#18181b":"#ffffff",textColor:e==="dark"?"#f4f4f5":"#1a1a1a"},{bgColor:n,textColor:o}=t;if(this.bannerElement&&(this.bannerElement.style.background=n,this.bannerElement.style.color=o),this.preferencesElement){let r=this.preferencesElement.querySelector(":scope > div");r&&(r.style.background=n,r.style.color=o);}}resolveTheme(e){return e==="auto"?w():e==="dark"?"dark":"light"}resolveColors(e,t){if(e.themeStyles?.[t])return e.themeStyles[t];let n=t==="dark";return {primaryColor:e.primaryColor||"#0066cc",bgColor:n?"#18181b":"#ffffff",textColor:n?"#f4f4f5":"#1a1a1a"}}contrastColor(e){let t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return (.299*t+.587*n+.114*o)/255>.5?"#000000":"#ffffff"}injectBannerStylesOnce(){if(document.getElementById("lynkow-consent-styles"))return;let e=document.createElement("style");e.id="lynkow-consent-styles",e.textContent=`
1
+ 'use strict';var v=class s extends Error{name="LynkowError";code;status;details;cause;constructor(e,t,n,o,r){super(e),this.code=t,this.status=n,this.details=o,this.cause=r,Error.captureStackTrace&&Error.captureStackTrace(this,s);}static async fromResponse(e){let t=e.status,n=`HTTP ${t}`,o;try{let i=await e.json();i.errors&&Array.isArray(i.errors)?(o=i.errors,n=i.errors[0]?.message||n):i.error?n=i.error:i.message&&(n=i.message);}catch{n=e.statusText||n;}let r=s.statusToCode(t);return new s(n,r,t,o)}static fromNetworkError(e){return e.name==="AbortError"?new s("Request timed out","TIMEOUT",void 0,void 0,e):e.name==="TypeError"?new s("Network error - please check your connection","NETWORK_ERROR",void 0,void 0,e):new s(e.message||"Unknown error","UNKNOWN",void 0,void 0,e)}static statusToCode(e){switch(e){case 400:return "VALIDATION_ERROR";case 401:return "UNAUTHORIZED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 429:return "RATE_LIMITED";default:return "UNKNOWN"}}toJSON(){return {name:this.name,message:this.message,code:this.code,status:this.status,details:this.details}}};function be(s){return s instanceof v}function ke(s){switch(s){case 400:return "BAD_REQUEST";case 401:return "UNAUTHORIZED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 422:return "VALIDATION_ERROR";case 429:return "TOO_MANY_REQUESTS";case 503:return "SERVICE_UNAVAILABLE";default:return "INTERNAL_ERROR"}}async function W(s,e){let t;try{t=await fetch(s,e);}catch(a){throw new v("Network error: Unable to reach the server","NETWORK_ERROR",0,[{message:a instanceof Error?a.message:"Unknown error"}])}if(t.ok)return t.json();let n={};try{n=await t.json();}catch{}let o=ke(t.status),r=n.error||n.message||`HTTP error: ${t.status}`,i=n.errors||[{message:r}];throw new v(r,o,t.status,i)}function ie(s){let e=new URLSearchParams;for(let[t,n]of Object.entries(s))n!=null&&n!==""&&e.append(t,String(n));return e.toString()}var d={SHORT:300*1e3,MEDIUM:600*1e3,LONG:1800*1e3},m=class{config;cache;constructor(e){this.config=e,this.cache=e.cache;}buildEndpointUrl(e,t){let n=`${this.config.baseUrl}/public/${this.config.siteId}${e}`;if(t&&Object.keys(t).length>0){let o=ie(t);return `${n}?${o}`}return n}async get(e,t,n){let o=n?.locale||this.config.locale,r=o?{...t,locale:o}:t,i=this.buildEndpointUrl(e,r),a=this.mergeFetchOptions(n?.fetchOptions);return W(i,{method:"GET",...a})}async getWithCache(e,t,n,o,r=d.SHORT){return this.cache?this.cache.getOrSet(e,()=>this.get(t,n,o),r):this.get(t,n,o)}invalidateCache(e){this.cache?.invalidate(e);}async post(e,t,n){let o=this.buildEndpointUrl(e),r=this.mergeFetchOptions(n?.fetchOptions);return W(o,{method:"POST",...r,headers:{"Content-Type":"application/json",...r.headers},body:JSON.stringify(t)})}async getText(e,t){let n=this.buildEndpointUrl(e),o=this.mergeFetchOptions(t?.fetchOptions),r=await fetch(n,{method:"GET",...o});if(!r.ok)throw new Error(`HTTP error: ${r.status}`);return r.text()}mergeFetchOptions(e){return {...this.config.fetchOptions,...e,headers:{...this.config.fetchOptions.headers,...e?.headers}}}};var G="contents_",b=class extends m{async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.category&&(n.category=e.category),e?.tag&&(n.tag=e.tag),e?.search&&(n.search=e.search),e?.sort&&(n.sort=e.sort),e?.order&&(n.order=e.order),e?.locale&&(n.locale=e.locale);let o=`${G}list_${JSON.stringify(e||{})}`;return this.getWithCache(o,"/contents",n,t,d.SHORT)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${G}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/contents/slug/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(G);}};var j="categories_",k=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${j}list_${t||"default"}`;return this.getWithCache(n,"/categories",void 0,e,d.SHORT)}async tree(e){let t=e?.locale||this.config.locale,n=`${j}tree_${t||"default"}`;return this.getWithCache(n,"/categories/tree",void 0,e,d.SHORT)}async getBySlug(e,t){let n={};t?.page&&(n.page=t.page),(t?.limit??t?.perPage)&&(n.limit=t?.limit??t?.perPage);let o=`${j}slug_${e}_${JSON.stringify(t||{})}`;return this.getWithCache(o,`/categories/${encodeURIComponent(e)}`,n,t,d.SHORT)}clearCache(){this.invalidateCache(j);}};var ae="tags_",x=class extends m{async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.locale&&(n.locale=e.locale);let o=t?.locale||e?.locale||this.config.locale,r=`${ae}list_${o||"default"}_${JSON.stringify(e||{})}`;return this.getWithCache(r,"/tags",n,t,d.SHORT)}clearCache(){this.invalidateCache(ae);}};var F="pages_",R=class extends m{async list(e){let t=e?.locale||this.config.locale,n={};e?.tag&&(n.tag=e.tag);let o=`${F}list_${t||"default"}_${e?.tag||"all"}`;return this.getWithCache(o,"/pages",n,e,d.SHORT)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${F}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}async getByPath(e,t){let n=t?.locale||this.config.locale,o=`${F}path_${e}_${n||"default"}`;return (await this.getWithCache(o,"/page-by-path",{path:e},t,d.SHORT)).data}async getJsonLd(e,t){let n=t?.locale||this.config.locale,o=`${F}jsonld_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}/json-ld`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(F);}};var J="globals_",E=class extends m{async siteConfig(e){let t=e?.locale||this.config.locale,n=`${J}siteconfig_${t||"default"}`;return this.getWithCache(n,"/site-config",void 0,e,d.MEDIUM)}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${J}${e}_${n||"default"}`;return this.getWithCache(o,`/global/${encodeURIComponent(e)}`,void 0,t,d.MEDIUM)}async global(e,t){return this.getBySlug(e,t)}clearCache(){this.invalidateCache(J);}};function K(s){return {_hp:"",_ts:s}}var ce="forms_",S=class extends m{sessionStartTime;constructor(e){super(e),this.sessionStartTime=Date.now();}async getBySlug(e){let t=`${ce}${e}`;return (await this.getWithCache(t,`/forms/${encodeURIComponent(e)}`,void 0,void 0,d.MEDIUM)).data}async submit(e,t,n){let o=K(this.sessionStartTime),r={data:t,honeypot:o._hp,...o};return n?.recaptchaToken&&(r.recaptchaToken=n.recaptchaToken),(await this.post(`/forms/${encodeURIComponent(e)}/submit`,r,n)).data}clearCache(){this.invalidateCache(ce);}};var D="reviews_",T=class extends m{sessionStartTime;constructor(e){super(e),this.sessionStartTime=Date.now();}async list(e,t){let n={};e?.page&&(n.page=e.page),(e?.limit??e?.perPage)&&(n.limit=e?.limit??e?.perPage),e?.minRating&&(n.minRating=e.minRating),e?.maxRating&&(n.maxRating=e.maxRating),e?.sort&&(n.sort=e.sort),e?.order&&(n.order=e.order);let o=`${D}list_${JSON.stringify(e||{})}`;return this.getWithCache(o,"/reviews",n,t,d.SHORT)}async getBySlug(e){let t=`${D}slug_${e}`;return (await this.getWithCache(t,`/reviews/${encodeURIComponent(e)}`,void 0,void 0,d.SHORT)).data}async settings(){let e=`${D}settings`;return (await this.getWithCache(e,"/reviews/settings",void 0,void 0,d.MEDIUM)).data}async submit(e,t){let n=K(this.sessionStartTime),o={...e,...n};t?.recaptchaToken&&(o._recaptcha_token=t.recaptchaToken);let r=await this.post("/reviews",o,t);return this.invalidateCache(D),r.data}clearCache(){this.invalidateCache(D);}};var le="site_",L=class extends m{async getConfig(){let e=`${le}config`;return (await this.getWithCache(e,"/site",void 0,void 0,d.MEDIUM)).data}clearCache(){this.invalidateCache(le);}};var V="legal_",O=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${V}list_${t||"default"}`;return (await this.getWithCache(n,"/pages",{tag:"legal"},e,d.SHORT)).data}async getBySlug(e,t){let n=t?.locale||this.config.locale,o=`${V}slug_${e}_${n||"default"}`;return (await this.getWithCache(o,`/pages/${encodeURIComponent(e)}`,void 0,t,d.SHORT)).data}clearCache(){this.invalidateCache(V);}};var de="cookies_",I=class extends m{async getConfig(){let e=`${de}config`;return (await this.getWithCache(e,"/cookie-consent/config",void 0,void 0,d.MEDIUM)).data}async logConsent(e,t){return this.post("/cookie-consent/log",{preferences:e},t)}clearCache(){this.invalidateCache(de);}};var P=class extends m{async sitemap(e){return this.getText("/sitemap.xml",e)}async sitemapPart(e,t){return this.getText(`/sitemap-${e}.xml`,t)}async robots(e){return this.getText("/robots.txt",e)}async llmsTxt(e){let t=e?.locale,n=t?`/${t}/llms.txt`:"/llms.txt";return this.getText(n,e)}async llmsFullTxt(e){let t=e?.locale,n=t?`/${t}/llms-full.txt`:"/llms-full.txt";return this.getText(n,e)}async getMarkdown(e,t){let n=e.startsWith("/")?e:`/${e}`;return this.getText(`${n}.md`,t)}};var X="paths_",B=class extends m{async list(e){let t=e?.locale||this.config.locale,n=`${X}list_${t||"all"}`;return this.getWithCache(n,"/paths",void 0,e,d.SHORT)}async resolve(e,t){let n=t?.locale||this.config.locale,o=`${X}resolve_${e}_${n||"default"}`;return this.getWithCache(o,"/resolve",{path:e},t,d.SHORT)}async matchRedirect(e,t){try{return (await this.get("/redirects/match",{path:e},t)).data}catch(n){if(n instanceof v&&n.status===404)return null;throw n}}clearCache(){this.invalidateCache(X);}};var c=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xe=!c;function Re(s,e){return c?s():e}async function Ee(s,e){return c?s():e}var Y="lynkow-tracker",q=class{config;enabled=true;initialized=false;loading=false;loadPromise=null;constructor(e){this.config=e;}getTrackerUrl(){return `${this.config.baseUrl}/analytics/tracker.js`}loadTracker(){return !c||window.LynkowAnalytics?Promise.resolve():this.loadPromise?this.loadPromise:(this.loading=true,this.loadPromise=new Promise((e,t)=>{if(document.getElementById(Y)){let o=setInterval(()=>{window.LynkowAnalytics&&(clearInterval(o),this.loading=false,e());},50);setTimeout(()=>{clearInterval(o),this.loading=false,t(new Error("Tracker script load timeout"));},1e4);return}let n=document.createElement("script");n.id=Y,n.src=this.getTrackerUrl(),n.async=true,n.setAttribute("data-site-id",this.config.siteId),this.config.baseUrl&&n.setAttribute("data-api-url",this.config.baseUrl);try{let o=localStorage.getItem("_lkw_consent_mode");o&&n.setAttribute("data-consent-mode",o);}catch{}n.onload=()=>{this.loading=false,setTimeout(()=>{window.LynkowAnalytics?e():t(new Error("Tracker script loaded but LynkowAnalytics not found"));},0);},n.onerror=()=>{this.loading=false,t(new Error("Failed to load tracker script"));},document.head.appendChild(n);}),this.loadPromise)}async init(){if(!(!c||this.initialized))try{await this.loadTracker(),window.LynkowAnalytics&&!this.initialized&&(this.initialized=!0);}catch(e){console.error("[Lynkow] Failed to initialize analytics:",e);}}async trackEvent(e){!c||!this.enabled||(await this.init(),window.LynkowAnalytics&&window.LynkowAnalytics.track(e));}async trackPageview(e){!c||!this.enabled||(await this.init(),window.LynkowAnalytics&&window.LynkowAnalytics.track({type:"pageview",path:e?.path||window.location.pathname,title:e?.title||document.title,referrer:e?.referrer||document.referrer}));}enable(){this.enabled=true;}disable(){this.enabled=false;}isEnabled(){return this.enabled}isInitialized(){return this.initialized&&!!window.LynkowAnalytics}getTracker(){if(c)return window.LynkowAnalytics}destroy(){if(!c)return;document.getElementById(Y)?.remove(),this.initialized=false,this.loadPromise=null;}};function Se(s){let e=s.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(!e||(e[4]!==void 0?parseFloat(e[4]):1)===0)return null;let n=parseInt(e[1],10),o=parseInt(e[2],10),r=parseInt(e[3],10);return (.299*n+.587*o+.114*r)/255}function w(){if(!c)return "light";let s=document.documentElement,e=document.body;for(let t of [s,e])for(let n of ["data-theme","data-mode","data-color-scheme"]){let o=t.getAttribute(n)?.toLowerCase();if(o){if(o.includes("dark"))return "dark";if(o.includes("light"))return "light"}}if(s.classList.contains("dark")||e.classList.contains("dark"))return "dark";try{let t=getComputedStyle(s).colorScheme;if(t){let n=t.toLowerCase().trim();if(n.startsWith("dark"))return "dark";if(n.startsWith("light"))return "light"}}catch{}try{let t=getComputedStyle(e).backgroundColor,n=Se(t);if(n!==null)return n<.5?"dark":"light"}catch{}try{if(window.matchMedia("(prefers-color-scheme: dark)").matches)return "dark"}catch{}return "light"}function $(s){if(!c)return ()=>{};let e=w(),t=[],n=()=>{let i=w();i!==e&&(e=i,s(i));},o=new MutationObserver(n),r={attributes:true,attributeFilter:["data-theme","data-mode","data-color-scheme","class","style"]};o.observe(document.documentElement,r),o.observe(document.body,r),t.push(()=>o.disconnect());try{let i=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>n();i.addEventListener("change",a),t.push(()=>i.removeEventListener("change",a));}catch{}return ()=>t.forEach(i=>i())}var z="_lkw_consent",Te=365*24*60*60*1e3,pe="lkw-script-",Q={necessary:true,analytics:false,marketing:false,preferences:false},N=class{config;events;bannerElement=null;preferencesElement=null;configCache=null;injectedScriptIds=new Set;themeCleanup=null;constructor(e,t){this.config=e,this.events=t;}async getConfig(){if(this.configCache)return this.configCache;let e=`${this.config.baseUrl}/public/${this.config.siteId}/cookie-consent/config`,t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"},...this.config.fetchOptions});if(!t.ok)throw new Error(`Failed to fetch consent config: ${t.status}`);let n=await t.json();return this.configCache=n.data,this.configCache}async logConsent(e,t){let n=`${this.config.baseUrl}/public/${this.config.siteId}/cookie-consent/log`;await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitorId:this.getOrCreateVisitorId(),action:t||this.inferAction(e),consentGiven:e,pageUrl:c?window.location.href:void 0}),...this.config.fetchOptions}).catch(()=>{});}getOrCreateVisitorId(){if(!c)return "server";let e="_lkw_vid";try{let t=localStorage.getItem(e);return t||(t=crypto.randomUUID(),localStorage.setItem(e,t)),t}catch{return crypto.randomUUID()}}inferAction(e){let t=Object.entries(e).filter(([r])=>r!=="necessary"),n=t.every(([,r])=>r===true),o=t.every(([,r])=>r===false);return n?"accept_all":o?"reject_all":"customize"}getStoredConsent(){if(!c)return null;try{let e=localStorage.getItem(z);if(e){let t=JSON.parse(e);return t.choices?t.timestamp&&Date.now()-t.timestamp>Te?(localStorage.removeItem(z),null):t.choices:t}}catch{}return null}saveConsent(e){if(c){try{localStorage.setItem(z,JSON.stringify({choices:e,timestamp:Date.now()}));}catch{}this.events.emit("consent-changed",e),document.dispatchEvent(new CustomEvent("lynkow:consent:update",{detail:e}));}}show(){c&&this.getConfig().then(e=>{if(!e.enabled)return;try{e.consentMode&&localStorage.setItem("_lkw_consent_mode",e.consentMode);}catch{}let t=this.getStoredConsent();if(t){this.activateScripts(t);return}if(this.bannerElement)return;this.injectBannerStylesOnce();let n=document.createElement("div");n.innerHTML=this.createBannerHTML(e),this.bannerElement=n.firstElementChild,document.body.appendChild(this.bannerElement),this.attachBannerEvents(),e.theme==="auto"&&!this.themeCleanup&&(this.themeCleanup=$(o=>{this.updateConsentTheme(o);}));});}hide(){c&&(this.bannerElement?.remove(),this.bannerElement=null,this.cleanupThemeObserverIfIdle());}showPreferences(){c&&(this.preferencesElement||this.getConfig().then(e=>{let t=this.getCategories(),n=document.createElement("div");n.innerHTML=this.createPreferencesHTML(e,t),this.preferencesElement=n.firstElementChild,document.body.appendChild(this.preferencesElement),this.attachPreferencesEvents(e),e.theme==="auto"&&!this.themeCleanup&&(this.themeCleanup=$(o=>{this.updateConsentTheme(o);}));}));}getCategories(){return c?this.getStoredConsent()||{...Q}:{...Q}}hasConsented(){return c?this.getStoredConsent()!==null:false}acceptAll(){if(!c)return;let e={necessary:true,analytics:true,marketing:true,preferences:true};this.saveConsent(e),this.logConsent(e,"accept_all"),this.activateScripts(e),this.hide();}rejectAll(){if(!c)return;let e={necessary:true,analytics:false,marketing:false,preferences:false};this.saveConsent(e),this.logConsent(e,"reject_all"),this.hide();}setCategories(e){if(!c)return;let n={...this.getCategories(),...e,necessary:true};this.saveConsent(n),this.logConsent(n,"customize"),this.activateScripts(n);}reset(){if(c){this.removeInjectedScripts();try{localStorage.removeItem(z);}catch{}this.events.emit("consent-changed",{...Q}),this.show();}}activateScripts(e){if(this.configCache?.thirdPartyScripts?.length)for(let[t,n]of Object.entries(e))n&&this.injectScriptsForCategory(t,this.configCache.thirdPartyScripts);}injectScriptsForCategory(e,t){for(let n of t){if(n.category!==e||this.injectedScriptIds.has(n.id))continue;this.injectedScriptIds.add(n.id);let o=document.createElement("div");o.innerHTML=n.script;let r=Array.from(o.children);for(let i=0;i<r.length;i++){let a=r[i],p=`${pe}${n.id}-${i}`;if(a.tagName==="SCRIPT"){let g=document.createElement("script");for(let u of Array.from(a.attributes))g.setAttribute(u.name,u.value);a.textContent&&(g.textContent=a.textContent),g.id=p,document.head.appendChild(g);}else a.id=p,document.body.appendChild(a);}}}removeInjectedScripts(){for(let e of this.injectedScriptIds){let t=0,n;for(;n=document.getElementById(`${pe}${e}-${t}`);)n.remove(),t++;}this.injectedScriptIds.clear();}cleanupThemeObserverIfIdle(){!this.bannerElement&&!this.preferencesElement&&(this.themeCleanup?.(),this.themeCleanup=null);}updateConsentTheme(e){let t=this.configCache?this.resolveColors(this.configCache,e):{bgColor:e==="dark"?"#18181b":"#ffffff",textColor:e==="dark"?"#f4f4f5":"#1a1a1a"},{bgColor:n,textColor:o}=t;if(this.bannerElement&&(this.bannerElement.style.background=n,this.bannerElement.style.color=o),this.preferencesElement){let r=this.preferencesElement.querySelector(":scope > div");r&&(r.style.background=n,r.style.color=o);}}resolveTheme(e){return e==="auto"?w():e==="dark"?"dark":"light"}resolveColors(e,t){if(e.themeStyles?.[t])return e.themeStyles[t];let n=t==="dark";return {primaryColor:e.primaryColor||"#0066cc",bgColor:n?"#18181b":"#ffffff",textColor:n?"#f4f4f5":"#1a1a1a"}}contrastColor(e){let t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return (.299*t+.587*n+.114*o)/255>.5?"#000000":"#ffffff"}injectBannerStylesOnce(){if(document.getElementById("lynkow-consent-styles"))return;let e=document.createElement("style");e.id="lynkow-consent-styles",e.textContent=`
2
2
  #lynkow-consent-banner {
3
3
  box-sizing: border-box;
4
4
  max-height: calc(100vh - 40px);