text: !function(){var e={class:"className",for:"htmlFor","http-equiv":"httpEquiv"};function t(e){return 9===e||10===e}var n=function(n,a){a||(a={});var o=a.concat||function(e,t){return String(e)+String(t)};return!1!==a.attrToProp&&(n=function(t){return function(n,r,a){for(var o in r)o in e&&(r[e[o]]=r[o],delete r[o]);return t(n,r,a)}}(n)),function(e){for(var l=1,s="",c=arguments.length,f=[],p=0;p<e.length;p++)if(p<c-1){var d=arguments[p+1],u=S(e[p]),h=l;10===h&&(h=8),9===h&&(h=8),7===h&&(h=8),4===h&&(h=5),2===h?"/"===s?(u.push([2,"/",d]),s=""):u.push([2,d]):13===h&&a.comments?s+=String(d):13!==h&&u.push([0,h,d]),f.push.apply(f,u)}else f.push.apply(f,S(e[p]));var m,g=[null,{},[]],b=[[g,-1]];for(p=0;p<f.length;p++){var v=b[b.length-1][0],y=(u=f[p])[0];if(2===y&&/^\//.test(u[1])){var x=b[b.length-1][1];b.length>1&&(b.pop(),b[b.length-1][0][2][x]=n(v[0],v[1],v[2].length?v[2]:void 0))}else if(2===y){var w=[u[1],{},[]];v[2].push(w),b.push([w,v[2].length-1])}else if(5===y||0===y&&5===u[1]){for(var C,k="";p<f.length;p++)if(5===f[p][0])k=o(k,f[p][1]);else{if(0!==f[p][0]||5!==f[p][1])break;if("object"!=typeof f[p][2]||k)k=o(k,f[p][2]);else for(C in f[p][2])f[p][2].hasOwnProperty(C)&&!v[1][C]&&(v[1][C]=f[p][2][C])}11===f[p][0]&&p++;for(var A=p;p<f.length;p++)if(8===f[p][0]||5===f[p][0])v[1][k]?""===f[p][1]||(v[1][k]=o(v[1][k],f[p][1])):v[1][k]=i(f[p][1]);else{if(0!==f[p][0]||8!==f[p][1]&&5!==f[p][1]){!k.length||v[1][k]||p!==A||3!==f[p][0]&&12!==f[p][0]||(v[1][k]=k.toLowerCase()),3===f[p][0]&&p--;break}v[1][k]?""===f[p][2]||(v[1][k]=o(v[1][k],f[p][2])):v[1][k]=i(f[p][2])}}else if(5===y)v[1][u[1]]=!0;else if(0===y&&5===u[1])v[1][u[2]]=!0;else if(3===y)m=v[0],r.test(m)&&b.length&&(x=b[b.length-1][1],b.pop(),b[b.length-1][0][2][x]=n(v[0],v[1],v[2].length?v[2]:void 0));else if(0===y&&1===u[1])void 0===u[2]||null===u[2]?u[2]="":u[2]||(u[2]=o("",u[2])),Array.isArray(u[2][0])?v[2].push.apply(v[2],u[2]):v[2].push(u[2]);else if(1===y)v[2].push(u[1]);else if(11!==y&&12!==y)throw new Error("unhandled: "+y)}if(g[2].length>1&&/^\s*$/.test(g[2][0])&&g[2].shift(),g[2].length>2||2===g[2].length&&/\S/.test(g[2][1])){if(a.createFragment)return a.createFragment(g[2]);throw new Error("multiple root elements must be wrapped in an enclosing tag")}return Array.isArray(g[2][0])&&"string"==typeof g[2][0][0]&&Array.isArray(g[2][0][2])&&(g[2][0]=n(g[2][0][0],g[2][0][1],g[2][0][2])),g[2][0];function S(e){var n=[];7===l&&(l=4);for(var r=0;r<e.length;r++){var o=e.charAt(r);1===l&&"<"===o?(s.length&&n.push([1,s]),s="",l=2):">"!==o||t(l)||13===l?13===l&&/-$/.test(s)&&"-"===o?(a.comments&&n.push([8,s.substr(0,s.length-1)]),s="",l=1):2===l&&/^!--$/.test(s)?(a.comments&&n.push([2,s],[5,"comment"],[11]),s=o,l=13):1===l||13===l?s+=o:2===l&&"/"===o&&s.length||(2===l&&/\s/.test(o)?(s.length&&n.push([2,s]),s="",l=4):2===l?s+=o:4===l&&/[^\s"'=/]/.test(o)?(l=5,s=o):4===l&&/\s/.test(o)?(s.length&&n.push([5,s]),n.push([12])):5===l&&/\s/.test(o)?(n.push([5,s]),s="",l=6):5===l&&"="===o?(n.push([5,s],[11]),s="",l=7):5===l?s+=o:6!==l&&4!==l||"="!==o?6!==l&&4!==l||/\s/.test(o)?7===l&&'"'===o?l=10:7===l&&"'"===o?l=9:10===l&&'"'===o||9===l&&"'"===o?(n.push([8,s],[12]),s="",l=4):7!==l||/\s/.test(o)?8===l&&/\s/.test(o)?(n.push([8,s],[12]),s="",l=4):8!==l&&9!==l&&10!==l||(s+=o):(l=8,r--):(n.push([12]),/[\w-]/.test(o)?(s+=o,l=5):l=4):(n.push([11]),l=7)):(2===l&&s.length?n.push([2,s]):5===l?n.push([5,s]):8===l&&s.length&&n.push([8,s]),n.push([3]),s="",l=1)}return 1===l&&s.length?(n.push([1,s]),s=""):8===l&&s.length||10===l&&s.length||9===l&&s.length?(n.push([8,s]),s=""):5===l&&(n.push([5,s]),s=""),n}};function i(e){return"function"==typeof e||"string"==typeof e||e&&"object"==typeof e||null==e?e:o("",e)}},r=RegExp("^("+["area","base","basefont","bgsound","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr","!--","animate","animateTransform","circle","cursor","desc","ellipse","feBlend","feColorMatrix","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","font-face-format","font-face-name","font-face-uri","glyph","glyphRef","hkern","image","line","missing-glyph","mpath","path","polygon","polyline","rect","set","stop","tref","use","view","vkern"].join("|")+")(?:[.#][a-zA-Z0-9\x7f-\uffff_:-]+)*$"),a=/\n[\s]+$/,o=/^\n[\s]+/,i=/[\s]+$/,l=/^[\s]+/,s=/[\n\s]+/g,c=["a","abbr","b","bdi","bdo","br","cite","data","dfn","em","i","kbd","mark","q","rp","rt","rtc","ruby","s","amp","small","span","strong","sub","sup","time","u","var","wbr"],f=["code","pre","textarea"],p=["svg","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],d=["async","autofocus","autoplay","checked","controls","default","defaultchecked","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","novalidate","open","playsinline","readonly","required","reversed","selected"],u=["indeterminate"],h=function(e){function t(t,n,r){var h;-1!==p.indexOf(t)&&(n.namespace="http://www.w3.org/2000/svg");var m=!1;n.namespace&&(m=n.namespace,delete n.namespace);var g=!1;if(n.is&&(g=n.is,delete n.is),m)h=g?e.createElementNS(m,t,{is:g}):e.createElementNS(m,t);else{if("!--"===t)return e.createComment(n.comment);h=g?e.createElement(t,{is:g}):e.createElement(t)}for(var b in n)if(n.hasOwnProperty(b)){var v=b.toLowerCase(),y=n[b];if("classname"===v&&(v="class",b="class"),"htmlFor"===b&&(b="for"),-1!==d.indexOf(v))if("true"===String(y))y=v;else if("false"===String(y))continue;"on"===v.slice(0,2)||-1!==u.indexOf(v)?h[b]=y:m?"xlink:href"===b?h.setAttributeNS("http://www.w3.org/1999/xlink",b,y):/^xmlns($|:)/i.test(b)||h.setAttributeNS(null,b,y):h.setAttribute(b,y)}return function e(t,n){if(Array.isArray(n))for(var r,p,d=t.nodeName.toLowerCase(),u=!1,h=0,m=n.length;h<m;h++){var g=n[h];if(Array.isArray(g))e(t,g);else{("number"==typeof g||"boolean"==typeof g||"function"==typeof g||g instanceof Date||g instanceof RegExp)&&(g=g.toString());var b=t.childNodes[t.childNodes.length-1];if("string"==typeof g)u=!0,b&&"#text"===b.nodeName?b.nodeValue+=g:(g=t.ownerDocument.createTextNode(g),t.appendChild(g),b=g),h===m-1&&(u=!1,-1===c.indexOf(d)&&-1===f.indexOf(d)?""===(r=b.nodeValue.replace(o,"").replace(i,"").replace(a,"").replace(s," "))?t.removeChild(b):b.nodeValue=r:-1===f.indexOf(d)&&(p=0===h?"":" ",r=b.nodeValue.replace(o,p).replace(l," ").replace(i,"").replace(a,"").replace(s," "),b.nodeValue=r));else if(g&&g.nodeType){u&&(u=!1,-1===c.indexOf(d)&&-1===f.indexOf(d)?""===(r=b.nodeValue.replace(o,"").replace(a," ").replace(s," "))?t.removeChild(b):b.nodeValue=r:-1===f.indexOf(d)&&(r=b.nodeValue.replace(l," ").replace(o,"").replace(a," ").replace(s," "),b.nodeValue=r));var v=g.nodeName;v&&(d=v.toLowerCase()),t.appendChild(g)}}}}(h,r),h}var r=n(t,{comments:!0,createFragment:function t(n){for(var r=e.createDocumentFragment(),a=0;a<n.length;a++)null!=n[a]&&(Array.isArray(n[a])?r.appendChild(t(n[a])):("string"==typeof n[a]&&(n[a]=e.createTextNode(n[a])),r.appendChild(n[a])));return r}});return r.default=r,r.createComment=t,r}(document);const m="(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v[.]?|via|vs[.]?)",g="([!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]*)",b=e=>e.toLowerCase(),v=e=>e.substr(0,1).toUpperCase()+e.substr(1);var y={},x=[],w=[];function C(e,t){if(t=t||{},void 0===e)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var n,r=!0===t.prepend?"prepend":"append",a=void 0!==t.container?t.container:document.querySelector("head"),o=x.indexOf(a);return-1===o&&(o=x.push(a)-1,w[o]={}),void 0!==w[o]&&void 0!==w[o][r]?n=w[o][r]:(n=w[o][r]=function(){var e=document.createElement("style");return e.setAttribute("type","text/css"),e}(),"prepend"===r?a.insertBefore(n,a.childNodes[0]):a.appendChild(n)),65279===e.charCodeAt(0)&&(e=e.substr(1,e.length)),n.styleSheet?n.styleSheet.cssText+=e:n.textContent+=e,n}(y=C).insertCss=C;var k=y;document.title="Capitalize titles in the browser";var A=h`
    <meta content="width=device-width, initial-scale=1" name="viewport">
  `;document.head.appendChild(A);var S=(k(":root {\n    --color-background: #ecdb83;\n    --color-border: #fff;\n    --color-text: #333;\n    --font-monospace: menlo, monaco, monospace;\n    --font-serif: 'hoefler text', 'bitstream charter', georgia, serif;\n  }\n  * {\n    box-sizing: border-box;\n  }\n  ._9faba987 {\n    background-color: var(--color-background);\n    color: var(--color-text);\n    font-family: var(--font-serif);\n    margin: 0;\n    padding: 1rem;\n  }"),"_9faba987");document.body.classList.add(""+S);var _=(k("._87c3d742 {\n    margin-left: auto;\n    margin-right: auto;\n    max-width: 40em;\n  }\n  ._87c3d742 label {\n    display: block;\n    margin-bottom: .5rem;\n  }\n  ._87c3d742 input,._87c3d742 textarea {\n    -webkit-appearance: none;\n    border: transparent;\n    display: block;\n    font-family: var(--font-monospace);\n    font-size: 1.25rem;\n    height: 3rem;\n    padding-left: .5rem;\n    padding-right: .5rem;\n    width: 100%;\n  }\n  ._87c3d742 input {\n    border-radius: .75rem;\n    margin-bottom: 1rem;\n  }\n  ._87c3d742 textarea {\n    border-bottom-left-radius: .75rem;\n    border-bottom-right-radius: 0;\n    border-right: hidden;\n    border-top-left-radius: .75rem;\n    border-top-right-radius: 0;\n    line-height: 2.25;\n    overflow-y: hidden;\n    resize: none;\n    z-index: 1;\n  }\n  ._87c3d742 div {\n    display: flex;\n    margin-bottom: 2rem;\n  }\n  ._87c3d742 button {\n    background-color: var(--color-background);\n    border-bottom-right-radius: .75rem;\n    border-top-right-radius: .75rem;\n    border: .25rem solid var(--color-border);\n    color: var(--color-text);\n    cursor: pointer;\n    font-family: var(--font-monospace);\n    font-size: 1rem;\n    line-height: 1;\n    margin: 0;\n    padding: .5rem 1rem;\n  }\n  ._87c3d742 summary {\n    border-radius: .75rem;\n  }\n  ._87c3d742 summary:hover {\n    cursor: pointer;\n  }\n  ._87c3d742 ul {\n    line-height: 1.5;\n    padding-left: 1rem;\n  }\n  ._87c3d742 code {\n    background-color: #fff;\n    border-radius: .25rem;\n    color: var(--color-text);\n    font-family: var(--font-monospace);\n    font-size: .875rem;\n    padding-left: .25rem;\n    padding-right: .25rem;\n    white-space: nowrap;\n  }"),"_87c3d742"),$=(k("._e9704c50 {\n    margin-bottom: 4rem;\n    text-align: center;\n  }\n  ._e9704c50 h1 {\n    font-size: 3rem;\n    margin-bottom: .5rem;\n    margin-top: 0;\n  }\n  ._e9704c50 h2 {\n    font-size: 1.75rem;\n    margin-bottom: 0;\n    margin-top: 0;\n  }"),"_e9704c50"),E=(k("._8f7114a1 {\n    bottom: 1rem;\n    position: absolute;\n  }\n  ._8f7114a1 a {\n    color: var(--color-text);\n  }"),"_8f7114a1"),L=h`
    <header class=${$}>
      <h1>caps</h1>
      <h2><i>Capitalize titles in the browser</i></h2>
    </header>
  `,O=h`<input autofocus oninput=${function(e){e.target.value=e.target.value.replace(/[\u2013]/g,"-").replace(/[\u2014]/g,"--").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/[\u2022]/g,"*")}} onkeyup=${function(e){F.innerText=(e=>{if(!("string"==typeof(t=e)||t&&"object"==typeof t&&"[object String]"===Object.prototype.toString.call(t)))return;var t;let n=[],r=/[:.;?!] |(?: |^)["\u014c]/g,a=0;for(;;){let t=r.exec(e);if(n.push(e.substring(a,t?t.index:e.length).replace(/\b([A-Za-z][a-z.'\xd5]*)\b/g,e=>/[A-Za-z]\.[A-Za-z]/.test(e)?e:v(e)).replace(RegExp("\\b"+m+"\\b","ig"),b).replace(RegExp("^"+g+m+"\\b","ig"),(e,t,n)=>t+v(n)).replace(RegExp("\\b"+m+g+"$","ig"),v)),a=r.lastIndex,!t)break;n.push(t[0])}return n.join("").replace(/ V(s?)\. /gi,"v$1.").replace(/(['\xd5])S\b/gi,"$1s").replace(/\b(AT&T|Q&A)\b/gi,e=>e.toUpperCase())})(e.target.value)}} type="text">`,F=h`<textarea readonly></textarea>`,z=h`<button onclick=${T}>Copy</button>`,N=h`
    <div>
      ${L}
      ${h`
    <div class=${_}>
      <label>Input:</label>
        ${O}
      <label>Output:</label>
      <div>
        ${F}
        ${z}
      </div>
      <details>
        <summary>Instructions:</summary>
        <ul>
          <li>You can use the key binding <code>Ctrl + v</code> to copy the output.</li>
          <li>Deselect the current field with <code>Esc</code>.</li>
        </ul>
      </details>
    </div>
  `}
      ${h`
    <footer class=${E}>
      <nav>
        <a href="https://github.com/frekyll/caps">View on GitHub</a>
      </nav>
    </footer>
  `}
    </div>
  `;function T(e){F.focus(),F.select(),F.select(0,99999),document.execCommand("copy")}document.body.appendChild(N),document.addEventListener("keydown",(function(e){"Escape"===e.key&&this.activeElement.blur(),e.ctrlKey&&"v"===e.key&&T()}))}();