{"version":3,"file":"modal.4-H7xht7.js","sources":["../../../../core/src/path.ts","../../../src/components/share/modal.svelte"],"sourcesContent":["import { cdnBaseUrl } from './gamera'\n\nexport const clean = (x: string) =>\n x\n .toLowerCase()\n // remove duplicate whitespace\n .replace(/\\s+/g, ' ')\n // convert single and double curly quotes to respective straight quotes\n .replaceAll('‘', \"'\")\n .replaceAll('’', \"'\")\n .replaceAll('“', '\"')\n .replaceAll('”', '\"')\n // remove trailing ?\n .replace(/\\?+$/, '')\n .trim()\n\nconst contains = (s: string, chars: string[]) => {\n let res = false\n for (const i in chars) {\n res = res || s.includes(chars[i])\n if (res) return res\n }\n return res\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#encoding_for_rfc3986\nexport const encodeRFC3986URIComponent = (str: string) => {\n return (\n encodeURIComponent(str)\n .replace(\n /[!'()*]/g,\n (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,\n )\n // application/x-www-form-urlencoded\n .replaceAll('%20', '+')\n )\n}\n\nexport const hasSymbols = (s: string) =>\n contains(encodeRFC3986URIComponent(clean(s)), ['%', '-'])\n\nexport const createSlug = (s: string) =>\n clean(s).replaceAll(' ', '-').replace(/-+$/, '')\n\nexport const createAskPath = ({\n domain,\n query,\n l,\n}: {\n domain?: string\n query: string\n l?: string\n}) => {\n let path = hasSymbols(query)\n ? `/ask?q=${encodeRFC3986URIComponent(query)}`\n : `/ask/${createSlug(query)}`\n const normalizedDomain = domain?.toLowerCase() === 'epl' ? 'fc' : domain\n if (l) {\n path = (path.includes('?') ? path + '&' : path + '?') + 'l=' + l\n }\n if (domain) return `/${normalizedDomain}${path}`\n return path\n}\n\nexport const imageForgeUrl = ({\n bgColor = 'FFFFFF',\n type,\n url,\n}: {\n bgColor?: string\n type: 'facebook' | 'twitter'\n url: string\n}) => {\n const bg =\n bgColor[0] === '#' ? bgColor.slice(1).toUpperCase() : bgColor.toUpperCase()\n return `${cdnBaseUrl}/forge-v2/${btoa(\n `${url}?${new URLSearchParams({\n bg,\n t: type,\n }).toString()}`,\n ).replaceAll('/', '_')}.png`\n}\n","\n\n\n\n\n{#if $isShareModalOpen}\n
Share this search
\n \n\n {type === 'musing' && !checked\n ? 'This answer is static and will not update'\n : 'This answer is live and will keep updating'}\n
\n {/if}\n