@samline/string 1.5.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this package. Format: [Keep a Changelog](https://keepacha
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [2.0.0] - 2026-11-15
8
+
9
+ ### Changed
10
+
11
+ - **Breaking:** the browser bundle defines `window.Strings` instead of `window.SamlineString`, so the global carries the package's own name like every other @samline package (`window.String` is JavaScript's built-in constructor). In pages that load the CDN script, replace `SamlineString` with `Strings`, for example `Strings.auto()` and `Strings.controller`. ESM and CommonJS imports are unchanged.
12
+
7
13
  ## [1.5.0] - 2026-11-15
8
14
 
9
15
  ### Added
package/README.md CHANGED
@@ -85,14 +85,14 @@ closest('te vrde', ['Café de olla', 'Té verde']) // 'Té verde'
85
85
  For Shopify, WordPress or plain HTML pages without a build step, load the browser bundle with a classic script tag. Pin the version in production.
86
86
 
87
87
  ```html
88
- <script src="https://cdn.jsdelivr.net/npm/@samline/string@1.5.0/dist/browser/string.global.js"></script>
88
+ <script src="https://cdn.jsdelivr.net/npm/@samline/string@2.0.0/dist/browser/string.global.js"></script>
89
89
  <script>
90
- const { slugify } = window.SamlineString
90
+ const { slugify } = window.Strings
91
91
  console.log(slugify('Café & Té')) // 'cafe-te'
92
92
  </script>
93
93
  ```
94
94
 
95
- The bundle defines `window.SamlineString` with every function and converts every `[data-string]` element and filters every `[data-string-search]` list when the DOM is ready, including elements added later. Add `data-manual` to the script tag to start it yourself with `SamlineString.auto(options)`.
95
+ The bundle defines `window.Strings` (`window.String` is JavaScript's own) with every function and, when the DOM is ready, starts every `[data-string]`, `[data-string-search]`, `[data-string-count]`, `[data-string-fit]` and `[data-string-copy]` element, including elements added later. Add `data-manual` to the script tag to start it yourself with `Strings.auto(options)`.
96
96
 
97
97
  ## Capabilities
98
98
 
@@ -106,7 +106,7 @@ The bundle defines `window.SamlineString` with every function and converts every
106
106
 
107
107
  ### Slugs and accents
108
108
 
109
- `slugify` removes accents, transliterates ß, æ, œ, ø, đ, ł and þ, applies your `replacements` (literal or regex pairs), collapses separators and cuts at a separator with `maxLength`. `trim: false` keeps a trailing separator for live slug fields, and `preserve: '.'` keeps characters such as the dot in `v1.2`. `charMap` adds transliteration: the `CYRILLIC`, `GREEK` and `GERMAN` presets (`Москва` → `moskva`, `Müller` → `mueller`) or your own map. `uniqueSlug(text, taken)` returns the first free slug (`hola-3`), keeping the number inside `maxLength`. `removeAccents` gives accent-insensitive text for search.
109
+ `slugify` removes accents, transliterates ß, æ, œ, ø, đ, ł and þ, applies your `replacements` (literal or regex pairs), collapses separators and cuts at a separator with `maxLength`. `trim: false` keeps a trailing separator for live slug fields, and `preserve: '.'` keeps characters such as the dot in `v1.2`. `charMap` adds transliteration: the `CYRILLIC`, `GREEK` and `GERMAN` presets (also by name in `CHAR_MAPS`) (`Москва` → `moskva`, `Müller` → `mueller`) or your own map. `uniqueSlug(text, taken)` returns the first free slug (`hola-3`), keeping the number inside `maxLength`. `removeAccents` gives accent-insensitive text for search.
110
110
 
111
111
  ### Display helpers
112
112
 
@@ -132,20 +132,20 @@ The bundle defines `window.SamlineString` with every function and converts every
132
132
 
133
133
  ## API at a glance
134
134
 
135
- | API | Purpose |
136
- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------- |
137
- | `camelCase`, `pascalCase`, `kebabCase`, `snakeCase`, `dotCase`, `pathCase`, `constantCase`, `trainCase` | Identifier cases. |
138
- | `titleCase`, `sentenceCase`, `capitalize`, `uncapitalize` | Human-readable casing. |
139
- | `slugify(text, options?)`, `uniqueSlug(text, taken, options?)`, `removeAccents(text, options?)`, `CYRILLIC`, `GREEK`, `GERMAN` | URL slugs, free slugs and accent-free text. |
140
- | `truncate(text, length, options?)`, `initials(text, options?)`, `graphemes(text)` | Display helpers. |
141
- | `convert(text, to, options?)`, `CONVERSIONS`, `isConversion(value)` | Any conversion by name. |
142
- | `wordCount`, `readingTime`, `pluralize`, `template`, `escapeHtml`, `unescapeHtml`, `stripTags` | Prose, plurals, placeholders and HTML text. |
143
- | `fold`, `contains`, `highlight`, `compareNatural`, `distance`, `similarity`, `closest` | Search, sorting and typo suggestions. |
144
- | `words(text)` | The shared word splitter. |
145
- | `string(target?, options?)`, `autoString(options?)` from `/vanilla` | Convert elements and fields from HTML. |
146
- | `count`, `fit`, `copy` and their `auto*()` from `/vanilla` | Counters, fitted text and copy buttons. |
147
- | `hashColor(text, options?)` | A stable color for a name. |
148
- | `search(target?, options?)`, `autoSearch(options?)` from `/vanilla` | Filter and highlight lists from HTML. |
135
+ | API | Purpose |
136
+ | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
137
+ | `camelCase`, `pascalCase`, `kebabCase`, `snakeCase`, `dotCase`, `pathCase`, `constantCase`, `trainCase` | Identifier cases. |
138
+ | `titleCase`, `sentenceCase`, `capitalize`, `uncapitalize` | Human-readable casing. |
139
+ | `slugify(text, options?)`, `uniqueSlug(text, taken, options?)`, `removeAccents(text, options?)`, `CYRILLIC`, `GREEK`, `GERMAN`, `CHAR_MAPS` | URL slugs, free slugs and accent-free text. |
140
+ | `truncate(text, length, options?)`, `initials(text, options?)`, `graphemes(text)` | Display helpers. |
141
+ | `convert(text, to, options?)`, `CONVERSIONS`, `isConversion(value)` | Any conversion by name. |
142
+ | `wordCount`, `readingTime`, `pluralize`, `template`, `escapeHtml`, `unescapeHtml`, `stripTags` | Prose, plurals, placeholders and HTML text. |
143
+ | `fold`, `contains`, `highlight`, `compareNatural`, `distance`, `similarity`, `closest` | Search, sorting and typo suggestions. |
144
+ | `words(text)` | The shared word splitter. |
145
+ | `string(target?, options?)`, `autoString(options?)` from `/vanilla` | Convert elements and fields from HTML. |
146
+ | `count`, `fit`, `copy` and their `auto*()` from `/vanilla` | Counters, fitted text and copy buttons. |
147
+ | `hashColor(text, options?)` | A stable color for a name. |
148
+ | `search(target?, options?)`, `autoSearch(options?)` from `/vanilla` | Filter and highlight lists from HTML. |
149
149
 
150
150
  ### Entrypoints
151
151
 
@@ -153,7 +153,7 @@ The bundle defines `window.SamlineString` with every function and converts every
153
153
  | ------------------------- | ------------------------------------------------------------------------------------------------------------- |
154
154
  | `@samline/string` | ESM or CommonJS, every pure function. |
155
155
  | `@samline/string/vanilla` | Every function plus the HTML layer: `string()`, `search()`, `count()`, `fit()`, `copy()` and their `auto*()`. |
156
- | `@samline/string/browser` | Classic script that defines `window.SamlineString` and starts the HTML layer. |
156
+ | `@samline/string/browser` | Classic script that defines `window.Strings` and starts the HTML layer. |
157
157
 
158
158
  ## Documentation
159
159
 
@@ -1,2 +1,2 @@
1
- "use strict";(()=>{var ve=Object.defineProperty;var Ae=(t,r)=>{for(var n in r)ve(t,n,{get:r[n],enumerable:!0})};var Ht={};Ae(Ht,{CHAR_MAPS:()=>G,CONVERSIONS:()=>Nt,CYRILLIC:()=>Tt,GERMAN:()=>Mt,GREEK:()=>wt,camelCase:()=>Z,capitalize:()=>ut,closest:()=>le,compareNatural:()=>ae,constantCase:()=>at,contains:()=>dt,convert:()=>k,distance:()=>It,dotCase:()=>ot,escapeHtml:()=>ge,fold:()=>H,graphemes:()=>N,hashColor:()=>Ct,highlight:()=>mt,initials:()=>gt,isConversion:()=>B,kebabCase:()=>rt,pascalCase:()=>tt,pathCase:()=>st,pluralize:()=>fe,readingTime:()=>pe,removeAccents:()=>I,sentenceCase:()=>ct,similarity:()=>ht,slugify:()=>Y,snakeCase:()=>nt,stripTags:()=>de,template:()=>yt,titleCase:()=>lt,trainCase:()=>it,truncate:()=>j,uncapitalize:()=>pt,unescapeHtml:()=>kt,uniqueSlug:()=>ft,wordCount:()=>V,words:()=>L});var L=t=>typeof t!="string"||t===""?[]:t.replace(/([\p{Ll}\p{N}]\p{M}*)(\p{Lu})/gu,"$1 $2").replace(/(\p{Lu})(\p{Lu}\p{Ll})/gu,"$1 $2").split(/[^\p{L}\p{M}\p{N}]+/u).filter(Boolean);var Xt={\u00DF:"ss","\u1E9E":"SS",\u00E6:"ae",\u00C6:"AE",\u0153:"oe",\u0152:"OE",\u00F8:"o",\u00D8:"O",\u0111:"d",\u0110:"D",\u0142:"l",\u0141:"L",\u00FE:"th",\u00DE:"TH",\u00F0:"d",\u00D0:"D",\u0131:"i"},Te=new RegExp(`[${Object.keys(Xt).join("")}]`,"g"),we=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),vt=new WeakMap,Me=t=>{if(vt.has(t))return vt.get(t);let r=Object.keys(t).filter(Boolean).sort((e,o)=>o.length-e.length),n=r.length?new RegExp(r.map(we).join("|"),"gu"):null;return vt.set(t,n),n},Qt=(t,r)=>{let n=Me(r);return n?t.replace(n,e=>r[e]??e):t},I=(t,{charMap:r}={})=>{let n=String(t??"");return r&&(n=Qt(n,r)),n=n.normalize("NFKD").replace(/\p{M}+/gu,"").replace(Te,e=>Xt[e]??e),r?Qt(n,r):n};var At=t=>{let r={...t};for(let[n,e]of Object.entries(t)){let o=n.toUpperCase();o!==n&&!(o in r)&&(r[o]=e.charAt(0).toUpperCase()+e.slice(1))}return r},Tt=At({\u0430:"a",\u0431:"b",\u0432:"v",\u0433:"g",\u0491:"g",\u0434:"d",\u0435:"e",\u0451:"yo",\u0454:"ye",\u0436:"zh",\u0437:"z",\u0438:"i",\u0456:"i",\u0457:"yi",\u0439:"y",\u043A:"k",\u043B:"l",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"p",\u0440:"r",\u0441:"s",\u0442:"t",\u0443:"u",\u045E:"u",\u0444:"f",\u0445:"kh",\u0446:"ts",\u0447:"ch",\u0448:"sh",\u0449:"shch",\u044A:"",\u044B:"y",\u044C:"",\u044D:"e",\u044E:"yu",\u044F:"ya"}),wt=At({\u03B1:"a",\u03B2:"v",\u03B3:"g",\u03B4:"d",\u03B5:"e",\u03B6:"z",\u03B7:"i",\u03B8:"th",\u03B9:"i",\u03BA:"k",\u03BB:"l",\u03BC:"m",\u03BD:"n",\u03BE:"x",\u03BF:"o",\u03C0:"p",\u03C1:"r",\u03C3:"s",\u03C2:"s",\u03C4:"t",\u03C5:"y",\u03C6:"f",\u03C7:"ch",\u03C8:"ps",\u03C9:"o"}),Mt=At({\u00E4:"ae",\u00F6:"oe",\u00FC:"ue"}),G={cyrillic:Tt,greek:wt,german:Mt};var _=(t,r)=>t.toLocaleLowerCase(r),Zt=(t,r)=>t.toLocaleUpperCase(r),X=(t,r)=>{let[n="",...e]=Array.from(t);return Zt(n,r)+e.join("")},Rt=(t,r)=>X(_(t,r),r),Z=(t,{locale:r}={})=>L(t).map((n,e)=>e===0?_(n,r):Rt(n,r)).join(""),tt=(t,{locale:r}={})=>L(t).map(n=>Rt(n,r)).join(""),et=t=>(r,{locale:n}={})=>L(r).map(e=>_(e,n)).join(t),rt=et("-"),nt=et("_"),ot=et("."),st=et("/"),it=(t,{locale:r}={})=>L(t).map(n=>Rt(n,r)).join("-"),at=(t,{locale:r}={})=>L(t).map(n=>Zt(n,r)).join("_"),lt=(t,{locale:r,smallWords:n=[]}={})=>{let e=new Set(n.map(s=>_(s,r))),o=0;return String(t??"").replace(/[\p{L}\p{M}\p{N}]+/gu,s=>{let l=o++===0,c=_(s,r);return!l&&e.has(c)?c:X(c,r)})},ct=(t,{locale:r}={})=>X(_(String(t??""),r),r),ut=(t,{locale:r}={})=>X(String(t??""),r),pt=(t,{locale:r}={})=>{let[n="",...e]=Array.from(String(t??""));return _(n,r)+e.join("")};var Re=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=(t,{separator:r="-",lower:n=!0,replacements:e={},maxLength:o,trim:s=!0,locale:l,charMap:c,preserve:f=""}={})=>{let a=String(t??""),p=Array.isArray(e)?e:Object.entries(e);for(let[d,h]of p)a=typeof d=="string"?a.split(d).join(` ${h} `):a.replace(d,` ${h} `);n&&(a=a.toLocaleLowerCase(l)),a=I(a,c?{charMap:c}:{});let i=Re(r),u=f.replace(/[\]\\^-]/g,"\\$&");if(a=a.replace(new RegExp(`[^A-Za-z0-9${u}]+`,"g"),r),r&&(a=a.replace(new RegExp(`(?:${i}){2,}`,"g"),r)),s&&r?a=a.replace(new RegExp(`^(?:${i})+|(?:${i})+$`,"g"),""):r&&(a=a.replace(new RegExp(`^(?:${i})+`),"")),o!==void 0&&Number.isFinite(o)&&o>=0&&a.length>o){let d=a.slice(0,o),h=r?d.lastIndexOf(r):-1;a=h>0&&a[o]!==r?d.slice(0,h):d,r&&(a=a.replace(new RegExp(`(?:${i})+$`),""))}return a},te=1e5,ft=(t,r,{start:n=2,...e}={})=>{let o=Y(t,e),s;if(typeof r=="function")s=r;else{let a=new Set(r);s=p=>a.has(p)}if(o&&!s(o))return o;let l=e.separator??"-",{maxLength:c}=e,f=Number.isFinite(n)?Math.floor(n):2;for(let a=f;a<f+te;a++){let p=o?`${l}${a}`:String(a),i=o;if(c!==void 0&&c>=0&&i.length+p.length>c&&(i=i.slice(0,Math.max(0,c-p.length)),l))for(;i.endsWith(l);)i=i.slice(0,-l.length);let u=i?i+p:String(a);if(!s(u))return u}throw new RangeError(`uniqueSlug: no free slug for "${o}" after ${te} tries`)};var ee=globalThis.Intl?.Segmenter,re=new Map,Lt=(t,r)=>{if(!ee)return;let n=`${t}|${r===void 0?"":[r].flat().join(",")}`,e=re.get(n);return e||(e=new ee(r,{granularity:t}),re.set(n,e)),e},N=t=>{let r=String(t??""),n=Lt("grapheme");return n?Array.from(n.segment(r),e=>e.segment):Array.from(r)};var ne=/[\p{L}\p{N}]/u,oe="[\\s.,;:!?-]+",Le=new RegExp(`${oe}$`,"u"),Ne=new RegExp(`^${oe}`,"u"),j=(t,r,{ellipsis:n="\u2026",wordBoundary:e=!0,position:o="end"}={})=>{let s=N(t);if(!Number.isFinite(r)||r<0||s.length<=r)return s.join("");let l=Math.max(0,r-N(n).length);if(o==="middle"){let f=s.slice(0,Math.ceil(l/2)).join(""),a=l>1?s.slice(s.length-Math.floor(l/2)).join(""):"";return f.replace(/\s+$/u,"")+n+a.replace(/^\s+/u,"")}if(o==="start"){let f=s.length-l,a=s.slice(f).join("");if(e&&l>0&&ne.test(s[f-1])){let p=a.search(/\s/u);p>=0&&p<a.length-1&&(a=a.slice(p))}return n+a.replace(Ne,"")}let c=s.slice(0,l).join("");if(e&&s[l]!==void 0&&ne.test(s[l])){let f=c.search(/\s\S*$/u);f>0&&(c=c.slice(0,f))}return c.replace(Le,"")+n},gt=(t,{max:r=2,locale:n}={})=>L(String(t??"")).slice(0,Math.max(0,r)).map(e=>N(e)[0].toLocaleUpperCase(n)).join("");var Nt=["camel","pascal","kebab","snake","dot","path","constant","train","title","sentence","capitalize","uncapitalize","lower","upper","slug","accents","truncate","initials"],B=t=>Nt.includes(t),k=(t,r,n={})=>{let e=String(t??""),{locale:o}=n,s=o===void 0?{}:{locale:o};switch(r){case"camel":return Z(e,s);case"pascal":return tt(e,s);case"kebab":return rt(e,s);case"snake":return nt(e,s);case"dot":return ot(e,s);case"path":return st(e,s);case"constant":return at(e,s);case"train":return it(e,s);case"title":return lt(e,n);case"sentence":return ct(e,s);case"capitalize":return ut(e,s);case"uncapitalize":return pt(e,s);case"lower":return e.toLocaleLowerCase(o);case"upper":return e.toLocaleUpperCase(o);case"slug":return n.taken===void 0?Y(e,n):ft(e,n.taken,n);case"accents":return I(e,n.charMap?{charMap:n.charMap}:{});case"truncate":return n.length===void 0?e:j(e,n.length,n);case"initials":return gt(e,n);default:return e}};var H=(t,{locale:r}={})=>I(String(t??"").toLocaleLowerCase(r)),ie=(t,{locale:r,split:n=!0})=>{let e=H(t,r===void 0?{}:{locale:r}).trim();return e?n?Array.from(new Set(e.split(/\s+/u))):[e]:[]},dt=(t,r,n={})=>{let e=ie(r,n);if(e.length===0)return!0;let o=H(t,n.locale===void 0?{}:{locale:n.locale});return e.every(s=>o.includes(s))},Ie=/^[\u0000-\u007f]*$/,mt=(t,r,n={})=>{let e=Array.from(String(t??""));if(e.length===0)return[];let o=ie(r,n);if(o.length===0)return[{text:e.join(""),match:!1}];let s=n.locale,l="",c=[],f=new Set;e.forEach((i,u)=>{let d=i.toLocaleLowerCase(s),h=Ie.test(d)?d:I(d);l+=h,h===""&&f.add(u);for(let C=0;C<h.length;C++)c.push(u)});let a=new Array(e.length).fill(!1);for(let i of o)for(let u=l.indexOf(i);u!==-1;u=l.indexOf(i,u+i.length))for(let d=c[u];d<=c[u+i.length-1];d++)a[d]=!0;f.forEach(i=>{i>0&&(a[i]=a[i-1])});let p=[];return e.forEach((i,u)=>{let d=a[u],h=p[p.length-1];h&&h.match===d?h.text+=i:p.push({text:i,match:d})}),p},se=new Map,ae=(t,r,{locale:n,sensitivity:e="base"}={})=>{let o=`${n===void 0?"":[n].flat().join(",")}|${e}`,s=se.get(o);return s||(s=new Intl.Collator(n,{numeric:!0,sensitivity:e}),se.set(o,s)),s.compare(String(t??""),String(r??""))},It=(t,r)=>{let n=Array.from(String(t??"")),e=Array.from(String(r??""));if(n.length===0)return e.length;if(e.length===0)return n.length;let o=Array.from({length:e.length+1},(s,l)=>l);for(let s=1;s<=n.length;s++){let l=[s];for(let c=1;c<=e.length;c++){let f=n[s-1]===e[c-1]?0:1;l[c]=Math.min(o[c]+1,l[c-1]+1,o[c-1]+f)}o=l}return o[e.length]},ht=(t,r,{fold:n=!0,locale:e}={})=>{let o=e===void 0?{}:{locale:e},s=n?H(t,o):String(t??""),l=n?H(r,o):String(r??""),c=Math.max(Array.from(s).length,Array.from(l).length);return c===0?1:1-It(s,l)/c},ke=.98,He=(t,r)=>{let n=Array.from(t),e=Array.from(r);if(n.length<3||e.length<=n.length)return 0;let o=n.join(""),s=0;return e.forEach((l,c)=>{if(c>0&&!/[\s\p{P}]/u.test(e[c-1])||/\s/u.test(l))return;let f=e.slice(c,c+n.length).join("");s=Math.max(s,ht(o,f,{fold:!1}))}),s*ke},le=(t,r,{threshold:n=.5,partial:e=!0,...o}={})=>{let s=o.fold??!0,l=o.locale===void 0?{}:{locale:o.locale},c=i=>s?H(i,l):String(i??""),f=c(t),a,p=-1;for(let i of r){let u=ht(t,i,o),d=e?Math.max(u,He(f,c(i))):u;d>p&&(a=i,p=d)}return p>=n?a:void 0};var V=(t,{locale:r}={})=>{let n=String(t??""),e=Lt("word",r);if(!e)return n.split(/[^\p{L}\p{M}\p{N}'’]+/u).filter(Boolean).length;let o=0;for(let s of e.segment(n))s.isWordLike&&o++;return o},pe=(t,{wordsPerMinute:r=200,...n}={})=>{let e=V(t,n),o=Number.isFinite(r)&&r>0?r:200;return{words:e,minutes:e===0?0:Math.max(1,Math.ceil(e/o))}},ce=new Map,ue=new Map,$e=t=>t===void 0?"":[t].flat().join(","),fe=(t,r,{locale:n,ordinal:e=!1}={})=>{let o=$e(n),s=`${o}|${e}`,l=ce.get(s);l||(l=new Intl.PluralRules(n,{type:e?"ordinal":"cardinal"}),ce.set(s,l));let c=ue.get(o);c||(c=new Intl.NumberFormat(n),ue.set(o,c));let f=l.select(t);return(t===0&&r.zero||r[f]||r.other).replace(/#/g,c.format(t))},yt=(t,r,{missing:n}={})=>String(t??"").replace(/\{\{|\}\}|\{\s*([^{}\s]+)\s*\}/g,(e,o)=>{if(o===void 0)return e[0];let s=r;for(let l of o.split("."))s=s!==null&&typeof s=="object"&&Object.prototype.hasOwnProperty.call(s,l)?s[l]:void 0;return s!=null?String(s):n===void 0?e:typeof n=="function"?n(o):n});var Fe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ge=t=>String(t??"").replace(/[&<>"']/g,r=>Fe[r]),Pe={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",hellip:"\u2026",mdash:"\u2014",ndash:"\u2013",laquo:"\xAB",raquo:"\xBB"},_e=(t,r)=>Number.isInteger(t)&&t>0&&t<=1114111&&(t<55296||t>57343)?String.fromCodePoint(t):r,kt=t=>String(t??"").replace(/&(#x[\da-f]+|#\d+|[a-z]+);/gi,(r,n)=>{if(n[0]!=="#")return Pe[n.toLowerCase()]??r;let e=n[1]==="x"||n[1]==="X";return _e(parseInt(n.slice(e?2:1),e?16:10),r)}),je=/<\/?(?:p|div|br|li|ul|ol|h[1-6]|tr|td|th|table|section|article|header|footer|blockquote|pre|hr)\b[^>]*>/gi,de=t=>kt(String(t??"").replace(/<!--[\s\S]*?-->/g,"").replace(/<(script|style|template|noscript)\b[\s\S]*?<\/\1\s*>/gi,"").replace(je," ").replace(/<[^>]*>/g,"")).replace(/\s+/g," ").trim();var Be=t=>{let r=2166136261;for(let n=0;n<t.length;n++)r^=t.charCodeAt(n),r=Math.imul(r,16777619);return r>>>0},ze=(t,r,n)=>{let e=r/100,o=n/100,s=c=>{let f=(c+t/30)%12,a=o-e*Math.min(o,1-o)*Math.max(-1,Math.min(f-3,9-f,1));return a<=.04045?a/12.92:((a+.055)/1.055)**2.4};return 1.05/(.2126*s(0)+.7152*s(8)+.0722*s(4)+.05)},Ct=(t,{saturation:r=55,lightness:n=45,contrast:e=4.5}={})=>{let o=Be(H(String(t??"").trim()))%360,s=Math.max(0,Math.min(100,n));for(;s>0&&ze(o,r,s)<e;)s--;return`hsl(${o} ${r}% ${s}%)`};var F=()=>typeof window<"u"&&typeof document<"u",b=()=>{},me=t=>typeof Element<"u"&&t instanceof Element,A=(t,r=F()?document:null)=>{if(t==null)return[];if(me(t))return[t];if(typeof t=="string")return r?Array.from(r.querySelectorAll(t)):[];let n=(typeof t[Symbol.iterator]=="function",Array.from(t));return Array.from(new Set(n.filter(me)))},xt=(t,r)=>t.hasAttribute(r)?t.getAttribute(r):null,S=(t,r,n)=>{let e=xt(t,r);return e===null||e.trim()===""?n:e.trim()},P=(t,r,n)=>{let e=xt(t,r);if(e===null)return n;let o=e.trim().toLowerCase();return o===""||o==="true"||o===r.toLowerCase()?!0:o==="false"?!1:n},M=(t,r,n)=>{let e=xt(t,r);if(e===null||e.trim()==="")return n;let o=Number(e);return Number.isFinite(o)?o:n};var z=(t,r,n,e)=>{let o=xt(t,r)?.trim();return o!==void 0&&n.includes(o)?o:e};var U=({selector:t,init:r,root:n,observe:e=!0})=>{if(!F())return{refresh:b,destroy:b};let o=n??document,s=new Map,l=i=>{s.has(i)||s.set(i,r(i)??b)},c=i=>{let u=s.get(i);u&&(s.delete(i),u())},f=(i,u)=>{i instanceof Element&&(i.matches(t)&&u(i),i.querySelectorAll(t).forEach(u))},a=()=>o.querySelectorAll(t).forEach(l),p=null;if(e&&typeof MutationObserver=="function"){p=new MutationObserver(u=>{for(let d of u)d.removedNodes.forEach(h=>f(h,C=>{C.isConnected||c(C)})),d.addedNodes.forEach(h=>f(h,l))});let i=o instanceof Document?o.documentElement:o;p.observe(i,{childList:!0,subtree:!0})}return a(),{refresh:a,destroy:()=>{p?.disconnect(),p=null,Array.from(s.keys()).forEach(c)}}};var q=(t,r)=>(n=t,e={})=>{if(!F())return{refresh:b,destroy:b};let o=A(n).filter(s=>s instanceof HTMLElement).map(s=>r(s,e)).filter(s=>s!==null);return{refresh:()=>o.forEach(s=>s.refresh()),destroy:()=>o.forEach(s=>s.destroy())}},W=(t,r)=>({selector:n=t,scope:e,observe:o=!0,...s}={})=>U({selector:n,observe:o,...e&&{root:e},init:l=>r(l,s).destroy}),Ot=t=>{let r=Array.from(t.childNodes);return()=>t.replaceChildren(...r)},he=t=>{let r=new Map;return{set:(n,e)=>{r.has(n)||r.set(n,t.getAttribute(n)),r.get(n)===null&&(e===null?t.removeAttribute(n):t.setAttribute(n,e))},restore:()=>r.forEach((n,e)=>n===null&&t.removeAttribute(e))}},ye=(t,r,n)=>t.getAttribute(r)?.trim()||n||t.closest("[lang]")?.getAttribute("lang")||void 0,Ce=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t.value:t.textContent??"";var K="data-string-copy",$t="data-string-copy-state",Ue="string:copy",qe=(t,r)=>{let{source:n,as:e,reset:o,onCopy:s,...l}=r,c,f=i=>{clearTimeout(c),t.setAttribute($t,i.ok?"copied":"error");let u=M(t,`${K}-reset`,o??2e3);c=setTimeout(()=>t.removeAttribute($t),u),s?.(i,t),t.dispatchEvent(new CustomEvent(Ue,{bubbles:!0,detail:i}))},a=async()=>{let i=A(S(t,K,"")||n)[0],u=i?Ce(i):"",d=S(t,`${K}-as`,""),h=B(d)?d:e,C=h?k(u,h,l):u;try{if(!i||!navigator.clipboard)throw new Error("No source or clipboard");await navigator.clipboard.writeText(C),f({value:C,ok:!0})}catch{f({value:C,ok:!1})}};t.addEventListener("click",a);let p=!0;return{refresh:()=>{},destroy:()=>{p&&(p=!1,clearTimeout(c),t.removeEventListener("click",a),t.removeAttribute($t))}}},Ft=q(`[${K}]`,qe),Pt=W(`[${K}]`,Ft);var Et="data-string-count",xe="data-string-count-state",We="string:count",De=["characters","words"],Ge=(t,r)=>{let n=c=>`${Et}-${c}`,e=A(S(t,Et,"")||r.field)[0];if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return null;let o=Ot(t),s=()=>{let c=z(t,n("unit"),De,r.unit??"characters"),f=ye(t,n("locale"),r.locale),a=c==="words"?V(e.value,f?{locale:f}:{}):N(e.value).length,p=r.max??(e.maxLength>0?e.maxLength:NaN),i=M(t,n("max"),p),u=Number.isFinite(i)&&i>=0?i:void 0,d=u===void 0?void 0:u-a,h=M(t,n("near"),r.near??Math.ceil((u??0)*.1)),C=d===void 0?"ok":d<0?"over":d<=h?"near":"ok",y={count:a,max:u,remaining:d,state:C},m=t.hasAttribute(n("format"))?t.getAttribute(n("format"))??"":r.format??(u===void 0?"{count}":"{remaining}");t.textContent=typeof m=="function"?m(y):yt(m,{count:a,max:u,remaining:d},{missing:""}),t.setAttribute(xe,C),r.onCount?.(y,t),t.dispatchEvent(new CustomEvent(We,{bubbles:!0,detail:y}))};e.addEventListener("input",s),s();let l=!0;return{refresh:()=>l&&s(),destroy:()=>{l&&(l=!1,e.removeEventListener("input",s),o(),t.removeAttribute(xe))}}},_t=q(`[${Et}]`,Ge),jt=W(`[${Et}]`,_t);var J="data-string-fit",Bt="data-string-fit-state",Ye=["end","middle","start"],Ve=(t,r)=>{let n=Ot(t),e=he(t),o=t.textContent??"",s=t.getAttribute("style"),l=!0;t.style.whiteSpace="nowrap",t.style.overflow="hidden";let c=()=>t.scrollWidth<=t.clientWidth,f=()=>{let u=z(t,J,Ye,r.position??"middle"),d=t.hasAttribute(`${J}-ellipsis`)?t.getAttribute(`${J}-ellipsis`)??"":r.ellipsis??"\u2026";if(t.textContent!==o&&(t.textContent=o),t.clientWidth===0||c()){t.setAttribute(Bt,"full"),e.set("title",null);return}let h=0,C=N(o).length-1,y=j(o,0,{position:u,ellipsis:d,wordBoundary:!1});for(;h<=C;){let m=Math.floor((h+C)/2),x=j(o,m,{position:u,ellipsis:d,wordBoundary:!1});t.textContent=x,c()?(y=x,h=m+1):C=m-1}t.textContent=y,t.setAttribute(Bt,"truncated"),e.set("title",o)},a=0,p=()=>{cancelAnimationFrame(a),a=requestAnimationFrame(f)},i=null;return typeof ResizeObserver=="function"?(i=new ResizeObserver(p),i.observe(t)):window.addEventListener("resize",p),t.ownerDocument.fonts?.ready.then(()=>l&&f()),f(),{refresh:()=>l&&f(),destroy:()=>{l&&(l=!1,cancelAnimationFrame(a),i?.disconnect(),window.removeEventListener("resize",p),n(),e.restore(),s===null?t.removeAttribute("style"):t.setAttribute("style",s),t.removeAttribute(Bt))}}},zt=q(`[${J}]`,Ve),Ut=W(`[${J}]`,zt);var bt="data-string-search",Oe="data-string-search-state",Ke="data-string-search-empty",Je="string:search",Qe=t=>{let r=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT),n=[];for(let e=r.nextNode();e;e=r.nextNode())n.push(e);return n},Xe=(t,r)=>{let n=m=>`${bt}-${m}`,e=S(t,bt,""),o=A(e||r.input)[0];if(!(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement))return null;let s=t.ownerDocument,l=new Map,c=[],f=[],a=null,p=()=>{let m=S(t,n("locale"),"")||r.locale||t.closest("[lang]")?.getAttribute("lang")||"";return{match:{split:P(t,n("split"),r.split??!0),...m&&{locale:m}},mark:P(t,n("highlight"),r.highlight??!0),min:Math.max(1,M(t,n("min"),r.min??1)),items:S(t,n("items"),r.items??"")}},i=m=>{l.has(m)||l.set(m,m.hidden)},u=()=>{let{items:m}=p(),x=Array.from(m?t.querySelectorAll(m):t.children),v=A(r.empty)[0];a=t.querySelector(`[${Ke}]`)??(v instanceof HTMLElement?v:null),f=x.filter(E=>E instanceof HTMLElement&&E!==a&&!E.contains(a)),f.forEach(i),a&&i(a),f=f.filter(E=>!l.get(E))},d=()=>{for(let{original:m,nodes:x}of c){let v=x[0];v?.parentNode&&v.parentNode.insertBefore(m,v),x.forEach(E=>E.parentNode?.removeChild(E))}c=[]},h=(m,x,v)=>{for(let E of Qe(m)){let w=mt(E.data,x,v);if(!w.some(g=>g.match))continue;let $=w.map(g=>{if(!g.match)return s.createTextNode(g.text);let O=s.createElement("mark");return O.textContent=g.text,O}),R=E.parentNode;$.forEach(g=>R.insertBefore(g,E)),R.removeChild(E),c.push({original:E,nodes:$})}},C=()=>{let{match:m,mark:x,min:v}=p(),E=o.value;d();let w=Array.from(E.trim()).length>=v,$=f.filter(O=>{let T=!w||dt(O.textContent??"",E,m);return O.hidden=T?l.get(O):!0,T&&w&&x&&h(O,E,m),T&&w}),R=w?$.length>0?"results":"empty":"idle";t.setAttribute(Oe,R),a&&(a.hidden=R!=="empty");let g={query:E,matches:w?$:[...f],total:f.length,state:R};r.onSearch?.(g,t),t.dispatchEvent(new CustomEvent(Je,{bubbles:!0,detail:g}))};o.addEventListener("input",C),u(),C();let y=!0;return{refresh:()=>{y&&(d(),u(),C())},destroy:()=>{y&&(y=!1,o.removeEventListener("input",C),d(),l.forEach((m,x)=>x.hidden=m),t.removeAttribute(Oe))}}},qt=(t=`[${bt}]`,r={})=>{if(!F())return{refresh:b,destroy:b};let n=A(t).filter(e=>e instanceof HTMLElement).map(e=>Xe(e,r)).filter(e=>e!==null);return{refresh:()=>n.forEach(e=>e.refresh()),destroy:()=>n.forEach(e=>e.destroy())}},Wt=({selector:t=`[${bt}]`,scope:r,observe:n=!0,...e}={})=>U({selector:t,observe:n,...r&&{root:r},init:o=>qt(o,e).destroy});var St="data-string",Ee="data-string-state",Dt="string:change",Gt="--string-color",Ze=["end","middle","start"],tr={kebab:"-",snake:"_",dot:".",path:"/",constant:"_",train:"-",camel:" ",pascal:" "},Se=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement,Yt=t=>Se(t)?t.value:t.textContent??"",er=t=>{try{let r=JSON.parse(t);if(r&&typeof r=="object"&&!Array.isArray(r))return Object.fromEntries(Object.entries(r).filter(n=>typeof n[1]=="string"))}catch{}},be=(t,r)=>{let n=t.getAttribute(St)?.trim(),e=B(n)?n:r.to;if(!e)return null;let{to:o,source:s,live:l,onChange:c,color:f,...a}=r,p={...a},i=y=>`${St}-${y}`,u=y=>t.hasAttribute(i(y)),d=S(t,i("locale"),"")||a.locale||t.closest("[lang]")?.getAttribute("lang")||"";if(d?p.locale=d:delete p.locale,u("separator")&&(p.separator=t.getAttribute(i("separator"))??""),u("lower")&&(p.lower=P(t,i("lower"),a.lower??!0)),u("max-length")){let y=M(t,i("max-length"),NaN);Number.isFinite(y)&&(p.maxLength=y)}if(u("replacements")){let y=er(t.getAttribute(i("replacements"))??"");y&&(p.replacements=y)}if(u("preserve")&&(p.preserve=t.getAttribute(i("preserve"))??""),u("transliterate")){let m=S(t,i("transliterate"),"").split(/[\s,]+/).filter(x=>x in G).map(x=>G[x]);m.length&&(p.charMap=Object.assign({},a.charMap,...m))}if(u("taken")){let y=t.getAttribute(i("taken"))??"",m;try{m=JSON.parse(y)}catch{m=y.split(/[\s,]+/)}Array.isArray(m)&&(p.taken=m.filter(x=>typeof x=="string"&&x!==""))}if(u("small-words")&&(p.smallWords=S(t,i("small-words"),"").split(/[\s,]+/).filter(Boolean)),u("length")){let y=M(t,i("length"),NaN);Number.isFinite(y)&&(p.length=y)}if(u("ellipsis")&&(p.ellipsis=t.getAttribute(i("ellipsis"))??""),u("position")&&(p.position=z(t,i("position"),Ze,a.position??"end")),u("word-boundary")&&(p.wordBoundary=P(t,i("word-boundary"),!0)),u("max")){let y=M(t,i("max"),NaN);Number.isFinite(y)&&(p.max=y)}let h=S(t,i("source"),""),C=A(h||s)[0]??null;return{to:e,options:p,source:C===t?null:C,live:P(t,i("live"),l??!0),color:P(t,i("color"),!!f)?typeof f=="object"?f:{}:null}},rr=(t,{to:r,options:n})=>{if(r==="slug"){let{taken:s,...l}=n;return k(t,r,{...l,trim:!1})}let e=tr[r],o=k(t,r,n);return e!==void 0&&o&&/[^\p{L}\p{N}]$/u.test(t)?o+e:o},nr=(t,r)=>{let n=be(t,r);if(!n)return null;let e=Se(t)?t:null,o=Array.from(t.childNodes),s=Yt(t),l=b,c="ready",f=!1,a=g=>{c=g,t.setAttribute(Ee,g)},p=g=>{r.onChange?.(g,t),t.dispatchEvent(new CustomEvent(Dt,{bubbles:!0,detail:{value:g,state:c}}))},i=new Map,u=(g,O)=>{i.has(g)||i.set(g,t.getAttribute(g)),i.get(g)===null&&(O===null?t.removeAttribute(g):t.setAttribute(g,O))},d=g=>{if(!e||e.value===g)return;let O=e.ownerDocument.activeElement===e,T=0;try{T=e.value.length-(e.selectionEnd??e.value.length)}catch{}if(e.value=g,O){let D=Math.max(0,g.length-T);try{e.setSelectionRange(D,D)}catch{}}p(g)},h=g=>{let O=n,T=k(g,O.to,O.options);if(e)return d(T);t.textContent!==T&&(t.textContent=T,p(T)),u("title",O.to==="truncate"&&T!==g?g:null);let D=O.to==="initials"?g.trim():"";u("role",D?"img":null),u("aria-label",D||null),O.color?t.style.setProperty(Gt,Ct(g,O.color)):t.style.removeProperty(Gt)},C=()=>n.source&&h(Yt(n.source)),y=()=>{(!e||c==="following")&&C()},m=()=>{if(!(!e||f)){if(n.source){if(e.value==="")return a("following");c!=="edited"&&a("edited")}n.live&&n.to!=="truncate"&&n.to!=="initials"&&d(rr(e.value,n))}},x=()=>{if(e){if(n.source&&c==="following")return C();h(e.value)}},v=()=>f=!0,E=()=>{f=!1,m()},w=()=>{l();let g=n.source;if(!g)return l=b;g.addEventListener("input",y),g.addEventListener(Dt,y),l=()=>{g.removeEventListener("input",y),g.removeEventListener(Dt,y)}},$=()=>{let g=n;if(w(),e&&g.source){let O=k(Yt(g.source),g.to,g.options);a(e.value===""||e.value===O?"following":"edited"),c==="following"?C():h(e.value)}else a("ready"),g.source?C():h(e?e.value:s)};e&&(e.addEventListener("input",m),e.addEventListener("blur",x),e.addEventListener("compositionstart",v),e.addEventListener("compositionend",E)),$();let R=!0;return{refresh:()=>{if(!R)return;let g=be(t,r);if(g){if(n=g,e&&n.source&&c!=="ready")return w(),c==="following"?C():h(e.value);$()}},destroy:()=>{R&&(R=!1,l(),e?(e.removeEventListener("input",m),e.removeEventListener("blur",x),e.removeEventListener("compositionstart",v),e.removeEventListener("compositionend",E)):t.replaceChildren(...o),i.forEach((g,O)=>g===null&&t.removeAttribute(O)),t.style.removeProperty(Gt),t.getAttribute("style")===""&&t.removeAttribute("style"),t.removeAttribute(Ee))}}},Vt=(t=`[${St}]`,r={})=>{if(!F())return{refresh:b,destroy:b};let n=A(t).filter(e=>e instanceof HTMLElement).map(e=>nr(e,r)).filter(e=>e!==null);return{refresh:()=>n.forEach(e=>e.refresh()),destroy:()=>n.forEach(e=>e.destroy())}},Kt=({selector:t=`[${St}]`,scope:r,observe:n=!0,...e}={})=>U({selector:t,observe:n,...r&&{root:r},init:o=>Vt(o,e).destroy});var or=typeof document<"u"?document.currentScript:null,sr=or?.hasAttribute("data-manual")??!1,Q=null,Jt={...Ht,string:Vt,autoString:Kt,search:qt,autoSearch:Wt,count:_t,autoCount:jt,fit:zt,autoFit:Ut,copy:Ft,autoCopy:Pt,auto:(t={})=>{Q?.destroy();let{search:r,count:n,fit:e,copy:o,...s}=t,l={...s.scope&&{scope:s.scope},...s.locale!==void 0&&{locale:s.locale}},{locale:c,...f}=l,a=[Kt(s),Wt({...l,...r}),jt({...l,...n}),Ut({...f,...e}),Pt({...l,...o})];return Q={refresh:()=>a.forEach(p=>p.refresh()),destroy:()=>a.forEach(p=>p.destroy())},Q},get controller(){return Q}},ir=globalThis;ir.SamlineString=Jt;!sr&&typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Q??Jt.auto(),{once:!0}):Jt.auto());})();
1
+ "use strict";(()=>{var ve=Object.defineProperty;var Ae=(t,r)=>{for(var n in r)ve(t,n,{get:r[n],enumerable:!0})};var Ht={};Ae(Ht,{CHAR_MAPS:()=>G,CONVERSIONS:()=>Nt,CYRILLIC:()=>Tt,GERMAN:()=>Mt,GREEK:()=>wt,camelCase:()=>Z,capitalize:()=>ut,closest:()=>le,compareNatural:()=>ae,constantCase:()=>at,contains:()=>dt,convert:()=>k,distance:()=>It,dotCase:()=>ot,escapeHtml:()=>ge,fold:()=>H,graphemes:()=>N,hashColor:()=>Ct,highlight:()=>mt,initials:()=>gt,isConversion:()=>B,kebabCase:()=>rt,pascalCase:()=>tt,pathCase:()=>st,pluralize:()=>fe,readingTime:()=>pe,removeAccents:()=>I,sentenceCase:()=>ct,similarity:()=>ht,slugify:()=>Y,snakeCase:()=>nt,stripTags:()=>de,template:()=>yt,titleCase:()=>lt,trainCase:()=>it,truncate:()=>j,uncapitalize:()=>pt,unescapeHtml:()=>kt,uniqueSlug:()=>ft,wordCount:()=>V,words:()=>L});var L=t=>typeof t!="string"||t===""?[]:t.replace(/([\p{Ll}\p{N}]\p{M}*)(\p{Lu})/gu,"$1 $2").replace(/(\p{Lu})(\p{Lu}\p{Ll})/gu,"$1 $2").split(/[^\p{L}\p{M}\p{N}]+/u).filter(Boolean);var Xt={\u00DF:"ss","\u1E9E":"SS",\u00E6:"ae",\u00C6:"AE",\u0153:"oe",\u0152:"OE",\u00F8:"o",\u00D8:"O",\u0111:"d",\u0110:"D",\u0142:"l",\u0141:"L",\u00FE:"th",\u00DE:"TH",\u00F0:"d",\u00D0:"D",\u0131:"i"},Te=new RegExp(`[${Object.keys(Xt).join("")}]`,"g"),we=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),vt=new WeakMap,Me=t=>{if(vt.has(t))return vt.get(t);let r=Object.keys(t).filter(Boolean).sort((e,o)=>o.length-e.length),n=r.length?new RegExp(r.map(we).join("|"),"gu"):null;return vt.set(t,n),n},Qt=(t,r)=>{let n=Me(r);return n?t.replace(n,e=>r[e]??e):t},I=(t,{charMap:r}={})=>{let n=String(t??"");return r&&(n=Qt(n,r)),n=n.normalize("NFKD").replace(/\p{M}+/gu,"").replace(Te,e=>Xt[e]??e),r?Qt(n,r):n};var At=t=>{let r={...t};for(let[n,e]of Object.entries(t)){let o=n.toUpperCase();o!==n&&!(o in r)&&(r[o]=e.charAt(0).toUpperCase()+e.slice(1))}return r},Tt=At({\u0430:"a",\u0431:"b",\u0432:"v",\u0433:"g",\u0491:"g",\u0434:"d",\u0435:"e",\u0451:"yo",\u0454:"ye",\u0436:"zh",\u0437:"z",\u0438:"i",\u0456:"i",\u0457:"yi",\u0439:"y",\u043A:"k",\u043B:"l",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"p",\u0440:"r",\u0441:"s",\u0442:"t",\u0443:"u",\u045E:"u",\u0444:"f",\u0445:"kh",\u0446:"ts",\u0447:"ch",\u0448:"sh",\u0449:"shch",\u044A:"",\u044B:"y",\u044C:"",\u044D:"e",\u044E:"yu",\u044F:"ya"}),wt=At({\u03B1:"a",\u03B2:"v",\u03B3:"g",\u03B4:"d",\u03B5:"e",\u03B6:"z",\u03B7:"i",\u03B8:"th",\u03B9:"i",\u03BA:"k",\u03BB:"l",\u03BC:"m",\u03BD:"n",\u03BE:"x",\u03BF:"o",\u03C0:"p",\u03C1:"r",\u03C3:"s",\u03C2:"s",\u03C4:"t",\u03C5:"y",\u03C6:"f",\u03C7:"ch",\u03C8:"ps",\u03C9:"o"}),Mt=At({\u00E4:"ae",\u00F6:"oe",\u00FC:"ue"}),G={cyrillic:Tt,greek:wt,german:Mt};var _=(t,r)=>t.toLocaleLowerCase(r),Zt=(t,r)=>t.toLocaleUpperCase(r),X=(t,r)=>{let[n="",...e]=Array.from(t);return Zt(n,r)+e.join("")},Rt=(t,r)=>X(_(t,r),r),Z=(t,{locale:r}={})=>L(t).map((n,e)=>e===0?_(n,r):Rt(n,r)).join(""),tt=(t,{locale:r}={})=>L(t).map(n=>Rt(n,r)).join(""),et=t=>(r,{locale:n}={})=>L(r).map(e=>_(e,n)).join(t),rt=et("-"),nt=et("_"),ot=et("."),st=et("/"),it=(t,{locale:r}={})=>L(t).map(n=>Rt(n,r)).join("-"),at=(t,{locale:r}={})=>L(t).map(n=>Zt(n,r)).join("_"),lt=(t,{locale:r,smallWords:n=[]}={})=>{let e=new Set(n.map(s=>_(s,r))),o=0;return String(t??"").replace(/[\p{L}\p{M}\p{N}]+/gu,s=>{let l=o++===0,c=_(s,r);return!l&&e.has(c)?c:X(c,r)})},ct=(t,{locale:r}={})=>X(_(String(t??""),r),r),ut=(t,{locale:r}={})=>X(String(t??""),r),pt=(t,{locale:r}={})=>{let[n="",...e]=Array.from(String(t??""));return _(n,r)+e.join("")};var Re=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=(t,{separator:r="-",lower:n=!0,replacements:e={},maxLength:o,trim:s=!0,locale:l,charMap:c,preserve:f=""}={})=>{let a=String(t??""),p=Array.isArray(e)?e:Object.entries(e);for(let[d,h]of p)a=typeof d=="string"?a.split(d).join(` ${h} `):a.replace(d,` ${h} `);n&&(a=a.toLocaleLowerCase(l)),a=I(a,c?{charMap:c}:{});let i=Re(r),u=f.replace(/[\]\\^-]/g,"\\$&");if(a=a.replace(new RegExp(`[^A-Za-z0-9${u}]+`,"g"),r),r&&(a=a.replace(new RegExp(`(?:${i}){2,}`,"g"),r)),s&&r?a=a.replace(new RegExp(`^(?:${i})+|(?:${i})+$`,"g"),""):r&&(a=a.replace(new RegExp(`^(?:${i})+`),"")),o!==void 0&&Number.isFinite(o)&&o>=0&&a.length>o){let d=a.slice(0,o),h=r?d.lastIndexOf(r):-1;a=h>0&&a[o]!==r?d.slice(0,h):d,r&&(a=a.replace(new RegExp(`(?:${i})+$`),""))}return a},te=1e5,ft=(t,r,{start:n=2,...e}={})=>{let o=Y(t,e),s;if(typeof r=="function")s=r;else{let a=new Set(r);s=p=>a.has(p)}if(o&&!s(o))return o;let l=e.separator??"-",{maxLength:c}=e,f=Number.isFinite(n)?Math.floor(n):2;for(let a=f;a<f+te;a++){let p=o?`${l}${a}`:String(a),i=o;if(c!==void 0&&c>=0&&i.length+p.length>c&&(i=i.slice(0,Math.max(0,c-p.length)),l))for(;i.endsWith(l);)i=i.slice(0,-l.length);let u=i?i+p:String(a);if(!s(u))return u}throw new RangeError(`uniqueSlug: no free slug for "${o}" after ${te} tries`)};var ee=globalThis.Intl?.Segmenter,re=new Map,Lt=(t,r)=>{if(!ee)return;let n=`${t}|${r===void 0?"":[r].flat().join(",")}`,e=re.get(n);return e||(e=new ee(r,{granularity:t}),re.set(n,e)),e},N=t=>{let r=String(t??""),n=Lt("grapheme");return n?Array.from(n.segment(r),e=>e.segment):Array.from(r)};var ne=/[\p{L}\p{N}]/u,oe="[\\s.,;:!?-]+",Le=new RegExp(`${oe}$`,"u"),Ne=new RegExp(`^${oe}`,"u"),j=(t,r,{ellipsis:n="\u2026",wordBoundary:e=!0,position:o="end"}={})=>{let s=N(t);if(!Number.isFinite(r)||r<0||s.length<=r)return s.join("");let l=Math.max(0,r-N(n).length);if(o==="middle"){let f=s.slice(0,Math.ceil(l/2)).join(""),a=l>1?s.slice(s.length-Math.floor(l/2)).join(""):"";return f.replace(/\s+$/u,"")+n+a.replace(/^\s+/u,"")}if(o==="start"){let f=s.length-l,a=s.slice(f).join("");if(e&&l>0&&ne.test(s[f-1])){let p=a.search(/\s/u);p>=0&&p<a.length-1&&(a=a.slice(p))}return n+a.replace(Ne,"")}let c=s.slice(0,l).join("");if(e&&s[l]!==void 0&&ne.test(s[l])){let f=c.search(/\s\S*$/u);f>0&&(c=c.slice(0,f))}return c.replace(Le,"")+n},gt=(t,{max:r=2,locale:n}={})=>L(String(t??"")).slice(0,Math.max(0,r)).map(e=>N(e)[0].toLocaleUpperCase(n)).join("");var Nt=["camel","pascal","kebab","snake","dot","path","constant","train","title","sentence","capitalize","uncapitalize","lower","upper","slug","accents","truncate","initials"],B=t=>Nt.includes(t),k=(t,r,n={})=>{let e=String(t??""),{locale:o}=n,s=o===void 0?{}:{locale:o};switch(r){case"camel":return Z(e,s);case"pascal":return tt(e,s);case"kebab":return rt(e,s);case"snake":return nt(e,s);case"dot":return ot(e,s);case"path":return st(e,s);case"constant":return at(e,s);case"train":return it(e,s);case"title":return lt(e,n);case"sentence":return ct(e,s);case"capitalize":return ut(e,s);case"uncapitalize":return pt(e,s);case"lower":return e.toLocaleLowerCase(o);case"upper":return e.toLocaleUpperCase(o);case"slug":return n.taken===void 0?Y(e,n):ft(e,n.taken,n);case"accents":return I(e,n.charMap?{charMap:n.charMap}:{});case"truncate":return n.length===void 0?e:j(e,n.length,n);case"initials":return gt(e,n);default:return e}};var H=(t,{locale:r}={})=>I(String(t??"").toLocaleLowerCase(r)),ie=(t,{locale:r,split:n=!0})=>{let e=H(t,r===void 0?{}:{locale:r}).trim();return e?n?Array.from(new Set(e.split(/\s+/u))):[e]:[]},dt=(t,r,n={})=>{let e=ie(r,n);if(e.length===0)return!0;let o=H(t,n.locale===void 0?{}:{locale:n.locale});return e.every(s=>o.includes(s))},Ie=/^[\u0000-\u007f]*$/,mt=(t,r,n={})=>{let e=Array.from(String(t??""));if(e.length===0)return[];let o=ie(r,n);if(o.length===0)return[{text:e.join(""),match:!1}];let s=n.locale,l="",c=[],f=new Set;e.forEach((i,u)=>{let d=i.toLocaleLowerCase(s),h=Ie.test(d)?d:I(d);l+=h,h===""&&f.add(u);for(let C=0;C<h.length;C++)c.push(u)});let a=new Array(e.length).fill(!1);for(let i of o)for(let u=l.indexOf(i);u!==-1;u=l.indexOf(i,u+i.length))for(let d=c[u];d<=c[u+i.length-1];d++)a[d]=!0;f.forEach(i=>{i>0&&(a[i]=a[i-1])});let p=[];return e.forEach((i,u)=>{let d=a[u],h=p[p.length-1];h&&h.match===d?h.text+=i:p.push({text:i,match:d})}),p},se=new Map,ae=(t,r,{locale:n,sensitivity:e="base"}={})=>{let o=`${n===void 0?"":[n].flat().join(",")}|${e}`,s=se.get(o);return s||(s=new Intl.Collator(n,{numeric:!0,sensitivity:e}),se.set(o,s)),s.compare(String(t??""),String(r??""))},It=(t,r)=>{let n=Array.from(String(t??"")),e=Array.from(String(r??""));if(n.length===0)return e.length;if(e.length===0)return n.length;let o=Array.from({length:e.length+1},(s,l)=>l);for(let s=1;s<=n.length;s++){let l=[s];for(let c=1;c<=e.length;c++){let f=n[s-1]===e[c-1]?0:1;l[c]=Math.min(o[c]+1,l[c-1]+1,o[c-1]+f)}o=l}return o[e.length]},ht=(t,r,{fold:n=!0,locale:e}={})=>{let o=e===void 0?{}:{locale:e},s=n?H(t,o):String(t??""),l=n?H(r,o):String(r??""),c=Math.max(Array.from(s).length,Array.from(l).length);return c===0?1:1-It(s,l)/c},ke=.98,He=(t,r)=>{let n=Array.from(t),e=Array.from(r);if(n.length<3||e.length<=n.length)return 0;let o=n.join(""),s=0;return e.forEach((l,c)=>{if(c>0&&!/[\s\p{P}]/u.test(e[c-1])||/\s/u.test(l))return;let f=e.slice(c,c+n.length).join("");s=Math.max(s,ht(o,f,{fold:!1}))}),s*ke},le=(t,r,{threshold:n=.5,partial:e=!0,...o}={})=>{let s=o.fold??!0,l=o.locale===void 0?{}:{locale:o.locale},c=i=>s?H(i,l):String(i??""),f=c(t),a,p=-1;for(let i of r){let u=ht(t,i,o),d=e?Math.max(u,He(f,c(i))):u;d>p&&(a=i,p=d)}return p>=n?a:void 0};var V=(t,{locale:r}={})=>{let n=String(t??""),e=Lt("word",r);if(!e)return n.split(/[^\p{L}\p{M}\p{N}'’]+/u).filter(Boolean).length;let o=0;for(let s of e.segment(n))s.isWordLike&&o++;return o},pe=(t,{wordsPerMinute:r=200,...n}={})=>{let e=V(t,n),o=Number.isFinite(r)&&r>0?r:200;return{words:e,minutes:e===0?0:Math.max(1,Math.ceil(e/o))}},ce=new Map,ue=new Map,$e=t=>t===void 0?"":[t].flat().join(","),fe=(t,r,{locale:n,ordinal:e=!1}={})=>{let o=$e(n),s=`${o}|${e}`,l=ce.get(s);l||(l=new Intl.PluralRules(n,{type:e?"ordinal":"cardinal"}),ce.set(s,l));let c=ue.get(o);c||(c=new Intl.NumberFormat(n),ue.set(o,c));let f=l.select(t);return(t===0&&r.zero||r[f]||r.other).replace(/#/g,c.format(t))},yt=(t,r,{missing:n}={})=>String(t??"").replace(/\{\{|\}\}|\{\s*([^{}\s]+)\s*\}/g,(e,o)=>{if(o===void 0)return e[0];let s=r;for(let l of o.split("."))s=s!==null&&typeof s=="object"&&Object.prototype.hasOwnProperty.call(s,l)?s[l]:void 0;return s!=null?String(s):n===void 0?e:typeof n=="function"?n(o):n});var Fe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ge=t=>String(t??"").replace(/[&<>"']/g,r=>Fe[r]),Pe={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",hellip:"\u2026",mdash:"\u2014",ndash:"\u2013",laquo:"\xAB",raquo:"\xBB"},_e=(t,r)=>Number.isInteger(t)&&t>0&&t<=1114111&&(t<55296||t>57343)?String.fromCodePoint(t):r,kt=t=>String(t??"").replace(/&(#x[\da-f]+|#\d+|[a-z]+);/gi,(r,n)=>{if(n[0]!=="#")return Pe[n.toLowerCase()]??r;let e=n[1]==="x"||n[1]==="X";return _e(parseInt(n.slice(e?2:1),e?16:10),r)}),je=/<\/?(?:p|div|br|li|ul|ol|h[1-6]|tr|td|th|table|section|article|header|footer|blockquote|pre|hr)\b[^>]*>/gi,de=t=>kt(String(t??"").replace(/<!--[\s\S]*?-->/g,"").replace(/<(script|style|template|noscript)\b[\s\S]*?<\/\1\s*>/gi,"").replace(je," ").replace(/<[^>]*>/g,"")).replace(/\s+/g," ").trim();var Be=t=>{let r=2166136261;for(let n=0;n<t.length;n++)r^=t.charCodeAt(n),r=Math.imul(r,16777619);return r>>>0},ze=(t,r,n)=>{let e=r/100,o=n/100,s=c=>{let f=(c+t/30)%12,a=o-e*Math.min(o,1-o)*Math.max(-1,Math.min(f-3,9-f,1));return a<=.04045?a/12.92:((a+.055)/1.055)**2.4};return 1.05/(.2126*s(0)+.7152*s(8)+.0722*s(4)+.05)},Ct=(t,{saturation:r=55,lightness:n=45,contrast:e=4.5}={})=>{let o=Be(H(String(t??"").trim()))%360,s=Math.max(0,Math.min(100,n));for(;s>0&&ze(o,r,s)<e;)s--;return`hsl(${o} ${r}% ${s}%)`};var F=()=>typeof window<"u"&&typeof document<"u",b=()=>{},me=t=>typeof Element<"u"&&t instanceof Element,A=(t,r=F()?document:null)=>{if(t==null)return[];if(me(t))return[t];if(typeof t=="string")return r?Array.from(r.querySelectorAll(t)):[];let n=(typeof t[Symbol.iterator]=="function",Array.from(t));return Array.from(new Set(n.filter(me)))},xt=(t,r)=>t.hasAttribute(r)?t.getAttribute(r):null,S=(t,r,n)=>{let e=xt(t,r);return e===null||e.trim()===""?n:e.trim()},P=(t,r,n)=>{let e=xt(t,r);if(e===null)return n;let o=e.trim().toLowerCase();return o===""||o==="true"||o===r.toLowerCase()?!0:o==="false"?!1:n},M=(t,r,n)=>{let e=xt(t,r);if(e===null||e.trim()==="")return n;let o=Number(e);return Number.isFinite(o)?o:n};var z=(t,r,n,e)=>{let o=xt(t,r)?.trim();return o!==void 0&&n.includes(o)?o:e};var U=({selector:t,init:r,root:n,observe:e=!0})=>{if(!F())return{refresh:b,destroy:b};let o=n??document,s=new Map,l=i=>{s.has(i)||s.set(i,r(i)??b)},c=i=>{let u=s.get(i);u&&(s.delete(i),u())},f=(i,u)=>{i instanceof Element&&(i.matches(t)&&u(i),i.querySelectorAll(t).forEach(u))},a=()=>o.querySelectorAll(t).forEach(l),p=null;if(e&&typeof MutationObserver=="function"){p=new MutationObserver(u=>{for(let d of u)d.removedNodes.forEach(h=>f(h,C=>{C.isConnected||c(C)})),d.addedNodes.forEach(h=>f(h,l))});let i=o instanceof Document?o.documentElement:o;p.observe(i,{childList:!0,subtree:!0})}return a(),{refresh:a,destroy:()=>{p?.disconnect(),p=null,Array.from(s.keys()).forEach(c)}}};var q=(t,r)=>(n=t,e={})=>{if(!F())return{refresh:b,destroy:b};let o=A(n).filter(s=>s instanceof HTMLElement).map(s=>r(s,e)).filter(s=>s!==null);return{refresh:()=>o.forEach(s=>s.refresh()),destroy:()=>o.forEach(s=>s.destroy())}},W=(t,r)=>({selector:n=t,scope:e,observe:o=!0,...s}={})=>U({selector:n,observe:o,...e&&{root:e},init:l=>r(l,s).destroy}),Ot=t=>{let r=Array.from(t.childNodes);return()=>t.replaceChildren(...r)},he=t=>{let r=new Map;return{set:(n,e)=>{r.has(n)||r.set(n,t.getAttribute(n)),r.get(n)===null&&(e===null?t.removeAttribute(n):t.setAttribute(n,e))},restore:()=>r.forEach((n,e)=>n===null&&t.removeAttribute(e))}},ye=(t,r,n)=>t.getAttribute(r)?.trim()||n||t.closest("[lang]")?.getAttribute("lang")||void 0,Ce=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t.value:t.textContent??"";var K="data-string-copy",$t="data-string-copy-state",Ue="string:copy",qe=(t,r)=>{let{source:n,as:e,reset:o,onCopy:s,...l}=r,c,f=i=>{clearTimeout(c),t.setAttribute($t,i.ok?"copied":"error");let u=M(t,`${K}-reset`,o??2e3);c=setTimeout(()=>t.removeAttribute($t),u),s?.(i,t),t.dispatchEvent(new CustomEvent(Ue,{bubbles:!0,detail:i}))},a=async()=>{let i=A(S(t,K,"")||n)[0],u=i?Ce(i):"",d=S(t,`${K}-as`,""),h=B(d)?d:e,C=h?k(u,h,l):u;try{if(!i||!navigator.clipboard)throw new Error("No source or clipboard");await navigator.clipboard.writeText(C),f({value:C,ok:!0})}catch{f({value:C,ok:!1})}};t.addEventListener("click",a);let p=!0;return{refresh:()=>{},destroy:()=>{p&&(p=!1,clearTimeout(c),t.removeEventListener("click",a),t.removeAttribute($t))}}},Ft=q(`[${K}]`,qe),Pt=W(`[${K}]`,Ft);var Et="data-string-count",xe="data-string-count-state",We="string:count",De=["characters","words"],Ge=(t,r)=>{let n=c=>`${Et}-${c}`,e=A(S(t,Et,"")||r.field)[0];if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return null;let o=Ot(t),s=()=>{let c=z(t,n("unit"),De,r.unit??"characters"),f=ye(t,n("locale"),r.locale),a=c==="words"?V(e.value,f?{locale:f}:{}):N(e.value).length,p=r.max??(e.maxLength>0?e.maxLength:NaN),i=M(t,n("max"),p),u=Number.isFinite(i)&&i>=0?i:void 0,d=u===void 0?void 0:u-a,h=M(t,n("near"),r.near??Math.ceil((u??0)*.1)),C=d===void 0?"ok":d<0?"over":d<=h?"near":"ok",y={count:a,max:u,remaining:d,state:C},m=t.hasAttribute(n("format"))?t.getAttribute(n("format"))??"":r.format??(u===void 0?"{count}":"{remaining}");t.textContent=typeof m=="function"?m(y):yt(m,{count:a,max:u,remaining:d},{missing:""}),t.setAttribute(xe,C),r.onCount?.(y,t),t.dispatchEvent(new CustomEvent(We,{bubbles:!0,detail:y}))};e.addEventListener("input",s),s();let l=!0;return{refresh:()=>l&&s(),destroy:()=>{l&&(l=!1,e.removeEventListener("input",s),o(),t.removeAttribute(xe))}}},_t=q(`[${Et}]`,Ge),jt=W(`[${Et}]`,_t);var J="data-string-fit",Bt="data-string-fit-state",Ye=["end","middle","start"],Ve=(t,r)=>{let n=Ot(t),e=he(t),o=t.textContent??"",s=t.getAttribute("style"),l=!0;t.style.whiteSpace="nowrap",t.style.overflow="hidden";let c=()=>t.scrollWidth<=t.clientWidth,f=()=>{let u=z(t,J,Ye,r.position??"middle"),d=t.hasAttribute(`${J}-ellipsis`)?t.getAttribute(`${J}-ellipsis`)??"":r.ellipsis??"\u2026";if(t.textContent!==o&&(t.textContent=o),t.clientWidth===0||c()){t.setAttribute(Bt,"full"),e.set("title",null);return}let h=0,C=N(o).length-1,y=j(o,0,{position:u,ellipsis:d,wordBoundary:!1});for(;h<=C;){let m=Math.floor((h+C)/2),x=j(o,m,{position:u,ellipsis:d,wordBoundary:!1});t.textContent=x,c()?(y=x,h=m+1):C=m-1}t.textContent=y,t.setAttribute(Bt,"truncated"),e.set("title",o)},a=0,p=()=>{cancelAnimationFrame(a),a=requestAnimationFrame(f)},i=null;return typeof ResizeObserver=="function"?(i=new ResizeObserver(p),i.observe(t)):window.addEventListener("resize",p),t.ownerDocument.fonts?.ready.then(()=>l&&f()),f(),{refresh:()=>l&&f(),destroy:()=>{l&&(l=!1,cancelAnimationFrame(a),i?.disconnect(),window.removeEventListener("resize",p),n(),e.restore(),s===null?t.removeAttribute("style"):t.setAttribute("style",s),t.removeAttribute(Bt))}}},zt=q(`[${J}]`,Ve),Ut=W(`[${J}]`,zt);var bt="data-string-search",Oe="data-string-search-state",Ke="data-string-search-empty",Je="string:search",Qe=t=>{let r=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT),n=[];for(let e=r.nextNode();e;e=r.nextNode())n.push(e);return n},Xe=(t,r)=>{let n=m=>`${bt}-${m}`,e=S(t,bt,""),o=A(e||r.input)[0];if(!(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement))return null;let s=t.ownerDocument,l=new Map,c=[],f=[],a=null,p=()=>{let m=S(t,n("locale"),"")||r.locale||t.closest("[lang]")?.getAttribute("lang")||"";return{match:{split:P(t,n("split"),r.split??!0),...m&&{locale:m}},mark:P(t,n("highlight"),r.highlight??!0),min:Math.max(1,M(t,n("min"),r.min??1)),items:S(t,n("items"),r.items??"")}},i=m=>{l.has(m)||l.set(m,m.hidden)},u=()=>{let{items:m}=p(),x=Array.from(m?t.querySelectorAll(m):t.children),v=A(r.empty)[0];a=t.querySelector(`[${Ke}]`)??(v instanceof HTMLElement?v:null),f=x.filter(E=>E instanceof HTMLElement&&E!==a&&!E.contains(a)),f.forEach(i),a&&i(a),f=f.filter(E=>!l.get(E))},d=()=>{for(let{original:m,nodes:x}of c){let v=x[0];v?.parentNode&&v.parentNode.insertBefore(m,v),x.forEach(E=>E.parentNode?.removeChild(E))}c=[]},h=(m,x,v)=>{for(let E of Qe(m)){let w=mt(E.data,x,v);if(!w.some(g=>g.match))continue;let $=w.map(g=>{if(!g.match)return s.createTextNode(g.text);let O=s.createElement("mark");return O.textContent=g.text,O}),R=E.parentNode;$.forEach(g=>R.insertBefore(g,E)),R.removeChild(E),c.push({original:E,nodes:$})}},C=()=>{let{match:m,mark:x,min:v}=p(),E=o.value;d();let w=Array.from(E.trim()).length>=v,$=f.filter(O=>{let T=!w||dt(O.textContent??"",E,m);return O.hidden=T?l.get(O):!0,T&&w&&x&&h(O,E,m),T&&w}),R=w?$.length>0?"results":"empty":"idle";t.setAttribute(Oe,R),a&&(a.hidden=R!=="empty");let g={query:E,matches:w?$:[...f],total:f.length,state:R};r.onSearch?.(g,t),t.dispatchEvent(new CustomEvent(Je,{bubbles:!0,detail:g}))};o.addEventListener("input",C),u(),C();let y=!0;return{refresh:()=>{y&&(d(),u(),C())},destroy:()=>{y&&(y=!1,o.removeEventListener("input",C),d(),l.forEach((m,x)=>x.hidden=m),t.removeAttribute(Oe))}}},qt=(t=`[${bt}]`,r={})=>{if(!F())return{refresh:b,destroy:b};let n=A(t).filter(e=>e instanceof HTMLElement).map(e=>Xe(e,r)).filter(e=>e!==null);return{refresh:()=>n.forEach(e=>e.refresh()),destroy:()=>n.forEach(e=>e.destroy())}},Wt=({selector:t=`[${bt}]`,scope:r,observe:n=!0,...e}={})=>U({selector:t,observe:n,...r&&{root:r},init:o=>qt(o,e).destroy});var St="data-string",Ee="data-string-state",Dt="string:change",Gt="--string-color",Ze=["end","middle","start"],tr={kebab:"-",snake:"_",dot:".",path:"/",constant:"_",train:"-",camel:" ",pascal:" "},Se=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement,Yt=t=>Se(t)?t.value:t.textContent??"",er=t=>{try{let r=JSON.parse(t);if(r&&typeof r=="object"&&!Array.isArray(r))return Object.fromEntries(Object.entries(r).filter(n=>typeof n[1]=="string"))}catch{}},be=(t,r)=>{let n=t.getAttribute(St)?.trim(),e=B(n)?n:r.to;if(!e)return null;let{to:o,source:s,live:l,onChange:c,color:f,...a}=r,p={...a},i=y=>`${St}-${y}`,u=y=>t.hasAttribute(i(y)),d=S(t,i("locale"),"")||a.locale||t.closest("[lang]")?.getAttribute("lang")||"";if(d?p.locale=d:delete p.locale,u("separator")&&(p.separator=t.getAttribute(i("separator"))??""),u("lower")&&(p.lower=P(t,i("lower"),a.lower??!0)),u("max-length")){let y=M(t,i("max-length"),NaN);Number.isFinite(y)&&(p.maxLength=y)}if(u("replacements")){let y=er(t.getAttribute(i("replacements"))??"");y&&(p.replacements=y)}if(u("preserve")&&(p.preserve=t.getAttribute(i("preserve"))??""),u("transliterate")){let m=S(t,i("transliterate"),"").split(/[\s,]+/).filter(x=>x in G).map(x=>G[x]);m.length&&(p.charMap=Object.assign({},a.charMap,...m))}if(u("taken")){let y=t.getAttribute(i("taken"))??"",m;try{m=JSON.parse(y)}catch{m=y.split(/[\s,]+/)}Array.isArray(m)&&(p.taken=m.filter(x=>typeof x=="string"&&x!==""))}if(u("small-words")&&(p.smallWords=S(t,i("small-words"),"").split(/[\s,]+/).filter(Boolean)),u("length")){let y=M(t,i("length"),NaN);Number.isFinite(y)&&(p.length=y)}if(u("ellipsis")&&(p.ellipsis=t.getAttribute(i("ellipsis"))??""),u("position")&&(p.position=z(t,i("position"),Ze,a.position??"end")),u("word-boundary")&&(p.wordBoundary=P(t,i("word-boundary"),!0)),u("max")){let y=M(t,i("max"),NaN);Number.isFinite(y)&&(p.max=y)}let h=S(t,i("source"),""),C=A(h||s)[0]??null;return{to:e,options:p,source:C===t?null:C,live:P(t,i("live"),l??!0),color:P(t,i("color"),!!f)?typeof f=="object"?f:{}:null}},rr=(t,{to:r,options:n})=>{if(r==="slug"){let{taken:s,...l}=n;return k(t,r,{...l,trim:!1})}let e=tr[r],o=k(t,r,n);return e!==void 0&&o&&/[^\p{L}\p{N}]$/u.test(t)?o+e:o},nr=(t,r)=>{let n=be(t,r);if(!n)return null;let e=Se(t)?t:null,o=Array.from(t.childNodes),s=Yt(t),l=b,c="ready",f=!1,a=g=>{c=g,t.setAttribute(Ee,g)},p=g=>{r.onChange?.(g,t),t.dispatchEvent(new CustomEvent(Dt,{bubbles:!0,detail:{value:g,state:c}}))},i=new Map,u=(g,O)=>{i.has(g)||i.set(g,t.getAttribute(g)),i.get(g)===null&&(O===null?t.removeAttribute(g):t.setAttribute(g,O))},d=g=>{if(!e||e.value===g)return;let O=e.ownerDocument.activeElement===e,T=0;try{T=e.value.length-(e.selectionEnd??e.value.length)}catch{}if(e.value=g,O){let D=Math.max(0,g.length-T);try{e.setSelectionRange(D,D)}catch{}}p(g)},h=g=>{let O=n,T=k(g,O.to,O.options);if(e)return d(T);t.textContent!==T&&(t.textContent=T,p(T)),u("title",O.to==="truncate"&&T!==g?g:null);let D=O.to==="initials"?g.trim():"";u("role",D?"img":null),u("aria-label",D||null),O.color?t.style.setProperty(Gt,Ct(g,O.color)):t.style.removeProperty(Gt)},C=()=>n.source&&h(Yt(n.source)),y=()=>{(!e||c==="following")&&C()},m=()=>{if(!(!e||f)){if(n.source){if(e.value==="")return a("following");c!=="edited"&&a("edited")}n.live&&n.to!=="truncate"&&n.to!=="initials"&&d(rr(e.value,n))}},x=()=>{if(e){if(n.source&&c==="following")return C();h(e.value)}},v=()=>f=!0,E=()=>{f=!1,m()},w=()=>{l();let g=n.source;if(!g)return l=b;g.addEventListener("input",y),g.addEventListener(Dt,y),l=()=>{g.removeEventListener("input",y),g.removeEventListener(Dt,y)}},$=()=>{let g=n;if(w(),e&&g.source){let O=k(Yt(g.source),g.to,g.options);a(e.value===""||e.value===O?"following":"edited"),c==="following"?C():h(e.value)}else a("ready"),g.source?C():h(e?e.value:s)};e&&(e.addEventListener("input",m),e.addEventListener("blur",x),e.addEventListener("compositionstart",v),e.addEventListener("compositionend",E)),$();let R=!0;return{refresh:()=>{if(!R)return;let g=be(t,r);if(g){if(n=g,e&&n.source&&c!=="ready")return w(),c==="following"?C():h(e.value);$()}},destroy:()=>{R&&(R=!1,l(),e?(e.removeEventListener("input",m),e.removeEventListener("blur",x),e.removeEventListener("compositionstart",v),e.removeEventListener("compositionend",E)):t.replaceChildren(...o),i.forEach((g,O)=>g===null&&t.removeAttribute(O)),t.style.removeProperty(Gt),t.getAttribute("style")===""&&t.removeAttribute("style"),t.removeAttribute(Ee))}}},Vt=(t=`[${St}]`,r={})=>{if(!F())return{refresh:b,destroy:b};let n=A(t).filter(e=>e instanceof HTMLElement).map(e=>nr(e,r)).filter(e=>e!==null);return{refresh:()=>n.forEach(e=>e.refresh()),destroy:()=>n.forEach(e=>e.destroy())}},Kt=({selector:t=`[${St}]`,scope:r,observe:n=!0,...e}={})=>U({selector:t,observe:n,...r&&{root:r},init:o=>Vt(o,e).destroy});var or=typeof document<"u"?document.currentScript:null,sr=or?.hasAttribute("data-manual")??!1,Q=null,Jt={...Ht,string:Vt,autoString:Kt,search:qt,autoSearch:Wt,count:_t,autoCount:jt,fit:zt,autoFit:Ut,copy:Ft,autoCopy:Pt,auto:(t={})=>{Q?.destroy();let{search:r,count:n,fit:e,copy:o,...s}=t,l={...s.scope&&{scope:s.scope},...s.locale!==void 0&&{locale:s.locale}},{locale:c,...f}=l,a=[Kt(s),Wt({...l,...r}),jt({...l,...n}),Ut({...f,...e}),Pt({...l,...o})];return Q={refresh:()=>a.forEach(p=>p.refresh()),destroy:()=>a.forEach(p=>p.destroy())},Q},get controller(){return Q}},ir=globalThis;ir.Strings=Jt;!sr&&typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Q??Jt.auto(),{once:!0}):Jt.auto());})();
2
2
  //# sourceMappingURL=string.global.js.map