tosijs-ui 1.12.3 → 1.12.4

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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.12.4
4
+
5
+ ### `.tjs` source files are documented again ([#108](https://github.com/tonioloewald/tosijs-ui/issues/108))
6
+
7
+ Converting a source file from `.ts` to native `.tjs` **silently deleted its documentation page**,
8
+ and its `llms.txt` entry with it. Reported from tosijs, mid-port: one page lost per converted
9
+ module.
10
+
11
+ The silence was the real defect. The build exited 0, and the internal-link check passed —
12
+ a page that was never generated is linked from nowhere, so "41 slugs, no 404s" is a _pass_. The
13
+ only signal was a slug count nothing asserts on. `'x.tjs'.endsWith('.ts')` is `false`, so the
14
+ `llms.txt` filter excluded it too, without even the mercy of an accidental match.
15
+
16
+ `.tjs` is now scraped, in both places. The doc-block syntax is identical across these languages —
17
+ a doc block is just a comment — so there is nothing language-specific to support. The list _is_
18
+ the feature, which is exactly why an omission from it is invisible.
19
+
20
+ **And a guard for the next one.** A file carrying what looks like a doc block, in an extension we
21
+ do not scrape, is now **named** in the build output rather than passed over:
22
+
23
+ ```
24
+ ⚠️ 1 file(s) look documented but are not scraped, so they have no page:
25
+ src/thing.vue
26
+ Scraped extensions: .ts, .js, .tjs, .css. Add one to SCRAPED_SOURCE_EXTENSIONS if it should be documented.
27
+ ```
28
+
29
+ It warns rather than fails: a file may legitimately contain the sequence without wanting to be
30
+ documentation, and a doc site that refused to build over a comment would be worse than the bug.
31
+ But whatever the next extension turns out to be, its absence can no longer happen quietly.
32
+
3
33
  ## 1.12.3
4
34
 
5
35
  ### Back now has layout coverage, because a reader noticed before the tests did
@@ -82,5 +82,6 @@ export declare function parseFrontmatter(content: string): {
82
82
  data: Partial<Doc>;
83
83
  body: string;
84
84
  };
85
+ export declare const SCRAPED_SOURCE_EXTENSIONS: string[];
85
86
  export declare function extractDocs(options: ExtractDocsOptions): Doc[];
86
87
  export declare function saveDocsJSON(docs: Doc[], outputPath: string): void;
@@ -181,6 +181,53 @@ function metadata(content, filePath) {
181
181
  delete data.title;
182
182
  return data;
183
183
  }
184
+ /*
185
+ Source extensions whose doc-comment blocks become documentation.
186
+
187
+ `.tjs` earns its place for a reason worth recording: converting `more-math.ts` to `more-math.tjs`
188
+ in tosijs SILENTLY deleted its documentation page (tosijs-ui#108). The build stayed green, and so
189
+ did the internal-link check — a page that was never generated is linked from nowhere, so "41
190
+ slugs, no 404s" is a pass. The only signal was a slug count nobody asserts on. A project mid-port
191
+ loses one page per converted module and hears about it from a reader.
192
+
193
+ The block syntax is identical across all of these, because a doc block is just a comment. There
194
+ is nothing language-specific to support; the list IS the whole feature, which is exactly why
195
+ forgetting an entry is silent.
196
+
197
+ (Written without the closing-delimiter characters spelled out, because putting them in a comment
198
+ ends it — the same trap tosijs-ui#70 records for doc blocks, hit again while writing this.)
199
+
200
+ See `warnUnscrapedDocBlocks` below: a missing extension should never again be invisible.
201
+ */
202
+ export const SCRAPED_SOURCE_EXTENSIONS = ['.ts', '.js', '.tjs', '.css'];
203
+ /** Files that look documented but are not scraped — reported once at the end of a walk. */
204
+ const unscrapedDocBlocks = [];
205
+ /**
206
+ * Does an UNSCRAPED file appear to carry a doc block?
207
+ *
208
+ * Deliberately cheap and deliberately narrow: only files we are not already reading, only
209
+ * plausible source extensions, and only the same line-starting pattern the scraper itself uses,
210
+ * so this cannot disagree with it about what a doc block is. Binary files and anything large are
211
+ * skipped — this is a safety net, not a search.
212
+ */
213
+ function hasDocBlock(filePath) {
214
+ const ext = path.extname(filePath);
215
+ if (SCRAPED_SOURCE_EXTENSIONS.includes(ext) || ext === '.md')
216
+ return false;
217
+ // Extensions worth checking: source-shaped, and not the ones we already read.
218
+ if (!/^\.[cm]?[jt]sx?$|^\.(tjs|ajs|svelte|vue|scss|sass|less)$/.test(ext)) {
219
+ return false;
220
+ }
221
+ try {
222
+ const stat = fs.statSync(filePath);
223
+ if (stat.size > 2_000_000)
224
+ return false;
225
+ return /^[ \t]*\/\*#/m.test(fs.readFileSync(filePath, 'utf8'));
226
+ }
227
+ catch {
228
+ return false; // unreadable is not our business here
229
+ }
230
+ }
184
231
  function findMarkdownFiles(paths, ignore) {
185
232
  const markdownFiles = [];
186
233
  const truncationFound = [];
@@ -223,7 +270,22 @@ function findMarkdownFiles(paths, ignore) {
223
270
  ...fm, // frontmatter wins over JSON-comment metadata + the H1
224
271
  });
225
272
  }
226
- else if (['.ts', '.js', '.css'].includes(path.extname(file))) {
273
+ else if (hasDocBlock(filePath)) {
274
+ /*
275
+ A file we do NOT scrape, carrying what looks like a doc block.
276
+
277
+ This is the guard for the whole class, not just for `.tjs`. The extension list is the
278
+ entire feature, so an omission from it is invisible by construction: the page is simply
279
+ never generated, nothing links to it, and the link check passes. tosijs lost a page per
280
+ ported module this way and found out from a reader (tosijs-ui#108).
281
+
282
+ Warn rather than fail. A file may legitimately contain the sequence without wanting to be
283
+ documentation, and a doc site that refuses to build over a comment would be worse than
284
+ the bug. But it can no longer happen in silence.
285
+ */
286
+ unscrapedDocBlocks.push(path.relative(process.cwd(), filePath));
287
+ }
288
+ else if (SCRAPED_SOURCE_EXTENSIONS.includes(path.extname(file))) {
227
289
  const content = fs.readFileSync(filePath, 'utf8');
228
290
  // A /*# … */ block is only a doc when it STARTS a line (whitespace-only
229
291
  // before the slash). This keeps a `/*#` that appears inside a // comment,
@@ -281,6 +343,21 @@ function findMarkdownFiles(paths, ignore) {
281
343
  if (truncationFound.length) {
282
344
  console.warn('\n' + formatTruncationWarnings(truncationFound));
283
345
  }
346
+ /*
347
+ Same policy, different failure: a file that looks documented and is not being read.
348
+
349
+ Named individually rather than counted, because the useful version of this message is one you
350
+ can act on without going looking. The fix is nearly always one entry in
351
+ SCRAPED_SOURCE_EXTENSIONS.
352
+ */
353
+ if (unscrapedDocBlocks.length) {
354
+ const list = unscrapedDocBlocks.map((f) => ` ${f}`).join('\n');
355
+ console.warn(`\n⚠️ ${unscrapedDocBlocks.length} file(s) look documented but are not scraped, so ` +
356
+ `they have no page:\n${list}\n` +
357
+ ` Scraped extensions: ${SCRAPED_SOURCE_EXTENSIONS.join(', ')}. ` +
358
+ `Add one to SCRAPED_SOURCE_EXTENSIONS if it should be documented.\n`);
359
+ unscrapedDocBlocks.length = 0; // a walk reports its own findings, not the previous one's
360
+ }
284
361
  return markdownFiles.sort(pinnedSort);
285
362
  }
286
363
  export function extractDocs(options) {
@@ -60,7 +60,14 @@ function entriesFromSrcScan() {
60
60
  const entries = [];
61
61
  let files;
62
62
  try {
63
- files = fs.readdirSync(SRC).filter((f) => f.endsWith('.ts'));
63
+ /*
64
+ `.tjs` too — and note `'x.tjs'.endsWith('.ts')` is FALSE, so the old test excluded it
65
+ silently rather than catching it by accident. Same root as tosijs-ui#108: a module ported
66
+ from `.ts` to `.tjs` dropped out of both the doc corpus and this index at once.
67
+ */
68
+ files = fs
69
+ .readdirSync(SRC)
70
+ .filter((f) => f.endsWith('.ts') || f.endsWith('.tjs'));
64
71
  }
65
72
  catch {
66
73
  return entries;
package/dist/iife.js CHANGED
@@ -272,7 +272,7 @@ ${s.join(`
272
272
  `)||"(idle)"}`}).join(`
273
273
  `)}var{slot:QO}=L;class _O extends R{static preferredTagName="tosi-row";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[QO()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"row",gap:C.tosiRowGap("0"),alignItems:C.tosiRowAlign("stretch"),justifyContent:C.tosiRowJustify("flex-start")}};render(){if(super.render(),this.gap)this.style.setProperty("--tosi-row-gap",this.gap);else this.style.removeProperty("--tosi-row-gap");if(this.align)this.style.setProperty("--tosi-row-align",this.align);else this.style.removeProperty("--tosi-row-align");if(this.justify)this.style.setProperty("--tosi-row-justify",this.justify);else this.style.removeProperty("--tosi-row-justify");this.style.flexWrap=this.wrap?"wrap":""}}var Ez=_O.elementCreator();class LO extends R{static preferredTagName="tosi-column";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[QO()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"column",gap:C.tosiColumnGap("0"),alignItems:C.tosiColumnAlign("stretch"),justifyContent:C.tosiColumnJustify("flex-start")}};render(){if(super.render(),this.gap)this.style.setProperty("--tosi-column-gap",this.gap);else this.style.removeProperty("--tosi-column-gap");if(this.align)this.style.setProperty("--tosi-column-align",this.align);else this.style.removeProperty("--tosi-column-align");if(this.justify)this.style.setProperty("--tosi-column-justify",this.justify);else this.style.removeProperty("--tosi-column-justify");this.style.flexWrap=this.wrap?"wrap":""}}var Az=LO.elementCreator();class RO extends R{static preferredTagName="tosi-grid";static initAttributes={columns:"",rows:"",gap:""};content=[QO()];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:C.tosiGridColumns("1fr"),gridTemplateRows:C.tosiGridRows("auto"),gap:C.tosiGridGap("0")}};render(){if(super.render(),this.columns)this.style.setProperty("--tosi-grid-columns",this.columns);else this.style.removeProperty("--tosi-grid-columns");if(this.rows)this.style.setProperty("--tosi-grid-rows",this.rows);else this.style.removeProperty("--tosi-grid-rows");if(this.gap)this.style.setProperty("--tosi-grid-gap",this.gap);else this.style.removeProperty("--tosi-grid-gap")}}var Mz=RO.elementCreator(),{span:rP}=L,Qz=(...e)=>rP({style:{flex:"1 1 var(--tosi-space, 0.5em)"}},...e),IO=(...e)=>rP({style:{flex:"0 0 var(--tosi-space, 0.5em)"}},...e);var Ks={accent:U.fromCss("#d92270"),background:U.fromCss("#fafafa"),text:U.fromCss("#222222")},oP={_tosiSpacingXs:"4px",_tosiSpacingSm:"8px",_tosiSpacing:"12px",_tosiSpacingLg:"16px",_tosiSpacingXl:"24px",_tosiFontFamily:"system-ui, -apple-system, sans-serif",_tosiFontSize:"16px",_tosiLineHeight:"1.5",_tosiCodeFontFamily:"ui-monospace, monospace",_tosiCodeFontSize:"14px",_tosiTouchSize:"44px",_tosiBorderRadius:"4px",_tosiBorderRadiusLg:"8px",_tosiTransition:"0.15s ease-out"};function aP(e){let{accent:t,background:i,text:s}=e,n=e.accentText??t.contrasting(),r=e.backgroundInset??i.darken(0.03),o=e.border??s.opacity(0.15),a=e.shadow??s.opacity(0.1),l=e.focus??t.opacity(0.5);return{_tosiAccent:t,_tosiAccentLight:t.brighten(0.15),_tosiAccentDark:t.darken(0.15),_tosiAccentText:n,_tosiBg:i,_tosiBgInset:r,_tosiBgHover:i.darken(0.05),_tosiBgActive:i.darken(0.1),_tosiText:s,_tosiTextMuted:s.opacity(0.6),_tosiTextDisabled:s.opacity(0.4),_tosiBorder:o,_tosiBorderFocus:t,_tosiShadow:a,_tosiShadowColor:a,_tosiFocusRing:`0 0 0 2px ${l}`,_tosiInputBg:i,_tosiInputBorder:o,_tosiInputBorderFocus:t,_tosiButtonBg:i,_tosiButtonText:s,_tosiButtonBorder:o,_tosiButtonHoverBg:i.darken(0.05),_tosiButtonActiveBg:t,_tosiButtonActiveText:n}}function ra(e){return{":root":{...oP,...aP(e)}}}function rf(e){let i=ra(e)[":root"];return{":root":Aa(i)}}function jO(e,t="tosi-theme"){ri(t,e)}var _z=ra(Ks),Lz=rf(Ks),lP={"--xin-icon-size":b.tosiIconSize,"--xin-icon-fill":b.tosiIconFill,"--xin-icon-stroke":b.tosiIconStroke,"--xin-tabs-bar-color":b.tosiTabsBarColor,"--xin-tabs-bar-height":b.tosiTabsBarHeight,"--xin-tabs-selected-color":b.tosiTabsSelectedColor,"--spacing":b.tosiSpacing,"--gap":b.tosiSpacingSm,"--touch-size":b.tosiTouchSize,"--background":b.tosiBg,"--text-color":b.tosiText,"--brand-color":b.tosiAccent,"--brand-text-color":b.tosiAccentText};function Rz(e){return{":root":{...ra(e)[":root"],...lP}}}function Iz(e,t){let i={};for(let[s,n]of Object.entries(t)){let r=`--tosi-${e}-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}`;i[s]=`var(${r}, ${n})`}return i}var{div:oa,label:of,input:af,span:jz,button:cP}=L,{liveTheme:tt}=Et({liveTheme:{accent:String(Ks.accent),background:String(Ks.background),text:String(Ks.text),dark:!1}}),lf=!1;function Sc(){if(!lf)return;let e={accent:U.fromCss(tt.accent.value),background:U.fromCss(tt.background.value),text:U.fromCss(tt.text.value)},t=tt.dark.value?rf(e):ra(e);jO(t,"tosi-live-theme")}function hP(){if(lf)return;lf=!0,tt.accent.observe(Sc),tt.background.observe(Sc),tt.text.observe(Sc),tt.dark.observe(Sc),Sc()}function Bz(){lf=!1}class BO extends R{static preferredTagName="tosi-theme-editor";static shadowStyleSpec={":host":{display:"block",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",lineHeight:"1.5",background:"#ffffff",color:"#222222",padding:"16px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",maxWidth:"320px"},":host .field":{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},":host label":{flex:"1",fontWeight:"500"},':host input[type="color"]':{width:"48px",height:"32px",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",padding:"2px"},':host input[type="checkbox"]':{width:"18px",height:"18px",cursor:"pointer"},":host .preview":{marginTop:"12px",padding:"12px",borderRadius:"4px",transition:"all 0.15s ease-out"},":host .preview-button":{border:"none",padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontFamily:"inherit",fontSize:"13px"},":host .actions":{marginTop:"8px",display:"flex",gap:"8px"},":host .actions button":{flex:"1",padding:"6px 12px",border:"1px solid #ccc",borderRadius:"4px",background:"#f5f5f5",color:"#222",cursor:"pointer",fontFamily:"inherit",fontSize:"13px"},":host .actions button:hover":{background:"#e8e8e8"}};content=()=>[oa({class:"field"},of("Accent"),af({type:"color",part:"accent"})),oa({class:"field"},of("Background"),af({type:"color",part:"background"})),oa({class:"field"},of("Text"),af({type:"color",part:"text"})),oa({class:"field"},of("Dark mode"),af({type:"checkbox",part:"dark"})),oa({class:"preview",part:"preview",style:{background:"var(--tosi-bg, #fafafa)",color:"var(--tosi-text, #222)"}},jz("Preview "),cP({class:"preview-button",style:{background:"var(--tosi-accent, #d92270)",color:"var(--tosi-accent-text, white)"}},"Button")),oa({class:"actions"},cP({part:"reset"},"Reset"))];connectedCallback(){super.connectedCallback(),hP();let e=()=>{this.parts.accent.value=tt.accent.value,this.parts.background.value=tt.background.value,this.parts.text.value=tt.text.value,this.parts.dark.checked=tt.dark.value};e(),tt.accent.observe(e),tt.background.observe(e),tt.text.observe(e),tt.dark.observe(e),this.parts.accent.addEventListener("input",()=>{tt.accent.value=this.parts.accent.value}),this.parts.background.addEventListener("input",()=>{tt.background.value=this.parts.background.value}),this.parts.text.addEventListener("input",()=>{tt.text.value=this.parts.text.value}),this.parts.dark.addEventListener("change",()=>{tt.dark.value=this.parts.dark.checked}),this.parts.reset.addEventListener("click",()=>{tt.accent.value=String(Ks.accent),tt.background.value=String(Ks.background),tt.text.value=String(Ks.text),tt.dark.value=!1})}}var Dz=BO.elementCreator();var{div:Nz}=L;class Ur extends R{static preferredTagName="tosi-map";static formAssociated=!0;static initAttributes={coords:"65.01715565258993,25.48081004203459,12",token:"",mapStyle:"mapbox://styles/mapbox/streets-v12",name:""};value="";formDisabledCallback(e){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=Nz({style:{width:"100%",height:"100%"}});get map(){return this._map}static mapboxCSSAvailable;static mapboxAvailable;_map;_mapPending=!1;static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"400px",height:"400px",textAlign:"left"}};constructor(){super();if(Ur.mapboxCSSAvailable===void 0)Ur.mapboxCSSAvailable=eh("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((e)=>{console.error("failed to load mapbox-gl.css",e)}),Ur.mapboxAvailable=Ps("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((e)=>{console.error("failed to load mapbox-gl.js",e)})}connectedCallback(){if(super.connectedCallback(),!this.token)console.error("mapbox requires an access token which you can provide via the token attribute")}_lastCoords="";_lastStyle="";render(){if(super.render(),!this.token)return;if(this._map){if(this.coords!==this._lastCoords){let[t,i,s]=this.coords.split(",").map((n)=>Number(n));this._map.setCenter([i,t]),this._map.setZoom(s),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}if(this._mapPending)return;this._mapPending=!0;let{div:e}=this.parts;Ur.mapboxAvailable.then(({mapboxgl:t})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;");let[i,s,n]=this.coords.split(",").map((r)=>Number(r));t.accessToken=this.token,this._map=new t.Map({container:e,style:this.mapStyle,zoom:n,center:[s,i]}),this._lastCoords=this.coords,this._lastStyle=this.mapStyle,this._mapPending=!1,this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let r=this._map.getCenter(),o=this._map.getZoom(),a=`${r.lat.toFixed(6)},${r.lng.toFixed(6)},${o.toFixed(1)}`;if(a!==this.value){if(this.internals)this.internals.setFormValue(a)}})}).catch((t)=>{this._mapPending=!1,console.error("tosi-map: mapbox failed to load",t)})}}var zz=Ur.elementCreator();function uP(e,t){if(t==null)t="";else if(typeof t!=="string")t=String(t);return t.replace(/\{\{([^}]+)\}\}/g,(i,s)=>{let n=st[`${e}${s.startsWith("[")?s:"."+s}`];return n===void 0?i:uP(e,String(n))})}class cf 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(),st[this.instanceId]=typeof this.context==="string"?JSON.parse(this.context):this.context;let e=uP(this.instanceId,this.value);if(this.elements){let t=e.split(`
274
274
  `).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]+=`
275
- `+s;else i.push(s)}return i},[]);this.innerHTML=t.map((i)=>i.startsWith("<")&&i.endsWith(">")?i:_e(i,this.options)).join("")}else this.innerHTML=_e(e,this.options);this.didRender()}}var Vz=cf,DO=cf.elementCreator(),Xz=DO,Zz=DO;var{div:NO,span:hf,button:zO}=L,Cc=86400000,Fz=[0,1,2,3,4,5,6],Wz=[1,2,3,4,5,6,7,8,9,10,11,12],VO=(e,t=2,i="0")=>String(e).padStart(t,i),Tc=(e,t,i)=>new Date(`${e}-${VO(t)}-${VO(i)}`);class XO 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:C.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:C.monthTodayBackground("transparent"),boxShadow:C.monthTodayShadow("none"),backdropFilter:C.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:C.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:C.monthDayColor("hotpink"),background:C.monthDayBackground("white"),fontWeight:C.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:C.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:C.monthDateCheckedColor("white"),background:C.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:C.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:C.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:C.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:C.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:C.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:Tc(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:Tc(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 Wz.map((e)=>({caption:Tc(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}-${VO(this.month)}-`),action:()=>{this.gotoDate(e)}});jumpMenu=()=>{ht({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=()=>[NO({part:"header"},zO({part:"previous",onClick:this.previousMonth},I.chevronLeft()),hf({style:{flex:"1"}}),zO({part:"jump",onClick:this.jumpMenu},I.calendar()),Fi({part:"month",options:this.months,onChange:this.setMonth}),Fi({part:"year",options:[this.year],onChange:this.setMonth}),hf({style:{flex:"1"}}),zO({part:"next",onClick:this.nextMonth},I.chevronRight())),NO({part:"week"}),NO({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=Tc(this.year,this.month,1),l=new Date(a.valueOf()-(7+a.getDay()-this.weekStart)%7*Cc),c=this.month===12?1:this.month+1,h=new Date(Tc(this.year+(this.month===12?1:0),c,1).valueOf()-Cc),u=new Date(h.valueOf()+(this.weekStart*2+5+this.endDay-h.getDay())%7*Cc),d=Fz.map((x)=>new Date(l.valueOf()+x*Cc).toString().split(" ")[0]);this.days=[];let f=new Date().toISOString().split("T")[0];for(let x=l.valueOf();x<=u.valueOf();x+=Cc){let k=new Date(x),w=k.toISOString().split("T")[0];this.days.push({date:k,selected:!1,inMonth:k.getMonth()+1===this.month,isToday:w===f,isWeekend:k.getDay()%6===0,inRange:!!(this.from&&w>=this.from&&w<=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)=>hf({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 w=x.date.toISOString().split("T")[0];if(this.checkDay(w))k.push("checked");if(k.push(x.isWeekend?"weekend":"weekday"),this.range){if(g===w)k.push("range-end");if(O===w)k.push("range-start")}let P=hf({class:k.join(" "),title:w,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},x.date.getDate());if(w===this.#e)m=P;return P})),m?.focus()}}var qz=XO.elementCreator();var dP=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("")},fP=async(e)=>{let t=await dP(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:ZO,tosiSlot:Hz}=L;class uf 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:C.meterHeight("24px"),background:C.indicatorBg("white"),borderRadius:C.meterRadius("4px"),boxShadow:C.meterShadow(`inset 0 0 0 2px ${b.indicatorColor}`)},':host [part="level"]':{height:C.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:b.indicatorColor,margin:C.levelMargin("2px"),borderRadius:C.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:b.descriptionColor,height:C.meterHeight("24px"),lineHeight:C.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 fP(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=()=>[Hz({onInput:this.update}),ZO({part:"meter"},ZO({part:"level"}),ZO({part:"description"}))];render(){super.render();let e=this.querySelector("input");this.updateIndicator(e?.value)}}var Yz=uf,pP=uf.elementCreator(),Uz=pP;var{span:FO}=L;class df 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=()=>FO({part:"container"},FO({part:"empty"}),FO({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(I[this.icon]()),i.append(I[this.icon]())}this.displayValue(this.value)}}var Gz=df,mP=df.elementCreator(),Kz=ni((...e)=>mP(...e),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:gP,div:Jz,button:eV}=L,tV=[{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 WO(e=tV){return Fi({title:"paragraph style",slot:"toolbar",class:"block-style",options:e.map(({caption:t,tagType:i})=>({caption:t,value:`formatBlock,${i}`}))})}var $c=()=>IO({slot:"toolbar"});function xs(e,t,i){return eV({slot:"toolbar",dataCommand:t,title:e},i)}var iV=()=>[xs("left-justify","justifyLeft",I.alignLeft()),xs("center","justifyCenter",I.alignCenter()),xs("right-justify","justifyRight",I.alignRight()),$c(),xs("bullet list","insertUnorderedList",I.listBullet()),xs("numbered list","insertOrderedList",I.listNumber()),$c(),xs("indent","indent",I.indent()),xs("indent","outdent",I.outdent())],OP=()=>[xs("bold","bold",I.fontBold()),xs("italic","italic",I.fontItalic()),xs("underline","underline",I.fontUnderline())],sV=()=>[WO(),$c(),...OP()],yP=()=>[WO(),$c(),...iV(),$c(),...OP()];class ff 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(qs.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=[gP({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),Jz({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),gP({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(...sV());break;case"default":e.append(...yP());break}}}var nV=ff,bP=ff.elementCreator(),rV=ni((...e)=>bP(...e),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:Pc}=Et({router:{path:"",hash:"",pattern:""}}),qO={};function oV(){return{...qO}}var pf=[],HO=!1,mf=new Set;function aV(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 lV(e){let t=e.split("?")[0].split("#")[0];for(let s of pf){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=pf.find((s)=>s.fallback);if(i)return{route:i,params:{}};return null}function Ec(){let e=HO?window.location.hash.replace(/^#\/?/,"").split("?")[0]:window.location.pathname;Pc.path.value=e,Pc.hash.value=window.location.hash;let t=lV(e);if(t){qO=t.params,Pc.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 mf){let n=s.name||"default",r=i.get(n);if(r)s.replaceChildren(r.component(t.params));else s.replaceChildren()}}else{qO={},Pc.pattern.value="";for(let i of mf)i.replaceChildren()}}var xP=!1;function vP(){if(xP)return;xP=!0,window.addEventListener("popstate",Ec),window.addEventListener("hashchange",Ec)}function cV(e,t={}){HO=t.hashRouting??!1,pf=e.map((i)=>{let{regex:s,paramNames:n}=aV(i.pattern);return{regex:s,paramNames:n,targets:i.targets,fallback:i.fallback??!1}}),vP(),Ec()}function hV(e){if(vP(),HO)window.location.hash="#/"+e.replace(/^\//,"");else window.history.pushState({},"","/"+e.replace(/^\//,""));Ec()}class YO extends R{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),mf.add(this),pf.length>0)Ec()}disconnectedCallback(){super.disconnectedCallback(),mf.delete(this)}}var uV=YO.elementCreator();var{div:dV,slot:fV,label:pV,span:mV,input:kP}=L;class aa 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=aa.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?I[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=()=>[fV(),dV({part:"options"},kP({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:C.segmentedOptionGap("8px"),alignItems:C.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:C.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:C.segmentedOptionGap("8px"),gridTemplateColumns:C.segmentedOptionGridColumns("0px 24px 1fr"),padding:C.segmentedOptionPadding("4px 12px"),font:C.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:C.segmentedFocusShadow(`inset 0 0 0 2px ${C.segmentedOptionCurrentBackground("#44a")}`),borderRadius:C.segmentedOptionsBorderRadius("8px")},":host label.current":{color:C.segmentedOptionCurrentColor("#eee"),background:C.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:C.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${C.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:C.segmentOptionIconSize("16px"),stroke:C.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:C.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:C.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:C.segmentedOptionsBorderRadius("8px"),background:C.segmentedOptionsBackground("#fff"),color:C.segmentedOptionColor("#222"),overflow:"hidden",alignItems:C.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:C.segmentedOptionPadding("4px 12px"),color:C.segmentedOptionCurrentColor("#eee"),background:C.segmentedOptionCurrentBackground("#44a"),font:C.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:C.segmentedOptionCurrentColor("#eee"),opacity:C.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=aa.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)=>pV({tabindex:0},kP({type:i,name:this.name,value:c.value,checked:o(c.value),tabIndex:-1}),c.icon||{class:"no-icon"},this.localized?ps(c.caption):mV(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 gV=aa,wP=aa.elementCreator(),OV=ni((...e)=>wP(...e),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:SP}=L;class UO extends R{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[SP({part:"normal"}),SP({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 yV=UO.elementCreator();class gf 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=I.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;Si(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 bV=gf,CP=gf.elementCreator(),xV=CP;var{div:vV,input:kV,span:wV,button:GO}=L,TP=(e)=>e.split(/(?<!\\),/).map((t)=>t.trim().replace(/\\,/g,",")),SV=(e)=>e.map((t)=>t.replace(/,/g,"\\,")).join(",");class Ac 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":C.brandColor("blue"),"--tag-text-color":C.brandTextColor("white"),display:"inline-flex",borderRadius:C.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:C.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:C.tagCloseButtonRadius("99px"),opacity:b.tagButtonOpacity},':host [part="remove"]:hover':{background:b.tagCloseButtonBg,opacity:b.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[wV({part:"caption"},this.caption),GO(I.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var CV=Ac,KO=Ac.elementCreator(),TV=ni((...e)=>KO(...e),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class la 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:C.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:C.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 TP(this.value).filter((e)=>e!=="")}set tags(e){this.value=SV(e)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(e){if(typeof e==="string")this._availableTags=la.parseAvailableTagsString(e);else this._availableTags=e;this.queueRender()}static parseAvailableTagsString(e){return TP(e).map((t)=>t===""?null:t)}connectedCallback(){super.connectedCallback();let e=this.getAttribute("available-tags");if(e&&this._availableTags.length===0)this._availableTags=la.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)}}});ht({target:t,width:"auto",menuItems:n})};content=()=>[GO({type:"button",style:{visibility:"hidden"},tabindex:-1}),vV({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),kV({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),GO({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},I.chevronDown())];removeTag=(e)=>{if(this.editable&&!this.disabled){let t=e.target.closest(Ac.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(KO({caption:s,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var $V=la,$P=la.elementCreator(),PV=ni((...e)=>$P(...e),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var PP="1.12.3";var{span:EV}=L,Mc=null,Of=null,yf=null,Js="tosi-tooltip",AV={[`.${Js}`]:{pointerEvents:"none",padding:C.tosiTooltipPadding("4px 10px"),borderRadius:C.tosiTooltipRadius("6px"),background:C.tosiTooltipBg("#333"),color:C.tosiTooltipColor("#fff"),fontSize:C.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:C.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${Js} p`]:{margin:"0"},[`.${Js} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${Js} a`]:{color:"inherit"},[`.${Js}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${Js}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Js}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Js}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${Js}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},EP=!1;function AP(){if(EP)return;EP=!0,ri("tosi-tooltip",AV)}function ca(){if(Of!==null)clearTimeout(Of),Of=null;if(Mc!==null)Mc.remove(),Mc=null;yf=null}function MV(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 QV(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 _V(e,t){if(t)e=de(e);let i=EV({class:Js});return i.innerHTML=_e.parseInline(e),i}function LV(e,t,i){AP(),ca(),yf=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=_V(t,i);h.classList.add(MV(c)),Mc=Kl({content:h,target:e,position:c,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(Mc&&yf)QV(h,e,c)})}function RV(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.tooltip)return t;return null}function IV(e={}){AP();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=RV(n);if(r===yf)return;if(ca(),!r)return;let o=r.dataset.tooltip||null;if(!o)return;Of=setTimeout(()=>LV(r,o,s),i)}),document.addEventListener("pointerleave",ca),document.addEventListener("pointerdown",ca),document.addEventListener("keydown",ca),window.addEventListener("scroll",ca,!0)}var IP="\\p{Extended_Pictographic}",jV=/^(\d{4})-(\d{2})-(\d{2})$/,BV=[31,28,31,30,31,30,31,31,30,31,30,31],MP=(e)=>{let t=jV.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:BV[s-1];return n<=r},DV=/^(\d{4}-\d{2}-\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})$/,vf={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:MP,"date-time":(e)=>{let t=DV.exec(e);if(!t||!MP(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)},NV=new Set(Object.keys(vf)),bf=new Map,jP=(e,t)=>{let i=t?"u":"",s=i+"\x00"+e,n=bf.get(s);if(n===void 0){if(n=new RegExp(e,i),bf.size>=500)bf.clear();bf.set(s,n)}return n},le=(e,t=!1)=>({schema:e,_type:null,_optional:t,validate:(i,s)=>Qc(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:`^${IP}+$`,format:"emoji"},t)},get int(){return le({...e,type:"integer"},t)},step:(i)=>le({...e,multipleOf:i},t)}),QP=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:`^${IP}+$`,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({})}},nJ=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}}),Gr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),BP=!0,ty=!1;function DP(e){if(BP=e,e)ty=!1}var zV=()=>{if(!BP||ty)return;ty=!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.")},_P=(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 xf=97,VV=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"]),XV=(e)=>e.properties!==void 0||e.required!==void 0||e.additionalProperties!==void 0||e.minProperties!==void 0||e.maxProperties!==void 0,ZV=(e)=>e.items!==void 0||e.minItems!==void 0||e.maxItems!==void 0;function Qc(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(Qc(c,f,{strict:r})){d=!0;break}if(!d)return a("Union mismatch")}if(Array.isArray(h.oneOf)){zV();let d=0;for(let f of h.oneOf)if(Qc(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(!_P(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,_P(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&&QP){if(!QP(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(!jP(h.pattern,h.format==="emoji").test(c))return a("Pattern mismatch")}catch{return a("Invalid pattern")}if(h.format&&vf[h.format]&&!vf[h.format](c))return a("Format invalid")}if(u==="object"||!u&&typeof c==="object"&&!Array.isArray(c)&&XV(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(Gr(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(!Gr(c,m))return a(`Missing ${m}`)}if(h.additionalProperties===!1)for(let m in c){if(!Gr(c,m))continue;if(h.properties&&Gr(h.properties,m))continue;return a(`Unexpected ${m}`)}if(h.properties){for(let m in h.properties)if(Gr(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(!Gr(c,x))continue;if(h.properties&&Gr(h.properties,x))continue;m.push(x)}let g=m.length,O=r||g<=xf?1:Math.floor(g/xf);for(let x=0;x<g;x+=O){let k=O>1&&x>g-1-O?g-1:x,w=m[k];o.push(w);let P=l(c[w],h.additionalProperties);if(o.pop(),!P)return!1;if(k===g-1)break}}return!0}if(u==="array"||!u&&Array.isArray(c)&&ZV(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<=xf?1:Math.floor(d/xf);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 FV=(e)=>e?.schema??e,WV=new Set(["title","description","default","examples","$counterexamples","$inferred","$schema","$id","$comment","deprecated","readOnly","writeOnly"]),qV=(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},LP=(e)=>e!==null&&typeof e==="object",HV=[["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"])],NP=[["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"]]],YV=[...NP.map(([e])=>e),"enum","$predicate"],zP=(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(!VV.has(n)&&!WV.has(n)&&!n.startsWith("x-"))i.push(`${t}.${n}`);for(let[n,r,o]of HV)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=YV.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 NP)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"&&!NV.has(e.format))i.push(`${t}.format:'${e.format}'`);if(typeof e.pattern==="string")try{jP(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(LP(e.const))i.push(`${t}.const (non-primitive; === comparison never matches)`);if(Array.isArray(e.enum)&&e.enum.some(LP))i.push(`${t}.enum (non-primitive member never matches)`);for(let[n,r]of qV(e))i.push(...zP(r,`${t}.${n}`));return i};function VP(e){let t=FV(e);if(t===!0||t===!1)return[];return zP(t)}var RP={maxDistinct:12,minCoverage:0.5},UV=["date","date-time","email","uri"],GV=(e)=>{if(e===null)return"null";if(typeof e==="number")return Number.isInteger(e)?"integer":"number";return typeof e},iy=(e)=>Array.from(new Set(e)).sort();function sy(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(eX(r,t,i));if(o.length)l.push(tX(o,t,i));if(a.length)l.push(KV(a,t));if(l.length===1)return JV(l[0],n);return{anyOf:n?[...l,{type:"null"}]:l}}function KV(e,t){let i=iy(e.map(GV)),s={};if(i.length===1)s.type=i[0];else if(i.length>1)s.type=i;let n=iX(e,i,t);if(n)s.enum=n;else sX(s,e,i,t);return s}function JV(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=iy([...i,"null"])}if(Array.isArray(e.enum)&&!e.enum.includes(null))e.enum=[...e.enum,null];return e}function eX(e,t,i){let s=iy(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]=sy(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 tX(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:sy(n,t,`${i}[]`)}}function iX(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?RP:{...RP,...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 sX(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 UV){let o=vf[r];if(n.every(o)){e.format=r;return}}}function XP(e,t={}){let i=sy([e],t,"");if(t.marker!==!1)i.$inferred=!0;return i}DP(!1);yd({validate:Qc,inferSchema:XP,unenforcedKeywords:VP});Object.assign(globalThis,{xinjs:Ma,xinjsui:JO});})();
275
+ `+s;else i.push(s)}return i},[]);this.innerHTML=t.map((i)=>i.startsWith("<")&&i.endsWith(">")?i:_e(i,this.options)).join("")}else this.innerHTML=_e(e,this.options);this.didRender()}}var Vz=cf,DO=cf.elementCreator(),Xz=DO,Zz=DO;var{div:NO,span:hf,button:zO}=L,Cc=86400000,Fz=[0,1,2,3,4,5,6],Wz=[1,2,3,4,5,6,7,8,9,10,11,12],VO=(e,t=2,i="0")=>String(e).padStart(t,i),Tc=(e,t,i)=>new Date(`${e}-${VO(t)}-${VO(i)}`);class XO 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:C.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:C.monthTodayBackground("transparent"),boxShadow:C.monthTodayShadow("none"),backdropFilter:C.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:C.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:C.monthDayColor("hotpink"),background:C.monthDayBackground("white"),fontWeight:C.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:C.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:C.monthDateCheckedColor("white"),background:C.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:C.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:C.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:C.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:C.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:C.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:Tc(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:Tc(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 Wz.map((e)=>({caption:Tc(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}-${VO(this.month)}-`),action:()=>{this.gotoDate(e)}});jumpMenu=()=>{ht({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=()=>[NO({part:"header"},zO({part:"previous",onClick:this.previousMonth},I.chevronLeft()),hf({style:{flex:"1"}}),zO({part:"jump",onClick:this.jumpMenu},I.calendar()),Fi({part:"month",options:this.months,onChange:this.setMonth}),Fi({part:"year",options:[this.year],onChange:this.setMonth}),hf({style:{flex:"1"}}),zO({part:"next",onClick:this.nextMonth},I.chevronRight())),NO({part:"week"}),NO({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=Tc(this.year,this.month,1),l=new Date(a.valueOf()-(7+a.getDay()-this.weekStart)%7*Cc),c=this.month===12?1:this.month+1,h=new Date(Tc(this.year+(this.month===12?1:0),c,1).valueOf()-Cc),u=new Date(h.valueOf()+(this.weekStart*2+5+this.endDay-h.getDay())%7*Cc),d=Fz.map((x)=>new Date(l.valueOf()+x*Cc).toString().split(" ")[0]);this.days=[];let f=new Date().toISOString().split("T")[0];for(let x=l.valueOf();x<=u.valueOf();x+=Cc){let k=new Date(x),w=k.toISOString().split("T")[0];this.days.push({date:k,selected:!1,inMonth:k.getMonth()+1===this.month,isToday:w===f,isWeekend:k.getDay()%6===0,inRange:!!(this.from&&w>=this.from&&w<=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)=>hf({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 w=x.date.toISOString().split("T")[0];if(this.checkDay(w))k.push("checked");if(k.push(x.isWeekend?"weekend":"weekday"),this.range){if(g===w)k.push("range-end");if(O===w)k.push("range-start")}let P=hf({class:k.join(" "),title:w,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},x.date.getDate());if(w===this.#e)m=P;return P})),m?.focus()}}var qz=XO.elementCreator();var dP=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("")},fP=async(e)=>{let t=await dP(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:ZO,tosiSlot:Hz}=L;class uf 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:C.meterHeight("24px"),background:C.indicatorBg("white"),borderRadius:C.meterRadius("4px"),boxShadow:C.meterShadow(`inset 0 0 0 2px ${b.indicatorColor}`)},':host [part="level"]':{height:C.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:b.indicatorColor,margin:C.levelMargin("2px"),borderRadius:C.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:b.descriptionColor,height:C.meterHeight("24px"),lineHeight:C.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 fP(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=()=>[Hz({onInput:this.update}),ZO({part:"meter"},ZO({part:"level"}),ZO({part:"description"}))];render(){super.render();let e=this.querySelector("input");this.updateIndicator(e?.value)}}var Yz=uf,pP=uf.elementCreator(),Uz=pP;var{span:FO}=L;class df 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=()=>FO({part:"container"},FO({part:"empty"}),FO({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(I[this.icon]()),i.append(I[this.icon]())}this.displayValue(this.value)}}var Gz=df,mP=df.elementCreator(),Kz=ni((...e)=>mP(...e),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:gP,div:Jz,button:eV}=L,tV=[{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 WO(e=tV){return Fi({title:"paragraph style",slot:"toolbar",class:"block-style",options:e.map(({caption:t,tagType:i})=>({caption:t,value:`formatBlock,${i}`}))})}var $c=()=>IO({slot:"toolbar"});function xs(e,t,i){return eV({slot:"toolbar",dataCommand:t,title:e},i)}var iV=()=>[xs("left-justify","justifyLeft",I.alignLeft()),xs("center","justifyCenter",I.alignCenter()),xs("right-justify","justifyRight",I.alignRight()),$c(),xs("bullet list","insertUnorderedList",I.listBullet()),xs("numbered list","insertOrderedList",I.listNumber()),$c(),xs("indent","indent",I.indent()),xs("indent","outdent",I.outdent())],OP=()=>[xs("bold","bold",I.fontBold()),xs("italic","italic",I.fontItalic()),xs("underline","underline",I.fontUnderline())],sV=()=>[WO(),$c(),...OP()],yP=()=>[WO(),$c(),...iV(),$c(),...OP()];class ff 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(qs.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=[gP({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),Jz({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),gP({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(...sV());break;case"default":e.append(...yP());break}}}var nV=ff,bP=ff.elementCreator(),rV=ni((...e)=>bP(...e),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:Pc}=Et({router:{path:"",hash:"",pattern:""}}),qO={};function oV(){return{...qO}}var pf=[],HO=!1,mf=new Set;function aV(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 lV(e){let t=e.split("?")[0].split("#")[0];for(let s of pf){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=pf.find((s)=>s.fallback);if(i)return{route:i,params:{}};return null}function Ec(){let e=HO?window.location.hash.replace(/^#\/?/,"").split("?")[0]:window.location.pathname;Pc.path.value=e,Pc.hash.value=window.location.hash;let t=lV(e);if(t){qO=t.params,Pc.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 mf){let n=s.name||"default",r=i.get(n);if(r)s.replaceChildren(r.component(t.params));else s.replaceChildren()}}else{qO={},Pc.pattern.value="";for(let i of mf)i.replaceChildren()}}var xP=!1;function vP(){if(xP)return;xP=!0,window.addEventListener("popstate",Ec),window.addEventListener("hashchange",Ec)}function cV(e,t={}){HO=t.hashRouting??!1,pf=e.map((i)=>{let{regex:s,paramNames:n}=aV(i.pattern);return{regex:s,paramNames:n,targets:i.targets,fallback:i.fallback??!1}}),vP(),Ec()}function hV(e){if(vP(),HO)window.location.hash="#/"+e.replace(/^\//,"");else window.history.pushState({},"","/"+e.replace(/^\//,""));Ec()}class YO extends R{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),mf.add(this),pf.length>0)Ec()}disconnectedCallback(){super.disconnectedCallback(),mf.delete(this)}}var uV=YO.elementCreator();var{div:dV,slot:fV,label:pV,span:mV,input:kP}=L;class aa 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=aa.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?I[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=()=>[fV(),dV({part:"options"},kP({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:C.segmentedOptionGap("8px"),alignItems:C.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:C.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:C.segmentedOptionGap("8px"),gridTemplateColumns:C.segmentedOptionGridColumns("0px 24px 1fr"),padding:C.segmentedOptionPadding("4px 12px"),font:C.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:C.segmentedFocusShadow(`inset 0 0 0 2px ${C.segmentedOptionCurrentBackground("#44a")}`),borderRadius:C.segmentedOptionsBorderRadius("8px")},":host label.current":{color:C.segmentedOptionCurrentColor("#eee"),background:C.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:C.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${C.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:C.segmentOptionIconSize("16px"),stroke:C.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:C.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:C.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:C.segmentedOptionsBorderRadius("8px"),background:C.segmentedOptionsBackground("#fff"),color:C.segmentedOptionColor("#222"),overflow:"hidden",alignItems:C.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:C.segmentedOptionPadding("4px 12px"),color:C.segmentedOptionCurrentColor("#eee"),background:C.segmentedOptionCurrentBackground("#44a"),font:C.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:C.segmentedOptionCurrentColor("#eee"),opacity:C.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=aa.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)=>pV({tabindex:0},kP({type:i,name:this.name,value:c.value,checked:o(c.value),tabIndex:-1}),c.icon||{class:"no-icon"},this.localized?ps(c.caption):mV(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 gV=aa,wP=aa.elementCreator(),OV=ni((...e)=>wP(...e),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:SP}=L;class UO extends R{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[SP({part:"normal"}),SP({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 yV=UO.elementCreator();class gf 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=I.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;Si(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 bV=gf,CP=gf.elementCreator(),xV=CP;var{div:vV,input:kV,span:wV,button:GO}=L,TP=(e)=>e.split(/(?<!\\),/).map((t)=>t.trim().replace(/\\,/g,",")),SV=(e)=>e.map((t)=>t.replace(/,/g,"\\,")).join(",");class Ac 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":C.brandColor("blue"),"--tag-text-color":C.brandTextColor("white"),display:"inline-flex",borderRadius:C.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:C.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:C.tagCloseButtonRadius("99px"),opacity:b.tagButtonOpacity},':host [part="remove"]:hover':{background:b.tagCloseButtonBg,opacity:b.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[wV({part:"caption"},this.caption),GO(I.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var CV=Ac,KO=Ac.elementCreator(),TV=ni((...e)=>KO(...e),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class la 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:C.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:C.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 TP(this.value).filter((e)=>e!=="")}set tags(e){this.value=SV(e)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(e){if(typeof e==="string")this._availableTags=la.parseAvailableTagsString(e);else this._availableTags=e;this.queueRender()}static parseAvailableTagsString(e){return TP(e).map((t)=>t===""?null:t)}connectedCallback(){super.connectedCallback();let e=this.getAttribute("available-tags");if(e&&this._availableTags.length===0)this._availableTags=la.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)}}});ht({target:t,width:"auto",menuItems:n})};content=()=>[GO({type:"button",style:{visibility:"hidden"},tabindex:-1}),vV({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),kV({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),GO({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},I.chevronDown())];removeTag=(e)=>{if(this.editable&&!this.disabled){let t=e.target.closest(Ac.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(KO({caption:s,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var $V=la,$P=la.elementCreator(),PV=ni((...e)=>$P(...e),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var PP="1.12.4";var{span:EV}=L,Mc=null,Of=null,yf=null,Js="tosi-tooltip",AV={[`.${Js}`]:{pointerEvents:"none",padding:C.tosiTooltipPadding("4px 10px"),borderRadius:C.tosiTooltipRadius("6px"),background:C.tosiTooltipBg("#333"),color:C.tosiTooltipColor("#fff"),fontSize:C.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:C.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${Js} p`]:{margin:"0"},[`.${Js} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${Js} a`]:{color:"inherit"},[`.${Js}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${Js}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Js}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Js}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${Js}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},EP=!1;function AP(){if(EP)return;EP=!0,ri("tosi-tooltip",AV)}function ca(){if(Of!==null)clearTimeout(Of),Of=null;if(Mc!==null)Mc.remove(),Mc=null;yf=null}function MV(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 QV(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 _V(e,t){if(t)e=de(e);let i=EV({class:Js});return i.innerHTML=_e.parseInline(e),i}function LV(e,t,i){AP(),ca(),yf=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=_V(t,i);h.classList.add(MV(c)),Mc=Kl({content:h,target:e,position:c,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(Mc&&yf)QV(h,e,c)})}function RV(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.tooltip)return t;return null}function IV(e={}){AP();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=RV(n);if(r===yf)return;if(ca(),!r)return;let o=r.dataset.tooltip||null;if(!o)return;Of=setTimeout(()=>LV(r,o,s),i)}),document.addEventListener("pointerleave",ca),document.addEventListener("pointerdown",ca),document.addEventListener("keydown",ca),window.addEventListener("scroll",ca,!0)}var IP="\\p{Extended_Pictographic}",jV=/^(\d{4})-(\d{2})-(\d{2})$/,BV=[31,28,31,30,31,30,31,31,30,31,30,31],MP=(e)=>{let t=jV.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:BV[s-1];return n<=r},DV=/^(\d{4}-\d{2}-\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})$/,vf={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:MP,"date-time":(e)=>{let t=DV.exec(e);if(!t||!MP(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)},NV=new Set(Object.keys(vf)),bf=new Map,jP=(e,t)=>{let i=t?"u":"",s=i+"\x00"+e,n=bf.get(s);if(n===void 0){if(n=new RegExp(e,i),bf.size>=500)bf.clear();bf.set(s,n)}return n},le=(e,t=!1)=>({schema:e,_type:null,_optional:t,validate:(i,s)=>Qc(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:`^${IP}+$`,format:"emoji"},t)},get int(){return le({...e,type:"integer"},t)},step:(i)=>le({...e,multipleOf:i},t)}),QP=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:`^${IP}+$`,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({})}},nJ=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}}),Gr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),BP=!0,ty=!1;function DP(e){if(BP=e,e)ty=!1}var zV=()=>{if(!BP||ty)return;ty=!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.")},_P=(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 xf=97,VV=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"]),XV=(e)=>e.properties!==void 0||e.required!==void 0||e.additionalProperties!==void 0||e.minProperties!==void 0||e.maxProperties!==void 0,ZV=(e)=>e.items!==void 0||e.minItems!==void 0||e.maxItems!==void 0;function Qc(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(Qc(c,f,{strict:r})){d=!0;break}if(!d)return a("Union mismatch")}if(Array.isArray(h.oneOf)){zV();let d=0;for(let f of h.oneOf)if(Qc(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(!_P(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,_P(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&&QP){if(!QP(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(!jP(h.pattern,h.format==="emoji").test(c))return a("Pattern mismatch")}catch{return a("Invalid pattern")}if(h.format&&vf[h.format]&&!vf[h.format](c))return a("Format invalid")}if(u==="object"||!u&&typeof c==="object"&&!Array.isArray(c)&&XV(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(Gr(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(!Gr(c,m))return a(`Missing ${m}`)}if(h.additionalProperties===!1)for(let m in c){if(!Gr(c,m))continue;if(h.properties&&Gr(h.properties,m))continue;return a(`Unexpected ${m}`)}if(h.properties){for(let m in h.properties)if(Gr(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(!Gr(c,x))continue;if(h.properties&&Gr(h.properties,x))continue;m.push(x)}let g=m.length,O=r||g<=xf?1:Math.floor(g/xf);for(let x=0;x<g;x+=O){let k=O>1&&x>g-1-O?g-1:x,w=m[k];o.push(w);let P=l(c[w],h.additionalProperties);if(o.pop(),!P)return!1;if(k===g-1)break}}return!0}if(u==="array"||!u&&Array.isArray(c)&&ZV(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<=xf?1:Math.floor(d/xf);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 FV=(e)=>e?.schema??e,WV=new Set(["title","description","default","examples","$counterexamples","$inferred","$schema","$id","$comment","deprecated","readOnly","writeOnly"]),qV=(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},LP=(e)=>e!==null&&typeof e==="object",HV=[["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"])],NP=[["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"]]],YV=[...NP.map(([e])=>e),"enum","$predicate"],zP=(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(!VV.has(n)&&!WV.has(n)&&!n.startsWith("x-"))i.push(`${t}.${n}`);for(let[n,r,o]of HV)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=YV.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 NP)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"&&!NV.has(e.format))i.push(`${t}.format:'${e.format}'`);if(typeof e.pattern==="string")try{jP(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(LP(e.const))i.push(`${t}.const (non-primitive; === comparison never matches)`);if(Array.isArray(e.enum)&&e.enum.some(LP))i.push(`${t}.enum (non-primitive member never matches)`);for(let[n,r]of qV(e))i.push(...zP(r,`${t}.${n}`));return i};function VP(e){let t=FV(e);if(t===!0||t===!1)return[];return zP(t)}var RP={maxDistinct:12,minCoverage:0.5},UV=["date","date-time","email","uri"],GV=(e)=>{if(e===null)return"null";if(typeof e==="number")return Number.isInteger(e)?"integer":"number";return typeof e},iy=(e)=>Array.from(new Set(e)).sort();function sy(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(eX(r,t,i));if(o.length)l.push(tX(o,t,i));if(a.length)l.push(KV(a,t));if(l.length===1)return JV(l[0],n);return{anyOf:n?[...l,{type:"null"}]:l}}function KV(e,t){let i=iy(e.map(GV)),s={};if(i.length===1)s.type=i[0];else if(i.length>1)s.type=i;let n=iX(e,i,t);if(n)s.enum=n;else sX(s,e,i,t);return s}function JV(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=iy([...i,"null"])}if(Array.isArray(e.enum)&&!e.enum.includes(null))e.enum=[...e.enum,null];return e}function eX(e,t,i){let s=iy(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]=sy(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 tX(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:sy(n,t,`${i}[]`)}}function iX(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?RP:{...RP,...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 sX(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 UV){let o=vf[r];if(n.every(o)){e.format=r;return}}}function XP(e,t={}){let i=sy([e],t,"");if(t.marker!==!1)i.$inferred=!0;return i}DP(!1);yd({validate:Qc,inferSchema:XP,unenforcedKeywords:VP});Object.assign(globalThis,{xinjs:Ma,xinjsui:JO});})();
276
276
 
277
- //# debugId=145BA687B949701064756E2164756E21
277
+ //# debugId=8600D8A53AEF089464756E2164756E21
278
278
  //# sourceMappingURL=iife.js.map