UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

2 lines 1.28 kB
import{__exportAll as e}from"../../_virtual/_rolldown/runtime.min.mjs";import{getFabricWindow as t}from"../env/index.min.mjs";var n=e({capitalize:()=>r,escapeXml:()=>i,graphemeSplit:()=>o});const r=(e,t=!1)=>`${e.charAt(0).toUpperCase()}${t?e.slice(1):e.slice(1).toLowerCase()}`,i=e=>e.toString().replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);let a;const o=e=>{if(a||a||(a=`Intl`in t()&&`Segmenter`in Intl&&new Intl.Segmenter(void 0,{granularity:`grapheme`})),a){let t=a.segment(e);return Array.from(t).map(({segment:e})=>e)}return s(e)},s=e=>{let t=[];for(let n,r=0;r<e.length;r++)!1!==(n=c(e,r))&&t.push(n);return t},c=(e,t)=>{let n=e.charCodeAt(t);if(isNaN(n))return``;if(n<55296||n>57343)return e.charAt(t);if(55296<=n&&n<=56319){if(e.length<=t+1)throw`High surrogate without following low surrogate`;let n=e.charCodeAt(t+1);if(56320>n||n>57343)throw`High surrogate without following low surrogate`;return e.charAt(t)+e.charAt(t+1)}if(t===0)throw`Low surrogate without preceding high surrogate`;let r=e.charCodeAt(t-1);if(55296>r||r>56319)throw`Low surrogate without preceding high surrogate`;return!1};export{i as escapeXml,o as graphemeSplit,n as lang_string_exports}; //# sourceMappingURL=lang_string.min.mjs.map