1 | import { C as CSS, p as plt, w as win, a as promiseResolve, d as doc, N as NAMESPACE } from './index-f826a15c.js';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | const noop = () => {
|
7 |
|
8 | };
|
9 | const IS_DENO_ENV = typeof Deno !== 'undefined';
|
10 | const IS_NODE_ENV = !IS_DENO_ENV &&
|
11 | typeof global !== 'undefined' &&
|
12 | typeof require === 'function' &&
|
13 | !!global.process &&
|
14 | typeof __filename === 'string' &&
|
15 | (!global.origin || typeof global.origin !== 'string');
|
16 | const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows';
|
17 | const getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : () => '/';
|
18 | const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop;
|
19 | const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
|
20 | const patchEsm = () => {
|
21 |
|
22 |
|
23 | if ( !(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) {
|
24 |
|
25 | return import( './css-shim-e7d213b9.js').then(() => {
|
26 | if ((plt.$cssShim$ = win.__cssshim)) {
|
27 | return plt.$cssShim$.i();
|
28 | }
|
29 | else {
|
30 |
|
31 | return 0;
|
32 | }
|
33 | });
|
34 | }
|
35 | return promiseResolve();
|
36 | };
|
37 | const patchBrowser = () => {
|
38 | {
|
39 |
|
40 | plt.$cssShim$ = win.__cssshim;
|
41 | }
|
42 |
|
43 | const scriptElm = Array.from(doc.querySelectorAll('script')).find(s => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute('data-stencil-namespace') === NAMESPACE)
|
44 | ;
|
45 | const opts = scriptElm['data-opts'] || {} ;
|
46 | if ( 'onbeforeload' in scriptElm && !history.scrollRestoration ) {
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | return {
|
55 | then() {
|
56 |
|
57 | },
|
58 | };
|
59 | }
|
60 | {
|
61 | opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
|
62 | {
|
63 | patchDynamicImport(opts.resourcesUrl, scriptElm);
|
64 | }
|
65 | if ( !win.customElements) {
|
66 |
|
67 |
|
68 | return import( './dom-d5f595cc.js').then(() => opts);
|
69 | }
|
70 | }
|
71 | return promiseResolve(opts);
|
72 | };
|
73 | const patchDynamicImport = (base, orgScriptElm) => {
|
74 | const importFunctionName = getDynamicImportFunction(NAMESPACE);
|
75 | try {
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
|
81 | }
|
82 | catch (e) {
|
83 |
|
84 |
|
85 |
|
86 | const moduleMap = new Map();
|
87 | win[importFunctionName] = (src) => {
|
88 | const url = new URL(src, base).href;
|
89 | let mod = moduleMap.get(url);
|
90 | if (!mod) {
|
91 | const script = doc.createElement('script');
|
92 | script.type = 'module';
|
93 | script.crossOrigin = orgScriptElm.crossOrigin;
|
94 | script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
|
95 | mod = new Promise(resolve => {
|
96 | script.onload = () => {
|
97 | resolve(win[importFunctionName].m);
|
98 | script.remove();
|
99 | };
|
100 | });
|
101 | moduleMap.set(url, mod);
|
102 | doc.head.appendChild(script);
|
103 | }
|
104 | return mod;
|
105 | };
|
106 | }
|
107 | };
|
108 |
|
109 |
|
110 | const t=function(t=""){if(!document.getElementById("SgnwFontCss")){const n=document.createElement("style");n.setAttribute("id","SgnwFontCss"),n.appendChild(document.createTextNode(`\n @font-face {\n font-family: "SuttonSignWritingLine";\n src: \n local('SuttonSignWritingLine'),\n ${t?`url('${t}SuttonSignWritingLine.ttf') format('truetype'),`:""}\n url('https://cdn.jsdelivr.net/npm/@sutton-signwriting/font-ttf@1.0.0/font/SuttonSignWritingLine.ttf') format('truetype');\n }\n @font-face {\n font-family: "SuttonSignWritingFill";\n src: \n local('SuttonSignWritingFill'),\n ${t?`url('${t}SuttonSignWritingFill.ttf') format('truetype'),`:""}\n url('https://cdn.jsdelivr.net/npm/@sutton-signwriting/font-ttf@1.0.0/font/SuttonSignWritingFill.ttf') format('truetype');\n }\n @font-face {\n font-family: "SuttonSignWritingOneD";\n src: \n local('SuttonSignWritingOneD'),\n ${t?`url('${t}SuttonSignWritingOneD.ttf') format('truetype'),`:""}\n url('https://cdn.jsdelivr.net/npm/@sutton-signwriting/font-ttf@1.0.0/font/SuttonSignWritingOneD.ttf') format('truetype');\n }\n `)),document.head.appendChild(n);}};let n={};const e=document.createElement("canvas");e.width=152,e.height=152;const i=e.getContext("2d"),o=function(t){if(t in n)return [...n[t]];i.clearRect(0,0,152,152),i.font="60px 'SuttonSignWritingLine'",i.fillText(String.fromCodePoint(t+983040),0,0);const e=i.getImageData(0,0,152,152).data;let o,r,l,f;t:for(o=151;o>=0;o--)for(r=0;r<152;r+=1)for(f=0;f<4;f+=1)if(l=4*o+4*r*152+f,e[l])break t;var c=o;t:for(r=151;r>=0;r--)for(o=0;o<c;o+=1)for(f=0;f<4;f+=1)if(l=4*o+4*r*152+f,e[l])break t;var u=r+1;if(c=Math.ceil(c/2),u=Math.ceil(u/2),14394==t&&(c=19),[10468,10480,10496,10512,10500,10532,10548,10862,10878,10894,11058,11074,11476,11488,11492,11504,11508,11520,10516,10910,10926,11042,11082,10942].includes(t)&&(c=20),31921==t&&(c=22),38460==t&&(c=23),[20164,20212].includes(t)&&(c=25),31894==t&&(c=28),46698==t&&(c=29),29606==t&&(c=30),44855==t&&(c=40),32667==t&&(c=50),[11088,11474,11490,11506].includes(t)&&(u=20),6285==t&&(u=21),40804==t&&(u=31),41475==t&&(u=36),0==c&&0==u){const n={9:[15,30],10:[21,30],11:[30,15],12:[30,21],13:[15,30],14:[21,30]};t in n&&(c=n[t][0],u=n[t][1]);}return 0!=c||0!=u?(n[t]=[c,u],[c,u]):void 0},l=function(t){return String.fromCodePoint(t+1048576)},c=function(t){let n=!1,e=!1;u(()=>{n=!0;}),a(()=>{e=!0;});const i=setInterval((function(){n&&e&&(clearInterval(i),t());}),100);},u=function(t){if(o(1))t();else {const n=setInterval((function(){o(1)&&(clearInterval(n),t());}),100);}},a=function(t){const n=function(){const t=document.createElement("canvas");t.width=15,t.height=30;const n=t.getContext("2d");n.font="30px 'SuttonSignWritingFill'",n.fillText(l(1),0,0);return !n.getImageData(0,0,15,30).data.every(t=>0===t)};if(n())t();else {const e=setInterval((function(){n()&&(clearInterval(e),t());}),100);}};
|
111 |
|
112 |
|
113 | window['sgnw'] = false;
|
114 | const event = new Event('sgnw');
|
115 | function appGlobalScript () {
|
116 | t();
|
117 | c(() => {
|
118 | window['sgnw'] = true;
|
119 | window.dispatchEvent(event);
|
120 | });
|
121 | }
|
122 |
|
123 | const globalScripts = appGlobalScript;
|
124 |
|
125 | export { patchEsm as a, globalScripts as g, patchBrowser as p };
|