@arbetsformedlingen/yrkesvaljaren 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +369 -0
- package/dist/cjs/af-validation-message-BzY5H0xU.js +16 -0
- package/dist/cjs/core-selector.cjs.entry.js +476 -0
- package/dist/cjs/digi-service-job-selector.cjs.entry.js +1619 -0
- package/dist/cjs/fuse-BTLNKxuL.js +1631 -0
- package/dist/cjs/geo-valjaren.cjs.entry.js +14910 -0
- package/dist/cjs/index-BOuTGlEp.js +1817 -0
- package/dist/cjs/index.cjs.js +14 -0
- package/dist/cjs/job-selector-demo.cjs.entry.js +692 -0
- package/dist/cjs/loader.cjs.js +12 -0
- package/dist/cjs/neobrutal-search.cjs.entry.js +171 -0
- package/dist/cjs/search.engine-D0cMelRi.js +489 -0
- package/dist/cjs/taxonomy-registry-DVmuDUpM.js +435 -0
- package/dist/cjs/types-CtHBl6Ra.js +14 -0
- package/dist/cjs/yrkesvaljaren.cjs.js +24 -0
- package/dist/collection/collection-manifest.json +15 -0
- package/dist/collection/components/core-selector/core-selector.css +803 -0
- package/dist/collection/components/core-selector/core-selector.js +761 -0
- package/dist/collection/components/core-selector/types.js +1 -0
- package/dist/collection/components/design-compat/af-icon.js +13 -0
- package/dist/collection/components/design-compat/af-label.js +2 -0
- package/dist/collection/components/design-compat/af-tag.js +6 -0
- package/dist/collection/components/design-compat/af-validation-message.js +11 -0
- package/dist/collection/components/design-compat/index.js +4 -0
- package/dist/collection/components/geovaljaren/geovaljaren.css +21 -0
- package/dist/collection/components/geovaljaren/geovaljaren.js +304 -0
- package/dist/collection/components/geovaljaren/logic/adapter.utils.js +20 -0
- package/dist/collection/components/geovaljaren/logic/data.utils.js +12 -0
- package/dist/collection/components/geovaljaren/logic/history-service.js +25 -0
- package/dist/collection/components/geovaljaren/logic/search.engine.js +28 -0
- package/dist/collection/components/job-selector/constants.js +26 -0
- package/dist/collection/components/job-selector/history-service.js +41 -0
- package/dist/collection/components/job-selector/job-selector-controller.js +835 -0
- package/dist/collection/components/job-selector/job-selector.css +318 -0
- package/dist/collection/components/job-selector/job-selector.js +1378 -0
- package/dist/collection/components/job-selector/keyboard-handlers.js +84 -0
- package/dist/collection/components/job-selector/logic/adapter.utils.js +75 -0
- package/dist/collection/components/job-selector/logic/label-formatter.js +118 -0
- package/dist/collection/components/job-selector/logic/search.engine.js +50 -0
- package/dist/collection/components/job-selector/search-logic.js +35 -0
- package/dist/collection/components/job-selector/search.utils.js +224 -0
- package/dist/collection/components/job-selector/suggestions-list.js +31 -0
- package/dist/collection/components/job-selector/taxonomy-registry.js +60 -0
- package/dist/collection/components/job-selector/test-data.mock.js +33 -0
- package/dist/collection/components/job-selector/types.js +10 -0
- package/dist/collection/components/job-selector/validation-message.js +24 -0
- package/dist/collection/demo-data.js +20 -0
- package/dist/collection/index.js +7 -0
- package/dist/collection/verkstad/verkstad.js +407 -0
- package/dist/components/core-selector.d.ts +11 -0
- package/dist/components/core-selector.js +1 -0
- package/dist/components/core-selector2.js +1 -0
- package/dist/components/digi-service-job-selector.d.ts +11 -0
- package/dist/components/digi-service-job-selector.js +1 -0
- package/dist/components/fuse.js +1 -0
- package/dist/components/geo-valjaren.d.ts +11 -0
- package/dist/components/geo-valjaren.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/job-selector-demo.d.ts +11 -0
- package/dist/components/job-selector-demo.js +1 -0
- package/dist/components/job-selector.js +1 -0
- package/dist/components/neobrutal-search.d.ts +11 -0
- package/dist/components/neobrutal-search.js +1 -0
- package/dist/components/search.engine.js +1 -0
- package/dist/components/types.js +1 -0
- package/dist/esm/af-validation-message-F8NIH2rC.js +14 -0
- package/dist/esm/core-selector.entry.js +474 -0
- package/dist/esm/digi-service-job-selector.entry.js +1617 -0
- package/dist/esm/fuse-BPnhMTul.js +1629 -0
- package/dist/esm/geo-valjaren.entry.js +14908 -0
- package/dist/esm/index-CGXZllj2.js +1806 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/job-selector-demo.entry.js +690 -0
- package/dist/esm/loader.js +10 -0
- package/dist/esm/neobrutal-search.entry.js +169 -0
- package/dist/esm/search.engine-nZ7AcXba.js +479 -0
- package/dist/esm/taxonomy-registry-Dw0VR9Aw.js +430 -0
- package/dist/esm/types-DHUftoZJ.js +12 -0
- package/dist/esm/yrkesvaljaren.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/core-selector/core-selector.d.ts +46 -0
- package/dist/types/components/core-selector/types.d.ts +1 -0
- package/dist/types/components/design-compat/af-icon.d.ts +7 -0
- package/dist/types/components/design-compat/af-label.d.ts +8 -0
- package/dist/types/components/design-compat/af-tag.d.ts +8 -0
- package/dist/types/components/design-compat/af-validation-message.d.ts +9 -0
- package/dist/types/components/design-compat/index.d.ts +5 -0
- package/dist/types/components/geovaljaren/geovaljaren.d.ts +24 -0
- package/dist/types/components/geovaljaren/logic/adapter.utils.d.ts +7 -0
- package/dist/types/components/geovaljaren/logic/data.utils.d.ts +7 -0
- package/dist/types/components/geovaljaren/logic/history-service.d.ts +6 -0
- package/dist/types/components/geovaljaren/logic/search.engine.d.ts +7 -0
- package/dist/types/components/job-selector/ambient.d.ts +4 -0
- package/dist/types/components/job-selector/constants.d.ts +13 -0
- package/dist/types/components/job-selector/history-service.d.ts +6 -0
- package/dist/types/components/job-selector/job-selector-controller.d.ts +82 -0
- package/dist/types/components/job-selector/job-selector.d.ts +140 -0
- package/dist/types/components/job-selector/keyboard-handlers.d.ts +13 -0
- package/dist/types/components/job-selector/logic/adapter.utils.d.ts +12 -0
- package/dist/types/components/job-selector/logic/label-formatter.d.ts +4 -0
- package/dist/types/components/job-selector/logic/search.engine.d.ts +21 -0
- package/dist/types/components/job-selector/search-logic.d.ts +17 -0
- package/dist/types/components/job-selector/search.utils.d.ts +10 -0
- package/dist/types/components/job-selector/suggestions-list.d.ts +13 -0
- package/dist/types/components/job-selector/taxonomy-registry.d.ts +20 -0
- package/dist/types/components/job-selector/test-data.mock.d.ts +7 -0
- package/dist/types/components/job-selector/types.d.ts +107 -0
- package/dist/types/components/job-selector/validation-message.d.ts +8 -0
- package/dist/types/components/job-selector-demo/job-selector-demo.d.ts +55 -0
- package/dist/types/components/neobrutal-search/neobrutal-search.d.ts +18 -0
- package/dist/types/components.d.ts +425 -0
- package/dist/types/demo-data.d.ts +16 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/stencil-public-runtime.d.ts +1873 -0
- package/dist/types/verkstad/verkstad.d.ts +1 -0
- package/dist/yrkesvaljaren/fuse-B0eHOxow.js.map +1 -0
- package/dist/yrkesvaljaren/index-Cy4BCo5s.js.map +1 -0
- package/dist/yrkesvaljaren/index-DfJXTQqL.js.map +1 -0
- package/dist/yrkesvaljaren/index.esm.js +1 -0
- package/dist/yrkesvaljaren/index.esm.js.map +1 -0
- package/dist/yrkesvaljaren/p-16636162.entry.js +1 -0
- package/dist/yrkesvaljaren/p-273cf6df.entry.js +1 -0
- package/dist/yrkesvaljaren/p-9e48afa4.entry.js +1 -0
- package/dist/yrkesvaljaren/p-BPnhMTul.js +1 -0
- package/dist/yrkesvaljaren/p-CGXZllj2.js +3 -0
- package/dist/yrkesvaljaren/p-DHUftoZJ.js +1 -0
- package/dist/yrkesvaljaren/p-DYFAzvqX.js +1 -0
- package/dist/yrkesvaljaren/p-Dw0VR9Aw.js +1 -0
- package/dist/yrkesvaljaren/p-aef7b5ae.entry.js +1 -0
- package/dist/yrkesvaljaren/p-b0f16abd.entry.js +1 -0
- package/dist/yrkesvaljaren/p-uBrs3sSs.js +1 -0
- package/dist/yrkesvaljaren/search.engine-DPT6roRm.js.map +1 -0
- package/dist/yrkesvaljaren/taxonomy-registry-s5khf6s4.js.map +1 -0
- package/dist/yrkesvaljaren/types-DHUftoZJ.js.map +1 -0
- package/dist/yrkesvaljaren/yrkesvaljaren.css +1 -0
- package/dist/yrkesvaljaren/yrkesvaljaren.esm.js +1 -0
- package/dist/yrkesvaljaren/yrkesvaljaren.esm.js.map +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +126 -0
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
import { r as registerInstance, a as getElement, h, F as Fragment, H as Host } from './index-CGXZllj2.js';
|
|
2
|
+
import { r as registerTaxonomy } from './taxonomy-registry-Dw0VR9Aw.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* marked v18.0.10 - a markdown parser
|
|
6
|
+
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
7
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
8
|
+
* https://github.com/markedjs/marked
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* DO NOT EDIT THIS FILE
|
|
13
|
+
* The code in this file is generated from files in ./src/
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
function C(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var R=C();function j(l){R=l;}var z={exec:()=>null};function A(l){let e=[];return t=>{let n=Math.max(0,Math.min(3,t-1)),s=e[n];return s||(s=l(n),e[n]=s),s}}function d(l,e=""){let t=typeof l=="string"?l:l.source,n={replace:(s,r)=>{let i=typeof r=="string"?r:r.source;return i=i.replace(m.caret,"$1"),t=t.replace(s,i),n},getRegex:()=>new RegExp(t,e)};return n}var Te=((l="")=>{try{return !!new RegExp("(?<=1)(?<!1)"+l)}catch{return false}})(),m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:A(l=>new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:A(l=>new RegExp(`^ {0,${l}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:A(l=>new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),headingBeginRegex:A(l=>new RegExp(`^ {0,${l}}#`)),htmlBeginRegex:A(l=>new RegExp(`^ {0,${l}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:A(l=>new RegExp(`^ {0,${l}}>`))},Oe=/^(?:[ \t]*(?:\n|$))+/,we=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ye=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,q=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,U=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,oe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ae=d(oe).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Se=d(oe).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),K=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,_e=/^[^\n]+/,W=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$e=d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",W).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Le=d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,U).getRegex(),Q="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",X=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Me=d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",X).replace("tag",Q).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le=l=>d(K).replace("hr",q).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",l).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex(),ze=le(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ee=le(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ce=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ee).getRegex(),J={blockquote:Ce,code:we,def:$e,fences:ye,heading:Pe,hr:q,html:Me,lheading:ae,list:Le,newline:Oe,paragraph:ze,table:z,text:_e},se=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",q).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex(),Ae={...J,lheading:Se,table:se,paragraph:d(K).replace("hr",q).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",se).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex()},Ie={...J,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",X).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(K).replace("hr",q).replace("heading",` *#{1,6} *[^
|
|
17
|
+
]`).replace("lheading",ae).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Be=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,De=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pe=/^( {2,}|\\)\n(?!\s*$)/,qe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_=/[\p{P}\p{S}]/u,I=/[\s\p{P}\p{S}]/u,v=/[^\s\p{P}\p{S}]/u,ve=d(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,I).getRegex(),He=/[\p{Pi}\p{Ps}"']/u,ue=/(?!~)[\p{P}\p{S}]/u,Ze=/(?!~)[\s\p{P}\p{S}]/u,Ge=/(?:[^\s\p{P}\p{S}]|~)/u,Qe=d(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Te?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ce=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ne=d(ce,"u").replace(/punct/g,_).getRegex(),je=d(ce,"u").replace(/punct/g,ue).getRegex(),Fe=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Ue=d(Fe,"u").replace(/openQuote/g,He).replace(/punct/g,_).getRegex(),he="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ke=d(he,"gu").replace(/notPunctSpace/g,v).replace(/punctSpace/g,I).replace(/punct/g,_).getRegex(),We=d(he,"gu").replace(/notPunctSpace/g,Ge).replace(/punctSpace/g,Ze).replace(/punct/g,ue).getRegex(),Xe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Je=d(Xe,"gu").replace(/notPunctSpace/g,v).replace(/punctSpace/g,I).replace(/punct/g,_).getRegex(),Ve=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,v).replace(/punctSpace/g,I).replace(/punct/g,_).getRegex(),Ye="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",et=d(Ye,"gu").replace(/notPunctSpace/g,v).replace(/punctSpace/g,I).replace(/punct/g,_).getRegex(),tt=d(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_).getRegex(),nt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",rt=d(nt,"gu").replace(/notPunctSpace/g,v).replace(/punctSpace/g,I).replace(/punct/g,_).getRegex(),st=d(/\\(punct)/,"gu").replace(/punct/g,_).getRegex(),it=d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ot=d(X).replace("(?:-->|$)","-->").getRegex(),at=d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ot).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),G=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,lt=d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",G).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),de=d(/^!?\[(label)\]\[(ref)\]/).replace("label",G).replace("ref",W).getRegex(),ke=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",W).getRegex(),pt=d("reflink|nolink(?!\\()","g").replace("reflink",de).replace("nolink",ke).getRegex(),ie=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,V={_backpedal:z,anyPunctuation:st,autolink:it,blockSkip:Qe,br:pe,code:De,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:Ne,emStrongRDelimAst:Ke,emStrongRDelimUnd:Ve,escape:Be,link:lt,nolink:ke,punctuation:ve,reflink:de,reflinkSearch:pt,tag:at,text:qe,url:z},ut={...V,emStrongLDelim:Ue,emStrongRDelimAst:Je,emStrongRDelimUnd:et,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",G).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",G).getRegex()},F={...V,emStrongRDelimAst:We,emStrongLDelim:je,delLDelim:tt,delRDelim:rt,url:d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ie).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:d(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ie).getRegex()},ct={...F,br:d(pe).replace("{2,}","*").getRegex(),text:d(F.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},H={normal:J,gfm:Ae,pedantic:Ie},B={normal:V,gfm:F,breaks:ct,pedantic:ut};var ht={"&":"&","<":"<",">":">",'"':""","'":"'"},ge=l=>ht[l];function O(l,e){if(e){if(m.escapeTest.test(l))return l.replace(m.escapeReplace,ge)}else if(m.escapeTestNoEncode.test(l))return l.replace(m.escapeReplaceNoEncode,ge);return l}function Y(l){try{l=encodeURI(l).replace(m.percentDecode,"%");}catch{return null}return l}function ee(l,e){let t=l.replace(m.findPipe,(r,i,o)=>{let p=false,a=i;for(;--a>=0&&o[a]==="\\";)p=!p;return p?"|":" |"}),n=t.split(m.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(m.slashPipe,"|");return n}function $(l,e,t){let n=l.length;if(n===0)return "";let s=0;for(;s<n;){let r=l.charAt(n-s-1);if(r===e&&true)s++;else break}return l.slice(0,n-s)}function te(l){let e=l.split(`
|
|
18
|
+
`),t=e.length-1;for(;t>=0&&m.blankLine.test(e[t]);)t--;return e.length-t<=2?l:e.slice(0,t+1).join(`
|
|
19
|
+
`)}function fe(l,e){if(l.indexOf(e[1])===-1)return -1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function me(l,e=0){let t=e,n="";for(let s of l)if(s===" "){let r=4-t%4;n+=" ".repeat(r),t+=r;}else n+=s,t++;return n}function xe(l,e,t,n,s){let r=e.href,i=e.title||null,o=l[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=true;let p={type:l[0].charAt(0)==="!"?"image":"link",raw:t,href:r,title:i,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=false,p}function dt(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
|
|
20
|
+
`).map(r=>{let i=r.match(t.other.beginningSpace);if(i===null)return r;let[o]=i;return o.length>=s.length?r.slice(s.length):r}).join(`
|
|
21
|
+
`)}var y=class{options;rules;lexer;constructor(e){this.options=e||R;}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return {type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:te(t[0]),s=n.replace(this.rules.other.codeRemoveIndent,"");return {type:"code",raw:n,codeBlockStyle:"indented",text:s}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=dt(n,t[3]||"",this.rules);return {type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=$(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim());}return {type:"heading",raw:$(t[0],`
|
|
22
|
+
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return {type:"hr",raw:$(t[0],`
|
|
23
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=$(t[0],`
|
|
24
|
+
`).split(`
|
|
25
|
+
`),s="",r="",i=[];for(;n.length>0;){let o=false,p=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))p.push(n[a]),o=true;else if(!o)p.push(n[a]);else break;n=n.slice(a);let u=p.join(`
|
|
26
|
+
`),c=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
27
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
28
|
+
${u}`:u,r=r?`${r}
|
|
29
|
+
${c}`:c;let h=this.lexer.state.top;if(this.lexer.state.top=true,this.lexer.blockTokens(c,i,true),this.lexer.state.top=h,n.length===0)break;let k=i.at(-1);if(k?.type==="code")break;if(k?.type==="blockquote"){let T=k,g=n.join(`
|
|
30
|
+
`),w=T.raw+`
|
|
31
|
+
`+g.replace(this.rules.other.blockquoteSetextReplace2,""),M=this.blockquote(w);i[i.length-1]=M,s=`${s}
|
|
32
|
+
${g}`,r=r.substring(0,r.length-T.text.length)+M.text;break}else if(k?.type==="list"){let T=k,g=T.raw+`
|
|
33
|
+
`+n.join(`
|
|
34
|
+
`),w=this.list(g);i[i.length-1]=w,s=s.substring(0,s.length-k.raw.length)+w.raw,r=r.substring(0,r.length-T.raw.length)+w.raw,n=g.substring(i.at(-1).raw.length).split(`
|
|
35
|
+
`);continue}}return {type:"blockquote",raw:s,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:false,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let i=this.rules.other.listItemRegex(n),o=false;for(;e;){let a=false,u="",c="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let h=me(t[2].split(`
|
|
36
|
+
`,1)[0],t[1].length),k=e.split(`
|
|
37
|
+
`,1)[0],T=!h.trim(),g=0;if(this.options.pedantic?(g=2,c=h.trimStart()):T?g=t[1].length+1:(g=h.search(this.rules.other.nonSpaceChar),g=g>4?1:g,c=h.slice(g),g+=t[1].length),T&&this.rules.other.blankLine.test(k)&&(u+=k+`
|
|
38
|
+
`,e=e.substring(k.length+1),a=true),!a){let w=this.rules.other.nextBulletRegex(g),M=this.rules.other.hrRegex(g),ne=this.rules.other.fencesBeginRegex(g),re=this.rules.other.headingBeginRegex(g),be=this.rules.other.htmlBeginRegex(g),Re=this.rules.other.blockquoteBeginRegex(g);for(;e;){let N=e.split(`
|
|
39
|
+
`,1)[0],D;if(k=N,this.options.pedantic?(k=k.replace(this.rules.other.listReplaceNesting," "),D=k):D=k.replace(this.rules.other.tabCharGlobal," "),ne.test(k)||re.test(k)||be.test(k)||Re.test(k)||w.test(k)||M.test(k))break;if(D.search(this.rules.other.nonSpaceChar)>=g||!k.trim())c+=`
|
|
40
|
+
`+D.slice(g);else {if(T||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ne.test(h)||re.test(h)||M.test(h))break;c+=`
|
|
41
|
+
`+k;}T=!k.trim(),u+=N+`
|
|
42
|
+
`,e=e.substring(N.length+1),h=D.slice(g);}}r.loose||(o?r.loose=true:this.rules.other.doubleBlankLine.test(u)&&(o=true)),r.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:false,text:c,tokens:[]}),r.raw+=u;}let p=r.items.at(-1);if(p)p.raw=p.raw.trimEnd(),p.text=p.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items)if(this.lexer.state.top=false,a.tokens=this.lexer.blockTokens(a.text,[]),!r.loose){let u=a.tokens.filter(h=>h.type==="space"),c=u.length>0&&u.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=c;}for(let a of r.items){let u=a.tokens[0];if(a.task&&(u?.type==="text"||u?.type==="paragraph")){a.text=a.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let h={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=h.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=h.raw+a.tokens[0].raw,a.tokens[0].text=h.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(h)):a.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):a.tokens.unshift(h);}}else a.task&&(a.task=false);}if(r.loose)for(let a of r.items){a.loose=true;for(let u of a.tokens)u.type==="text"&&(u.type="paragraph");}return r}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=te(t[0]);return {type:"html",block:true,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return {type:"def",tag:n,raw:$(t[0],`
|
|
43
|
+
`),href:s,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ee(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
44
|
+
`):[],i={type:"table",raw:$(t[0],`
|
|
45
|
+
`),header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<n.length;o++)i.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:true,align:i.align[o]});for(let o of r)i.rows.push(ee(o,i.header.length).map((p,a)=>({text:p,tokens:this.lexer.inline(p),header:false,align:i.align[a]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return {type:"heading",raw:$(t[0],`
|
|
46
|
+
`),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
47
|
+
`?t[1].slice(0,-1):t[1];return {type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return {type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return {type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return !this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=true:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=false),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=true:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=false),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=$(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else {let i=fe(t[2],"()");if(i===-2)return;if(i>-1){let p=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,p).trim(),t[3]="";}}let s=t[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3]);}else r=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),xe(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[s.toLowerCase()];if(!r){let i=n[0].charAt(0);return {type:"text",raw:i,text:i}}return xe(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[3]||"")||!n||this.rules.inline.punctuation.exec(n)){let i=[...s[0]].length-1,o,p,a=i,u=0,c=s[0][0],h=n===c,k=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(k.lastIndex=0,t=t.slice(-1*e.length+i);(s=k.exec(t))!==null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(p=[...o].length,s[3]||s[4]){a+=p;continue}else if(s[5]||s[6]){if(i%3&&!((i+p)%3)){u+=p;continue}if(h)break}if(a-=p,a>0)continue;p=Math.min(p,p+a+u);let T=[...s[0]][0].length,g=e.slice(0,i+s.index+T+p);if(Math.min(i,p)%2){let M=g.slice(1,-1);return {type:"em",raw:g,text:M,tokens:this.lexer.inlineTokens(M)}}let w=g.slice(2,-2);return {type:"strong",raw:g,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return {type:"br",raw:t[0]}}del(e,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(!s)return;if(!(s[1]||"")||!n||this.rules.inline.punctuation.exec(n)){let i=[...s[0]].length-1,o,p,a=i,u=this.rules.inline.delRDelim;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(s=u.exec(t))!==null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o||(p=[...o].length,p!==i))continue;if(s[3]||s[4]){a+=p;continue}if(a-=p,a>0)continue;p=Math.min(p,p+a);let c=[...s[0]][0].length,h=e.slice(0,i+s.index+c+p),k=h.slice(i,-i);return {type:"del",raw:h,text:k,tokens:this.lexer.inlineTokens(k)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else {let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0];}return {type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return {type:"text",raw:t[0],text:t[0],escaped:n}}}};var x=class l{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||R,this.options.tokenizer=this.options.tokenizer||new y,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:false,inRawBlock:false,top:true};let t={other:m,block:H.normal,inline:B.normal};this.options.pedantic?(t.block=H.pedantic,t.inline=B.pedantic):this.options.gfm&&(t.block=H.gfm,this.options.breaks?t.inline=B.breaks:t.inline=B.gfm),this.tokenizer.rules=t;}static get rules(){return {block:H,inline:B}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){return new l(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
|
|
48
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens);}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=false){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));let s=1/0;for(;e;){if(e.length<s)s=e.length;else {this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(o=>(r=o.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),true):false))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let o=t.at(-1);r.raw.length===1&&o!==void 0?o.raw+=`
|
|
49
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
50
|
+
`)?"":`
|
|
51
|
+
`)+r.raw,o.text+=`
|
|
52
|
+
`+r.text,this.inlineQueue.at(-1).src=o.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
53
|
+
`)?"":`
|
|
54
|
+
`)+r.raw,o.text+=`
|
|
55
|
+
`+r.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let o=1/0,p=e.slice(1),a;this.options.extensions.startBlock.forEach(u=>{a=u.call({lexer:this},p),typeof a=="number"&&a>=0&&(o=Math.min(o,a));}),o<1/0&&o>=0&&(i=e.substring(0,o+1));}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let o=t.at(-1);n&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
56
|
+
`)?"":`
|
|
57
|
+
`)+r.raw,o.text+=`
|
|
58
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
59
|
+
`)?"":`
|
|
60
|
+
`)+r.raw,o.text+=`
|
|
61
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=true,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links){let o=Object.keys(this.tokens.links);o.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,p=>o.includes(p.slice(p.lastIndexOf("[")+1,-1))?"["+"a".repeat(p.length-2)+"]":p));}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,o=>"+".repeat(o.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(o,p,a)=>{let u=a?a.length:0;return o.slice(0,u)+"["+"a".repeat(o.length-u-2)+"]"}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let s=false,r="",i=1/0;for(;e;){if(e.length<i)i=e.length;else {this.infiniteLoopError(e.charCodeAt(0));break}s||(r=""),s=false;let o;if(this.options.extensions?.inline?.some(a=>(o=a.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),true):false))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let a=t.at(-1);o.type==="text"&&a?.type==="text"?(a.raw+=o.raw,a.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let p=e;if(this.options.extensions?.startInline){let a=1/0,u=e.slice(1),c;this.options.extensions.startInline.forEach(h=>{c=h.call({lexer:this},u),typeof c=="number"&&c>=0&&(a=Math.min(a,c));}),a<1/0&&a>=0&&(p=e.substring(0,a+1));}if(o=this.tokenizer.inlineText(p)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(r=o.raw.slice(-1)),s=true;let a=t.at(-1);a?.type==="text"?(a.raw+=o.raw,a.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}};var P=class{options;parser;constructor(e){this.options=e||R;}space(e){return ""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(m.notSpaceStart)?.[0],r=e.replace(m.endingNewline,"")+`
|
|
62
|
+
`;return s?'<pre><code class="language-'+O(s)+'">'+(n?r:O(r,true))+`</code></pre>
|
|
63
|
+
`:"<pre><code>"+(n?r:O(r,true))+`</code></pre>
|
|
64
|
+
`}blockquote({tokens:e}){return `<blockquote>
|
|
65
|
+
${this.parser.parse(e)}</blockquote>
|
|
66
|
+
`}html({text:e}){return e}def(e){return ""}heading({tokens:e,depth:t}){return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
67
|
+
`}hr(e){return `<hr>
|
|
68
|
+
`}list(e){let t=e.ordered,n=e.start,s="";for(let o=0;o<e.items.length;o++){let p=e.items[o];s+=this.listitem(p);}let r=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return "<"+r+i+`>
|
|
69
|
+
`+s+"</"+r+`>
|
|
70
|
+
`}listitem(e){return `<li>${this.parser.parse(e.tokens)}</li>
|
|
71
|
+
`}checkbox({checked:e}){return "<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return `<p>${this.parser.parseInline(e)}</p>
|
|
72
|
+
`}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let s="";for(let r=0;r<e.rows.length;r++){let i=e.rows[r];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);s+=this.tablerow({text:n});}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
73
|
+
<thead>
|
|
74
|
+
`+t+`</thead>
|
|
75
|
+
`+s+`</table>
|
|
76
|
+
`}tablerow({text:e}){return `<tr>
|
|
77
|
+
${e}</tr>
|
|
78
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return (e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
79
|
+
`}strong({tokens:e}){return `<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return `<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return `<code>${O(e,true)}</code>`}br(e){return "<br>"}del({tokens:e}){return `<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),r=Y(e);if(r===null)return s;e=r;let i='<a href="'+e+'"';return t&&(i+=' title="'+O(t)+'"'),i+=">"+s+"</a>",i}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=Y(e);if(r===null)return O(n);e=r;let i=`<img src="${e}" alt="${O(n)}"`;return t&&(i+=` title="${O(t)}"`),i+=">",i}text(e){return "tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:O(e.text)}};var L=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return ""+e}image({text:e}){return ""+e}br(){return ""}checkbox({raw:e}){return e}};var b=class l{options;renderer;textRenderer;constructor(e){this.options=e||R,this.options.renderer=this.options.renderer||new P,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new L;}static parse(e,t){return new l(t).parse(e)}static parseInline(e,t){return new l(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let s=e[n];if(this.options.extensions?.renderers?.[s.type]){let i=s,o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==false||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(i.type)){t+=o||"";continue}}let r=s;switch(r.type){case "space":{t+=this.renderer.space(r);break}case "hr":{t+=this.renderer.hr(r);break}case "heading":{t+=this.renderer.heading(r);break}case "code":{t+=this.renderer.code(r);break}case "table":{t+=this.renderer.table(r);break}case "blockquote":{t+=this.renderer.blockquote(r);break}case "list":{t+=this.renderer.list(r);break}case "checkbox":{t+=this.renderer.checkbox(r);break}case "html":{t+=this.renderer.html(r);break}case "def":{t+=this.renderer.def(r);break}case "paragraph":{t+=this.renderer.paragraph(r);break}case "text":{t+=this.renderer.text(r);break}default:{let i='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let o=this.options.extensions.renderers[r.type].call({parser:this},r);if(o!==false||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){n+=o||"";continue}}let i=r;switch(i.type){case "escape":{n+=t.text(i);break}case "html":{n+=t.html(i);break}case "link":{n+=t.link(i);break}case "image":{n+=t.image(i);break}case "checkbox":{n+=t.checkbox(i);break}case "strong":{n+=t.strong(i);break}case "em":{n+=t.em(i);break}case "codespan":{n+=t.codespan(i);break}case "br":{n+=t.br(i);break}case "del":{n+=t.del(i);break}case "text":{n+=t.text(i);break}default:{let o='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}};var S=class{options;block;constructor(e){this.options=e||R;}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?x.lex:x.lexInline}provideParser(e=this.block){return e?b.parse:b.parseInline}};var Z=class{defaults=C();options=this.setOptions;parse=this.parseMarkdown(true);parseInline=this.parseMarkdown(false);Parser=b;Renderer=P;TextRenderer=L;Lexer=x;Tokenizer=y;Hooks=S;constructor(...e){this.use(...e);}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case "table":{let r=s;for(let i of r.header)n=n.concat(this.walkTokens(i.tokens,t));for(let i of r.rows)for(let o of i)n=n.concat(this.walkTokens(o.tokens,t));break}case "list":{let r=s;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let o=r[i].flat(1/0);n=n.concat(this.walkTokens(o,t));}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)));}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||false,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=t.renderers[r.name];i?t.renderers[r.name]=function(...o){let p=r.renderer.apply(this,o);return p===false&&(p=i.apply(this,o)),p}:t.renderers[r.name]=r.renderer;}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[r.level];i?i.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]));}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens);}),s.extensions=t),n.renderer){let r=this.defaults.renderer||new P(this.defaults);for(let i in n.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,p=n.renderer[o],a=r[o];r[o]=(...u)=>{let c=p.apply(r,u);return c===false&&(c=a.apply(r,u)),c||""};}s.renderer=r;}if(n.tokenizer){let r=this.defaults.tokenizer||new y(this.defaults);for(let i in n.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,p=n.tokenizer[o],a=r[o];r[o]=(...u)=>{let c=p.apply(r,u);return c===false&&(c=a.apply(r,u)),c};}s.tokenizer=r;}if(n.hooks){let r=this.defaults.hooks||new S;for(let i in n.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,p=n.hooks[o],a=r[o];S.passThroughHooks.has(i)?r[o]=u=>{if(this.defaults.async&&S.passThroughHooksRespectAsync.has(i))return (async()=>{let h=await p.call(r,u);return a.call(r,h)})();let c=p.call(r,u);return a.call(r,c)}:r[o]=(...u)=>{if(this.defaults.async)return (async()=>{let h=await p.apply(r,u);return h===false&&(h=await a.apply(r,u)),h})();let c=p.apply(r,u);return c===false&&(c=a.apply(r,u)),c};}s.hooks=r;}if(n.walkTokens){let r=this.defaults.walkTokens,i=n.walkTokens;s.walkTokens=function(o){let p=[];return p.push(i.call(this,o)),r&&(p=p.concat(r.call(this,o))),p};}this.defaults={...this.defaults,...s};}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return (n,s)=>{let r={...s},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===true&&r.async===false)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return (async()=>{let p=i.hooks?await i.hooks.preprocess(n):n,u=await(i.hooks?await i.hooks.provideLexer(e):e?x.lex:x.lexInline)(p,i),c=i.hooks?await i.hooks.processAllTokens(u):u;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let k=await(i.hooks?await i.hooks.provideParser(e):e?b.parse:b.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(k):k})().catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let a=(i.hooks?i.hooks.provideLexer(e):e?x.lex:x.lexInline)(n,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let c=(i.hooks?i.hooks.provideParser(e):e?b.parse:b.parseInline)(a,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(p){return o(p)}}}onError(e,t){return n=>{if(n.message+=`
|
|
80
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+O(n.message+"",true)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}};var E=new Z;function f(l,e){return E.parse(l,e)}f.options=f.setOptions=function(l){return E.setOptions(l),f.defaults=E.defaults,j(f.defaults),f};f.getDefaults=C;f.defaults=R;function kt(...l){return E.use(...l),f.defaults=E.defaults,j(f.defaults),f}f.use=kt;f.walkTokens=function(l,e){return E.walkTokens(l,e)};f.parseInline=E.parseInline;f.Parser=b;f.parser=b.parse;f.Renderer=P;f.TextRenderer=L;f.Lexer=x;f.lexer=x.lex;f.Tokenizer=y;f.Hooks=S;f.parse=f;
|
|
81
|
+
|
|
82
|
+
const jobSelectorDemoCss = () => `.control-panel{width:100%;background-color:#f1f3f5;border-radius:4px;border:1px solid #dee2e6;display:flex;flex-direction:column}.control-panel-section{padding:var(--digi--global--spacing--base) var(--digi--global--spacing--base) var(--digi--global--spacing--base) var(--digi--global--spacing--base);border-bottom:1px solid #e0e0e0}.control-panel-section:last-child{border-bottom:none}.control-panel-section--button{margin-top:auto;position:relative;padding-top:0;border-bottom:none}.control-panel-section--button::before{content:'';display:block;border-top:1px solid #dcdcdc;margin-bottom:1rem;width:100%}.control-panel-section digi-form-label{display:block;margin-bottom:var(--digi--global--spacing--smallest-2)}.hidden{display:none !important}.mt-2{margin-top:var(--digi--global--spacing--base)}.page-subheading{margin-bottom:var(--digi--global--spacing--largest-4)}.example-container{display:flex;flex-direction:column;gap:var(--digi--global--spacing--base);margin-bottom:var(--digi--global--spacing--largest-4)}.example-main-column{flex:1;display:flex;flex-direction:column;min-width:0}.demo-area{flex:1;background-color:#ffffff;background-image:linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0), linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);background-size:20px 20px;background-position:0 0, 10px 10px;padding:var(--digi--global--spacing--base) var(--digi--global--spacing--largest-4) var(--digi--global--spacing--largest-4) var(--digi--global--spacing--largest-4);border:1px solid #dee2e6;border-bottom:none;border-radius:4px 4px 0 0;min-height:200px;display:flex;flex-direction:column;gap:var(--digi--global--spacing--largest-4)}.demo-visual-wrapper{flex:1;min-width:0;margin-top:calc(var(--digi--global--spacing--smallest-3) * -1)}.demo-live-output{flex:1;display:flex;flex-direction:column;height:auto;min-height:100px;align-self:flex-start !important}.output-label-external{margin-bottom:var(--digi--global--spacing--smallest-3);display:block}#live-json-block{background-color:#262626;color:#fff;border-radius:4px;box-shadow:0 4px 6px rgba(0, 0, 0, 0.1);flex:1;width:100%;margin-top:0 !important;display:block}.demo-live-output *,.demo-live-output *::before,.demo-live-output *::after{border-color:transparent !important;}#live-json-block *,#live-json-block *::before,#live-json-block *::after{border-color:#262626 !important}.output-title{display:none;}.code-output-container{background-color:transparent;border-radius:4px;padding:0;margin-top:0;display:flex;flex-direction:column;gap:1.5rem}.digi-code-block-custom{--digi--code-block--background:transparent;--digi--code-block--max-height:auto;margin:0 !important;border:none !important;width:100%}.digi-code-block-custom::part(container){border:none !important;box-shadow:none !important;background:transparent !important;padding:0 !important;height:auto;border-top-color:#262626 !important;border-bottom-color:#262626 !important;margin:0 !important}.digi-code-block-custom::part(code){white-space:pre-wrap;height:auto;overflow:visible;padding:0 !important;background:transparent !important;border:none !important;border-top-color:#262626 !important;border-bottom-color:#262626 !important;margin:0 !important}.digi-code-block-custom::part(pre){border:none !important;margin:0 !important;padding:0 !important;border-top-color:#262626 !important;border-bottom-color:#262626 !important}.digi-code-block-custom::part(toolbar){border-color:#262626 !important;background:#262626 !important;border-top-color:#262626 !important;border-bottom-color:#262626 !important;margin:0 !important;padding:0 !important}#live-json-block::part(container),#live-json-block::part(code),#live-json-block::part(pre),#live-json-block::part(toolbar){border-color:#262626 !important;border-top-color:#262626 !important;border-bottom-color:#262626 !important;margin-top:0 !important;padding-top:0 !important}#live-json-block pre,#live-json-block code{margin-top:0 !important;padding-top:0 !important}.digi-code-block-custom::part(copy-button){display:none}.readme-content-area{font-family:'Open Sans', sans-serif;padding-left:0;padding-right:0}.readme-content-area h1,.readme-content-area h2,.readme-content-area h3{color:#212529;font-weight:600;margin-top:3rem}.readme-content-area p,.readme-content-area li{color:#343a40}.readme-content-area pre{background-color:#262626;color:#ffffff;padding:1.5rem;border-radius:4px}.readme-content-area pre code{background-color:transparent;padding:0}.readme-content-area code{font-family:monospace;background-color:rgba(0, 0, 0, 0.05);padding:0.2em 0.4em;border-radius:3px;font-size:0.9em}.readme-content-area img,.readme-content-area table{max-width:100%}table,digi-table{width:100%;border-collapse:collapse;margin-top:1rem}th,td{border:1px solid #dee2e6;padding:0.75rem;text-align:left}td:last-child{word-break:break-word;hyphens:auto}td:nth-child(3){word-break:break-word;min-width:92px}th{background-color:#f8f9fa}.section-spacing{margin-top:3rem}#copy-button{margin:0;--digi--button--padding-inline:0;--digi--button--padding-inline-start:0;--digi--button--padding-left:0}@media (min-width: 992px){.example-container{flex-direction:row;align-items:stretch;gap:0}.control-panel{width:350px;flex-shrink:0;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #dee2e6}.demo-area{flex-direction:row;flex-wrap:wrap;border-top-right-radius:0;border-right:none;row-gap:var(--digi--global--spacing--base);column-gap:var(--digi--global--spacing--largest-4);align-items:flex-start;align-content:flex-start;}.demo-visual-wrapper{flex:0 0 auto;width:100%;max-width:500px;}.demo-live-output{flex:1;min-width:300px;max-width:500px;margin-left:0;align-self:flex-start !important;height:auto !important}.code-output-container{border-bottom-right-radius:0}}.footer-email-link{text-decoration:none !important;color:inherit;font-weight:600}.footer-email-link:hover{text-decoration:underline !important}.digi-docs-home-main-quote-block{display:block;margin-top:3rem;width:100%}.digi-docs-home-main-quote-block::part(container){background-color:#f8fdf0 !important;}.digi-docs-home-main-quote-block .digi-quote__img{object-position:18% 30% !important}.quote-container{display:block;width:fit-content;padding:2rem 0;margin:0}@media (min-width: 992px){.quote-container{padding:4rem 0}}.tracks-info-section{margin-top:4rem;padding-top:2rem;border-top:1px solid #eee}.tracks-info-grid{display:grid;grid-template-columns:1fr 1fr;gap:2rem;align-items:start}.track-info-column{display:flex;flex-direction:column;gap:1rem}.track-info-column h2{margin:0 0 0.5rem 0;color:#006ebf}.track-info-column p{line-height:1.6;color:#333}@media (max-width: 1024px){.tracks-info-grid{grid-template-columns:1fr;gap:2rem}}.radiobutton-description{max-width:var(--digi--paragraph-width--medium);line-height:var(--digi--typography--label-description--line-height--desktop);font-size:var(--digi--typography--label-description--font-size--desktop);padding-left:2rem;font-family:var(--digi--global--typography--font-family--default, "Open Sans", Arial, sans-serif);margin-top:-0.5rem;margin-bottom:1rem;color:var(--digi--color--text--description, #5c5c5c)}`;
|
|
83
|
+
|
|
84
|
+
const DATA_PUBLIC_BASE_URL = 'https://d3hng02m5bee8m.cloudfront.net';
|
|
85
|
+
const DATA_PACKAGE_MANIFEST_URL = `${DATA_PUBLIC_BASE_URL}/data-packages/latest.json`;
|
|
86
|
+
const YrkesvaljarenDemo = class {
|
|
87
|
+
constructor(hostRef) {
|
|
88
|
+
registerInstance(this, hostRef);
|
|
89
|
+
}
|
|
90
|
+
get el() { return getElement(this); }
|
|
91
|
+
variant = 'single';
|
|
92
|
+
version = 'latest';
|
|
93
|
+
required = true;
|
|
94
|
+
allowFreeText = false;
|
|
95
|
+
history = true;
|
|
96
|
+
size = 'medium';
|
|
97
|
+
framework = 'html';
|
|
98
|
+
codeInstallationMode = 'latest';
|
|
99
|
+
afHideHeader = false;
|
|
100
|
+
afHidePreamble = false;
|
|
101
|
+
lastSingleSelection = '';
|
|
102
|
+
lastMultiSelection = '';
|
|
103
|
+
implementationCode = '';
|
|
104
|
+
readmeMainContent = 'Laddar dokumentation...';
|
|
105
|
+
readmeCodeContent = [];
|
|
106
|
+
availableYvVersions = [];
|
|
107
|
+
latestYvDataVersion = '';
|
|
108
|
+
// Changelog state
|
|
109
|
+
latestVersion = '';
|
|
110
|
+
latestDate = '';
|
|
111
|
+
latestType = '';
|
|
112
|
+
latestChanges = '';
|
|
113
|
+
isTaxonomyLoading = true;
|
|
114
|
+
singleBox;
|
|
115
|
+
multiBox;
|
|
116
|
+
latestYvDataUrl = `${DATA_PUBLIC_BASE_URL}/yrkesvaljaren/latest.json`;
|
|
117
|
+
async componentWillLoad() {
|
|
118
|
+
await this.loadDataPackageManifest();
|
|
119
|
+
this.updateCodeBlock();
|
|
120
|
+
// Load changelog and markdown in parallel
|
|
121
|
+
this.loadMarkdown();
|
|
122
|
+
this.loadChangelog();
|
|
123
|
+
// Wait for taxonomy to be ready before rendering selectors
|
|
124
|
+
await this.refreshTaxonomy();
|
|
125
|
+
}
|
|
126
|
+
async loadDataPackageManifest() {
|
|
127
|
+
try {
|
|
128
|
+
const response = await fetch(DATA_PACKAGE_MANIFEST_URL);
|
|
129
|
+
if (!response.ok) {
|
|
130
|
+
throw new Error(`Manifest HTTP error! status: ${response.status}`);
|
|
131
|
+
}
|
|
132
|
+
const manifest = await response.json();
|
|
133
|
+
const yvManifest = manifest.yrkesvaljaren;
|
|
134
|
+
const versions = yvManifest?.versions || [];
|
|
135
|
+
this.availableYvVersions = versions.map(versionInfo => versionInfo.taxonomyVersion);
|
|
136
|
+
this.latestYvDataVersion = yvManifest?.latest?.taxonomyVersion || this.availableYvVersions[0] || '';
|
|
137
|
+
this.latestYvDataUrl = yvManifest?.latest?.dataUrl || this.latestYvDataUrl;
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
console.warn('[Demo] Kunde inte hämta datapaketsmanifestet', error);
|
|
141
|
+
this.availableYvVersions = [];
|
|
142
|
+
this.latestYvDataVersion = '';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
getTaxonomyUrls() {
|
|
146
|
+
return [this.latestYvDataUrl, '/assets/taxonomy.json'];
|
|
147
|
+
}
|
|
148
|
+
async fetchFirstOk(urls) {
|
|
149
|
+
let lastError = null;
|
|
150
|
+
for (const url of urls) {
|
|
151
|
+
try {
|
|
152
|
+
const response = await fetch(url);
|
|
153
|
+
if (response.ok) {
|
|
154
|
+
return response;
|
|
155
|
+
}
|
|
156
|
+
lastError = new Error(`Taxonomy HTTP error! status: ${response.status}`);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
lastError = error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
throw lastError || new Error('Kunde inte hitta någon taxonomi-URL att hämta.');
|
|
163
|
+
}
|
|
164
|
+
getExampleDataPackageName() {
|
|
165
|
+
const version = this.version === 'latest'
|
|
166
|
+
? this.latestYvDataVersion
|
|
167
|
+
: this.version;
|
|
168
|
+
return version
|
|
169
|
+
? `@taxonomy/yrkesvaljaren-data-v${version}`
|
|
170
|
+
: '@taxonomy/yrkesvaljaren-data-v30';
|
|
171
|
+
}
|
|
172
|
+
async refreshTaxonomy() {
|
|
173
|
+
this.isTaxonomyLoading = true;
|
|
174
|
+
const taxonomyUrls = this.getTaxonomyUrls();
|
|
175
|
+
try {
|
|
176
|
+
console.log(`[Demo] Fetching taxonomy from: ${taxonomyUrls.join(', ')}`);
|
|
177
|
+
const taxRes = await this.fetchFirstOk(taxonomyUrls);
|
|
178
|
+
const data = await taxRes.json();
|
|
179
|
+
// Register data globally
|
|
180
|
+
registerTaxonomy(data);
|
|
181
|
+
console.log(`[Demo] Taxonomy registered successfully`);
|
|
182
|
+
// Trigger components to update
|
|
183
|
+
if (this.singleBox && this.singleBox.updateData) {
|
|
184
|
+
await this.singleBox.updateData();
|
|
185
|
+
}
|
|
186
|
+
if (this.multiBox && this.multiBox.updateData) {
|
|
187
|
+
await this.multiBox.updateData();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (e) {
|
|
191
|
+
console.error('[Demo] Failed to load taxonomy', e);
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
this.isTaxonomyLoading = false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
async loadChangelog() {
|
|
198
|
+
try {
|
|
199
|
+
const response = await fetch('/CHANGELOG.md');
|
|
200
|
+
if (!response.ok)
|
|
201
|
+
return; // Silent fail if missing
|
|
202
|
+
const text = await response.text();
|
|
203
|
+
// Split on version headings and skip sections such as "Unreleased".
|
|
204
|
+
const chunks = text.split(/^## /m);
|
|
205
|
+
const chunk = chunks
|
|
206
|
+
.slice(1)
|
|
207
|
+
.find(candidate => /^\[[^\]]+\] - .+$/m.test(candidate.split('\n')[0].trim()));
|
|
208
|
+
if (chunk) {
|
|
209
|
+
const lines = chunk.split('\n');
|
|
210
|
+
const firstLine = lines[0].trim();
|
|
211
|
+
const verRegex = /^\[(.*?)\] - (.*)$/;
|
|
212
|
+
const verMatch = firstLine.match(verRegex);
|
|
213
|
+
if (verMatch) {
|
|
214
|
+
this.latestVersion = verMatch[1];
|
|
215
|
+
this.latestDate = verMatch[2];
|
|
216
|
+
let body = lines.slice(1).join('\n').trim();
|
|
217
|
+
// Extract the first ### Header
|
|
218
|
+
const headerRegex = /^\s*###\s+(.*)$/m;
|
|
219
|
+
const headerMatch = body.match(headerRegex);
|
|
220
|
+
if (headerMatch) {
|
|
221
|
+
this.latestType = headerMatch[1].trim();
|
|
222
|
+
// Use substring to remove the header line safely
|
|
223
|
+
const startIndex = (headerMatch.index || 0) + headerMatch[0].length;
|
|
224
|
+
body = body.substring(startIndex).trim();
|
|
225
|
+
}
|
|
226
|
+
// Replace remaining ### with bold syntax as requested
|
|
227
|
+
body = body.replace(/### (.*)/g, '**$1**');
|
|
228
|
+
// Use Marked to parse the content snippet
|
|
229
|
+
const marked = new Z();
|
|
230
|
+
let htmlContent = await marked.parse(body);
|
|
231
|
+
// Reduce margin for bold section headers
|
|
232
|
+
this.latestChanges = htmlContent.replace(/<p><strong>(.*?)<\/strong><\/p>/g, '<p style="margin-bottom: 0; margin-top: 1rem;"><strong>$1</strong></p>');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
console.warn('Could not load changelog', e);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
componentDidLoad() {
|
|
241
|
+
this.singleBox = this.el.querySelector('#single-select-box');
|
|
242
|
+
this.multiBox = this.el.querySelector('#multi-select-box');
|
|
243
|
+
// this.triggerHighlight();
|
|
244
|
+
}
|
|
245
|
+
componentDidUpdate() {
|
|
246
|
+
// this.triggerHighlight();
|
|
247
|
+
}
|
|
248
|
+
triggerHighlight() {
|
|
249
|
+
setTimeout(() => {
|
|
250
|
+
if (window.hljs) {
|
|
251
|
+
this.el.querySelectorAll('pre code').forEach((el) => {
|
|
252
|
+
window.hljs.highlightElement(el);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}, 100);
|
|
256
|
+
}
|
|
257
|
+
handleSelection(event) {
|
|
258
|
+
const detail = event.detail;
|
|
259
|
+
const singleBox = this.el.querySelector('#single-select-box');
|
|
260
|
+
const multiBox = this.el.querySelector('#multi-select-box');
|
|
261
|
+
// Check if it's an empty selection (X button clicked in multi-mode)
|
|
262
|
+
const isEmpty = detail === null ||
|
|
263
|
+
detail === undefined ||
|
|
264
|
+
(Array.isArray(detail) && detail.length === 0) ||
|
|
265
|
+
(typeof detail === 'object' && detail !== null && Object.keys(detail).length === 0);
|
|
266
|
+
if (isEmpty) {
|
|
267
|
+
// Clear the output when deselected
|
|
268
|
+
if (event.target === singleBox) {
|
|
269
|
+
this.lastSingleSelection = '';
|
|
270
|
+
}
|
|
271
|
+
else if (event.target === multiBox) {
|
|
272
|
+
this.lastMultiSelection = '';
|
|
273
|
+
}
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
let json = JSON.stringify(detail, null, 2);
|
|
277
|
+
if (event.target === singleBox) {
|
|
278
|
+
this.lastSingleSelection = json;
|
|
279
|
+
}
|
|
280
|
+
else if (event.target === multiBox) {
|
|
281
|
+
this.lastMultiSelection = json;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
async loadMarkdown() {
|
|
285
|
+
try {
|
|
286
|
+
const response = await fetch(`/README.md?t=${new Date().getTime()}`);
|
|
287
|
+
if (!response.ok)
|
|
288
|
+
throw new Error(`Kunde inte hämta README.md`);
|
|
289
|
+
const markdownText = await response.text();
|
|
290
|
+
const renderer = {
|
|
291
|
+
code(code, lang) {
|
|
292
|
+
const text = typeof code === 'string' ? code : (code.text || '');
|
|
293
|
+
let language = (typeof code === 'string' ? lang : (code.lang || 'html')) || 'html';
|
|
294
|
+
if (language === 'ini')
|
|
295
|
+
language = 'bash';
|
|
296
|
+
const escapedCode = text
|
|
297
|
+
.replace(/&/g, "&")
|
|
298
|
+
.replace(/</g, "<")
|
|
299
|
+
.replace(/>/g, ">")
|
|
300
|
+
.replace(/"/g, """)
|
|
301
|
+
.replace(/'/g, "'");
|
|
302
|
+
return `<digi-code-block af-code="${escapedCode}" af-language="${language}" af-variation="dark"></digi-code-block>`;
|
|
303
|
+
},
|
|
304
|
+
html(html) {
|
|
305
|
+
const text = typeof html === 'string' ? html : (html.text || '');
|
|
306
|
+
if (text.includes('<!DOCTYPE html>')) {
|
|
307
|
+
const escapedCode = text
|
|
308
|
+
.replace(/&/g, "&")
|
|
309
|
+
.replace(/</g, "<")
|
|
310
|
+
.replace(/>/g, ">")
|
|
311
|
+
.replace(/"/g, """)
|
|
312
|
+
.replace(/'/g, "'");
|
|
313
|
+
return `<digi-code-block af-code="${escapedCode}" af-language="html" af-variation="dark"></digi-code-block>`;
|
|
314
|
+
}
|
|
315
|
+
return text;
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
const marked = new Z({ renderer });
|
|
319
|
+
const parsedHtml = await marked.parse(markdownText);
|
|
320
|
+
const tempDiv = document.createElement('div');
|
|
321
|
+
tempDiv.innerHTML = parsedHtml;
|
|
322
|
+
// Wrap tables in digi-table
|
|
323
|
+
const tables = tempDiv.querySelectorAll('table');
|
|
324
|
+
tables.forEach(table => {
|
|
325
|
+
const wrapper = document.createElement('digi-table');
|
|
326
|
+
wrapper.setAttribute('af-variation', 'tertiary');
|
|
327
|
+
wrapper.setAttribute('af-size', 'medium');
|
|
328
|
+
if (table.parentNode) {
|
|
329
|
+
table.parentNode.insertBefore(wrapper, table);
|
|
330
|
+
wrapper.appendChild(table);
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
// Remove unwanted headings
|
|
334
|
+
const headings = tempDiv.querySelectorAll('h1, h2, h3, h4');
|
|
335
|
+
headings.forEach(heading => {
|
|
336
|
+
if (!heading.textContent)
|
|
337
|
+
return;
|
|
338
|
+
if (heading.textContent.trim().toLowerCase().includes('innehållsförteckning')) {
|
|
339
|
+
const nextSibling = heading.nextElementSibling;
|
|
340
|
+
if (nextSibling && (nextSibling.tagName === 'UL' || nextSibling.tagName === 'OL')) {
|
|
341
|
+
nextSibling.remove();
|
|
342
|
+
}
|
|
343
|
+
heading.remove();
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
const configEventNodes = [];
|
|
347
|
+
const mainNodes = [];
|
|
348
|
+
let movingToCodeTab = false;
|
|
349
|
+
// Update movingToCodeTab to be robust
|
|
350
|
+
const movingToCodeTabRegex = /användning|konfiguration|attribut|händelser|events|programmatisk|tillgänglighet|validering/i;
|
|
351
|
+
const skipRegex = /^installation|^bidra och release/i;
|
|
352
|
+
const resetTabRegex = /^stil/i; // Headers that force 'Overview' tab
|
|
353
|
+
let skipMode = false;
|
|
354
|
+
Array.from(tempDiv.children).forEach(child => {
|
|
355
|
+
const text = (child.textContent || '').toLowerCase();
|
|
356
|
+
const tagName = child.tagName.toLowerCase();
|
|
357
|
+
if (tagName === 'hr')
|
|
358
|
+
return;
|
|
359
|
+
if (tagName === 'h1' && text.includes('yrkesväljaren webbkomponent'))
|
|
360
|
+
return;
|
|
361
|
+
if (tagName === 'p' && text.includes('en robust och intelligent'))
|
|
362
|
+
return;
|
|
363
|
+
if (tagName.match(/^h[1-6]$/)) {
|
|
364
|
+
if (skipRegex.test(text)) {
|
|
365
|
+
skipMode = true;
|
|
366
|
+
movingToCodeTab = false;
|
|
367
|
+
}
|
|
368
|
+
else if (movingToCodeTabRegex.test(text)) {
|
|
369
|
+
movingToCodeTab = true;
|
|
370
|
+
skipMode = false;
|
|
371
|
+
}
|
|
372
|
+
else if (resetTabRegex.test(text)) {
|
|
373
|
+
movingToCodeTab = false;
|
|
374
|
+
skipMode = false;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (skipMode)
|
|
378
|
+
return;
|
|
379
|
+
if (movingToCodeTab)
|
|
380
|
+
configEventNodes.push(child);
|
|
381
|
+
else
|
|
382
|
+
mainNodes.push(child);
|
|
383
|
+
});
|
|
384
|
+
const structureContent = (nodes) => {
|
|
385
|
+
const fragment = document.createDocumentFragment();
|
|
386
|
+
let currentTextGroup = null;
|
|
387
|
+
const closeTextGroup = () => {
|
|
388
|
+
if (currentTextGroup) {
|
|
389
|
+
const typography = document.createElement('digi-typography');
|
|
390
|
+
while (currentTextGroup.firstChild) {
|
|
391
|
+
typography.appendChild(currentTextGroup.firstChild);
|
|
392
|
+
}
|
|
393
|
+
const col = document.createElement('div');
|
|
394
|
+
// Explicitly matching legacy classes
|
|
395
|
+
col.className = 'digi-layout-column digi-layout-column--12 digi-layout-column--lg-8';
|
|
396
|
+
col.appendChild(typography);
|
|
397
|
+
fragment.appendChild(col);
|
|
398
|
+
currentTextGroup = null;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
const openTextGroup = () => {
|
|
402
|
+
if (!currentTextGroup)
|
|
403
|
+
currentTextGroup = document.createElement('div');
|
|
404
|
+
};
|
|
405
|
+
nodes.forEach(child => {
|
|
406
|
+
const tagName = child.tagName.toLowerCase();
|
|
407
|
+
// Robust check for wide elements
|
|
408
|
+
const isWide = tagName === 'digi-code-block' || tagName === 'table' || tagName === 'digi-table' || tagName === 'img';
|
|
409
|
+
if (isWide) {
|
|
410
|
+
closeTextGroup();
|
|
411
|
+
const col = document.createElement('div');
|
|
412
|
+
col.className = 'digi-layout-column digi-layout-column--12 digi-layout-column--lg-12';
|
|
413
|
+
col.appendChild(child.cloneNode(true));
|
|
414
|
+
fragment.appendChild(col);
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
openTextGroup();
|
|
418
|
+
if (currentTextGroup)
|
|
419
|
+
currentTextGroup.appendChild(child.cloneNode(true));
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
closeTextGroup();
|
|
423
|
+
const tempWrap = document.createElement('div');
|
|
424
|
+
tempWrap.appendChild(fragment);
|
|
425
|
+
return tempWrap.innerHTML;
|
|
426
|
+
};
|
|
427
|
+
this.readmeMainContent = structureContent(mainNodes);
|
|
428
|
+
// Wrap the code content in a similar structure to ensure layout consistency
|
|
429
|
+
this.readmeCodeContent = [structureContent(configEventNodes)];
|
|
430
|
+
// Trigger highlighting
|
|
431
|
+
// this.triggerHighlight();
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
this.readmeMainContent = `<h2>Kunde inte ladda dokumentationen</h2><p>${error.message}</p>`;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
updateCodeBlock() {
|
|
438
|
+
const indent = ' ';
|
|
439
|
+
let code;
|
|
440
|
+
const isLatest = this.version === 'latest';
|
|
441
|
+
const cStart = this.framework === 'html' ? '<!--' : '//';
|
|
442
|
+
const cEnd = this.framework === 'html' ? '-->' : '';
|
|
443
|
+
const dataPackageName = this.getExampleDataPackageName();
|
|
444
|
+
let step = 1;
|
|
445
|
+
// 1. Installation Section
|
|
446
|
+
code = `${cStart} ${step}. Kopiera och kör detta skript för att installera Yrkesväljaren i ditt projekt. ${cEnd}\n`;
|
|
447
|
+
code += `/bin/bash -c "echo '@taxonomy:registry=https://gitlab.com/api/v4/projects/74569456/packages/npm/' >> .npmrc &&\nnpm install @taxonomy/yrkesvaljaren"\n\n`;
|
|
448
|
+
step++;
|
|
449
|
+
if (!isLatest) {
|
|
450
|
+
code += `${cStart} ${step}. Installera datapaketet för vald taxonomiversion ${cEnd}\n`;
|
|
451
|
+
code += `npm install ${dataPackageName}\n\n`;
|
|
452
|
+
step++;
|
|
453
|
+
}
|
|
454
|
+
// 2. Setup Section
|
|
455
|
+
if (this.framework === 'html') {
|
|
456
|
+
code += isLatest
|
|
457
|
+
? `<!-- ${step}. Initiera komponenten i din kod -->\n<script type="module">\n${indent}import { defineCustomElements as defineYrkesvaljaren } from '@taxonomy/yrkesvaljaren/loader';\n${indent}defineYrkesvaljaren();\n</script>\n\n`
|
|
458
|
+
: `<!-- ${step}. Initiera komponenten med vald taxonomiversion - (v${this.version}) -->\n<script type="module">\n${indent}import { registerTaxonomy } from '@taxonomy/yrkesvaljaren';\n${indent}import { defineCustomElements as defineYrkesvaljaren } from '@taxonomy/yrkesvaljaren/loader';\n${indent}import { taxonomyData, metadata } from '${dataPackageName}';\n${indent}registerTaxonomy({ data: taxonomyData, metadata });\n${indent}defineYrkesvaljaren();\n</script>\n\n`;
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
code += isLatest
|
|
462
|
+
? `// ${step}. Setup: Auto-fetch\nimport { defineCustomElements as defineYrkesvaljaren } from '@taxonomy/yrkesvaljaren/loader';\ndefineYrkesvaljaren();\n\n`
|
|
463
|
+
: `// ${step}. Setup: Manual (v${this.version})\nimport { registerTaxonomy } from '@taxonomy/yrkesvaljaren';\nimport { defineCustomElements as defineYrkesvaljaren } from '@taxonomy/yrkesvaljaren/loader';\nimport { taxonomyData, metadata } from '${dataPackageName}';\nregisterTaxonomy({ data: taxonomyData, metadata });\ndefineYrkesvaljaren();\n\n`;
|
|
464
|
+
}
|
|
465
|
+
step++;
|
|
466
|
+
// 3. Usage Section
|
|
467
|
+
code += this.framework === 'html' ? `<!-- ${step}. Använd komponenten i ditt gränssnitt -->\n` : `// ${step}. Usage\n`;
|
|
468
|
+
if (this.framework === 'html') {
|
|
469
|
+
code += `<digi-service-job-selector\n`;
|
|
470
|
+
code += `${indent}af-label="Välj yrke"\n`;
|
|
471
|
+
if (this.variant === 'multi') {
|
|
472
|
+
code += `${indent}af-label-description="Du kan välja mer än ett yrke"\n`;
|
|
473
|
+
code += `${indent}af-enable-multiple="true"\n`;
|
|
474
|
+
}
|
|
475
|
+
code += `${indent}af-required="${this.required}"\n`;
|
|
476
|
+
code += `${indent}af-manual-input="${this.allowFreeText}"\n`;
|
|
477
|
+
code += `${indent}af-history="${this.history}"\n`;
|
|
478
|
+
if (this.size !== 'medium')
|
|
479
|
+
code += `${indent}af-size="${this.size}"\n`;
|
|
480
|
+
code += `></digi-service-job-selector>`;
|
|
481
|
+
}
|
|
482
|
+
else if (this.framework === 'angular') {
|
|
483
|
+
code += `<digi-service-job-selector\n`;
|
|
484
|
+
code += `${indent}[attr.af-label]="'Välj yrke'"\n`;
|
|
485
|
+
if (this.variant === 'multi') {
|
|
486
|
+
code += `${indent}[attr.af-label-description]="'Du kan välja mer än ett yrke'"\n`;
|
|
487
|
+
code += `${indent}[attr.af-enable-multiple]="true"\n`;
|
|
488
|
+
}
|
|
489
|
+
code += `${indent}[attr.af-required]="${this.required}"\n`;
|
|
490
|
+
code += `${indent}[attr.af-manual-input]="${this.allowFreeText}"\n`;
|
|
491
|
+
code += `${indent}[attr.af-history]="${this.history}"\n`;
|
|
492
|
+
if (this.size !== 'medium')
|
|
493
|
+
code += `${indent}[attr.af-size]="'${this.size}'"\n`;
|
|
494
|
+
code += `></digi-service-job-selector>`;
|
|
495
|
+
}
|
|
496
|
+
else if (this.framework === 'react') {
|
|
497
|
+
code += `<Yrkesvaljaren\n`;
|
|
498
|
+
code += `${indent}afLabel="Välj yrke"\n`;
|
|
499
|
+
if (this.variant === 'multi') {
|
|
500
|
+
code += `${indent}afLabelDescription="Du kan välja mer än ett yrke"\n`;
|
|
501
|
+
code += `${indent}afEnableMultiple={true}\n`;
|
|
502
|
+
}
|
|
503
|
+
code += `${indent}required={${this.required}}\n`;
|
|
504
|
+
code += `${indent}manualInput={${this.allowFreeText}}\n`;
|
|
505
|
+
code += `${indent}afHistory={${this.history}}\n`;
|
|
506
|
+
if (this.size !== 'medium')
|
|
507
|
+
code += `${indent}afSize="${this.size}"\n`;
|
|
508
|
+
code += `/>`;
|
|
509
|
+
}
|
|
510
|
+
this.implementationCode = code;
|
|
511
|
+
}
|
|
512
|
+
handleVariantChange(e) {
|
|
513
|
+
// Robust handling for digi-form-radiogroup event
|
|
514
|
+
const val = e.detail && typeof e.detail === 'string' ? e.detail : (e.target && e.target.value);
|
|
515
|
+
if (val) {
|
|
516
|
+
this.variant = val;
|
|
517
|
+
this.updateCodeBlock();
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
async handleVersionChange(e) {
|
|
521
|
+
console.log('[Demo] Version change event:', e);
|
|
522
|
+
// Try all possible ways to get the value from a Digi select event
|
|
523
|
+
const val = (e.detail && typeof e.detail === 'string')
|
|
524
|
+
? e.detail
|
|
525
|
+
: (e.target && e.target.value)
|
|
526
|
+
|| (e.detail && e.detail.target && e.detail.target.value)
|
|
527
|
+
|| (e.detail && e.detail.value);
|
|
528
|
+
console.log('[Demo] Extracted version value:', val);
|
|
529
|
+
if (val) {
|
|
530
|
+
this.version = val;
|
|
531
|
+
this.updateCodeBlock();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
handleRequiredChange(e) {
|
|
535
|
+
// Check for CustomEvent detail (boolean) or target.checked/afChecked
|
|
536
|
+
let isChecked = false;
|
|
537
|
+
if (typeof e.detail === 'boolean') {
|
|
538
|
+
isChecked = e.detail;
|
|
539
|
+
}
|
|
540
|
+
else if (e.target && (e.target.afChecked !== undefined)) {
|
|
541
|
+
isChecked = e.target.afChecked;
|
|
542
|
+
}
|
|
543
|
+
else if (e.target && e.target.checked !== undefined) {
|
|
544
|
+
isChecked = e.target.checked;
|
|
545
|
+
}
|
|
546
|
+
this.required = isChecked;
|
|
547
|
+
this.updateCodeBlock();
|
|
548
|
+
}
|
|
549
|
+
handleFreeTextChange(e) {
|
|
550
|
+
let isChecked = false;
|
|
551
|
+
if (typeof e.detail === 'boolean') {
|
|
552
|
+
isChecked = e.detail;
|
|
553
|
+
}
|
|
554
|
+
else if (e.target && (e.target.afChecked !== undefined)) {
|
|
555
|
+
isChecked = e.target.afChecked;
|
|
556
|
+
}
|
|
557
|
+
else if (e.target && e.target.checked !== undefined) {
|
|
558
|
+
isChecked = e.target.checked;
|
|
559
|
+
}
|
|
560
|
+
this.allowFreeText = isChecked;
|
|
561
|
+
this.updateCodeBlock();
|
|
562
|
+
}
|
|
563
|
+
handleHistoryChange(e) {
|
|
564
|
+
let isChecked = true;
|
|
565
|
+
if (typeof e.detail === 'boolean') {
|
|
566
|
+
isChecked = e.detail;
|
|
567
|
+
}
|
|
568
|
+
else if (e.target && (e.target.afChecked !== undefined)) {
|
|
569
|
+
isChecked = e.target.afChecked;
|
|
570
|
+
}
|
|
571
|
+
else if (e.target && e.target.checked !== undefined) {
|
|
572
|
+
isChecked = e.target.checked;
|
|
573
|
+
}
|
|
574
|
+
this.history = isChecked;
|
|
575
|
+
this.updateCodeBlock();
|
|
576
|
+
}
|
|
577
|
+
handleSizeChange(e) {
|
|
578
|
+
const val = e.detail && typeof e.detail === 'string' ? e.detail : (e.target && e.target.value);
|
|
579
|
+
if (val) {
|
|
580
|
+
this.size = val;
|
|
581
|
+
this.updateCodeBlock();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
handleFrameworkChange(e) {
|
|
585
|
+
const val = e.detail && typeof e.detail === 'string' ? e.detail : (e.target && e.target.value);
|
|
586
|
+
if (val) {
|
|
587
|
+
this.framework = val;
|
|
588
|
+
this.updateCodeBlock();
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
handleCodeInstallationModeChange(e) {
|
|
592
|
+
const val = e.detail && typeof e.detail === 'string' ? e.detail : (e.target && e.target.value);
|
|
593
|
+
if (val) {
|
|
594
|
+
this.codeInstallationMode = val;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
handleCopyCode() {
|
|
598
|
+
navigator.clipboard.writeText(this.implementationCode)
|
|
599
|
+
.then(() => console.log('Kopierat!'))
|
|
600
|
+
.catch(err => console.error('Fel', err));
|
|
601
|
+
}
|
|
602
|
+
render() {
|
|
603
|
+
return (h(Host, { key: '840f5f9ce6e5f71e655162588a378c13667d7d5a' }, h("main", { key: 'd7f92ed38d20a743234de61929fc6efb9d503456' }, !this.afHideHeader && (h("digi-layout-container", { key: '416e31b045f95bc65762170c43ff8ebdf61f802f', "af-margin-top": "true", "af-margin-bottom": "true" }, h("digi-typography-heading-jumbo", { key: 'aa0ed8ef8fe5c39f4a97da54fd29573ac31bef07', "af-text": "Yrkesv\u00E4ljaren", "af-level": "h1" }), h("digi-typography", { key: '319ae37dfb6a5c4804d1190f9cd07874542e0bf5' }, h("h2", { key: '62b547bec40d202bcccdd0cbd2bdfb8ab8435a3f', class: "digi-subheading", style: { marginTop: '0', fontWeight: '600', fontSize: '1.5em', color: '#333' } }, "digi-service-job-selector")))), h("digi-layout-container", { key: '08650df5c5b2273f0ab5bf92df6a740592604fde', "af-variation": "static", "af-margin-bottom": "true" }, h("digi-tablist", { key: '1e4f8b4121683c13ed5bfaee7758f0d5ccf6a9df', id: "main-tabs", "af-tabs": '[{"id": "oversikt", "title": "\u00D6versikt"}, {"id": "kod", "title": "Kod"}]', "af-aria-label": "Exempel flikar" }, h("digi-tablist-panel", { key: '8bf77b94e62c514d252d769098ae1ea60dcd62ea', tab: "oversikt" }, !this.afHidePreamble && (h("div", { key: '1536a3806f46e63859384b186a2fcf96aa35d6f8', style: { marginBottom: '3rem', maxWidth: '800px' } }, h("digi-typography-preamble", { key: '6b5a5d7dcb99f5f87739eacef41574717307b821' }, "Yrkesv\u00E4ljaren anv\u00E4nds f\u00F6r att s\u00F6ka och v\u00E4lja yrken fr\u00E5n valfri version av Arbetsf\u00F6rmedlingens taxonomi."))), h("div", { key: '7bdcd1ad873a317b903af0a95234c035e589fd42', class: "example-container" }, h("div", { key: 'e0ed90678d0498e23a3b987872a69eb44704f467', class: "example-main-column" }, h("div", { key: '2137d210601fff1bfd528037a46e4164e4e3b906', class: "demo-area" }, h("div", { key: '7ed8d93eeca0f7dd2c98d6ef00805929b65c51f0', class: "demo-visual-wrapper" }, this.isTaxonomyLoading ? (h("div", { style: { padding: '2rem', textAlign: 'center' } }, h("digi-loader", { "af-size": "large", "af-text": "Laddar yrkesdata..." }))) : (h(Fragment, null, h("div", { id: "demo-visual-single", style: { display: this.variant === 'single' ? 'block' : 'none' } }, h("digi-service-job-selector", { id: "single-select-box", "af-label": "V\u00E4lj yrke", "af-placeholder": "T.ex. snickare, undersk\u00F6terska, programmerare...", "af-size": this.size, "af-required": this.required, "af-manual-input": this.allowFreeText, "af-history": this.history, tabindex: "0" })), h("div", { id: "demo-visual-multi", style: { display: this.variant === 'multi' ? 'block' : 'none' } }, h("digi-service-job-selector", { id: "multi-select-box", "af-label": "V\u00E4lj yrke", "af-label-description": "Du kan v\u00E4lja mer \u00E4n ett yrke", "af-enable-multiple": true, "af-size": this.size, "af-required": this.required, "af-manual-input": this.allowFreeText, "af-history": this.history, tabindex: "0" }))))), h("div", { key: '7397f1e79b9a64cd9bed853ca60061a9b83f97aa', class: "demo-live-output", style: { alignSelf: 'flex-start', height: 'fit-content' } }, h("digi-form-label", { key: 'ff12b92dc0e9f2f75fb69956904413b9d63d0c43', "af-label": "Output", "af-for": "live-json-block", class: "output-label-external" }), h("digi-code-block", { key: '85c91eff18a11883fd87882846f3d3a621cf0d62', id: "live-json-block", class: "digi-code-block-custom", "af-language": "json", "af-variation": "dark", "af-code": this.variant === 'single' ? this.lastSingleSelection : this.lastMultiSelection, "af-hide-toolbar": "true" }))), h("div", { key: 'a593fe8f2bea1d194be8a7e59e6aff373caf2458', class: "code-output-container" }, h("div", { key: '7cd5476ee27b0f38db2729e0b2733d94e11d750c', id: "demo-output-codeblock" }, h("digi-code-block", { key: 'ada0cf627eda05ba57253e272f4fa84e1f9bc0c2', id: "implementation-code", class: "digi-code-block-custom", "af-language": "xml", "af-variation": "dark", "af-code": this.implementationCode, "af-hide-toolbar": "true" })))), h("div", { key: 'aced0d2f238bc5b1d974c4b37c73350898c70905', class: "control-panel" }, h("div", { key: 'ca53d909670b6efa4547107a4317387064dc7377', class: "control-panel-section" }, h("digi-form-label", { key: '21504ee2981a68d50048361de81889f3a307eb21', afLabel: "Variant", afFor: "variant-group" }), h("digi-form-radiogroup", { key: '884dfc17479dee9431c24076c9b262ef1c7578e3', afName: "variant", id: "variant-group", afValue: this.variant, afLayout: "vertical", onAfOnGroupChange: (e) => this.handleVariantChange(e) }, h("digi-form-radiobutton", { key: 'fcb7b04c9b20655da2c33640b167cb69f2b6aa00', afLabel: "Ett valbart yrke", afValue: "single" }), h("digi-form-radiobutton", { key: 'b9a67e59d281d469405edc1138c25fdef41dc61a', afLabel: "Flera valbara yrken", afValue: "multi" }))), h("div", { key: '9c3f7307b6cceb914cf1df0e32da623ba2f4e974', class: "control-panel-section" }, h("digi-form-select", { key: 'ea8c91099bdb01e183e0668ff3612310829e0530', id: "version-select", ref: (el) => {
|
|
604
|
+
if (el) {
|
|
605
|
+
el.afLabel = "Välj taxonomiversion";
|
|
606
|
+
el.setAttribute('af-label', 'Välj taxonomiversion');
|
|
607
|
+
}
|
|
608
|
+
}, afLabel: "V\u00E4lj taxonomiversion", afDescription: "Anv\u00E4nd automatiskt den senaste eller installera en specifik version.", afValue: this.version, onAfOnChange: (e) => this.handleVersionChange(e) }, h("option", { key: 'f2b3dfcf430809320288d29984fc5bd8d0a30209', value: "latest" }, "Senaste automatiskt uppdaterad"), this.availableYvVersions.length > 0 ? (this.availableYvVersions.map(ver => (h("option", { value: ver }, "Installera version ", ver)))) : (h("option", { disabled: true }, "Kunde inte h\u00E4mta versionslistan fr\u00E5n datapaketsmanifestet")))), h("div", { key: '472caa4c3c59a0ef8848d987d8447d0ce33aff02', class: "control-panel-section" }, h("digi-form-checkbox", { key: '458161644bfa0b3d11824208840a1b76a8994cb6', id: "required-checkbox", afLabel: "Obligatorisk", afDescription: "Kr\u00E4ver att anv\u00E4ndaren g\u00F6r ett val f\u00F6r att f\u00E4ltet ska vara giltigt.", afChecked: this.required, onAfOnChange: (e) => this.handleRequiredChange(e) }), h("digi-form-checkbox", { key: 'fa62e67f5d31724738486605113c1e02b34e4831', id: "freetext-checkbox", afLabel: "Till\u00E5t fritext", afDescription: "Till\u00E5ter manuell inmatning av egna yrkestitlar utanf\u00F6r taxonomin.", afChecked: this.allowFreeText, onAfOnChange: (e) => this.handleFreeTextChange(e) }), h("digi-form-checkbox", { key: 'baf2a24d0c239e0e7b9f0f9741410acd864398bf', id: "history-checkbox", afLabel: "Till\u00E5t historik (rekommenderas)", afDescription: "Sparar tidigare val lokalt i webbl\u00E4saren f\u00F6r snabbare \u00E5terval.", afChecked: this.history, onAfOnChange: (e) => this.handleHistoryChange(e) })), h("div", { key: 'c97f188ff87bf26249d76ec6055c1ec30449cb62', class: "control-panel-section" }, h("digi-form-label", { key: '1274b46dbfa332243f8eeb13f11f1677a609c03c', afLabel: "Storlekar", afFor: "size-radiogroup" }), h("digi-form-radiogroup", { key: '72b2286733822b6932bf2ba4ac4d3e7fba751cf5', afName: "size", afLegend: "Storlek", afOrientation: "horizontal", id: "size-radiogroup", afValue: this.size, onAfOnGroupChange: (e) => this.handleSizeChange(e) }, h("digi-form-radiobutton", { key: '5ed2c64274d1f5a3fd2f577efe005b776e4669a9', afLabel: "Small", afValue: "small" }), h("digi-form-radiobutton", { key: 'c9a3156b3f26d7f0248964cccaee0e2cb051e1eb', afLabel: "Medium", afValue: "medium" }), h("digi-form-radiobutton", { key: '79d3d832869060850c20b050884964ad297ecdc5', afLabel: "Large", afValue: "large" }))), h("div", { key: '47adbfa5ba5d11514700352bd7a652b881a2db23', class: "control-panel-section" }, h("digi-form-label", { key: '9c6276b9fc589c00fb5fab2fb1d04bb88cb5f346', afLabel: "Kodspr\u00E5k", afFor: "framework-group" }), h("digi-form-radiogroup", { key: '54a1e0fcc32c78fcca11e3bf8d85c4b74951d6d0', afName: "framework", id: "framework-group", afValue: this.framework, afLayout: "vertical", onAfOnGroupChange: (e) => this.handleFrameworkChange(e) }, h("digi-form-radiobutton", { key: 'a1b5053acb6ae89be7a6cc5537b3e5ee12cd8c0c', afLabel: "HTML", afValue: "html" }), h("digi-form-radiobutton", { key: 'f0fe9586373e220f804f96e19fd25fec5d22079c', afLabel: "Angular", afValue: "angular" }), h("digi-form-radiobutton", { key: '7f0df4fa19a244457429d3ec3db4d0b980e47656', afLabel: "React", afValue: "react" }))), h("div", { key: 'e60e0425985ed42104c34cdd31d2144ae20029f8', class: "control-panel-section control-panel-section--button" }, h("digi-button", { key: '0e1e84d9eee42478ff0df600f5ee06bbadba5d08', id: "copy-button", "af-size": "medium", "af-variation": "function", onAfOnClick: () => this.handleCopyCode() }, h("digi-icon-copy", { key: 'f177c497410ea6a4527bb96ded7dac5ca6ad240f', slot: "icon" }), "Kopiera kod")))), h("div", { key: 'ca32d09587fab29ff9a44fa554f173ef3459eb67', id: "readme-content", class: "section-spacing readme-content-area", innerHTML: this.readmeMainContent }), h("digi-layout-block", { key: '46b81dfca1ced4066f1282e237d7f4227248c2cd', "af-variation": "symbol", class: "digi-docs-home-main-quote-block section-spacing" }, h("digi-layout-container", { key: '1afa39463ac2ac4f726cc2f98ba8702479bb2e98' }, h("div", { key: 'aa44f0f38f11f02d3228a151cbec46279ae00f49', class: "quote-container" }, h("digi-quote", { key: 'b33dfd2231d5cd3ce869afeb214dedc03778db09', "af-type": "default", "af-variation": "transparent", "af-image-position": "left", "af-image-src": "/assets/images/startpage/jesper-kennholt.jpeg", "af-image-alt": "Profilbild p\u00E5 Jesper Kennholt", "af-quote-author-name": "Jesper Kennholt", "af-quote-author-title": "Bed\u00F6ma planera & matcha" }, h("p", { key: '9957a64254f6931ab58322bc601b8b3fb31cb07c', style: { fontWeight: 'bold', marginBottom: '0.5rem' } }, "Yrkesv\u00E4ljaren var en game changer f\u00F6r oss!"), "V\u00E5ra anv\u00E4ndare hittar nu snabbt r\u00E4tt yrke, och vi f\u00E5r inte l\u00E4ngre klagom\u00E5l & incidenter att hantera i Kompetensprofilen. Och det ger b\u00E4ttre matchning!")))), h("div", { key: '630ddd8f9ca00c10ef831a13953856be096a38c8', style: { marginTop: '3rem' } }, h("div", { key: 'f4ecdc6da9779bdc6f0df077b919b49889eb86e4', class: "footer-cards-container", style: { display: 'flex', flexDirection: 'column', gap: '2rem' } }, h("digi-info-card", { key: '64a34a777d5d732172294c3062a5d7f9e3d19521', "af-heading": this.latestVersion ? `Nytt i version ${this.latestVersion} - ${this.latestDate}` : "Förvaltning", "af-heading-level": "h2", "af-variation": "primary" }, h("digi-typography", { key: '3bd6d456e6eb494e29fc2f40f784901fbcceae72' }, this.latestVersion && (h(Fragment, { key: '198e87c1748ccf717ed9ddc4533e2be922b25bc3' }, h("p", { key: 'c795d00c24a233b6e49d76b09f44085c3c48535b', style: { marginTop: '0', marginBottom: '0' } }, this.latestType && h("strong", { key: 'e32662dbcb335b466b0de3784bf8bc8ea96e082b' }, this.latestType)), h("div", { key: '8087d865ebc46675e16cd34ca90ed0ffe82eb5b9', innerHTML: this.latestChanges }), h("p", { key: '1d94a65a43a506084cd8659cbb26144059b3372e' }, h("digi-link", { key: 'af9a757b3df5b3e08c894c370352500bd88cfa1a', "af-href": "/CHANGELOG.md", "af-target": "_blank", "af-variation": "primary" }, "L\u00E4s hela changelog", h("digi-icon-arrow-forward", { key: '131db6398a334523ed26469ca71c59f7bea58f99', slot: "icon-secondary" }))), h("h2", { key: '671cc0ae7618a14c5944d760946bbcc79bf3356e', style: { marginTop: '2.5rem' } }, "F\u00F6rvaltning"))), h("p", { key: '38bef00b08645bc73052b541e8e277579ab8820f' }, "Yrkesv\u00E4ljaren f\u00F6rvaltas av teamet bakom Taxonomin, och hanteras som \u00F6ppen k\u00E4llkod. Kontakta oss p\u00E5", ' ', h("digi-link", { key: '8a054b4b3ed10434c63970d5b426afa3cacfa1bd', "af-href": "mailto:taxonomy@arbetsformedlingen.se", "af-variation": "primary" }, "taxonomy@arbetsformedlingen.se", h("digi-icon-envelope", { key: '8ca8238fa9debc59813ec4371641345bda18c574', slot: "icon-secondary" })), ". Bidra och rapportera buggar i v\u00E5rt gitlab-repo."), h("p", { key: '47b3368c8591869a59b2105a9ade6fda5031f0f3' }, h("digi-link", { key: '28deb2ea7cb53f12b077588cc1f60e4d4dbf3cc9', "af-href": "https://gitlab.com/arbetsformedlingen/taxonomy-dev/frontend/yrkesvaljaren", "af-target": "_blank", "af-variation": "primary" }, "K\u00E4llkod p\u00E5 Gitlab", h("digi-icon-external-link", { key: '4795dea2e08294a56fa46580b80cb6e666bef293', slot: "icon-secondary" })))))))), h("digi-tablist-panel", { key: '2b8243e9b01bb33fe1938ed2a3db38b0736dbbbe', tab: "kod" }, h("div", { key: '874cd35b6f1b86a99dd32a22ff36a9d8652760db', id: "code-tab-content", class: "digi-layout-grid section-spacing readme-content-area" }, h("div", { key: '392005b6810bd9ad9a956e0b829febf3b089a797', class: "digi-layout-column digi-layout-column--12" }, h("h3", { key: '626eb8a864a49820c7f4dad3bddb0c5e3f0d0c6e', id: "installation" }, "Installation"), h("digi-form-fieldset", { key: '1ae759b2f722791c0ec98b6e48e0802685718d8f', "af-legend": "V\u00E4lj hur du vill uppdatera taxonomiversionerna f\u00F6r att se anpassad instruktion.", style: { marginTop: '1rem', marginBottom: '1.5rem' } }, h("digi-form-radiogroup", { key: 'f83a4f6e80dfdd8813c80c805960ad39ba4654fe', "af-name": "data-version-selection-kod", "af-value": this.codeInstallationMode, onAfOnGroupChange: (e) => this.handleCodeInstallationModeChange(e) }, h("digi-form-radiobutton", { key: '16948037c7f393d29a6a9c449bf08f376557bca3', "af-label": "Automatiskt uppdaterad till senaste version", "af-value": "latest", "af-checked": this.codeInstallationMode === 'latest' }), h("div", { key: '43c9af443c866c1f70bb1b361b66a3575df8c9ff', class: "radiobutton-description" }, "Yrkesdatan h\u00E4mtas fr\u00E5n Yrkesv\u00E4ljarens egen CDN-distribuerade kopia. Datat beh\u00F6ver inte lagras p\u00E5 din server."), h("digi-form-radiobutton", { key: 'd2d85bc1afef6fc0d9720e5fe24994ff4300e027', "af-label": this.latestYvDataVersion ? `Låst till specifik version, t.ex v${this.latestYvDataVersion}` : 'Låst till specifik version', "af-value": "versioned", "af-checked": this.codeInstallationMode === 'versioned' }), h("div", { key: '6642753992393db2ae1979a8684cd203873e34a6', class: "radiobutton-description" }, "Valt datapaket synkas till ditt projekt vid bygge, och servas sedan till klienten fr\u00E5n din server tillsammans med webbkomponenten (och resten av din webbsida/app). "))), h("div", { key: 'f8a7dc49c01ca8ca694aa6b06a8d0c323828e9f7', class: "code-output-container", style: { marginTop: '1.5rem', marginBottom: '2rem' } }, h("div", { key: '4c80df59895a927cb89ace1ed5e19da6e1e6bb98', class: "track-code-step" }, h("digi-typography", { key: 'a02c6414e9d2502f500b8bfb95020da92ae9c007' }, h("p", { key: '5d7d53fd105c2f9bbc57bc0ae2ee15dd84e3b9d9', style: { margin: '0' } }, h("strong", { key: '1d9e254f297c7ed5075556f3c639472ebeedc062' }, "1. Kopiera och k\u00F6r detta skript f\u00F6r att installera Yrkesv\u00E4ljaren i ditt projekt. "))), h("digi-code-block", { key: 'e84b10b7da97b2c720833ae35faaec434230cb01', class: "digi-code-block-custom", "af-language": "bash", "af-variation": "dark", "af-code": this.getInstallationCommandPart1(), "af-hide-toolbar": "false" })), this.codeInstallationMode === 'versioned' && (h("div", { key: 'd9c9055bb42a4e3cee5e12a95e6d54785abc54e6', class: "track-code-step", style: { marginTop: '1rem' } }, h("digi-typography", { key: '689704ca6b1bcabe87130bbd25a196a93cd491fc' }, h("p", { key: 'f132f1d3a644d8857a0c96c9fc3970f01f0352ed', style: { margin: '0' } }, h("strong", { key: '17ef4a182359e0372d48cb309e484c07f19e586d' }, "2. Installera datapaketet f\u00F6r vald taxonomiversion"))), h("digi-code-block", { key: '5e024b67cfb8089d9467b8dc676d0210a2994e31', class: "digi-code-block-custom", "af-language": "bash", "af-variation": "dark", "af-code": this.getInstallationCommandPart2(), "af-hide-toolbar": "false" }))), h("div", { key: '1d12da14d73c4b6fbfb24511b238c4ca65b145bc', class: "track-code-step", style: { marginTop: '1rem' } }, h("digi-typography", { key: 'fef606609bc9b5cbc8b55733322a2b8622913e32' }, h("p", { key: '644a6282210e2e3e1abcf1688cc653a3092e5991', style: { margin: '0' } }, h("strong", { key: 'b31f8aeb6808b0ae49492304cb5a3518e31eeca0' }, this.codeInstallationMode === 'latest' ? '2' : '3', ". Initiera komponenten i din kod"))), h("digi-code-block", { key: 'c2bf53b8d2a809a18a026e2ef3e7c543114d8754', class: "digi-code-block-custom", "af-language": this.framework === 'react' ? 'javascript' : 'xml', "af-variation": "dark", "af-code": this.getSetupCommand(), "af-hide-toolbar": "false" })), h("div", { key: '3e8aa11885a7ee8ef2b0198def2ea331e83066ba', class: "track-code-step", style: { marginTop: '1rem' } }, h("digi-typography", { key: 'ab0e157b03c963b4db5189552d0c414f4bc2ccad' }, h("p", { key: 'bad2e003c192e0142adc7a7207075eb0b6bba670', style: { margin: '0' } }, h("strong", { key: 'efaf5fcdb1b3cd2d1c2f80341c728ebdda7a7754' }, this.codeInstallationMode === 'latest' ? '3' : '4', ". Anv\u00E4nd komponenten i ditt gr\u00E4nssnitt"))), h("digi-code-block", { key: 'b5d1da9d88351072c9989e8256c7d54317fa5742', class: "digi-code-block-custom", "af-language": this.framework === 'react' ? 'javascript' : 'xml', "af-variation": "dark", "af-code": this.getUsageCommand(), "af-hide-toolbar": "false" })))), this.readmeCodeContent.map(nodeHtml => (h("div", { innerHTML: nodeHtml }))))))))));
|
|
609
|
+
}
|
|
610
|
+
getInstallationCommandPart1() {
|
|
611
|
+
return `/bin/bash -c "echo '@taxonomy:registry=https://gitlab.com/api/v4/projects/74569456/packages/npm/' >> .npmrc &&\nnpm install @taxonomy/yrkesvaljaren"`;
|
|
612
|
+
}
|
|
613
|
+
getInstallationCommandPart2() {
|
|
614
|
+
return `npm install ${this.getExampleDataPackageName()}`;
|
|
615
|
+
}
|
|
616
|
+
getSetupCommand() {
|
|
617
|
+
const isLatest = this.codeInstallationMode === 'latest';
|
|
618
|
+
const dataPackageName = this.getExampleDataPackageName();
|
|
619
|
+
const indent = ' ';
|
|
620
|
+
let code = '';
|
|
621
|
+
if (this.framework === 'html') {
|
|
622
|
+
code += isLatest
|
|
623
|
+
? `<script type="module">\n${indent}import { defineCustomElements as defineYrkesvaljaren } from '@taxonomy/yrkesvaljaren/loader';\n${indent}defineYrkesvaljaren();\n</script>`
|
|
624
|
+
: `<script type="module">\n${indent}import { registerTaxonomy } from '@taxonomy/yrkesvaljaren';\n${indent}import { defineCustomElements as defineYrkesvaljaren } from '@taxonomy/yrkesvaljaren/loader';\n${indent}import { taxonomyData, metadata } from '${dataPackageName}';\n${indent}registerTaxonomy({ data: taxonomyData, metadata });\n${indent}defineYrkesvaljaren();\n</script>`;
|
|
625
|
+
}
|
|
626
|
+
else if (this.framework === 'react') {
|
|
627
|
+
code += isLatest
|
|
628
|
+
? `import { Yrkesvaljaren } from '@taxonomy/yrkesvaljaren-react';`
|
|
629
|
+
: `import { Yrkesvaljaren } from '@taxonomy/yrkesvaljaren-react';\nimport { registerTaxonomy } from '@taxonomy/yrkesvaljaren';\nimport { defineCustomElements } from '@taxonomy/yrkesvaljaren/loader';\nimport { taxonomyData, metadata } from '${dataPackageName}';\nregisterTaxonomy({ data: taxonomyData, metadata });\ndefineCustomElements();`;
|
|
630
|
+
}
|
|
631
|
+
else if (this.framework === 'angular') {
|
|
632
|
+
code += isLatest
|
|
633
|
+
? `import { defineCustomElements as defineYrkesvaljaren } from '@taxonomy/yrkesvaljaren/loader';\ndefineYrkesvaljaren();`
|
|
634
|
+
: `import { registerTaxonomy } from '@taxonomy/yrkesvaljaren';\nimport { defineCustomElements as defineYrkesvaljaren } from '@taxonomy/yrkesvaljaren/loader';\nimport { taxonomyData, metadata } from '${dataPackageName}';\nregisterTaxonomy({ data: taxonomyData, metadata });\ndefineYrkesvaljaren();`;
|
|
635
|
+
}
|
|
636
|
+
return code;
|
|
637
|
+
}
|
|
638
|
+
getUsageCommand() {
|
|
639
|
+
const indent = ' ';
|
|
640
|
+
let code = '';
|
|
641
|
+
if (this.framework === 'html') {
|
|
642
|
+
code += `<digi-service-job-selector\n`;
|
|
643
|
+
code += `${indent}af-label="Välj yrke"\n`;
|
|
644
|
+
if (this.variant === 'multi') {
|
|
645
|
+
code += `${indent}af-label-description="Du kan välja mer än ett yrke"\n`;
|
|
646
|
+
code += `${indent}af-enable-multiple="true"\n`;
|
|
647
|
+
}
|
|
648
|
+
code += `${indent}af-required="${this.required}"\n`;
|
|
649
|
+
code += `${indent}af-manual-input="${this.allowFreeText}"\n`;
|
|
650
|
+
code += `${indent}af-history="${this.history}"\n`;
|
|
651
|
+
if (this.size !== 'medium')
|
|
652
|
+
code += `${indent}af-size="${this.size}"\n`;
|
|
653
|
+
code += `></digi-service-job-selector>`;
|
|
654
|
+
}
|
|
655
|
+
else if (this.framework === 'angular') {
|
|
656
|
+
code += `<digi-service-job-selector\n`;
|
|
657
|
+
code += `${indent}[attr.af-label]="'Välj yrke'"\n`;
|
|
658
|
+
if (this.variant === 'multi') {
|
|
659
|
+
code += `${indent}[attr.af-label-description]="'Du kan välja mer än ett yrke'"\n`;
|
|
660
|
+
code += `${indent}[attr.af-enable-multiple]="true"\n`;
|
|
661
|
+
}
|
|
662
|
+
code += `${indent}[attr.af-required]="${this.required}"\n`;
|
|
663
|
+
code += `${indent}[attr.af-manual-input]="${this.allowFreeText}"\n`;
|
|
664
|
+
code += `${indent}[attr.af-history]="${this.history}"\n`;
|
|
665
|
+
if (this.size !== 'medium')
|
|
666
|
+
code += `${indent}[attr.af-size]="'${this.size}'"\n`;
|
|
667
|
+
code += `></digi-service-job-selector>`;
|
|
668
|
+
}
|
|
669
|
+
else if (this.framework === 'react') {
|
|
670
|
+
code += `export const MyComponent = () => (\n`;
|
|
671
|
+
code += `${indent}<Yrkesvaljaren\n`;
|
|
672
|
+
code += `${indent}${indent}afLabel="Välj yrke"\n`;
|
|
673
|
+
if (this.variant === 'multi') {
|
|
674
|
+
code += `${indent}${indent}afLabelDescription="Du kan välja mer än ett yrke"\n`;
|
|
675
|
+
code += `${indent}${indent}afEnableMultiple={true}\n`;
|
|
676
|
+
}
|
|
677
|
+
code += `${indent}${indent}required={${this.required}}\n`;
|
|
678
|
+
code += `${indent}${indent}manualInput={${this.allowFreeText}}\n`;
|
|
679
|
+
code += `${indent}${indent}afHistory={${this.history}}\n`;
|
|
680
|
+
if (this.size !== 'medium')
|
|
681
|
+
code += `${indent}${indent}afSize="${this.size}"\n`;
|
|
682
|
+
code += `${indent}/>\n`;
|
|
683
|
+
code += `);`;
|
|
684
|
+
}
|
|
685
|
+
return code;
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
YrkesvaljarenDemo.style = jobSelectorDemoCss();
|
|
689
|
+
|
|
690
|
+
export { YrkesvaljarenDemo as job_selector_demo };
|