@paroicms/content-loading-plugin 0.9.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeSearch = makeSearch;
4
- exports.getPartials = getPartials;
5
- exports.toNodeId = toNodeId;
6
- const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
7
- const public_anywhere_lib_1 = require("@paroicms/public-anywhere-lib");
8
- async function makeSearch(service, query, req, res) {
1
+ import { isDef } from "@paroi/data-formatters-lib";
2
+ import { parseNodelId } from "@paroicms/public-anywhere-lib";
3
+ export async function makeSearch(service, query, req, res) {
9
4
  const { q, language, limit, start, tpl } = query;
10
5
  const words = q.split(/\s+/).filter((word) => word.length >= 2);
11
6
  if (words.length === 0)
@@ -20,10 +15,10 @@ async function makeSearch(service, query, req, res) {
20
15
  templateName: tpl,
21
16
  });
22
17
  }
23
- async function getPartials(service, req, res, params, labeledById) {
18
+ export async function getPartials(service, req, res, params, labeledById) {
24
19
  const documentId = params["children-of"];
25
- const parentId = (0, public_anywhere_lib_1.parseNodelId)(documentId);
26
- const labeledByTermId = (0, data_formatters_lib_1.isDef)(labeledById) ? toNodeId(labeledById) : undefined;
20
+ const parentId = parseNodelId(documentId);
21
+ const labeledByTermId = isDef(labeledById) ? toNodeId(labeledById) : undefined;
27
22
  const payload = {
28
23
  templateName: params.templateName,
29
24
  documentId,
@@ -38,6 +33,6 @@ async function getPartials(service, req, res, params, labeledById) {
38
33
  labeledByTermId,
39
34
  });
40
35
  }
41
- function toNodeId(nodeOrNodelId) {
42
- return nodeOrNodelId.indexOf(":") !== -1 ? (0, public_anywhere_lib_1.parseNodelId)(nodeOrNodelId).nodeId : nodeOrNodelId;
36
+ export function toNodeId(nodeOrNodelId) {
37
+ return nodeOrNodelId.indexOf(":") !== -1 ? parseNodelId(nodeOrNodelId).nodeId : nodeOrNodelId;
43
38
  }
@@ -1,26 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
4
- const public_server_lib_1 = require("@paroicms/public-server-lib");
5
- const node_path_1 = require("node:path");
6
- const controller_1 = require("./controller");
7
- const projectDir = (0, node_path_1.dirname)(__dirname);
8
- const packageDir = (0, node_path_1.dirname)(projectDir);
9
- const version = (0, data_formatters_lib_1.strVal)(require((0, node_path_1.join)(packageDir, "package.json")).version);
1
+ import { strVal } from "@paroi/data-formatters-lib";
2
+ import { escapeHtml, resolveModuleDirectory, } from "@paroicms/public-server-lib";
3
+ import { readFileSync } from "node:fs";
4
+ import { dirname, join } from "node:path";
5
+ import { getPartials, makeSearch } from "./controller.js";
6
+ const projectDir = resolveModuleDirectory(import.meta.url, { parent: true });
7
+ const packageDir = dirname(projectDir);
8
+ const version = strVal(JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8")).version);
10
9
  const plugin = {
11
10
  version,
12
11
  slug: "content-loading",
13
12
  async siteInit(service) {
14
- service.setPublicAssetsDirectory((0, node_path_1.join)(packageDir, "public-front", "dist"));
15
- service.addHeadTag(`<link rel="stylesheet" href="${(0, public_server_lib_1.escapeHtml)(`${service.pluginAssetsUrl}/public-front-plugin.css`)}">`, `<script type="module" src="${(0, public_server_lib_1.escapeHtml)(`${service.pluginAssetsUrl}/public-front-plugin.mjs`)}"></script>`);
13
+ service.setPublicAssetsDirectory(join(packageDir, "public-front", "dist"));
14
+ service.addHeadTag(`<link rel="stylesheet" href="${escapeHtml(`${service.pluginAssetsUrl}/public-front-plugin.css`)}">`, `<script type="module" src="${escapeHtml(`${service.pluginAssetsUrl}/public-front-plugin.mjs`)}"></script>`);
16
15
  service.setPublicApiHandler(async (ctx, req, res, relativePath) => {
17
16
  if (relativePath === "/search") {
18
- await (0, controller_1.makeSearch)(ctx, req.query, req, res);
17
+ await makeSearch(ctx, req.query, req, res);
19
18
  return;
20
19
  }
21
20
  if (relativePath === "/partials") {
22
21
  const labeledById = req.query.labeledById;
23
- await (0, controller_1.getPartials)(ctx, req, res, req.query, labeledById);
22
+ await getPartials(ctx, req, res, req.query, labeledById);
24
23
  return;
25
24
  }
26
25
  res.append("Content-Type", "application/json; charset=utf-8");
@@ -29,4 +28,4 @@ const plugin = {
29
28
  });
30
29
  },
31
30
  };
32
- exports.default = plugin;
31
+ export default plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/content-loading-plugin",
3
- "version": "0.9.2",
3
+ "version": "0.11.0",
4
4
  "description": "Content loading plugin for ParoiCMS",
5
5
  "keywords": [
6
6
  "paroicms",
@@ -32,8 +32,9 @@
32
32
  "@paroicms/public-server-lib": "0"
33
33
  },
34
34
  "devDependencies": {
35
- "@paroicms/public-anywhere-lib": "0.14.0",
36
- "@paroicms/public-server-lib": "0.22.1",
35
+ "@paroicms/public-anywhere-lib": "0.15.0",
36
+ "@paroicms/public-server-lib": "0.23.0",
37
+ "@paroicms/tiny-modal": "0.2.0",
37
38
  "@solid-primitives/i18n": "~2.1.1",
38
39
  "@solidjs/router": "~0.14.1",
39
40
  "@types/node": "~22.10.7",
@@ -46,6 +47,7 @@
46
47
  "vite-plugin-solid": "~2.11.0",
47
48
  "terser": "~5.37.0"
48
49
  },
50
+ "type": "module",
49
51
  "main": "backend/dist/plugin.js",
50
52
  "files": [
51
53
  "backend/dist",
@@ -1 +1 @@
1
- ._SearchForm_1a5n6_1{height:40px;margin:32px 0;text-align:center}._SearchForm_1a5n6_1>input{height:100%;width:400px}._SearchForm_1a5n6_1>button{height:100%;margin-left:16px;padding:0 10px}@media screen and (max-width: 640px){._SearchForm_1a5n6_1>input{width:300px}._SearchForm_1a5n6_1>button{margin-left:0;margin-top:16px}}.SearchOpenerOverlay{background-color:#000000a1;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;transition:height .1s;width:100%;z-index:10000}.SearchOpenerOverlay-form{align-items:center;border-radius:5px;display:flex;height:55px;margin-top:150px}@media not screen and (min-width: 1023px){.SearchOpenerOverlay-form{width:90%}}.SearchOpenerOverlay-input{border:none;height:100%;padding:0 20px;width:450px}@media not (min-width: 1023px){.SearchOpenerOverlay-input{width:80%}}.SearchOpenerOverlay-btn{background-color:var(--siteAppBtnBgColor, #777);color:var(--siteAppBtnFgColor, #fff);height:100%;padding:0 20px}.SearchOpenerBtn{cursor:pointer}.SearchOpenerBtn-svg{fill:var(--siteAppBtnBgColor, #000)}
1
+ @charset "UTF-8";._SearchForm_1a5n6_1{height:40px;margin:32px 0;text-align:center}._SearchForm_1a5n6_1>input{height:100%;width:400px}._SearchForm_1a5n6_1>button{height:100%;margin-left:16px;padding:0 10px}@media screen and (max-width: 640px){._SearchForm_1a5n6_1>input{width:300px}._SearchForm_1a5n6_1>button{margin-left:0;margin-top:16px}}.TinyModal{background:transparent;border:none;margin:0;max-width:none;padding:0}.TinyModal::backdrop{background-color:transparent}.TinyModal-closeBtn{align-items:center;background-color:#bbb;border-radius:50%;cursor:pointer;display:flex;font-size:30px;font-weight:700;height:40px;justify-content:center;line-height:1;position:absolute;right:50px;top:10px;width:40px;z-index:2}.TinyModal-closeBtn:before{content:"×"}.TinyModal-closeBtn:hover,.TinyModal-closeBtn:focus{background-color:#888}.HiddenForTinyModal{display:none!important}.SearchOpener{background-color:#000000a1;display:flex;height:100%;justify-content:center;left:0;position:fixed;max-height:100vh;max-width:500px;top:0;transition:height .1s;width:100%;z-index:10000}.SearchForm{align-items:center;border-radius:5px;display:flex;height:55px;margin-top:150px}@media not screen and (min-width: 1023px){.SearchForm{width:90%}}.SearchForm-input{border:none;height:100%;padding:0 20px;width:450px}@media not (min-width: 1023px){.SearchForm-input{width:80%}}.SearchForm-btn{background-color:var(--siteAppBtnBgColor, #777);color:var(--siteAppBtnFgColor, #fff);height:100%;padding:0 20px}.SearchOpenerBtn{cursor:pointer}.SearchOpenerBtn-svg{fill:var(--siteAppBtnBgColor, #000)}
@@ -1 +1 @@
1
- import{delegateEvents as K,insert as C,setAttribute as z,template as R,isServer as N,getRequestEvent as Z,createComponent as b,memo as me,effect as k,className as ge,render as ne,use as Ve}from"https://esm.sh/solid-js@1.9.4/web";import{createMemo as A,getOwner as we,runWithOwner as ve,createContext as ye,useContext as $e,createSignal as L,createRenderEffect as Ge,on as T,startTransition as He,resetErrorBoundaries as Ke,batch as ze,untrack as be,createComponent as Je,children as Re,mergeProps as Qe,Show as F,createRoot as Xe,onCleanup as Se,sharedConfig as Q,createEffect as re}from"https://esm.sh/solid-js@1.9.4";function ee(e){return e.varName?` for '${e.varName}'`:""}function Ye(e){return!isNaN(e)&&!isNaN(parseFloat(e))}function Ze(e,t={}){if(e==null||e===""&&!t.allowEmpty)throw new Error(`Missing string value${ee(t)}`);return typeof e=="string"?e:e.toString()}function V(e,t={}){return e==null||e===""&&!t.allowEmpty?void 0:Ze(e,t)}function et(e,t={}){if(typeof e=="number")return e;if(e==null)throw new Error(`Missing number value${ee(t)}`);if(typeof e=="string"&&Ye(e))return Number(e);throw new Error(`Cannot convert to number the value of type '${typeof e}'${ee(t)}`)}function G(e,t={}){return e==null?void 0:et(e,t)}function tt(e){let t=e;const r=t.indexOf("?");r!==-1&&(t=t.substring(0,r));const o=t.indexOf("#");o!==-1&&(t=t.substring(0,o));const n=t.lastIndexOf("/");return n===-1?void 0:t.slice(0,n)}const Le="/api/plugin/content-loading",Ee=tt(import.meta.url);async function nt(e){const t=`${Le}${e}`,r=await fetch(t);if(r.status!==200)throw new Error(`api error ${r.status}`);return await r.text()}var Ce=e=>e!=null&&(e=Object.getPrototypeOf(e),e===Array.prototype||e===Object.prototype);function Ae(e,t,r){for(const[o,n]of Object.entries(t)){const a=`${r}.${o}`;e[a]=n,Ce(n)&&Ae(e,n,a)}}function rt(e){const t={...e};for(const[r,o]of Object.entries(e))Ce(o)&&Ae(t,o,r);return t}var ot=(e,t)=>{if(t)for(const[r,o]of Object.entries(t))e=e.replace(new RegExp(`{{\\s*${r}\\s*}}`,"g"),o);return e},at=e=>e;function st(e,t=at){return(r,...o)=>{r[0]==="."&&(r=r.slice(1));const n=e()?.[r];switch(typeof n){case"function":return n(...o);case"string":return t(n,o[0]);default:return n}}}const it={nothingGet:"No results found for",search:"Search"},ct={loadMore:"Load more"},lt={searchApp:it,infiniteLoading:ct},ut={nothingGet:"Aucun résultat trouvé pour",search:"Rechercher"},ft={loadMore:"Charger la suite"},dt={searchApp:ut,infiniteLoading:ft},ue={en:lt,fr:dt};function J(e){const t=A((()=>{const o=e in ue?e:"en";return rt(ue[o])}));return{t:st(t,ot)}}var ht=R("<button class=InfiniteLoading-btn type=button>"),pt=R("<div class=InfiniteLoading-actionArea>"),mt=R("<img class=InfiniteLoading-spinner width=50 height=50 alt=…>");function gt(e,{language:t}){const r=G(e.dataset.start),o=G(e.dataset.total),n=G(e.dataset.limit),a=V(e.dataset.parentId),s=V(e.dataset.template),c=V(e.dataset.labeledById);if(!(r===void 0||o===void 0||a===void 0||n===void 0||s===void 0)){if(!t)throw new Error("Missing language");wt({language:t,limit:n,parentId:a,root:e,start:r,total:o,templateName:s,labeledById:c})}}function wt({language:e,limit:t,root:r,start:o,total:n,parentId:a,templateName:s,labeledById:c}){const{t:u}=J(e);let i=o;if(i>=n)return;const f=(()=>{var v=ht();return v.$$click=w,C(v,(()=>u("infiniteLoading.loadMore"))),v})(),p=(()=>{var v=pt();return C(v,f),v})(),h=(()=>{var v=mt();return z(v,"src",`${Ee}/spinner.svg`),v})();r.appendChild(p);async function w(){r.appendChild(h);const v=await vt({limit:t,newStart:i,parentId:a,templateName:s,labeledById:c});for(const l of v)r.insertBefore(l,p);i+=t,i>=n&&p.remove(),h.remove()}}async function vt({limit:e,newStart:t,parentId:r,templateName:o,labeledById:n}){const a=n?`?labeled=${encodeURIComponent(n)}`:"",s=`/partials?templateName=${encodeURIComponent(o)}&children-of=${encodeURIComponent(r)}&start=${encodeURIComponent(t)}&limit=${encodeURIComponent(e)}${a}`,c=await nt(s),u=document.createElement("div");return u.innerHTML=c,[...u.children]}K(["click"]);function Pe(){let e=new Set;function t(n){return e.add(n),()=>e.delete(n)}let r=!1;function o(n,a){if(r)return!(r=!1);const s={to:n,options:a,defaultPrevented:!1,preventDefault:()=>s.defaultPrevented=!0};for(const c of e)c.listener({...s,from:c.location,retry:u=>{u&&(r=!0),c.navigate(n,{...a,resolve:!1})}});return!s.defaultPrevented}return{subscribe:t,confirm:o}}let te;function oe(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),te=window.history.state._depth}N||oe();function yt(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function $t(e,t){let r=!1;return()=>{const o=te;oe();const n=o==null?null:te-o;if(r){r=!1;return}n&&t(n)?(r=!0,window.history.go(-n)):e()}}const bt=/^(?:[a-z0-9]+:)?\/\//i,Rt=/^\/+|(\/)\/+$/g,_e="http://sr";function B(e,t=!1){const r=e.replace(Rt,"$1");return r?t||/^[?#]/.test(r)?r:"/"+r:""}function H(e,t,r){if(bt.test(t))return;const o=B(e),n=r&&B(r);let a="";return!n||t.startsWith("/")?a=o:n.toLowerCase().indexOf(o.toLowerCase())!==0?a=o+n:a=n,(a||"/")+B(t,!a)}function St(e,t){if(e==null)throw new Error(t);return e}function Lt(e,t){return B(e).replace(/\/*(\*.*)?$/g,"")+B(t)}function Oe(e){const t={};return e.searchParams.forEach(((r,o)=>{o in t?Array.isArray(t[o])?t[o].push(r):t[o]=[t[o],r]:t[o]=r})),t}function Et(e,t,r){const[o,n]=e.split("/*",2),a=o.split("/").filter(Boolean),s=a.length;return c=>{const u=c.split("/").filter(Boolean),i=u.length-s;if(i<0||i>0&&n===void 0&&!t)return null;const f={path:s?"":"/",params:{}},p=h=>r===void 0?void 0:r[h];for(let h=0;h<s;h++){const w=a[h],v=w[0]===":",l=v?u[h]:u[h].toLowerCase(),d=v?w.slice(1):w.toLowerCase();if(v&&X(l,p(d)))f.params[d]=l;else if(v||!X(l,d))return null;f.path+=`/${l}`}if(n){const h=i?u.slice(-i).join("/"):"";if(X(h,p(n)))f.params[n]=h;else return null}return f}}function X(e,t){const r=o=>o===e;return t===void 0?!0:typeof t=="string"?r(t):typeof t=="function"?t(e):Array.isArray(t)?t.some(r):t instanceof RegExp?t.test(e):!1}function Ct(e){const[t,r]=e.pattern.split("/*",2),o=t.split("/").filter(Boolean);return o.reduce(((n,a)=>n+(a.startsWith(":")?2:3)),o.length-(r===void 0?0:1))}function xe(e){const t=new Map,r=we();return new Proxy({},{get(o,n){return t.has(n)||ve(r,(()=>t.set(n,A((()=>e()[n]))))),t.get(n)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())}})}function Ie(e){let t=/(\/?\:[^\/]+)\?/.exec(e);if(!t)return[e];let r=e.slice(0,t.index),o=e.slice(t.index+t[0].length);const n=[r,r+=t[1]];for(;t=/^(\/\:[^\/]+)\?/.exec(o);)n.push(r+=t[1]),o=o.slice(t[0].length);return Ie(o).reduce(((a,s)=>[...a,...n.map((c=>c+s))]),[])}const At=100,Ue=ye(),Fe=ye(),ae=()=>St($e(Ue),"<A> and 'use' router primitives can be only used inside a Route."),ke=()=>ae().navigatorFactory(),Pt=()=>ae().location,_t=()=>ae().params;function Ot(e,t=""){const{component:r,preload:o,load:n,children:a,info:s}=e,c=!a||Array.isArray(a)&&!a.length,u={key:e,component:r,preload:o||n,info:s};return Me(e.path).reduce(((i,f)=>{for(const p of Ie(f)){const h=Lt(t,p);let w=c?h:h.split("/*",1)[0];w=w.split("/").map((v=>v.startsWith(":")||v.startsWith("*")?v:encodeURIComponent(v))).join("/"),i.push({...u,originalPath:f,pattern:w,matcher:Et(w,!c,e.matchFilters)})}return i}),[])}function xt(e,t=0){return{routes:e,score:Ct(e[e.length-1])*1e4-t,matcher(r){const o=[];for(let n=e.length-1;n>=0;n--){const a=e[n],s=a.matcher(r);if(!s)return null;o.unshift({...s,route:a})}return o}}}function Me(e){return Array.isArray(e)?e:[e]}function Ne(e,t="",r=[],o=[]){const n=Me(e);for(let a=0,s=n.length;a<s;a++){const c=n[a];if(c&&typeof c=="object"){c.hasOwnProperty("path")||(c.path="");const u=Ot(c,t);for(const i of u){r.push(i);const f=Array.isArray(c.children)&&c.children.length===0;if(c.children&&!f)Ne(c.children,i.pattern,r,o);else{const p=xt([...r],o.length);o.push(p)}r.pop()}}}return r.length?o:o.sort(((a,s)=>s.score-a.score))}function q(e,t){for(let r=0,o=e.length;r<o;r++){const n=e[r].matcher(t);if(n)return n}return[]}function It(e,t,r){const o=new URL(_e),n=A((f=>{const p=e();try{return new URL(p,o)}catch{return console.error(`Invalid path ${p}`),f}}),o,{equals:(f,p)=>f.href===p.href}),a=A((()=>n().pathname)),s=A((()=>n().search),!0),c=A((()=>n().hash)),u=()=>"",i=T(s,(()=>Oe(n())));return{get pathname(){return a()},get search(){return s()},get hash(){return c()},get state(){return t()},get key(){return u()},query:r?r(i):xe(i)}}let O;function Ut(){return O}function Ft(e,t,r,o={}){const{signal:[n,a],utils:s={}}=e,c=s.parsePath||(g=>g),u=s.renderPath||(g=>g),i=s.beforeLeave||Pe(),f=H("",o.base||"");if(f===void 0)throw new Error(`${f} is not a valid base path`);f&&!n().value&&a({value:f,replace:!0,scroll:!1});const[p,h]=L(!1);let w;const v=(g,y)=>{y.value===l()&&y.state===$()||(w===void 0&&h(!0),O=g,w=y,He((()=>{w===y&&(d(w.value),m(w.state),Ke(),N||_[1]([]))})).finally((()=>{w===y&&ze((()=>{O=void 0,g==="navigate"&&je(w),h(!1),w=void 0}))})))},[l,d]=L(n().value),[$,m]=L(n().state),P=It(l,$,s.queryWrapper),S=[],_=L(N?We():[]),M=A((()=>typeof o.transformUrl=="function"?q(t(),o.transformUrl(P.pathname)):q(t(),P.pathname))),se=()=>{const g=M(),y={};for(let E=0;E<g.length;E++)Object.assign(y,g[E].params);return y},Be=s.paramsWrapper?s.paramsWrapper(se,t):xe(se),ie={pattern:f,path:()=>f,outlet:()=>null,resolvePath(g){return H(f,g)}};return Ge(T(n,(g=>v("native",g)),{defer:!0})),{base:ie,location:P,params:Be,isRouting:p,renderPath:u,parsePath:c,navigatorFactory:Te,matches:M,beforeLeave:i,preloadRoute:De,singleFlight:o.singleFlight===void 0?!0:o.singleFlight,submissions:_};function qe(g,y,E){be((()=>{if(typeof y=="number"){y&&(s.go?s.go(y):console.warn("Router integration does not support relative routing"));return}const j=!y||y[0]==="?",{replace:D,resolve:x,scroll:W,state:I}={replace:!1,resolve:!j,scroll:!0,...E},U=x?g.resolvePath(y):H(j&&P.pathname||"",y);if(U===void 0)throw new Error(`Path '${y}' is not a routable path`);if(S.length>=At)throw new Error("Too many redirects");const ce=l();if(U!==ce||I!==$())if(N){const le=Z();le&&(le.response={status:302,headers:new Headers({Location:U})}),a({value:U,replace:D,scroll:W,state:I})}else i.confirm(U,E)&&(S.push({value:ce,replace:D,scroll:W,state:$()}),v("navigate",{value:U,state:I}))}))}function Te(g){return g=g||$e(Fe)||ie,(y,E)=>qe(g,y,E)}function je(g){const y=S[0];y&&(a({...g,replace:y.replace,scroll:y.scroll}),S.length=0)}function De(g,y){const E=q(t(),g.pathname),j=O;O="preload";for(let D in E){const{route:x,params:W}=E[D];x.component&&x.component.preload&&x.component.preload();const{preload:I}=x;y&&I&&ve(r(),(()=>I({params:W,location:{pathname:g.pathname,search:g.search,hash:g.hash,query:Oe(g),state:null,key:""},intent:"preload"})))}O=j}function We(){const g=Z();return g&&g.router&&g.router.submission?[g.router.submission]:[]}}function kt(e,t,r,o){const{base:n,location:a,params:s}=e,{pattern:c,component:u,preload:i}=o().route,f=A((()=>o().path));u&&u.preload&&u.preload();const p=i?i({params:s,location:a,intent:O||"initial"}):void 0;return{parent:t,pattern:c,path:f,outlet:()=>u?Je(u,{params:s,location:a,data:p,get children(){return r()}}):r(),resolvePath(w){return H(n.path(),w,f())}}}const Mt=e=>t=>{const{base:r}=t,o=Re((()=>t.children)),n=A((()=>Ne(o(),t.base||"")));let a;const s=Ft(e,n,(()=>a),{base:r,singleFlight:t.singleFlight,transformUrl:t.transformUrl});return e.create&&e.create(s),b(Ue.Provider,{value:s,get children(){return b(Nt,{routerState:s,get root(){return t.root},get preload(){return t.rootPreload||t.rootLoad},get children(){return[me((()=>(a=we())&&null)),b(Bt,{routerState:s,get branches(){return n()}})]}})}})};function Nt(e){const t=e.routerState.location,r=e.routerState.params,o=A((()=>e.preload&&be((()=>{e.preload({params:r,location:t,intent:Ut()||"initial"})}))));return b(F,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:n=>b(n,{params:r,location:t,get data(){return o()},get children(){return e.children}})})}function Bt(e){if(N){const n=Z();if(n&&n.router&&n.router.dataOnly){qt(n,e.routerState,e.branches);return}n&&((n.router||(n.router={})).matches||(n.router.matches=e.routerState.matches().map((({route:a,path:s,params:c})=>({path:a.originalPath,pattern:a.pattern,match:s,params:c,info:a.info})))))}const t=[];let r;const o=A(T(e.routerState.matches,((n,a,s)=>{let c=a&&n.length===a.length;const u=[];for(let i=0,f=n.length;i<f;i++){const p=a&&a[i],h=n[i];s&&p&&h.route.key===p.route.key?u[i]=s[i]:(c=!1,t[i]&&t[i](),Xe((w=>{t[i]=w,u[i]=kt(e.routerState,u[i-1]||e.routerState.base,fe((()=>o()[i+1])),(()=>e.routerState.matches()[i]))})))}return t.splice(n.length).forEach((i=>i())),s&&c?s:(r=u[0],u)})));return fe((()=>o()&&r))()}const fe=e=>()=>b(F,{get when(){return e()},keyed:!0,children:t=>b(Fe.Provider,{value:t,get children(){return t.outlet()}})}),Y=e=>{const t=Re((()=>e.children));return Qe(e,{get children(){return t()}})};function qt(e,t,r){const o=new URL(e.request.url),n=q(r,new URL(e.router.previousUrl||e.request.url).pathname),a=q(r,o.pathname);for(let s=0;s<a.length;s++){(!n[s]||a[s].route!==n[s].route)&&(e.router.dataOnly=!0);const{route:c,params:u}=a[s];c.preload&&c.preload({params:u,location:t.location,intent:"preload"})}}function Tt([e,t],r,o){return[e,n=>t(o(n))]}function jt(e){let t=!1;const r=n=>typeof n=="string"?{value:n}:n,o=Tt(L(r(e.get()),{equals:(n,a)=>n.value===a.value&&n.state===a.state}),void 0,(n=>(!t&&e.set(n),Q.registry&&!Q.done&&(Q.done=!0),n)));return e.init&&Se(e.init(((n=e.get())=>{t=!0,o[1](r(n)),t=!1}))),Mt({signal:o,create:e.create,utils:e.utils})}function Dt(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}function Wt(e,t){const r=e&&document.getElementById(e);r?r.scrollIntoView():t&&window.scrollTo(0,0)}const Vt=new Map;function Gt(e=!0,t=!1,r="/_server",o){return n=>{const a=n.base.path(),s=n.navigatorFactory(n.base);let c,u;function i(l){return l.namespaceURI==="http://www.w3.org/2000/svg"}function f(l){if(l.defaultPrevented||l.button!==0||l.metaKey||l.altKey||l.ctrlKey||l.shiftKey)return;const d=l.composedPath().find((M=>M instanceof Node&&M.nodeName.toUpperCase()==="A"));if(!d||t&&!d.hasAttribute("link"))return;const $=i(d),m=$?d.href.baseVal:d.href;if(($?d.target.baseVal:d.target)||!m&&!d.hasAttribute("state"))return;const S=(d.getAttribute("rel")||"").split(/\s+/);if(d.hasAttribute("download")||S&&S.includes("external"))return;const _=$?new URL(m,document.baseURI):new URL(m);if(!(_.origin!==window.location.origin||a&&_.pathname&&!_.pathname.toLowerCase().startsWith(a.toLowerCase())))return[d,_]}function p(l){const d=f(l);if(!d)return;const[$,m]=d,P=n.parsePath(m.pathname+m.search+m.hash),S=$.getAttribute("state");l.preventDefault(),s(P,{resolve:!1,replace:$.hasAttribute("replace"),scroll:!$.hasAttribute("noscroll"),state:S?JSON.parse(S):void 0})}function h(l){const d=f(l);if(!d)return;const[$,m]=d;n.preloadRoute(m,$.getAttribute("preload")!=="false")}function w(l){clearTimeout(c);const d=f(l);if(!d)return u=null;const[$,m]=d;u!==$&&(c=setTimeout((()=>{n.preloadRoute(m,$.getAttribute("preload")!=="false"),u=$}),20))}function v(l){if(l.defaultPrevented)return;let d=l.submitter&&l.submitter.hasAttribute("formaction")?l.submitter.getAttribute("formaction"):l.target.getAttribute("action");if(!d)return;if(!d.startsWith("https://action/")){const m=new URL(d,_e);if(d=n.parsePath(m.pathname+m.search),!d.startsWith(r))return}if(l.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const $=Vt.get(d);if($){l.preventDefault();const m=new FormData(l.target,l.submitter);$.call({r:n,f:l.target},l.target.enctype==="multipart/form-data"?m:new URLSearchParams(m))}}K(["click","submit"]),document.addEventListener("click",p),e&&(document.addEventListener("mousemove",w,{passive:!0}),document.addEventListener("focusin",h,{passive:!0}),document.addEventListener("touchstart",h,{passive:!0})),document.addEventListener("submit",v),Se((()=>{document.removeEventListener("click",p),e&&(document.removeEventListener("mousemove",w),document.removeEventListener("focusin",h),document.removeEventListener("touchstart",h)),document.removeEventListener("submit",v)}))}}function Ht(e){const t=e.replace(/^.*?#/,"");if(!t.startsWith("/")){const[,r="/"]=window.location.hash.split("#",2);return`${r}#${t}`}return t}function Kt(e){const t=()=>window.location.hash.slice(1),r=Pe();return jt({get:t,set({value:o,replace:n,scroll:a,state:s}){n?window.history.replaceState(yt(s),"","#"+o):window.history.pushState(s,"","#"+o);const c=o.indexOf("#"),u=c>=0?o.slice(c+1):"";Wt(u,a),oe()},init:o=>Dt(window,"hashchange",$t(o,(n=>!r.confirm(n&&n<0?n:t())))),create:Gt(e.preload,e.explicitLinks,e.actionBase),utils:{go:o=>window.history.go(o),renderPath:o=>`#${o}`,parsePath:Ht,beforeLeave:r}})(e)}function zt(e){const t=ke(),r=Pt(),{href:o,state:n}=e,a=typeof o=="function"?o({navigate:t,location:r}):o;return t(a,{replace:!0,state:n}),null}const Jt={};async function de({language:e,text:t,limit:r,start:o,templateName:n}){const a=`${Le}/search?language=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}&limit=${encodeURIComponent(r)}&start=${encodeURIComponent(o)}&tpl=${encodeURIComponent(n)}`,s=await fetch(a,{method:"GET"});if(s.status!==200){const u=await s.text();throw new Error(`API error (${s.status}): ${u}`)}return await s.json()}const Qt="_SearchForm_1a5n6_1",Xt={SearchForm:Qt};var Yt=R("<form><input type=search><button type=submit>");const Zt=e=>{const t=ke(),[r,o]=L(e.value??""),{t:n}=J(e.language);re(T((()=>e.value),(()=>o(e.value??""))));const a=async s=>{s.preventDefault(),t(`/q/${encodeURIComponent(r())}`)};return(()=>{var s=Yt(),c=s.firstChild,u=c.nextSibling;return s.addEventListener("submit",a),c.addEventListener("change",(i=>o(i.currentTarget.value))),C(u,(()=>n("searchApp.search"))),k((i=>{var f=Xt.SearchForm,p=n("searchApp.search");return f!==i.e&&ge(s,i.e=f),p!==i.t&&z(c,"placeholder",i.t=p),i}),{e:void 0,t:void 0}),k((()=>c.value=r())),s})()};var en=R("<div class=SearchPageResponse>"),he=R("<div>"),tn=R("<img class=SearchPageResponse-spinner width=80 height=80 alt=…>"),nn=R("<button type=button>"),rn=R("<div class=SearchPageResponse-noResultMessage> <span>");function pe({language:e,limit:t,templateName:r}){const{t:o}=J(e),{searchString:n}=_t(),[a,s]=L(""),[c,u]=L(0),[i,f]=L(0),[p,h]=L(!1);re(T((()=>n),w));async function w(){if(n){h(!0);try{s(""),f(0);const l=await de({language:e,text:decodeURIComponent(n),limit:t,start:i(),templateName:r});if(u(l.total),f(i()+t),!l.html)return;s(l.html)}finally{h(!1)}}}async function v(){if(!n)return;const l=c();if(l===void 0||i()>=l)return;const d=await de({language:e,text:decodeURIComponent(n),limit:t,start:i(),templateName:r});d.html&&(s(`${a()}${d.html}`),f(i()+t))}return(()=>{var l=he();return C(l,b(Zt,{language:e,get value(){return n?decodeURIComponent(n):void 0}}),null),C(l,b(F,{when:n,get children(){var d=en();return C(d,(()=>{var $=me((()=>!!p()));return()=>$()?(()=>{var m=tn();return z(m,"src",`${Ee}/spinner.svg`),m})():b(F,{get when(){return a()},get fallback(){return(()=>{var m=rn(),P=m.firstChild,S=P.nextSibling;return C(m,(()=>o("searchApp.nothingGet")),P),C(S,n),m})()},get children(){return[(()=>{var m=he();return k((()=>m.innerHTML=a())),m})(),b(F,{get when(){return i()<c()},get children(){var m=nn();return m.$$click=v,C(m,(()=>o("infiniteLoading.loadMore"))),m}})]}})})()),d}}),null),k((()=>ge(l,Jt.SiteApp))),l})()}K(["click"]);function on(e,{language:t}){if(!t)throw new Error("Missing language");const r=G(e.dataset.limit),o=V(e.dataset.template);r===void 0||o===void 0||ne((()=>b(Kt,{explicitLinks:!0,get children(){return[b(Y,{path:"/",component:()=>b(zt,{href:"/q"})}),b(Y,{path:"/q",component:()=>b(pe,{language:t,templateName:o,limit:r})}),b(Y,{path:"/q/:searchString",component:()=>b(pe,{language:t,templateName:o,limit:r})})]}})),e)}var an=R("<input class=SearchOpenerOverlay-input type=search required>"),sn=R("<div class=SearchOpenerOverlay><form class=SearchOpenerOverlay-form><button class=SearchOpenerOverlay-btn type=submit>");function cn({searchURL:e,language:t,setSearchFormOverlayIsOpen:r}){let o;const[n,a]=L(""),{t:s}=J(t),c=(()=>{var i=an();return i.addEventListener("change",(f=>a(f.currentTarget.value))),k((()=>z(i,"placeholder",s("searchApp.search")))),k((()=>i.value=n())),i})(),u=i=>{i.preventDefault(),window.location.href=`${e}#/q/${encodeURIComponent(n())}`,r(!1)};return re((()=>{c.focus()})),(()=>{var i=sn(),f=i.firstChild,p=f.firstChild;i.$$click=w=>{w.target===o&&r(!1)};var h=o;return typeof h=="function"?Ve(h,i):o=i,f.addEventListener("submit",u),C(f,c,p),C(p,(()=>s("searchApp.search"))),i})()}K(["click"]);var ln=R('<button type=button class=SearchOpenerBtn><svg class=SearchOpenerBtn-svg width=20 height=20 version=1.1 id=Capa_1 xmlns=http://www.w3.org/2000/svg viewBox="0 0 490.4 490.4"><title>Search Icon</title><g id=SVGRepo_bgCarrier stroke-width=0></g><g id=SVGRepo_tracerCarrier stroke-linecap=round stroke-linejoin=round></g><g id=SVGRepo_iconCarrier><g><path d="M484.1,454.796l-110.5-110.6c29.8-36.3,47.6-82.8,47.6-133.4c0-116.3-94.3-210.6-210.6-210.6S0,94.496,0,210.796 s94.3,210.6,210.6,210.6c50.8,0,97.4-18,133.8-48l110.5,110.5c12.9,11.8,25,4.2,29.2,0C492.5,475.596,492.5,463.096,484.1,454.796z M41.1,210.796c0-93.6,75.9-169.5,169.5-169.5s169.6,75.9,169.6,169.5s-75.9,169.5-169.5,169.5S41.1,304.396,41.1,210.796z"></path> '),un=R("<div>");function fn({searchIconColor:e,language:t,searchURL:r}){const[o,n]=L(!1),a=(()=>{var c=ln(),u=c.firstChild;return e!=null?u.style.setProperty("fill",e):u.style.removeProperty("fill"),c})(),s=un();return document.body.appendChild(s),a.addEventListener("click",(()=>n(!0))),ne((()=>b(F,{get when(){return o()},get children(){return b(cn,{searchURL:r,language:t,setSearchFormOverlayIsOpen:n})}})),s),a}function dn(e,{language:t}){const r=e.dataset.searchUrl,o=e.dataset.iconColor;if(!t)throw new Error("Missing language");if(!r)throw new Error("Missing search url");ne((()=>b(fn,{language:t,searchURL:r,searchIconColor:o})),e)}document.addEventListener("DOMContentLoaded",(()=>{const e=document.documentElement.lang,t={searchOpener:dn,searchForm:on,infiniteLoading:gt},r=document.querySelectorAll("[data-effect]");for(const o of r){const n=o.dataset.effect;if(!n)continue;const a=t[n];a&&a(o,{language:e})}}));
1
+ import{delegateEvents as te,insert as E,setAttribute as K,template as S,isServer as k,getRequestEvent as Y,createComponent as $,memo as me,effect as F,className as pe,render as ge}from"https://esm.sh/solid-js@1.9.4/web";import{createMemo as C,getOwner as we,runWithOwner as ye,createContext as ve,useContext as be,createSignal as A,createRenderEffect as He,on as B,startTransition as Ve,resetErrorBoundaries as Ge,batch as Ke,untrack as $e,createComponent as ze,children as Re,mergeProps as Je,Show as T,createRoot as Qe,onCleanup as Se,sharedConfig as J,createEffect as ne}from"https://esm.sh/solid-js@1.9.4";function Z(e){return e.varName?` for '${e.varName}'`:""}function Xe(e){return!isNaN(e)&&!isNaN(parseFloat(e))}function Ye(e,t={}){if(e==null||e===""&&!t.allowEmpty)throw new Error(`Missing string value${Z(t)}`);return typeof e=="string"?e:e.toString()}function H(e,t={}){return e==null||e===""&&!t.allowEmpty?void 0:Ye(e,t)}function Ze(e,t={}){if(typeof e=="number")return e;if(e==null)throw new Error(`Missing number value${Z(t)}`);if(typeof e=="string"&&Xe(e))return Number(e);throw new Error(`Cannot convert to number the value of type '${typeof e}'${Z(t)}`)}function V(e,t={}){return e==null?void 0:Ze(e,t)}function et(e){let t=e;const r=t.indexOf("?");r!==-1&&(t=t.substring(0,r));const o=t.indexOf("#");o!==-1&&(t=t.substring(0,o));const n=t.lastIndexOf("/");return n===-1?void 0:t.slice(0,n)}const Le="/api/plugin/content-loading",Ee=et(import.meta.url);async function tt(e){const t=`${Le}${e}`,r=await fetch(t);if(r.status!==200)throw new Error(`api error ${r.status}`);return await r.text()}var Ce=e=>e!=null&&(e=Object.getPrototypeOf(e),e===Array.prototype||e===Object.prototype);function Ae(e,t,r){for(const[o,n]of Object.entries(t)){const a=`${r}.${o}`;e[a]=n,Ce(n)&&Ae(e,n,a)}}function nt(e){const t={...e};for(const[r,o]of Object.entries(e))Ce(o)&&Ae(t,o,r);return t}var rt=(e,t)=>{if(t)for(const[r,o]of Object.entries(t))e=e.replace(new RegExp(`{{\\s*${r}\\s*}}`,"g"),o);return e},ot=e=>e;function at(e,t=ot){return(r,...o)=>{r[0]==="."&&(r=r.slice(1));const n=e()?.[r];switch(typeof n){case"function":return n(...o);case"string":return t(n,o[0]);default:return n}}}const st={nothingGet:"No results found for",search:"Search"},it={loadMore:"Load more"},ct={searchApp:st,infiniteLoading:it},lt={nothingGet:"Aucun résultat trouvé pour",search:"Rechercher"},ut={loadMore:"Charger la suite"},dt={searchApp:lt,infiniteLoading:ut},le={en:ct,fr:dt};function z(e){const t=C((()=>{const o=e in le?e:"en";return nt(le[o])}));return{t:at(t,rt)}}var ft=S("<button class=InfiniteLoading-btn type=button>"),ht=S("<div class=InfiniteLoading-actionArea>"),mt=S("<img class=InfiniteLoading-spinner width=50 height=50 alt=…>");function pt(e,{language:t}){const r=V(e.dataset.start),o=V(e.dataset.total),n=V(e.dataset.limit),a=H(e.dataset.parentId),s=H(e.dataset.template),i=H(e.dataset.labeledById);if(!(r===void 0||o===void 0||a===void 0||n===void 0||s===void 0)){if(!t)throw new Error("Missing language");gt({language:t,limit:n,parentId:a,root:e,start:r,total:o,templateName:s,labeledById:i})}}function gt({language:e,limit:t,root:r,start:o,total:n,parentId:a,templateName:s,labeledById:i}){const{t:l}=z(e);let c=o;if(c>=n)return;const d=(()=>{var y=ft();return y.$$click=g,E(y,(()=>l("infiniteLoading.loadMore"))),y})(),m=(()=>{var y=ht();return E(y,d),y})(),h=(()=>{var y=mt();return K(y,"src",`${Ee}/spinner.svg`),y})();r.appendChild(m);async function g(){r.appendChild(h);const y=await wt({limit:t,newStart:c,parentId:a,templateName:s,labeledById:i});for(const u of y)r.insertBefore(u,m);c+=t,c>=n&&m.remove(),h.remove()}}async function wt({limit:e,newStart:t,parentId:r,templateName:o,labeledById:n}){const a=n?`?labeled=${encodeURIComponent(n)}`:"",s=`/partials?templateName=${encodeURIComponent(o)}&children-of=${encodeURIComponent(r)}&start=${encodeURIComponent(t)}&limit=${encodeURIComponent(e)}${a}`,i=await tt(s),l=document.createElement("div");return l.innerHTML=i,[...l.children]}te(["click"]);function Pe(){let e=new Set;function t(n){return e.add(n),()=>e.delete(n)}let r=!1;function o(n,a){if(r)return!(r=!1);const s={to:n,options:a,defaultPrevented:!1,preventDefault:()=>s.defaultPrevented=!0};for(const i of e)i.listener({...s,from:i.location,retry:l=>{l&&(r=!0),i.navigate(n,{...a,resolve:!1})}});return!s.defaultPrevented}return{subscribe:t,confirm:o}}let ee;function re(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),ee=window.history.state._depth}k||re();function yt(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function vt(e,t){let r=!1;return()=>{const o=ee;re();const n=o==null?null:ee-o;if(r){r=!1;return}n&&t(n)?(r=!0,window.history.go(-n)):e()}}const bt=/^(?:[a-z0-9]+:)?\/\//i,$t=/^\/+|(\/)\/+$/g,_e="http://sr";function N(e,t=!1){const r=e.replace($t,"$1");return r?t||/^[?#]/.test(r)?r:"/"+r:""}function G(e,t,r){if(bt.test(t))return;const o=N(e),n=r&&N(r);let a="";return!n||t.startsWith("/")?a=o:n.toLowerCase().indexOf(o.toLowerCase())!==0?a=o+n:a=n,(a||"/")+N(t,!a)}function Rt(e,t){if(e==null)throw new Error(t);return e}function St(e,t){return N(e).replace(/\/*(\*.*)?$/g,"")+N(t)}function xe(e){const t={};return e.searchParams.forEach(((r,o)=>{o in t?Array.isArray(t[o])?t[o].push(r):t[o]=[t[o],r]:t[o]=r})),t}function Lt(e,t,r){const[o,n]=e.split("/*",2),a=o.split("/").filter(Boolean),s=a.length;return i=>{const l=i.split("/").filter(Boolean),c=l.length-s;if(c<0||c>0&&n===void 0&&!t)return null;const d={path:s?"":"/",params:{}},m=h=>r===void 0?void 0:r[h];for(let h=0;h<s;h++){const g=a[h],y=g[0]===":",u=y?l[h]:l[h].toLowerCase(),f=y?g.slice(1):g.toLowerCase();if(y&&Q(u,m(f)))d.params[f]=u;else if(y||!Q(u,f))return null;d.path+=`/${u}`}if(n){const h=c?l.slice(-c).join("/"):"";if(Q(h,m(n)))d.params[n]=h;else return null}return d}}function Q(e,t){const r=o=>o===e;return t===void 0?!0:typeof t=="string"?r(t):typeof t=="function"?t(e):Array.isArray(t)?t.some(r):t instanceof RegExp?t.test(e):!1}function Et(e){const[t,r]=e.pattern.split("/*",2),o=t.split("/").filter(Boolean);return o.reduce(((n,a)=>n+(a.startsWith(":")?2:3)),o.length-(r===void 0?0:1))}function Ue(e){const t=new Map,r=we();return new Proxy({},{get(o,n){return t.has(n)||ye(r,(()=>t.set(n,C((()=>e()[n]))))),t.get(n)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())}})}function Ie(e){let t=/(\/?\:[^\/]+)\?/.exec(e);if(!t)return[e];let r=e.slice(0,t.index),o=e.slice(t.index+t[0].length);const n=[r,r+=t[1]];for(;t=/^(\/\:[^\/]+)\?/.exec(o);)n.push(r+=t[1]),o=o.slice(t[0].length);return Ie(o).reduce(((a,s)=>[...a,...n.map((i=>i+s))]),[])}const Ct=100,Oe=ve(),Fe=ve(),oe=()=>Rt(be(Oe),"<A> and 'use' router primitives can be only used inside a Route."),Me=()=>oe().navigatorFactory(),At=()=>oe().location,Pt=()=>oe().params;function _t(e,t=""){const{component:r,preload:o,load:n,children:a,info:s}=e,i=!a||Array.isArray(a)&&!a.length,l={key:e,component:r,preload:o||n,info:s};return ke(e.path).reduce(((c,d)=>{for(const m of Ie(d)){const h=St(t,m);let g=i?h:h.split("/*",1)[0];g=g.split("/").map((y=>y.startsWith(":")||y.startsWith("*")?y:encodeURIComponent(y))).join("/"),c.push({...l,originalPath:d,pattern:g,matcher:Lt(g,!i,e.matchFilters)})}return c}),[])}function xt(e,t=0){return{routes:e,score:Et(e[e.length-1])*1e4-t,matcher(r){const o=[];for(let n=e.length-1;n>=0;n--){const a=e[n],s=a.matcher(r);if(!s)return null;o.unshift({...s,route:a})}return o}}}function ke(e){return Array.isArray(e)?e:[e]}function Te(e,t="",r=[],o=[]){const n=ke(e);for(let a=0,s=n.length;a<s;a++){const i=n[a];if(i&&typeof i=="object"){i.hasOwnProperty("path")||(i.path="");const l=_t(i,t);for(const c of l){r.push(c);const d=Array.isArray(i.children)&&i.children.length===0;if(i.children&&!d)Te(i.children,c.pattern,r,o);else{const m=xt([...r],o.length);o.push(m)}r.pop()}}}return r.length?o:o.sort(((a,s)=>s.score-a.score))}function q(e,t){for(let r=0,o=e.length;r<o;r++){const n=e[r].matcher(t);if(n)return n}return[]}function Ut(e,t,r){const o=new URL(_e),n=C((d=>{const m=e();try{return new URL(m,o)}catch{return console.error(`Invalid path ${m}`),d}}),o,{equals:(d,m)=>d.href===m.href}),a=C((()=>n().pathname)),s=C((()=>n().search),!0),i=C((()=>n().hash)),l=()=>"",c=B(s,(()=>xe(n())));return{get pathname(){return a()},get search(){return s()},get hash(){return i()},get state(){return t()},get key(){return l()},query:r?r(c):Ue(c)}}let x;function It(){return x}function Ot(e,t,r,o={}){const{signal:[n,a],utils:s={}}=e,i=s.parsePath||(w=>w),l=s.renderPath||(w=>w),c=s.beforeLeave||Pe(),d=G("",o.base||"");if(d===void 0)throw new Error(`${d} is not a valid base path`);d&&!n().value&&a({value:d,replace:!0,scroll:!1});const[m,h]=A(!1);let g;const y=(w,v)=>{v.value===u()&&v.state===b()||(g===void 0&&h(!0),x=w,g=v,Ve((()=>{g===v&&(f(g.value),p(g.state),Ge(),k||_[1]([]))})).finally((()=>{g===v&&Ke((()=>{x=void 0,w==="navigate"&&je(g),h(!1),g=void 0}))})))},[u,f]=A(n().value),[b,p]=A(n().state),P=Ut(u,b,s.queryWrapper),R=[],_=A(k?We():[]),M=C((()=>typeof o.transformUrl=="function"?q(t(),o.transformUrl(P.pathname)):q(t(),P.pathname))),ae=()=>{const w=M(),v={};for(let L=0;L<w.length;L++)Object.assign(v,w[L].params);return v},Ne=s.paramsWrapper?s.paramsWrapper(ae,t):Ue(ae),se={pattern:d,path:()=>d,outlet:()=>null,resolvePath(w){return G(d,w)}};return He(B(n,(w=>y("native",w)),{defer:!0})),{base:se,location:P,params:Ne,isRouting:m,renderPath:l,parsePath:i,navigatorFactory:Be,matches:M,beforeLeave:c,preloadRoute:De,singleFlight:o.singleFlight===void 0?!0:o.singleFlight,submissions:_};function qe(w,v,L){$e((()=>{if(typeof v=="number"){v&&(s.go?s.go(v):console.warn("Router integration does not support relative routing"));return}const j=!v||v[0]==="?",{replace:D,resolve:U,scroll:W,state:I}={replace:!1,resolve:!j,scroll:!0,...L},O=U?w.resolvePath(v):G(j&&P.pathname||"",v);if(O===void 0)throw new Error(`Path '${v}' is not a routable path`);if(R.length>=Ct)throw new Error("Too many redirects");const ie=u();if(O!==ie||I!==b())if(k){const ce=Y();ce&&(ce.response={status:302,headers:new Headers({Location:O})}),a({value:O,replace:D,scroll:W,state:I})}else c.confirm(O,L)&&(R.push({value:ie,replace:D,scroll:W,state:b()}),y("navigate",{value:O,state:I}))}))}function Be(w){return w=w||be(Fe)||se,(v,L)=>qe(w,v,L)}function je(w){const v=R[0];v&&(a({...w,replace:v.replace,scroll:v.scroll}),R.length=0)}function De(w,v){const L=q(t(),w.pathname),j=x;x="preload";for(let D in L){const{route:U,params:W}=L[D];U.component&&U.component.preload&&U.component.preload();const{preload:I}=U;v&&I&&ye(r(),(()=>I({params:W,location:{pathname:w.pathname,search:w.search,hash:w.hash,query:xe(w),state:null,key:""},intent:"preload"})))}x=j}function We(){const w=Y();return w&&w.router&&w.router.submission?[w.router.submission]:[]}}function Ft(e,t,r,o){const{base:n,location:a,params:s}=e,{pattern:i,component:l,preload:c}=o().route,d=C((()=>o().path));l&&l.preload&&l.preload();const m=c?c({params:s,location:a,intent:x||"initial"}):void 0;return{parent:t,pattern:i,path:d,outlet:()=>l?ze(l,{params:s,location:a,data:m,get children(){return r()}}):r(),resolvePath(g){return G(n.path(),g,d())}}}const Mt=e=>t=>{const{base:r}=t,o=Re((()=>t.children)),n=C((()=>Te(o(),t.base||"")));let a;const s=Ot(e,n,(()=>a),{base:r,singleFlight:t.singleFlight,transformUrl:t.transformUrl});return e.create&&e.create(s),$(Oe.Provider,{value:s,get children(){return $(kt,{routerState:s,get root(){return t.root},get preload(){return t.rootPreload||t.rootLoad},get children(){return[me((()=>(a=we())&&null)),$(Tt,{routerState:s,get branches(){return n()}})]}})}})};function kt(e){const t=e.routerState.location,r=e.routerState.params,o=C((()=>e.preload&&$e((()=>{e.preload({params:r,location:t,intent:It()||"initial"})}))));return $(T,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:n=>$(n,{params:r,location:t,get data(){return o()},get children(){return e.children}})})}function Tt(e){if(k){const n=Y();if(n&&n.router&&n.router.dataOnly){Nt(n,e.routerState,e.branches);return}n&&((n.router||(n.router={})).matches||(n.router.matches=e.routerState.matches().map((({route:a,path:s,params:i})=>({path:a.originalPath,pattern:a.pattern,match:s,params:i,info:a.info})))))}const t=[];let r;const o=C(B(e.routerState.matches,((n,a,s)=>{let i=a&&n.length===a.length;const l=[];for(let c=0,d=n.length;c<d;c++){const m=a&&a[c],h=n[c];s&&m&&h.route.key===m.route.key?l[c]=s[c]:(i=!1,t[c]&&t[c](),Qe((g=>{t[c]=g,l[c]=Ft(e.routerState,l[c-1]||e.routerState.base,ue((()=>o()[c+1])),(()=>e.routerState.matches()[c]))})))}return t.splice(n.length).forEach((c=>c())),s&&i?s:(r=l[0],l)})));return ue((()=>o()&&r))()}const ue=e=>()=>$(T,{get when(){return e()},keyed:!0,children:t=>$(Fe.Provider,{value:t,get children(){return t.outlet()}})}),X=e=>{const t=Re((()=>e.children));return Je(e,{get children(){return t()}})};function Nt(e,t,r){const o=new URL(e.request.url),n=q(r,new URL(e.router.previousUrl||e.request.url).pathname),a=q(r,o.pathname);for(let s=0;s<a.length;s++){(!n[s]||a[s].route!==n[s].route)&&(e.router.dataOnly=!0);const{route:i,params:l}=a[s];i.preload&&i.preload({params:l,location:t.location,intent:"preload"})}}function qt([e,t],r,o){return[e,n=>t(o(n))]}function Bt(e){let t=!1;const r=n=>typeof n=="string"?{value:n}:n,o=qt(A(r(e.get()),{equals:(n,a)=>n.value===a.value&&n.state===a.state}),void 0,(n=>(!t&&e.set(n),J.registry&&!J.done&&(J.done=!0),n)));return e.init&&Se(e.init(((n=e.get())=>{t=!0,o[1](r(n)),t=!1}))),Mt({signal:o,create:e.create,utils:e.utils})}function jt(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}function Dt(e,t){const r=e&&document.getElementById(e);r?r.scrollIntoView():t&&window.scrollTo(0,0)}const Wt=new Map;function Ht(e=!0,t=!1,r="/_server",o){return n=>{const a=n.base.path(),s=n.navigatorFactory(n.base);let i,l;function c(u){return u.namespaceURI==="http://www.w3.org/2000/svg"}function d(u){if(u.defaultPrevented||u.button!==0||u.metaKey||u.altKey||u.ctrlKey||u.shiftKey)return;const f=u.composedPath().find((M=>M instanceof Node&&M.nodeName.toUpperCase()==="A"));if(!f||t&&!f.hasAttribute("link"))return;const b=c(f),p=b?f.href.baseVal:f.href;if((b?f.target.baseVal:f.target)||!p&&!f.hasAttribute("state"))return;const R=(f.getAttribute("rel")||"").split(/\s+/);if(f.hasAttribute("download")||R&&R.includes("external"))return;const _=b?new URL(p,document.baseURI):new URL(p);if(!(_.origin!==window.location.origin||a&&_.pathname&&!_.pathname.toLowerCase().startsWith(a.toLowerCase())))return[f,_]}function m(u){const f=d(u);if(!f)return;const[b,p]=f,P=n.parsePath(p.pathname+p.search+p.hash),R=b.getAttribute("state");u.preventDefault(),s(P,{resolve:!1,replace:b.hasAttribute("replace"),scroll:!b.hasAttribute("noscroll"),state:R?JSON.parse(R):void 0})}function h(u){const f=d(u);if(!f)return;const[b,p]=f;n.preloadRoute(p,b.getAttribute("preload")!=="false")}function g(u){clearTimeout(i);const f=d(u);if(!f)return l=null;const[b,p]=f;l!==b&&(i=setTimeout((()=>{n.preloadRoute(p,b.getAttribute("preload")!=="false"),l=b}),20))}function y(u){if(u.defaultPrevented)return;let f=u.submitter&&u.submitter.hasAttribute("formaction")?u.submitter.getAttribute("formaction"):u.target.getAttribute("action");if(!f)return;if(!f.startsWith("https://action/")){const p=new URL(f,_e);if(f=n.parsePath(p.pathname+p.search),!f.startsWith(r))return}if(u.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const b=Wt.get(f);if(b){u.preventDefault();const p=new FormData(u.target,u.submitter);b.call({r:n,f:u.target},u.target.enctype==="multipart/form-data"?p:new URLSearchParams(p))}}te(["click","submit"]),document.addEventListener("click",m),e&&(document.addEventListener("mousemove",g,{passive:!0}),document.addEventListener("focusin",h,{passive:!0}),document.addEventListener("touchstart",h,{passive:!0})),document.addEventListener("submit",y),Se((()=>{document.removeEventListener("click",m),e&&(document.removeEventListener("mousemove",g),document.removeEventListener("focusin",h),document.removeEventListener("touchstart",h)),document.removeEventListener("submit",y)}))}}function Vt(e){const t=e.replace(/^.*?#/,"");if(!t.startsWith("/")){const[,r="/"]=window.location.hash.split("#",2);return`${r}#${t}`}return t}function Gt(e){const t=()=>window.location.hash.slice(1),r=Pe();return Bt({get:t,set({value:o,replace:n,scroll:a,state:s}){n?window.history.replaceState(yt(s),"","#"+o):window.history.pushState(s,"","#"+o);const i=o.indexOf("#"),l=i>=0?o.slice(i+1):"";Dt(l,a),re()},init:o=>jt(window,"hashchange",vt(o,(n=>!r.confirm(n&&n<0?n:t())))),create:Ht(e.preload,e.explicitLinks,e.actionBase),utils:{go:o=>window.history.go(o),renderPath:o=>`#${o}`,parsePath:Vt,beforeLeave:r}})(e)}function Kt(e){const t=Me(),r=At(),{href:o,state:n}=e,a=typeof o=="function"?o({navigate:t,location:r}):o;return t(a,{replace:!0,state:n}),null}const zt={};async function de({language:e,text:t,limit:r,start:o,templateName:n}){const a=`${Le}/search?language=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}&limit=${encodeURIComponent(r)}&start=${encodeURIComponent(o)}&tpl=${encodeURIComponent(n)}`,s=await fetch(a,{method:"GET"});if(s.status!==200){const l=await s.text();throw new Error(`API error (${s.status}): ${l}`)}return await s.json()}const Jt="_SearchForm_1a5n6_1",Qt={SearchForm:Jt};var Xt=S("<form><input type=search><button type=submit>");const Yt=e=>{const t=Me(),[r,o]=A(e.value??""),{t:n}=z(e.language);ne(B((()=>e.value),(()=>o(e.value??""))));const a=async s=>{s.preventDefault(),t(`/q/${encodeURIComponent(r())}`)};return(()=>{var s=Xt(),i=s.firstChild,l=i.nextSibling;return s.addEventListener("submit",a),i.addEventListener("change",(c=>o(c.currentTarget.value))),E(l,(()=>n("searchApp.search"))),F((c=>{var d=Qt.SearchForm,m=n("searchApp.search");return d!==c.e&&pe(s,c.e=d),m!==c.t&&K(i,"placeholder",c.t=m),c}),{e:void 0,t:void 0}),F((()=>i.value=r())),s})()};var Zt=S("<div class=SearchPageResponse>"),fe=S("<div>"),en=S("<img class=SearchPageResponse-spinner width=80 height=80 alt=…>"),tn=S("<button type=button>"),nn=S("<div class=SearchPageResponse-noResultMessage> <span>");function he({language:e,limit:t,templateName:r}){const{t:o}=z(e),{searchString:n}=Pt(),[a,s]=A(""),[i,l]=A(0),[c,d]=A(0),[m,h]=A(!1);ne(B((()=>n),g));async function g(){if(n){h(!0);try{s(""),d(0);const u=await de({language:e,text:decodeURIComponent(n),limit:t,start:c(),templateName:r});if(l(u.total),d(c()+t),!u.html)return;s(u.html)}finally{h(!1)}}}async function y(){if(!n)return;const u=i();if(u===void 0||c()>=u)return;const f=await de({language:e,text:decodeURIComponent(n),limit:t,start:c(),templateName:r});f.html&&(s(`${a()}${f.html}`),d(c()+t))}return(()=>{var u=fe();return E(u,$(Yt,{language:e,get value(){return n?decodeURIComponent(n):void 0}}),null),E(u,$(T,{when:n,get children(){var f=Zt();return E(f,(()=>{var b=me((()=>!!m()));return()=>b()?(()=>{var p=en();return K(p,"src",`${Ee}/spinner.svg`),p})():$(T,{get when(){return a()},get fallback(){return(()=>{var p=nn(),P=p.firstChild,R=P.nextSibling;return E(p,(()=>o("searchApp.nothingGet")),P),E(R,n),p})()},get children(){return[(()=>{var p=fe();return F((()=>p.innerHTML=a())),p})(),$(T,{get when(){return c()<i()},get children(){var p=tn();return p.$$click=y,E(p,(()=>o("infiniteLoading.loadMore"))),p}})]}})})()),f}}),null),F((()=>pe(u,zt.SiteApp))),u})()}te(["click"]);function rn(e,{language:t}){if(!t)throw new Error("Missing language");const r=V(e.dataset.limit),o=H(e.dataset.template);r===void 0||o===void 0||ge((()=>$(Gt,{explicitLinks:!0,get children(){return[$(X,{path:"/",component:()=>$(Kt,{href:"/q"})}),$(X,{path:"/q",component:()=>$(he,{language:t,templateName:o,limit:r})}),$(X,{path:"/q/:searchString",component:()=>$(he,{language:t,templateName:o,limit:r})})]}})),e)}function on({openButton:e,dialogContent:t}){const r=e?typeof e=="string"?document.querySelector(e):e:void 0,o=typeof t=="string"?document.querySelector(t):t;if(!o)return;o instanceof HTMLTemplateElement||o.classList.remove("HiddenForTinyModal");const n=document.createElement("dialog");n.classList.add("TinyModal");const a=document.createElement("button");a.classList.add("TinyModal-closeBtn"),n.appendChild(a);const s=document.createElement("div");s.classList.add("TinyModal-wrapper"),s.appendChild(o instanceof HTMLTemplateElement?o.content.cloneNode(!0):o),n.appendChild(s),document.body.appendChild(n);const i=new Map;function l(h,g){i.has(h)||i.set(h,[]),i.get(h)?.push(g)}function c(h){i.has(h)&&i.get(h)?.forEach((g=>g()))}function d(){n.showModal(),document.body.style.overflow="hidden",c("open")}function m(){n.close()}return r?.addEventListener("click",d),a.addEventListener("click",m),n.addEventListener("close",(()=>{document.body.style.overflow="",c("close")})),{open:d,close:m,on:l}}var an=S("<input class=SearchForm-input type=search required>"),sn=S("<div class=SearchOpener><form class=SearchForm><button class=SearchForm-btn type=submit>");function cn({searchURL:e,language:t}){const[r,o]=A(""),{t:n}=z(t),a=(()=>{var i=an();return i.addEventListener("change",(l=>o(l.currentTarget.value))),F((()=>K(i,"placeholder",n("searchApp.search")))),F((()=>i.value=r())),i})(),s=i=>{i.preventDefault(),window.location.href=`${e}#/q/${encodeURIComponent(r())}`};return ne((()=>{a.focus()})),(()=>{var i=sn(),l=i.firstChild,c=l.firstChild;return l.addEventListener("submit",s),E(l,a,c),E(c,(()=>n("searchApp.search"))),i})()}var ln=S('<button type=button class=SearchOpenerBtn><svg class=SearchOpenerBtn-svg width=20 height=20 version=1.1 id=Capa_1 xmlns=http://www.w3.org/2000/svg viewBox="0 0 490.4 490.4"><title>Search Icon</title><g id=SVGRepo_bgCarrier stroke-width=0></g><g id=SVGRepo_tracerCarrier stroke-linecap=round stroke-linejoin=round></g><g id=SVGRepo_iconCarrier><g><path d="M484.1,454.796l-110.5-110.6c29.8-36.3,47.6-82.8,47.6-133.4c0-116.3-94.3-210.6-210.6-210.6S0,94.496,0,210.796 s94.3,210.6,210.6,210.6c50.8,0,97.4-18,133.8-48l110.5,110.5c12.9,11.8,25,4.2,29.2,0C492.5,475.596,492.5,463.096,484.1,454.796z M41.1,210.796c0-93.6,75.9-169.5,169.5-169.5s169.6,75.9,169.6,169.5s-75.9,169.5-169.5,169.5S41.1,304.396,41.1,210.796z"></path> ');function un({searchIconColor:e,language:t,searchURL:r}){const o=(()=>{var a=ln(),s=a.firstChild;return e!=null?s.style.setProperty("fill",e):s.style.removeProperty("fill"),a})(),n=$(cn,{searchURL:r,language:t});return on({openButton:o,dialogContent:n}),o}function dn(e,{language:t}){const r=e.dataset.searchUrl,o=e.dataset.iconColor;if(!t)throw new Error("Missing language");if(!r)throw new Error("Missing search url");ge((()=>$(un,{language:t,searchURL:r,searchIconColor:o})),e)}document.addEventListener("DOMContentLoaded",(()=>{const e=document.documentElement.lang,t={searchOpener:dn,searchForm:rn,infiniteLoading:pt},r=document.querySelectorAll("[data-effect]");for(const o of r){const n=o.dataset.effect;if(!n)continue;const a=t[n];a&&a(o,{language:e})}}));