tosijs-ui 1.14.2 → 1.14.3
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/CHANGELOG.md +31 -0
- package/dist/iife.js +3 -3
- package/dist/iife.js.map +3 -3
- package/dist/live-example/code-transform.d.ts +1 -1
- package/dist/live-example/code-transform.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/llms.txt +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.14.3
|
|
4
|
+
|
|
5
|
+
A single-fix patch cut from `v1.14.2`. Carries no 1.15.0 work.
|
|
6
|
+
|
|
7
|
+
### tjs-lang 0.13.13 — a quoted test block was executed in the HOST page (#135)
|
|
8
|
+
|
|
9
|
+
On tjs-lang ≤ 0.13.11, a `test '…' { … }` written inside a template literal or a
|
|
10
|
+
double-quoted string was mistaken for a real test block: the body ran at transpile time and
|
|
11
|
+
the text was **deleted from the output**. Both silent.
|
|
12
|
+
|
|
13
|
+
That is the bad case for a doc site specifically, because documentation about a language
|
|
14
|
+
quotes the language. `transform()` is called from the component — the **host page** — and its
|
|
15
|
+
output is then injected into the iframe, so anything the transpiler executes at transpile time
|
|
16
|
+
runs outside the sandbox that exists for exactly this. Any tjs example *showing* a test block
|
|
17
|
+
had it deleted from the rendered example and executed in the host page. Upstream lost 52 of 99
|
|
18
|
+
failures in their own conversion gate to it before finding the cause.
|
|
19
|
+
|
|
20
|
+
Fixed in 0.13.12; this moves to **0.13.13** (latest), verified across all four lanes rather
|
|
21
|
+
than on the release note alone. 0.13.5–0.13.13 also carry the AJS/TJS parser split, a
|
|
22
|
+
prototype-chain lookup fix in the VM, a source-size cap on `Eval`/`SafeFunction`, and further
|
|
23
|
+
literal-blindness fixes.
|
|
24
|
+
|
|
25
|
+
The pin lives in **two** places by design — `package.json` and `TJS_VERSION` in
|
|
26
|
+
`code-transform.ts`, which governs the CDN bundle a doc site actually loads — and both moved
|
|
27
|
+
together. The peer floor is unchanged at `^0.13.1`: raising it would warn on install for
|
|
28
|
+
people whose own pin is older, and the CDN pin is what fixes the behaviour on the default
|
|
29
|
+
path. **If you install tjs-lang yourself, upgrade to ≥0.13.12** — your copy wins over ours.
|
|
30
|
+
|
|
31
|
+
Reported by tjs-lang, which was blocked on this while moving its playground onto the doc-site
|
|
32
|
+
system. Released as a patch so nobody waits for 1.15.0 for it.
|
|
33
|
+
|
|
3
34
|
## 1.14.2
|
|
4
35
|
|
|
5
36
|
A single-fix patch, cut from `v1.14.1` rather than from `main`, so it carries none of the
|
package/dist/iife.js
CHANGED
|
@@ -149,7 +149,7 @@ ${e}</tr>
|
|
|
149
149
|
`+this.renderer.text(a);i?s+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):s+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw Error(a)}}}return s}parseInline(t,i=this.renderer){let s="";for(let n=0;n<t.length;n++){let r=t[n];if(this.options.extensions?.renderers?.[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){s+=a||"";continue}}let o=r;switch(o.type){case"escape":{s+=i.text(o);break}case"html":{s+=i.html(o);break}case"link":{s+=i.link(o);break}case"image":{s+=i.image(o);break}case"strong":{s+=i.strong(o);break}case"em":{s+=i.em(o);break}case"codespan":{s+=i.codespan(o);break}case"br":{s+=i.br(o);break}case"del":{s+=i.del(o);break}case"text":{s+=i.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw Error(a)}}}return s}},nl=class{options;block;constructor(e){this.options=e||kr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?as.lex:as.lexInline}provideParser(){return this.block?ls.parse:ls.parseInline}},uu=class{defaults=Vm();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ls;Renderer=ko;TextRenderer=Um;Lexer=as;Tokenizer=lu;Hooks=nl;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(let s of e)switch(i=i.concat(t.call(this,s)),s.type){case"table":{let n=s;for(let r of n.header)i=i.concat(this.walkTokens(r.tokens,t));for(let r of n.rows)for(let o of r)i=i.concat(this.walkTokens(o.tokens,t));break}case"list":{let n=s;i=i.concat(this.walkTokens(n.items,t));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach((r)=>{let o=n[r].flat(1/0);i=i.concat(this.walkTokens(o,t))}):n.tokens&&(i=i.concat(this.walkTokens(n.tokens,t)))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((i)=>{let s={...i};if(s.async=this.defaults.async||s.async||!1,i.extensions&&(i.extensions.forEach((n)=>{if(!n.name)throw Error("extension name required");if("renderer"in n){let r=t.renderers[n.name];r?t.renderers[n.name]=function(...o){let a=n.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let r=t[n.level];r?r.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),s.extensions=t),i.renderer){let n=this.defaults.renderer||new ko(this.defaults);for(let r in i.renderer){if(!(r in n))throw Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=i.renderer[o],l=n[o];n[o]=(...c)=>{let h=a.apply(n,c);return h===!1&&(h=l.apply(n,c)),h||""}}s.renderer=n}if(i.tokenizer){let n=this.defaults.tokenizer||new lu(this.defaults);for(let r in i.tokenizer){if(!(r in n))throw Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=i.tokenizer[o],l=n[o];n[o]=(...c)=>{let h=a.apply(n,c);return h===!1&&(h=l.apply(n,c)),h}}s.tokenizer=n}if(i.hooks){let n=this.defaults.hooks||new nl;for(let r in i.hooks){if(!(r in n))throw Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=i.hooks[o],l=n[o];nl.passThroughHooks.has(r)?n[o]=(c)=>{if(this.defaults.async&&nl.passThroughHooksRespectAsync.has(r))return(async()=>{let u=await a.call(n,c);return l.call(n,u)})();let h=a.call(n,c);return l.call(n,h)}:n[o]=(...c)=>{if(this.defaults.async)return(async()=>{let u=await a.apply(n,c);return u===!1&&(u=await l.apply(n,c)),u})();let h=a.apply(n,c);return h===!1&&(h=l.apply(n,c)),h}}s.hooks=n}if(i.walkTokens){let n=this.defaults.walkTokens,r=i.walkTokens;s.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),n&&(a=a.concat(n.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return as.lex(e,t??this.defaults)}parser(e,t){return ls.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let s={...i},n={...this.defaults,...s},r=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return r(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return r(Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return r(Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=e),n.async)return(async()=>{let o=n.hooks?await n.hooks.preprocess(t):t,a=await(n.hooks?await n.hooks.provideLexer():e?as.lex:as.lexInline)(o,n),l=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(l,n.walkTokens));let c=await(n.hooks?await n.hooks.provideParser():e?ls.parse:ls.parseInline)(l,n);return n.hooks?await n.hooks.postprocess(c):c})().catch(r);try{n.hooks&&(t=n.hooks.preprocess(t));let o=(n.hooks?n.hooks.provideLexer():e?as.lex:as.lexInline)(t,n);n.hooks&&(o=n.hooks.processAllTokens(o)),n.walkTokens&&this.walkTokens(o,n.walkTokens);let a=(n.hooks?n.hooks.provideParser():e?ls.parse:ls.parseInline)(o,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(e,t){return(i)=>{if(i.message+=`
|
|
150
150
|
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Bs(i.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(i);throw i}}},wr=new uu;function Ae(e,t){return wr.parse(e,t)}Ae.options=Ae.setOptions=function(e){return wr.setOptions(e),Ae.defaults=wr.defaults,w2(Ae.defaults),Ae};Ae.getDefaults=Vm;Ae.defaults=kr;Ae.use=function(...e){return wr.use(...e),Ae.defaults=wr.defaults,w2(Ae.defaults),Ae};Ae.walkTokens=function(e,t){return wr.walkTokens(e,t)};Ae.parseInline=wr.parseInline;Ae.Parser=ls;Ae.parser=ls.parse;Ae.Renderer=ko;Ae.TextRenderer=Um;Ae.Lexer=as;Ae.lexer=as.lex;Ae.Tokenizer=lu;Ae.Hooks=nl;Ae.parse=Ae;var{options:hq,setOptions:uq,use:dq,walkTokens:fq,parseInline:pq}=Ae;var mq=ls.parse,gq=as.lex;function _2(e,t){if(t==null)t="";else if(typeof t!=="string")t=String(t);return t.replace(/\{\{([^}]+)\}\}/g,(i,s)=>{let n=rt[`${e}${s.startsWith("[")?s:"."+s}`];return n===void 0?i:_2(e,String(n))})}class du extends R{static preferredTagName="tosi-md";static initAttributes={src:"",elements:!1};context={};value="";content=null;options={};connectedCallback(){if(super.connectedCallback(),this.src!=="")(async()=>{let e=await fetch(this.src);this.value=await e.text()})();else if(this.value==="")if(this.elements)this.value=this.innerHTML;else this.value=this.textContent!=null?this.textContent:""}didRender=()=>{};render(){super.render(),rt[this.instanceId]=typeof this.context==="string"?JSON.parse(this.context):this.context;let e=_2(this.instanceId,this.value);if(this.elements){let t=e.split(`
|
|
151
151
|
`).reduce((i,s)=>{if(s.startsWith("<")||i.length===0)i.push(s);else{let n=i[i.length-1];if(!n.startsWith("<")||!n.endsWith(">"))i[i.length-1]+=`
|
|
152
|
-
`+s;else i.push(s)}return i},[]);this.innerHTML=t.map((i)=>i.startsWith("<")&&i.endsWith(">")?i:Ae(i,this.options)).join("")}else this.innerHTML=Ae(e,this.options);this.didRender()}}var lQ=du,Gm=du.elementCreator(),cQ=Gm,hQ=Gm;var{div:Km,span:fu,button:Jm}=L,al=86400000,uQ=[0,1,2,3,4,5,6],dQ=[1,2,3,4,5,6,7,8,9,10,11,12],eg=(e,t=2,i="0")=>String(e).padStart(t,i),ll=(e,t,i)=>new Date(`${e}-${eg(t)}-${eg(i)}`);class tg extends R{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:w.disabledOpacity(0.6)},':host [part="month"], :host [part="year"]':{_fieldWidth:"4em",flex:"1"},":host [part=week], :host [part=days]":{display:"grid",gridTemplateColumns:"auto auto auto auto auto auto auto",justifyItems:"stretch"},":host .today":{background:w.monthTodayBackground("transparent"),boxShadow:w.monthTodayShadow("none"),backdropFilter:w.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:w.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:w.monthDayColor("hotpink"),background:w.monthDayBackground("white"),fontWeight:w.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:w.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:w.monthDateCheckedColor("white"),background:w.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:w.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:w.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:w.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:w.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:w.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:ll(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:ll(new Date().getFullYear()+10,12,31).toISOString().split("T")[0],selectable:!1,multiple:!1,range:!1,disabled:!1,readonly:!1,required:!1,name:""};selectedDays=[];value="";formDisabledCallback(e){this.disabled=e}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return dQ.map((e)=>({caption:ll(2025,e,1).toString().split(" ")[1],value:String(e)}))}get years(){let e=Number(this.minDate.split("-")[0]),t=Number(this.maxDate.split("-")[0]),i=[];for(let s=e;s<=t;s++)i.push(String(s));return i}monthChanged=(e,t)=>{};gotoMonth(e,t){if(this.month!==t||this.year!==e)this.month=t,this.year=e,this.monthChanged(e,t)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(e){this.selectedDays[1]=e,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(e){this.selectedDays[0]=e,this.selectedDays.splice(2)}clickDate=(e)=>{let t=e.target.getAttribute("title");this.selectDate(t)};keyDate=(e)=>{let t=!1;switch(e.code){case"Space":{let i=e.target.getAttribute("title");this.selectDate(i),t=!0;break}case"Tab":break;default:console.log(e)}if(t)e.preventDefault(),e.stopPropagation()};#e="";selectDate=(e)=>{if(this.#e=e,this.range){if(!this.to)this.selectedDays=[e,e];else if(this.from===e&&this.to===e)this.selectedDays=[];else if(this.from===e)this.from=this.to;else if(this.to===e)this.to=this.from;else if(e<this.from)this.from=e;else if(e>this.to)this.to=e;else this.to=e;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(e))this.selectedDays.splice(this.selectedDays.indexOf(e),1);else this.selectedDays.push(e),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(e))this.value="",this.selectedDays=[];else this.value=e,this.selectedDays=[e]};nextMonth=()=>{if(this.month<12)this.gotoMonth(this.year,this.month+1);else this.gotoMonth(this.year+1,1)};previousMonth=()=>{if(this.month>1)this.gotoMonth(this.year,this.month-1);else this.gotoMonth(this.year-1,12)};checkDay=(e)=>{if(!this.range)return this.selectedDays.includes(e);else if(this.range)return this.from&&e>=this.from&&e<=this.to;return!1};dateMenuItem=(e,t="")=>(e=e.split("T")[0],{caption:t||e,enabled:()=>!e.startsWith(`${this.year}-${eg(this.month)}-`),action:()=>{this.gotoDate(e)}});jumpMenu=()=>{mt({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((e)=>this.dateMenuItem(e))]})};content=()=>[Km({part:"header"},Jm({part:"previous",onClick:this.previousMonth},j.chevronLeft()),fu({style:{flex:"1"}}),Jm({part:"jump",onClick:this.jumpMenu},j.calendar()),Ii({part:"month",options:this.months,onChange:this.setMonth}),Ii({part:"year",options:[this.year],onChange:this.setMonth}),fu({style:{flex:"1"}}),Jm({part:"next",onClick:this.nextMonth},j.chevronRight())),Km({part:"week"}),Km({part:"days"})];gotoDate(e){let t=new Date(e);this.gotoMonth(t.getFullYear(),t.getMonth()+1)}connectedCallback(){super.connectedCallback();let e=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=e.getMonth()+1;if(isNaN(this.year))this.year=e.getFullYear()}days=[];render(){super.render();let{week:e,days:t,jump:i,month:s,year:n,previous:r,next:o}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let a=ll(this.year,this.month,1),l=new Date(a.valueOf()-(7+a.getDay()-this.weekStart)%7*al),c=this.month===12?1:this.month+1,h=new Date(ll(this.year+(this.month===12?1:0),c,1).valueOf()-al),u=new Date(h.valueOf()+(this.weekStart*2+5+this.endDay-h.getDay())%7*al),d=uQ.map((x)=>new Date(l.valueOf()+x*al).toString().split(" ")[0]);this.days=[];let f=new Date().toISOString().split("T")[0];for(let x=l.valueOf();x<=u.valueOf();x+=al){let k=new Date(x),S=k.toISOString().split("T")[0];this.days.push({date:k,selected:!1,inMonth:k.getMonth()+1===this.month,isToday:S===f,isWeekend:k.getDay()%6===0,inRange:!!(this.from&&S>=this.from&&S<=this.to)})}s.value=String(this.month),n.value=String(this.year),s.disabled=n.disabled=i.disabled=r.disabled=o.disabled=this.disabled||this.readonly,n.options=this.years,e.textContent="",e.append(...d.map((x)=>fu({class:"day"},x))),t.textContent="";let m=null,{to:g,from:O}=this;t.append(...this.days.map((x)=>{let k=["date"];if(x.inMonth)k.push("in-month");if(x.isToday)k.push("today");let S=x.date.toISOString().split("T")[0];if(this.checkDay(S))k.push("checked");if(k.push(x.isWeekend?"weekend":"weekday"),this.range){if(g===S)k.push("range-end");if(O===S)k.push("range-start")}let P=fu({class:k.join(" "),title:S,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},x.date.getDate());if(S===this.#e)m=P;return P})),m?.focus()}}var fQ=tg.elementCreator();var{div:ig,button:pQ}=L,mQ={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class zn extends R{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${b.notificationSpacing} ${b.notificationSpacing50} ${b.notificationSpacing} ${b.notificationSpacing200}`,_notificationBg:w.background("#fafafa"),_notificationAccentColor:"#aaa",_notificationTextColor:w.textColor("#444"),_notificationIconSize:b.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:b.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:b.notificationSpacing,width:b.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:b.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:b.notificationTextColor},":host .note":{display:"grid",background:b.notificationBg,padding:b.notificationPadding,gridTemplateColumns:`${b.notificationIconSize} 1fr ${b.notificationButtonSize}`,gap:b.notificationSpacing,alignItems:"center",borderRadius:b.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${b.notificationAccentColor}`,borderColor:b.notificationAccentColor,borderWidth:b.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:b.notificationButtonSize,padding:0,margin:0,height:b.notificationButtonSize,width:b.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:b.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:b.notificationBg,background:b.notificationAccentColor,padding:b.spacing50},":host .note svg":{height:b.notificationIconSize,width:b.notificationIconSize,pointerEvents:"none",color:b.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:b.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(e){e.classList.add("closing"),e.style.marginBottom=-e.offsetHeight+"px";let t=()=>{e.remove()};e.addEventListener("transitionend",t),setTimeout(t,1000)}static post(e){let{message:t,duration:i,type:s,close:n,progress:r,icon:o,color:a}=Object.assign({type:"info",duration:-1},typeof e==="string"?{message:e}:e);if(!this.singleton)this.singleton=sg();let l=this.singleton;document.body.append(l),l.style.zIndex=String(br()+1);let c=a||mQ[s],h=r||s==="progress"?L.progress():{},u=()=>{if(n)n();zn.removeNote(m)},d=o instanceof SVGElement?o:o?j[o]():j.info(),f=s==="error"||s==="warn",m=ig({class:`note ${s}`,role:f?"alert":"status",ariaLive:f?"assertive":"polite",style:{_notificationAccentColor:c}},d,ig({class:"message"},ig(t),h),pQ({class:"close",title:"close",ariaLabel:"Close notification",apply(g){g.addEventListener("click",u)}},j.x()));if(l.shadowRoot.append(m),h instanceof HTMLProgressElement&&r instanceof Function){h.setAttribute("max",String(100)),h.value=r();let g=setInterval(()=>{if(!l.shadowRoot.contains(m)){clearInterval(g);return}let O=r();if(h.value=O,O>=100)zn.removeNote(m)},1000)}if(i>0)setTimeout(()=>{zn.removeNote(m)},i*1000);return m.scrollIntoView(),u}content=null}var gQ=zn,sg=zn.elementCreator(),OQ=sg;function ng(e){return zn.post(e)}var L2=async(e,t="SHA-1")=>{let s=new TextEncoder().encode(e),n=await crypto.subtle.digest(t,s);return Array.from(new Uint8Array(n)).map((a)=>a.toString(16).padStart(2,"0")).join("")},R2=async(e)=>{let t=await L2(e),i=await fetch(`https://weakpass.com/api/v1/search/${t}`);if(i.ok){let s=await i.json();console.log("password found in weakpass database",s)}return i.status!==404},{span:rg,tosiSlot:yQ}=L;class pu extends R{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:b.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:w.meterHeight("24px"),background:w.indicatorBg("white"),borderRadius:w.meterRadius("4px"),boxShadow:w.meterShadow(`inset 0 0 0 2px ${b.indicatorColor}`)},':host [part="level"]':{height:w.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:b.indicatorColor,margin:w.levelMargin("2px"),borderRadius:w.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:b.descriptionColor,height:w.meterHeight("24px"),lineHeight:w.meterHeight("24px"),textAlign:"center"}};static initAttributes={minLength:8,goodLength:12,indicatorColors:"#f00,#f40,#f80,#ef0,#8f0,#0a2"};descriptionColors="#000,#000,#000,#000,#000,#fff";issues={tooShort:!0,short:!0,noUpper:!0,noLower:!0,noNumber:!0,noSpecial:!0};issueDescriptions={tooShort:"too short",short:"short",noUpper:"no upper case",noLower:"no lower case",noNumber:"no digits",noSpecial:"no unusual characters"};value=0;strengthDescriptions=["unacceptable","very weak","weak","moderate","strong","very strong"];strength(e){return this.issues={tooShort:e.length<this.minLength,short:e.length<this.goodLength,noUpper:!e.match(/[A-Z]/),noLower:!e.match(/[a-z]/),noNumber:!e.match(/[0-9]/),noSpecial:!e.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((t)=>!t).length-1}async isBreached(){let e=this.querySelector("input")?.value;if(!e||typeof e!=="string")return!0;return await R2(e)}updateIndicator=(e)=>{let{level:t,description:i}=this.parts,s=this.indicatorColors.split(","),n=this.descriptionColors.split(","),r=this.strength(e);if(this.value!==r)this.value=r,this.dispatchEvent(new Event("change"));t.style.width=`${(r+1)*16.67}%`,this.style.setProperty("--indicator-color",s[r]),this.style.setProperty("--description-color",n[r]),i.textContent=this.strengthDescriptions[r]};update=(e)=>{let t=e.target.closest("input");this.updateIndicator(t?.value||"")};content=()=>[yQ({onInput:this.update}),rg({part:"meter"},rg({part:"level"}),rg({part:"description"}))];render(){super.render();let e=this.querySelector("input");this.updateIndicator(e?.value)}}var bQ=pu,I2=pu.elementCreator(),xQ=I2;var{button:vQ,div:wQ,slot:kQ}=L;class og extends R{static preferredTagName="tosi-pocket-bar";static initAttributes={icon:"",direction:"auto",open:!1};pinned=!1;get vertical(){return/^[ns]/.test(this.direction)}get resolvedIcon(){return this.icon||(this.vertical?"moreVertical":"moreHorizontal")}get floatPosition(){return this.direction==="auto"?"side":this.direction}reposition=()=>{if(!this.hydrated)return;vh(this.parts.bar,this.parts.handle,this.floatPosition,"remain","remain")};setOpen(e){if(this.open!==e)this.open=e;if(e)this.reposition()}handlePointerEnter=(e)=>{if(e.pointerType==="touch")return;this.setOpen(!0)};handlePointerLeave=(e)=>{if(e.pointerType==="touch")return;if(!this.pinned)this.setOpen(!1)};handleFocusIn=()=>this.setOpen(!0);handleFocusOut=()=>{requestAnimationFrame(()=>{if(!this.pinned&&!this.matches(":focus-within"))this.setOpen(!1)})};close=()=>{this.pinned=!1,this.setOpen(!1)};toggle=(e)=>{e?.preventDefault(),this.pinned=!this.pinned,this.setOpen(this.pinned)};handleOutsidePointer=(e)=>{if(!this.pinned)return;let t=e.composedPath();if(!t.includes(this)&&!t.includes(this.parts.bar))this.pinned=!1,this.setOpen(!1)};handleScrollResize=()=>{if(this.open)this.reposition()};content=()=>[vQ({part:"handle",class:"no-drag",title:"toolbar","aria-label":"toolbar","aria-expanded":"false",onClick:this.toggle},qp({part:"handleIcon",icon:this.resolvedIcon})),wQ({part:"bar",role:"toolbar",style:{flexDirection:this.vertical?"column":"row"}},kQ())];static shadowStyleSpec={":host":{display:"inline-flex",position:"relative",opacity:w.tosiPocketOpacity("0.75"),transition:"opacity 0.15s ease-out"},":host([open])":{opacity:"1"},':host [part="handle"]':{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:b.spacing50,border:"0",margin:"0",cursor:"pointer",color:w.tosiPocketHandleColor("inherit"),background:w.tosiPocketHandleBg(w.tosiPocketBg("color-mix(in srgb, var(--tosi-bg, #fff) 85%, transparent)")),backdropFilter:"blur(12px)",borderRadius:w.tosiPocketHandleRadius(b.spacing),width:w.tosiPocketHandleSize("auto"),height:w.tosiPocketHandleSize("auto"),transition:"background 0.15s ease-out"},':host [part="bar"]':{position:"fixed",display:"flex",gap:b.spacing25,padding:b.spacing25,background:w.tosiPocketBg("color-mix(in srgb, var(--tosi-bg, #fff) 82%, transparent)"),backdropFilter:"blur(12px)",borderRadius:b.spacing,boxShadow:`0 ${b.spacing25} ${b.spacing} #0003`,opacity:"0",pointerEvents:"none",transform:"scale(0.9)",transition:"opacity 0.15s ease-out, transform 0.15s ease-out"},':host([open]) [part="bar"]':{opacity:"1",pointerEvents:"auto",transform:"scale(1)"},"::slotted(button), ::slotted(label)":{display:"inline-flex",alignItems:"center",gap:b.spacing25,padding:b.spacing50,margin:"0",border:"0",background:"transparent",color:"inherit",font:"inherit",cursor:"pointer",borderRadius:b.spacing25,transition:"background 0.15s ease-out, opacity 0.15s, filter 0.15s"},"::slotted(button:hover), ::slotted(label:hover)":{background:"color-mix(in srgb, currentColor 15%, transparent)"},'::slotted(label:has(input[type="checkbox"]:not(:checked)))':{opacity:"0.45",filter:"grayscale(1)"}};connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",this.handlePointerEnter),this.addEventListener("pointerleave",this.handlePointerLeave),this.addEventListener("focusin",this.handleFocusIn),this.addEventListener("focusout",this.handleFocusOut),document.addEventListener("pointerdown",this.handleOutsidePointer,!0),window.addEventListener("scroll",this.handleScrollResize,{passive:!0,capture:!0}),window.addEventListener("resize",this.handleScrollResize,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this.handleOutsidePointer,!0),window.removeEventListener("scroll",this.handleScrollResize,!0),window.removeEventListener("resize",this.handleScrollResize)}render(){super.render(),this.parts.handleIcon.icon=this.resolvedIcon,this.parts.bar.style.flexDirection=this.vertical?"column":"row",this.parts.handle.setAttribute("aria-expanded",String(!!this.open)),this.reposition()}}var ag=og.elementCreator();var{span:lg}=L;class mu extends R{static preferredTagName="tosi-rating";static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"#ccc",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(e){this.readonly=e}formResetCallback(){this.value=""}static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"fit-content"},":host::part(container)":{position:"relative",display:"inline-block"},":host::part(empty), :host::part(filled)":{height:"100%",whiteSpace:"nowrap",overflow:"hidden"},":host::part(empty)":{pointerEvents:"none"},":host::part(filled)":{position:"absolute",left:0,transition:"width 0.15s ease-out"},":host svg":{transform:"scale(0.9)",pointerEvents:"all !important",transition:"0.25s ease-in-out"},":host svg:hover":{transform:"scale(1)"},":host svg:active":{transform:"scale(1.1)"}};content=()=>lg({part:"container"},lg({part:"empty"}),lg({part:"filled"}));displayValue(e){let{empty:t,filled:i}=this.parts,n=Math.round((typeof e==="string"?0:e||0)/this.step)*this.step;i.style.width=n/this.max*t.offsetWidth+"px"}update=(e)=>{if(this.readonly)return;let{empty:t}=this.parts,i=e instanceof MouseEvent?e.pageX-t.getBoundingClientRect().x:0,s=Math.min(Math.max(this.min,Math.round(i/t.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(e.type==="click")this.value=s;else if(e.type==="mousemove")this.displayValue(s);else this.displayValue(this.value||0)};handleKey=(e)=>{let t=this.value===""?NaN:Number(this.value);if(isNaN(t))t=Math.round((this.min+this.max)*0.5*this.step)*this.step;let i=!1;switch(e.key){case"ArrowUp":case"ArrowRight":t+=this.step,i=!0;break;case"ArrowDown":case"ArrowLeft":t-=this.step,i=!0;break}if(this.value=Math.max(Math.min(t,this.max),this.min),i)e.stopPropagation(),e.preventDefault()};connectedCallback(){super.connectedCallback();let{container:e}=this.parts;e.tabIndex=0,e.addEventListener("mousemove",this.update,!0),e.addEventListener("mouseleave",this.update),e.addEventListener("blur",this.update),e.addEventListener("click",this.update),e.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let e=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",e),this.readonly)this.role="image";else this.role="slider";this.ariaLabel=`rating ${this.value} out of ${this.max}`,this.ariaValueMax=String(this.max),this.ariaValueMin=String(this.min),this.ariaValueNow=this.value===""?String(-1):String(this.value);let{empty:t,filled:i}=this.parts;if(t.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),t.style.setProperty("--tosi-icon-stroke",this.emptyStroke),i.style.setProperty("--tosi-icon-fill",this.ratingFill),i.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let s=0;s<this.max;s++)t.append(j[this.icon]()),i.append(j[this.icon]())}this.displayValue(this.value)}}var SQ=mu,j2=mu.elementCreator(),CQ=li((...e)=>j2(...e),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:B2,div:TQ,button:$Q}=L,PQ=[{caption:"Title",tagType:"H1"},{caption:"Heading",tagType:"H2"},{caption:"Subheading",tagType:"H3"},{caption:"Minor heading",tagType:"H4"},{caption:"Body",tagType:"P"},{caption:"Code Block",tagType:"PRE"}];function cg(e=PQ){return Ii({title:"paragraph style",slot:"toolbar",class:"block-style",options:e.map(({caption:t,tagType:i})=>({caption:t,value:`formatBlock,${i}`}))})}var cl=()=>Bm({slot:"toolbar"});function cs(e,t,i){return $Q({slot:"toolbar",dataCommand:t,title:e},i)}var EQ=()=>[cs("left-justify","justifyLeft",j.alignLeft()),cs("center","justifyCenter",j.alignCenter()),cs("right-justify","justifyRight",j.alignRight()),cl(),cs("bullet list","insertUnorderedList",j.listBullet()),cs("numbered list","insertOrderedList",j.listNumber()),cl(),cs("indent","indent",j.indent()),cs("indent","outdent",j.outdent())],D2=()=>[cs("bold","bold",j.fontBold()),cs("italic","italic",j.fontItalic()),cs("underline","underline",j.fontUnderline())],AQ=()=>[cg(),cl(),...D2()],N2=()=>[cg(),cl(),...EQ(),cl(),...D2()];class gu extends R{static preferredTagName="tosi-rich-text";static lightStyleSpec={":host":{display:"flex",flexDirection:"column",height:"100%"},':host [part="toolbar"]':{padding:4,display:"flex",gap:"0px",flex:"0 0 auto",flexWrap:"wrap"},':host [part="toolbar"] > button':{_xinIconSize:18}};static formAssociated=!0;static initAttributes={widgets:"default",name:"",required:!1};isInitialized=!1;savedValue="";formDisabledCallback(e){if(this.isInitialized)this.parts.doc.contentEditable=e?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(e){let t=this._value;if(this._value=e,this.isInitialized){if(this.parts.doc.innerHTML!==e)this.parts.doc.innerHTML=e}if(t!==e&&this.internals)this.internals.setFormValue(e)}blockElement(e){let{doc:t}=this.parts;while(e.parentElement!==null&&e.parentElement!==t)e=e.parentElement;return e.parentElement===t?e:void 0}get selectedBlocks(){let{doc:e}=this.parts,t=window.getSelection();if(t===null)return[];let i=[];for(let s=0;s<t.rangeCount;s++){let n=t.getRangeAt(s);if(!e.contains(n.commonAncestorContainer))continue;let r=this.blockElement(n.startContainer),o=this.blockElement(n.endContainer);i.push(r);while(r!==o&&r!==null)r=r.nextElementSibling,i.push(r)}return i}get selectedText(){let e=window.getSelection();if(e===null)return"";return this.selectedBlocks.length?e.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(e)=>{if(this._updatingBlockStyle)return;let i=e.target?.closest(Rs.tagName);if(i==null)return;this.doCommand(i.value)};handleButtonClick=(e)=>{let i=e.target?.closest("button");if(i==null)return;this.doCommand(i.dataset.command)};content=[B2({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),TQ({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),B2({part:"content"})];doCommand(e){if(e===void 0)return;let t=e.split(",");console.log("execCommand",t[0],!1,...t.slice(1)),document.execCommand(t[0],!1,...t.slice(1))}updateBlockStyle(){let e=this.parts.toolbar.querySelector(".block-style");if(e===null)return;let t=this.selectedBlocks.map((i)=>i.tagName);t=[...new Set(t)],this._updatingBlockStyle=!0,e.value=t.length===1?`formatBlock,${t[0]}`:"",this._updatingBlockStyle=!1}hasContent(){return(this.parts.doc.textContent||"").trim().length>0}handleInput=()=>{if(this.internals)this.internals.setFormValue(this.parts.doc.innerHTML),this.updateValidity()};updateValidity(){if(this.internals)if(this.required&&!this.hasContent())this.internals.setValidity({valueMissing:!0},"Please enter some content",this.parts.doc);else this.internals.setValidity({})}connectedCallback(){super.connectedCallback();let{doc:e,content:t}=this.parts;if(t.innerHTML!==""&&e.innerHTML==="")e.innerHTML=t.innerHTML,t.innerHTML="";this.isInitialized=!0,t.style.display="none",e.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(i)=>{this.updateBlockStyle(),this.selectionChange(i,this)})}render(){let{toolbar:e}=this.parts;if(super.render(),e.children.length===0)switch(this.widgets){case"minimal":e.append(...AQ());break;case"default":e.append(...N2());break}}}var MQ=gu,z2=gu.elementCreator(),QQ=li((...e)=>z2(...e),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:hl}=Rt({router:{path:"",hash:"",pattern:""}}),hg={};function _Q(){return{...hg}}var Ou=[],ug=!1,yu=new Set;function LQ(e){let t=[];if(e==="")return{regex:/^\/?$/,paramNames:t};let i=e.split("/").map((n)=>{if(n.startsWith(":"))return t.push(n.slice(1)),"([^/]+)";return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+i.join("/")+"/?$"),paramNames:t}}function RQ(e){let t=e.split("?")[0].split("#")[0];for(let s of Ou){if(s.fallback)continue;let n=t.match(s.regex);if(n){let r={};return s.paramNames.forEach((o,a)=>{r[o]=decodeURIComponent(n[a+1])}),{route:s,params:r}}}let i=Ou.find((s)=>s.fallback);if(i)return{route:i,params:{}};return null}function ul(){let e=ug?window.location.hash.replace(/^#\/?/,"").split("?")[0]:window.location.pathname;hl.path.value=e,hl.hash.value=window.location.hash;let t=RQ(e);if(t){hg=t.params,hl.pattern.value=t.route.regex.source;let i=new Map;for(let s of t.route.targets)i.set(s.view??"default",s);for(let s of yu){let n=s.name||"default",r=i.get(n);if(r)s.replaceChildren(r.component(t.params));else s.replaceChildren()}}else{hg={},hl.pattern.value="";for(let i of yu)i.replaceChildren()}}var V2=!1;function X2(){if(V2)return;V2=!0,window.addEventListener("popstate",ul),window.addEventListener("hashchange",ul)}function IQ(e,t={}){ug=t.hashRouting??!1,Ou=e.map((i)=>{let{regex:s,paramNames:n}=LQ(i.pattern);return{regex:s,paramNames:n,targets:i.targets,fallback:i.fallback??!1}}),X2(),ul()}function jQ(e){if(X2(),ug)window.location.hash="#/"+e.replace(/^\//,"");else window.history.pushState({},"","/"+e.replace(/^\//,""));ul()}class dg extends R{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),yu.add(this),Ou.length>0)ul()}disconnectedCallback(){super.disconnectedCallback(),yu.delete(this)}}var BQ=dg.elementCreator();var{div:DQ,slot:NQ,label:zQ,span:VQ,input:Z2}=L;class So extends R{static preferredTagName="tosi-segmented";static formAssociated=!0;static initAttributes={direction:"row",other:"",multiple:!1,name:"",placeholder:"Please specify…",localized:!1,required:!1};_choices=[];get choices(){return this._choices}set choices(e){if(typeof e==="string")this._choices=So.parseChoicesString(e);else this._choices=e;this.queueRender()}static parseChoicesString(e){return e.split(",").filter((t)=>t.trim()!=="").map((t)=>{let[i,s]=t.split("=").map((a)=>a.trim()),[n,r]=(s||i).split(":").map((a)=>a.trim()),o=r?j[r]():"";return{value:i,icon:o,caption:n}})}value="";formDisabledCallback(e){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((e)=>e.trim()).filter((e)=>e!=="")}content=()=>[NQ(),DQ({part:"options"},Z2({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:w.segmentedOptionGap("8px"),alignItems:w.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:w.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:w.segmentedOptionGap("8px"),gridTemplateColumns:w.segmentedOptionGridColumns("0px 24px 1fr"),padding:w.segmentedOptionPadding("4px 12px"),font:w.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:w.segmentedFocusShadow(`inset 0 0 0 2px ${w.segmentedOptionCurrentBackground("#44a")}`),borderRadius:w.segmentedOptionsBorderRadius("8px")},":host label.current":{color:w.segmentedOptionCurrentColor("#eee"),background:w.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:w.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${w.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:w.segmentOptionIconSize("16px"),stroke:w.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:w.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:w.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:w.segmentedOptionsBorderRadius("8px"),background:w.segmentedOptionsBackground("#fff"),color:w.segmentedOptionColor("#222"),overflow:"hidden",alignItems:w.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:w.segmentedOptionPadding("4px 12px"),color:w.segmentedOptionCurrentColor("#eee"),background:w.segmentedOptionCurrentBackground("#44a"),font:w.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:w.segmentedOptionCurrentColor("#eee"),opacity:w.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:e}=this.parts,{values:t,isOtherValue:i}=this;e.querySelectorAll("label").forEach((s)=>{let n=s.querySelector("input")?.value??"";s.classList.toggle("current",t.includes(n)||n===""&&i)})}handleChange=()=>{let{options:e,custom:t}=this.parts;if(this.multiple){let i=[...e.querySelectorAll("input:checked")];this.value=i.map((s)=>s.value).join(",")}else{let i=e.querySelector("input:checked");if(!i)this.value="";else if(i.value)t.setAttribute("hidden",""),this.value=i.value;else t.removeAttribute("hidden"),t.focus(),t.select(),this.value=t.value}this.syncCurrent()};handleKey=(e)=>{let t=!1;switch(e.code){case"Space":if(e.target instanceof HTMLLabelElement)e.target.click(),t=!0;break;case"Tab":if(!(e.target instanceof HTMLLabelElement))e.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let i=e.target.closest("label");if(i.previousElementSibling instanceof HTMLLabelElement)i.previousElementSibling.focus()}t=!0;break;case"ArrowRight":case"ArrowDown":{let i=e.target.closest("label");if(i.nextElementSibling instanceof HTMLLabelElement)i.nextElementSibling.focus()}t=!0;break}if(t)e.preventDefault(),e.stopPropagation()};connectedCallback(){super.connectedCallback();let e=this.getAttribute("choices");if(e&&this._choices.length===0)this._choices=So.parseChoicesString(e);let{options:t}=this.parts;if(this.name==="")this.name=this.instanceId;if(t.addEventListener("change",this.handleChange),t.addEventListener("keydown",this.handleKey),this.other&&this.multiple)console.warn(this,"is set to [other] and [multiple]; [other] will be ignored"),this.other=""}get _choicesWithOther(){let e=[...this.choices];if(this.other&&!this.multiple){let[t,i]=this.other.split(":");e.push({value:"",caption:t,icon:i})}return e}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((e)=>e.value===this.value))}render(){super.render();let{options:e,custom:t}=this.parts,i=this.multiple?"checkbox":"radio",{values:s,isOtherValue:n}=this,r=this._choicesWithOther,o=(c)=>s.includes(c)||c===""&&n,a=[...e.querySelectorAll("label")];if(a.length===r.length&&a.every((c,h)=>c.querySelector("input")?.value===r[h].value))a.forEach((c)=>{let h=c.querySelector("input");if(h&&h.checked!==o(h.value))h.checked=o(h.value)});else e.textContent="",e.append(...r.map((c)=>zQ({tabindex:0},Z2({type:i,name:this.name,value:c.value,checked:o(c.value),tabIndex:-1}),c.icon||{class:"no-icon"},this.localized?ns(c.caption):VQ(c.caption))));if(this.other&&!this.multiple){t.hidden=!n;let c=n?this.value:"";if(t.value!==c)t.value=c;if(t.placeholder=this.placeholder,t.parentElement!==e)e.append(t)}this.syncCurrent()}}var XQ=So,F2=So.elementCreator(),ZQ=li((...e)=>F2(...e),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:W2}=L;class Sr extends R{static preferredTagName="tosi-sidenav";static initAttributes={minSize:800,navSize:200,compact:!1,contentVisible:!1,alwaysCompact:!1};value="normal";get navVisible(){return!this.compact||!this.contentVisible}set navVisible(e){if(e){this.alwaysCompact=!1,this.contentVisible=!1;return}let t=this.offsetParent;if(!(t?t.offsetWidth<this.minSize:!1))this.alwaysCompact=!0;this.contentVisible=!0}content=[W2({name:"nav",part:"nav"}),W2({part:"content"})];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:`${w.navWidth("50%")} ${w.contentWidth("50%")}`,gridTemplateRows:"100%",position:"relative",margin:w.margin("0 0 0 -100%"),transition:w.sideNavTransition("0.25s ease-out")},":host slot":{position:"relative"},":host slot:not([name])":{display:"block"},':host slot[name="nav"]':{display:"block"}};handleResize=()=>{let{content:e}=this.parts,t=this.offsetParent;if(t===null)return;let i;if(this.compact=this.alwaysCompact||t.offsetWidth<this.minSize,[...this.childNodes].find((n)=>n instanceof Element?n.getAttribute("slot")!=="nav":!0)===void 0)i="compact/nav",this.style.setProperty("--nav-width","100%"),this.style.setProperty("--content-width","0%");else if(!this.compact)i="normal",e.classList.add("-tosi-sidenav-visible"),this.style.setProperty("--nav-width",`${this.navSize}px`),this.style.setProperty("--content-width",`calc(100% - ${this.navSize}px)`),this.style.setProperty("--margin","0");else if(e.classList.remove("-tosi-sidenav-visible"),this.style.setProperty("--nav-width","50%"),this.style.setProperty("--content-width","50%"),this.contentVisible)i="compact/content",this.style.setProperty("--margin","0 0 0 -100%");else i="compact/nav",this.style.setProperty("--margin","0 -100% 0 0");if(this.value!==i)this.value=i;this.releaseTransition()};observer;connectedCallback(){super.connectedCallback(),this.contentVisible=this.parts.content.childNodes.length===0,globalThis.addEventListener("resize",this.handleResize),this.observer=new MutationObserver(this.handleResize),this.observer.observe(this,{childList:!0}),this.style.setProperty("--side-nav-transition","0s")}releaseTransition=()=>{if(!this.transitionSuppressed)return;this.transitionSuppressed=!1,requestAnimationFrame(()=>{this.style.removeProperty("--side-nav-transition")})};transitionSuppressed=!0;disconnectedCallback(){super.disconnectedCallback(),this.observer.disconnect()}render(){super.render(),this.handleResize()}}var FQ=Sr,dl=Sr.elementCreator(),WQ=dl,qQ=dl;var{slot:q2}=L;class fg extends R{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[q2({part:"normal"}),q2({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};handleResize=()=>{let{normal:e,small:t}=this.parts,i=this.offsetParent;if(!(i instanceof HTMLElement))return;else if(i.offsetWidth<this.minWidth||i.offsetHeight<this.minHeight)e.hidden=!0,t.hidden=!1,this.value="small";else e.hidden=!1,t.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.handleResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.handleResize)}}var HQ=fg.elementCreator();class bu extends R{static preferredTagName="tosi-sizer";target=null;static shadowStyleSpec={":host":{_resizeIconFill:"#222",display:"block",position:"absolute",bottom:-7,right:-7,padding:14,width:44,height:44,opacity:0.25,transition:"opacity 0.25s ease-out"},":host(:hover)":{opacity:0.5},":host svg":{width:16,height:16,stroke:b.resizeIconFill}};content=j.resize();get minSize(){let{minWidth:e,minHeight:t}=getComputedStyle(this.target);return{width:parseFloat(e)||32,height:parseFloat(t)||32}}resizeTarget=(e)=>{let{target:t}=this;if(!t)return;let{offsetWidth:i,offsetHeight:s}=t;t.style.left=t.offsetLeft+"px",t.style.top=t.offsetTop+"px",t.style.bottom="",t.style.right="";let{minSize:n}=this;vi(e,(r,o,a)=>{if(t.style.width=Math.max(n.width,i+r)+"px",t.style.height=Math.max(n.height,s+o)+"px",a.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let e={passive:!0};this.addEventListener("mousedown",this.resizeTarget),this.addEventListener("touchstart",this.resizeTarget,e)}}var YQ=bu,H2=bu.elementCreator(),UQ=H2;var{div:Cr,slot:Y2,span:GQ,button:KQ}=L;class xu extends R{static preferredTagName="tosi-tabs";static initAttributes={localized:!1};value=0;makeTab(e,t,i){let s=t.getAttribute("name"),n=t.querySelector('template[role="tab"]')?.content.cloneNode(!0)||(this.localized?ns(s):GQ(s)),r=Cr(n,{part:"tab",tabindex:0,role:"tab",ariaControls:i},t.hasAttribute("data-close")?KQ({title:"close",class:"close"},j.x()):{}),o=t.dataset.tooltip;if(o)r.dataset.tooltip=o;return r}static shadowStyleSpec={":host":{"--tosi-tabs-selected-color":"var(--xin-tabs-selected-color, var(--tosi-accent, currentColor))","--tosi-tabs-bar-color":"var(--xin-tabs-bar-color, #ccc)","--tosi-tabs-bar-height":"var(--xin-tabs-bar-height, 2px)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",boxShadow:"none !important"},slot:{position:"relative",display:"block",flex:"1",overflow:"hidden",overflowY:"auto"},'slot[name="after-tabs"]':{flex:"0 0 auto"},"::slotted([hidden])":{display:"none !important"},":host::part(tabpanel)":{display:"flex",flexDirection:"column",overflowX:"auto"},":host::part(tabrow)":{display:"flex"},":host .tabs":{display:"flex",userSelect:"none",whiteSpace:"nowrap"},":host .tabs > div":{padding:`${b.spacing50} ${b.spacing}`,cursor:"default",display:"flex",alignItems:"baseline"},":host .tabs > [aria-selected]":{"--text-color":b.tosiTabsSelectedColor,color:b.textColor},":host .elastic":{flex:"1"},":host .border":{background:b.tosiTabsBarColor},":host .border > .selected":{content:" ",width:0,height:b.tosiTabsBarHeight,background:b.tosiTabsSelectedColor,transition:"ease-out 0.2s"},":host button.close":{border:0,background:"transparent",textAlign:"center",marginLeft:b.spacing50,padding:0},":host button.close > svg":{height:"12px"}};handleCloseTab=null;get onCloseTab(){return this.handleCloseTab}set onCloseTab(e){this.handleCloseTab=e}content=[Cr({role:"tabpanel",part:"tabpanel"},Cr({part:"tabrow"},Cr({class:"tabs",part:"tabs"}),Cr({class:"elastic"}),Y2({name:"after-tabs"})),Cr({class:"border"},Cr({class:"selected",part:"selected"}))),Y2()];addTabBody(e,t=!1){if(!e.hasAttribute("name"))throw console.error("element has no name attribute",e),Error("element has no name attribute");if(this.append(e),this.setupTabs(),t)this.value=this.bodies.length-1;this.queueRender()}removeTabBody(e){e.remove(),this.setupTabs(),this.queueRender()}keyTab=(e)=>{let{tabs:t}=this.parts,i=[...t.children].indexOf(e.target);switch(e.key){case"ArrowLeft":this.value=(i+Number(t.children.length)-1)%t.children.length,t.children[this.value].focus(),e.preventDefault();break;case"ArrowRight":this.value=(i+1)%t.children.length,t.children[this.value].focus(),e.preventDefault();break;case" ":this.pickTab(e),e.preventDefault();break;default:}};get bodies(){return[...this.children].filter((e)=>e.hasAttribute("name"))}pickTab=(e)=>{let{tabs:t}=this.parts,i=e.target,s=i.closest("button.close")!==null,n=i.closest(".tabs > div"),r=[...t.children].indexOf(n);if(s){let o=this.bodies[r];if(!this.handleCloseTab||this.handleCloseTab(o)!==!1)this.removeTabBody(this.bodies[r])}else if(r>-1)this.value=r};setupTabs=()=>{let{tabs:e}=this.parts,t=[...this.children].filter((i)=>!i.hasAttribute("slot")&&i.hasAttribute("name"));if(e.textContent="",this.value>=t.length)this.value=t.length-1;for(let i in t){let s=t[i],n=`${this.instanceId}-${i}`;s.id=n;let r=this.makeTab(this,s,n);e.append(r)}};connectedCallback(){super.connectedCallback();let{tabs:e}=this.parts;e.addEventListener("click",this.pickTab),e.addEventListener("keydown",this.keyTab),this.setupTabs(),Is.allInstances.add(this)}disconnectedCallback(){super.disconnectedCallback(),Is.allInstances.delete(this)}localeChanged=()=>{this.queueRender()};handleResize(){this.queueRender()}render(){let{tabs:e,selected:t}=this.parts,i=this.bodies;for(let s=0;s<i.length;s++){let n=i[s],r=e.children[s],o=this.value===Number(s);if(r.toggleAttribute("aria-selected",o),n.toggleAttribute("hidden",!o),o)t.style.marginLeft=`${r.offsetLeft-e.offsetLeft}px`,t.style.width=`${r.offsetWidth}px`}}}var JQ=xu,fl=xu.elementCreator(),e_=fl,t_=fl;var{div:i_,input:s_,span:n_,button:pg}=L,U2=(e)=>e.split(/(?<!\\),/).map((t)=>t.trim().replace(/\\,/g,",")),r_=(e)=>e.map((t)=>t.replace(/,/g,"\\,")).join(",");class pl extends R{static preferredTagName="tosi-tag";static lightStyleSpec={":host":{"--tag-close-button-color":"#000c","--tag-close-button-bg":"#fffc","--tag-button-opacity":"0.5","--tag-button-hover-opacity":"0.75","--tag-bg":w.brandColor("blue"),"--tag-text-color":w.brandTextColor("white"),display:"inline-flex",borderRadius:w.tagRoundedRadius(b.spacing50),color:b.tagTextColor,background:b.tagBg,padding:`0 ${b.spacing75} 0 ${b.spacing75}`,height:`calc(${b.lineHeight} + ${b.spacing50})`,lineHeight:`calc(${b.lineHeight} + ${b.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:w.fontSize("16px"),color:b.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${b.spacing_50} 0 ${b.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:b.spacing150,width:b.spacing150,color:b.tagCloseButtonColor,background:b.tagCloseButtonBg,borderRadius:w.tagCloseButtonRadius("99px"),opacity:b.tagButtonOpacity},':host [part="remove"]:hover':{background:b.tagCloseButtonBg,opacity:b.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[n_({part:"caption"},this.caption),pg(j.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var o_=pl,mg=pl.elementCreator(),a_=li((...e)=>mg(...e),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class Co extends R{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:b.tagListBg,gap:b.spacing25,borderRadius:w.taglistRoundedRadius(b.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${b.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${b.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:b.inputBg,borderRadius:w.tagContainerRadius(b.spacing50),boxShadow:b.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:b.spacing25,minHeight:`calc(${b.lineHeight} + ${b.spacing})`,padding:b.spacing25},':host [part="tagMenu"]':{width:b.touchSize,height:b.touchSize,lineHeight:b.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:b.brandColor,color:b.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return U2(this.value).filter((e)=>e!=="")}set tags(e){this.value=r_(e)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(e){if(typeof e==="string")this._availableTags=Co.parseAvailableTagsString(e);else this._availableTags=e;this.queueRender()}static parseAvailableTagsString(e){return U2(e).map((t)=>t===""?null:t)}connectedCallback(){super.connectedCallback();let e=this.getAttribute("available-tags");if(e&&this._availableTags.length===0)this._availableTags=Co.parseAvailableTagsString(e)}formDisabledCallback(e){this.disabled=e}formResetCallback(){this.value=""}addTag=(e)=>{let t=e.trim();if(t===""||this.tags.includes(t))return;this.tags=[...this.tags,t],this.queueRender(!0)};toggleTag=(e)=>{if(this.tags.includes(e))this.tags=this.tags.filter((t)=>t!==e),this.queueRender(!0);else this.addTag(e)};enterTag=(e)=>{let{tagInput:t}=this.parts;switch(e.key){case",":{let i=t.value.split(",")[0];this.addTag(i)}break;case"Enter":{let i=t.value.split(",")[0];this.addTag(i)}e.stopPropagation(),e.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:e}=this,{tagMenu:t}=this.parts,i=[...this.availableTags],s=this.tags.filter((r)=>!i.includes(r));if(s.length)i.push(null,...s);let n=i.map((r)=>{if(r===""||r===null)return null;else if(typeof r==="object")return{checked:()=>this.tags.includes(r.value),caption:r.caption,action(){e(r.value)}};else return{checked:()=>this.tags.includes(r),caption:r,action(){e(r)}}});mt({target:t,width:"auto",menuItems:n})};content=()=>[pg({type:"button",style:{visibility:"hidden"},tabindex:-1}),i_({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),s_({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),pg({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},j.chevronDown())];removeTag=(e)=>{if(this.editable&&!this.disabled){let t=e.target.closest(pl.tagName);this.tags=this.tags.filter((i)=>i!==t.caption),t.remove(),this.queueRender(!0)}e.stopPropagation(),e.preventDefault()};render(){super.render();let{tagContainer:e,tagMenu:t,tagInput:i}=this.parts;if(t.disabled=this.disabled,i.value="",i.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)t.toggleAttribute("hidden",!1),i.toggleAttribute("hidden",!this.textEntry);else t.toggleAttribute("hidden",!0),i.toggleAttribute("hidden",!0);e.textContent="";for(let s of this.tags)e.append(mg({caption:s,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var l_=Co,G2=Co.elementCreator(),c_=li((...e)=>G2(...e),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var K2="1.14.2";var{span:h_}=L,ml=null,vu=null,wu=null,Ds="tosi-tooltip",u_={[`.${Ds}`]:{pointerEvents:"none",padding:w.tosiTooltipPadding("4px 10px"),borderRadius:w.tosiTooltipRadius("6px"),background:w.tosiTooltipBg("#333"),color:w.tosiTooltipColor("#fff"),fontSize:w.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:w.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${Ds} p`]:{margin:"0"},[`.${Ds} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${Ds} a`]:{color:"inherit"},[`.${Ds}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${Ds}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Ds}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Ds}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${Ds}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},J2=!1;function ew(){if(J2)return;J2=!0,ci("tosi-tooltip",u_)}function To(){if(vu!==null)clearTimeout(vu),vu=null;if(ml!==null)ml.remove(),ml=null;wu=null}function d_(e){if(e.startsWith("s"))return"tt-s";if(e.startsWith("n"))return"tt-n";if(e.startsWith("e"))return"tt-e";if(e.startsWith("w"))return"tt-w";return"tt-s"}function f_(e,t,i){let s=t.getBoundingClientRect(),n=e.getBoundingClientRect(),r=s.left+s.width*0.5,o=s.top+s.height*0.5,a;if(i.startsWith("s")||i.startsWith("n"))a=Math.max(8,Math.min(n.width-8,r-n.left))-4;else a=Math.max(8,Math.min(n.height-8,o-n.top))-4;e.style.setProperty("--tosi-tooltip-arrow",a+"px")}function p_(e,t){if(t)e=ue(e);let i=h_({class:Ds});return i.innerHTML=Ae.parseInline(e),i}function m_(e,t,i){ew(),To(),wu=e;let{top:s,left:n,width:r}=e.getBoundingClientRect(),o=n+r*0.5,a=window.innerHeight,l=window.innerWidth,c=(s>a*0.5?"n":"s")+(o>l*0.5?"w":"e"),h=p_(t,i);h.classList.add(d_(c)),ml=Na({content:h,target:e,position:c,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(ml&&wu)f_(h,e,c)})}function g_(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.tooltip)return t;return null}function O_(e={}){ew();let{convertTitles:t=!0,delay:i=250,localize:s=!1}=e;document.addEventListener("pointermove",(n)=>{if(t){for(let a of n.composedPath())if(a instanceof HTMLElement&&a.title&&!a.dataset.tooltip){a.dataset.tooltip=a.title,a.removeAttribute("title");break}}let r=g_(n);if(r===wu)return;if(To(),!r)return;let o=r.dataset.tooltip||null;if(!o)return;vu=setTimeout(()=>m_(r,o,s),i)}),document.addEventListener("pointerleave",To),document.addEventListener("pointerdown",To),document.addEventListener("keydown",To),window.addEventListener("scroll",To,!0)}var KO={};Ji(KO,{CodeEditor:()=>wn,codeEditor:()=>kn});var{div:gP}=L,OP=new Set,Qc=(e,t)=>{if(OP.has(e))return;OP.add(e),console.warn(`<tosi-code>.${e} was removed in tosijs-ui 1.7 (the editor is now CodeMirror 6, not ACE) — ${t}. See CHANGELOG 1.7.0.`)},yP=!1,Cf=!1;class wn extends R{static preferredTagName="tosi-code";source="";_handle;_loadPromise;_loadGeneration=0;_appliedMode="";_appliedDisabled;_tjsAutocomplete;get tjsAutocomplete(){return this._tjsAutocomplete}set tjsAutocomplete(e){if(this._tjsAutocomplete=e,this._handle&&this.isTjsMode())this.applyTjsExtension()}get value(){return this._handle?this._handle.getValue():this.source}set value(e){if(this._handle)this._handle.setValue(e);else this.source=e}_original;get original(){return this._original??this.value}set original(e){this._original=e}diffOverlay;_pendingDiff;get showingDiff(){if(!this.hydrated)return this._pendingDiff??!1;return!this.parts.diffHost.hidden}diffResolvable=!1;diffOriginalLabel="Original";diffModifiedLabel="Modified";showDiff(e){if(!this.hydrated){this._pendingDiff=e;return}let{diffHost:t}=this.parts;if(e){if(this.diffOverlay===void 0)this.diffOverlay=el(),t.append(this.diffOverlay);this.diffOverlay.resolvable=this.diffResolvable,this.diffOverlay.originalLabel=this.diffOriginalLabel,this.diffOverlay.modifiedLabel=this.diffModifiedLabel,this.diffOverlay.original=this.original,this.diffOverlay.modified=this.value}else if(this.diffOverlay!==void 0&&this.diffResolvable){let i=this.diffOverlay.value;if(i!==this.value)this.value=i,this.dispatchEvent(new CustomEvent("change",{detail:{value:i}}))}t.hidden=!e}static initAttributes={mode:"javascript",disabled:!1};role="code editor";get editor(){if(!yP)yP=!0,console.info("<tosi-code>.editor is the CodeMirror 6 EditorView (the supported accessor; it was an ACE editor in 1.6). ACE-era `editor.session` / `getSession()` / "+"`setOption()` are gone — use undo()/redo()/canUndo()/canRedo() for history.");return this._handle?.view}get theme(){return Qc("theme","style the editor with --code-bg / --text-color instead"),""}set theme(e){Qc("theme","style the editor with --code-bg / --text-color instead")}get options(){return Qc("options","configure CodeMirror via the `editor` (EditorView) instead"),{}}set options(e){Qc("options","configure CodeMirror via the `editor` (EditorView) instead")}get ace(){Qc("ace","use `editor`, which is now a CodeMirror EditorView");return}undo(){this._handle?.undo()}redo(){this._handle?.redo()}canUndo(){return this._handle?.canUndo()??!1}canRedo(){return this._handle?.canRedo()??!1}content=()=>[gP({part:"host"}),gP({part:"diffHost",hidden:!0})];static shadowStyleSpec={":host":{display:"block",position:"relative",width:"100%",height:"100%"},'[part="host"]':{height:"100%"},'[part="diffHost"]':{position:"absolute",inset:"0",zIndex:"5",overflow:"auto",_background:w.codeBg(w.inputBg("#fdfdfd")),background:w.tosiDiffBg(w.codeBg("#fdfdfd"))},".cm-editor":{height:"100%"},".cm-scroller":{outline:"none",fontFamily:"Menlo, Monaco, Consolas, 'Courier New', monospace"}};handleResize(){this._handle?.refresh()}connectedCallback(){if(super.connectedCallback(),this.source==="")this.value=this.textContent!==null?this.textContent.trim():"";if(this._pendingDiff!==void 0){let e=this._pendingDiff;this._pendingDiff=void 0,this.showDiff(e)}if(this._loadPromise===void 0){let e=++this._loadGeneration;this._loadPromise=Promise.resolve().then(() => (GO(),UO)).then(({createCmEditor:t})=>{if(e!==this._loadGeneration||!this.isConnected)return;let i=t(this.parts.host,{value:this.source,mode:this.mode,readOnly:this.disabled,root:this.shadowRoot??void 0,onChange:(s)=>this.dispatchEvent(new CustomEvent("change",{detail:{value:s}}))});return this._handle=i,this._appliedMode=this.mode,this._appliedDisabled=this.disabled,this.applyTjsExtension(),i})}}disconnectedCallback(){if(super.disconnectedCallback(),this._handle)this.source=this._handle.getValue(),this._handle.destroy(),this._handle=void 0;this._loadPromise=void 0,this._appliedMode="",this._appliedDisabled=void 0}isTjsMode(){return this.mode==="tjs"||this.mode==="ajs"}applyTjsExtension(){let e=this._handle;if(!e||!this.isTjsMode())return;Promise.resolve().then(() => (GO(),UO)).then(({loadTjsExtension:t})=>t(this._tjsAutocomplete??{})).then((t)=>{if(t&&this._handle===e&&this.isTjsMode()){e.setLanguageExtension(t),this._tjsExtensionApplied=!0;return}if(!t&&this._handle===e&&this.isTjsMode()&&!Cf)Cf=!0,console.warn(`<tosi-code mode="${this.mode}">: tjs-lang's CodeMirror extension did not load — `+"falling back to TypeScript highlighting (no tjs autocomplete). Install the optional peer `tjs-lang`, or check that tjs-lang/editors/codemirror still exports `tjsEditorExtension`.")}).catch((t)=>{if(!Cf)Cf=!0,console.warn("<tosi-code>: failed to apply the tjs extension —",t)})}get tjsExtensionApplied(){return this._tjsExtensionApplied}_tjsExtensionApplied=!1;render(){if(super.render(),this._handle){if(this.disabled!==this._appliedDisabled)this._handle.setReadOnly(this.disabled),this._appliedDisabled=this.disabled;if(this.mode!==this._appliedMode)this._handle.setMode(this.mode),this._appliedMode=this.mode,this.applyTjsExtension()}}}var kn=wn.elementCreator();var ky={};Ji(ky,{createDocBrowser:()=>wy,hasTestBlock:()=>lE});var fV=/^readme\.md$/i;function bP(e){if(fV.test(e))return"";return e.replace(/\.[^.]+$/,"")}function ha(e){let t={};for(let s of e){let n=bP(s.filename);t[n]=(t[n]||0)+1}let i={};for(let s of e){let n=bP(s.filename);i[s.filename]=n!==""&&t[n]>1?s.filename.replace(/\./g,"-"):n}return i}function JO(e){return e===""?"/":`/${e}/`}function vP(e,t){let i=e.replace(/^\?/,"");if(!i||i.includes("=")||i.includes("&"))return null;let s=decodeURIComponent(i),n=t[s];if(n===void 0)return null;return JO(n)}function pV(e){return e.replace(/^\/+/,"").replace(/\/+$/,"").replace(/\/index\.html$/i,"")}function ey(e,t){let i=pV(e);for(let[s,n]of Object.entries(t))if(n===i)return s;return""}function xP(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ty(e,t,i){if(!e)return"";for(let n of t)if(n.filename===e)return n.filename;for(let n of t)if(i[n.filename]===e)return n.filename;let s=xP(e);for(let n of t)if(i[n.filename]===s)return n.filename;for(let n of t)if(n.title&&xP(n.title)===s)return n.filename;return""}function wP(e){return e.pin==="top"?0:e.pin==="bottom"?2:1}function mV(e,t){return wP(e)-wP(t)||(e.order??500)-(t.order??500)||(e.title||"").toLocaleLowerCase().localeCompare((t.title||"").toLocaleLowerCase())||e.filename.localeCompare(t.filename)}function Tf(e,t){let i=new Map;for(let o of e)i.set(o.filename,{doc:o,slug:t[o.filename]??"",children:[],depth:0});let s=new Map;for(let o of e){let a=o.parent?ty(o.parent,e,t):"";if(a&&(a===o.filename||!i.has(a)||gV(o.filename,a,e,t)))a="";s.set(o.filename,a)}let n=[];for(let o of e){let a=s.get(o.filename)||"",l=i.get(o.filename);if(a)i.get(a).children.push(l);else n.push(l)}let r=(o,a)=>{o.sort((l,c)=>mV(l.doc,c.doc));for(let l of o)l.depth=a,r(l.children,a+1)};return r(n,0),n}function gV(e,t,i,s){let n=new Map(i.map((a)=>[a.filename,a])),r=t,o=new Set([e]);while(r){if(o.has(r))return!0;o.add(r);let a=n.get(r);r=a?.parent?ty(a.parent,i,s):""}return!1}var OV=new ko,ny,ry=new uu;ry.use({renderer:{code(e){let t=String(e.lang||""),i=t.match(/^[a-z]+/)?.[0]??"",s=t.match(/#([A-Za-z0-9_-]+)/)?.[1]??"",n=t.match(/:([a-z]+)/)?.[1]??"",r=ny?.get(e.text);if(!s&&!n&&!r)return!1;let o=OV.code({...e,lang:i}),a=[s&&`data-example-id="${s}"`,n&&`data-example-mode="${n}"`].filter(Boolean).join(" ");if(a)o=o.replace(/^<pre>/,`<pre ${a}>`);if(r){let l=JSON.stringify(r.js).replace(/</g,"\\u003c");o+=`<script type="application/tosi-transpiled" data-dialect="${r.dialect}">${l}</script>`}return o}}});function iy(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function yV(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var bV=new uu,sy=new Map,ua=[];ry.use({hooks:{preprocess(e){return sy=new Map,ua=[],e},postprocess(e){if(ua.length===0)return e;let t=ua.map((i)=>{let s=bV.parseInline(sy.get(i)??""),n=iy(i);return`<li id="fn-${n}"><p>${s} <a href="#fnref-${n}" class="footnote-backref" aria-label="Back to reference">↩</a></p></li>`}).join(`
|
|
152
|
+
`+s;else i.push(s)}return i},[]);this.innerHTML=t.map((i)=>i.startsWith("<")&&i.endsWith(">")?i:Ae(i,this.options)).join("")}else this.innerHTML=Ae(e,this.options);this.didRender()}}var lQ=du,Gm=du.elementCreator(),cQ=Gm,hQ=Gm;var{div:Km,span:fu,button:Jm}=L,al=86400000,uQ=[0,1,2,3,4,5,6],dQ=[1,2,3,4,5,6,7,8,9,10,11,12],eg=(e,t=2,i="0")=>String(e).padStart(t,i),ll=(e,t,i)=>new Date(`${e}-${eg(t)}-${eg(i)}`);class tg extends R{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:w.disabledOpacity(0.6)},':host [part="month"], :host [part="year"]':{_fieldWidth:"4em",flex:"1"},":host [part=week], :host [part=days]":{display:"grid",gridTemplateColumns:"auto auto auto auto auto auto auto",justifyItems:"stretch"},":host .today":{background:w.monthTodayBackground("transparent"),boxShadow:w.monthTodayShadow("none"),backdropFilter:w.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:w.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:w.monthDayColor("hotpink"),background:w.monthDayBackground("white"),fontWeight:w.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:w.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:w.monthDateCheckedColor("white"),background:w.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:w.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:w.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:w.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:w.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:w.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:ll(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:ll(new Date().getFullYear()+10,12,31).toISOString().split("T")[0],selectable:!1,multiple:!1,range:!1,disabled:!1,readonly:!1,required:!1,name:""};selectedDays=[];value="";formDisabledCallback(e){this.disabled=e}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return dQ.map((e)=>({caption:ll(2025,e,1).toString().split(" ")[1],value:String(e)}))}get years(){let e=Number(this.minDate.split("-")[0]),t=Number(this.maxDate.split("-")[0]),i=[];for(let s=e;s<=t;s++)i.push(String(s));return i}monthChanged=(e,t)=>{};gotoMonth(e,t){if(this.month!==t||this.year!==e)this.month=t,this.year=e,this.monthChanged(e,t)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(e){this.selectedDays[1]=e,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(e){this.selectedDays[0]=e,this.selectedDays.splice(2)}clickDate=(e)=>{let t=e.target.getAttribute("title");this.selectDate(t)};keyDate=(e)=>{let t=!1;switch(e.code){case"Space":{let i=e.target.getAttribute("title");this.selectDate(i),t=!0;break}case"Tab":break;default:console.log(e)}if(t)e.preventDefault(),e.stopPropagation()};#e="";selectDate=(e)=>{if(this.#e=e,this.range){if(!this.to)this.selectedDays=[e,e];else if(this.from===e&&this.to===e)this.selectedDays=[];else if(this.from===e)this.from=this.to;else if(this.to===e)this.to=this.from;else if(e<this.from)this.from=e;else if(e>this.to)this.to=e;else this.to=e;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(e))this.selectedDays.splice(this.selectedDays.indexOf(e),1);else this.selectedDays.push(e),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(e))this.value="",this.selectedDays=[];else this.value=e,this.selectedDays=[e]};nextMonth=()=>{if(this.month<12)this.gotoMonth(this.year,this.month+1);else this.gotoMonth(this.year+1,1)};previousMonth=()=>{if(this.month>1)this.gotoMonth(this.year,this.month-1);else this.gotoMonth(this.year-1,12)};checkDay=(e)=>{if(!this.range)return this.selectedDays.includes(e);else if(this.range)return this.from&&e>=this.from&&e<=this.to;return!1};dateMenuItem=(e,t="")=>(e=e.split("T")[0],{caption:t||e,enabled:()=>!e.startsWith(`${this.year}-${eg(this.month)}-`),action:()=>{this.gotoDate(e)}});jumpMenu=()=>{mt({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((e)=>this.dateMenuItem(e))]})};content=()=>[Km({part:"header"},Jm({part:"previous",onClick:this.previousMonth},j.chevronLeft()),fu({style:{flex:"1"}}),Jm({part:"jump",onClick:this.jumpMenu},j.calendar()),Ii({part:"month",options:this.months,onChange:this.setMonth}),Ii({part:"year",options:[this.year],onChange:this.setMonth}),fu({style:{flex:"1"}}),Jm({part:"next",onClick:this.nextMonth},j.chevronRight())),Km({part:"week"}),Km({part:"days"})];gotoDate(e){let t=new Date(e);this.gotoMonth(t.getFullYear(),t.getMonth()+1)}connectedCallback(){super.connectedCallback();let e=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=e.getMonth()+1;if(isNaN(this.year))this.year=e.getFullYear()}days=[];render(){super.render();let{week:e,days:t,jump:i,month:s,year:n,previous:r,next:o}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let a=ll(this.year,this.month,1),l=new Date(a.valueOf()-(7+a.getDay()-this.weekStart)%7*al),c=this.month===12?1:this.month+1,h=new Date(ll(this.year+(this.month===12?1:0),c,1).valueOf()-al),u=new Date(h.valueOf()+(this.weekStart*2+5+this.endDay-h.getDay())%7*al),d=uQ.map((x)=>new Date(l.valueOf()+x*al).toString().split(" ")[0]);this.days=[];let f=new Date().toISOString().split("T")[0];for(let x=l.valueOf();x<=u.valueOf();x+=al){let k=new Date(x),S=k.toISOString().split("T")[0];this.days.push({date:k,selected:!1,inMonth:k.getMonth()+1===this.month,isToday:S===f,isWeekend:k.getDay()%6===0,inRange:!!(this.from&&S>=this.from&&S<=this.to)})}s.value=String(this.month),n.value=String(this.year),s.disabled=n.disabled=i.disabled=r.disabled=o.disabled=this.disabled||this.readonly,n.options=this.years,e.textContent="",e.append(...d.map((x)=>fu({class:"day"},x))),t.textContent="";let m=null,{to:g,from:O}=this;t.append(...this.days.map((x)=>{let k=["date"];if(x.inMonth)k.push("in-month");if(x.isToday)k.push("today");let S=x.date.toISOString().split("T")[0];if(this.checkDay(S))k.push("checked");if(k.push(x.isWeekend?"weekend":"weekday"),this.range){if(g===S)k.push("range-end");if(O===S)k.push("range-start")}let P=fu({class:k.join(" "),title:S,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},x.date.getDate());if(S===this.#e)m=P;return P})),m?.focus()}}var fQ=tg.elementCreator();var{div:ig,button:pQ}=L,mQ={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class zn extends R{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${b.notificationSpacing} ${b.notificationSpacing50} ${b.notificationSpacing} ${b.notificationSpacing200}`,_notificationBg:w.background("#fafafa"),_notificationAccentColor:"#aaa",_notificationTextColor:w.textColor("#444"),_notificationIconSize:b.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:b.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:b.notificationSpacing,width:b.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:b.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:b.notificationTextColor},":host .note":{display:"grid",background:b.notificationBg,padding:b.notificationPadding,gridTemplateColumns:`${b.notificationIconSize} 1fr ${b.notificationButtonSize}`,gap:b.notificationSpacing,alignItems:"center",borderRadius:b.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${b.notificationAccentColor}`,borderColor:b.notificationAccentColor,borderWidth:b.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:b.notificationButtonSize,padding:0,margin:0,height:b.notificationButtonSize,width:b.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:b.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:b.notificationBg,background:b.notificationAccentColor,padding:b.spacing50},":host .note svg":{height:b.notificationIconSize,width:b.notificationIconSize,pointerEvents:"none",color:b.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:b.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(e){e.classList.add("closing"),e.style.marginBottom=-e.offsetHeight+"px";let t=()=>{e.remove()};e.addEventListener("transitionend",t),setTimeout(t,1000)}static post(e){let{message:t,duration:i,type:s,close:n,progress:r,icon:o,color:a}=Object.assign({type:"info",duration:-1},typeof e==="string"?{message:e}:e);if(!this.singleton)this.singleton=sg();let l=this.singleton;document.body.append(l),l.style.zIndex=String(br()+1);let c=a||mQ[s],h=r||s==="progress"?L.progress():{},u=()=>{if(n)n();zn.removeNote(m)},d=o instanceof SVGElement?o:o?j[o]():j.info(),f=s==="error"||s==="warn",m=ig({class:`note ${s}`,role:f?"alert":"status",ariaLive:f?"assertive":"polite",style:{_notificationAccentColor:c}},d,ig({class:"message"},ig(t),h),pQ({class:"close",title:"close",ariaLabel:"Close notification",apply(g){g.addEventListener("click",u)}},j.x()));if(l.shadowRoot.append(m),h instanceof HTMLProgressElement&&r instanceof Function){h.setAttribute("max",String(100)),h.value=r();let g=setInterval(()=>{if(!l.shadowRoot.contains(m)){clearInterval(g);return}let O=r();if(h.value=O,O>=100)zn.removeNote(m)},1000)}if(i>0)setTimeout(()=>{zn.removeNote(m)},i*1000);return m.scrollIntoView(),u}content=null}var gQ=zn,sg=zn.elementCreator(),OQ=sg;function ng(e){return zn.post(e)}var L2=async(e,t="SHA-1")=>{let s=new TextEncoder().encode(e),n=await crypto.subtle.digest(t,s);return Array.from(new Uint8Array(n)).map((a)=>a.toString(16).padStart(2,"0")).join("")},R2=async(e)=>{let t=await L2(e),i=await fetch(`https://weakpass.com/api/v1/search/${t}`);if(i.ok){let s=await i.json();console.log("password found in weakpass database",s)}return i.status!==404},{span:rg,tosiSlot:yQ}=L;class pu extends R{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:b.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:w.meterHeight("24px"),background:w.indicatorBg("white"),borderRadius:w.meterRadius("4px"),boxShadow:w.meterShadow(`inset 0 0 0 2px ${b.indicatorColor}`)},':host [part="level"]':{height:w.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:b.indicatorColor,margin:w.levelMargin("2px"),borderRadius:w.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:b.descriptionColor,height:w.meterHeight("24px"),lineHeight:w.meterHeight("24px"),textAlign:"center"}};static initAttributes={minLength:8,goodLength:12,indicatorColors:"#f00,#f40,#f80,#ef0,#8f0,#0a2"};descriptionColors="#000,#000,#000,#000,#000,#fff";issues={tooShort:!0,short:!0,noUpper:!0,noLower:!0,noNumber:!0,noSpecial:!0};issueDescriptions={tooShort:"too short",short:"short",noUpper:"no upper case",noLower:"no lower case",noNumber:"no digits",noSpecial:"no unusual characters"};value=0;strengthDescriptions=["unacceptable","very weak","weak","moderate","strong","very strong"];strength(e){return this.issues={tooShort:e.length<this.minLength,short:e.length<this.goodLength,noUpper:!e.match(/[A-Z]/),noLower:!e.match(/[a-z]/),noNumber:!e.match(/[0-9]/),noSpecial:!e.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((t)=>!t).length-1}async isBreached(){let e=this.querySelector("input")?.value;if(!e||typeof e!=="string")return!0;return await R2(e)}updateIndicator=(e)=>{let{level:t,description:i}=this.parts,s=this.indicatorColors.split(","),n=this.descriptionColors.split(","),r=this.strength(e);if(this.value!==r)this.value=r,this.dispatchEvent(new Event("change"));t.style.width=`${(r+1)*16.67}%`,this.style.setProperty("--indicator-color",s[r]),this.style.setProperty("--description-color",n[r]),i.textContent=this.strengthDescriptions[r]};update=(e)=>{let t=e.target.closest("input");this.updateIndicator(t?.value||"")};content=()=>[yQ({onInput:this.update}),rg({part:"meter"},rg({part:"level"}),rg({part:"description"}))];render(){super.render();let e=this.querySelector("input");this.updateIndicator(e?.value)}}var bQ=pu,I2=pu.elementCreator(),xQ=I2;var{button:vQ,div:wQ,slot:kQ}=L;class og extends R{static preferredTagName="tosi-pocket-bar";static initAttributes={icon:"",direction:"auto",open:!1};pinned=!1;get vertical(){return/^[ns]/.test(this.direction)}get resolvedIcon(){return this.icon||(this.vertical?"moreVertical":"moreHorizontal")}get floatPosition(){return this.direction==="auto"?"side":this.direction}reposition=()=>{if(!this.hydrated)return;vh(this.parts.bar,this.parts.handle,this.floatPosition,"remain","remain")};setOpen(e){if(this.open!==e)this.open=e;if(e)this.reposition()}handlePointerEnter=(e)=>{if(e.pointerType==="touch")return;this.setOpen(!0)};handlePointerLeave=(e)=>{if(e.pointerType==="touch")return;if(!this.pinned)this.setOpen(!1)};handleFocusIn=()=>this.setOpen(!0);handleFocusOut=()=>{requestAnimationFrame(()=>{if(!this.pinned&&!this.matches(":focus-within"))this.setOpen(!1)})};close=()=>{this.pinned=!1,this.setOpen(!1)};toggle=(e)=>{e?.preventDefault(),this.pinned=!this.pinned,this.setOpen(this.pinned)};handleOutsidePointer=(e)=>{if(!this.pinned)return;let t=e.composedPath();if(!t.includes(this)&&!t.includes(this.parts.bar))this.pinned=!1,this.setOpen(!1)};handleScrollResize=()=>{if(this.open)this.reposition()};content=()=>[vQ({part:"handle",class:"no-drag",title:"toolbar","aria-label":"toolbar","aria-expanded":"false",onClick:this.toggle},qp({part:"handleIcon",icon:this.resolvedIcon})),wQ({part:"bar",role:"toolbar",style:{flexDirection:this.vertical?"column":"row"}},kQ())];static shadowStyleSpec={":host":{display:"inline-flex",position:"relative",opacity:w.tosiPocketOpacity("0.75"),transition:"opacity 0.15s ease-out"},":host([open])":{opacity:"1"},':host [part="handle"]':{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:b.spacing50,border:"0",margin:"0",cursor:"pointer",color:w.tosiPocketHandleColor("inherit"),background:w.tosiPocketHandleBg(w.tosiPocketBg("color-mix(in srgb, var(--tosi-bg, #fff) 85%, transparent)")),backdropFilter:"blur(12px)",borderRadius:w.tosiPocketHandleRadius(b.spacing),width:w.tosiPocketHandleSize("auto"),height:w.tosiPocketHandleSize("auto"),transition:"background 0.15s ease-out"},':host [part="bar"]':{position:"fixed",display:"flex",gap:b.spacing25,padding:b.spacing25,background:w.tosiPocketBg("color-mix(in srgb, var(--tosi-bg, #fff) 82%, transparent)"),backdropFilter:"blur(12px)",borderRadius:b.spacing,boxShadow:`0 ${b.spacing25} ${b.spacing} #0003`,opacity:"0",pointerEvents:"none",transform:"scale(0.9)",transition:"opacity 0.15s ease-out, transform 0.15s ease-out"},':host([open]) [part="bar"]':{opacity:"1",pointerEvents:"auto",transform:"scale(1)"},"::slotted(button), ::slotted(label)":{display:"inline-flex",alignItems:"center",gap:b.spacing25,padding:b.spacing50,margin:"0",border:"0",background:"transparent",color:"inherit",font:"inherit",cursor:"pointer",borderRadius:b.spacing25,transition:"background 0.15s ease-out, opacity 0.15s, filter 0.15s"},"::slotted(button:hover), ::slotted(label:hover)":{background:"color-mix(in srgb, currentColor 15%, transparent)"},'::slotted(label:has(input[type="checkbox"]:not(:checked)))':{opacity:"0.45",filter:"grayscale(1)"}};connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",this.handlePointerEnter),this.addEventListener("pointerleave",this.handlePointerLeave),this.addEventListener("focusin",this.handleFocusIn),this.addEventListener("focusout",this.handleFocusOut),document.addEventListener("pointerdown",this.handleOutsidePointer,!0),window.addEventListener("scroll",this.handleScrollResize,{passive:!0,capture:!0}),window.addEventListener("resize",this.handleScrollResize,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this.handleOutsidePointer,!0),window.removeEventListener("scroll",this.handleScrollResize,!0),window.removeEventListener("resize",this.handleScrollResize)}render(){super.render(),this.parts.handleIcon.icon=this.resolvedIcon,this.parts.bar.style.flexDirection=this.vertical?"column":"row",this.parts.handle.setAttribute("aria-expanded",String(!!this.open)),this.reposition()}}var ag=og.elementCreator();var{span:lg}=L;class mu extends R{static preferredTagName="tosi-rating";static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"#ccc",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(e){this.readonly=e}formResetCallback(){this.value=""}static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"fit-content"},":host::part(container)":{position:"relative",display:"inline-block"},":host::part(empty), :host::part(filled)":{height:"100%",whiteSpace:"nowrap",overflow:"hidden"},":host::part(empty)":{pointerEvents:"none"},":host::part(filled)":{position:"absolute",left:0,transition:"width 0.15s ease-out"},":host svg":{transform:"scale(0.9)",pointerEvents:"all !important",transition:"0.25s ease-in-out"},":host svg:hover":{transform:"scale(1)"},":host svg:active":{transform:"scale(1.1)"}};content=()=>lg({part:"container"},lg({part:"empty"}),lg({part:"filled"}));displayValue(e){let{empty:t,filled:i}=this.parts,n=Math.round((typeof e==="string"?0:e||0)/this.step)*this.step;i.style.width=n/this.max*t.offsetWidth+"px"}update=(e)=>{if(this.readonly)return;let{empty:t}=this.parts,i=e instanceof MouseEvent?e.pageX-t.getBoundingClientRect().x:0,s=Math.min(Math.max(this.min,Math.round(i/t.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(e.type==="click")this.value=s;else if(e.type==="mousemove")this.displayValue(s);else this.displayValue(this.value||0)};handleKey=(e)=>{let t=this.value===""?NaN:Number(this.value);if(isNaN(t))t=Math.round((this.min+this.max)*0.5*this.step)*this.step;let i=!1;switch(e.key){case"ArrowUp":case"ArrowRight":t+=this.step,i=!0;break;case"ArrowDown":case"ArrowLeft":t-=this.step,i=!0;break}if(this.value=Math.max(Math.min(t,this.max),this.min),i)e.stopPropagation(),e.preventDefault()};connectedCallback(){super.connectedCallback();let{container:e}=this.parts;e.tabIndex=0,e.addEventListener("mousemove",this.update,!0),e.addEventListener("mouseleave",this.update),e.addEventListener("blur",this.update),e.addEventListener("click",this.update),e.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let e=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",e),this.readonly)this.role="image";else this.role="slider";this.ariaLabel=`rating ${this.value} out of ${this.max}`,this.ariaValueMax=String(this.max),this.ariaValueMin=String(this.min),this.ariaValueNow=this.value===""?String(-1):String(this.value);let{empty:t,filled:i}=this.parts;if(t.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),t.style.setProperty("--tosi-icon-stroke",this.emptyStroke),i.style.setProperty("--tosi-icon-fill",this.ratingFill),i.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let s=0;s<this.max;s++)t.append(j[this.icon]()),i.append(j[this.icon]())}this.displayValue(this.value)}}var SQ=mu,j2=mu.elementCreator(),CQ=li((...e)=>j2(...e),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:B2,div:TQ,button:$Q}=L,PQ=[{caption:"Title",tagType:"H1"},{caption:"Heading",tagType:"H2"},{caption:"Subheading",tagType:"H3"},{caption:"Minor heading",tagType:"H4"},{caption:"Body",tagType:"P"},{caption:"Code Block",tagType:"PRE"}];function cg(e=PQ){return Ii({title:"paragraph style",slot:"toolbar",class:"block-style",options:e.map(({caption:t,tagType:i})=>({caption:t,value:`formatBlock,${i}`}))})}var cl=()=>Bm({slot:"toolbar"});function cs(e,t,i){return $Q({slot:"toolbar",dataCommand:t,title:e},i)}var EQ=()=>[cs("left-justify","justifyLeft",j.alignLeft()),cs("center","justifyCenter",j.alignCenter()),cs("right-justify","justifyRight",j.alignRight()),cl(),cs("bullet list","insertUnorderedList",j.listBullet()),cs("numbered list","insertOrderedList",j.listNumber()),cl(),cs("indent","indent",j.indent()),cs("indent","outdent",j.outdent())],D2=()=>[cs("bold","bold",j.fontBold()),cs("italic","italic",j.fontItalic()),cs("underline","underline",j.fontUnderline())],AQ=()=>[cg(),cl(),...D2()],N2=()=>[cg(),cl(),...EQ(),cl(),...D2()];class gu extends R{static preferredTagName="tosi-rich-text";static lightStyleSpec={":host":{display:"flex",flexDirection:"column",height:"100%"},':host [part="toolbar"]':{padding:4,display:"flex",gap:"0px",flex:"0 0 auto",flexWrap:"wrap"},':host [part="toolbar"] > button':{_xinIconSize:18}};static formAssociated=!0;static initAttributes={widgets:"default",name:"",required:!1};isInitialized=!1;savedValue="";formDisabledCallback(e){if(this.isInitialized)this.parts.doc.contentEditable=e?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(e){let t=this._value;if(this._value=e,this.isInitialized){if(this.parts.doc.innerHTML!==e)this.parts.doc.innerHTML=e}if(t!==e&&this.internals)this.internals.setFormValue(e)}blockElement(e){let{doc:t}=this.parts;while(e.parentElement!==null&&e.parentElement!==t)e=e.parentElement;return e.parentElement===t?e:void 0}get selectedBlocks(){let{doc:e}=this.parts,t=window.getSelection();if(t===null)return[];let i=[];for(let s=0;s<t.rangeCount;s++){let n=t.getRangeAt(s);if(!e.contains(n.commonAncestorContainer))continue;let r=this.blockElement(n.startContainer),o=this.blockElement(n.endContainer);i.push(r);while(r!==o&&r!==null)r=r.nextElementSibling,i.push(r)}return i}get selectedText(){let e=window.getSelection();if(e===null)return"";return this.selectedBlocks.length?e.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(e)=>{if(this._updatingBlockStyle)return;let i=e.target?.closest(Rs.tagName);if(i==null)return;this.doCommand(i.value)};handleButtonClick=(e)=>{let i=e.target?.closest("button");if(i==null)return;this.doCommand(i.dataset.command)};content=[B2({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),TQ({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),B2({part:"content"})];doCommand(e){if(e===void 0)return;let t=e.split(",");console.log("execCommand",t[0],!1,...t.slice(1)),document.execCommand(t[0],!1,...t.slice(1))}updateBlockStyle(){let e=this.parts.toolbar.querySelector(".block-style");if(e===null)return;let t=this.selectedBlocks.map((i)=>i.tagName);t=[...new Set(t)],this._updatingBlockStyle=!0,e.value=t.length===1?`formatBlock,${t[0]}`:"",this._updatingBlockStyle=!1}hasContent(){return(this.parts.doc.textContent||"").trim().length>0}handleInput=()=>{if(this.internals)this.internals.setFormValue(this.parts.doc.innerHTML),this.updateValidity()};updateValidity(){if(this.internals)if(this.required&&!this.hasContent())this.internals.setValidity({valueMissing:!0},"Please enter some content",this.parts.doc);else this.internals.setValidity({})}connectedCallback(){super.connectedCallback();let{doc:e,content:t}=this.parts;if(t.innerHTML!==""&&e.innerHTML==="")e.innerHTML=t.innerHTML,t.innerHTML="";this.isInitialized=!0,t.style.display="none",e.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(i)=>{this.updateBlockStyle(),this.selectionChange(i,this)})}render(){let{toolbar:e}=this.parts;if(super.render(),e.children.length===0)switch(this.widgets){case"minimal":e.append(...AQ());break;case"default":e.append(...N2());break}}}var MQ=gu,z2=gu.elementCreator(),QQ=li((...e)=>z2(...e),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:hl}=Rt({router:{path:"",hash:"",pattern:""}}),hg={};function _Q(){return{...hg}}var Ou=[],ug=!1,yu=new Set;function LQ(e){let t=[];if(e==="")return{regex:/^\/?$/,paramNames:t};let i=e.split("/").map((n)=>{if(n.startsWith(":"))return t.push(n.slice(1)),"([^/]+)";return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+i.join("/")+"/?$"),paramNames:t}}function RQ(e){let t=e.split("?")[0].split("#")[0];for(let s of Ou){if(s.fallback)continue;let n=t.match(s.regex);if(n){let r={};return s.paramNames.forEach((o,a)=>{r[o]=decodeURIComponent(n[a+1])}),{route:s,params:r}}}let i=Ou.find((s)=>s.fallback);if(i)return{route:i,params:{}};return null}function ul(){let e=ug?window.location.hash.replace(/^#\/?/,"").split("?")[0]:window.location.pathname;hl.path.value=e,hl.hash.value=window.location.hash;let t=RQ(e);if(t){hg=t.params,hl.pattern.value=t.route.regex.source;let i=new Map;for(let s of t.route.targets)i.set(s.view??"default",s);for(let s of yu){let n=s.name||"default",r=i.get(n);if(r)s.replaceChildren(r.component(t.params));else s.replaceChildren()}}else{hg={},hl.pattern.value="";for(let i of yu)i.replaceChildren()}}var V2=!1;function X2(){if(V2)return;V2=!0,window.addEventListener("popstate",ul),window.addEventListener("hashchange",ul)}function IQ(e,t={}){ug=t.hashRouting??!1,Ou=e.map((i)=>{let{regex:s,paramNames:n}=LQ(i.pattern);return{regex:s,paramNames:n,targets:i.targets,fallback:i.fallback??!1}}),X2(),ul()}function jQ(e){if(X2(),ug)window.location.hash="#/"+e.replace(/^\//,"");else window.history.pushState({},"","/"+e.replace(/^\//,""));ul()}class dg extends R{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),yu.add(this),Ou.length>0)ul()}disconnectedCallback(){super.disconnectedCallback(),yu.delete(this)}}var BQ=dg.elementCreator();var{div:DQ,slot:NQ,label:zQ,span:VQ,input:Z2}=L;class So extends R{static preferredTagName="tosi-segmented";static formAssociated=!0;static initAttributes={direction:"row",other:"",multiple:!1,name:"",placeholder:"Please specify…",localized:!1,required:!1};_choices=[];get choices(){return this._choices}set choices(e){if(typeof e==="string")this._choices=So.parseChoicesString(e);else this._choices=e;this.queueRender()}static parseChoicesString(e){return e.split(",").filter((t)=>t.trim()!=="").map((t)=>{let[i,s]=t.split("=").map((a)=>a.trim()),[n,r]=(s||i).split(":").map((a)=>a.trim()),o=r?j[r]():"";return{value:i,icon:o,caption:n}})}value="";formDisabledCallback(e){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((e)=>e.trim()).filter((e)=>e!=="")}content=()=>[NQ(),DQ({part:"options"},Z2({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:w.segmentedOptionGap("8px"),alignItems:w.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:w.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:w.segmentedOptionGap("8px"),gridTemplateColumns:w.segmentedOptionGridColumns("0px 24px 1fr"),padding:w.segmentedOptionPadding("4px 12px"),font:w.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:w.segmentedFocusShadow(`inset 0 0 0 2px ${w.segmentedOptionCurrentBackground("#44a")}`),borderRadius:w.segmentedOptionsBorderRadius("8px")},":host label.current":{color:w.segmentedOptionCurrentColor("#eee"),background:w.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:w.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${w.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:w.segmentOptionIconSize("16px"),stroke:w.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:w.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:w.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:w.segmentedOptionsBorderRadius("8px"),background:w.segmentedOptionsBackground("#fff"),color:w.segmentedOptionColor("#222"),overflow:"hidden",alignItems:w.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:w.segmentedOptionPadding("4px 12px"),color:w.segmentedOptionCurrentColor("#eee"),background:w.segmentedOptionCurrentBackground("#44a"),font:w.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:w.segmentedOptionCurrentColor("#eee"),opacity:w.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:e}=this.parts,{values:t,isOtherValue:i}=this;e.querySelectorAll("label").forEach((s)=>{let n=s.querySelector("input")?.value??"";s.classList.toggle("current",t.includes(n)||n===""&&i)})}handleChange=()=>{let{options:e,custom:t}=this.parts;if(this.multiple){let i=[...e.querySelectorAll("input:checked")];this.value=i.map((s)=>s.value).join(",")}else{let i=e.querySelector("input:checked");if(!i)this.value="";else if(i.value)t.setAttribute("hidden",""),this.value=i.value;else t.removeAttribute("hidden"),t.focus(),t.select(),this.value=t.value}this.syncCurrent()};handleKey=(e)=>{let t=!1;switch(e.code){case"Space":if(e.target instanceof HTMLLabelElement)e.target.click(),t=!0;break;case"Tab":if(!(e.target instanceof HTMLLabelElement))e.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let i=e.target.closest("label");if(i.previousElementSibling instanceof HTMLLabelElement)i.previousElementSibling.focus()}t=!0;break;case"ArrowRight":case"ArrowDown":{let i=e.target.closest("label");if(i.nextElementSibling instanceof HTMLLabelElement)i.nextElementSibling.focus()}t=!0;break}if(t)e.preventDefault(),e.stopPropagation()};connectedCallback(){super.connectedCallback();let e=this.getAttribute("choices");if(e&&this._choices.length===0)this._choices=So.parseChoicesString(e);let{options:t}=this.parts;if(this.name==="")this.name=this.instanceId;if(t.addEventListener("change",this.handleChange),t.addEventListener("keydown",this.handleKey),this.other&&this.multiple)console.warn(this,"is set to [other] and [multiple]; [other] will be ignored"),this.other=""}get _choicesWithOther(){let e=[...this.choices];if(this.other&&!this.multiple){let[t,i]=this.other.split(":");e.push({value:"",caption:t,icon:i})}return e}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((e)=>e.value===this.value))}render(){super.render();let{options:e,custom:t}=this.parts,i=this.multiple?"checkbox":"radio",{values:s,isOtherValue:n}=this,r=this._choicesWithOther,o=(c)=>s.includes(c)||c===""&&n,a=[...e.querySelectorAll("label")];if(a.length===r.length&&a.every((c,h)=>c.querySelector("input")?.value===r[h].value))a.forEach((c)=>{let h=c.querySelector("input");if(h&&h.checked!==o(h.value))h.checked=o(h.value)});else e.textContent="",e.append(...r.map((c)=>zQ({tabindex:0},Z2({type:i,name:this.name,value:c.value,checked:o(c.value),tabIndex:-1}),c.icon||{class:"no-icon"},this.localized?ns(c.caption):VQ(c.caption))));if(this.other&&!this.multiple){t.hidden=!n;let c=n?this.value:"";if(t.value!==c)t.value=c;if(t.placeholder=this.placeholder,t.parentElement!==e)e.append(t)}this.syncCurrent()}}var XQ=So,F2=So.elementCreator(),ZQ=li((...e)=>F2(...e),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:W2}=L;class Sr extends R{static preferredTagName="tosi-sidenav";static initAttributes={minSize:800,navSize:200,compact:!1,contentVisible:!1,alwaysCompact:!1};value="normal";get navVisible(){return!this.compact||!this.contentVisible}set navVisible(e){if(e){this.alwaysCompact=!1,this.contentVisible=!1;return}let t=this.offsetParent;if(!(t?t.offsetWidth<this.minSize:!1))this.alwaysCompact=!0;this.contentVisible=!0}content=[W2({name:"nav",part:"nav"}),W2({part:"content"})];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:`${w.navWidth("50%")} ${w.contentWidth("50%")}`,gridTemplateRows:"100%",position:"relative",margin:w.margin("0 0 0 -100%"),transition:w.sideNavTransition("0.25s ease-out")},":host slot":{position:"relative"},":host slot:not([name])":{display:"block"},':host slot[name="nav"]':{display:"block"}};handleResize=()=>{let{content:e}=this.parts,t=this.offsetParent;if(t===null)return;let i;if(this.compact=this.alwaysCompact||t.offsetWidth<this.minSize,[...this.childNodes].find((n)=>n instanceof Element?n.getAttribute("slot")!=="nav":!0)===void 0)i="compact/nav",this.style.setProperty("--nav-width","100%"),this.style.setProperty("--content-width","0%");else if(!this.compact)i="normal",e.classList.add("-tosi-sidenav-visible"),this.style.setProperty("--nav-width",`${this.navSize}px`),this.style.setProperty("--content-width",`calc(100% - ${this.navSize}px)`),this.style.setProperty("--margin","0");else if(e.classList.remove("-tosi-sidenav-visible"),this.style.setProperty("--nav-width","50%"),this.style.setProperty("--content-width","50%"),this.contentVisible)i="compact/content",this.style.setProperty("--margin","0 0 0 -100%");else i="compact/nav",this.style.setProperty("--margin","0 -100% 0 0");if(this.value!==i)this.value=i;this.releaseTransition()};observer;connectedCallback(){super.connectedCallback(),this.contentVisible=this.parts.content.childNodes.length===0,globalThis.addEventListener("resize",this.handleResize),this.observer=new MutationObserver(this.handleResize),this.observer.observe(this,{childList:!0}),this.style.setProperty("--side-nav-transition","0s")}releaseTransition=()=>{if(!this.transitionSuppressed)return;this.transitionSuppressed=!1,requestAnimationFrame(()=>{this.style.removeProperty("--side-nav-transition")})};transitionSuppressed=!0;disconnectedCallback(){super.disconnectedCallback(),this.observer.disconnect()}render(){super.render(),this.handleResize()}}var FQ=Sr,dl=Sr.elementCreator(),WQ=dl,qQ=dl;var{slot:q2}=L;class fg extends R{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[q2({part:"normal"}),q2({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};handleResize=()=>{let{normal:e,small:t}=this.parts,i=this.offsetParent;if(!(i instanceof HTMLElement))return;else if(i.offsetWidth<this.minWidth||i.offsetHeight<this.minHeight)e.hidden=!0,t.hidden=!1,this.value="small";else e.hidden=!1,t.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.handleResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.handleResize)}}var HQ=fg.elementCreator();class bu extends R{static preferredTagName="tosi-sizer";target=null;static shadowStyleSpec={":host":{_resizeIconFill:"#222",display:"block",position:"absolute",bottom:-7,right:-7,padding:14,width:44,height:44,opacity:0.25,transition:"opacity 0.25s ease-out"},":host(:hover)":{opacity:0.5},":host svg":{width:16,height:16,stroke:b.resizeIconFill}};content=j.resize();get minSize(){let{minWidth:e,minHeight:t}=getComputedStyle(this.target);return{width:parseFloat(e)||32,height:parseFloat(t)||32}}resizeTarget=(e)=>{let{target:t}=this;if(!t)return;let{offsetWidth:i,offsetHeight:s}=t;t.style.left=t.offsetLeft+"px",t.style.top=t.offsetTop+"px",t.style.bottom="",t.style.right="";let{minSize:n}=this;vi(e,(r,o,a)=>{if(t.style.width=Math.max(n.width,i+r)+"px",t.style.height=Math.max(n.height,s+o)+"px",a.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let e={passive:!0};this.addEventListener("mousedown",this.resizeTarget),this.addEventListener("touchstart",this.resizeTarget,e)}}var YQ=bu,H2=bu.elementCreator(),UQ=H2;var{div:Cr,slot:Y2,span:GQ,button:KQ}=L;class xu extends R{static preferredTagName="tosi-tabs";static initAttributes={localized:!1};value=0;makeTab(e,t,i){let s=t.getAttribute("name"),n=t.querySelector('template[role="tab"]')?.content.cloneNode(!0)||(this.localized?ns(s):GQ(s)),r=Cr(n,{part:"tab",tabindex:0,role:"tab",ariaControls:i},t.hasAttribute("data-close")?KQ({title:"close",class:"close"},j.x()):{}),o=t.dataset.tooltip;if(o)r.dataset.tooltip=o;return r}static shadowStyleSpec={":host":{"--tosi-tabs-selected-color":"var(--xin-tabs-selected-color, var(--tosi-accent, currentColor))","--tosi-tabs-bar-color":"var(--xin-tabs-bar-color, #ccc)","--tosi-tabs-bar-height":"var(--xin-tabs-bar-height, 2px)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",boxShadow:"none !important"},slot:{position:"relative",display:"block",flex:"1",overflow:"hidden",overflowY:"auto"},'slot[name="after-tabs"]':{flex:"0 0 auto"},"::slotted([hidden])":{display:"none !important"},":host::part(tabpanel)":{display:"flex",flexDirection:"column",overflowX:"auto"},":host::part(tabrow)":{display:"flex"},":host .tabs":{display:"flex",userSelect:"none",whiteSpace:"nowrap"},":host .tabs > div":{padding:`${b.spacing50} ${b.spacing}`,cursor:"default",display:"flex",alignItems:"baseline"},":host .tabs > [aria-selected]":{"--text-color":b.tosiTabsSelectedColor,color:b.textColor},":host .elastic":{flex:"1"},":host .border":{background:b.tosiTabsBarColor},":host .border > .selected":{content:" ",width:0,height:b.tosiTabsBarHeight,background:b.tosiTabsSelectedColor,transition:"ease-out 0.2s"},":host button.close":{border:0,background:"transparent",textAlign:"center",marginLeft:b.spacing50,padding:0},":host button.close > svg":{height:"12px"}};handleCloseTab=null;get onCloseTab(){return this.handleCloseTab}set onCloseTab(e){this.handleCloseTab=e}content=[Cr({role:"tabpanel",part:"tabpanel"},Cr({part:"tabrow"},Cr({class:"tabs",part:"tabs"}),Cr({class:"elastic"}),Y2({name:"after-tabs"})),Cr({class:"border"},Cr({class:"selected",part:"selected"}))),Y2()];addTabBody(e,t=!1){if(!e.hasAttribute("name"))throw console.error("element has no name attribute",e),Error("element has no name attribute");if(this.append(e),this.setupTabs(),t)this.value=this.bodies.length-1;this.queueRender()}removeTabBody(e){e.remove(),this.setupTabs(),this.queueRender()}keyTab=(e)=>{let{tabs:t}=this.parts,i=[...t.children].indexOf(e.target);switch(e.key){case"ArrowLeft":this.value=(i+Number(t.children.length)-1)%t.children.length,t.children[this.value].focus(),e.preventDefault();break;case"ArrowRight":this.value=(i+1)%t.children.length,t.children[this.value].focus(),e.preventDefault();break;case" ":this.pickTab(e),e.preventDefault();break;default:}};get bodies(){return[...this.children].filter((e)=>e.hasAttribute("name"))}pickTab=(e)=>{let{tabs:t}=this.parts,i=e.target,s=i.closest("button.close")!==null,n=i.closest(".tabs > div"),r=[...t.children].indexOf(n);if(s){let o=this.bodies[r];if(!this.handleCloseTab||this.handleCloseTab(o)!==!1)this.removeTabBody(this.bodies[r])}else if(r>-1)this.value=r};setupTabs=()=>{let{tabs:e}=this.parts,t=[...this.children].filter((i)=>!i.hasAttribute("slot")&&i.hasAttribute("name"));if(e.textContent="",this.value>=t.length)this.value=t.length-1;for(let i in t){let s=t[i],n=`${this.instanceId}-${i}`;s.id=n;let r=this.makeTab(this,s,n);e.append(r)}};connectedCallback(){super.connectedCallback();let{tabs:e}=this.parts;e.addEventListener("click",this.pickTab),e.addEventListener("keydown",this.keyTab),this.setupTabs(),Is.allInstances.add(this)}disconnectedCallback(){super.disconnectedCallback(),Is.allInstances.delete(this)}localeChanged=()=>{this.queueRender()};handleResize(){this.queueRender()}render(){let{tabs:e,selected:t}=this.parts,i=this.bodies;for(let s=0;s<i.length;s++){let n=i[s],r=e.children[s],o=this.value===Number(s);if(r.toggleAttribute("aria-selected",o),n.toggleAttribute("hidden",!o),o)t.style.marginLeft=`${r.offsetLeft-e.offsetLeft}px`,t.style.width=`${r.offsetWidth}px`}}}var JQ=xu,fl=xu.elementCreator(),e_=fl,t_=fl;var{div:i_,input:s_,span:n_,button:pg}=L,U2=(e)=>e.split(/(?<!\\),/).map((t)=>t.trim().replace(/\\,/g,",")),r_=(e)=>e.map((t)=>t.replace(/,/g,"\\,")).join(",");class pl extends R{static preferredTagName="tosi-tag";static lightStyleSpec={":host":{"--tag-close-button-color":"#000c","--tag-close-button-bg":"#fffc","--tag-button-opacity":"0.5","--tag-button-hover-opacity":"0.75","--tag-bg":w.brandColor("blue"),"--tag-text-color":w.brandTextColor("white"),display:"inline-flex",borderRadius:w.tagRoundedRadius(b.spacing50),color:b.tagTextColor,background:b.tagBg,padding:`0 ${b.spacing75} 0 ${b.spacing75}`,height:`calc(${b.lineHeight} + ${b.spacing50})`,lineHeight:`calc(${b.lineHeight} + ${b.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:w.fontSize("16px"),color:b.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${b.spacing_50} 0 ${b.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:b.spacing150,width:b.spacing150,color:b.tagCloseButtonColor,background:b.tagCloseButtonBg,borderRadius:w.tagCloseButtonRadius("99px"),opacity:b.tagButtonOpacity},':host [part="remove"]:hover':{background:b.tagCloseButtonBg,opacity:b.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[n_({part:"caption"},this.caption),pg(j.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var o_=pl,mg=pl.elementCreator(),a_=li((...e)=>mg(...e),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class Co extends R{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:b.tagListBg,gap:b.spacing25,borderRadius:w.taglistRoundedRadius(b.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${b.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${b.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:b.inputBg,borderRadius:w.tagContainerRadius(b.spacing50),boxShadow:b.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:b.spacing25,minHeight:`calc(${b.lineHeight} + ${b.spacing})`,padding:b.spacing25},':host [part="tagMenu"]':{width:b.touchSize,height:b.touchSize,lineHeight:b.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:b.brandColor,color:b.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return U2(this.value).filter((e)=>e!=="")}set tags(e){this.value=r_(e)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(e){if(typeof e==="string")this._availableTags=Co.parseAvailableTagsString(e);else this._availableTags=e;this.queueRender()}static parseAvailableTagsString(e){return U2(e).map((t)=>t===""?null:t)}connectedCallback(){super.connectedCallback();let e=this.getAttribute("available-tags");if(e&&this._availableTags.length===0)this._availableTags=Co.parseAvailableTagsString(e)}formDisabledCallback(e){this.disabled=e}formResetCallback(){this.value=""}addTag=(e)=>{let t=e.trim();if(t===""||this.tags.includes(t))return;this.tags=[...this.tags,t],this.queueRender(!0)};toggleTag=(e)=>{if(this.tags.includes(e))this.tags=this.tags.filter((t)=>t!==e),this.queueRender(!0);else this.addTag(e)};enterTag=(e)=>{let{tagInput:t}=this.parts;switch(e.key){case",":{let i=t.value.split(",")[0];this.addTag(i)}break;case"Enter":{let i=t.value.split(",")[0];this.addTag(i)}e.stopPropagation(),e.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:e}=this,{tagMenu:t}=this.parts,i=[...this.availableTags],s=this.tags.filter((r)=>!i.includes(r));if(s.length)i.push(null,...s);let n=i.map((r)=>{if(r===""||r===null)return null;else if(typeof r==="object")return{checked:()=>this.tags.includes(r.value),caption:r.caption,action(){e(r.value)}};else return{checked:()=>this.tags.includes(r),caption:r,action(){e(r)}}});mt({target:t,width:"auto",menuItems:n})};content=()=>[pg({type:"button",style:{visibility:"hidden"},tabindex:-1}),i_({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),s_({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),pg({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},j.chevronDown())];removeTag=(e)=>{if(this.editable&&!this.disabled){let t=e.target.closest(pl.tagName);this.tags=this.tags.filter((i)=>i!==t.caption),t.remove(),this.queueRender(!0)}e.stopPropagation(),e.preventDefault()};render(){super.render();let{tagContainer:e,tagMenu:t,tagInput:i}=this.parts;if(t.disabled=this.disabled,i.value="",i.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)t.toggleAttribute("hidden",!1),i.toggleAttribute("hidden",!this.textEntry);else t.toggleAttribute("hidden",!0),i.toggleAttribute("hidden",!0);e.textContent="";for(let s of this.tags)e.append(mg({caption:s,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var l_=Co,G2=Co.elementCreator(),c_=li((...e)=>G2(...e),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var K2="1.14.3";var{span:h_}=L,ml=null,vu=null,wu=null,Ds="tosi-tooltip",u_={[`.${Ds}`]:{pointerEvents:"none",padding:w.tosiTooltipPadding("4px 10px"),borderRadius:w.tosiTooltipRadius("6px"),background:w.tosiTooltipBg("#333"),color:w.tosiTooltipColor("#fff"),fontSize:w.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:w.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${Ds} p`]:{margin:"0"},[`.${Ds} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${Ds} a`]:{color:"inherit"},[`.${Ds}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${Ds}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Ds}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Ds}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${Ds}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},J2=!1;function ew(){if(J2)return;J2=!0,ci("tosi-tooltip",u_)}function To(){if(vu!==null)clearTimeout(vu),vu=null;if(ml!==null)ml.remove(),ml=null;wu=null}function d_(e){if(e.startsWith("s"))return"tt-s";if(e.startsWith("n"))return"tt-n";if(e.startsWith("e"))return"tt-e";if(e.startsWith("w"))return"tt-w";return"tt-s"}function f_(e,t,i){let s=t.getBoundingClientRect(),n=e.getBoundingClientRect(),r=s.left+s.width*0.5,o=s.top+s.height*0.5,a;if(i.startsWith("s")||i.startsWith("n"))a=Math.max(8,Math.min(n.width-8,r-n.left))-4;else a=Math.max(8,Math.min(n.height-8,o-n.top))-4;e.style.setProperty("--tosi-tooltip-arrow",a+"px")}function p_(e,t){if(t)e=ue(e);let i=h_({class:Ds});return i.innerHTML=Ae.parseInline(e),i}function m_(e,t,i){ew(),To(),wu=e;let{top:s,left:n,width:r}=e.getBoundingClientRect(),o=n+r*0.5,a=window.innerHeight,l=window.innerWidth,c=(s>a*0.5?"n":"s")+(o>l*0.5?"w":"e"),h=p_(t,i);h.classList.add(d_(c)),ml=Na({content:h,target:e,position:c,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(ml&&wu)f_(h,e,c)})}function g_(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.tooltip)return t;return null}function O_(e={}){ew();let{convertTitles:t=!0,delay:i=250,localize:s=!1}=e;document.addEventListener("pointermove",(n)=>{if(t){for(let a of n.composedPath())if(a instanceof HTMLElement&&a.title&&!a.dataset.tooltip){a.dataset.tooltip=a.title,a.removeAttribute("title");break}}let r=g_(n);if(r===wu)return;if(To(),!r)return;let o=r.dataset.tooltip||null;if(!o)return;vu=setTimeout(()=>m_(r,o,s),i)}),document.addEventListener("pointerleave",To),document.addEventListener("pointerdown",To),document.addEventListener("keydown",To),window.addEventListener("scroll",To,!0)}var KO={};Ji(KO,{CodeEditor:()=>wn,codeEditor:()=>kn});var{div:gP}=L,OP=new Set,Qc=(e,t)=>{if(OP.has(e))return;OP.add(e),console.warn(`<tosi-code>.${e} was removed in tosijs-ui 1.7 (the editor is now CodeMirror 6, not ACE) — ${t}. See CHANGELOG 1.7.0.`)},yP=!1,Cf=!1;class wn extends R{static preferredTagName="tosi-code";source="";_handle;_loadPromise;_loadGeneration=0;_appliedMode="";_appliedDisabled;_tjsAutocomplete;get tjsAutocomplete(){return this._tjsAutocomplete}set tjsAutocomplete(e){if(this._tjsAutocomplete=e,this._handle&&this.isTjsMode())this.applyTjsExtension()}get value(){return this._handle?this._handle.getValue():this.source}set value(e){if(this._handle)this._handle.setValue(e);else this.source=e}_original;get original(){return this._original??this.value}set original(e){this._original=e}diffOverlay;_pendingDiff;get showingDiff(){if(!this.hydrated)return this._pendingDiff??!1;return!this.parts.diffHost.hidden}diffResolvable=!1;diffOriginalLabel="Original";diffModifiedLabel="Modified";showDiff(e){if(!this.hydrated){this._pendingDiff=e;return}let{diffHost:t}=this.parts;if(e){if(this.diffOverlay===void 0)this.diffOverlay=el(),t.append(this.diffOverlay);this.diffOverlay.resolvable=this.diffResolvable,this.diffOverlay.originalLabel=this.diffOriginalLabel,this.diffOverlay.modifiedLabel=this.diffModifiedLabel,this.diffOverlay.original=this.original,this.diffOverlay.modified=this.value}else if(this.diffOverlay!==void 0&&this.diffResolvable){let i=this.diffOverlay.value;if(i!==this.value)this.value=i,this.dispatchEvent(new CustomEvent("change",{detail:{value:i}}))}t.hidden=!e}static initAttributes={mode:"javascript",disabled:!1};role="code editor";get editor(){if(!yP)yP=!0,console.info("<tosi-code>.editor is the CodeMirror 6 EditorView (the supported accessor; it was an ACE editor in 1.6). ACE-era `editor.session` / `getSession()` / "+"`setOption()` are gone — use undo()/redo()/canUndo()/canRedo() for history.");return this._handle?.view}get theme(){return Qc("theme","style the editor with --code-bg / --text-color instead"),""}set theme(e){Qc("theme","style the editor with --code-bg / --text-color instead")}get options(){return Qc("options","configure CodeMirror via the `editor` (EditorView) instead"),{}}set options(e){Qc("options","configure CodeMirror via the `editor` (EditorView) instead")}get ace(){Qc("ace","use `editor`, which is now a CodeMirror EditorView");return}undo(){this._handle?.undo()}redo(){this._handle?.redo()}canUndo(){return this._handle?.canUndo()??!1}canRedo(){return this._handle?.canRedo()??!1}content=()=>[gP({part:"host"}),gP({part:"diffHost",hidden:!0})];static shadowStyleSpec={":host":{display:"block",position:"relative",width:"100%",height:"100%"},'[part="host"]':{height:"100%"},'[part="diffHost"]':{position:"absolute",inset:"0",zIndex:"5",overflow:"auto",_background:w.codeBg(w.inputBg("#fdfdfd")),background:w.tosiDiffBg(w.codeBg("#fdfdfd"))},".cm-editor":{height:"100%"},".cm-scroller":{outline:"none",fontFamily:"Menlo, Monaco, Consolas, 'Courier New', monospace"}};handleResize(){this._handle?.refresh()}connectedCallback(){if(super.connectedCallback(),this.source==="")this.value=this.textContent!==null?this.textContent.trim():"";if(this._pendingDiff!==void 0){let e=this._pendingDiff;this._pendingDiff=void 0,this.showDiff(e)}if(this._loadPromise===void 0){let e=++this._loadGeneration;this._loadPromise=Promise.resolve().then(() => (GO(),UO)).then(({createCmEditor:t})=>{if(e!==this._loadGeneration||!this.isConnected)return;let i=t(this.parts.host,{value:this.source,mode:this.mode,readOnly:this.disabled,root:this.shadowRoot??void 0,onChange:(s)=>this.dispatchEvent(new CustomEvent("change",{detail:{value:s}}))});return this._handle=i,this._appliedMode=this.mode,this._appliedDisabled=this.disabled,this.applyTjsExtension(),i})}}disconnectedCallback(){if(super.disconnectedCallback(),this._handle)this.source=this._handle.getValue(),this._handle.destroy(),this._handle=void 0;this._loadPromise=void 0,this._appliedMode="",this._appliedDisabled=void 0}isTjsMode(){return this.mode==="tjs"||this.mode==="ajs"}applyTjsExtension(){let e=this._handle;if(!e||!this.isTjsMode())return;Promise.resolve().then(() => (GO(),UO)).then(({loadTjsExtension:t})=>t(this._tjsAutocomplete??{})).then((t)=>{if(t&&this._handle===e&&this.isTjsMode()){e.setLanguageExtension(t),this._tjsExtensionApplied=!0;return}if(!t&&this._handle===e&&this.isTjsMode()&&!Cf)Cf=!0,console.warn(`<tosi-code mode="${this.mode}">: tjs-lang's CodeMirror extension did not load — `+"falling back to TypeScript highlighting (no tjs autocomplete). Install the optional peer `tjs-lang`, or check that tjs-lang/editors/codemirror still exports `tjsEditorExtension`.")}).catch((t)=>{if(!Cf)Cf=!0,console.warn("<tosi-code>: failed to apply the tjs extension —",t)})}get tjsExtensionApplied(){return this._tjsExtensionApplied}_tjsExtensionApplied=!1;render(){if(super.render(),this._handle){if(this.disabled!==this._appliedDisabled)this._handle.setReadOnly(this.disabled),this._appliedDisabled=this.disabled;if(this.mode!==this._appliedMode)this._handle.setMode(this.mode),this._appliedMode=this.mode,this.applyTjsExtension()}}}var kn=wn.elementCreator();var ky={};Ji(ky,{createDocBrowser:()=>wy,hasTestBlock:()=>lE});var fV=/^readme\.md$/i;function bP(e){if(fV.test(e))return"";return e.replace(/\.[^.]+$/,"")}function ha(e){let t={};for(let s of e){let n=bP(s.filename);t[n]=(t[n]||0)+1}let i={};for(let s of e){let n=bP(s.filename);i[s.filename]=n!==""&&t[n]>1?s.filename.replace(/\./g,"-"):n}return i}function JO(e){return e===""?"/":`/${e}/`}function vP(e,t){let i=e.replace(/^\?/,"");if(!i||i.includes("=")||i.includes("&"))return null;let s=decodeURIComponent(i),n=t[s];if(n===void 0)return null;return JO(n)}function pV(e){return e.replace(/^\/+/,"").replace(/\/+$/,"").replace(/\/index\.html$/i,"")}function ey(e,t){let i=pV(e);for(let[s,n]of Object.entries(t))if(n===i)return s;return""}function xP(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ty(e,t,i){if(!e)return"";for(let n of t)if(n.filename===e)return n.filename;for(let n of t)if(i[n.filename]===e)return n.filename;let s=xP(e);for(let n of t)if(i[n.filename]===s)return n.filename;for(let n of t)if(n.title&&xP(n.title)===s)return n.filename;return""}function wP(e){return e.pin==="top"?0:e.pin==="bottom"?2:1}function mV(e,t){return wP(e)-wP(t)||(e.order??500)-(t.order??500)||(e.title||"").toLocaleLowerCase().localeCompare((t.title||"").toLocaleLowerCase())||e.filename.localeCompare(t.filename)}function Tf(e,t){let i=new Map;for(let o of e)i.set(o.filename,{doc:o,slug:t[o.filename]??"",children:[],depth:0});let s=new Map;for(let o of e){let a=o.parent?ty(o.parent,e,t):"";if(a&&(a===o.filename||!i.has(a)||gV(o.filename,a,e,t)))a="";s.set(o.filename,a)}let n=[];for(let o of e){let a=s.get(o.filename)||"",l=i.get(o.filename);if(a)i.get(a).children.push(l);else n.push(l)}let r=(o,a)=>{o.sort((l,c)=>mV(l.doc,c.doc));for(let l of o)l.depth=a,r(l.children,a+1)};return r(n,0),n}function gV(e,t,i,s){let n=new Map(i.map((a)=>[a.filename,a])),r=t,o=new Set([e]);while(r){if(o.has(r))return!0;o.add(r);let a=n.get(r);r=a?.parent?ty(a.parent,i,s):""}return!1}var OV=new ko,ny,ry=new uu;ry.use({renderer:{code(e){let t=String(e.lang||""),i=t.match(/^[a-z]+/)?.[0]??"",s=t.match(/#([A-Za-z0-9_-]+)/)?.[1]??"",n=t.match(/:([a-z]+)/)?.[1]??"",r=ny?.get(e.text);if(!s&&!n&&!r)return!1;let o=OV.code({...e,lang:i}),a=[s&&`data-example-id="${s}"`,n&&`data-example-mode="${n}"`].filter(Boolean).join(" ");if(a)o=o.replace(/^<pre>/,`<pre ${a}>`);if(r){let l=JSON.stringify(r.js).replace(/</g,"\\u003c");o+=`<script type="application/tosi-transpiled" data-dialect="${r.dialect}">${l}</script>`}return o}}});function iy(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function yV(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var bV=new uu,sy=new Map,ua=[];ry.use({hooks:{preprocess(e){return sy=new Map,ua=[],e},postprocess(e){if(ua.length===0)return e;let t=ua.map((i)=>{let s=bV.parseInline(sy.get(i)??""),n=iy(i);return`<li id="fn-${n}"><p>${s} <a href="#fnref-${n}" class="footnote-backref" aria-label="Back to reference">↩</a></p></li>`}).join(`
|
|
153
153
|
`);return`${e}
|
|
154
154
|
<section class="footnotes" role="doc-endnotes">
|
|
155
155
|
<hr />
|
|
@@ -157,7 +157,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
|
|
|
157
157
|
${t}
|
|
158
158
|
</ol>
|
|
159
159
|
</section>
|
|
160
|
-
`}},extensions:[{name:"wikilink",level:"inline",start(e){return e.match(/\[\[/)?.index},tokenizer(e){let t=/^\[\[([^\]|]+?)(?:\|([^\]]+?))?\]\]/.exec(e);if(!t)return;return{type:"wikilink",raw:t[0],target:t[1].trim(),label:(t[2]??t[1]).trim()}},renderer(e){return`<a href="/${iy(e.target)}/" class="wikilink">${yV(e.label)}</a>`}},{name:"footnoteDef",level:"block",start(e){return e.match(/^\[\^[^\]]+\]:/m)?.index},tokenizer(e){let t=/^\[\^([^\]]+)\]:[ \t]*([^\n]*)(?:\n|$)/.exec(e);if(!t)return;return sy.set(t[1].trim(),t[2].trim()),{type:"footnoteDef",raw:t[0]}},renderer(){return""}},{name:"footnoteRef",level:"inline",start(e){return e.match(/\[\^/)?.index},tokenizer(e){let t=/^\[\^([^\]]+)\]/.exec(e);if(!t)return;let i=t[1].trim();if(!ua.includes(i))ua.push(i);return{type:"footnoteRef",raw:t[0],id:i}},renderer(e){let t=ua.indexOf(e.id)+1,i=iy(e.id);return`<sup class="footnote-ref"><a href="#fn-${i}" id="fnref-${i}">${t}</a></sup>`}}]});var xV=/<p>\s*(<([a-z][a-z0-9]*-[a-z0-9-]*)\b[\s\S]*?<\/\2>)\s*<\/p>/gi;function vV(e){return e.replace(xV,(t,i)=>i.includes("</p>")?t:i)}function _c(e,t={}){ny=t.bakes;try{return vV(ry.parse(e))}finally{ny=void 0}}function kP(e,t){let i=e.headTitle?.trim();if(i)return i;let s=t?.trim()??"";if(!s)return e.title;let n=e.title.toLowerCase(),r=s.toLowerCase();if(n.includes(r)||r.includes(n))return e.title;return`${e.title} — ${s}`}function wV(e){return e.hasTests&&!e.testRunning}function SP(e){return e.filter((t)=>t.test&&!wV(t))}var vy={};Ji(vy,{LiveExample:()=>dr,RemoteSyncManager:()=>Ic,STORAGE_KEY:()=>Pf,createTestContext:()=>Oy,disableTests:()=>Nc,enableTests:()=>Dc,executeCode:()=>EP,executeInIframe:()=>_f,executeInline:()=>Qf,expect:()=>gy,insertExamples:()=>Lf,liveExample:()=>Bf,loadTransform:()=>Rc,pageTestCount:()=>jf,rewriteImports:()=>Cs,runTests:()=>Rf,testManager:()=>Kt});var Sn=(async()=>{}).constructor;class PP extends Error{statement;constructor(e,t){super(e);this.statement=t;this.name="UnsupportedImportError"}}function $f(e){let t=e.replace(/[^a-zA-Z0-9_$]/g,"");if(!t)return"_ctx";if(/^[0-9]/.test(t)||kV.has(t))return`_${t}`;return t}var kV=new Set("break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield await".split(" "));function hr(e){let t=new Map;return e.map((i)=>{let s=$f(i),n=t.get(s);if(n!==void 0)throw Error(`example context keys ${JSON.stringify(n)} and ${JSON.stringify(i)} both reduce to the identifier "${s}", so an import from one of them could not be told from the other. Rename one of the context keys.`);return t.set(s,i),s})}function CP(e){return e.split(",").map((t)=>{let i=t.trim().match(/^(\w+)\s+as\s+(\w+)$/);return i?`${i[1]}: ${i[2]}`:t.trim()}).filter(Boolean).join(", ")}function SV(e,t){let i=(s)=>/^(\.|\/|https?:)/.test(s)?s:t+s;return e.replace(/import\s+([^;'"]+?)\s+from\s+(['"])([^'"]+)\2[ \t]*;?/g,(s,n,r,o)=>{let a=`await import(${r}${i(o)}${r})`,l=n.trim(),c;if(c=l.match(/^\{([^}]*)\}$/))return`const { ${CP(c[1])} } = ${a}`;if(c=l.match(/^\*\s+as\s+(\w+)$/))return`const ${c[1]} = ${a}`;if(c=l.match(/^(\w+)$/))return`const ${c[1]} = (${a}).default`;if(c=l.match(/^(\w+)\s*,\s*\{([^}]*)\}$/))return`const { default: ${c[1]}, ${CP(c[2])} } = ${a}`;return s}).replace(/import\s+(['"])([^'"]+)\1[ \t]*;?/g,(s,n,r)=>`await import(${n}${i(r)}${n})`)}function CV(){return globalThis.__TOSI_IMPORT_RESOLVER?.prefix}function Cs(e,t,i=CV()){let s=e;for(let r of t){let o=$f(r),a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");s=s.replace(new RegExp(`import\\s*\\{([^}]*)\\}\\s*from\\s*['"]${a}['"]`,"g"),(l,c)=>`const { ${c.replace(/\s+/g," ").trim()} } = ${o}`),s=s.replace(new RegExp(`import\\s*\\*\\s*as\\s+(\\w+)\\s+from\\s*['"]${a}['"]`,"g"),(l,c)=>`const ${c} = ${o}`),s=s.replace(new RegExp(`import\\s+(\\w+)\\s+from\\s*['"]${a}['"]`,"g"),(l,c)=>`const ${c} = ${o}`)}if(i)s=SV(s,i);let n=s.match(/^\s*import\s+['"{*\w][^\n]*/m);if(n){let r=n[0].trim(),o=r.match(/from\s*['"]([^'"]+)['"]/)?.[1],l=o!==void 0&&t.includes(o)?`\`${o}\` IS in the example context, so the import CLAUSE is what could not be `+"rewritten — supported forms are `{ named }`, `* as ns`, `default`, and "+"`default, { named }`.":`${o?`\`${o}\` is not`:"that specifier is not"} in the example context (${t.join(", ")})`+(i?", and the import-resolver did not rewrite it.":". Enable importResolver to import other packages.");throw new PP(`live example: unsupported import \`${r}\` — ${l}`,r)}return s}async function EP(e,t,i){let s=Cs(e,Object.keys(t)),n=(await i(s,{transforms:["typescript"]})).code,r=hr(Object.keys(t)),o=Object.values(t);await new Sn(...r,n)(...o)}var oy="0.13.
|
|
160
|
+
`}},extensions:[{name:"wikilink",level:"inline",start(e){return e.match(/\[\[/)?.index},tokenizer(e){let t=/^\[\[([^\]|]+?)(?:\|([^\]]+?))?\]\]/.exec(e);if(!t)return;return{type:"wikilink",raw:t[0],target:t[1].trim(),label:(t[2]??t[1]).trim()}},renderer(e){return`<a href="/${iy(e.target)}/" class="wikilink">${yV(e.label)}</a>`}},{name:"footnoteDef",level:"block",start(e){return e.match(/^\[\^[^\]]+\]:/m)?.index},tokenizer(e){let t=/^\[\^([^\]]+)\]:[ \t]*([^\n]*)(?:\n|$)/.exec(e);if(!t)return;return sy.set(t[1].trim(),t[2].trim()),{type:"footnoteDef",raw:t[0]}},renderer(){return""}},{name:"footnoteRef",level:"inline",start(e){return e.match(/\[\^/)?.index},tokenizer(e){let t=/^\[\^([^\]]+)\]/.exec(e);if(!t)return;let i=t[1].trim();if(!ua.includes(i))ua.push(i);return{type:"footnoteRef",raw:t[0],id:i}},renderer(e){let t=ua.indexOf(e.id)+1,i=iy(e.id);return`<sup class="footnote-ref"><a href="#fn-${i}" id="fnref-${i}">${t}</a></sup>`}}]});var xV=/<p>\s*(<([a-z][a-z0-9]*-[a-z0-9-]*)\b[\s\S]*?<\/\2>)\s*<\/p>/gi;function vV(e){return e.replace(xV,(t,i)=>i.includes("</p>")?t:i)}function _c(e,t={}){ny=t.bakes;try{return vV(ry.parse(e))}finally{ny=void 0}}function kP(e,t){let i=e.headTitle?.trim();if(i)return i;let s=t?.trim()??"";if(!s)return e.title;let n=e.title.toLowerCase(),r=s.toLowerCase();if(n.includes(r)||r.includes(n))return e.title;return`${e.title} — ${s}`}function wV(e){return e.hasTests&&!e.testRunning}function SP(e){return e.filter((t)=>t.test&&!wV(t))}var vy={};Ji(vy,{LiveExample:()=>dr,RemoteSyncManager:()=>Ic,STORAGE_KEY:()=>Pf,createTestContext:()=>Oy,disableTests:()=>Nc,enableTests:()=>Dc,executeCode:()=>EP,executeInIframe:()=>_f,executeInline:()=>Qf,expect:()=>gy,insertExamples:()=>Lf,liveExample:()=>Bf,loadTransform:()=>Rc,pageTestCount:()=>jf,rewriteImports:()=>Cs,runTests:()=>Rf,testManager:()=>Kt});var Sn=(async()=>{}).constructor;class PP extends Error{statement;constructor(e,t){super(e);this.statement=t;this.name="UnsupportedImportError"}}function $f(e){let t=e.replace(/[^a-zA-Z0-9_$]/g,"");if(!t)return"_ctx";if(/^[0-9]/.test(t)||kV.has(t))return`_${t}`;return t}var kV=new Set("break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield await".split(" "));function hr(e){let t=new Map;return e.map((i)=>{let s=$f(i),n=t.get(s);if(n!==void 0)throw Error(`example context keys ${JSON.stringify(n)} and ${JSON.stringify(i)} both reduce to the identifier "${s}", so an import from one of them could not be told from the other. Rename one of the context keys.`);return t.set(s,i),s})}function CP(e){return e.split(",").map((t)=>{let i=t.trim().match(/^(\w+)\s+as\s+(\w+)$/);return i?`${i[1]}: ${i[2]}`:t.trim()}).filter(Boolean).join(", ")}function SV(e,t){let i=(s)=>/^(\.|\/|https?:)/.test(s)?s:t+s;return e.replace(/import\s+([^;'"]+?)\s+from\s+(['"])([^'"]+)\2[ \t]*;?/g,(s,n,r,o)=>{let a=`await import(${r}${i(o)}${r})`,l=n.trim(),c;if(c=l.match(/^\{([^}]*)\}$/))return`const { ${CP(c[1])} } = ${a}`;if(c=l.match(/^\*\s+as\s+(\w+)$/))return`const ${c[1]} = ${a}`;if(c=l.match(/^(\w+)$/))return`const ${c[1]} = (${a}).default`;if(c=l.match(/^(\w+)\s*,\s*\{([^}]*)\}$/))return`const { default: ${c[1]}, ${CP(c[2])} } = ${a}`;return s}).replace(/import\s+(['"])([^'"]+)\1[ \t]*;?/g,(s,n,r)=>`await import(${n}${i(r)}${n})`)}function CV(){return globalThis.__TOSI_IMPORT_RESOLVER?.prefix}function Cs(e,t,i=CV()){let s=e;for(let r of t){let o=$f(r),a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");s=s.replace(new RegExp(`import\\s*\\{([^}]*)\\}\\s*from\\s*['"]${a}['"]`,"g"),(l,c)=>`const { ${c.replace(/\s+/g," ").trim()} } = ${o}`),s=s.replace(new RegExp(`import\\s*\\*\\s*as\\s+(\\w+)\\s+from\\s*['"]${a}['"]`,"g"),(l,c)=>`const ${c} = ${o}`),s=s.replace(new RegExp(`import\\s+(\\w+)\\s+from\\s*['"]${a}['"]`,"g"),(l,c)=>`const ${c} = ${o}`)}if(i)s=SV(s,i);let n=s.match(/^\s*import\s+['"{*\w][^\n]*/m);if(n){let r=n[0].trim(),o=r.match(/from\s*['"]([^'"]+)['"]/)?.[1],l=o!==void 0&&t.includes(o)?`\`${o}\` IS in the example context, so the import CLAUSE is what could not be `+"rewritten — supported forms are `{ named }`, `* as ns`, `default`, and "+"`default, { named }`.":`${o?`\`${o}\` is not`:"that specifier is not"} in the example context (${t.join(", ")})`+(i?", and the import-resolver did not rewrite it.":". Enable importResolver to import other packages.");throw new PP(`live example: unsupported import \`${r}\` — ${l}`,r)}return s}async function EP(e,t,i){let s=Cs(e,Object.keys(t)),n=(await i(s,{transforms:["typescript"]})).code,r=hr(Object.keys(t)),o=Object.values(t);await new Sn(...r,n)(...o)}var oy="0.13.13",TV="5.9.3",$V=`https://esm.sh/typescript@${TV}`;function ly(e){let t=globalThis.__TJS_LOCAL_BASE;return[...typeof t==="string"?[`${t}${e}`]:[],`https://cdn.jsdelivr.net/npm/tjs-lang@${oy}/dist/${e}`,`https://unpkg.com/tjs-lang@${oy}/dist/${e}`,`https://esm.sh/tjs-lang@${oy}/dist/${e}`]}async function cy(e){for(let t of e)try{let i=await import(t);if(i)return i}catch{}return null}async function PV(){try{let{tjs:t}=await import("tjs-lang/browser");if(typeof t==="function")return t}catch{}let e=await cy(ly("tjs-browser.js"));if(e&&typeof e.tjs==="function")return e.tjs;return null}var EV;async function AV(){let e=[()=>import("tjs-lang/browser"),()=>cy(ly("tjs-browser.js"))];for(let t of e)try{let i=await t();if(i&&typeof i.extractTests==="function"&&typeof i.testUtils==="string")return{extractTests:i.extractTests,testUtils:i.testUtils}}catch{}return null}function AP(){return EV??=AV()}async function MV(){try{let{fromTS:t}=await import("tjs-lang/browser/from-ts");if(typeof t==="function")return t}catch{}let e=await cy(ly("tjs-browser-from-ts.js"));if(e&&typeof e.fromTS==="function")return e.fromTS;return null}var QV,_V,LV=256,Lc=new Map,ay=(e,t)=>{if(Lc.size>=LV){let i=Lc.keys().next().value;if(i!==void 0)Lc.delete(i)}Lc.set(e,t)},TP=!1,$P=!1;async function Rc(e="js"){if(e==="js")return(s)=>({code:s});let t=await(QV??=PV());if(!t&&!TP)TP=!0,console.warn("tjs-lang not available — live examples run as raw JavaScript "+"(tjs/TypeScript examples will not transpile). Install with: npm install tjs-lang");let i=e==="ts"?await(_V??=MV()):null;if(e==="ts"&&!i&&!$P)$P=!0,console.warn("tjs-lang/browser/from-ts not available — `ts` examples run as raw JavaScript.");return(s)=>{let n=`${e}\x00${s}`,r=Lc.get(n);if(r)return r;if(!t){let a={code:s};return ay(n,a),a}if(e==="ts")return(async()=>{let a=i?(await i(s,{emitTJS:!0,typescriptUrl:$V})).code:s,l={code:t(a,{dialect:"tjs",runTests:!1}).code};return ay(n,l),l})();let o={code:t(s,{dialect:e,runTests:!1}).code};return ay(n,o),o}}var Pf="live-example-payload";function MP(e,t,i){return i!==""?`${e}-${i}`:`${e}-${t}`}function hy(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(i){console.warn("live-example: failed to write to localStorage",i)}}function RV(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function QP(e,t,i,s,n,r){let o=new URLSearchParams({[e]:t});if(r?.sourceFile&&r.ordinal!=null)o.set("sf",r.sourceFile),o.set("ord",r.ordinal);let a=location.href.split("?")[0]+"?"+o.toString();hy(i,{remoteKey:s,sentAt:Date.now(),...n,original:r?.original}),window.open(a)}var IV=typeof BroadcastChannel<"u";class Ic{storageKey;remoteKey;lastUpdate=0;interval;channel;listening=!1;onReceive;constructor(e,t,i){this.storageKey=e,this.remoteKey=t,this.onReceive=i}handlePayload=(e)=>{if(e.sentAt<=this.lastUpdate)return;if(e.remoteKey!==this.remoteKey)return;this.lastUpdate=e.sentAt,this.onReceive(e)};handleMessage=(e)=>{let t=e.data;if(t)this.handlePayload(t)};handlePoll=()=>{let e;try{e=localStorage.getItem(this.storageKey)}catch{return}let t=RV(e);if(t)this.handlePayload(t)};startListening(){if(this.listening)return;if(this.listening=!0,IV)this.channel=new BroadcastChannel(this.storageKey),this.channel.onmessage=this.handleMessage;this.interval=setInterval(this.handlePoll,500)}stopListening(){if(!this.listening)return;if(this.listening=!1,this.channel)this.channel.close(),this.channel=void 0;if(this.interval)clearInterval(this.interval),this.interval=void 0}send(e){let t={remoteKey:this.remoteKey,sentAt:Date.now(),...e};if(hy(this.storageKey,t),this.channel)this.channel.postMessage(t)}sendClose(){let e={remoteKey:this.remoteKey,sentAt:Date.now(),css:"",html:"",js:"",close:!0};if(hy(this.storageKey,e),this.channel)this.channel.postMessage(e)}}var LP="inline-example",RP="inline-test",jV=/\/(index|module|iife|module\.debug|module\.safe)\.js$/;function Ef(e){if(!e)return null;for(let t of e.split(`
|
|
161
161
|
`)){let i=t.trim();if(!i)continue;if(/^\w*Error[:\s]/.test(i))continue;let s=i.match(/[(@\s]([^()\s]+):(\d+):(\d+)\)?$/);if(!s)continue;let[,n,r,o]=s;if(jV.test(n))continue;return{url:n,line:Number(r),col:Number(o)}}return null}var _P="tosi-line-offset-probe",jc=null;function BV(){if(jc!==null)return jc;jc=0;try{Function(`throw new Error('probe')
|
|
162
162
|
//# sourceURL=${_P}`)()}catch(e){let t=Ef(e.stack);if(t?.url.includes(_P))jc=t.line-1}return jc}function uy(e){if(!e)return null;let t=e.line-BV();return t>=1?t:null}function dy(e,t){if(!e||t<1)return null;return e.split(`
|
|
163
163
|
`)[t-1]?.trim()||null}function Af(e,t){let i=e,s=String(i?.message??e),n=uy(Ef(i?.stack));if(n===null)return s;let r=dy(t,n);return r?`${s} | ${r} (line ${n})`:`${s} (line ${n})`}function Mf(e,t,i,s){let n=String(e?.message??e),r=!0;try{s(i)}catch{r=!1}if(!r)return`${n} — the code could not be compiled`;return`${n} — the code itself compiles, so the CONTEXT KEYS are at fault. `+`They became this parameter list: ${t.join(", ")}. A key that cannot be an identifier (a subpath like 'pkg/sub', a scoped name, a leading digit) is the usual cause.`}var zP=null,VP="__tosiCaptureScope",{div:XP}=L;function VV(e,t){let i=e.customElements;if(!i)return;let s=(r)=>{if(!r||i.get(r))return;let o=customElements.get(r);if(o)try{i.define(r,o)}catch{}};for(let r of Object.values(t))if(r&&typeof r==="object"){for(let o of Object.values(r))if(typeof o==="function"&&"tagName"in o)s(o.tagName)}let n=e.document;if(n){let r=n.querySelectorAll("*");for(let o of r){let a=o.tagName.toLowerCase();if(a.includes("-"))s(a)}}}async function ZP(e,t){if(!t)return{code:e,extraContext:{}};let i;try{({scopeCaptureEpilogue:i}=await Promise.resolve().then(() => (NP(),DP)))}catch{return{code:e,extraContext:{}}}let s=i(e,VP);if(!s)return{code:e,extraContext:{}};return{code:e+s,extraContext:{[VP]:t}}}async function Qf(e){let{html:t,css:i,js:s,context:n,transform:r,compiledJs:o,exampleElement:a,styleElement:l,widgetsElement:c,onError:h,onScope:u}=e,d=XP({class:"preview"});d.innerHTML=t,l.innerText=i;let f=a.querySelector(".preview");if(f)f.replaceWith(d);else a.insertBefore(d,c);try{let m=o??(await r(Cs(s,Object.keys(n)),{transforms:["typescript"]})).code,{code:g,extraContext:O}=await ZP(m,u),x={preview:d,...n,...O},k=hr(Object.keys(x)),S=Object.values(x),P=`${g}
|
|
@@ -297,5 +297,5 @@ ${t.autoPrint?'<script>addEventListener("load",function(){setTimeout(function(){
|
|
|
297
297
|
</body>
|
|
298
298
|
</html>`}var dE=200,vX=600;function wX(e={}){let t=G.fromCss(e.accent??"#d92270");return{_textColor:e.text??"#222",_brandColor:t,_background:e.background??"#fafafa",_buttonBg:e.buttonBg??"#fdfdfd",_inputBg:e.inputBg??"#fdfdfd",_backgroundShaded:"#f5f5f5",_navBg:t.rotate(30).desaturate(0.5).brighten(0.9),_barColor:t.opacity(0.4),_focusColor:t.opacity(0.7),_placeholderColor:t.opacity(0.4),_brandTextColor:t.contrasting(),_insetBg:t.rotate(45).brighten(0.8),_codeBg:e.codeBg??"#fdfdfd",_linkColor:t.rotate(-30).darken(0.5),_shadowColor:"#0004",_menuBg:"#fafafa",_menuItemActiveColor:"#000",_menuItemIconActiveColor:"#000",_menuItemActiveBg:"#aaa",_menuItemHoverBg:"#eee",_menuItemColor:"#222",_menuSeparatorColor:"#2224",_menuShadow:"0 4px 8px #0004",_scrollThumbColor:"#0006",_scrollBarColor:"#0001",_inputBorderShadow:"inset 0 0 2px #0006"}}function fE(e={}){let t=wX(e),i=G.fromCss(e.accent??"#d92270");return{"@import":"https://fonts.googleapis.com/css2?family=Aleo:ital,wght@0,100..900;1,100..900&famiSpline+Sans+Mono:ital,wght@0,300..700;1,300..700&display=swap",":root":{_fontFamily:"'Aleo', sans-serif",_codeFontFamily:"'Spline Sans Mono', monospace",_fontSize:"16px",_codeFontSize:"14px",...t,_tosiAccent:b.brandColor,_tosiBg:b.background,_tosiText:b.textColor,_tosiBgInset:b.insetBg,_spacing:"10px",_lineHeight:"calc(var(--font-size) * 1.6)",_h1Scale:"2",_h2Scale:"1.5",_h3Scale:"1.25",_touchSize:"32px",_headerHeight:"calc( var(--line-height) * var(--h2-scale) + var(--spacing) * 2 )",_docContentMaxWidth:"44em"},'tosi-doc-system[data-layout="full-width"]':{_docContentMaxWidth:"none"},'tosi-doc-system[data-layout="full-screen"]':{_docContentMaxWidth:"none"},'tosi-doc-system[data-layout="full-screen"] .doc-content':{height:"100%",_docContentPadding:"0",_docContentOverflow:"auto"},'tosi-doc-system[data-layout="full-screen"] > .doc-nav.doc-nav, tosi-doc-system[data-layout="full-screen"] > .doc-navbar.doc-navbar':{display:"none"},".darkmode":{...Ia(t),_brandColor:i.brighten(0.18),_shadowColor:i.opacity(0.5),_menuShadow:`0 0 0 2px ${i.opacity(0.75)}`,_menuSeparatorColor:i.opacity(0.5)},".high-contrast":{filter:"contrast(2)"},"*":{boxSizing:"border-box",scrollbarColor:`${b.scrollThumbColor} ${b.scrollBarColor}`,scrollbarWidth:"thin"},body:{fontFamily:b.fontFamily,fontSize:b.fontSize,margin:"0",lineHeight:b.lineHeight,background:b.background,_tosiTabsSelectedColor:b.brandColor,_tosiTabsBarColor:b.brandTextColor,_menuItemIconColor:b.brandColor,color:b.textColor},"tosi-doc-system":{display:"block"},"tosi-doc-system tosi-sidenav::part(nav)":{background:b.navBg},"tosi-doc-system:not(:defined)":{display:"block",position:"fixed",inset:`${b.headerHeight} 0 0 0`,overflow:"auto"},"tosi-doc-system:not(:defined)::before":{content:'""',position:"fixed",top:"0",left:"0",right:"0",height:b.headerHeight,background:b.brandColor},"tosi-doc-system:not(:defined) .doc-content":{display:"block",maxWidth:b.docContentMaxWidth,margin:"auto",padding:"var(--doc-content-padding, 0 1em)",overflow:"var(--doc-content-overflow, hidden)"},"tosi-doc-system:not(:defined) .doc-navbar":{display:"none"},"tosi-doc-system:not(:defined) pre:has(> code.language-test)":{display:"none"},"tosi-doc-system:not(:defined) .doc-nav":{display:"none"},[`@media (min-width: ${vX}px)`]:{"tosi-doc-system:not(:defined)":{left:`${dE}px`},"tosi-doc-system:not(:defined) .doc-nav":{display:"block",position:"fixed",left:"0",top:b.headerHeight,bottom:"0",width:`${dE}px`,overflow:"auto",background:b.navBg,padding:"0"},"tosi-doc-system:not(:defined) .doc-nav summary":{cursor:"pointer"}},".center":{display:"flex",alignItems:"center",justifyContent:"center"},"input, button, select, textarea":{fontFamily:b.fontFamily,fontSize:b.fontSize,color:"currentColor",background:b.inputBg},select:{WebkitAppearance:"none",appearance:"none"},header:{background:b.brandColor,color:b.brandTextColor,_textColor:b.brandTextColor,_linkColor:b.brandTextColor,display:"flex",alignItems:"center",padding:"0 var(--spacing)",lineHeight:"calc(var(--line-height) * var(--h1-scale))",height:b.headerHeight,whiteSpace:"nowrap"},h1:{color:b.brandColor,fontSize:"calc(var(--font-size) * var(--h1-scale))",lineHeight:"calc(var(--line-height) * var(--h1-scale))",fontWeight:"400",borderBottom:`4px solid ${b.barColor}`,margin:`${b.spacing} 0 ${b.spacing200}`,padding:0},"header h2":{color:b.brandTextColor,whiteSpace:"nowrap"},h2:{color:b.brandColor,fontSize:"calc(var(--font-size) * var(--h2-scale))",lineHeight:"calc(var(--line-height) * var(--h2-scale))",margin:"calc(var(--spacing) * var(--h2-scale)) 0"},h3:{fontSize:"calc(var(--font-size) * var(--h3-scale))",lineHeight:"calc(var(--line-height) * var(--h3-scale))",margin:"calc(var(--spacing) * var(--h3-scale)) 0"},"input[type=search]":{borderRadius:99},blockquote:{position:"relative",background:b.insetBg,margin:"0 48px 56px 0",borderRadius:b.spacing,padding:"var(--spacing) calc(var(--spacing) * 2)",filter:`drop-shadow(0px 1px 1px ${b.shadowColor})`},"blockquote > :first-child":{marginTop:"0"},"blockquote > :last-child":{marginBottom:"0"},"blockquote::before":{content:'" "',display:"block",width:1,height:1,border:"10px solid transparent",borderTopColor:b.insetBg,borderRightColor:b.insetBg,position:"absolute",bottom:-20,right:24},"blockquote::after":{content:'" "',width:48,height:48,display:"block",bottom:-48,right:-24,position:"absolute",background:Ba(j.tosi(),void 0,void 0,2)},a:{textDecoration:"none",color:b.linkColor,opacity:"0.9",borderBottom:"1px solid var(--brand-color)"},"button, select, .clickable":{display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"ease-out 0.2s",_textColor:b.brandColor,color:b.textColor,textDecoration:"none",background:b.buttonBg,padding:"0 calc(var(--spacing) * 1.25)",border:"none",borderRadius:"calc(var(--spacing) * 0.5)"},"button, select, .clickable, input":{lineHeight:"calc(var(--line-height) + var(--spacing))"},"input, textarea":{border:"none",outline:"none",borderRadius:"calc(var(--spacing) * 0.5)",boxShadow:b.inputBorderShadow},input:{padding:"0 calc(var(--spacing) * 1.5)"},"::placeholder":{color:b.placeholderColor},img:{verticalAlign:"middle"},"button:hover, .clickable:hover":{boxShadow:"inset 0 0 0 2px var(--brand-color)"},"button:active, .clickable:active":{background:b.brandColor,color:b.brandTextColor},label:{display:"inline-flex",gap:"calc(var(--spacing) * 0.5)",alignItems:"center"},".elastic":{flex:"1 1 auto",overflow:"hidden",position:"relative"},"svg.tosi-icon, button svg":{fill:"currentColor",pointerEvents:"none"},"[aria-selected]":{background:"#08835820"},":disabled":{opacity:"0.5",filter:"saturate(0)",pointerEvents:"none"},pre:{background:b.codeBg,padding:b.spacing,borderRadius:"calc(var(--spacing) * 0.25)",overflow:"auto",fontSize:b.codeFontSize,lineHeight:"calc(var(--font-size) * 1.2)"},"pre, code":{fontFamily:b.codeFontFamily,_textColor:b.brandColor},".transparent, .iconic":{background:"none"},".iconic":{padding:"0",fontSize:"150%",height:"calc(var(--line-height) + var(--spacing))",lineHeight:"calc(var(--line-height) + var(--spacing))",width:"calc(var(--line-height) + var(--spacing))",textAlign:"center"},".transparent:hover, .iconic:hover":{background:"#0002",boxShadow:"none",color:b.textColor},".transparent:active, .iconic:active":{background:"#0004",boxShadow:"none",color:b.textColor},".current, summary:has(.current)":{background:b.background},".doc-link":{cursor:"pointer",borderBottom:"none",transition:"0.15s ease-out",marginLeft:"10px",padding:"calc(var(--spacing) * 0.5) calc(var(--spacing) * 1.5)"},".doc-link:not(.current):hover":{background:b.background},".doc-link:not(.current)":{opacity:"0.8",marginLeft:0},"tosi-example":{margin:"var(--spacing) 0"},"tosi-example [part=editors]":{background:b.insetBg},"[class*='icon-'], tosi-icon":{color:"currentcolor",pointerEvents:"none"},"[class*='icon-']":{verticalAlign:"middle"},table:{borderCollapse:"collapse"},thead:{background:b.brandColor,color:b.brandTextColor},tbody:{background:b.background},"tr:nth-child(2n)":{background:b.backgroundShaded},"th, td":{padding:"calc(var(--spacing) * 0.5) var(--spacing)"},".doc-nav ul, .doc-nav li":{listStyle:"none",margin:0,padding:0},".doc-nav li":{display:"flex",flexDirection:"column"},".doc-nav":{display:"flex",flexDirection:"column"},".doc-nav details > ul":{paddingLeft:b.spacing},".doc-nav details:not([open]) > ul":{display:"none"},".doc-nav summary":{cursor:"pointer",paddingLeft:"calc(var(--spacing) * 0.5)"},".doc-nav summary::marker":{color:b.brandColor},".doc-nav summary > .doc-link":{display:"inline-block",paddingLeft:"calc(var(--spacing) * 0.5)"},".doc-navbar":{listStyle:"none",display:"flex",flexWrap:"wrap",gap:b.spacing,margin:0,padding:b.spacing}}}var{h2:kX,code:SX}=L,CX=/^(#[0-9a-f]{3,8}|(?:rgb|hsl)a?\([^)]*\))$/i;class pE extends R{static preferredTagName="tosi-css-var-editor";static initAttributes={elementSelector:"",targetSelector:""};content=()=>[kX({part:"title"},"CSS variables"),tu({part:"variables",changeCallback:this.update})];retryTimer;retries=0;loadVars=()=>{let{title:e,variables:t}=this.parts;if(t.textContent="",!this.elementSelector)return;e.textContent=`CSS variables for ${this.elementSelector}`;let i=document.querySelector(this.elementSelector);if(!i){if(this.retries++<40)this.retryTimer=setTimeout(this.loadVars,250);return}let s=i.shadowRoot?i.shadowRoot.querySelector("style"):document.querySelector(`style#${this.elementSelector}-component`);if(!s||!s.textContent)return;let n=getComputedStyle(i),r=[...new Set(s.textContent.match(/--[\w-]+/g)??[])];for(let o of r){let a=n.getPropertyValue(o).trim(),l=CX.test(a)?"color":"string";if(l==="color")a=G.fromCss(a).html;t.append(eu(SX(o),{key:o,value:a,type:l}))}};update=()=>{let e=this.targetSelector||this.elementSelector;if(!e)return;let t=[...document.querySelectorAll(e)],{value:i}=this.parts.variables;for(let s of t)for(let n of Object.keys(i))s.style.setProperty(n,i[n])};connectedCallback(){super.connectedCallback(),this.retries=0,this.loadVars(),this.parts.variables.addEventListener("change",this.update)}disconnectedCallback(){if(super.disconnectedCallback(),this.retryTimer)clearTimeout(this.retryTimer)}}var zJ=pE.elementCreator();var{button:_X,div:LX}=L,vE="tosi-doc-system-prefs",kE=3,RX=250,wE=4000;function IX(e){return e===429||e>=500}async function SE(e){let t;for(let i=0;i<kE;i++){if(i>0){let s=Math.min(wE,RX*2**(i-1));await new Promise((n)=>setTimeout(n,Math.random()*s))}try{let s=await fetch(e);if(!s.ok){let n=Error(`${s.status} ${s.statusText}`);if(!IX(s.status))return Promise.reject(n);t=n;let r=Number(s.headers.get("retry-after"));if(Number.isFinite(r)&&r>0)await new Promise((o)=>setTimeout(o,Math.min(r*1000,wE)));continue}return await s.json()}catch(s){if(s instanceof SyntaxError)throw s;t=s}}throw t}class $y extends R{static preferredTagName="tosi-doc-system";static initAttributes={docs:"/docs.json",config:"",localized:"",routing:"",route:"",accent:"",background:"",text:""};context;content=null;corpus;browser;appliedRoute="";suppressed=!1;nestingDepth(){let e=0,t=this.parentNode;while(t){if(t.nodeType===Node.ELEMENT_NODE&&t.tagName==="TOSI-DOC-SYSTEM")e++;t=t.parentNode||t.host||null}return e}prefs;stylesApplied=!1;applyStyles(){if(this.stylesApplied)return;if(this.stylesApplied=!0,!document.querySelector("link[data-tosi-doc-system]"))ci("tosi-doc-system",fE({accent:this.accent||void 0,background:this.background||void 0,text:this.text||void 0}))}applyThemePrefs=()=>{let e=this.prefs.theme.value,t=e==="dark"||e==="system"&&matchMedia("(prefers-color-scheme: dark)").matches,i=this.prefs.highContrast.value;document.body.classList.toggle("darkmode",t),document.body.classList.toggle("high-contrast",i),document.documentElement.classList.toggle("darkmode",t),document.documentElement.classList.toggle("high-contrast",i)};persistPrefs(){try{localStorage.setItem(vE,JSON.stringify({theme:this.prefs.theme.value,highContrast:this.prefs.highContrast.value,locale:this.prefs.locale.value}))}catch{}}initPrefs(){let e={};try{e=JSON.parse(localStorage.getItem(vE)||"{}")}catch{}this.prefs=Rt({prefs:{theme:e.theme||"system",highContrast:e.highContrast||!1,locale:e.locale||""}}).prefs,this.applyThemePrefs(),matchMedia("(prefers-color-scheme: dark)").addEventListener("change",this.applyThemePrefs),this.prefs.theme.observe(()=>{this.applyThemePrefs(),this.persistPrefs()}),this.prefs.highContrast.observe(()=>{this.applyThemePrefs(),this.persistPrefs()}),this.prefs.locale.observe(()=>this.persistPrefs())}async initLocale(){if(!this.localized)return;try{let e=await(await fetch(this.localized)).text();if(lm(e),this.prefs.locale.value)Ph(this.prefs.locale.value)}catch(e){console.warn("<tosi-doc-system> could not load localization from",this.localized,e)}}settingsButton(){return _X({class:"iconic",style:{color:b.linkColor},title:"settings",onClick:(e)=>{let t=[],i="";try{i=JSON.parse(this.config||"{}").projectName||""}catch{}let s=i||document.title||"Documentation";t.push({caption:"Print as PDF",icon:"printer",action:()=>{let a=window.open("","_blank");if(!a){window.alert("Allow pop-ups to print the documentation as a book.");return}a.document.open(),a.document.write(uE(this.corpus,{title:s,autoPrint:!0})),a.document.close()}}),t.push({caption:"Download ePub",icon:"book",action:()=>{let a=document.createElement("a");a.href=`/${Nf(s)}.epub`,a.download="",a.click()}}),t.push(null);let n=De.localeOptions.value||[];if(n.length>1)t.push({caption:"Language",icon:"globe",menuItems:n.map((a)=>({caption:a.caption,icon:a.icon,checked:()=>a.value===De.locale.value,action:()=>{this.prefs.locale.value=a.value,Ph(a.value)}}))});let r=this.browser?.sourceMenuItems?.()??[];if(r.length>0)t.push({caption:"Source",icon:"code",menuItems:r}),t.push(null);let o=this.browser?.testsMenuItem?.()??null;if(o)t.push(o),t.push(null);t.push({caption:"Color Theme",icon:"rgb",menuItems:[{caption:"System",checked:()=>this.prefs.theme.value==="system",action:()=>this.prefs.theme.value="system"},{caption:"Dark",checked:()=>this.prefs.theme.value==="dark",action:()=>this.prefs.theme.value="dark"},{caption:"Light",checked:()=>this.prefs.theme.value==="light",action:()=>this.prefs.theme.value="light"},null,{caption:"High Contrast",checked:()=>this.prefs.highContrast.value,action:()=>this.prefs.highContrast.value=!this.prefs.highContrast.value}]}),mt({target:e.target,localized:!0,menuItems:t})}},j.moreVertical())}parseLinks(e){let t=this.querySelector(e);if(!t)return[];return[...t.querySelectorAll("a")].map((i)=>({href:i.getAttribute("href")||"",label:(i.textContent||"").trim(),icon:i.dataset.icon||void 0}))}connectedCallback(){if(super.connectedCallback(),this.nestingDepth()>=2){this.suppressed=!0,this.replaceChildren(LX({class:"doc-system-nested"},"\uD83D\uDCD6 nested doc-system preview (suppressed)"));return}if(this.applyStyles(),this.initPrefs(),this.initLocale(),this.corpus===void 0){let e=this.docs||"/docs.json";SE(e).then((t)=>{this.corpus=t;let i=vP(location.search,ha(t));if(i){if(i!==location.pathname){location.replace(i+location.hash);return}history.replaceState(null,"",i+location.hash)}this.queueRender()}).catch((t)=>console.error("<tosi-doc-system> could not load docs from",e,t))}}render(){if(super.render(),this.suppressed||this.corpus===void 0)return;if(this.browser!==void 0){let r=this.browser.navigate;if(r&&this.route&&this.route!==this.appliedRoute)this.appliedRoute=this.route,r(this.route);return}let e={};if(this.config)try{e=JSON.parse(this.config)}catch{console.warn("<tosi-doc-system> ignoring invalid config attribute")}let t=this.nestingDepth()>=1,i=t||this.routing==="memory"||this.routing==="internal",s=this.querySelector(".doc-content")||void 0,n=this.parseLinks(".doc-navbar");if(this.appliedRoute=this.route,this.browser=wy({docs:this.corpus,routing:i?"memory":"path",initialRoute:i?this.route||void 0:void 0,onRouteChange:i?(r)=>{this.appliedRoute=r,this.route=r}:void 0,context:this.context||{tosijs:globalThis.xinjs,"tosijs-ui":globalThis.xinjsui},projectName:e.projectName,projectLinks:e.projectLinks,logo:e.logo,navbarLinks:n.length?n:void 0,contentElement:s}),!t){let r=this.browser.querySelector("header");if(r)r.append(this.settingsButton())}this.replaceChildren(this.browser)}}var jX=$y.elementCreator();function BX(){if(typeof document>"u")return;let e=globalThis.__TOSI_IMPORT_RESOLVER;if(!e)return;Promise.resolve().then(() => (xE(),bE)).then(({registerImportResolver:t})=>t(e)).catch((t)=>console.warn("import-resolver: registration failed",t))}BX();var AE="\\p{Extended_Pictographic}",DX=/^(\d{4})-(\d{2})-(\d{2})$/,NX=[31,28,31,30,31,30,31,31,30,31,30,31],CE=(e)=>{let t=DX.exec(e);if(!t)return!1;let i=+t[1],s=+t[2],n=+t[3];if(s<1||s>12||n<1)return!1;let r=s===2&&i%4===0&&(i%100!==0||i%400===0)?29:NX[s-1];return n<=r},zX=/^(\d{4}-\d{2}-\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})$/,Xf={email:(e)=>/^\S+@\S+\.\S+$/.test(e),uuid:(e)=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e),uri:(e)=>{try{return new URL(e),!0}catch{return!1}},ipv4:(e)=>/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(e),date:CE,"date-time":(e)=>{let t=zX.exec(e);if(!t||!CE(t[1]))return!1;let i=+t[2],s=+t[3],n=+t[4];if(i>23||s>59)return!1;return n<=59||n===60&&i===23&&s===59},emoji:(e)=>new RegExp("\\p{Extended_Pictographic}","u").test(e)},VX=new Set(Object.keys(Xf)),zf=new Map,ME=(e,t)=>{let i=t?"u":"",s=i+"\x00"+e,n=zf.get(s);if(n===void 0){if(n=new RegExp(e,i),zf.size>=500)zf.clear();zf.set(s,n)}return n},le=(e,t=!1)=>({schema:e,_type:null,_optional:t,validate:(i,s)=>Xc(i,e,s),get optional(){let i={...e};if(e.type!==void 0){let s=Array.isArray(e.type)?e.type:[e.type];i.type=s.includes("null")?s:[...s,"null"]}if(i.const!==void 0){let s=i.const===null?"null":typeof i.const;if(i.enum=[i.const,null],delete i.const,i.type===void 0&&s!=="null")i.type=[s,"null"]}if(Array.isArray(i.enum)&&!i.enum.includes(null))i.enum=[...i.enum,null];if(i.type===void 0&&i.enum===void 0&&Array.isArray(i.anyOf)&&!i.anyOf.some((s)=>s===!0||s?.type==="null"||Array.isArray(s?.type)&&s.type.includes("null")))i.anyOf=[...i.anyOf,{type:"null"}];return le(i,!0)},get open(){return le({...e,additionalProperties:!0},t)},title:(i)=>le({...e,title:i},t),describe:(i)=>le({...e,description:i},t),default:(i)=>le({...e,default:i},t),meta:(i)=>le({...i,...e,...i},t),min:(i)=>{let s=e.type==="string"?"minLength":e.type==="array"?"minItems":e.type==="object"?"minProperties":"minimum";return le({...e,[s]:i},t)},max:(i)=>{let s=e.type==="string"?"maxLength":e.type==="array"?"maxItems":e.type==="object"?"maxProperties":"maximum";return le({...e,[s]:i},t)},pattern:(i)=>le({...e,pattern:typeof i==="string"?i:i.source},t),get email(){return le({...e,format:"email"},t)},get uuid(){return le({...e,format:"uuid"},t)},get ipv4(){return le({...e,format:"ipv4"},t)},get url(){return le({...e,format:"uri"},t)},get datetime(){return le({...e,format:"date-time"},t)},get date(){return le({...e,format:"date"},t)},get emoji(){return le({...e,pattern:`^${AE}+$`,format:"emoji"},t)},get int(){return le({...e,type:"integer"},t)},step:(i)=>le({...e,multipleOf:i},t)}),TE=null;var Ey={get email(){return le({type:"string",format:"email"})},get uuid(){return le({type:"string",format:"uuid"})},get ipv4(){return le({type:"string",format:"ipv4"})},get url(){return le({type:"string",format:"uri"})},get datetime(){return le({type:"string",format:"date-time"})},get date(){return le({type:"string",format:"date"})},get emoji(){return le({type:"string",pattern:`^${AE}+$`,format:"emoji"})},get null(){return le({type:"null"})},get undefined(){return le({type:"null","x-tjs-undefined":!0})},get any(){return le({})},pattern:(e)=>le({type:"string",pattern:typeof e==="string"?e:e.source}),union:(e)=>le({anyOf:e.map((t)=>t.schema)}),enum:(e)=>le({type:typeof e[0],enum:e}),const:(e)=>le({const:e}),array:(e)=>le({type:"array",items:e.schema}),tuple:(e)=>le({type:"array",items:e.map((t)=>t.schema),minItems:e.length,maxItems:e.length}),object:(e,t)=>{let i={},s=[];for(let n in e){i[n]=e[n].schema;let r=i[n];if(e[n]._optional!==!0&&(!Array.isArray(r.type)||!r.type.includes("null")))s.push(n)}return le({type:"object",properties:i,required:s,additionalProperties:t?.additionalProperties===!0})},record:(e)=>{if(e==null)throw Error("s.record(valueSchema) requires a value schema — use s.record(s.any) for unconstrained values");return le({type:"object",additionalProperties:e.schema})},infer:(e)=>{if(e===null)return le({type:"null"});if(e===void 0)return le({type:"null","x-tjs-undefined":!0});let t=typeof e;if(t==="string")return le({type:"string"});if(t==="number")return le({type:Number.isInteger(e)?"integer":"number"});if(t==="boolean")return le({type:"boolean"});if(Array.isArray(e)){if(e.length===0)return le({type:"array"});return le({type:"array",items:Ey.infer(e[0]).schema})}if(t==="object"){let i={},s=[];for(let n in e)i[n]=Ey.infer(e[n]).schema,s.push(n);return le({type:"object",properties:i,required:s,additionalProperties:!1})}return le({})}},iee=new Proxy(Ey,{get(e,t){if(t in e)return e[t];if(t==="string"||t==="number"||t==="boolean"||t==="integer"){let i=le({type:t});return e[t]=i,i}return}}),eo=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),QE=!0,Ay=!1;function _E(e){if(QE=e,e)Ay=!1}var XX=()=>{if(!QE||Ay)return;Ay=!0,console.warn("[tosijs-schema] `oneOf` is validated by trying every branch (no short-circuit, unlike `anyOf`) — for a discriminated union, `anyOf` is cheaper. Silence with setWarnings(false). This warns once per process.")},$E=(e,t)=>t==="integer"?typeof e==="number"&&Number.isInteger(e):t==="array"?Array.isArray(e):t==="object"?typeof e==="object"&&!Array.isArray(e):t==="number"?typeof e==="number":typeof e===t;var Vf=97,ZX=new Set(["type","properties","required","items","enum","const","anyOf","oneOf","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","pattern","format","minItems","maxItems","minProperties","maxProperties","additionalProperties","$predicate","x-tjs-undefined"]),FX=(e)=>e.properties!==void 0||e.required!==void 0||e.additionalProperties!==void 0||e.minProperties!==void 0||e.maxProperties!==void 0,WX=(e)=>e.items!==void 0||e.minItems!==void 0||e.maxItems!==void 0;function Xc(e,t,i){let s=t?.schema||t,n=typeof i==="function"?i:i?.onError,r=typeof i==="object"?i?.strict??i?.fullScan??!1:!1,o=[],a=(c)=>{if(n)n(o.join(".")||"root",c);return!1},l=(c,h)=>{if(h===!0)return!0;if(h===!1)return a("Schema forbids value");if(Array.isArray(h.anyOf)){let d=!1;for(let f of h.anyOf)if(Xc(c,f,{strict:r})){d=!0;break}if(!d)return a("Union mismatch")}if(Array.isArray(h.oneOf)){XX();let d=0;for(let f of h.oneOf)if(Xc(c,f,{strict:r})){if(d++,d>1)break}if(d!==1)return a(`oneOf: matched ${d} branches, need exactly 1`)}if(h.const!==void 0){if(c!==h.const)return a("Const mismatch")}if(Array.isArray(h.enum)&&c!==void 0&&!h.enum.includes(c))return a("Enum mismatch");if(c===null){let d=h.type==="null"&&!h["x-tjs-undefined"],f=Array.isArray(h.type)&&h.type.includes("null");return d||f||!h.type||a("Expected value, got null")}if(c===void 0){let d=h.type==="null"&&h["x-tjs-undefined"],f=Array.isArray(h.type)&&h.type.includes("null");return d||f||!h.type||a("Expected value, got undefined")}let u;if(typeof h.type==="string"){if(h.type==="null")return a("Expected null");if(!$E(c,h.type))return a(`Expected ${h.type}`);u=h.type}else if(Array.isArray(h.type)){let d=!1;for(let f of h.type){if(typeof f!=="string"||f==="null")continue;if(d=!0,$E(c,f)){u=f;break}}if(d&&u===void 0)return a(`Expected ${h.type.filter((f)=>typeof f==="string"&&f!=="null").join(" | ")}`);if(!d&&h.type.includes("null"))return a("Expected null")}if(h.$predicate&&TE){if(!TE(h.$predicate,c))return a("Predicate mismatch")}if(typeof c==="number"){if(!Number.isFinite(c))return a("Expected finite number");if(h.minimum!==void 0&&c<h.minimum)return a("Value < min");if(h.maximum!==void 0&&c>h.maximum)return a("Value > max");if(h.exclusiveMinimum!==void 0&&c<=h.exclusiveMinimum)return a("Value <= exclusive min");if(h.exclusiveMaximum!==void 0&&c>=h.exclusiveMaximum)return a("Value >= exclusive max");if(h.multipleOf!==void 0){let d=Math.abs(c%h.multipleOf),f=0.0000000001;if(d>0.0000000001&&Math.abs(d-Math.abs(h.multipleOf))>0.0000000001)return a("Value not step")}}if(typeof c==="string"){if(h.minLength!==void 0&&c.length<h.minLength)return a("Len < min");if(h.maxLength!==void 0&&c.length>h.maxLength)return a("Len > max");if(h.pattern)try{if(!ME(h.pattern,h.format==="emoji").test(c))return a("Pattern mismatch")}catch{return a("Invalid pattern")}if(h.format&&Xf[h.format]&&!Xf[h.format](c))return a("Format invalid")}if(u==="object"||!u&&typeof c==="object"&&!Array.isArray(c)&&FX(h)){let d=h.minProperties!==void 0,f=r&&h.maxProperties!==void 0;if(d||f){let m=0;for(let g in c)if(eo(c,g))m++;if(d&&m<h.minProperties)return a("Too few props");if(f&&m>h.maxProperties)return a("Too many props")}if(h.required){for(let m of h.required)if(!eo(c,m))return a(`Missing ${m}`)}if(h.additionalProperties===!1)for(let m in c){if(!eo(c,m))continue;if(h.properties&&eo(h.properties,m))continue;return a(`Unexpected ${m}`)}if(h.properties){for(let m in h.properties)if(eo(c,m)){o.push(m);let g=l(c[m],h.properties[m]);if(o.pop(),!g)return!1}}if(h.additionalProperties){let m=[];for(let x in c){if(!eo(c,x))continue;if(h.properties&&eo(h.properties,x))continue;m.push(x)}let g=m.length,O=r||g<=Vf?1:Math.floor(g/Vf);for(let x=0;x<g;x+=O){let k=O>1&&x>g-1-O?g-1:x,S=m[k];o.push(S);let P=l(c[S],h.additionalProperties);if(o.pop(),!P)return!1;if(k===g-1)break}}return!0}if(u==="array"||!u&&Array.isArray(c)&&WX(h)){let d=c.length;if(h.minItems!==void 0&&d<h.minItems)return a("Array too short");if(h.maxItems!==void 0&&d>h.maxItems)return a("Array too long");if(h.items===void 0)return!0;if(Array.isArray(h.items)){for(let m=0;m<h.items.length;m++){if(o.push(String(m)),!l(c[m],h.items[m]))return o.pop(),!1;o.pop()}return!0}let f=r||d<=Vf?1:Math.floor(d/Vf);for(let m=0;m<d;m+=f){let g=f>1&&m>d-1-f?d-1:m;o.push(String(g));let O=l(c[g],h.items);if(o.pop(),!O)return!1;if(g===d-1)break}return!0}return!0};return l(e,s)}var qX=(e)=>e?.schema??e,HX=new Set(["title","description","default","examples","$counterexamples","$inferred","$schema","$id","$comment","deprecated","readOnly","writeOnly"]),YX=(e)=>{let t=[];if(e.properties&&typeof e.properties==="object")for(let i of Object.keys(e.properties))t.push([`properties.${i}`,e.properties[i]]);if(e.items!==void 0)if(Array.isArray(e.items))e.items.forEach((i,s)=>t.push([`items.${s}`,i]));else t.push(["items",e.items]);if(e.additionalProperties!==void 0&&typeof e.additionalProperties==="object")t.push(["additionalProperties",e.additionalProperties]);for(let i of["anyOf","oneOf"])if(Array.isArray(e[i]))e[i].forEach((s,n)=>t.push([`${i}.${n}`,s]));return t},PE=(e)=>e!==null&&typeof e==="object",UX=[["type",(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string"),"a string or array of strings"],["anyOf",Array.isArray,"an array"],["oneOf",Array.isArray,"an array"],["required",(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string"),"an array of strings"],["enum",Array.isArray,"an array"],["properties",(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),"an object"],["items",(e)=>e!==null&&typeof e==="object","a schema or array"],["additionalProperties",(e)=>typeof e==="boolean"||e!==null&&typeof e==="object","a boolean or schema"],["pattern",(e)=>typeof e==="string","a string"],["format",(e)=>typeof e==="string","a string"],["$predicate",(e)=>typeof e==="string","a string"],...["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","minItems","maxItems","minProperties","maxProperties"].map((e)=>[e,(t)=>typeof t==="number","a number"])],LE=[["minLength",["string"]],["maxLength",["string"]],["pattern",["string"]],["format",["string"]],["minimum",["number","integer"]],["maximum",["number","integer"]],["exclusiveMinimum",["number","integer"]],["exclusiveMaximum",["number","integer"]],["multipleOf",["number","integer"]],["items",["array"]],["minItems",["array"]],["maxItems",["array"]],["properties",["object"]],["required",["object"]],["additionalProperties",["object"]],["minProperties",["object"]],["maxProperties",["object"]]],GX=[...LE.map(([e])=>e),"enum","$predicate"],RE=(e,t="root")=>{if(e===!0||e===!1)return[];if(e==null||typeof e!=="object"||Array.isArray(e))return[`${t} (not a schema)`];let i=[];for(let n of Object.keys(e))if(!ZX.has(n)&&!HX.has(n)&&!n.startsWith("x-"))i.push(`${t}.${n}`);for(let[n,r,o]of UX)if(e[n]!==void 0&&!r(e[n]))i.push(`${t}.${n} (must be ${o})`);if(e.type===void 0&&e.const===void 0&&e.anyOf===void 0&&e.oneOf===void 0){let n=GX.filter((r)=>e[r]!==void 0);if(n.length>0)i.push(`${t} (constraints without a type — null/undefined and mismatched `+`primitives bypass ${n.join("/")}; add an explicit type)`)}let s=typeof e.type==="string"?[e.type]:Array.isArray(e.type)&&e.type.every((n)=>typeof n==="string")?e.type:null;if(s){for(let[n,r]of LE)if(e[n]!==void 0&&!s.some((o)=>r.includes(o)))i.push(`${t}.${n} (never applies to type ${JSON.stringify(e.type)})`)}if(typeof e.format==="string"&&!VX.has(e.format))i.push(`${t}.format:'${e.format}'`);if(typeof e.pattern==="string")try{ME(e.pattern,e.format==="emoji")}catch{i.push(`${t}.pattern (invalid regex)`)}if(Array.isArray(e.items)&&e.maxItems!==e.items.length)i.push(`${t}.items (tuple without maxItems: ${e.items.length})`);if(PE(e.const))i.push(`${t}.const (non-primitive; === comparison never matches)`);if(Array.isArray(e.enum)&&e.enum.some(PE))i.push(`${t}.enum (non-primitive member never matches)`);for(let[n,r]of YX(e))i.push(...RE(r,`${t}.${n}`));return i};function IE(e){let t=qX(e);if(t===!0||t===!1)return[];return RE(t)}var EE={maxDistinct:12,minCoverage:0.5},KX=["date","date-time","email","uri"],JX=(e)=>{if(e===null)return"null";if(typeof e==="number")return Number.isInteger(e)?"integer":"number";return typeof e},My=(e)=>Array.from(new Set(e)).sort();function Qy(e,t,i){let s=e.filter((c)=>c!==null&&c!==void 0),n=s.length<e.length;if(s.length===0)return e.some((c)=>c===void 0)||e.length===0?{}:{type:"null"};let r=s.filter((c)=>typeof c==="object"&&c!==null&&!Array.isArray(c)),o=s.filter(Array.isArray),a=s.filter((c)=>typeof c!=="object"||c===null),l=[];if(r.length)l.push(iZ(r,t,i));if(o.length)l.push(sZ(o,t,i));if(a.length)l.push(eZ(a,t));if(l.length===1)return tZ(l[0],n);return{anyOf:n?[...l,{type:"null"}]:l}}function eZ(e,t){let i=My(e.map(JX)),s={};if(i.length===1)s.type=i[0];else if(i.length>1)s.type=i;let n=nZ(e,i,t);if(n)s.enum=n;else rZ(s,e,i,t);return s}function tZ(e,t){if(!t)return e;if(e.type!==void 0){let i=Array.isArray(e.type)?e.type:[e.type];if(!i.includes("null"))e.type=My([...i,"null"])}if(Array.isArray(e.enum)&&!e.enum.includes(null))e.enum=[...e.enum,null];return e}function iZ(e,t,i){let s=My(e.flatMap((o)=>Object.keys(o))),n={},r=[];for(let o of s){let a=e.filter((l)=>Object.prototype.hasOwnProperty.call(l,o));if(n[o]=Qy(a.map((l)=>l[o]),t,i?`${i}.${o}`:o),a.length===e.length)r.push(o)}return{type:"object",properties:n,required:r,additionalProperties:!0}}function sZ(e,t,i){let s=e.reduce((r,o)=>r+o.length,0),n;if(t.sampleSize!==void 0&&s>t.sampleSize){n=[];for(let r of e){for(let o of r)if(n.push(o),n.length>=t.sampleSize)break;if(n.length>=t.sampleSize)break}t.onTruncate?.({path:i||"(root)",sampled:n.length,total:s})}else n=e.flat();if(n.length===0)return{type:"array"};return{type:"array",items:Qy(n,t,`${i}[]`)}}function nZ(e,t,i){if(!i.enums||e.length===0)return null;let s=t.length>0&&t.every((l)=>l==="integer"||l==="number"),n=t.length===1&&t[0]==="string";if(!s&&!n)return null;let r=i.enums===!0?EE:{...EE,...i.enums},o=Array.from(new Set(e)),a=1-o.length/e.length;if(o.length>r.maxDistinct||a<r.minCoverage)return null;return s?o.slice().sort((l,c)=>l-c):o.slice().sort()}function rZ(e,t,i,s){if(!s.formats||!(i.length===1&&i[0]==="string"))return;let n=t;if(n.length===0)return;for(let r of KX){let o=Xf[r];if(n.every(o)){e.format=r;return}}}function jE(e,t={}){let i=Qy([e],t,"");if(t.marker!==!1)i.$inferred=!0;return i}var oZ={...gg,...KO,...ky,...Py,...vy};_E(!1);Mh({validate:Xc,inferSchema:jE,unenforcedKeywords:IE});Object.assign(globalThis,{xinjs:ja,xinjsui:oZ});})();
|
|
299
299
|
|
|
300
|
-
//# debugId=
|
|
300
|
+
//# debugId=F9F2D6DEEC9F868564756E2164756E21
|
|
301
301
|
//# sourceMappingURL=iife.js.map
|