PageSourceSearch

https://coffee-labo.co.jp/wp-content/cache/min/1/wp-content/themes…/assets/js/coffee-quiz.js?ver=1790126336

js coffee-labo.co.jp collected 2026-09-24 22:21:44 UTC 28,464 bytes, 52 lines download raw bytes

1document.addEventListener("DOMContentLoaded",()=>{const QUIZ_DATA=[{key:"flavor",question:"Q1: どのようなフレーバーに惹かれますか?",subtitle:"普段好む味を考えてみてください。",options:["華やか、フルーティー","ナッツ、チョコレートのよう","スモーキー、力強い","バランスが取れていて滑らか"]},{key:"acidity",question:"Q2: コーヒーの酸味についてはどうですか?",subtitle:"爽やかな酸味が好きか、穏やかなものが良いか教えてください。",options:["フルーティーな酸味が好き","少し感じるくらいが丁度いい","酸味はあまり得意ではない"]},{key:"body",question:"Q3: 口当たりの好みはありますか?",subtitle:"飲んだ時の満足感をイメージしてください。",options:["すっきり軽やか","バランスが取れている","どっしり重厚感"]},{key:"effort",question:"Q4: どれくらいの手間をかけたいですか?",subtitle:"毎日の習慣に合わせて正直に答えてください!",options:["ほぼ手間なし(お湯を注ぐだけなど)","少しの手間(ドリップマシンなど)","プロセスを楽しむ(ハンドドリップなど)"]},{key:"caffeine",question:"Q5: カフェインはどのくらい気にしますか?",subtitle:"時間帯や体調に合わせて選んでみましょう。",options:["しっかり摂りたい(気にしない)","普通で良い","控えめが良い(デカフェ)"]},{key:"roast",question:"Q6: 焙煎度合いの好みはありますか?",subtitle:"香ばしさや苦味のバランスを選んでください。",options:["浅煎り(フルーティー)","中煎り(バランス)","深煎り(ビター)"]},{key:"pairing",question:"Q7: コーヒーと何を合わせるのが好きですか?",subtitle:"お気に入りの組み合わせを教えてください。",options:["スイーツやケーキ","特に何も合わせない","チョコレート"]},{key:"importance",question:"Q8: コーヒーを選ぶ上で最も重視することは?",subtitle:"あなたのコーヒー哲学を教えてください。",options:["香り","味のバランス","手軽さ","珍しさ"]}];const COFFEE_DATA={decafGuide:{name:"デカフェのコーヒー選び",tagline:"カフェインを控えたい希望を優先しました",description:"味の好みに加えて、デカフェであることを条件に選びましょう。デカフェ専用の比較記事から、豆や粉などお好みのタイプを探せます。",ctaText:"デカフェの比較記事を見る",ctaUrl:"https://coffee-labo.co.jp/decaf-recommended/",internal:!0},laboCafe:{name:"ラボカフェ 定期便",tagline:"あなただけのコーヒー体験を",imageUrl:"https://coffee-labo.co.jp/wp-content/uploads/2022/03/6e5c6d711d5e73c5789269fd7ee5e10c.jpg",description:"専門のコーヒー鑑定士が厳選した、高品質なスペシャルティコーヒーの定期便。あなたの好みに合わせた特別な一杯で、毎日を豊かに彩ります。",ctaText:"定期便を詳しく見る",ctaUrl:"https://coffee-labo.co.jp/products/subscription/",internalLinkText:"ラボカフェの魅力とは?評判・口コミやおすすめ人気コーヒー豆も紹介!",internalLinkUrl:"https://coffee-labo.co.jp/labo-cafe/"},coffeeSoldier:{name:"コーヒーソルジャー",tagline:"まずは人気の一杯を試したい方に",imageUrl:"https://coffee-labo.co.jp/wp-content/uploads/2020/06/f97ce16d09a6306f72fa058663f89dd3.jpg",description:"コーヒーソルジャーが気になる方に向けたおすすめ。まずはお試しで味を確かめたい方、手軽に美味しいコーヒー体験を始めたい方に向いています。",ctaText:"商品ページを見る",ctaUrl:"https://af.moshimo.com/af/c/click?a_id=1919333&p_id=1956&pc_id=3910&pl_id=26914&url=http%3A%2F%2Fcoffeesoldier.shop-pro.jp%2F%3Fpid%3D107962818",internalLinks:[{text:"コーヒーソルジャー お試しセットのレビュー・詳細はこちら",url:"https://coffee-labo.co.jp/coffee-soldier-trial-set/"},{text:"コーヒーソルジャーの評判・特徴まとめはこちら",url:"https://coffee-labo.co.jp/coffee-soldier/"}]},coffeeCarrot:{name:"珈琲きゃろっと 初回お試しセット",tagline:"感動の香りを、まずはお試し",imageUrl:"https://coffee-labo.co.jp/wp-content/uploads/2019/06/coffee-carrot-set-1.jpg",description:"初めての方限定!「これ本当にコーヒー?」と驚くほどのフルーティーな香りと甘さを体験できるセット。焙煎したての新鮮な豆だけが持つ、格別な味わいをご家庭で。",ctaText:"お試しセットを見る",ctaUrl:"https://px.a8.net/svt/ejp?a8mat=3BBPK4+4786QY+2CG0+5YJRM",internalLinkText:"珈琲きゃろっとの評判・口コミは?おすすめの初回お試しセットも紹介",internalLinkUrl:"https://coffee-labo.co.jp/carrot/"},doiCoffee:{name:"土居珈琲 おためしセット",tagline:"職人技が光る、極上の一杯",imageUrl:"https://coffee-labo.co.jp/wp-content/uploads/2020/11/IMG_9945.jpeg",description:"創業40年以上の老舗が、注文後に少量ずつ丁寧に焙煎。豆が持つポテンシャルを最大限に引き出した、深く豊かな味わいが特徴です。本物のコーヒーの味を知りたいあなたに。",ctaText:"お試しセットを見る",ctaUrl:"https://px.a8.net/svt/ejp?a8mat=3BBEJS+E9T65M+2H8I+5YJRM",internalLinkText:"土居珈琲の評判は?美味しさの理由からおすすめの豆まで解説",internalLinkUrl:"https://coffee-labo.co.jp/doi/"}};const RESULT_TYPES={adventurousExplorer:{name:"冒険家タイプ",description:"新しいフレーバーや体験を求めるあなた。フルーティーで華やかな香りのコーヒーに心惹かれる傾向があります。コーヒーを淹れるプロセスそのものも楽しむことができる、好奇心旺盛なタイプです。",coffeeId:"coffeeCarrot",imageUrl:"https://coffee-labo.co.jp/wp-content/uploads/2022/09/pixta_78235373_M.jpg"}
1,qualitySeeker:{name:"本格志向タイプ",description:"コーヒー本来の深く豊かな味わいを大切にするあなた。チョコレートやナッツのようなリッチな風味や、職人技が光る一杯を求めています。本物を見極める確かな舌を持つ、コーヒー通タイプです。",coffeeId:"doiCoffee",imageUrl:"https://coffee-labo.co.jp/wp-content/uploads/2024/11/pixta_92503091_M.jpg"},everydayComfort:{name:"バランス重視タイプ",description:"毎日の生活にそっと寄り添う、バランスの取れた一杯を好むあなた。手間をかけすぎず、安らぎのひとときを楽しみたいと考えています。どんなシーンにも合う、調和の取れたコーヒーがぴったりです。",coffeeId:"laboCafe",imageUrl:"https://coffee-labo.co.jp/wp-content/uploads/2024/11/pixta_98498963_M.jpg"},trendySeeker:{name:"トレンド追求タイプ",description:"常に新しいものや話題のものを追いかけるあなた。デザイン性の高いパッケージや、SNSで話題のコーヒーに興味があります。コーヒーを通じてライフスタイルを表現するタイプです。",coffeeId:"coffeeSoldier",imageUrl:"https://coffee-labo.co.jp/wp-content/uploads/2019/07/pixta_42843010_M.jpg"}};const QUIZ_VARIANT="A"
2const SCORING_CONFIG={A:{initialBias:{everydayComfort:2,adventurousExplorer:0,qualitySeeker:0,trendySeeker:0}}}
3const container=document.getElementById("quiz-container");if(!container)return;const quizBody=container.querySelector("#quiz-body");const resultArea=container.querySelector("#result-area");let index=0,answers={},resultType=null;let questionStartTime=null,quizStartTime=null,quizInProgress=!1,abandonmentFired=!1;let resultViewStartTime=null;let quizStarted=!1;function trackEvent(name,params){if(typeof gtag==="function")gtag("event",name,{...params,quiz_variant:QUIZ_VARIANT})}
4function el(tag,attrs,children){const e=document.createElement(tag);if(attrs){for(const k in attrs){if(k==="className")e.className=attrs[k];else if(k==="dataset"){for(const d in attrs[k])e.dataset[d]=attrs[k][d]}else if(attrs[k]!=null)e.setAttribute(k,attrs[k])}}
5if(children){(Array.isArray(children)?children:[children]).forEach(ch=>{if(ch==null)return;e.appendChild(typeof ch==="string"?document.createTextNode(ch):ch)})}
6return e}
7function svgEl(paths,vb){const NS="http://www.w3.org/2000/svg";const svg=document.createElementNS(NS,"svg");svg.setAttribute("viewBox",vb||"0 0 24 24");paths.forEach(d=>{const p=document.createElementNS(NS,"path");p.setAttribute("d",d);svg.appendChild(p)});return svg}
8function trackAbandonment(){if(!quizInProgress||abandonmentFired||index>=QUIZ_DATA.length)return;abandonmentFired=!0;const timeSpent=quizStartTime?Math.round((Date.now()-quizStartTime)/1000):0;trackEvent("quiz_abandoned",{abandoned_at_question:index+1,total_questions:QUIZ_DATA.length,time_spent_seconds:timeSpent,answers_given:Object.keys(answers).length})}
9document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){trackAbandonment();if(resultViewStartTime&&!quizInProgress){trackEvent("result_view_duration",{result_type:resultType?resultType.name:'',type_key:resultType?resultType.typeKey:'',duration_seconds:Math.round((Date.now()-resultViewStartTime)/1000)});resultViewStartTime=null}}});window.addEventListener("pagehide",()=>{trackAbandonment()});function showCelebration(){const celebIcon=el("div",{className:"celebration-icon"});const celebSvg=svgEl(["M2 21V19H22V21ZM4 17V10H6V17ZM8 17V7C8 6.45 8.196 5.979 8.588 5.587C8.98 5.195 9.45 5 10 5H18C18.55 5 19.021 5.195 19.413 5.587C19.805 5.979 20 6.45 20 7V10H16V17ZM10 10H14V7H10ZM18 10V7H16V10Z"],"0 0 24 24");celebSvg.style.cssText="width:48px;height:48px;fill:#8b5e3c;";celebIcon.appendChild(celebSvg);const celebBlock=el("div",{className:"celebration-block"},[celebIcon,el("p",{className:"celebration-text"},["診断完了!"]),el("p",{className:"celebration-subtext"},["あなたにぴったりのコーヒーを分析中..."])]);quizBody.textContent="";quizBody.appendChild(celebBlock);quizBody.classList.remove("hidden");resultArea.classList.add("hidden");setTimeout(()=>{renderResult()},2000)}
10function generateShareCard(rt,callback){const canvas=document.createElement('canvas');canvas.width=1200;canvas.height=630;const ctx=canvas.getContext('2d');const grad=ctx.createLinearGradient(0,0,1200,630);grad.addColorStop(0,'#2c1810');grad.addColorStop(1,'#4a2c20');ctx.fillStyle=grad;ctx.fillRect(0,0,1200,630);ctx.fillStyle='#c4a882';ctx.font='600 24px sans-serif';ctx.fillText('コーヒー診断結果',60,80);ctx.fillStyle='#ffffff';ctx.font='700 48px sans-serif';ctx.fillText('あなたは',60,180);ctx.fillText('「'+rt.name+'」',60,240);ctx.font='400 20px sans-serif';if(rt.caffeinePreference==='decaf')ctx.fillText('カフェインã
10®å¸Œæœ›ï¼šãƒ‡ã‚«ãƒ•ã‚§',60,275);const words=rt.description;const maxW=500;const lineH=30;let y=310;let line='';for(let i=0;i<words.length;i++){const test=line+words[i];if(ctx.measureText(test).width>maxW&&line){ctx.fillText(line,60,y);y+=lineH;line=words[i]}else line=test}
11if(line)ctx.fillText(line,60,y);ctx.fillStyle='#c4a882';ctx.font='600 18px sans-serif';ctx.fillText('coffee-labo.co.jp',60,580);const img=new Image();img.crossOrigin='anonymous';img.onload=function(){ctx.drawImage(img,620,40,540,550);callback(canvas)};img.onerror=function(){callback(canvas)};img.src=rt.imageUrl}
12function renderQuestion(){questionStartTime=Date.now();if(index===0&&!quizStarted)quizStartTime=Date.now();if(index>=QUIZ_DATA.length){showCelebration();return}
13const q=QUIZ_DATA[index];const prog=((index+1)/QUIZ_DATA.length)*100;const fillDiv=el("div",{className:"progress-bar-fill"});fillDiv.style.width=prog+"%";const optionsContainer=el("div",{className:"options-container",role:"radiogroup","aria-labelledby":"quiz-question-title"});q.options.forEach((o,i)=>{const id="q"+index+"-"+i;const radio=el("input",{type:"radio",id:id,name:"q-"+index,value:o});if(answers[q.key]===o)radio.checked=!0;const label=el("label",{"for":id},[el("span",{className:"option-radio-visual"},[el("span",{className:"inner-dot"})]),el("span",null,[o])]);optionsContainer.appendChild(el("div",null,[radio,label]))});const trackDiv=el("div",{className:"progress-bar-track",role:"progressbar","aria-valuenow":String(Math.round(prog)),"aria-valuemin":"0","aria-valuemax":"100"},[fillDiv])
14const blockChildren=[el("div",{className:"progress-bar-container"},[el("div",{className:"progress-bar-labels"},[el("span",{className:"label-text"},["Q"+(index+1)]),el("span",{className:"label-count"},[(QUIZ_DATA.length-index-1)>0?"あと "+(QUIZ_DATA.length-index-1)+" 問":"最後の質問"])]),trackDiv]),el("p",{className:"question-title",id:"quiz-question-title",tabindex:"-1"},[q.question]),el("p",{className:"question-subtitle"},[q.subtitle]),optionsContainer];if(index===0&&!quizStarted){const lead=el("p",{className:"quiz-lead"},["全"+QUIZ_DATA.length+"問・約30秒で、あなたにぴったりの一杯がわかります"]);blockChildren.unshift(lead)}
15if(index>0){blockChildren.push(el("div",{className:"back-button-container"},[(function(){const btn=el("button",{className:"back-button"},["前の質問に戻る"]);const arw=svgEl(["M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"],"0 0 24 24");arw.style.cssText="width:14px;height:14px;fill:currentColor;";btn.prepend(arw);return btn})()]))}
16const block=el("div",{className:"question-block"},blockChildren);quizBody.textContent="";quizBody.appendChild(block);quizBody.classList.remove("hidden");resultArea.classList.add("hidden");let advanceTimer=null;block.querySelectorAll('input[type=radio]').forEach(r=>r.onchange=e=>{const timeSpent=questionStartTime?Math.round((Date.now()-questionStartTime)/1000):0;if(!quizStarted){quizStarted=!0;quizInProgress=!0;trackEvent("quiz_start",{})}
17answers[q.key]=e.target.value;trackEvent("question_answered",{question_key:q.key,answer:e.target.value,question_number:index+1,time_spent_seconds:timeSpent});clearTimeout(advanceTimer);advanceTimer=setTimeout(()=>{index++;renderQuestion()},300)});const back=block.querySelector(".back-button");if(back)back.onclick=()=>{clearTimeout(advanceTimer);index--;renderQuestion()};const qTitle=block.querySelector(".question-title")
18if(qTitle)qTitle.focus({preventScroll:!0})}
19function judge(){const s={...SCORING_CONFIG[QUIZ_VARIANT].initialBias};const a=answers;if(a.flavor==="華やか、フルーティー")s.adventurousExplorer+=3;if(a.flavor==="ナッツ、チョコレートのよう")s.qualitySeeker+=3;if(a.flavor==="スモーキー、力強い"){s.qualitySeeker+=1;s.everydayComfort+=1}
20if(a.flavor==="バランスが取れていて滑らか")s.everydayComfort+=3;if(a.acidity==="フルーティーな酸味が好き")s.adventurousExplorer+=2;if(a.acidity==="少し感じるくらいが丁度いい")s.everydayComfort+=1;if(a.acidity==="酸味はあまり得意ではない"){s.qualitySeeker+=1;s.everydayComfort+=1}
21if(a.body==="すっきり軽やか"){s.adventurousExplorer+=1;s.everydayComfort+=1}
22if(a.body==="バランスが取れている")s.everydayComfort+=2;if(a.body==="どっしり重厚感")s.qualitySeeker+=2;if(a.effort==="ほぼ手間なし(お湯を注ぐだけなど)"){s.trendySeeker+=4;s.everydayComfort+=1}
23if(a.effort==="少しの手間(ドリップマシンなど)")s.everydayComfort+=1;if(a.effort==="プロセスを楽しむ(ハンドドリップなど)"){s.adventurousExplorer+=1;s.qualitySeeker+=1}
24if(a.caffeine==="しっかり摂りたい(気にしない)")s.qual
24itySeeker+=1;if(a.caffeine==="普通で良い")s.everydayComfort+=1;if(a.caffeine==="控えめが良い(デカフェ)"){s.trendySeeker+=1;s.everydayComfort+=1}
25if(a.roast==="浅煎り(フルーティー)")s.adventurousExplorer+=2;if(a.roast==="中煎り(バランス)")s.everydayComfort+=3;if(a.roast==="深煎り(ビター)"){s.qualitySeeker+=3;s.everydayComfort+=1}
26if(a.pairing==="スイーツやケーキ")s.trendySeeker+=1;if(a.pairing==="特に何も合わせない")s.everydayComfort+=1;if(a.pairing==="チョコレート")s.qualitySeeker+=2;if(a.importance==="香り"){s.adventurousExplorer+=1;s.qualitySeeker+=1}
27if(a.importance==="味のバランス")s.everydayComfort+=2;if(a.importance==="手軽さ"){s.trendySeeker+=3;s.everydayComfort+=1}
28if(a.importance==="珍しさ"){s.adventurousExplorer+=1;s.trendySeeker+=1}
29const PRIORITY=["everydayComfort","adventurousExplorer","qualitySeeker","trendySeeker"];let key=PRIORITY[0],max=s[key];PRIORITY.forEach(k=>{if(s[k]>max){max=s[k];key=k}});return resultForType(key,a.caffeine==="控えめが良い(デカフェ)"?"decaf":"any")}
30function resultForType(key,preference){const caffeinePreference=preference==="decaf"||preference==="any"?preference:"unknown";return{...RESULT_TYPES[key],typeKey:key,caffeinePreference,...(caffeinePreference==="decaf"?{coffeeId:"decafGuide"}:{})}}
31function trackResultScrollDepth(){if(typeof IntersectionObserver==="undefined")return;const milestones=[25,50,75,100];const fired=new Set();const block=resultArea.querySelector('.result-block');if(!block)return;const observer=new IntersectionObserver((entries)=>{entries.forEach(entry=>{if(entry.isIntersecting){const pct=parseInt(entry.target.dataset.scrollDepth);if(!fired.has(pct)){fired.add(pct);trackEvent("result_scroll_depth",{result_type:resultType.name,type_key:resultType.typeKey,depth_percent:pct})}}})},{threshold:0.5});milestones.forEach(pct=>{const marker=el("div",{dataset:{scrollDepth:String(pct)}});marker.style.cssText='height:1px;width:1px;pointer-events:none;';const children=block.children;const insertIndex=Math.floor((pct/100)*children.length);if(insertIndex<children.length)block.insertBefore(marker,children[insertIndex]);else block.appendChild(marker);observer.observe(marker)})}
32function renderResult(typeKeyOverride,caffeinePreference){if(typeKeyOverride&&RESULT_TYPES[typeKeyOverride]){resultType=resultForType(typeKeyOverride,caffeinePreference)}else{resultType=judge()}
33const c=COFFEE_DATA[resultType.coffeeId];if(!typeKeyOverride){const totalTime=quizStartTime?Math.round((Date.now()-quizStartTime)/1000):0;trackEvent("quiz_completed",{result_type:resultType.name,coffee_id:resultType.coffeeId,total_time_seconds:totalTime})}
34quizInProgress=!1;resultViewStartTime=Date.now();if(!typeKeyOverride){try{localStorage.setItem("coffee-quiz-result",JSON.stringify({schemaVersion:2,typeKey:resultType.typeKey,caffeinePreference:resultType.caffeinePreference,timestamp:Date.now()}))}catch(e){}}
35const typeImg=el("img",{className:"result-type-image",src:resultType.imageUrl,alt:resultType.name,width:"672",height:"224",loading:"lazy"});let feedbackText=""
36if(!typeKeyOverride&&Object.keys(answers).length>0){const flavorMap={"華やか、フルーティー":"フルーティーな味わい","ナッツ、チョコレートのよう":"ナッツやチョコレート系の味わい","スモーキー、力強い":"力強い味わい","バランスが取れていて滑らか":"バランスの取れた味わい"}
37const importanceMap={"香り":"香り","味のバランス":"味のバランス","手軽さ":"手軽さ","珍しさ":"珍しさや新しい発見"}
38const f=flavorMap[answers.flavor]||""
39const imp=importanceMap[answers.importance]||""
40if(f&&imp)feedbackText=f+"を好み、"+imp+"を大切にするあなたにぴったりの一杯です。"}
41const typeCardChildren=[el("p",{className:"subtitle"},["あなたは..."]),el("p",{className:"result-type-name"},["「"+resultType.name+"」です!"]),typeImg,el("p",{className:"result-type-description"},[resultType.description])]
42if(feedbackText){typeCardChildren.push(el("p",{className:"result-type-feedback"},[feedbackText]))}
43const preferenceText=resultType.caffeinePreference==="decaf"?"カフェインの希望:控えめ(デカフェ)。デカフェ専用の比較記事をご案内します。":resultType.caffeinePreference==="unknown"?"この結果にはカフェインの希望が保存されていません。デカフェをご希望の場合は、もう一度診断してください。":"カフェインの希望:通常のコーヒーも選択肢に含める。";typeCardChildren.push(el("p",{className:"result-caffeine-preference"},[preferenceText]));const typeCard=el("div",{className:"result-type-card"},typeCardChildren)
44const productImg=c.imageUrl?el("img",{src:c.imageUrl,alt:c.name,width:"672",height:"224",loading:"lazy"}):null;const ctaLink=el("a",{href:c.ctaUrl,...(c.internal?{}:{target:"_blank",rel:"nofollow noopener noreferrer"}),className:"cta-button"},[c.ctaText]);ctaLink.addEventListener("click",()=>{trackEvent("cta_clicked",{result_type:resultType.name,type_key:resultType.typeKey,coffee_name:c.name,coffee_id:resultType.coffeeId,link_url:c.ctaUrl})});const cardChildren=[el("p",{className:"result-card-title"},[c.name]),el("p",{className:"tagline"},[c.tagline]),productImg,el("p",{className:"description"},[c.description]),ctaLink];if(c&&Array.isArray(c.internalLinks)&&c.internalLinks.length){const promo=el("p",{className:"internal-link-promo"},["詳しくは以下の記事を参考にして下さい!"]);c.internalLinks.forEach((l,i)=>{if(i>0)promo.appendChild(document.createElement("br"));promo.appendChild(document.createElement("br"));const a=el("a",{href:l.url},[l.text]);promo.appendChild(a)});cardChildren.push(promo)}else if(c&&c.internalLinkUrl&&c.internalLinkText){const promo=el("p",{className:"internal-link-promo"},["詳しくは以下の記事を参考にして下さい!"]);promo.appendChild(document.createElement("br"));promo.appendChild(el("a",{href:c.internalLinkUrl},[c.internalLinkText]));cardChildren.push(promo)}
45const resultCard=el("div",{className:"result-card"},cardChildren);resultCard.querySelectorAll('.internal-link-promo a').forEach((link,i)=>{link.addEventListener('click',()=>{trackEvent("internal_link_clicked",{result_type:resultType.name,type_key:resultType.typeKey,link_url:link.href,link_position:i+1})})});const xBtn=el("button",{className:"share-button share-x","aria-label":"Xでシェア",dataset:{p:"x"}},[svgEl(["M18.901 1.153h3.68l-8.04 9.19L24 22.846H16.594l-5.8-7.584L4.156 22.846H.474l8.6-9.83L0 1.154h7.594l5.243 6.932Z"])]);const fbBtn=el("button",{className:"share-button share-facebook","aria-label":"Facebookでシェア",dataset:{p:"facebook"}},[svgEl(["M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878V14.89H7.9V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33v6.988C18.343 21.128 22 16.991 22 12z"])]);const lineBtn=el("button",{className:"share-button share-line","aria-label":"LINEでシェア",dataset:{p:"line"}},[svgEl(["M12 1.2A10.8 10.8 0 0 0 1.2 12 10.8 10.8 0 0 0 12 22.8h.1A10.8 10.8 0 0 0 22.8 12 10.8 10.8 0 0 0 12 1.2zM16.4 14.3h-1.3a1 1 0 0 1-1-1.3 1.35 1.35 0 0 0-1.3-1 1.26 1.26 0 0 0-1.3 1.3v1h-1V9.5h1.1V11a2.27 2.27 0 0 1 2.7-1.5 2.53 2.53 0 0 1 2.6 2.4zm-5.3-4.8H9.9v4.8h1.2zm-3.1 0H6.8v4.8H8z"])]);const shareSection=el("div",{className:"share-section"},[el("p",{className:"share-section-title"},["診断結果をシェアする"]),el("div",{className:"share-buttons-container"},[xBtn,fbBtn,lineBtn])]);const lineCta=el("div",{className:"line-cta-section"},[el("p",{className:"line-cta-title"},["診断結果をLINEで保存 & おすすめ情報を受け取る"]),el("p",{className:"line-cta-subtitle"},["友だち追加で、あなたの「"+resultType.name+"」タイプに合ったコーヒー情報をお届けします"]),el("a",{href:"https://lin.ee/q64GmoF",target:"_blank",rel:"noopener noreferrer",className:"line-cta-button"},["LINEで友だち追加する"])]);lineCta.querySelector('.line-cta-button').addEventListener('click',()=>{trackEvent("line_friend_add_clicked",{result_type:resultType.name,type_key:resultType.typeKey})});const dlIcon=svgEl(["M5 20h14v-2H5v2zm7-18v12.17l3.59-3.58L17 12l-5 5-5-5 1.41-1.41L11 14.17V2h2z"],"0 0 24 24");dlIcon.style.cssText="width:16px;height:16px;fill:currentColor;";const downloadBtn=el("button",{className:"share-card-download"},[dlIcon,"診断カードをダウンロード"]);downloadBtn.addEventListener("click",()=>{generateShareCard(resultType,(canvas)=>{try{const link=document.createElement('a');link.download='coffee-diagnosis-'+resultType.typeKey+'.png';link.href=canvas.toDataURL('image/png');link.click();trackEvent("share_card_downloaded",{result_type:resultType.name})}
45catch(err){console.error("share card download failed:",err);trackEvent("share_card_download_failed",{result_type:resultType.name});alert("診断カードの画像生成に失敗しました。お手数ですが、結果画面のスクリーンショットをご利用ください。")}})});const block=el("div",{className:"result-block"},[el("p",{className:"result-title",tabindex:"-1"},["診断結果"]),typeCard,el("p",{className:"result-recommendation-title"},["そんなあなたへのおすすめはこちら"]),resultCard,el("div",{className:"restart-button-container"},[el("button",{className:"restart-button"},["もう一度診断する"])]),el("div",{className:"share-card-container"},[downloadBtn]),shareSection,lineCta]);container.dataset.resultType=resultType.typeKey
46resultArea.textContent="";resultArea.appendChild(block);quizBody.classList.add("hidden");resultArea.classList.remove("hidden");const rTitle=resultArea.querySelector(".result-title");if(rTitle)rTitle.focus({preventScroll:!0});trackResultScrollDepth()}
47function share(platform){if(!resultType)return;const configuredBase=window.ooaksCoffeeQuiz&&window.ooaksCoffeeQuiz.resultBaseUrl;const resultBase=(configuredBase||location.origin+location.pathname).replace(/[?#].*$/,"");const base=resultBase+"?result="+encodeURIComponent(resultType.typeKey)+"&caffeine="+encodeURIComponent(resultType.caffeinePreference);const url=encodeURIComponent(base);const text=encodeURIComponent("コーヒー診断で「"+resultType.name+"」でした! #コーヒー診断");trackEvent("quiz_shared",{platform:platform,result_type:resultType.name});const map={x:"https://twitter.com/intent/tweet?url="+url+"&text="+text,facebook:"https://www.facebook.com/sharer/sharer.php?u="+url,line:"https://social-plugins.line.me/lineit/share?url="+url+"&text="+text};window.open(map[platform],"_blank","noopener,noreferrer")}
48resultArea.addEventListener("click",e=>{const restart=e.target.closest(".restart-button");if(restart){delete container.dataset.resultType;index=0;answers={};resultType=null;quizInProgress=!1;questionStartTime=null;quizStartTime=null;abandonmentFired=!1;resultViewStartTime=null;quizStarted=!1;quizBody.classList.remove("hidden");renderQuestion();return}
49const shareBtn=e.target.closest(".share-button");if(shareBtn){share(shareBtn.dataset.p)}});(function(){const fire=()=>trackEvent("quiz_impression",{});if(typeof IntersectionObserver==="undefined"){fire();return}
50const io=new IntersectionObserver(entries=>{if(entries.some(en=>en.isIntersecting)){io.disconnect();fire()}},{threshold:0.3});io.observe(container)})();try{const urlParams=new URLSearchParams(location.search);const urlResult=urlParams.get("result");if(urlResult&&RESULT_TYPES[urlResult]){renderResult(urlResult,urlParams.get("caffeine"));return}}catch(e){}
51try{const saved=localStorage.getItem("coffee-quiz-result");if(saved){const data=JSON.parse(saved);if(data&&data.typeKey&&RESULT_TYPES[data.typeKey]){const prevBtn=el("button",{className:"restart-button"},["前回の診断結果を見る"]);const newBtn=el("button",{className:"restart-button"},["新しく診断を始める"]);const choiceBlock=el("div",{className:"question-block"},[el("p",{className:"question-title"},["おかえりなさい!"]),el("p",{className:"question-subtitle"},["前回の診断結果を確認するか、新しく診断を始めることができます。"]),el("div",{className:"back-button-container"},[prevBtn]),el("div",{className:"back-button-container"},[newBtn])]);quizBody.textContent="";quizBody.appendChild(choiceBlock);quizBody.classList.remove("hidden");resultArea.classList.add("hidden");prevBtn.addEventListener("click",()=>{renderResult(data.typeKey,data.caffeinePreference)});newBtn.addEventListener("click",()=>{renderQuestion()});return}}}catch(e){}
52renderQuestion()})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.