Repository navigation
Expand file tree
/
Copy pathfeedback.js
More file actions
40 lines (37 loc) · 12.7 KB
/
Copy pathfeedback.js
File metadata and controls
40 lines (37 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";(()=>{var g={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};var I=([e,a,r])=>{let t=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(a).forEach(o=>{t.setAttribute(o,String(a[o]))}),r?.length&&r.forEach(o=>{let i=I(o);t.appendChild(i)}),t},W=(e,a={})=>{let t={...g,...a};return I(["svg",t,e])};var z=(...e)=>e.filter((a,r,t)=>!!a&&a.trim()!==""&&t.indexOf(a)===r).join(" ").trim();var X=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};var N=e=>{let a="",r=!1;for(let t of e){if(t==="-"||t==="_"||t<=" "){r=a.length>0;continue}a.length===0?a+=t.toLowerCase():a+=r?t.toUpperCase():t,r=!1}return a};var K=e=>{let a=N(e);return a.charAt(0).toUpperCase()+a.slice(1)};var oe=e=>Array.from(e.attributes).reduce((a,r)=>(a[r.name]=r.value,a),{}),Z=e=>typeof e=="string"?e:!e||!e.class?"":e.class&&typeof e.class=="string"?e.class.split(" "):e.class&&Array.isArray(e.class)?e.class:"",b=(e,{nameAttr:a,icons:r,attrs:t})=>{let o=e.getAttribute(a);if(o==null)return;let i=K(o),u=r[i];if(!u)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);let n=oe(e),ee=X(n)?{}:{"aria-hidden":"true"},G={...g,"data-lucide":o,...ee,...t,...n},ae=Z(n),re=Z(t),V=z("lucide",`lucide-${o}`,...ae,...re);V&&Object.assign(G,{class:V});let te=W(u,G);return e.parentNode?.replaceChild(te,e)};var M=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]];var D=[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]];var L=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]];var y=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];var B=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];var F=[["circle",{cx:"12",cy:"18",r:"3"}],["circle",{cx:"6",cy:"6",r:"3"}],["circle",{cx:"18",cy:"6",r:"3"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}],["path",{d:"M12 12v3"}]];var v=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}],["path",{d:"M9 18h6"}],["path",{d:"M10 22h4"}]];var T=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}]];var R=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var q=({icons:e={},nameAttr:a="data-lucide",attrs:r={},root:t=document,inTemplates:o}={})=>{if(!Object.values(e).length)throw new Error(`Please provide an icons object.
If you want to use all the icons you can import it like:
\`import { createIcons, icons } from 'lucide';
lucide.createIcons({icons});\``);if(typeof t>"u")throw new Error("`createIcons()` only works in a browser environment.");if(Array.from(t.querySelectorAll(`[${a}]`)).forEach(u=>b(u,{nameAttr:a,icons:e,attrs:r})),o&&Array.from(t.querySelectorAll("template")).forEach(n=>q({icons:e,nameAttr:a,attrs:r,root:n.content,inTemplates:o})),a==="data-lucide"){let u=t.querySelectorAll("[icon-name]");u.length>0&&(console.warn("[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide"),Array.from(u).forEach(n=>b(n,{nameAttr:"icon-name",icons:e,attrs:r})))}};var fe="https://github.com/HuggingMath/TheoremOS",U=`${fe}/issues/new`,Ne=`${U}?template=early-access.yml`;var j=e=>e.toLowerCase().startsWith("en")?"en":"zh";function $(){for(let e of document.querySelectorAll("a.lang-link")){let a=()=>{e.hash=location.hash};for(let r of["pointerdown","mousedown","focus","click","auxclick","contextmenu"])e.addEventListener(r,a)}}var S="theoremos:feedback-draft:v1";function J(e){if(e)try{let a=JSON.parse(e);return!a||a.schema!=="theoremos.feedback-draft.v1"||!["bug","feature","question"].includes(a.kind)||!["","workbench","website","lean","access","other"].includes(a.area)||typeof a.subject!="string"||a.subject.length>100||typeof a.description!="string"||a.description.length>1e4||typeof a.environment!="string"||a.environment.length>240?void 0:{kind:a.kind,area:a.area,subject:a.subject,description:a.description,environment:a.environment}}catch{return}}var Q=e=>JSON.stringify({schema:"theoremos.feedback-draft.v1",...e});q({icons:{ArrowRight:M,ArrowUpRight:D,Bug:L,Copy:y,Download:B,GitFork:F,Lightbulb:v,MessageCircle:T,X:R},attrs:{"aria-hidden":"true"}});var l=e=>{let a=document.getElementById(e);if(!a)throw new Error(`Missing feedback element: ${e}`);return a},le=j(document.documentElement.lang),f={zh:{kinds:{bug:{name:"\u95EE\u9898\u53CD\u9988",prefix:"[Bug]",hint:"\u9644\u4E0A\u590D\u73B0\u6B65\u9AA4\u3001\u9519\u8BEF\u4FE1\u606F\u548C\u9884\u671F\u7ED3\u679C\uFF0C\u65B9\u4FBF\u6392\u67E5\u3002",placeholder:"\u8BF7\u63CF\u8FF0\u9047\u5230\u7684\u95EE\u9898"},feature:{name:"\u529F\u80FD\u5EFA\u8BAE",prefix:"[Feature]",hint:"\u8BF4\u660E\u4F7F\u7528\u573A\u666F\uFF0C\u4EE5\u53CA\u8FD9\u9879\u6539\u8FDB\u80FD\u89E3\u51B3\u7684\u95EE\u9898\u3002",placeholder:"\u4F60\u5E0C\u671B\u589E\u52A0\u6216\u6539\u8FDB\u4EC0\u4E48\uFF1F"},question:{name:"\u4F7F\u7528\u54A8\u8BE2",prefix:"[Question]",hint:"\u9644\u4E0A\u5DF2\u7ECF\u67E5\u9605\u7684\u8D44\u6599\u6216\u5C1D\u8BD5\u8FC7\u7684\u65B9\u6CD5\u3002",placeholder:"\u4F60\u60F3\u4E86\u89E3\u4EC0\u4E48\uFF1F"}},missingSubject:"\u8BF7\u586B\u5199\u53CD\u9988\u6807\u9898\u3002",missingDescription:"\u8BF7\u586B\u5199\u8BE6\u7EC6\u63CF\u8FF0\u3002",headings:{kind:"\u53CD\u9988\u7C7B\u578B",area:"\u76F8\u5173\u4F4D\u7F6E",description:"\u8BE6\u7EC6\u63CF\u8FF0",environment:"\u73AF\u5883\u4E0E\u7248\u672C"},footer:"\u6765\u81EA TheoremOS \u53CD\u9988\u9875\u3002",longNote:"\u5185\u5BB9\u8F83\u957F\uFF0C\u8BF7\u5148\u590D\u5236\u6216\u4E0B\u8F7D\u5168\u6587\uFF0C\u518D\u5230 GitHub \u7C98\u8D34\u53D1\u5E03\u3002",note:"\u5C06\u5728 GitHub \u6253\u5F00\u8349\u7A3F\uFF0C\u63D0\u4EA4\u540E\u516C\u5F00\u3002",copied:"\u5DF2\u590D\u5236\u53CD\u9988\u5168\u6587\u3002",copyFailed:"\u672A\u80FD\u81EA\u52A8\u590D\u5236\uFF0C\u5DF2\u9009\u4E2D\u5168\u6587\uFF0C\u53EF\u624B\u52A8\u590D\u5236\u3002",downloaded:"\u5DF2\u51C6\u5907\u53CD\u9988 Markdown \u4E0B\u8F7D\u3002",draftSaved:"\u8349\u7A3F\u5DF2\u4FDD\u7559\u5728\u6B64\u6807\u7B7E\u9875\u3002",draftRestored:"\u5DF2\u6062\u590D\u4E0A\u6B21\u586B\u5199\u7684\u53CD\u9988\u3002",draftCleared:"\u5DF2\u6E05\u7A7A\u53CD\u9988\u8349\u7A3F\u3002",draftUnavailable:"\u6D4F\u89C8\u5668\u672A\u80FD\u4FDD\u7559\u8349\u7A3F\uFF0C\u79BB\u5F00\u524D\u8BF7\u590D\u5236\u6216\u4E0B\u8F7D\u5168\u6587\u3002",clearConfirm:"\u6E05\u7A7A\u8FD9\u4EFD\u5C1A\u672A\u53D1\u5E03\u7684\u53CD\u9988\uFF1F"},en:{kinds:{bug:{name:"Bug report",prefix:"[Bug]",hint:"Add steps to reproduce, error messages and the expected result.",placeholder:"Describe the problem"},feature:{name:"Feature request",prefix:"[Feature]",hint:"Explain when you would use this and the problem it would solve.",placeholder:"What would you like added or improved?"},question:{name:"Question",prefix:"[Question]",hint:"Add what you have read or tried so far.",placeholder:"What would you like to know?"}},missingSubject:"Enter a title for your feedback.",missingDescription:"Enter a description.",headings:{kind:"Type",area:"Area",description:"Description",environment:"Environment"},footer:"Sent from the TheoremOS feedback page.",longNote:"This is too long for a link. Copy or download the full text, then paste it on GitHub.",note:"A draft opens on GitHub. It becomes public when you submit it there.",copied:"Copied the full text.",copyFailed:"Could not copy automatically. The full text is selected so you can copy it.",downloaded:"The Markdown download is ready.",draftSaved:"Draft saved in this tab.",draftRestored:"Your previous feedback has been restored.",draftCleared:"Feedback draft cleared.",draftUnavailable:"The browser could not save your draft. Copy or download it before leaving.",clearConfirm:"Clear this unpublished feedback?"}}[le],P=f.kinds,c=l("feedback-form"),m=l("feedback-area"),p=l("feedback-subject"),s=l("feedback-description"),x=l("feedback-environment"),Y=l("feedback-review"),d=l("feedback-markdown"),se=l("feedback-github"),k=l("feedback-export-status"),C=l("feedback-draft-status"),_=l("feedback-clear-draft"),w=!1,O=Array.from(c.querySelectorAll('input[name="feedback-kind"]')),h=()=>{let e=O.find(a=>a.checked)?.value;return e&&Object.hasOwn(P,e)?e:"bug"};function A(){let e=P[h()];l("feedback-description-hint").textContent=e.hint,s.placeholder=e.placeholder,p.setCustomValidity(p.value.trim()?"":f.missingSubject),s.setCustomValidity(s.value.trim()?"":f.missingDescription),l("feedback-count").textContent=`${s.value.length} / ${s.maxLength}`,_.disabled=!p.value&&!s.value&&!x.value&&!m.value&&h()==="bug"}function H(){A();let e={kind:h(),area:m.value,subject:p.value,description:s.value,environment:x.value};try{sessionStorage.setItem(S,Q(e)),w=!1,C.textContent=f.draftSaved}catch{w=!0,C.textContent=f.draftUnavailable}}c.addEventListener("input",H);c.addEventListener("change",H);window.addEventListener("beforeunload",e=>{w&&(e.preventDefault(),e.returnValue="")});_.addEventListener("click",()=>{if(!window.confirm(f.clearConfirm))return;try{sessionStorage.removeItem(S)}catch{C.textContent=f.draftUnavailable;return}c.reset(),A(),w=!1,C.textContent=f.draftCleared;let e=new URL(location.href);for(let a of["kind","area","environment"])e.searchParams.delete(a);history.replaceState(null,"",e),p.focus()});c.addEventListener("submit",e=>{if(e.preventDefault(),A(),!c.reportValidity())return;let a=P[h()],r=`${a.prefix} ${p.value.trim()}`,t=[`### ${f.headings.kind}
${a.name}`,`### ${f.headings.area}
${m.selectedOptions[0]?.textContent??m.value}`,`### ${f.headings.description}
${s.value.trim()}`,...x.value.trim()?[`### ${f.headings.environment}
${x.value.trim()}`]:[],`---
${f.footer}`].join(`
`),o=new URL(U);o.searchParams.set("title",r),o.searchParams.set("body",t);let i=o.href.length>7500;i&&o.searchParams.delete("body"),d.value=`# ${r}
${t}
`,l("feedback-review-summary").textContent=r,l("feedback-review-note").textContent=i?f.longNote:f.note,se.href=o.href,k.textContent="",Y.showModal(),d.setSelectionRange(0,0),d.scrollTop=0,d.scrollLeft=0});l("feedback-review-close").addEventListener("click",()=>Y.close());l("feedback-copy").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(d.value),k.textContent=f.copied}catch{d.focus(),d.select(),k.textContent=f.copyFailed}});l("feedback-download").addEventListener("click",()=>{let e=URL.createObjectURL(new Blob([d.value],{type:"text/markdown;charset=utf-8"})),a=document.createElement("a");a.href=e,a.download="theoremos-feedback.md",a.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3),k.textContent=f.downloaded});function ue(e){let a=e.get("kind"),r=e.get("area"),t=e.get("environment");return!a&&!r&&t===null?!1:(a!==null&&O.forEach(o=>{o.checked=o.value===(P[a]?a:"bug")}),r!==null&&(m.value=[...m.options].some(o=>o.value===r&&!o.disabled)?r:""),t!==null&&(x.value=t.replace(/\s+/gu," ").trim().slice(0,x.maxLength)),!0)}var E=!1;try{let e=J(sessionStorage.getItem(S));e&&(O.forEach(a=>{a.checked=a.value===e.kind}),m.value=e.area,p.value=e.subject,s.value=e.description,x.value=e.environment,E=!0,C.textContent=f.draftRestored)}catch{C.textContent=f.draftUnavailable}var de=E&&(p.value.trim()!==""||s.value.trim()!==""),pe=!de&&ue(new URLSearchParams(location.search));(pe||!E&&(m.value||x.value||h()!=="bug"))&&H();A();c.hidden=!1;l("feedback-fallback").hidden=!0;$();document.documentElement.dataset.feedbackReady="true";})();
/*! Bundled license information:
lucide/dist/esm/defaultAttributes.mjs:
lucide/dist/esm/createElement.mjs:
lucide/dist/esm/shared/src/utils/mergeClasses.mjs:
lucide/dist/esm/shared/src/utils/hasA11yProp.mjs:
lucide/dist/esm/shared/src/utils/toCamelCase.mjs:
lucide/dist/esm/shared/src/utils/toPascalCase.mjs:
lucide/dist/esm/replaceElement.mjs:
lucide/dist/esm/icons/arrow-right.mjs:
lucide/dist/esm/icons/arrow-up-right.mjs:
lucide/dist/esm/icons/bug.mjs:
lucide/dist/esm/icons/copy.mjs:
lucide/dist/esm/icons/download.mjs:
lucide/dist/esm/icons/git-fork.mjs:
lucide/dist/esm/icons/lightbulb.mjs:
lucide/dist/esm/icons/message-circle.mjs:
lucide/dist/esm/icons/x.mjs:
lucide/dist/esm/lucide.mjs:
(**
* @license lucide v1.57.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
*/