UNPKG

6.83 kBJavaScriptView Raw
1/*!
2 * The Sutton SignWriting Web Components
3 */
4import{c as t,a as e}from"./p-7486a92a.js";var o=t((function(t,e){!function(t){let e={symbol:"(?:(?:\ud8c0[\udc01-\udfff])|(?:[\ud8c1-\ud8fc][\udc00-\udfff])|(?:\ud8fd[\udc00-\udc80]))",coord:"(?:\ud836[\udc0c-\uddff]){2}",sort:"𝠀",box:"\ud836[\udc01-\udc04]"};e.prefix=`(?:${e.sort}(?:${e.symbol})+)`,e.spatial=`${e.symbol}${e.coord}`,e.signbox=`${e.box}${e.coord}(?:${e.spatial})*`,e.sign=`${e.prefix}?${e.signbox}`,e.sortable=`${e.prefix}${e.signbox}`;let o={colorize:"C",colorhex:"(?:[0-9a-fA-F]{3}){1,2}",colorname:"[a-zA-Z]+",padding:"P[0-9]{2}",zoom:"Z(?:[0-9]+(?:\\.[0-9]+)?|x)",classbase:"-?[_a-zA-Z][_a-zA-Z0-9-]{0,100}",id:"[a-zA-Z][_a-zA-Z0-9-]{0,100}"};o.colorbase=`(?:${o.colorhex}|${o.colorname})`,o.color=`_${o.colorbase}_`,o.colors=`_${o.colorbase}(?:,${o.colorbase})?_`,o.background=`G${o.color}`,o.detail=`D${o.colors}`,o.detailsym=`D[0-9]{2}${o.colors}`,o.classes=`${o.classbase}(?: ${o.classbase})*`,o.full=`-(${o.colorize})?(${o.padding})?(${o.background})?(${o.detail})?(${o.zoom})?(?:-((?:${o.detailsym})*))?(?:-(${o.classes})?!(?:(${o.id})!)?)?`;const n=t=>(new RegExp(`^${o.colorhex}$`).test(t)?"#":"")+t,r=t=>{const e=("string"==typeof t?t.match(new RegExp(`^${o.full}`)):[])||[];return r={colorize:e[1]?!!e[1]:void 0,padding:e[2]?parseInt(e[2].slice(1)):void 0,background:e[3]?n(e[3].slice(2,-1)):void 0,detail:e[4]?e[4].slice(2,-1).split(",").map(n):void 0,zoom:e[5]?"Zx"===e[5]?"x":parseFloat(e[5].slice(1)):void 0,detailsym:e[6]?e[6].match(new RegExp(o.detailsym,"g")).map((t=>{const e=t.split("_"),o=e[1].split(",").map(n);return{index:parseInt(e[0].slice(1)),detail:o}})):void 0,classes:e[7]?e[7]:void 0,id:e[8]?e[8]:void 0},Object.fromEntries(Object.entries(r).filter((([t,e])=>void 0!==e)));var r},i=t=>parseInt(t.codePointAt(0))-120844+250,s=t=>[i(t.slice(0,2)),i(t.slice(2,4))],d=t=>t.map((t=>(t=>String.fromCodePoint(120844+parseInt(t)-250))(t))).join(""),a=t=>parseInt(t.codePointAt(0)),c={symbol:t=>{const n="string"==typeof t?t.match(new RegExp(`^(${e.symbol})(${e.coord})?(${o.full})?`)):void 0;return{symbol:n?n[1]:void 0,coord:n&&n[2]?s(n[2]):void 0,style:n?n[3]:void 0}},sign:t=>{const n="string"==typeof t?t.match(new RegExp(`^(${e.prefix})?(${e.signbox})(${o.full})?`)):void 0;return n?{sequence:n[1]?n[1].slice(2).match(/.{2}/g):void 0,box:n[2].slice(0,2),max:s(n[2].slice(2,6)),spatials:n[2].length<7?void 0:n[2].slice(6).match(/(.{6})/g).map((t=>({symbol:t.slice(0,2),coord:s(t.slice(2))}))),style:n[3]}:{}},text:t=>{if("string"!=typeof t)return[];const n=t.match(new RegExp(`(${e.sign}(${o.full})?|${e.spatial}(${o.full})?)`,"g"));return n?[...n]:[]}},u={symbol:t=>{if("object"==typeof t&&null!==t&&"string"==typeof t.symbol){const n=(t.symbol.match(e.symbol)||[""])[0];if(n){const e=t.coord&&t.coord[0]||"",r=t.coord&&t.coord[1]||"";return n+(e&&r?d([e,r]):"")+("string"==typeof t.style&&(t.style.match(o.full)||[""])[0]||"")}}},sign:t=>{if("object"!=typeof t||null===t)return;let n="string"!=typeof t.box?"𝠃":(t.box+"𝠃").match(e.box);const r=t.max&&t.max[0]||"",i=t.max&&t.max[1]||"",s=r&&i?d([r,i]):void 0;if(!s)return;let a="";t.sequence&&Array.isArray(t.sequence)&&(a=t.sequence.map((t=>(t.match(e.symbol)||[""])[0])).join(""),a=a?"𝠀"+a:"");let c="";return t.spatials&&Array.isArray(t.spatials)&&(c=t.spatials.map((t=>{if("string"==typeof t.symbol){const o=(t.symbol.match(e.symbol)||[""])[0];if(o){const e=t.coord&&t.coord[0]||"",n=t.coord&&t.coord[1]||"",r=e&&n?d([e,n]):"";if(r)return o+r}}return""})).join("")),a+n+s+c+("string"==typeof t.style&&(t.style.match(o.full)||[""])[0]||"")}},l=t=>{let e,o,n,i,s,d,a,u,l=c.sign(t);l.spatials?(i=Math.min(...l.spatials.map((t=>t.coord[0]))),s=l.max[0],e=s-i,d=Math.min(...l.spatials.map((t=>t.coord[1]))),a=l.max[1],o=a-d,n="sign",u=l.box):(l=c.symbol(t),u="𝠃",l.coord?(i=l.coord[0],e=2*(500-i),d=l.coord[1],o=2*(500-d),n="symbol"):(i=490,e=20,d=490,o=20,n="none"));let f=r(l.style);return{minX:i,minY:d,width:e,height:o,segment:n,lane:{"𝠁":0,"𝠂":-1,"𝠃":0,"𝠄":1}[u],padding:f.padding||0,zoom:f.zoom||1}},f={height:500,width:150,offset:50,pad:20,margin:5,dynamic:!1,background:void 0,punctuation:{spacing:!0,pad:30,pull:!0},style:{detail:["black","white"],zoom:1}},p=t=>("object"!=typeof t&&(t={}),{...f,...t,punctuation:{...f.punctuation,...t.punctuation},style:{...f.style,...t.style}}),$=[262145,287201,310433,311201,321761,323489,324257],g={all:[262145,324736],writing:[262145,323488],hand:[262145,287200],movement:[287201,310432],dynamic:[310433,311200],head:[311201,321760],hcenter:[311201,321760],vcenter:[311201,322624],trunk:[321761,322624],limb:[322625,323488],location:[323489,324256],punctuation:[324257,324736]},y=["#0000CC","#CC0000","#FF0099","#006600","#000000","#884411","#FF9900"];t.category=$,t.colorize=t=>{const e=c.symbol(t);let o="#000000";if(e.symbol){const t=a(e.symbol),n=$.findIndex((e=>e>t));o=y[n<0?6:n-1]}return o},t.colors=y,t.columnDefaults=f,t.columnDefaultsMerge=p,t.columns=(t,e)=>{if("string"!=typeof t)return{};const o=p(e);let n=c.text(t),r=0,i=[],s=[],d=0,a=parseInt(o.width/2),u=o.height-o.margin,f=!0,$=!1;for(let t of n){let e=l(t);r+=d,r+=o.punctuation.spacing?"sign"==e.segment?o.pad:0:o.pad,$=r+e.height>u,$&&"symbol"==e.segment&&o.punctuation.pull&&f&&($=!1,f=!1),0==s.length&&($=!1),$&&(r=o.pad,i.push(s),s=[],f=!0),s.push(Object.assign(e,{x:a+o.offset*e.lane-(500-e.minX)*e.zoom*o.style.zoom,y:r,text:t})),r+=e.height*e.zoom*o.style.zoom,d=o.punctuation.spacing?"sign"==e.segment?o.pad:o.punctuation.pad:o.pad}if(s.length&&i.push(s),o.punctuation.pull)for(let t of i){let e=t[t.length-1],n=e.y+e.height-(o.height-o.margin);if(n>0){let e=parseInt(n/t.length)+1;for(let o in t)t[o].y-=e*o+e}}let g=[];for(let t of i){let e=[a-o.offset-o.pad],n=[a+o.offset+o.pad];for(let r of t)e.push(r.x-o.pad),n.push(r.x+r.width+o.pad);e=Math.min(...e),n=Math.max(...n);let r=o.width,i=0;o.dynamic?(r=n-e,i=-e):i=a-parseInt((e+n)/2);for(let e of t)e.x+=i;g.push(r)}return{options:o,widths:g,columns:i}},t.compose=u,t.decode=t=>t.replace(/\\u([0-9A-F]{4})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})),t.encode=t=>t.replace(/[\u007F-\uFFFF]/g,(function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).substr(-4).toUpperCase()})),t.group=[262145,263489,265025,268673,269441,275009,277889,280001,281825,285665,287201,288833,290753,294881,296417,299777,302657,304289,307169,308513,310433,311201,312257,315329,316961,319841,321761,322625,323489,324257],t.info=l,t.isType=(t,e)=>{const o=c.symbol(t);if(o.symbol){const t=a(o.symbol),n=g[e];if(n)return n[0]<=t&&n[1]>=t}return!1},t.kind=[262145,323489,324257],t.pair=t=>[t.charCodeAt(0).toString(16).toUpperCase(),t.charCodeAt(1).toString(16).toUpperCase()],t.parse=c,t.ranges=g,t.re=e,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));export{o as s}
\No newline at end of file