tosijs-ui 1.6.5 → 1.6.6

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.
@@ -4,4 +4,5 @@ declare global {
4
4
  }
5
5
  export declare function devServer(config: SiteConfig, opts?: {
6
6
  test?: boolean;
7
+ build?: () => unknown | Promise<unknown>;
7
8
  }): Promise<void>;
@@ -98,9 +98,15 @@ export async function devServer(config, opts = {}) {
98
98
  }
99
99
  }
100
100
  if (!testMode) {
101
- // Rebuild on any source change. buildSite() already re-extracts docs and
102
- // regenerates icon-data, so a single rebuild covers everything. Serialize
103
- // builds (no overlap) and coalesce bursts.
101
+ // Rebuild on any source change. By default that's just buildSite(), but a
102
+ // consumer whose full build has steps BEYOND buildSite — e.g. a custom IIFE
103
+ // bundle built separately (because it needs a Bun plugin buildSite can't
104
+ // take) — MUST pass opts.build with their whole pipeline. buildSite() starts
105
+ // with `rm -rf <outputDir>`, so any artifact those extra steps produced
106
+ // (iife.js, etc.) is deleted on the first rebuild and, without opts.build,
107
+ // never regenerated — leaving the page's /iife.js to 404 into the SPA
108
+ // fallback (it "loads as html"). Serialize builds and coalesce bursts.
109
+ const runBuild = opts.build ?? (() => buildSite(config));
104
110
  let building = false;
105
111
  let pending = false;
106
112
  const rebuild = async () => {
@@ -110,7 +116,7 @@ export async function devServer(config, opts = {}) {
110
116
  }
111
117
  building = true;
112
118
  try {
113
- await buildSite(config);
119
+ await runBuild();
114
120
  }
115
121
  catch (error) {
116
122
  console.error('rebuild failed:', error);
package/dist/iife.js CHANGED
@@ -97,7 +97,7 @@ ${y.join(`
97
97
  `)||"(idle)"}`}).join(`
98
98
  `)}var{slot:P3}=z;class _3 extends j{static preferredTagName="tosi-row";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[P3()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"row",gap:p.tosiRowGap("0"),alignItems:p.tosiRowAlign("stretch"),justifyContent:p.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 Ky=_3.elementCreator();class V3 extends j{static preferredTagName="tosi-column";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[P3()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"column",gap:p.tosiColumnGap("0"),alignItems:p.tosiColumnAlign("stretch"),justifyContent:p.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 Wy=V3.elementCreator();class U3 extends j{static preferredTagName="tosi-grid";static initAttributes={columns:"",rows:"",gap:""};content=[P3()];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:p.tosiGridColumns("1fr"),gridTemplateRows:p.tosiGridRows("auto"),gap:p.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 Qy=U3.elementCreator(),{span:G6}=z,Yy=(...i)=>G6({style:{flex:"1 1 var(--tosi-space, 0.5em)"}},...i),O3=(...i)=>G6({style:{flex:"0 0 var(--tosi-space, 0.5em)"}},...i);var Q1={accent:q.fromCss("#EE257B"),background:q.fromCss("#fafafa"),text:q.fromCss("#222222")},F6={_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 K6(i){let{accent:l,background:h,text:y}=i,x=i.accentText??l.contrasting(),C=i.backgroundInset??h.darken(0.03),o=i.border??y.opacity(0.15),s=i.shadow??y.opacity(0.1),g=i.focus??l.opacity(0.5);return{_tosiAccent:l,_tosiAccentLight:l.brighten(0.15),_tosiAccentDark:l.darken(0.15),_tosiAccentText:x,_tosiBg:h,_tosiBgInset:C,_tosiBgHover:h.darken(0.05),_tosiBgActive:h.darken(0.1),_tosiText:y,_tosiTextMuted:y.opacity(0.6),_tosiTextDisabled:y.opacity(0.4),_tosiBorder:o,_tosiBorderFocus:l,_tosiShadow:s,_tosiShadowColor:s,_tosiFocusRing:`0 0 0 2px ${g}`,_tosiInputBg:h,_tosiInputBorder:o,_tosiInputBorderFocus:l,_tosiButtonBg:h,_tosiButtonText:y,_tosiButtonBorder:o,_tosiButtonHoverBg:h.darken(0.05),_tosiButtonActiveBg:l,_tosiButtonActiveText:x}}function G2(i){return{":root":{...F6,...K6(i)}}}function P4(i){let h=G2(i)[":root"];return{":root":T2(h)}}function G3(i,l="tosi-theme"){z1(l,i)}var Ny=G2(Q1),Xy=P4(Q1),W6={"--xin-icon-size":w.tosiIconSize,"--xin-icon-fill":w.tosiIconFill,"--xin-icon-stroke":w.tosiIconStroke,"--xin-tabs-bar-color":w.tosiTabsBarColor,"--xin-tabs-bar-height":w.tosiTabsBarHeight,"--xin-tabs-selected-color":w.tosiTabsSelectedColor,"--spacing":w.tosiSpacing,"--gap":w.tosiSpacingSm,"--touch-size":w.tosiTouchSize,"--background":w.tosiBg,"--text-color":w.tosiText,"--brand-color":w.tosiAccent,"--brand-text-color":w.tosiAccentText};function $y(i){return{":root":{...G2(i)[":root"],...W6}}}function by(i,l){let h={};for(let[y,x]of Object.entries(l)){let C=`--tosi-${i}-${y.replace(/([A-Z])/g,"-$1").toLowerCase()}`;h[y]=`var(${C}, ${x})`}return h}var{div:F2,label:_4,input:V4,span:Ry,button:Q6}=z,{liveTheme:R}=L({liveTheme:{accent:String(Q1.accent),background:String(Q1.background),text:String(Q1.text),dark:!1}}),U4=!1;function n0(){if(!U4)return;let i={accent:q.fromCss(R.accent.value),background:q.fromCss(R.background.value),text:q.fromCss(R.text.value)},l=R.dark.value?P4(i):G2(i);G3(l,"tosi-live-theme")}function Y6(){if(U4)return;U4=!0,R.accent.observe(n0),R.background.observe(n0),R.text.observe(n0),R.dark.observe(n0),n0()}function Zy(){U4=!1}class F3 extends j{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=()=>[F2({class:"field"},_4("Accent"),V4({type:"color",part:"accent"})),F2({class:"field"},_4("Background"),V4({type:"color",part:"background"})),F2({class:"field"},_4("Text"),V4({type:"color",part:"text"})),F2({class:"field"},_4("Dark mode"),V4({type:"checkbox",part:"dark"})),F2({class:"preview",part:"preview",style:{background:"var(--tosi-bg, #fafafa)",color:"var(--tosi-text, #222)"}},Ry("Preview "),Q6({class:"preview-button",style:{background:"var(--tosi-accent, #EE257B)",color:"var(--tosi-accent-text, white)"}},"Button")),F2({class:"actions"},Q6({part:"reset"},"Reset"))];connectedCallback(){super.connectedCallback(),Y6();let i=()=>{this.parts.accent.value=R.accent.value,this.parts.background.value=R.background.value,this.parts.text.value=R.text.value,this.parts.dark.checked=R.dark.value};i(),R.accent.observe(i),R.background.observe(i),R.text.observe(i),R.dark.observe(i),this.parts.accent.addEventListener("input",()=>{R.accent.value=this.parts.accent.value}),this.parts.background.addEventListener("input",()=>{R.background.value=this.parts.background.value}),this.parts.text.addEventListener("input",()=>{R.text.value=this.parts.text.value}),this.parts.dark.addEventListener("change",()=>{R.dark.value=this.parts.dark.checked}),this.parts.reset.addEventListener("click",()=>{R.accent.value=String(Q1.accent),R.background.value=String(Q1.background),R.text.value=String(Q1.text),R.dark.value=!1})}}var Hy=F3.elementCreator();var{div:Jy}=z;class w2 extends j{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(i){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=Jy({style:{width:"100%",height:"100%"}});get map(){return this._map}static mapboxCSSAvailable;static mapboxAvailable;_map;static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"400px",height:"400px",textAlign:"left"}};constructor(){super();if(w2.mapboxCSSAvailable===void 0)w2.mapboxCSSAvailable=S0("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((i)=>{console.error("failed to load mapbox-gl.css",i)}),w2.mapboxAvailable=d1("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((i)=>{console.error("failed to load mapbox-gl.js",i)})}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[x,C,o]=this.coords.split(",").map((s)=>Number(s));this._map.setCenter([C,x]),this._map.setZoom(o),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}let{div:i}=this.parts,[l,h,y]=this.coords.split(",").map((x)=>Number(x));this._lastCoords=this.coords,this._lastStyle=this.mapStyle,w2.mapboxAvailable.then(({mapboxgl:x})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;"),x.accessToken=this.token,this._map=new x.Map({container:i,style:this.mapStyle,zoom:y,center:[h,l]}),this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let C=this._map.getCenter(),o=this._map.getZoom(),s=`${C.lat.toFixed(6)},${C.lng.toFixed(6)},${o.toFixed(1)}`;if(s!==this.value){if(this.internals)this.internals.setFormValue(s)}})})}}var Sy=w2.elementCreator();function N6(i,l){if(l==null)l="";else if(typeof l!=="string")l=String(l);return l.replace(/\{\{([^}]+)\}\}/g,(h,y)=>{let x=u[`${i}${y.startsWith("[")?y:"."+y}`];return x===void 0?h:N6(i,String(x))})}class O4 extends j{static preferredTagName="tosi-md";static initAttributes={src:"",elements:!1};context={};value="";content=null;options={};connectedCallback(){if(super.connectedCallback(),this.src!=="")(async()=>{let i=await fetch(this.src);this.value=await i.text()})();else if(this.value==="")if(this.elements)this.value=this.innerHTML;else this.value=this.textContent!=null?this.textContent:""}didRender=()=>{};render(){super.render(),u[this.instanceId]=typeof this.context==="string"?JSON.parse(this.context):this.context;let i=N6(this.instanceId,this.value);if(this.elements){let l=i.split(`
99
99
  `).reduce((h,y)=>{if(y.startsWith("<")||h.length===0)h.push(y);else{let x=h[h.length-1];if(!x.startsWith("<")||!x.endsWith(">"))h[h.length-1]+=`
100
- `+y;else h.push(y)}return h},[]);this.innerHTML=l.map((h)=>h.startsWith("<")&&h.endsWith(">")?h:O(h,this.options)).join("")}else this.innerHTML=O(i,this.options);this.didRender()}}var Dy=O4,K3=O4.elementCreator(),ay=K3,Iy=K3;var{div:W3,span:G4,button:Q3}=z,z0=86400000,Ty=[0,1,2,3,4,5,6],My=[1,2,3,4,5,6,7,8,9,10,11,12],Y3=(i,l=2,h="0")=>String(i).padStart(l,h),j0=(i,l,h)=>new Date(`${i}-${Y3(l)}-${Y3(h)}`);class N3 extends j{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:p.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:p.monthTodayBackground("transparent"),boxShadow:p.monthTodayShadow("none"),backdropFilter:p.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:p.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:p.monthDayColor("hotpink"),background:p.monthDayBackground("white"),fontWeight:p.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:p.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:p.monthDateCheckedColor("white"),background:p.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:p.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:p.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:p.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:p.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:p.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:j0(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:j0(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(i){this.disabled=i}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return My.map((i)=>({caption:j0(2025,i,1).toString().split(" ")[1],value:String(i)}))}get years(){let i=Number(this.minDate.split("-")[0]),l=Number(this.maxDate.split("-")[0]),h=[];for(let y=i;y<=l;y++)h.push(String(y));return h}monthChanged=(i,l)=>{};gotoMonth(i,l){if(this.month!==l||this.year!==i)this.month=l,this.year=i,this.monthChanged(i,l)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(i){this.selectedDays[1]=i,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(i){this.selectedDays[0]=i,this.selectedDays.splice(2)}clickDate=(i)=>{let l=i.target.getAttribute("title");this.selectDate(l)};keyDate=(i)=>{let l=!1;switch(i.code){case"Space":{let h=i.target.getAttribute("title");this.selectDate(h),l=!0;break}case"Tab":break;default:console.log(i)}if(l)i.preventDefault(),i.stopPropagation()};#i="";selectDate=(i)=>{if(this.#i=i,this.range){if(!this.to)this.selectedDays=[i,i];else if(this.from===i&&this.to===i)this.selectedDays=[];else if(this.from===i)this.from=this.to;else if(this.to===i)this.to=this.from;else if(i<this.from)this.from=i;else if(i>this.to)this.to=i;else this.to=i;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(i))this.selectedDays.splice(this.selectedDays.indexOf(i),1);else this.selectedDays.push(i),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(i))this.value="",this.selectedDays=[];else this.value=i,this.selectedDays=[i]};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=(i)=>{if(!this.range)return this.selectedDays.includes(i);else if(this.range)return this.from&&i>=this.from&&i<=this.to;return!1};dateMenuItem=(i,l="")=>{return i=i.split("T")[0],{caption:l||i,enabled:()=>!i.startsWith(`${this.year}-${Y3(this.month)}-`),action:()=>{this.gotoDate(i)}}};jumpMenu=()=>{a({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((i)=>this.dateMenuItem(i))]})};content=()=>[W3({part:"header"},Q3({part:"previous",onClick:this.previousMonth},n.chevronLeft()),G4({style:{flex:"1"}}),Q3({part:"jump",onClick:this.jumpMenu},n.calendar()),B1({part:"month",options:this.months,onChange:this.setMonth}),B1({part:"year",options:[this.year],onChange:this.setMonth}),G4({style:{flex:"1"}}),Q3({part:"next",onClick:this.nextMonth},n.chevronRight())),W3({part:"week"}),W3({part:"days"})];gotoDate(i){let l=new Date(i);this.gotoMonth(l.getFullYear(),l.getMonth()+1)}connectedCallback(){super.connectedCallback();let i=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=i.getMonth()+1;if(isNaN(this.year))this.year=i.getFullYear()}days=[];render(){super.render();let{week:i,days:l,jump:h,month:y,year:x,previous:C,next:o}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let s=j0(this.year,this.month,1),g=new Date(s.valueOf()-(7+s.getDay()-this.weekStart)%7*z0),k=this.month===12?1:this.month+1,r=new Date(j0(this.year+(this.month===12?1:0),k,1).valueOf()-z0),c=new Date(r.valueOf()+(this.weekStart*2+5+this.endDay-r.getDay())%7*z0),d=Ty.map((P)=>new Date(g.valueOf()+P*z0).toString().split(" ")[0]);this.days=[];let v=new Date().toISOString().split("T")[0];for(let P=g.valueOf();P<=c.valueOf();P+=z0){let V=new Date(P),W=V.toISOString().split("T")[0];this.days.push({date:V,selected:!1,inMonth:V.getMonth()+1===this.month,isToday:W===v,isWeekend:V.getDay()%6===0,inRange:!!(this.from&&W>=this.from&&W<=this.to)})}y.value=String(this.month),x.value=String(this.year),y.disabled=x.disabled=h.disabled=C.disabled=o.disabled=this.disabled||this.readonly,x.options=this.years,i.textContent="",i.append(...d.map((P)=>G4({class:"day"},P))),l.textContent="";let B=null,{to:t,from:_}=this;l.append(...this.days.map((P)=>{let V=["date"];if(P.inMonth)V.push("in-month");if(P.isToday)V.push("today");let W=P.date.toISOString().split("T")[0];if(this.checkDay(W))V.push("checked");if(V.push(P.isWeekend?"weekend":"weekday"),this.range){if(t===W)V.push("range-end");if(_===W)V.push("range-start")}let Z=G4({class:V.join(" "),title:W,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},P.date.getDate());if(W===this.#i)B=Z;return Z})),B?.focus()}}var uy=N3.elementCreator();var{div:X3,button:Ly}=z,my={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class L1 extends j{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${w.notificationSpacing} ${w.notificationSpacing50} ${w.notificationSpacing} ${w.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:w.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:w.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:w.notificationSpacing,width:w.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:w.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:w.notificationTextColor},":host .note":{display:"grid",background:w.notificationBg,padding:w.notificationPadding,gridTemplateColumns:`${w.notificationIconSize} 1fr ${w.notificationButtonSize}`,gap:w.notificationSpacing,alignItems:"center",borderRadius:w.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${w.notificationAccentColor}`,borderColor:w.notificationAccentColor,borderWidth:w.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:w.notificationButtonSize,padding:0,margin:0,height:w.notificationButtonSize,width:w.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:w.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:w.notificationBg,background:w.notificationAccentColor,padding:w.spacing50},":host .note svg":{height:w.notificationIconSize,width:w.notificationIconSize,pointerEvents:"none",color:w.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:w.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(i){i.classList.add("closing"),i.style.marginBottom=-i.offsetHeight+"px";let l=()=>{i.remove()};i.addEventListener("transitionend",l),setTimeout(l,1000)}static post(i){let{message:l,duration:h,type:y,close:x,progress:C,icon:o,color:s}=Object.assign({type:"info",duration:-1},typeof i==="string"?{message:i}:i);if(!this.singleton)this.singleton=$3();let g=this.singleton;document.body.append(g),g.style.zIndex=String(y2()+1);let k=s||my[y],r=C||y==="progress"?z.progress():{},c=()=>{if(x)x();L1.removeNote(B)},d=o instanceof SVGElement?o:o?n[o]():n.info(),v=y==="error"||y==="warn",B=X3({class:`note ${y}`,role:v?"alert":"status",ariaLive:v?"assertive":"polite",style:{_notificationAccentColor:k}},d,X3({class:"message"},X3(l),r),Ly({class:"close",title:"close",ariaLabel:"Close notification",apply(t){t.addEventListener("click",c)}},n.x()));if(g.shadowRoot.append(B),r instanceof HTMLProgressElement&&C instanceof Function){r.setAttribute("max",String(100)),r.value=C();let t=setInterval(()=>{if(!g.shadowRoot.contains(B)){clearInterval(t);return}let _=C();if(r.value=_,_>=100)L1.removeNote(B)},1000)}if(h>0)setTimeout(()=>{L1.removeNote(B)},h*1000);return B.scrollIntoView(),c}content=null}var ey=L1,$3=L1.elementCreator(),Ey=$3;function ix(i){return L1.post(i)}var X6=async(i,l="SHA-1")=>{let y=new TextEncoder().encode(i),x=await crypto.subtle.digest(l,y);return Array.from(new Uint8Array(x)).map((s)=>s.toString(16).padStart(2,"0")).join("")},$6=async(i)=>{let l=await X6(i),h=await fetch(`https://weakpass.com/api/v1/search/${l}`);if(h.ok){let y=await h.json();console.log("password found in weakpass database",y)}return h.status!==404},{span:b3,tosiSlot:lx}=z;class F4 extends j{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:w.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:p.meterHeight("24px"),background:p.indicatorBg("white"),borderRadius:p.meterRadius("4px"),boxShadow:p.meterShadow(`inset 0 0 0 2px ${w.indicatorColor}`)},':host [part="level"]':{height:p.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:w.indicatorColor,margin:p.levelMargin("2px"),borderRadius:p.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:w.descriptionColor,height:p.meterHeight("24px"),lineHeight:p.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(i){return this.issues={tooShort:i.length<this.minLength,short:i.length<this.goodLength,noUpper:!i.match(/[A-Z]/),noLower:!i.match(/[a-z]/),noNumber:!i.match(/[0-9]/),noSpecial:!i.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((l)=>!l).length-1}async isBreached(){let i=this.querySelector("input")?.value;if(!i||typeof i!=="string")return!0;return await $6(i)}updateIndicator=(i)=>{let{level:l,description:h}=this.parts,y=this.indicatorColors.split(","),x=this.descriptionColors.split(","),C=this.strength(i);if(this.value!==C)this.value=C,this.dispatchEvent(new Event("change"));l.style.width=`${(C+1)*16.67}%`,this.style.setProperty("--indicator-color",y[C]),this.style.setProperty("--description-color",x[C]),h.textContent=this.strengthDescriptions[C]};update=(i)=>{let l=i.target.closest("input");this.updateIndicator(l?.value||"")};content=()=>[lx({onInput:this.update}),b3({part:"meter"},b3({part:"level"}),b3({part:"description"}))];render(){super.render();let i=this.querySelector("input");this.updateIndicator(i?.value)}}var hx=F4,b6=F4.elementCreator(),yx=b6;var{span:R3}=z;class K4 extends j{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(i){this.readonly=i}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=()=>R3({part:"container"},R3({part:"empty"}),R3({part:"filled"}));displayValue(i){let{empty:l,filled:h}=this.parts,x=Math.round((typeof i==="string"?0:i||0)/this.step)*this.step;h.style.width=x/this.max*l.offsetWidth+"px"}update=(i)=>{if(this.readonly)return;let{empty:l}=this.parts,h=i instanceof MouseEvent?i.pageX-l.getBoundingClientRect().x:0,y=Math.min(Math.max(this.min,Math.round(h/l.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(i.type==="click")this.value=y;else if(i.type==="mousemove")this.displayValue(y);else this.displayValue(this.value||0)};handleKey=(i)=>{let l=this.value===""?NaN:Number(this.value);if(isNaN(l))l=Math.round((this.min+this.max)*0.5*this.step)*this.step;let h=!1;switch(i.key){case"ArrowUp":case"ArrowRight":l+=this.step,h=!0;break;case"ArrowDown":case"ArrowLeft":l-=this.step,h=!0;break}if(this.value=Math.max(Math.min(l,this.max),this.min),h)i.stopPropagation(),i.preventDefault()};connectedCallback(){super.connectedCallback();let{container:i}=this.parts;i.tabIndex=0,i.addEventListener("mousemove",this.update,!0),i.addEventListener("mouseleave",this.update),i.addEventListener("blur",this.update),i.addEventListener("click",this.update),i.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let i=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",i),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:l,filled:h}=this.parts;if(l.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),l.style.setProperty("--tosi-icon-stroke",this.emptyStroke),h.style.setProperty("--tosi-icon-fill",this.ratingFill),h.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let y=0;y<this.max;y++)l.append(n[this.icon]()),h.append(n[this.icon]())}this.displayValue(this.value)}}var xx=K4,R6=K4.elementCreator(),Cx=o1((...i)=>R6(...i),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:Z6,div:ox,button:sx}=z,gx=[{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 Z3(i=gx){return B1({title:"paragraph style",slot:"toolbar",class:"block-style",options:i.map(({caption:l,tagType:h})=>({caption:l,value:`formatBlock,${h}`}))})}var t0=()=>O3({slot:"toolbar"});function P1(i,l,h){return sx({slot:"toolbar",dataCommand:l,title:i},h)}var kx=()=>[P1("left-justify","justifyLeft",n.alignLeft()),P1("center","justifyCenter",n.alignCenter()),P1("right-justify","justifyRight",n.alignRight()),t0(),P1("bullet list","insertUnorderedList",n.listBullet()),P1("numbered list","insertOrderedList",n.listNumber()),t0(),P1("indent","indent",n.indent()),P1("indent","outdent",n.outdent())],H6=()=>[P1("bold","bold",n.fontBold()),P1("italic","italic",n.fontItalic()),P1("underline","underline",n.fontUnderline())],wx=()=>[Z3(),t0(),...H6()],J6=()=>[Z3(),t0(),...kx(),t0(),...H6()];class W4 extends j{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(i){if(this.isInitialized)this.parts.doc.contentEditable=i?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(i){let l=this._value;if(this._value=i,this.isInitialized){if(this.parts.doc.innerHTML!==i)this.parts.doc.innerHTML=i}if(l!==i&&this.internals)this.internals.setFormValue(i)}blockElement(i){let{doc:l}=this.parts;while(i.parentElement!==null&&i.parentElement!==l)i=i.parentElement;return i.parentElement===l?i:void 0}get selectedBlocks(){let{doc:i}=this.parts,l=window.getSelection();if(l===null)return[];let h=[];for(let y=0;y<l.rangeCount;y++){let x=l.getRangeAt(y);if(!i.contains(x.commonAncestorContainer))continue;let C=this.blockElement(x.startContainer),o=this.blockElement(x.endContainer);h.push(C);while(C!==o&&C!==null)C=C.nextElementSibling,h.push(C)}return h}get selectedText(){let i=window.getSelection();if(i===null)return"";return this.selectedBlocks.length?i.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(i)=>{if(this._updatingBlockStyle)return;let h=i.target?.closest(G1.tagName);if(h==null)return;this.doCommand(h.value)};handleButtonClick=(i)=>{let h=i.target?.closest("button");if(h==null)return;this.doCommand(h.dataset.command)};content=[Z6({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),ox({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),Z6({part:"content"})];doCommand(i){if(i===void 0)return;let l=i.split(",");console.log("execCommand",l[0],!1,...l.slice(1)),document.execCommand(l[0],!1,...l.slice(1))}updateBlockStyle(){let i=this.parts.toolbar.querySelector(".block-style");if(i===null)return;let l=this.selectedBlocks.map((h)=>h.tagName);l=[...new Set(l)],this._updatingBlockStyle=!0,i.value=l.length===1?`formatBlock,${l[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:i,content:l}=this.parts;if(l.innerHTML!==""&&i.innerHTML==="")i.innerHTML=l.innerHTML,l.innerHTML="";this.isInitialized=!0,l.style.display="none",i.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(h)=>{this.updateBlockStyle(),this.selectionChange(h,this)})}render(){let{toolbar:i}=this.parts;if(super.render(),i.children.length===0)switch(this.widgets){case"minimal":i.append(...wx());break;case"default":i.append(...J6());break}}}var rx=W4,S6=W4.elementCreator(),px=o1((...i)=>S6(...i),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:v0}=L({router:{path:"",hash:"",pattern:""}}),H3={};function cx(){return{...H3}}var Q4=[],J3=!1,Y4=new Set;function dx(i){let l=[];if(i==="")return{regex:/^\/?$/,paramNames:l};let h=i.split("/").map((x)=>{if(x.startsWith(":"))return l.push(x.slice(1)),"([^/]+)";return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+h.join("/")+"/?$"),paramNames:l}}function Bx(i){let l=i.split("?")[0].split("#")[0];for(let y of Q4){if(y.fallback)continue;let x=l.match(y.regex);if(x){let C={};return y.paramNames.forEach((o,s)=>{C[o]=decodeURIComponent(x[s+1])}),{route:y,params:C}}}let h=Q4.find((y)=>y.fallback);if(h)return{route:h,params:{}};return null}function A0(){let i=J3?window.location.hash.replace(/^#\/?/,""):window.location.pathname;v0.path.value=i,v0.hash.value=window.location.hash;let l=Bx(i);if(l){H3=l.params,v0.pattern.value=l.route.regex.source;let h=new Map;for(let y of l.route.targets)h.set(y.view??"default",y);for(let y of Y4){let x=y.name||"default",C=h.get(x);if(C)y.replaceChildren(C.component(l.params));else y.replaceChildren()}}else{H3={},v0.pattern.value="";for(let h of Y4)h.replaceChildren()}}var D6=!1;function a6(){if(D6)return;D6=!0,window.addEventListener("popstate",A0),window.addEventListener("hashchange",A0)}function fx(i,l={}){J3=l.hashRouting??!1,Q4=i.map((h)=>{let{regex:y,paramNames:x}=dx(h.pattern);return{regex:y,paramNames:x,targets:h.targets,fallback:h.fallback??!1}}),a6(),A0()}function nx(i){if(a6(),J3)window.location.hash="#/"+i.replace(/^\//,"");else window.history.pushState({},"","/"+i.replace(/^\//,""));A0()}class S3 extends j{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),Y4.add(this),Q4.length>0)A0()}disconnectedCallback(){super.disconnectedCallback(),Y4.delete(this)}}var zx=S3.elementCreator();var{div:jx,slot:tx,label:vx,span:Ax,input:I6}=z;class K2 extends j{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(i){if(typeof i==="string")this._choices=K2.parseChoicesString(i);else this._choices=i;this.queueRender()}static parseChoicesString(i){return i.split(",").filter((l)=>l.trim()!=="").map((l)=>{let[h,y]=l.split("=").map((s)=>s.trim()),[x,C]=(y||h).split(":").map((s)=>s.trim()),o=C?n[C]():"";return{value:h,icon:o,caption:x}})}value="";formDisabledCallback(i){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((i)=>i.trim()).filter((i)=>i!=="")}content=()=>[tx(),jx({part:"options"},I6({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:p.segmentedOptionGap("8px"),alignItems:p.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:p.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:p.segmentedOptionGap("8px"),gridTemplateColumns:p.segmentedOptionGridColumns("0px 24px 1fr"),padding:p.segmentedOptionPadding("4px 12px"),font:p.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:p.segmentedFocusShadow(`inset 0 0 0 2px ${p.segmentedOptionCurrentBackground("#44a")}`),borderRadius:p.segmentedOptionsBorderRadius("8px")},":host label.current":{color:p.segmentedOptionCurrentColor("#eee"),background:p.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:p.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${p.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:p.segmentOptionIconSize("16px"),stroke:p.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:p.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:p.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:p.segmentedOptionsBorderRadius("8px"),background:p.segmentedOptionsBackground("#fff"),color:p.segmentedOptionColor("#222"),overflow:"hidden",alignItems:p.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:p.segmentedOptionPadding("4px 12px"),color:p.segmentedOptionCurrentColor("#eee"),background:p.segmentedOptionCurrentBackground("#44a"),font:p.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:p.segmentedOptionCurrentColor("#eee"),opacity:p.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:i}=this.parts;i.querySelectorAll("label").forEach((l)=>{let h=l.querySelector("input");l.classList.toggle("current",Boolean(h&&h.checked))})}valueChanged=!1;handleChange=()=>{let{options:i,custom:l}=this.parts;if(this.multiple){let h=[...i.querySelectorAll("input:checked")];this.value=h.map((y)=>y.value).join(",")}else{let h=i.querySelector("input:checked");if(!h)this.value="";else if(h.value)l.setAttribute("hidden",""),this.value=h.value;else l.removeAttribute("hidden"),l.focus(),l.select(),this.value=l.value}this.syncCurrent(),this.valueChanged=!0};handleKey=(i)=>{let l=!1;switch(i.code){case"Space":if(i.target instanceof HTMLLabelElement)i.target.click(),l=!0;break;case"Tab":if(!(i.target instanceof HTMLLabelElement))i.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let h=i.target.closest("label");if(h.previousElementSibling instanceof HTMLLabelElement)h.previousElementSibling.focus()}l=!0;break;case"ArrowRight":case"ArrowDown":{let h=i.target.closest("label");if(h.nextElementSibling instanceof HTMLLabelElement)h.nextElementSibling.focus()}l=!0;break}if(l)i.preventDefault(),i.stopPropagation()};connectedCallback(){super.connectedCallback();let i=this.getAttribute("choices");if(i&&this._choices.length===0)this._choices=K2.parseChoicesString(i);let{options:l}=this.parts;if(this.name==="")this.name=this.instanceId;if(l.addEventListener("change",this.handleChange),l.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 i=[...this.choices];if(this.other&&!this.multiple){let[l,h]=this.other.split(":");i.push({value:"",caption:l,icon:h})}return i}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((i)=>i.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:i,custom:l}=this.parts;i.textContent="";let h=this.multiple?"checkbox":"radio",{values:y,isOtherValue:x}=this;if(i.append(...this._choicesWithOther.map((C)=>{return vx({tabindex:0},I6({type:h,name:this.name,value:C.value,checked:y.includes(C.value)||C.value===""&&x,tabIndex:-1}),C.icon||{class:"no-icon"},this.localized?j1(C.caption):Ax(C.caption))})),this.other&&!this.multiple)l.hidden=!x,l.value=x?this.value:"",l.placeholder=this.placeholder,i.append(l);this.syncCurrent()}}var qx=K2,T6=K2.elementCreator(),Px=o1((...i)=>T6(...i),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:M6}=z;class D3 extends j{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[M6({part:"normal"}),M6({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:i,small:l}=this.parts,h=this.offsetParent;if(!(h instanceof HTMLElement))return;else if(h.offsetWidth<this.minWidth||h.offsetHeight<this.minHeight)i.hidden=!0,l.hidden=!1,this.value="small";else i.hidden=!1,l.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var _x=D3.elementCreator();class N4 extends j{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:w.resizeIconFill}};content=n.resize();get minSize(){let{minWidth:i,minHeight:l}=getComputedStyle(this.target);return{width:parseFloat(i)||32,height:parseFloat(l)||32}}resizeTarget=(i)=>{let{target:l}=this;if(!l)return;let{offsetWidth:h,offsetHeight:y}=l;l.style.left=l.offsetLeft+"px",l.style.top=l.offsetTop+"px",l.style.bottom="",l.style.right="";let{minSize:x}=this;r1(i,(C,o,s)=>{if(l.style.width=Math.max(x.width,h+C)+"px",l.style.height=Math.max(x.height,y+o)+"px",s.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let i={passive:!0};this.addEventListener("mousedown",this.resizeTarget,i),this.addEventListener("touchstart",this.resizeTarget,i)}}var Vx=N4,u6=N4.elementCreator(),Ux=u6;var{div:Ox,input:Gx,span:Fx,button:a3}=z,L6=(i)=>i.split(/(?<!\\),/).map((l)=>l.trim().replace(/\\,/g,",")),Kx=(i)=>i.map((l)=>l.replace(/,/g,"\\,")).join(",");class q0 extends j{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":p.brandColor("blue"),"--tag-text-color":p.brandTextColor("white"),display:"inline-flex",borderRadius:p.tagRoundedRadius(w.spacing50),color:w.tagTextColor,background:w.tagBg,padding:`0 ${w.spacing75} 0 ${w.spacing75}`,height:`calc(${w.lineHeight} + ${w.spacing50})`,lineHeight:`calc(${w.lineHeight} + ${w.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:p.fontSize("16px"),color:w.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${w.spacing_50} 0 ${w.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:w.spacing150,width:w.spacing150,color:w.tagCloseButtonColor,background:w.tagCloseButtonBg,borderRadius:p.tagCloseButtonRadius("99px"),opacity:w.tagButtonOpacity},':host [part="remove"]:hover':{background:w.tagCloseButtonBg,opacity:w.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[Fx({part:"caption"},this.caption),a3(n.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var Wx=q0,I3=q0.elementCreator(),Qx=o1((...i)=>I3(...i),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class W2 extends j{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:w.tagListBg,gap:w.spacing25,borderRadius:p.taglistRoundedRadius(w.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${w.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${w.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:w.inputBg,borderRadius:p.tagContainerRadius(w.spacing50),boxShadow:w.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:w.spacing25,minHeight:`calc(${w.lineHeight} + ${w.spacing})`,padding:w.spacing25},':host [part="tagMenu"]':{width:w.touchSize,height:w.touchSize,lineHeight:w.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:w.brandColor,color:w.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return L6(this.value).filter((i)=>i!=="")}set tags(i){this.value=Kx(i)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(i){if(typeof i==="string")this._availableTags=W2.parseAvailableTagsString(i);else this._availableTags=i;this.queueRender()}static parseAvailableTagsString(i){return L6(i).map((l)=>l===""?null:l)}connectedCallback(){super.connectedCallback();let i=this.getAttribute("available-tags");if(i&&this._availableTags.length===0)this._availableTags=W2.parseAvailableTagsString(i)}formDisabledCallback(i){this.disabled=i}formResetCallback(){this.value=""}addTag=(i)=>{let l=i.trim();if(l===""||this.tags.includes(l))return;this.tags=[...this.tags,l],this.queueRender(!0)};toggleTag=(i)=>{if(this.tags.includes(i))this.tags=this.tags.filter((l)=>l!==i),this.queueRender(!0);else this.addTag(i)};enterTag=(i)=>{let{tagInput:l}=this.parts;switch(i.key){case",":{let h=l.value.split(",")[0];this.addTag(h)}break;case"Enter":{let h=l.value.split(",")[0];this.addTag(h)}i.stopPropagation(),i.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:i}=this,{tagMenu:l}=this.parts,h=[...this.availableTags],y=this.tags.filter((C)=>!h.includes(C));if(y.length)h.push(null,...y);let x=h.map((C)=>{if(C===""||C===null)return null;else if(typeof C==="object")return{checked:()=>this.tags.includes(C.value),caption:C.caption,action(){i(C.value)}};else return{checked:()=>this.tags.includes(C),caption:C,action(){i(C)}}});a({target:l,width:"auto",menuItems:x})};content=()=>[a3({type:"button",style:{visibility:"hidden"},tabindex:-1}),Ox({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),Gx({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),a3({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},n.chevronDown())];removeTag=(i)=>{if(this.editable&&!this.disabled){let l=i.target.closest(q0.tagName);this.tags=this.tags.filter((h)=>h!==l.caption),l.remove(),this.queueRender(!0)}i.stopPropagation(),i.preventDefault()};render(){super.render();let{tagContainer:i,tagMenu:l,tagInput:h}=this.parts;if(l.disabled=this.disabled,h.value="",h.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)l.toggleAttribute("hidden",!1),h.toggleAttribute("hidden",!this.textEntry);else l.toggleAttribute("hidden",!0),h.toggleAttribute("hidden",!0);i.textContent="";for(let y of this.tags)i.append(I3({caption:y,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var Yx=W2,m6=W2.elementCreator(),Nx=o1((...i)=>m6(...i),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var e6="1.6.5";var{span:Xx}=z,P0=null,X4=null,$4=null,Y1="tosi-tooltip";z1("tosi-tooltip",{[`.${Y1}`]:{pointerEvents:"none",padding:p.tosiTooltipPadding("4px 10px"),borderRadius:p.tosiTooltipRadius("6px"),background:p.tosiTooltipBg("#333"),color:p.tosiTooltipColor("#fff"),fontSize:p.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:p.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${Y1} p`]:{margin:"0"},[`.${Y1} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${Y1} a`]:{color:"inherit"},[`.${Y1}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${Y1}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Y1}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Y1}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${Y1}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}});function Q2(){if(X4!==null)clearTimeout(X4),X4=null;if(P0!==null)P0.remove(),P0=null;$4=null}function $x(i){if(i.startsWith("s"))return"tt-s";if(i.startsWith("n"))return"tt-n";if(i.startsWith("e"))return"tt-e";if(i.startsWith("w"))return"tt-w";return"tt-s"}function bx(i,l,h){let y=l.getBoundingClientRect(),x=i.getBoundingClientRect(),C=y.left+y.width*0.5,o=y.top+y.height*0.5,s;if(h.startsWith("s")||h.startsWith("n"))s=Math.max(8,Math.min(x.width-8,C-x.left))-4;else s=Math.max(8,Math.min(x.height-8,o-x.top))-4;i.style.setProperty("--tosi-tooltip-arrow",s+"px")}function Rx(i,l){if(l)i=N(i);let h=Xx({class:Y1});return h.innerHTML=O.parseInline(i),h}function Zx(i,l,h){Q2(),$4=i;let{top:y,left:x,width:C}=i.getBoundingClientRect(),o=x+C*0.5,s=window.innerHeight,g=window.innerWidth,k=(y>s*0.5?"n":"s")+(o>g*0.5?"w":"e"),r=Rx(l,h);r.classList.add($x(k)),P0=m2({content:r,target:i,position:k,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(P0&&$4)bx(r,i,k)})}function Hx(i){for(let l of i.composedPath())if(l instanceof HTMLElement&&l.dataset.tooltip)return l;return null}function Jx(i={}){let{convertTitles:l=!0,delay:h=250,localize:y=!1}=i;document.addEventListener("pointermove",(x)=>{if(l){for(let s of x.composedPath())if(s instanceof HTMLElement&&s.title&&!s.dataset.tooltip){s.dataset.tooltip=s.title,s.removeAttribute("title");break}}let C=Hx(x);if(C===$4)return;if(Q2(),!C)return;let o=C.dataset.tooltip||null;if(!o)return;X4=setTimeout(()=>Zx(C,o,y),h)}),document.addEventListener("pointerleave",Q2),document.addEventListener("pointerdown",Q2),document.addEventListener("keydown",Q2),window.addEventListener("scroll",Q2,!0)}Object.assign(globalThis,{xinjs:M2,xinjsui:T3});})();
100
+ `+y;else h.push(y)}return h},[]);this.innerHTML=l.map((h)=>h.startsWith("<")&&h.endsWith(">")?h:O(h,this.options)).join("")}else this.innerHTML=O(i,this.options);this.didRender()}}var Dy=O4,K3=O4.elementCreator(),ay=K3,Iy=K3;var{div:W3,span:G4,button:Q3}=z,z0=86400000,Ty=[0,1,2,3,4,5,6],My=[1,2,3,4,5,6,7,8,9,10,11,12],Y3=(i,l=2,h="0")=>String(i).padStart(l,h),j0=(i,l,h)=>new Date(`${i}-${Y3(l)}-${Y3(h)}`);class N3 extends j{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:p.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:p.monthTodayBackground("transparent"),boxShadow:p.monthTodayShadow("none"),backdropFilter:p.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:p.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:p.monthDayColor("hotpink"),background:p.monthDayBackground("white"),fontWeight:p.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:p.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:p.monthDateCheckedColor("white"),background:p.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:p.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:p.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:p.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:p.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:p.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:j0(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:j0(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(i){this.disabled=i}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return My.map((i)=>({caption:j0(2025,i,1).toString().split(" ")[1],value:String(i)}))}get years(){let i=Number(this.minDate.split("-")[0]),l=Number(this.maxDate.split("-")[0]),h=[];for(let y=i;y<=l;y++)h.push(String(y));return h}monthChanged=(i,l)=>{};gotoMonth(i,l){if(this.month!==l||this.year!==i)this.month=l,this.year=i,this.monthChanged(i,l)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(i){this.selectedDays[1]=i,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(i){this.selectedDays[0]=i,this.selectedDays.splice(2)}clickDate=(i)=>{let l=i.target.getAttribute("title");this.selectDate(l)};keyDate=(i)=>{let l=!1;switch(i.code){case"Space":{let h=i.target.getAttribute("title");this.selectDate(h),l=!0;break}case"Tab":break;default:console.log(i)}if(l)i.preventDefault(),i.stopPropagation()};#i="";selectDate=(i)=>{if(this.#i=i,this.range){if(!this.to)this.selectedDays=[i,i];else if(this.from===i&&this.to===i)this.selectedDays=[];else if(this.from===i)this.from=this.to;else if(this.to===i)this.to=this.from;else if(i<this.from)this.from=i;else if(i>this.to)this.to=i;else this.to=i;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(i))this.selectedDays.splice(this.selectedDays.indexOf(i),1);else this.selectedDays.push(i),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(i))this.value="",this.selectedDays=[];else this.value=i,this.selectedDays=[i]};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=(i)=>{if(!this.range)return this.selectedDays.includes(i);else if(this.range)return this.from&&i>=this.from&&i<=this.to;return!1};dateMenuItem=(i,l="")=>{return i=i.split("T")[0],{caption:l||i,enabled:()=>!i.startsWith(`${this.year}-${Y3(this.month)}-`),action:()=>{this.gotoDate(i)}}};jumpMenu=()=>{a({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((i)=>this.dateMenuItem(i))]})};content=()=>[W3({part:"header"},Q3({part:"previous",onClick:this.previousMonth},n.chevronLeft()),G4({style:{flex:"1"}}),Q3({part:"jump",onClick:this.jumpMenu},n.calendar()),B1({part:"month",options:this.months,onChange:this.setMonth}),B1({part:"year",options:[this.year],onChange:this.setMonth}),G4({style:{flex:"1"}}),Q3({part:"next",onClick:this.nextMonth},n.chevronRight())),W3({part:"week"}),W3({part:"days"})];gotoDate(i){let l=new Date(i);this.gotoMonth(l.getFullYear(),l.getMonth()+1)}connectedCallback(){super.connectedCallback();let i=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=i.getMonth()+1;if(isNaN(this.year))this.year=i.getFullYear()}days=[];render(){super.render();let{week:i,days:l,jump:h,month:y,year:x,previous:C,next:o}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let s=j0(this.year,this.month,1),g=new Date(s.valueOf()-(7+s.getDay()-this.weekStart)%7*z0),k=this.month===12?1:this.month+1,r=new Date(j0(this.year+(this.month===12?1:0),k,1).valueOf()-z0),c=new Date(r.valueOf()+(this.weekStart*2+5+this.endDay-r.getDay())%7*z0),d=Ty.map((P)=>new Date(g.valueOf()+P*z0).toString().split(" ")[0]);this.days=[];let v=new Date().toISOString().split("T")[0];for(let P=g.valueOf();P<=c.valueOf();P+=z0){let V=new Date(P),W=V.toISOString().split("T")[0];this.days.push({date:V,selected:!1,inMonth:V.getMonth()+1===this.month,isToday:W===v,isWeekend:V.getDay()%6===0,inRange:!!(this.from&&W>=this.from&&W<=this.to)})}y.value=String(this.month),x.value=String(this.year),y.disabled=x.disabled=h.disabled=C.disabled=o.disabled=this.disabled||this.readonly,x.options=this.years,i.textContent="",i.append(...d.map((P)=>G4({class:"day"},P))),l.textContent="";let B=null,{to:t,from:_}=this;l.append(...this.days.map((P)=>{let V=["date"];if(P.inMonth)V.push("in-month");if(P.isToday)V.push("today");let W=P.date.toISOString().split("T")[0];if(this.checkDay(W))V.push("checked");if(V.push(P.isWeekend?"weekend":"weekday"),this.range){if(t===W)V.push("range-end");if(_===W)V.push("range-start")}let Z=G4({class:V.join(" "),title:W,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},P.date.getDate());if(W===this.#i)B=Z;return Z})),B?.focus()}}var uy=N3.elementCreator();var{div:X3,button:Ly}=z,my={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class L1 extends j{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${w.notificationSpacing} ${w.notificationSpacing50} ${w.notificationSpacing} ${w.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:w.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:w.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:w.notificationSpacing,width:w.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:w.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:w.notificationTextColor},":host .note":{display:"grid",background:w.notificationBg,padding:w.notificationPadding,gridTemplateColumns:`${w.notificationIconSize} 1fr ${w.notificationButtonSize}`,gap:w.notificationSpacing,alignItems:"center",borderRadius:w.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${w.notificationAccentColor}`,borderColor:w.notificationAccentColor,borderWidth:w.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:w.notificationButtonSize,padding:0,margin:0,height:w.notificationButtonSize,width:w.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:w.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:w.notificationBg,background:w.notificationAccentColor,padding:w.spacing50},":host .note svg":{height:w.notificationIconSize,width:w.notificationIconSize,pointerEvents:"none",color:w.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:w.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(i){i.classList.add("closing"),i.style.marginBottom=-i.offsetHeight+"px";let l=()=>{i.remove()};i.addEventListener("transitionend",l),setTimeout(l,1000)}static post(i){let{message:l,duration:h,type:y,close:x,progress:C,icon:o,color:s}=Object.assign({type:"info",duration:-1},typeof i==="string"?{message:i}:i);if(!this.singleton)this.singleton=$3();let g=this.singleton;document.body.append(g),g.style.zIndex=String(y2()+1);let k=s||my[y],r=C||y==="progress"?z.progress():{},c=()=>{if(x)x();L1.removeNote(B)},d=o instanceof SVGElement?o:o?n[o]():n.info(),v=y==="error"||y==="warn",B=X3({class:`note ${y}`,role:v?"alert":"status",ariaLive:v?"assertive":"polite",style:{_notificationAccentColor:k}},d,X3({class:"message"},X3(l),r),Ly({class:"close",title:"close",ariaLabel:"Close notification",apply(t){t.addEventListener("click",c)}},n.x()));if(g.shadowRoot.append(B),r instanceof HTMLProgressElement&&C instanceof Function){r.setAttribute("max",String(100)),r.value=C();let t=setInterval(()=>{if(!g.shadowRoot.contains(B)){clearInterval(t);return}let _=C();if(r.value=_,_>=100)L1.removeNote(B)},1000)}if(h>0)setTimeout(()=>{L1.removeNote(B)},h*1000);return B.scrollIntoView(),c}content=null}var ey=L1,$3=L1.elementCreator(),Ey=$3;function ix(i){return L1.post(i)}var X6=async(i,l="SHA-1")=>{let y=new TextEncoder().encode(i),x=await crypto.subtle.digest(l,y);return Array.from(new Uint8Array(x)).map((s)=>s.toString(16).padStart(2,"0")).join("")},$6=async(i)=>{let l=await X6(i),h=await fetch(`https://weakpass.com/api/v1/search/${l}`);if(h.ok){let y=await h.json();console.log("password found in weakpass database",y)}return h.status!==404},{span:b3,tosiSlot:lx}=z;class F4 extends j{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:w.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:p.meterHeight("24px"),background:p.indicatorBg("white"),borderRadius:p.meterRadius("4px"),boxShadow:p.meterShadow(`inset 0 0 0 2px ${w.indicatorColor}`)},':host [part="level"]':{height:p.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:w.indicatorColor,margin:p.levelMargin("2px"),borderRadius:p.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:w.descriptionColor,height:p.meterHeight("24px"),lineHeight:p.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(i){return this.issues={tooShort:i.length<this.minLength,short:i.length<this.goodLength,noUpper:!i.match(/[A-Z]/),noLower:!i.match(/[a-z]/),noNumber:!i.match(/[0-9]/),noSpecial:!i.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((l)=>!l).length-1}async isBreached(){let i=this.querySelector("input")?.value;if(!i||typeof i!=="string")return!0;return await $6(i)}updateIndicator=(i)=>{let{level:l,description:h}=this.parts,y=this.indicatorColors.split(","),x=this.descriptionColors.split(","),C=this.strength(i);if(this.value!==C)this.value=C,this.dispatchEvent(new Event("change"));l.style.width=`${(C+1)*16.67}%`,this.style.setProperty("--indicator-color",y[C]),this.style.setProperty("--description-color",x[C]),h.textContent=this.strengthDescriptions[C]};update=(i)=>{let l=i.target.closest("input");this.updateIndicator(l?.value||"")};content=()=>[lx({onInput:this.update}),b3({part:"meter"},b3({part:"level"}),b3({part:"description"}))];render(){super.render();let i=this.querySelector("input");this.updateIndicator(i?.value)}}var hx=F4,b6=F4.elementCreator(),yx=b6;var{span:R3}=z;class K4 extends j{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(i){this.readonly=i}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=()=>R3({part:"container"},R3({part:"empty"}),R3({part:"filled"}));displayValue(i){let{empty:l,filled:h}=this.parts,x=Math.round((typeof i==="string"?0:i||0)/this.step)*this.step;h.style.width=x/this.max*l.offsetWidth+"px"}update=(i)=>{if(this.readonly)return;let{empty:l}=this.parts,h=i instanceof MouseEvent?i.pageX-l.getBoundingClientRect().x:0,y=Math.min(Math.max(this.min,Math.round(h/l.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(i.type==="click")this.value=y;else if(i.type==="mousemove")this.displayValue(y);else this.displayValue(this.value||0)};handleKey=(i)=>{let l=this.value===""?NaN:Number(this.value);if(isNaN(l))l=Math.round((this.min+this.max)*0.5*this.step)*this.step;let h=!1;switch(i.key){case"ArrowUp":case"ArrowRight":l+=this.step,h=!0;break;case"ArrowDown":case"ArrowLeft":l-=this.step,h=!0;break}if(this.value=Math.max(Math.min(l,this.max),this.min),h)i.stopPropagation(),i.preventDefault()};connectedCallback(){super.connectedCallback();let{container:i}=this.parts;i.tabIndex=0,i.addEventListener("mousemove",this.update,!0),i.addEventListener("mouseleave",this.update),i.addEventListener("blur",this.update),i.addEventListener("click",this.update),i.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let i=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",i),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:l,filled:h}=this.parts;if(l.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),l.style.setProperty("--tosi-icon-stroke",this.emptyStroke),h.style.setProperty("--tosi-icon-fill",this.ratingFill),h.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let y=0;y<this.max;y++)l.append(n[this.icon]()),h.append(n[this.icon]())}this.displayValue(this.value)}}var xx=K4,R6=K4.elementCreator(),Cx=o1((...i)=>R6(...i),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:Z6,div:ox,button:sx}=z,gx=[{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 Z3(i=gx){return B1({title:"paragraph style",slot:"toolbar",class:"block-style",options:i.map(({caption:l,tagType:h})=>({caption:l,value:`formatBlock,${h}`}))})}var t0=()=>O3({slot:"toolbar"});function P1(i,l,h){return sx({slot:"toolbar",dataCommand:l,title:i},h)}var kx=()=>[P1("left-justify","justifyLeft",n.alignLeft()),P1("center","justifyCenter",n.alignCenter()),P1("right-justify","justifyRight",n.alignRight()),t0(),P1("bullet list","insertUnorderedList",n.listBullet()),P1("numbered list","insertOrderedList",n.listNumber()),t0(),P1("indent","indent",n.indent()),P1("indent","outdent",n.outdent())],H6=()=>[P1("bold","bold",n.fontBold()),P1("italic","italic",n.fontItalic()),P1("underline","underline",n.fontUnderline())],wx=()=>[Z3(),t0(),...H6()],J6=()=>[Z3(),t0(),...kx(),t0(),...H6()];class W4 extends j{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(i){if(this.isInitialized)this.parts.doc.contentEditable=i?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(i){let l=this._value;if(this._value=i,this.isInitialized){if(this.parts.doc.innerHTML!==i)this.parts.doc.innerHTML=i}if(l!==i&&this.internals)this.internals.setFormValue(i)}blockElement(i){let{doc:l}=this.parts;while(i.parentElement!==null&&i.parentElement!==l)i=i.parentElement;return i.parentElement===l?i:void 0}get selectedBlocks(){let{doc:i}=this.parts,l=window.getSelection();if(l===null)return[];let h=[];for(let y=0;y<l.rangeCount;y++){let x=l.getRangeAt(y);if(!i.contains(x.commonAncestorContainer))continue;let C=this.blockElement(x.startContainer),o=this.blockElement(x.endContainer);h.push(C);while(C!==o&&C!==null)C=C.nextElementSibling,h.push(C)}return h}get selectedText(){let i=window.getSelection();if(i===null)return"";return this.selectedBlocks.length?i.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(i)=>{if(this._updatingBlockStyle)return;let h=i.target?.closest(G1.tagName);if(h==null)return;this.doCommand(h.value)};handleButtonClick=(i)=>{let h=i.target?.closest("button");if(h==null)return;this.doCommand(h.dataset.command)};content=[Z6({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),ox({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),Z6({part:"content"})];doCommand(i){if(i===void 0)return;let l=i.split(",");console.log("execCommand",l[0],!1,...l.slice(1)),document.execCommand(l[0],!1,...l.slice(1))}updateBlockStyle(){let i=this.parts.toolbar.querySelector(".block-style");if(i===null)return;let l=this.selectedBlocks.map((h)=>h.tagName);l=[...new Set(l)],this._updatingBlockStyle=!0,i.value=l.length===1?`formatBlock,${l[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:i,content:l}=this.parts;if(l.innerHTML!==""&&i.innerHTML==="")i.innerHTML=l.innerHTML,l.innerHTML="";this.isInitialized=!0,l.style.display="none",i.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(h)=>{this.updateBlockStyle(),this.selectionChange(h,this)})}render(){let{toolbar:i}=this.parts;if(super.render(),i.children.length===0)switch(this.widgets){case"minimal":i.append(...wx());break;case"default":i.append(...J6());break}}}var rx=W4,S6=W4.elementCreator(),px=o1((...i)=>S6(...i),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:v0}=L({router:{path:"",hash:"",pattern:""}}),H3={};function cx(){return{...H3}}var Q4=[],J3=!1,Y4=new Set;function dx(i){let l=[];if(i==="")return{regex:/^\/?$/,paramNames:l};let h=i.split("/").map((x)=>{if(x.startsWith(":"))return l.push(x.slice(1)),"([^/]+)";return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+h.join("/")+"/?$"),paramNames:l}}function Bx(i){let l=i.split("?")[0].split("#")[0];for(let y of Q4){if(y.fallback)continue;let x=l.match(y.regex);if(x){let C={};return y.paramNames.forEach((o,s)=>{C[o]=decodeURIComponent(x[s+1])}),{route:y,params:C}}}let h=Q4.find((y)=>y.fallback);if(h)return{route:h,params:{}};return null}function A0(){let i=J3?window.location.hash.replace(/^#\/?/,""):window.location.pathname;v0.path.value=i,v0.hash.value=window.location.hash;let l=Bx(i);if(l){H3=l.params,v0.pattern.value=l.route.regex.source;let h=new Map;for(let y of l.route.targets)h.set(y.view??"default",y);for(let y of Y4){let x=y.name||"default",C=h.get(x);if(C)y.replaceChildren(C.component(l.params));else y.replaceChildren()}}else{H3={},v0.pattern.value="";for(let h of Y4)h.replaceChildren()}}var D6=!1;function a6(){if(D6)return;D6=!0,window.addEventListener("popstate",A0),window.addEventListener("hashchange",A0)}function fx(i,l={}){J3=l.hashRouting??!1,Q4=i.map((h)=>{let{regex:y,paramNames:x}=dx(h.pattern);return{regex:y,paramNames:x,targets:h.targets,fallback:h.fallback??!1}}),a6(),A0()}function nx(i){if(a6(),J3)window.location.hash="#/"+i.replace(/^\//,"");else window.history.pushState({},"","/"+i.replace(/^\//,""));A0()}class S3 extends j{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),Y4.add(this),Q4.length>0)A0()}disconnectedCallback(){super.disconnectedCallback(),Y4.delete(this)}}var zx=S3.elementCreator();var{div:jx,slot:tx,label:vx,span:Ax,input:I6}=z;class K2 extends j{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(i){if(typeof i==="string")this._choices=K2.parseChoicesString(i);else this._choices=i;this.queueRender()}static parseChoicesString(i){return i.split(",").filter((l)=>l.trim()!=="").map((l)=>{let[h,y]=l.split("=").map((s)=>s.trim()),[x,C]=(y||h).split(":").map((s)=>s.trim()),o=C?n[C]():"";return{value:h,icon:o,caption:x}})}value="";formDisabledCallback(i){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((i)=>i.trim()).filter((i)=>i!=="")}content=()=>[tx(),jx({part:"options"},I6({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:p.segmentedOptionGap("8px"),alignItems:p.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:p.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:p.segmentedOptionGap("8px"),gridTemplateColumns:p.segmentedOptionGridColumns("0px 24px 1fr"),padding:p.segmentedOptionPadding("4px 12px"),font:p.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:p.segmentedFocusShadow(`inset 0 0 0 2px ${p.segmentedOptionCurrentBackground("#44a")}`),borderRadius:p.segmentedOptionsBorderRadius("8px")},":host label.current":{color:p.segmentedOptionCurrentColor("#eee"),background:p.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:p.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${p.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:p.segmentOptionIconSize("16px"),stroke:p.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:p.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:p.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:p.segmentedOptionsBorderRadius("8px"),background:p.segmentedOptionsBackground("#fff"),color:p.segmentedOptionColor("#222"),overflow:"hidden",alignItems:p.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:p.segmentedOptionPadding("4px 12px"),color:p.segmentedOptionCurrentColor("#eee"),background:p.segmentedOptionCurrentBackground("#44a"),font:p.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:p.segmentedOptionCurrentColor("#eee"),opacity:p.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:i}=this.parts;i.querySelectorAll("label").forEach((l)=>{let h=l.querySelector("input");l.classList.toggle("current",Boolean(h&&h.checked))})}valueChanged=!1;handleChange=()=>{let{options:i,custom:l}=this.parts;if(this.multiple){let h=[...i.querySelectorAll("input:checked")];this.value=h.map((y)=>y.value).join(",")}else{let h=i.querySelector("input:checked");if(!h)this.value="";else if(h.value)l.setAttribute("hidden",""),this.value=h.value;else l.removeAttribute("hidden"),l.focus(),l.select(),this.value=l.value}this.syncCurrent(),this.valueChanged=!0};handleKey=(i)=>{let l=!1;switch(i.code){case"Space":if(i.target instanceof HTMLLabelElement)i.target.click(),l=!0;break;case"Tab":if(!(i.target instanceof HTMLLabelElement))i.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let h=i.target.closest("label");if(h.previousElementSibling instanceof HTMLLabelElement)h.previousElementSibling.focus()}l=!0;break;case"ArrowRight":case"ArrowDown":{let h=i.target.closest("label");if(h.nextElementSibling instanceof HTMLLabelElement)h.nextElementSibling.focus()}l=!0;break}if(l)i.preventDefault(),i.stopPropagation()};connectedCallback(){super.connectedCallback();let i=this.getAttribute("choices");if(i&&this._choices.length===0)this._choices=K2.parseChoicesString(i);let{options:l}=this.parts;if(this.name==="")this.name=this.instanceId;if(l.addEventListener("change",this.handleChange),l.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 i=[...this.choices];if(this.other&&!this.multiple){let[l,h]=this.other.split(":");i.push({value:"",caption:l,icon:h})}return i}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((i)=>i.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:i,custom:l}=this.parts;i.textContent="";let h=this.multiple?"checkbox":"radio",{values:y,isOtherValue:x}=this;if(i.append(...this._choicesWithOther.map((C)=>{return vx({tabindex:0},I6({type:h,name:this.name,value:C.value,checked:y.includes(C.value)||C.value===""&&x,tabIndex:-1}),C.icon||{class:"no-icon"},this.localized?j1(C.caption):Ax(C.caption))})),this.other&&!this.multiple)l.hidden=!x,l.value=x?this.value:"",l.placeholder=this.placeholder,i.append(l);this.syncCurrent()}}var qx=K2,T6=K2.elementCreator(),Px=o1((...i)=>T6(...i),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:M6}=z;class D3 extends j{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[M6({part:"normal"}),M6({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:i,small:l}=this.parts,h=this.offsetParent;if(!(h instanceof HTMLElement))return;else if(h.offsetWidth<this.minWidth||h.offsetHeight<this.minHeight)i.hidden=!0,l.hidden=!1,this.value="small";else i.hidden=!1,l.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var _x=D3.elementCreator();class N4 extends j{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:w.resizeIconFill}};content=n.resize();get minSize(){let{minWidth:i,minHeight:l}=getComputedStyle(this.target);return{width:parseFloat(i)||32,height:parseFloat(l)||32}}resizeTarget=(i)=>{let{target:l}=this;if(!l)return;let{offsetWidth:h,offsetHeight:y}=l;l.style.left=l.offsetLeft+"px",l.style.top=l.offsetTop+"px",l.style.bottom="",l.style.right="";let{minSize:x}=this;r1(i,(C,o,s)=>{if(l.style.width=Math.max(x.width,h+C)+"px",l.style.height=Math.max(x.height,y+o)+"px",s.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let i={passive:!0};this.addEventListener("mousedown",this.resizeTarget,i),this.addEventListener("touchstart",this.resizeTarget,i)}}var Vx=N4,u6=N4.elementCreator(),Ux=u6;var{div:Ox,input:Gx,span:Fx,button:a3}=z,L6=(i)=>i.split(/(?<!\\),/).map((l)=>l.trim().replace(/\\,/g,",")),Kx=(i)=>i.map((l)=>l.replace(/,/g,"\\,")).join(",");class q0 extends j{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":p.brandColor("blue"),"--tag-text-color":p.brandTextColor("white"),display:"inline-flex",borderRadius:p.tagRoundedRadius(w.spacing50),color:w.tagTextColor,background:w.tagBg,padding:`0 ${w.spacing75} 0 ${w.spacing75}`,height:`calc(${w.lineHeight} + ${w.spacing50})`,lineHeight:`calc(${w.lineHeight} + ${w.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:p.fontSize("16px"),color:w.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${w.spacing_50} 0 ${w.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:w.spacing150,width:w.spacing150,color:w.tagCloseButtonColor,background:w.tagCloseButtonBg,borderRadius:p.tagCloseButtonRadius("99px"),opacity:w.tagButtonOpacity},':host [part="remove"]:hover':{background:w.tagCloseButtonBg,opacity:w.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[Fx({part:"caption"},this.caption),a3(n.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var Wx=q0,I3=q0.elementCreator(),Qx=o1((...i)=>I3(...i),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class W2 extends j{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:w.tagListBg,gap:w.spacing25,borderRadius:p.taglistRoundedRadius(w.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${w.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${w.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:w.inputBg,borderRadius:p.tagContainerRadius(w.spacing50),boxShadow:w.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:w.spacing25,minHeight:`calc(${w.lineHeight} + ${w.spacing})`,padding:w.spacing25},':host [part="tagMenu"]':{width:w.touchSize,height:w.touchSize,lineHeight:w.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:w.brandColor,color:w.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return L6(this.value).filter((i)=>i!=="")}set tags(i){this.value=Kx(i)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(i){if(typeof i==="string")this._availableTags=W2.parseAvailableTagsString(i);else this._availableTags=i;this.queueRender()}static parseAvailableTagsString(i){return L6(i).map((l)=>l===""?null:l)}connectedCallback(){super.connectedCallback();let i=this.getAttribute("available-tags");if(i&&this._availableTags.length===0)this._availableTags=W2.parseAvailableTagsString(i)}formDisabledCallback(i){this.disabled=i}formResetCallback(){this.value=""}addTag=(i)=>{let l=i.trim();if(l===""||this.tags.includes(l))return;this.tags=[...this.tags,l],this.queueRender(!0)};toggleTag=(i)=>{if(this.tags.includes(i))this.tags=this.tags.filter((l)=>l!==i),this.queueRender(!0);else this.addTag(i)};enterTag=(i)=>{let{tagInput:l}=this.parts;switch(i.key){case",":{let h=l.value.split(",")[0];this.addTag(h)}break;case"Enter":{let h=l.value.split(",")[0];this.addTag(h)}i.stopPropagation(),i.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:i}=this,{tagMenu:l}=this.parts,h=[...this.availableTags],y=this.tags.filter((C)=>!h.includes(C));if(y.length)h.push(null,...y);let x=h.map((C)=>{if(C===""||C===null)return null;else if(typeof C==="object")return{checked:()=>this.tags.includes(C.value),caption:C.caption,action(){i(C.value)}};else return{checked:()=>this.tags.includes(C),caption:C,action(){i(C)}}});a({target:l,width:"auto",menuItems:x})};content=()=>[a3({type:"button",style:{visibility:"hidden"},tabindex:-1}),Ox({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),Gx({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),a3({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},n.chevronDown())];removeTag=(i)=>{if(this.editable&&!this.disabled){let l=i.target.closest(q0.tagName);this.tags=this.tags.filter((h)=>h!==l.caption),l.remove(),this.queueRender(!0)}i.stopPropagation(),i.preventDefault()};render(){super.render();let{tagContainer:i,tagMenu:l,tagInput:h}=this.parts;if(l.disabled=this.disabled,h.value="",h.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)l.toggleAttribute("hidden",!1),h.toggleAttribute("hidden",!this.textEntry);else l.toggleAttribute("hidden",!0),h.toggleAttribute("hidden",!0);i.textContent="";for(let y of this.tags)i.append(I3({caption:y,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var Yx=W2,m6=W2.elementCreator(),Nx=o1((...i)=>m6(...i),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var e6="1.6.6";var{span:Xx}=z,P0=null,X4=null,$4=null,Y1="tosi-tooltip";z1("tosi-tooltip",{[`.${Y1}`]:{pointerEvents:"none",padding:p.tosiTooltipPadding("4px 10px"),borderRadius:p.tosiTooltipRadius("6px"),background:p.tosiTooltipBg("#333"),color:p.tosiTooltipColor("#fff"),fontSize:p.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:p.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${Y1} p`]:{margin:"0"},[`.${Y1} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${Y1} a`]:{color:"inherit"},[`.${Y1}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${Y1}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Y1}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Y1}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${Y1}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}});function Q2(){if(X4!==null)clearTimeout(X4),X4=null;if(P0!==null)P0.remove(),P0=null;$4=null}function $x(i){if(i.startsWith("s"))return"tt-s";if(i.startsWith("n"))return"tt-n";if(i.startsWith("e"))return"tt-e";if(i.startsWith("w"))return"tt-w";return"tt-s"}function bx(i,l,h){let y=l.getBoundingClientRect(),x=i.getBoundingClientRect(),C=y.left+y.width*0.5,o=y.top+y.height*0.5,s;if(h.startsWith("s")||h.startsWith("n"))s=Math.max(8,Math.min(x.width-8,C-x.left))-4;else s=Math.max(8,Math.min(x.height-8,o-x.top))-4;i.style.setProperty("--tosi-tooltip-arrow",s+"px")}function Rx(i,l){if(l)i=N(i);let h=Xx({class:Y1});return h.innerHTML=O.parseInline(i),h}function Zx(i,l,h){Q2(),$4=i;let{top:y,left:x,width:C}=i.getBoundingClientRect(),o=x+C*0.5,s=window.innerHeight,g=window.innerWidth,k=(y>s*0.5?"n":"s")+(o>g*0.5?"w":"e"),r=Rx(l,h);r.classList.add($x(k)),P0=m2({content:r,target:i,position:k,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(P0&&$4)bx(r,i,k)})}function Hx(i){for(let l of i.composedPath())if(l instanceof HTMLElement&&l.dataset.tooltip)return l;return null}function Jx(i={}){let{convertTitles:l=!0,delay:h=250,localize:y=!1}=i;document.addEventListener("pointermove",(x)=>{if(l){for(let s of x.composedPath())if(s instanceof HTMLElement&&s.title&&!s.dataset.tooltip){s.dataset.tooltip=s.title,s.removeAttribute("title");break}}let C=Hx(x);if(C===$4)return;if(Q2(),!C)return;let o=C.dataset.tooltip||null;if(!o)return;X4=setTimeout(()=>Zx(C,o,y),h)}),document.addEventListener("pointerleave",Q2),document.addEventListener("pointerdown",Q2),document.addEventListener("keydown",Q2),window.addEventListener("scroll",Q2,!0)}Object.assign(globalThis,{xinjs:M2,xinjsui:T3});})();
101
101
 
102
- //# debugId=86AE32264A14B94F64756E2164756E21
102
+ //# debugId=087C17D498B213CB64756E2164756E21
103
103
  //# sourceMappingURL=iife.js.map