@skhema/embed 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -37,7 +37,7 @@ import '@skhema/embed'
37
37
  - `key_challenge` - Business challenges
38
38
  - `supporting_fact` - Evidence and data points
39
39
  - `guiding_policy` - Strategic approaches
40
- - `solution_alternative` - Potential solutions
40
+ - `solution` - Potential solutions
41
41
  - And more...
42
42
 
43
43
  ## Example
@@ -1 +1 @@
1
- {"version":3,"file":"SkhemaComponent.d.ts","sourceRoot":"","sources":["../../src/components/SkhemaComponent.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,oBAAoB,EAGpB,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,YAAY,CAAA;AA4QnB,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,WAAW,CAAoC;IACvD,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,kBAAkB,CAA8B;;IAQxD,MAAM,KAAK,kBAAkB,IAAI,CAAC,MAAM,yBAAyB,CAAC,EAAE,CASnE;IAED,iBAAiB;IA6BjB,oBAAoB;IAQpB,wBAAwB,CACtB,KAAK,EAAE,MAAM,yBAAyB,EACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,MAAM;IAiDd,OAAO,CAAC,2BAA2B;IAgCnC,OAAO,CAAC,mBAAmB;IAuC3B,OAAO,CAAC,aAAa;IA4GrB,OAAO,CAAC,mBAAmB;IAqB3B,OAAO,CAAC,cAAc;IA4CtB,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,kBAAkB;I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CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,kBAAkB,CAA8B;;IASxD,MAAM,KAAK,kBAAkB,IAAI,CAAC,MAAM,uBAAuB,CAAC,EAAE,CAUjE;IAED,iBAAiB;IA+DjB,oBAAoB;IAIpB,wBAAwB,CACtB,KAAK,EAAE,MAAM,uBAAuB,EACpC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB;;OAEG;IACI,cAAc,IAAI,iBAAiB,GAAG,IAAI;IASjD,OAAO,CAAC,MAAM;IAwCd,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,aAAa;IAmFrB,OAAO,CAAC,cAAc;IAmDtB,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,kBAAkB;IA2B1B,OAAO,CAAC,cAAc;IAwBtB,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,iBAAiB;YA0BX,SAAS;YAiCT,eAAe;IAkBtB,cAAc,IAAI,WAAW,GAAG,IAAI;IAIpC,OAAO,IAAI,IAAI;IAMtB,OAAO,CAAC,mBAAmB;IA6B3B,OAAO,CAAC,qBAAqB;IAa7B,OAAO,CAAC,WAAW;CAYpB;AAGD,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,mBAAoB,SAAQ,qBAAqB;KAAG;IAE9D,UAAU,gBAAiB,SAAQ,OAAO,CAAC,uBAAuB,CAAC;QACjE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB;IAGD,UAAU,oBAAoB;QAC5B,gBAAgB,EAAE,gBAAgB,CAAA;KACnC;CACF"}
@@ -2,6 +2,7 @@ import { ComponentValue, ElementValue } from '@skhema/types';
2
2
  export interface SkhemaElementAttributes {
3
3
  'element-type': ElementValue;
4
4
  'contributor-id': string;
5
+ 'contributor-name'?: string;
5
6
  content?: string;
6
7
  'source-url'?: string;
7
8
  theme?: 'light' | 'dark' | 'auto';
@@ -43,6 +44,7 @@ export interface SkhemaElementEventMap {
43
44
  export interface SkhemaComponentAttributes {
44
45
  'component-type': ComponentValue;
45
46
  'contributor-id': string;
47
+ 'contributor-name'?: string;
46
48
  title?: string;
47
49
  theme?: 'light' | 'dark' | 'auto';
48
50
  'track-analytics'?: 'true' | 'false';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjE,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,YAAY,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACjC,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,YAAY,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,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K,CAAC;QACd,YAAY,EAAE,YAAY,CAAA;QAC1B,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;KACrB,CAAC,CAAA;IACF,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,cAAc,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,KAAK,CAAC;QACd,WAAW,EAAE,YAAY,CAAA;QACzB,OAAO,EAAE,MAAM,CAAA;QACf,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,uBAAuB,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAA;IAC7D,wBAAwB,EAAE,WAAW,CAAC,oBAAoB,CAAC,CAAA;IAC3D,cAAc,EAAE,WAAW,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAClE;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,YAAY,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;CACpB"}
package/dist/embed.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SkhemaEmbed={})}(this,function(e){"use strict";const t={diagnosis:{bg:"oklch(0.65 0.06 25 / 0.15)",text:"oklch(0.65 0.06 25)",border:"oklch(0.65 0.06 25 / 0.3)"},method:{bg:"oklch(0.6 0.06 250 / 0.15)",text:"oklch(0.6 0.06 250)",border:"oklch(0.6 0.06 250 / 0.3)"},initiatives:{bg:"oklch(0.6 0.06 155 / 0.15)",text:"oklch(0.6 0.06 155)",border:"oklch(0.6 0.06 155 / 0.3)"},measures:{bg:"oklch(0.6 0.06 300 / 0.15)",text:"oklch(0.6 0.06 300)",border:"oklch(0.6 0.06 300 / 0.3)"},support:{bg:"oklch(0.65 0.06 65 / 0.15)",text:"oklch(0.65 0.06 65)",border:"oklch(0.65 0.06 65 / 0.3)"}},n="\n/* Monospace acronym badge */\n.skhema-acronym-badge {\n display: inline-flex;\n align-items: center;\n font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n font-size: 10px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 2px;\n letter-spacing: 0.02em;\n flex-shrink: 0;\n}\n\n/* Footer attribution tagline */\n.skhema-footer-attribution {\n font-size: 11px;\n color: var(--skhema-text-muted);\n line-height: 1.4;\n}\n\n.skhema-footer-attribution a {\n color: var(--skhema-text-muted);\n text-decoration: underline;\n text-decoration-color: var(--skhema-border);\n text-underline-offset: 2px;\n}\n\n.skhema-footer-attribution a:hover {\n color: var(--skhema-text);\n}\n\n/* Contributor line in footer */\n.skhema-contributor-line {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: var(--skhema-text-muted);\n}\n\n.skhema-contributor-line svg {\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n/* Save button — primary brand color */\n.skhema-save-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n background: var(--skhema-primary);\n color: white;\n border: none;\n padding: 6px 14px;\n border-radius: calc(var(--skhema-radius) + 2px);\n font-size: 12px;\n font-weight: 500;\n text-decoration: none;\n cursor: pointer;\n transition: background 0.15s ease;\n white-space: nowrap;\n}\n\n.skhema-save-btn:hover {\n background: var(--skhema-primary-hover);\n}\n\n.skhema-save-btn:active {\n background: var(--skhema-primary-pressed);\n}\n\n.skhema-save-btn:focus {\n outline: 2px solid var(--skhema-primary);\n outline-offset: 2px;\n}\n\n.skhema-save-btn::after {\n content: '\\2192';\n font-size: 13px;\n}\n",a='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>',s="https://analytics.skhema.com/functions/v1/embed-manage";function o(){try{const e=document.cookie.split("; ").find(e=>e.startsWith("_sk="));if(!e)return[];const t=JSON.parse(decodeURIComponent(e.split("=")[1])),n=Date.now()-864e5;return t.filter(e=>e.timestamp>n)}catch{return[]}}function i(e){return o().some(t=>t.contentHash===e)}function r(e){const t=o();t.push({contentHash:e,timestamp:Date.now()}),function(e){try{const t=e.slice(-50),n=new Date(Date.now()+864e5);document.cookie=`_sk=${encodeURIComponent(JSON.stringify(t))}; expires=${n.toUTCString()}; path=/; SameSite=Lax`}catch{}}(t)}const c=new class{constructor(){this.batch={embeds:[],clicks:[],componentEmbeds:[],componentClicks:[]},this.batchTimeout=null,this.BATCH_DELAY=2e3,this.MAX_BATCH_SIZE=10}addEmbedLoad(e){this.batch.embeds.push(e),this.scheduleBatchSend()}addClick(e){this.batch.clicks.push(e),this.scheduleBatchSend()}addComponentEmbedLoad(e){this.batch.componentEmbeds.push(e),this.scheduleBatchSend()}addComponentClick(e){this.batch.componentClicks.push(e),this.scheduleBatchSend()}scheduleBatchSend(){this.batchTimeout&&clearTimeout(this.batchTimeout);this.batch.embeds.length+this.batch.clicks.length+this.batch.componentEmbeds.length+this.batch.componentClicks.length>=this.MAX_BATCH_SIZE?this.sendBatch():this.batchTimeout=window.setTimeout(()=>{this.sendBatch()},this.BATCH_DELAY)}async sendBatch(){this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=null);const e={...this.batch};this.batch={embeds:[],clicks:[],componentEmbeds:[],componentClicks:[]};(e.embeds.length>0||e.clicks.length>0||e.componentEmbeds.length>0||e.componentClicks.length>0)&&(e.embeds.length>0&&await this.sendEmbeds(e.embeds),e.clicks.length>0&&await this.sendClicks(e.clicks),e.componentEmbeds.length>0&&await this.sendComponentEmbeds(e.componentEmbeds),e.componentClicks.length>0&&await this.sendComponentClicks(e.componentClicks))}async sendEmbeds(e){if(0!==e.length)try{const t={action:"embed",events:e.map(e=>({contributor_id:e.contributorId,element_type:e.elementType,content_hash:e.contentHash,content:e.content,page_url:e.pageUrl,page_title:e.pageTitle||"",user_agent:e.userAgent||""}))};await l(s,t,"json")}catch(t){console.debug("Embed tracking failed:",t)}}async sendClicks(e){for(const n of e)try{const e={action:"click",contributor_id:n.contributor_id,content_hash:n.content_hash,source_url:n.source_url,element_type:n.element_type};fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"omit",keepalive:!0}).catch(()=>{})}catch(t){console.debug("Click tracking failed:",t)}}async sendComponentEmbeds(e){if(0!==e.length)for(const n of e)try{const e={action:"component_embed",contributor_id:n.contributorId,component_type:n.componentType,component_hash:n.componentHash,title:n.title,elements:n.elements.map(e=>({element_type:e.elementType,content:e.content,content_hash:e.contentHash})),page_url:n.pageUrl,page_title:n.pageTitle||"",user_agent:n.userAgent||""};await l(s,e,"json")}catch(t){console.debug("Component embed tracking failed:",t)}}async sendComponentClicks(e){for(const n of e)try{const e={action:"component_click",contributor_id:n.contributor_id,component_type:n.component_type,component_hash:n.component_hash,title:n.title,source_url:n.source_url};fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"omit",keepalive:!0}).catch(()=>{})}catch(t){console.debug("Component click tracking failed:",t)}}flush(){this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=null);const e={...this.batch};if(this.batch={embeds:[],clicks:[],componentEmbeds:[],componentClicks:[]},e.embeds.length>0){const t={action:"embed",events:e.embeds.map(e=>({contributor_id:e.contributorId,element_type:e.elementType,content_hash:e.contentHash,content:e.content,page_url:e.pageUrl,page_title:e.pageTitle||"",user_agent:e.userAgent||""}))};this.sendViaBeacon(t)}for(const t of e.clicks)this.sendViaBeacon({action:"click",contributor_id:t.contributor_id,content_hash:t.content_hash,source_url:t.source_url,element_type:t.element_type});for(const t of e.componentEmbeds)this.sendViaBeacon({action:"component_embed",contributor_id:t.contributorId,component_type:t.componentType,component_hash:t.componentHash,title:t.title,elements:t.elements.map(e=>({element_type:e.elementType,content:e.content,content_hash:e.contentHash})),page_url:t.pageUrl,page_title:t.pageTitle||"",user_agent:t.userAgent||""});for(const t of e.componentClicks)this.sendViaBeacon({action:"component_click",contributor_id:t.contributor_id,component_type:t.component_type,component_hash:t.component_hash,title:t.title,source_url:t.source_url})}sendViaBeacon(e){try{"undefined"!=typeof navigator&&navigator.sendBeacon?navigator.sendBeacon(s,new Blob([JSON.stringify(e)],{type:"application/json"})):fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"omit",keepalive:!0}).catch(()=>{})}catch{}}};async function l(e,t,n="json",a=3){for(let o=0;o<a;o++){try{const a={method:"POST",credentials:"omit",keepalive:!0};"json"===n?(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(t)):a.body=t;const s=await fetch(e,a);if(s.ok)return;if(s.status>=400&&s.status<500)break}catch(s){if(o===a-1)return void console.debug("Analytics failed after retries:",s)}await new Promise(e=>setTimeout(e,1e3*Math.pow(2,o)))}}function h(e){return"false"!==e.getAttribute("track-analytics")}"undefined"!=typeof window&&(window.addEventListener("beforeunload",()=>{c.flush()}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&c.flush()}));const m={DIAGNOSIS:{value:"diagnosis",label:"Diagnosis",acronym:"BD"},METHOD:{value:"method",label:"Method & Positioning",acronym:"MP"},INITIATIVES:{value:"initiatives",label:"Portfolio of Initiatives",acronym:"PI"},MEASURES:{value:"measures",label:"Measures",acronym:"M"},SUPPORT:{value:"support",label:"Support Structures",acronym:"SS"}},d={KEY_CHALLENGE:{value:"key_challenge",label:"Key Challenge",acronym:"KC"},SUPPORTING_FACT:{value:"supporting_fact",label:"Supporting Fact",acronym:"SF"},ASSOCIATED_IMPACT:{value:"associated_impact",label:"Associated Impact",acronym:"AI"},GUIDING_POLICY:{value:"guiding_policy",label:"Guiding Policy",acronym:"GP"},COMPETITOR_MOVE:{value:"competitor_move",label:"Competitor Move",acronym:"CM"},SCOPE:{value:"scope",label:"Scope",acronym:"SC"},CONSTRAINT:{value:"constraint",label:"Constraint",acronym:"CN"},SOLUTION_ALTERNATIVE:{value:"solution_alternative",label:"Solution Alternative",acronym:"SA"},ASSUMPTION_HYPOTHESIS:{value:"assumption_hypothesis",label:"Assumption Hypothesis",acronym:"AH"},EXPERIMENT:{value:"experiment",label:"Experiment",acronym:"EX"},ACTION:{value:"action",label:"Action",acronym:"AC"},INVESTMENT:{value:"investment",label:"Investment",acronym:"IN"},ESTIMATE:{value:"estimate",label:"Estimate",acronym:"ES"},BASELINE:{value:"baseline",label:"Baseline",acronym:"BL"},OUTCOME:{value:"outcome",label:"Outcome",acronym:"OC"},PERFORMANCE_VARIABLE:{value:"performance_variable",label:"Performance Variable",acronym:"PV"},CAPABILITY:{value:"capability",label:"Capability",acronym:"CP"},SYSTEM:{value:"system",label:"System",acronym:"SY"},PRINCIPLE:{value:"principle",label:"Principle",acronym:"PR"}},p={elementFlow:{[m.DIAGNOSIS.value]:[d.KEY_CHALLENGE,d.SUPPORTING_FACT,d.ASSOCIATED_IMPACT],[m.METHOD.value]:[d.GUIDING_POLICY,d.COMPETITOR_MOVE,d.SCOPE,d.CONSTRAINT],[m.INITIATIVES.value]:[d.SOLUTION_ALTERNATIVE,d.ASSUMPTION_HYPOTHESIS,d.EXPERIMENT,d.ACTION,d.ESTIMATE,d.INVESTMENT],[m.MEASURES.value]:[d.BASELINE,d.OUTCOME,d.PERFORMANCE_VARIABLE],[m.SUPPORT.value]:[d.CAPABILITY,d.SYSTEM,d.PRINCIPLE]}};function u(e){return Object.values(m).map(e=>e.value).includes(e)}function k(e,t){if(!u(t))return!1;const n=p.elementFlow[t];return!!n&&n.some(t=>t.value===e)}function b(e){const t=Object.values(m).find(t=>t.value===e);return t?.label||e}function g(e){const t=Object.values(m).find(t=>t.value===e);return t?.acronym||e.substring(0,2).toUpperCase()}function y(e){let t=0;const n=e.trim().substring(0,200);for(let a=0;a<n.length;a++){t=(t<<5)-t+n.charCodeAt(a),t&=t}return Math.abs(t).toString(36).substring(0,12)}function v(e){let t=function(e){let t=e;return[/https?:\/\/[^\s<>"{}|\\^`[\]]+/gi,/ftp:\/\/[^\s<>"{}|\\^`[\]]+/gi,/www\.[^\s<>"{}|\\^`[\]]+/gi,/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/gi,/(?:^|\s)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:\/[^\s]*)?/gi].forEach(e=>{t=t.replace(e,"")}),t=t.replace(/\s+/g," ").trim(),t}(e);return t=(e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML})(t),t=t.replace(/\n/g,"<br>"),t=t.split(/(\s+)/).map(e=>/^\s+$/.test(e)||e.includes("<")?e:e.length>30?e.replace(/(.{10})/g,"$1​"):e).join(""),t}function f(e){return Object.values(d).map(e=>e.value).includes(e)}function x(e){const t=[],n=e.getAttribute("element-type"),a=e.getAttribute("contributor-id");if(n){if(!f(n)){const e=Object.values(d).map(e=>e.value).join(", ");t.push(`Invalid element-type "${n}". Valid types: ${e}`)}}else t.push("Missing required attribute: element-type");return a?0===a.trim().length&&t.push("contributor-id cannot be empty"):t.push("Missing required attribute: contributor-id"),{isValid:0===t.length,errors:t,elementType:f(n||"")?n:void 0,contributorId:a||void 0}}function w(e){const t=Object.values(d).find(t=>t.value===e);return t?.label||e}function C(e,t,n,a={}){const s=a.baseUrl||"https://app.skhema.com/save",o=y(e),i=encodeURIComponent(window.location.href),r=Date.now();return`${s}?type=contributor&contributor_id=${n}&element_type=${t}&content_hash=${o}&${new URLSearchParams({source:i,t:r.toString(),utm_source:a.utmSource||"web_component",utm_medium:a.utmMedium||"embedded",utm_campaign:a.utmCampaign||t,utm_content:n}).toString()}`}function S(e,t,n,a={}){const s=a.baseUrl||"https://app.skhema.com/save",o=encodeURIComponent(window.location.href),i=Date.now();return`${s}?type=component&component_type=${t}&component_hash=${e}&contributor_id=${n}&${new URLSearchParams({source:o,t:i.toString(),utm_source:a.utmSource||"web_component",utm_medium:a.utmMedium||"embedded",utm_campaign:a.utmCampaign||t,utm_content:n}).toString()}`}const T=`\n:host {\n --skhema-primary: hsl(344 57% 54%);\n --skhema-primary-hover: hsl(344 50% 47%);\n --skhema-secondary: hsl(345 100% 75%);\n\n /* Light mode colors */\n --skhema-bg: hsl(0 0% 100%);\n --skhema-card: hsl(0 0% 100%);\n --skhema-border: hsl(214.3 31.8% 91.4%);\n --skhema-text: hsl(222.2 84% 4.9%);\n --skhema-text-muted: hsl(215.4 16.3% 46.9%);\n --skhema-accent: hsl(210 40% 96%);\n --skhema-surface-subtle: hsl(210 40% 97%);\n\n /* Shadows */\n --skhema-shadow: 0 1px 3px 0 hsl(0 0 0 / 0.1), 0 1px 2px -1px hsl(0 0 0 / 0.1);\n --skhema-shadow-md: 0 4px 6px -1px hsl(0 0 0 / 0.1), 0 2px 4px -2px hsl(0 0 0 / 0.1);\n --skhema-shadow-lg: 0 10px 15px -3px hsl(0 0 0 / 0.1), 0 4px 6px -4px hsl(0 0 0 / 0.1);\n --skhema-radius: 0.1rem;\n\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;\n line-height: 1.5;\n color: var(--skhema-text);\n}\n\n/* Dark mode */\n.skhema-component-card[data-theme="dark"],\n.skhema-skeleton[data-theme="dark"] {\n --skhema-bg: hsl(222.2 84% 4.9%);\n --skhema-card: hsl(222.2 84% 4.9%);\n --skhema-border: hsl(217.2 32.6% 17.5%);\n --skhema-text: hsl(210 40% 98%);\n --skhema-text-muted: hsl(215 20.2% 65.1%);\n --skhema-accent: hsl(217.2 32.6% 17.5%);\n --skhema-surface-subtle: hsl(217.2 32.6% 12%);\n}\n\n/* Main card */\n.skhema-component-card {\n position: relative;\n background: var(--skhema-card);\n border: 1px solid var(--skhema-border);\n border-radius: calc(var(--skhema-radius) + 2px);\n padding: 0;\n box-shadow: var(--skhema-shadow);\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n max-width: 600px;\n margin: 8px 0;\n overflow: hidden;\n}\n\n.skhema-component-card:hover {\n box-shadow: var(--skhema-shadow-lg);\n transform: translateY(-1px);\n}\n\n/* Colored top border */\n.skhema-top-border {\n height: 2px;\n width: 100%;\n}\n\n/* Header */\n.skhema-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--skhema-border);\n}\n\n.skhema-type-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--skhema-text-muted);\n}\n\n.skhema-title-separator {\n color: var(--skhema-text-muted);\n font-size: 13px;\n}\n\n.skhema-title {\n font-size: 13px;\n font-weight: 600;\n color: var(--skhema-text);\n}\n\n/* Elements section */\n.skhema-elements {\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n/* Element group */\n.skhema-element-group {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.skhema-element-label {\n text-transform: uppercase;\n letter-spacing: 0.05em;\n font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n font-size: 10px;\n font-weight: 600;\n color: var(--skhema-text-muted);\n}\n\n.skhema-element-content {\n font-size: 14px;\n line-height: 1.6;\n color: var(--skhema-text);\n padding-left: 8px;\n border-left: 2px solid var(--skhema-border);\n word-wrap: break-word;\n overflow-wrap: break-word;\n}\n\n/* Footer */\n.skhema-footer {\n padding: 12px 16px;\n border-top: 1px solid var(--skhema-border);\n}\n\n.skhema-footer-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n${n}\n\n/* Error state */\n.skhema-error {\n background: hsl(0 93% 94%);\n border: 1px solid hsl(0 84% 60%);\n color: hsl(0 74% 42%);\n padding: 12px;\n border-radius: calc(var(--skhema-radius) + 2px);\n font-size: 13px;\n}\n\n.skhema-error-title {\n font-weight: 600;\n margin-bottom: 8px;\n}\n\n.skhema-error-list {\n margin: 0;\n padding-left: 16px;\n}\n\n/* Skeleton loading state */\n.skhema-skeleton {\n background: var(--skhema-card);\n border: 1px solid var(--skhema-border);\n border-radius: calc(var(--skhema-radius) + 2px);\n padding: 16px;\n box-shadow: var(--skhema-shadow);\n max-width: 600px;\n margin: 8px 0;\n animation: skeletonPulse 1.5s ease-in-out infinite;\n}\n\n.skhema-skeleton-header {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 12px;\n}\n\n.skhema-skeleton-badge {\n width: 32px;\n height: 20px;\n border-radius: 2px;\n background: linear-gradient(90deg,\n var(--skhema-border) 25%,\n var(--skhema-accent) 50%,\n var(--skhema-border) 75%);\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n}\n\n.skhema-skeleton-text {\n flex: 1;\n}\n\n.skhema-skeleton-line {\n height: 12px;\n background: linear-gradient(90deg,\n var(--skhema-border) 25%,\n var(--skhema-accent) 50%,\n var(--skhema-border) 75%);\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n border-radius: calc(var(--skhema-radius) + 2px);\n margin: 6px 0;\n}\n\n.skhema-skeleton-line.short { width: 40%; }\n.skhema-skeleton-line.medium { width: 70%; }\n\n.skhema-skeleton-content {\n margin: 16px 0;\n}\n\n@keyframes skeletonPulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.8; }\n}\n\n@keyframes shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n\n/* Responsive */\n@media (max-width: 640px) {\n .skhema-component-card {\n margin: 4px 0;\n }\n\n .skhema-header {\n padding: 10px 12px;\n flex-wrap: wrap;\n }\n\n .skhema-elements {\n padding: 12px;\n }\n\n .skhema-footer {\n padding: 10px 12px;\n }\n\n .skhema-footer-row {\n flex-direction: column;\n align-items: stretch;\n gap: 8px;\n }\n\n .skhema-save-btn {\n justify-content: center;\n }\n}\n\n/* Accessibility */\n@media (prefers-reduced-motion: reduce) {\n .skhema-component-card,\n .skhema-save-btn {\n transition: none;\n }\n}\n\n.skhema-structured-data {\n display: none !important;\n}\n`;class _ extends HTMLElement{constructor(){super(),this.contentData=null,this.componentConnected=!1,this.hasTrackedLoad=!1,this.pendingRender=null,this.themeObserver=null,this.mediaQueryListener=null,this.shadow=this.attachShadow({mode:"closed"}),this.renderSkeleton()}static get observedAttributes(){return["component-type","contributor-id","title","theme","track-analytics","source-url"]}connectedCallback(){if(!this.componentConnected){this.componentConnected=!0;try{this.addPreconnectHints(),this.addEventListener("skhema:element-ready",()=>{this.scheduleRender()}),"function"==typeof customElements.whenDefined?customElements.whenDefined("skhema-element").then(()=>{this.scheduleRender()}):this.scheduleRender(),this.setupThemeListeners()}catch(e){this.renderError("Failed to initialize component",e)}}}disconnectedCallback(){this.cleanupThemeListeners(),null!==this.pendingRender&&(cancelAnimationFrame(this.pendingRender),this.pendingRender=null)}attributeChangedCallback(e,t,n){t!==n&&this.componentConnected&&this.scheduleRender()}scheduleRender(){null!==this.pendingRender&&cancelAnimationFrame(this.pendingRender),this.pendingRender=requestAnimationFrame(()=>{this.pendingRender=null,this.render()})}render(){const e=this.validateComponentAttributes();if(!e.isValid)return void this.renderError("Invalid component attributes",e.errors);const t=e.componentType,n=e.contributorId,a=this.getAttribute("title")||"",s=this.gatherChildElements(t);if(0===s.length)return void this.renderError("Component requires child elements",["Add <skhema-element> children inside this component"]);const o=(i=s.map(e=>({elementType:e.elementType,content:e.content})),y([...i].sort((e,t)=>{const n=e.elementType.localeCompare(t.elementType);return 0!==n?n:e.content.localeCompare(t.content)}).map(e=>`${e.elementType}:${e.content}`).join("|")));var i;this.contentData={contributor_id:n,component_type:t,component_hash:o,title:a,elements:s.map(e=>({element_type:e.elementType,content:e.content,content_hash:e.contentHash})),source_url:this.getAttribute("source-url")||window.location.href,timestamp:(new Date).toISOString(),page_title:document.title},this.renderContent(s),this.addStructuredData(),this.trackLoad()}validateComponentAttributes(){const e=[],t=this.getAttribute("component-type"),n=this.getAttribute("contributor-id");return t?u(t)||e.push(`Invalid component-type "${t}"`):e.push("Missing required attribute: component-type"),n?0===n.trim().length&&e.push("contributor-id cannot be empty"):e.push("Missing required attribute: contributor-id"),{isValid:0===e.length,errors:e,componentType:u(t||"")?t:void 0,contributorId:n||void 0}}gatherChildElements(e){const t=Array.from(this.querySelectorAll("skhema-element")),n=[];for(const s of t){const t=s.getElementData?.();t&&(k(t.elementType,e)||console.warn(`skhema-component: element type "${t.elementType}" does not belong to component type "${e}"`),n.push(t))}const a=function(e){if(!u(e))return[];const t=p.elementFlow[e];return t?.map(e=>e.value)||[]}(e);return n.sort((e,t)=>{const n=a.indexOf(e.elementType),s=a.indexOf(t.elementType);return(-1===n?a.length:n)-(-1===s?a.length:s)}),n}renderContent(e){if(!this.contentData)return;const{component_type:n,contributor_id:s,title:o}=this.contentData,i=b(n),r=g(n),c=t[n],l=this.formatContributorName(s),h=this.getAttribute("theme")||"auto",m=this.getActualTheme(h),d=S(this.contentData.component_hash,n,s),p=c?`background: ${c.bg}; color: ${c.text}; border: 1px solid ${c.border};`:"",u=c?c.text:"var(--skhema-primary)",k=this.groupElementsByType(e).map(e=>`\n <div class="skhema-element-group">\n <div class="skhema-element-label">${w(e.elementType)}</div>\n ${e.items.map(e=>`<div class="skhema-element-content">${v(e.content)}</div>`).join("")}\n </div>\n `).join("");this.setAttribute("role","article"),this.setAttribute("aria-label",`${i} component${o?` — ${o}`:""}`);const y=o?`<span class="skhema-title-separator">&mdash;</span><span class="skhema-title">${o}</span>`:"";this.shadow.innerHTML=`\n <style>${T}</style>\n\n <div class="skhema-component-card" data-theme="${m}">\n <div class="skhema-top-border" style="background: ${u};"></div>\n\n <div class="skhema-header">\n <span class="skhema-acronym-badge" style="${p}" title="${i}">\n ${r}\n </span>\n <span class="skhema-type-label">${i}</span>\n ${y}\n </div>\n\n <div class="skhema-elements">\n ${k}\n </div>\n\n <div class="skhema-footer">\n <div class="skhema-footer-row">\n <span class="skhema-contributor-line">\n ${a}\n ${l}\n </span>\n <a href="${d}"\n class="skhema-save-btn"\n target="_blank"\n rel="noopener noreferrer"\n title="Save this component to Skhema">\n Save to Skhema\n </a>\n </div>\n <div class="skhema-footer-attribution">\n Strategy powered by <a href="https://skhema.com" target="_blank" rel="noopener noreferrer">Skhema</a>\n </div>\n </div>\n </div>\n\n <slot style="display:none;"></slot>\n `;const f=this.shadow.querySelector(".skhema-save-btn");f&&f.addEventListener("click",e=>{this.handleSaveClick(e)})}groupElementsByType(e){const t=new Map;for(const n of e){const e=t.get(n.elementType);e?e.push(n):t.set(n.elementType,[n])}return Array.from(t.entries()).map(([e,t])=>({elementType:e,items:t}))}getActualTheme(e){if("light"===e||"dark"===e)return e;const t=document.documentElement,n=document.body,a=t.getAttribute("data-theme")||t.getAttribute("theme")||t.className.match(/theme-(\w+)/)?.[1],s=n.getAttribute("data-theme")||n.getAttribute("theme")||n.className.match(/theme-(\w+)/)?.[1];if(t.classList.contains("dark")||n.classList.contains("dark")||t.classList.contains("dark-mode")||n.classList.contains("dark-mode")||"dark"===a||"dark"===s)return"dark";const o=window.getComputedStyle(t).getPropertyValue("color-scheme");return o&&o.includes("dark")||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}formatContributorName(e){return e.split(/[_-]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}addPreconnectHints(){if(!document.querySelector('link[rel="preconnect"][href*="analytics.skhema.com"]'))try{const e=document.createElement("link");e.rel="preconnect",e.href="https://analytics.skhema.com",document.head.appendChild(e);const t=document.createElement("link");t.rel="dns-prefetch",t.href="https://skhema.com",document.head.appendChild(t)}catch(e){console.debug("Failed to add preconnect hints:",e)}}renderSkeleton(){const e=this.getAttribute("theme")||"auto",t=this.getActualTheme(e);this.shadow.innerHTML=`\n <style>${T}</style>\n\n <div class="skhema-skeleton" data-theme="${t}">\n <div class="skhema-skeleton-header">\n <div class="skhema-skeleton-badge"></div>\n <div class="skhema-skeleton-text">\n <div class="skhema-skeleton-line medium"></div>\n </div>\n </div>\n <div class="skhema-skeleton-content">\n <div class="skhema-skeleton-line short"></div>\n <div class="skhema-skeleton-line"></div>\n <div class="skhema-skeleton-line short"></div>\n <div class="skhema-skeleton-line"></div>\n <div class="skhema-skeleton-line medium"></div>\n </div>\n </div>\n\n <slot style="display:none;"></slot>\n `}renderError(e,t){const n=Array.isArray(t)?t:[String(t)];this.shadow.innerHTML=`\n <style>${T}</style>\n\n <div class="skhema-component-card">\n <div class="skhema-error">\n <div class="skhema-error-title">Skhema Component Error: ${e}</div>\n <ul class="skhema-error-list">\n ${n.map(e=>`<li>${e}</li>`).join("")}\n </ul>\n </div>\n </div>\n\n <slot style="display:none;"></slot>\n `,this.dispatchEvent(new CustomEvent("skhema:error",{detail:{error:e,details:t},bubbles:!0}))}addStructuredData(){if(!this.contentData)return;const{component_type:e,contributor_id:t,title:n,elements:a,source_url:s}=this.contentData,o=function(e,t,n,a,s){const o=b(t);return{"@context":"https://schema.org","@type":"CreativeWork",name:e,description:`${o} strategy component`,category:o,contributor:n,url:S(y(a.map(e=>e.content).join("|")),t,n),hasPart:a.map(e=>({"@type":"AnalysisContent",text:e.content,analysisType:e.elementType,category:w(e.elementType)})),provider:{"@type":"Organization",name:"Skhema",url:"https://skhema.com"},isPartOf:{"@type":"WebPage",url:s},dateCreated:(new Date).toISOString(),platform:"Skhema"}}(n,e,t,a.map(e=>({elementType:e.element_type,content:e.content})),s),i=document.createElement("script");i.type="application/ld+json",i.textContent=JSON.stringify(o),i.className="skhema-structured-data",document.head.appendChild(i)}async trackLoad(){if(!h(this)||!this.contentData||this.hasTrackedLoad)return;this.hasTrackedLoad=!0;const e={contributorId:this.contentData.contributor_id,componentType:this.contentData.component_type,componentHash:this.contentData.component_hash,title:this.contentData.title,elements:this.contentData.elements.map(e=>({elementType:e.element_type,content:e.content,contentHash:e.content_hash})),pageUrl:window.location.href,pageTitle:document.title,timestamp:Date.now(),userAgent:navigator.userAgent};await async function(e){try{if(i(e.componentHash))return void console.debug("Component embed already tracked, skipping:",e.componentHash);r(e.componentHash),c.addComponentEmbedLoad(e)}catch(t){console.debug("Component analytics tracking failed:",t)}}(e),this.dispatchEvent(new CustomEvent("skhema:component-load",{detail:e,bubbles:!0}))}async handleSaveClick(e){this.contentData&&(h(this)&&await async function(e){try{c.addComponentClick(e)}catch(t){console.debug("Component click tracking failed:",t)}}(this.contentData),this.dispatchEvent(new CustomEvent("skhema:component-click",{detail:this.contentData,bubbles:!0})))}getContentData(){return this.contentData}refresh(){this.render()}setupThemeListeners(){const e=this.getAttribute("theme");if("auto"===e||!e){if(window.matchMedia){this.mediaQueryListener=window.matchMedia("(prefers-color-scheme: dark)");const e=()=>this.updateTheme();this.mediaQueryListener.addEventListener("change",e)}this.themeObserver=new MutationObserver(()=>this.updateTheme()),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","theme"]}),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme","theme"]})}}cleanupThemeListeners(){this.themeObserver&&(this.themeObserver.disconnect(),this.themeObserver=null),this.mediaQueryListener&&(this.mediaQueryListener=null)}updateTheme(){if("auto"===(this.getAttribute("theme")||"auto")){const e=this.shadow.querySelector(".skhema-component-card");if(e){const t=this.getActualTheme("auto");e.setAttribute("data-theme",t)}}}}const E=`\n:host {\n /* Skhema Brand Colors - matching UI library */\n --skhema-primary: hsl(344 57% 54%); /* #cd476a */\n --skhema-primary-hover: hsl(344 50% 47%); /* #b53d5e */\n --skhema-primary-pressed: hsl(343 50% 41%); /* #9d3552 */\n --skhema-secondary: hsl(345 100% 75%); /* #ff82a2 */\n\n /* Light mode colors */\n --skhema-bg: hsl(0 0% 100%);\n --skhema-card: hsl(0 0% 100%);\n --skhema-border: hsl(214.3 31.8% 91.4%);\n --skhema-text: hsl(222.2 84% 4.9%);\n --skhema-text-muted: hsl(215.4 16.3% 46.9%);\n --skhema-accent: hsl(210 40% 96%);\n\n /* Shadows matching UI library */\n --skhema-shadow: 0 1px 3px 0 hsl(0 0 0 / 0.1), 0 1px 2px -1px hsl(0 0 0 / 0.1);\n --skhema-shadow-md: 0 4px 6px -1px hsl(0 0 0 / 0.1), 0 2px 4px -2px hsl(0 0 0 / 0.1);\n --skhema-shadow-lg: 0 10px 15px -3px hsl(0 0 0 / 0.1), 0 4px 6px -4px hsl(0 0 0 / 0.1);\n --skhema-radius: 0.1rem;\n\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;\n line-height: 1.5;\n color: var(--skhema-text);\n}\n\n/* Dark mode styles - applied via data-theme attribute */\n.skhema-element-card[data-theme="dark"],\n.skhema-skeleton[data-theme="dark"] {\n --skhema-bg: hsl(222.2 84% 4.9%);\n --skhema-card: hsl(222.2 84% 4.9%);\n --skhema-border: hsl(217.2 32.6% 17.5%);\n --skhema-text: hsl(210 40% 98%);\n --skhema-text-muted: hsl(215 20.2% 65.1%);\n --skhema-accent: hsl(217.2 32.6% 17.5%);\n}\n\n/* Main component card */\n.skhema-element-card {\n position: relative;\n background: var(--skhema-card);\n border: 1px solid var(--skhema-border);\n border-radius: calc(var(--skhema-radius) + 2px);\n padding: 0;\n box-shadow: var(--skhema-shadow);\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n max-width: 600px;\n margin: 8px 0;\n overflow: hidden;\n}\n\n.skhema-element-card:hover {\n box-shadow: var(--skhema-shadow-lg);\n border-color: var(--skhema-primary);\n transform: translateY(-1px);\n}\n\n/* Header section with acronym badge + element type label */\n.skhema-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--skhema-border);\n}\n\n/* Content section */\n.skhema-content {\n padding: 16px;\n}\n\n.skhema-content-text {\n font-size: 15px;\n line-height: 1.6;\n color: var(--skhema-text);\n margin: 0;\n word-wrap: break-word;\n overflow-wrap: break-word;\n hyphens: auto;\n max-width: 100%;\n}\n\n/* Footer section */\n.skhema-footer {\n padding: 12px 16px;\n border-top: 1px solid var(--skhema-border);\n}\n\n.skhema-footer-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n${n}\n\n/* Element type label next to badge */\n.skhema-type-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--skhema-text);\n}\n\n/* Error state */\n.skhema-error {\n background: hsl(0 93% 94%);\n border: 1px solid hsl(0 84% 60%);\n color: hsl(0 74% 42%);\n padding: 12px;\n border-radius: calc(var(--skhema-radius) + 2px);\n font-size: 13px;\n}\n\n.skhema-error-title {\n font-weight: 600;\n margin-bottom: 8px;\n}\n\n.skhema-error-list {\n margin: 0;\n padding-left: 16px;\n}\n\n/* Skeleton loading state */\n.skhema-skeleton {\n background: var(--skhema-card);\n border: 1px solid var(--skhema-border);\n border-radius: calc(var(--skhema-radius) + 2px);\n padding: 16px;\n box-shadow: var(--skhema-shadow);\n max-width: 600px;\n margin: 8px 0;\n animation: skeletonPulse 1.5s ease-in-out infinite;\n}\n\n.skhema-skeleton-header {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 12px;\n}\n\n.skhema-skeleton-badge {\n width: 32px;\n height: 20px;\n border-radius: 2px;\n background: linear-gradient(90deg,\n var(--skhema-border) 25%,\n var(--skhema-accent) 50%,\n var(--skhema-border) 75%);\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n}\n\n.skhema-skeleton-text {\n flex: 1;\n}\n\n.skhema-skeleton-line {\n height: 12px;\n background: linear-gradient(90deg,\n var(--skhema-border) 25%,\n var(--skhema-accent) 50%,\n var(--skhema-border) 75%);\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n border-radius: calc(var(--skhema-radius) + 2px);\n margin: 6px 0;\n}\n\n.skhema-skeleton-line.short {\n width: 40%;\n}\n\n.skhema-skeleton-line.medium {\n width: 70%;\n}\n\n.skhema-skeleton-content {\n margin: 16px 0;\n}\n\n@keyframes skeletonPulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.8;\n }\n}\n\n@keyframes shimmer {\n 0% {\n background-position: -200% 0;\n }\n 100% {\n background-position: 200% 0;\n }\n}\n\n/* Responsive design */\n@media (max-width: 640px) {\n .skhema-element-card {\n margin: 4px 0;\n }\n\n .skhema-header {\n padding: 10px 12px;\n }\n\n .skhema-content {\n padding: 12px;\n }\n\n .skhema-footer {\n padding: 10px 12px;\n }\n\n .skhema-footer-row {\n flex-direction: column;\n align-items: stretch;\n gap: 8px;\n }\n\n .skhema-save-btn {\n justify-content: center;\n }\n}\n\n/* Accessibility */\n@media (prefers-reduced-motion: reduce) {\n .skhema-element-card,\n .skhema-save-btn {\n transition: none;\n }\n\n .skhema-save-btn::after {\n transition: none;\n }\n\n .skhema-save-btn:hover::after {\n transform: none;\n }\n}\n\n.skhema-structured-data {\n display: none !important;\n}\n`;class A extends HTMLElement{constructor(){super(),this.contentData=null,this.componentConnected=!1,this.hasTrackedLoad=!1,this.nestedMode=!1,this.themeObserver=null,this.mediaQueryListener=null,this.shadow=this.attachShadow({mode:"closed"}),this.renderSkeleton()}static get observedAttributes(){return["element-type","contributor-id","content","source-url","theme","track-analytics"]}connectedCallback(){if(!this.componentConnected){if(this.componentConnected=!0,this.closest("skhema-component")){this.nestedMode=!0;const e=x(this);if(!e.isValid)return void console.warn("skhema-element: invalid attributes in nested mode",e.errors);const t=this.getContent();return t.trim()?(this.contentData={contributor_id:e.contributorId,element_type:e.elementType,content:t,content_hash:y(t),source_url:this.getAttribute("source-url")||window.location.href,timestamp:(new Date).toISOString(),page_title:document.title},this.shadow.innerHTML="",void this.dispatchEvent(new CustomEvent("skhema:element-ready",{bubbles:!0,composed:!0,detail:this.getElementData()}))):void console.warn("skhema-element: empty content in nested mode")}try{this.addPreconnectHints(),requestAnimationFrame(()=>{this.render(),this.trackLoad(),this.setupThemeListeners()})}catch(e){this.renderError("Failed to initialize component",e)}}}disconnectedCallback(){this.cleanupThemeListeners()}attributeChangedCallback(e,t,n){t!==n&&this.componentConnected&&!this.nestedMode&&this.render()}getElementData(){return this.contentData?{elementType:this.contentData.element_type,content:this.contentData.content,contentHash:this.contentData.content_hash}:null}render(){const e=x(this);if(!e.isValid)return void this.renderError("Invalid component attributes",e.errors);const t=this.getContent();if(!t.trim())return void this.renderError("Component requires content",["Add content between the opening and closing tags, or use the content attribute"]);const n=function(e){const t=[];return/<script[\s>]/i.test(e)&&t.push("Script tags detected"),/on\w+\s*=/i.test(e)&&t.push("Event handlers detected"),/javascript:/i.test(e)&&t.push("JavaScript protocol detected"),/data:[^,]*script/i.test(e)&&t.push("Data URL with script detected"),/<iframe[\s>]/i.test(e)&&t.push("Iframe tags detected"),(/https?:\/\//i.test(e)||/www\./i.test(e))&&t.push("URLs detected in content"),{isSecure:0===t.length,issues:t}}(t);n.isSecure?(this.contentData={contributor_id:e.contributorId,element_type:e.elementType,content:t,content_hash:y(t),source_url:this.getAttribute("source-url")||window.location.href,timestamp:(new Date).toISOString(),page_title:document.title},this.renderContent(),this.addStructuredData()):this.renderError("Content security validation failed",n.issues)}getContent(){return this.getAttribute("content")||this.textContent||""}renderContent(){if(!this.contentData)return;const{element_type:e,contributor_id:n,content:s}=this.contentData,o=w(e),i=C(s,e,n),r=this.getAttribute("theme")||"auto",c=this.getActualTheme(r),l=this.formatContributorName(n),h=function(e){for(const[t,n]of Object.entries(p.elementFlow))if(n.some(t=>t.value===e))return t;return"diagnosis"}(e),m=g(h),d=t[h],u={role:"article","aria-label":`${w(e)} - Strategic element`,"aria-describedby":"skhema-description"};Object.entries(u).forEach(([e,t])=>{this.setAttribute(e,t)});const k=d?`background: ${d.bg}; color: ${d.text}; border: 1px solid ${d.border};`:"";this.shadow.innerHTML=`\n <style>${E}</style>\n\n <div class="skhema-element-card" data-theme="${c}">\n <div class="skhema-header">\n <span class="skhema-acronym-badge" style="${k}" title="${o}">\n ${m}\n </span>\n <span class="skhema-type-label">${o}</span>\n </div>\n\n <div class="skhema-content">\n <div class="skhema-content-text">${v(s)}</div>\n </div>\n\n <div class="skhema-footer">\n <div class="skhema-footer-row">\n <span class="skhema-contributor-line">\n ${a}\n ${l}\n </span>\n <a href="${i}"\n class="skhema-save-btn"\n target="_blank"\n rel="noopener noreferrer"\n title="Save this element to Skhema">\n Save to Skhema\n </a>\n </div>\n <div class="skhema-footer-attribution">\n Strategy powered by <a href="https://skhema.com" target="_blank" rel="noopener noreferrer">Skhema</a>\n </div>\n </div>\n </div>\n `;const b=this.shadow.querySelector(".skhema-save-btn");b&&b.addEventListener("click",e=>{this.handleSaveClick(e)})}getActualTheme(e){if("light"===e||"dark"===e)return e;const t=document.documentElement,n=document.body,a=t.getAttribute("data-theme")||t.getAttribute("theme")||t.className.match(/theme-(\w+)/)?.[1],s=n.getAttribute("data-theme")||n.getAttribute("theme")||n.className.match(/theme-(\w+)/)?.[1];if(t.classList.contains("dark")||n.classList.contains("dark")||t.classList.contains("dark-mode")||n.classList.contains("dark-mode")||"dark"===a||"dark"===s)return"dark";const o=window.getComputedStyle(t).getPropertyValue("color-scheme");return o&&o.includes("dark")||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}formatContributorName(e){return e.split(/[_-]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}addPreconnectHints(){if(!document.querySelector('link[rel="preconnect"][href*="analytics.skhema.com"]'))try{const e=document.createElement("link");e.rel="preconnect",e.href="https://analytics.skhema.com",document.head.appendChild(e);const t=document.createElement("link");t.rel="dns-prefetch",t.href="https://skhema.com",document.head.appendChild(t)}catch(e){console.debug("Failed to add preconnect hints:",e)}}renderSkeleton(){const e=this.getAttribute("theme")||"auto",t=this.getActualTheme(e);this.shadow.innerHTML=`\n <style>${E}</style>\n\n <div class="skhema-skeleton" data-theme="${t}">\n <div class="skhema-skeleton-header">\n <div class="skhema-skeleton-badge"></div>\n <div class="skhema-skeleton-text">\n <div class="skhema-skeleton-line medium"></div>\n </div>\n </div>\n <div class="skhema-skeleton-content">\n <div class="skhema-skeleton-line"></div>\n <div class="skhema-skeleton-line"></div>\n <div class="skhema-skeleton-line medium"></div>\n </div>\n </div>\n `}renderError(e,t){const n=Array.isArray(t)?t:[String(t)];this.shadow.innerHTML=`\n <style>${E}</style>\n\n <div class="skhema-element-card">\n <div class="skhema-error">\n <div class="skhema-error-title">Skhema Component Error: ${e}</div>\n <ul class="skhema-error-list">\n ${n.map(e=>`<li>${e}</li>`).join("")}\n </ul>\n </div>\n </div>\n `,this.dispatchEvent(new CustomEvent("skhema:error",{detail:{error:e,details:t},bubbles:!0}))}addStructuredData(){if(!this.contentData)return;const{content:e,element_type:t,contributor_id:n,source_url:a}=this.contentData,s=function(e,t,n,a){return{"@context":"https://schema.org","@type":"AnalysisContent",text:e,analysisType:t,category:w(t),contributor:n,url:C(e,t,n),provider:{"@type":"Organization",name:"Skhema",url:"https://skhema.com"},isPartOf:{"@type":"WebPage",url:a},dateCreated:(new Date).toISOString(),platform:"Skhema"}}(e,t,n,a),o=document.createElement("script");o.type="application/ld+json",o.textContent=JSON.stringify(s),o.className="skhema-structured-data",document.head.appendChild(o);const i=document.createElement("div");i.innerHTML=function(e,t,n){return`\n <div itemscope itemtype="https://schema.org/AnalysisContent" style="display:none;">\n <meta itemprop="analysisType" content="${t}">\n <meta itemprop="text" content="${e}">\n <meta itemprop="contributor" content="${n}">\n <meta itemprop="category" content="${w(t)}">\n <meta itemprop="platform" content="Skhema">\n </div>\n `}(e,t,n),i.className="skhema-structured-data",document.body.appendChild(i)}async trackLoad(){if(!h(this)||!this.contentData||this.hasTrackedLoad)return;this.hasTrackedLoad=!0;const e={contributorId:this.contentData.contributor_id,elementType:this.contentData.element_type,contentHash:this.contentData.content_hash,content:this.contentData.content,pageUrl:window.location.href,pageTitle:document.title,timestamp:Date.now(),userAgent:navigator.userAgent};await async function(e){try{if(i(e.contentHash))return void console.debug("Embed already tracked, skipping:",e.contentHash);r(e.contentHash),c.addEmbedLoad(e)}catch(t){console.debug("Analytics tracking failed:",t)}}(e),this.dispatchEvent(new CustomEvent("skhema:load",{detail:e,bubbles:!0}))}async handleSaveClick(e){this.contentData&&(h(this)&&await async function(e){try{c.addClick(e)}catch(t){console.debug("Click tracking failed:",t)}}(this.contentData),this.dispatchEvent(new CustomEvent("skhema:click",{detail:this.contentData,bubbles:!0})))}getContentData(){return this.contentData}refresh(){this.nestedMode||this.render()}setupThemeListeners(){const e=this.getAttribute("theme");if("auto"===e||!e){if(window.matchMedia){this.mediaQueryListener=window.matchMedia("(prefers-color-scheme: dark)");const e=()=>this.updateTheme();this.mediaQueryListener.addEventListener("change",e)}this.themeObserver=new MutationObserver(()=>this.updateTheme()),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","theme"]}),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme","theme"]})}}cleanupThemeListeners(){this.themeObserver&&(this.themeObserver.disconnect(),this.themeObserver=null),this.mediaQueryListener&&(this.mediaQueryListener=null)}updateTheme(){if("auto"===(this.getAttribute("theme")||"auto")){const e=this.shadow.querySelector(".skhema-element-card");if(e){const t=this.getActualTheme("auto");e.setAttribute("data-theme",t)}}}}customElements.get("skhema-element")||customElements.define("skhema-element",A),customElements.get("skhema-component")||customElements.define("skhema-component",_),"undefined"!=typeof window&&(window.SkhemaElement=A,window.SkhemaComponent=_),e.SkhemaComponent=_,e.SkhemaElement=A,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SkhemaEmbed={})}(this,function(e){"use strict";const t={diagnosis:{bg:"oklch(0.65 0.06 25 / 0.15)",text:"oklch(0.65 0.06 25)",border:"oklch(0.65 0.06 25 / 0.3)"},method:{bg:"oklch(0.6 0.06 250 / 0.15)",text:"oklch(0.6 0.06 250)",border:"oklch(0.6 0.06 250 / 0.3)"},initiatives:{bg:"oklch(0.6 0.06 155 / 0.15)",text:"oklch(0.6 0.06 155)",border:"oklch(0.6 0.06 155 / 0.3)"},measures:{bg:"oklch(0.6 0.06 300 / 0.15)",text:"oklch(0.6 0.06 300)",border:"oklch(0.6 0.06 300 / 0.3)"},support:{bg:"oklch(0.65 0.06 65 / 0.15)",text:"oklch(0.65 0.06 65)",border:"oklch(0.65 0.06 65 / 0.3)"}},n="\n/* Monospace acronym badge */\n.skhema-acronym-badge {\n display: inline-flex;\n align-items: center;\n font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n font-size: 10px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 2px;\n letter-spacing: 0.02em;\n flex-shrink: 0;\n}\n\n/* Footer attribution tagline */\n.skhema-footer-attribution {\n font-size: 11px;\n color: var(--skhema-text-muted);\n line-height: 1.4;\n}\n\n.skhema-footer-attribution a {\n color: var(--skhema-text-muted);\n text-decoration: underline;\n text-decoration-color: var(--skhema-border);\n text-underline-offset: 2px;\n}\n\n.skhema-footer-attribution a:hover {\n color: var(--skhema-text);\n}\n\n/* Contributor line in footer */\n.skhema-contributor-line {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: var(--skhema-text-muted);\n}\n\n.skhema-contributor-line svg {\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n/* Save button — primary brand color */\n.skhema-save-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n background: var(--skhema-primary);\n color: white;\n border: none;\n padding: 6px 14px;\n border-radius: calc(var(--skhema-radius) + 2px);\n font-size: 12px;\n font-weight: 500;\n text-decoration: none;\n cursor: pointer;\n transition: background 0.15s ease;\n white-space: nowrap;\n}\n\n.skhema-save-btn:hover {\n background: var(--skhema-primary-hover);\n}\n\n.skhema-save-btn:active {\n background: var(--skhema-primary-pressed);\n}\n\n.skhema-save-btn:focus {\n outline: 2px solid var(--skhema-primary);\n outline-offset: 2px;\n}\n\n.skhema-save-btn::after {\n content: '\\2192';\n font-size: 13px;\n}\n",a='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>',s="https://analytics.skhema.com/functions/v1/embed-manage";function o(){try{const e=document.cookie.split("; ").find(e=>e.startsWith("_sk="));if(!e)return[];const t=JSON.parse(decodeURIComponent(e.split("=")[1])),n=Date.now()-864e5;return t.filter(e=>e.timestamp>n)}catch{return[]}}function i(e){return o().some(t=>t.contentHash===e)}function r(e){const t=o();t.push({contentHash:e,timestamp:Date.now()}),function(e){try{const t=e.slice(-50),n=new Date(Date.now()+864e5);document.cookie=`_sk=${encodeURIComponent(JSON.stringify(t))}; expires=${n.toUTCString()}; path=/; SameSite=Lax`}catch{}}(t)}const c=new class{constructor(){this.batch={embeds:[],clicks:[],componentEmbeds:[],componentClicks:[]},this.batchTimeout=null,this.BATCH_DELAY=2e3,this.MAX_BATCH_SIZE=10}addEmbedLoad(e){this.batch.embeds.push(e),this.scheduleBatchSend()}addClick(e){this.batch.clicks.push(e),this.scheduleBatchSend()}addComponentEmbedLoad(e){this.batch.componentEmbeds.push(e),this.scheduleBatchSend()}addComponentClick(e){this.batch.componentClicks.push(e),this.scheduleBatchSend()}scheduleBatchSend(){this.batchTimeout&&clearTimeout(this.batchTimeout);this.batch.embeds.length+this.batch.clicks.length+this.batch.componentEmbeds.length+this.batch.componentClicks.length>=this.MAX_BATCH_SIZE?this.sendBatch():this.batchTimeout=window.setTimeout(()=>{this.sendBatch()},this.BATCH_DELAY)}async sendBatch(){this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=null);const e={...this.batch};this.batch={embeds:[],clicks:[],componentEmbeds:[],componentClicks:[]};(e.embeds.length>0||e.clicks.length>0||e.componentEmbeds.length>0||e.componentClicks.length>0)&&(e.embeds.length>0&&await this.sendEmbeds(e.embeds),e.clicks.length>0&&await this.sendClicks(e.clicks),e.componentEmbeds.length>0&&await this.sendComponentEmbeds(e.componentEmbeds),e.componentClicks.length>0&&await this.sendComponentClicks(e.componentClicks))}async sendEmbeds(e){if(0!==e.length)try{const t={action:"embed",events:e.map(e=>({contributor_id:e.contributorId,element_type:e.elementType,content_hash:e.contentHash,content:e.content,page_url:e.pageUrl,page_title:e.pageTitle||"",user_agent:e.userAgent||""}))};await l(s,t,"json")}catch(t){console.debug("Embed tracking failed:",t)}}async sendClicks(e){for(const n of e)try{const e={action:"click",contributor_id:n.contributor_id,content_hash:n.content_hash,source_url:n.source_url,element_type:n.element_type};fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"omit",keepalive:!0}).catch(()=>{})}catch(t){console.debug("Click tracking failed:",t)}}async sendComponentEmbeds(e){if(0!==e.length)for(const n of e)try{const e={action:"component_embed",contributor_id:n.contributorId,component_type:n.componentType,component_hash:n.componentHash,title:n.title,elements:n.elements.map(e=>({element_type:e.elementType,content:e.content,content_hash:e.contentHash})),page_url:n.pageUrl,page_title:n.pageTitle||"",user_agent:n.userAgent||""};await l(s,e,"json")}catch(t){console.debug("Component embed tracking failed:",t)}}async sendComponentClicks(e){for(const n of e)try{const e={action:"component_click",contributor_id:n.contributor_id,component_type:n.component_type,component_hash:n.component_hash,title:n.title,source_url:n.source_url};fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"omit",keepalive:!0}).catch(()=>{})}catch(t){console.debug("Component click tracking failed:",t)}}flush(){this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=null);const e={...this.batch};if(this.batch={embeds:[],clicks:[],componentEmbeds:[],componentClicks:[]},e.embeds.length>0){const t={action:"embed",events:e.embeds.map(e=>({contributor_id:e.contributorId,element_type:e.elementType,content_hash:e.contentHash,content:e.content,page_url:e.pageUrl,page_title:e.pageTitle||"",user_agent:e.userAgent||""}))};this.sendViaBeacon(t)}for(const t of e.clicks)this.sendViaBeacon({action:"click",contributor_id:t.contributor_id,content_hash:t.content_hash,source_url:t.source_url,element_type:t.element_type});for(const t of e.componentEmbeds)this.sendViaBeacon({action:"component_embed",contributor_id:t.contributorId,component_type:t.componentType,component_hash:t.componentHash,title:t.title,elements:t.elements.map(e=>({element_type:e.elementType,content:e.content,content_hash:e.contentHash})),page_url:t.pageUrl,page_title:t.pageTitle||"",user_agent:t.userAgent||""});for(const t of e.componentClicks)this.sendViaBeacon({action:"component_click",contributor_id:t.contributor_id,component_type:t.component_type,component_hash:t.component_hash,title:t.title,source_url:t.source_url})}sendViaBeacon(e){try{"undefined"!=typeof navigator&&navigator.sendBeacon?navigator.sendBeacon(s,new Blob([JSON.stringify(e)],{type:"application/json"})):fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"omit",keepalive:!0}).catch(()=>{})}catch{}}};async function l(e,t,n="json",a=3){for(let o=0;o<a;o++){try{const a={method:"POST",credentials:"omit",keepalive:!0};"json"===n?(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(t)):a.body=t;const s=await fetch(e,a);if(s.ok)return;if(s.status>=400&&s.status<500)break}catch(s){if(o===a-1)return void console.debug("Analytics failed after retries:",s)}await new Promise(e=>setTimeout(e,1e3*Math.pow(2,o)))}}function h(e){return"false"!==e.getAttribute("track-analytics")}"undefined"!=typeof window&&(window.addEventListener("beforeunload",()=>{c.flush()}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&c.flush()}));const m={DIAGNOSIS:{value:"diagnosis",label:"Diagnosis",acronym:"BD"},METHOD:{value:"method",label:"Method & Positioning",acronym:"MP"},INITIATIVES:{value:"initiatives",label:"Portfolio of Initiatives",acronym:"PI"},MEASURES:{value:"measures",label:"Measures",acronym:"M"},SUPPORT:{value:"support",label:"Support Structures",acronym:"SS"}},d={KEY_CHALLENGE:{value:"key_challenge",label:"Key Challenge",acronym:"CHL"},SUPPORTING_FACT:{value:"supporting_fact",label:"Supporting Fact",acronym:"FCT"},IMPACT:{value:"impact",label:"Impact",acronym:"IMP"},GUIDING_POLICY:{value:"guiding_policy",label:"Guiding Policy",acronym:"POL"},COMPETITOR_MOVE:{value:"competitor_move",label:"Competitor Move",acronym:"CMV"},SCOPE:{value:"scope",label:"Scope",acronym:"SCP"},CONSTRAINT:{value:"constraint",label:"Constraint",acronym:"CST"},SOLUTION:{value:"solution",label:"Solution",acronym:"SOL"},ASSUMPTION_HYPOTHESIS:{value:"assumption_hypothesis",label:"Assumption Hypothesis",acronym:"HYP"},EXPERIMENT:{value:"experiment",label:"Experiment",acronym:"EXP"},ACTION:{value:"action",label:"Action",acronym:"ACT"},INVESTMENT:{value:"investment",label:"Investment",acronym:"INV"},ESTIMATE:{value:"estimate",label:"Estimate",acronym:"EST"},BASELINE:{value:"baseline",label:"Baseline",acronym:"BSL"},OUTCOME:{value:"outcome",label:"Outcome",acronym:"OCM"},PERFORMANCE_VARIABLE:{value:"performance_variable",label:"Performance Variable",acronym:"VAR"},CAPABILITY:{value:"capability",label:"Capability",acronym:"CAP"},SYSTEM:{value:"system",label:"System",acronym:"SYS"},PRINCIPLE:{value:"principle",label:"Principle",acronym:"PRN"}},p={elementFlow:{[m.DIAGNOSIS.value]:[d.KEY_CHALLENGE,d.SUPPORTING_FACT,d.IMPACT],[m.METHOD.value]:[d.GUIDING_POLICY,d.COMPETITOR_MOVE,d.SCOPE,d.CONSTRAINT],[m.INITIATIVES.value]:[d.SOLUTION,d.ASSUMPTION_HYPOTHESIS,d.EXPERIMENT,d.ACTION,d.ESTIMATE,d.INVESTMENT],[m.MEASURES.value]:[d.BASELINE,d.OUTCOME,d.PERFORMANCE_VARIABLE],[m.SUPPORT.value]:[d.CAPABILITY,d.SYSTEM,d.PRINCIPLE]}};function u(e){return Object.values(m).map(e=>e.value).includes(e)}function k(e,t){if(!u(t))return!1;const n=p.elementFlow[t];return!!n&&n.some(t=>t.value===e)}function b(e){const t=Object.values(m).find(t=>t.value===e);return t?.label||e}function g(e){const t=Object.values(m).find(t=>t.value===e);return t?.acronym||e.substring(0,2).toUpperCase()}function y(e){let t=0;const n=e.trim().substring(0,200);for(let a=0;a<n.length;a++){t=(t<<5)-t+n.charCodeAt(a),t&=t}return Math.abs(t).toString(36).substring(0,12)}function v(e){let t=function(e){let t=e;return[/https?:\/\/[^\s<>"{}|\\^`[\]]+/gi,/ftp:\/\/[^\s<>"{}|\\^`[\]]+/gi,/www\.[^\s<>"{}|\\^`[\]]+/gi,/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/gi,/(?:^|\s)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:\/[^\s]*)?/gi].forEach(e=>{t=t.replace(e,"")}),t=t.replace(/\s+/g," ").trim(),t}(e);return t=(e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML})(t),t=t.replace(/\n/g,"<br>"),t=t.split(/(\s+)/).map(e=>/^\s+$/.test(e)||e.includes("<")?e:e.length>30?e.replace(/(.{10})/g,"$1​"):e).join(""),t}function f(e){return Object.values(d).map(e=>e.value).includes(e)}function x(e){const t=[],n=e.getAttribute("element-type"),a=e.getAttribute("contributor-id");if(n){if(!f(n)){const e=Object.values(d).map(e=>e.value).join(", ");t.push(`Invalid element-type "${n}". Valid types: ${e}`)}}else t.push("Missing required attribute: element-type");return a?0===a.trim().length&&t.push("contributor-id cannot be empty"):t.push("Missing required attribute: contributor-id"),{isValid:0===t.length,errors:t,elementType:f(n||"")?n:void 0,contributorId:a||void 0}}function w(e){const t=Object.values(d).find(t=>t.value===e);return t?.label||e}function C(e,t,n,a={}){const s=a.baseUrl||"https://app.skhema.com/save",o=y(e),i=encodeURIComponent(window.location.href),r=Date.now();return`${s}?type=contributor&contributor_id=${n}&element_type=${t}&content_hash=${o}&${new URLSearchParams({source:i,t:r.toString(),utm_source:a.utmSource||"web_component",utm_medium:a.utmMedium||"embedded",utm_campaign:a.utmCampaign||t,utm_content:n}).toString()}`}function S(e,t,n,a={}){const s=a.baseUrl||"https://app.skhema.com/save",o=encodeURIComponent(window.location.href),i=Date.now();return`${s}?type=component&component_type=${t}&component_hash=${e}&contributor_id=${n}&${new URLSearchParams({source:o,t:i.toString(),utm_source:a.utmSource||"web_component",utm_medium:a.utmMedium||"embedded",utm_campaign:a.utmCampaign||t,utm_content:n}).toString()}`}const T=`\n:host {\n --skhema-primary: hsl(344 57% 54%);\n --skhema-primary-hover: hsl(344 50% 47%);\n --skhema-secondary: hsl(345 100% 75%);\n\n /* Light mode colors */\n --skhema-bg: hsl(0 0% 100%);\n --skhema-card: hsl(0 0% 100%);\n --skhema-border: hsl(214.3 31.8% 91.4%);\n --skhema-text: hsl(222.2 84% 4.9%);\n --skhema-text-muted: hsl(215.4 16.3% 46.9%);\n --skhema-accent: hsl(210 40% 96%);\n --skhema-surface-subtle: hsl(210 40% 97%);\n\n /* Shadows */\n --skhema-shadow: 0 1px 3px 0 hsl(0 0 0 / 0.1), 0 1px 2px -1px hsl(0 0 0 / 0.1);\n --skhema-shadow-md: 0 4px 6px -1px hsl(0 0 0 / 0.1), 0 2px 4px -2px hsl(0 0 0 / 0.1);\n --skhema-shadow-lg: 0 10px 15px -3px hsl(0 0 0 / 0.1), 0 4px 6px -4px hsl(0 0 0 / 0.1);\n --skhema-radius: 0.1rem;\n\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;\n line-height: 1.5;\n color: var(--skhema-text);\n}\n\n/* Dark mode */\n.skhema-component-card[data-theme="dark"],\n.skhema-skeleton[data-theme="dark"] {\n --skhema-bg: hsl(222.2 84% 4.9%);\n --skhema-card: hsl(222.2 84% 4.9%);\n --skhema-border: hsl(217.2 32.6% 17.5%);\n --skhema-text: hsl(210 40% 98%);\n --skhema-text-muted: hsl(215 20.2% 65.1%);\n --skhema-accent: hsl(217.2 32.6% 17.5%);\n --skhema-surface-subtle: hsl(217.2 32.6% 12%);\n}\n\n/* Main card */\n.skhema-component-card {\n position: relative;\n background: var(--skhema-card);\n border: 1px solid var(--skhema-border);\n border-radius: calc(var(--skhema-radius) + 2px);\n padding: 0;\n box-shadow: var(--skhema-shadow);\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n max-width: 600px;\n margin: 8px 0;\n overflow: hidden;\n}\n\n.skhema-component-card:hover {\n box-shadow: var(--skhema-shadow-lg);\n transform: translateY(-1px);\n}\n\n/* Colored top border */\n.skhema-top-border {\n height: 2px;\n width: 100%;\n}\n\n/* Header */\n.skhema-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--skhema-border);\n}\n\n.skhema-type-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--skhema-text-muted);\n}\n\n.skhema-title-separator {\n color: var(--skhema-text-muted);\n font-size: 13px;\n}\n\n.skhema-title {\n font-size: 13px;\n font-weight: 600;\n color: var(--skhema-text);\n}\n\n/* Elements section */\n.skhema-elements {\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n/* Element group */\n.skhema-element-group {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.skhema-element-label {\n text-transform: uppercase;\n letter-spacing: 0.05em;\n font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n font-size: 10px;\n font-weight: 600;\n color: var(--skhema-text-muted);\n}\n\n.skhema-element-content {\n font-size: 14px;\n line-height: 1.6;\n color: var(--skhema-text);\n padding-left: 8px;\n border-left: 2px solid var(--skhema-border);\n word-wrap: break-word;\n overflow-wrap: break-word;\n}\n\n/* Footer */\n.skhema-footer {\n padding: 12px 16px;\n border-top: 1px solid var(--skhema-border);\n}\n\n.skhema-footer-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n${n}\n\n/* Error state */\n.skhema-error {\n background: hsl(0 93% 94%);\n border: 1px solid hsl(0 84% 60%);\n color: hsl(0 74% 42%);\n padding: 12px;\n border-radius: calc(var(--skhema-radius) + 2px);\n font-size: 13px;\n}\n\n.skhema-error-title {\n font-weight: 600;\n margin-bottom: 8px;\n}\n\n.skhema-error-list {\n margin: 0;\n padding-left: 16px;\n}\n\n/* Skeleton loading state */\n.skhema-skeleton {\n background: var(--skhema-card);\n border: 1px solid var(--skhema-border);\n border-radius: calc(var(--skhema-radius) + 2px);\n padding: 16px;\n box-shadow: var(--skhema-shadow);\n max-width: 600px;\n margin: 8px 0;\n animation: skeletonPulse 1.5s ease-in-out infinite;\n}\n\n.skhema-skeleton-header {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 12px;\n}\n\n.skhema-skeleton-badge {\n width: 32px;\n height: 20px;\n border-radius: 2px;\n background: linear-gradient(90deg,\n var(--skhema-border) 25%,\n var(--skhema-accent) 50%,\n var(--skhema-border) 75%);\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n}\n\n.skhema-skeleton-text {\n flex: 1;\n}\n\n.skhema-skeleton-line {\n height: 12px;\n background: linear-gradient(90deg,\n var(--skhema-border) 25%,\n var(--skhema-accent) 50%,\n var(--skhema-border) 75%);\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n border-radius: calc(var(--skhema-radius) + 2px);\n margin: 6px 0;\n}\n\n.skhema-skeleton-line.short { width: 40%; }\n.skhema-skeleton-line.medium { width: 70%; }\n\n.skhema-skeleton-content {\n margin: 16px 0;\n}\n\n@keyframes skeletonPulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.8; }\n}\n\n@keyframes shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n\n/* Responsive */\n@media (max-width: 640px) {\n .skhema-component-card {\n margin: 4px 0;\n }\n\n .skhema-header {\n padding: 10px 12px;\n flex-wrap: wrap;\n }\n\n .skhema-elements {\n padding: 12px;\n }\n\n .skhema-footer {\n padding: 10px 12px;\n }\n\n .skhema-footer-row {\n flex-direction: column;\n align-items: stretch;\n gap: 8px;\n }\n\n .skhema-save-btn {\n justify-content: center;\n }\n}\n\n/* Accessibility */\n@media (prefers-reduced-motion: reduce) {\n .skhema-component-card,\n .skhema-save-btn {\n transition: none;\n }\n}\n\n.skhema-structured-data {\n display: none !important;\n}\n`;class _ extends HTMLElement{constructor(){super(),this.contentData=null,this.componentConnected=!1,this.hasTrackedLoad=!1,this.pendingRender=null,this.themeObserver=null,this.mediaQueryListener=null,this.shadow=this.attachShadow({mode:"closed"}),this.renderSkeleton()}static get observedAttributes(){return["component-type","contributor-id","contributor-name","title","theme","track-analytics","source-url"]}connectedCallback(){if(!this.componentConnected){this.componentConnected=!0;try{this.addPreconnectHints(),this.addEventListener("skhema:element-ready",()=>{this.scheduleRender()}),"function"==typeof customElements.whenDefined?customElements.whenDefined("skhema-element").then(()=>{this.scheduleRender()}):this.scheduleRender(),this.setupThemeListeners()}catch(e){this.renderError("Failed to initialize component",e)}}}disconnectedCallback(){this.cleanupThemeListeners(),null!==this.pendingRender&&(cancelAnimationFrame(this.pendingRender),this.pendingRender=null)}attributeChangedCallback(e,t,n){t!==n&&this.componentConnected&&this.scheduleRender()}scheduleRender(){null!==this.pendingRender&&cancelAnimationFrame(this.pendingRender),this.pendingRender=requestAnimationFrame(()=>{this.pendingRender=null,this.render()})}render(){const e=this.validateComponentAttributes();if(!e.isValid)return void this.renderError("Invalid component attributes",e.errors);const t=e.componentType,n=e.contributorId,a=this.getAttribute("title")||"",s=this.gatherChildElements(t);if(0===s.length)return void this.renderError("Component requires child elements",["Add <skhema-element> children inside this component"]);const o=(i=s.map(e=>({elementType:e.elementType,content:e.content})),y([...i].sort((e,t)=>{const n=e.elementType.localeCompare(t.elementType);return 0!==n?n:e.content.localeCompare(t.content)}).map(e=>`${e.elementType}:${e.content}`).join("|")));var i;this.contentData={contributor_id:n,component_type:t,component_hash:o,title:a,elements:s.map(e=>({element_type:e.elementType,content:e.content,content_hash:e.contentHash})),source_url:this.getAttribute("source-url")||window.location.href,timestamp:(new Date).toISOString(),page_title:document.title},this.renderContent(s),this.addStructuredData(),this.trackLoad()}validateComponentAttributes(){const e=[],t=this.getAttribute("component-type"),n=this.getAttribute("contributor-id");return t?u(t)||e.push(`Invalid component-type "${t}"`):e.push("Missing required attribute: component-type"),n?0===n.trim().length&&e.push("contributor-id cannot be empty"):e.push("Missing required attribute: contributor-id"),{isValid:0===e.length,errors:e,componentType:u(t||"")?t:void 0,contributorId:n||void 0}}gatherChildElements(e){const t=Array.from(this.querySelectorAll("skhema-element")),n=[];for(const s of t){const t=s.getElementData?.();t&&(k(t.elementType,e)||console.warn(`skhema-component: element type "${t.elementType}" does not belong to component type "${e}"`),n.push(t))}const a=function(e){if(!u(e))return[];const t=p.elementFlow[e];return t?.map(e=>e.value)||[]}(e);return n.sort((e,t)=>{const n=a.indexOf(e.elementType),s=a.indexOf(t.elementType);return(-1===n?a.length:n)-(-1===s?a.length:s)}),n}renderContent(e){if(!this.contentData)return;const{component_type:n,contributor_id:s,title:o}=this.contentData,i=b(n),r=g(n),c=t[n],l=this.getAttribute("contributor-name")||this.formatContributorName(s),h=this.getAttribute("theme")||"auto",m=this.getActualTheme(h),d=S(this.contentData.component_hash,n,s),p=c?`background: ${c.bg}; color: ${c.text}; border: 1px solid ${c.border};`:"",u=c?c.text:"var(--skhema-primary)",k=this.groupElementsByType(e).map(e=>`\n <div class="skhema-element-group">\n <div class="skhema-element-label">${w(e.elementType)}</div>\n ${e.items.map(e=>`<div class="skhema-element-content">${v(e.content)}</div>`).join("")}\n </div>\n `).join("");this.setAttribute("role","article"),this.setAttribute("aria-label",`${i} component${o?` — ${o}`:""}`);const y=o?`<span class="skhema-title-separator">&mdash;</span><span class="skhema-title">${o}</span>`:"";this.shadow.innerHTML=`\n <style>${T}</style>\n\n <div class="skhema-component-card" data-theme="${m}">\n <div class="skhema-top-border" style="background: ${u};"></div>\n\n <div class="skhema-header">\n <span class="skhema-acronym-badge" style="${p}" title="${i}">\n ${r}\n </span>\n <span class="skhema-type-label">${i}</span>\n ${y}\n </div>\n\n <div class="skhema-elements">\n ${k}\n </div>\n\n <div class="skhema-footer">\n <div class="skhema-footer-row">\n <span class="skhema-contributor-line">\n ${a}\n ${l}\n </span>\n <a href="${d}"\n class="skhema-save-btn"\n target="_blank"\n rel="noopener noreferrer"\n title="Save this component to Skhema">\n Save to Skhema\n </a>\n </div>\n <div class="skhema-footer-attribution">\n Strategy powered by <a href="https://skhema.com" target="_blank" rel="noopener noreferrer">Skhema</a>\n </div>\n </div>\n </div>\n\n <slot style="display:none;"></slot>\n `;const f=this.shadow.querySelector(".skhema-save-btn");f&&f.addEventListener("click",e=>{this.handleSaveClick(e)})}groupElementsByType(e){const t=new Map;for(const n of e){const e=t.get(n.elementType);e?e.push(n):t.set(n.elementType,[n])}return Array.from(t.entries()).map(([e,t])=>({elementType:e,items:t}))}getActualTheme(e){if("light"===e||"dark"===e)return e;const t=document.documentElement,n=document.body,a=t.getAttribute("data-theme")||t.getAttribute("theme")||t.className.match(/theme-(\w+)/)?.[1],s=n.getAttribute("data-theme")||n.getAttribute("theme")||n.className.match(/theme-(\w+)/)?.[1];if(t.classList.contains("dark")||n.classList.contains("dark")||t.classList.contains("dark-mode")||n.classList.contains("dark-mode")||"dark"===a||"dark"===s)return"dark";const o=window.getComputedStyle(t).getPropertyValue("color-scheme");return o&&o.includes("dark")||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}formatContributorName(e){return e.split(/[_-]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}addPreconnectHints(){if(!document.querySelector('link[rel="preconnect"][href*="analytics.skhema.com"]'))try{const e=document.createElement("link");e.rel="preconnect",e.href="https://analytics.skhema.com",document.head.appendChild(e);const t=document.createElement("link");t.rel="dns-prefetch",t.href="https://skhema.com",document.head.appendChild(t)}catch(e){console.debug("Failed to add preconnect hints:",e)}}renderSkeleton(){const e=this.getAttribute("theme")||"auto",t=this.getActualTheme(e);this.shadow.innerHTML=`\n <style>${T}</style>\n\n <div class="skhema-skeleton" data-theme="${t}">\n <div class="skhema-skeleton-header">\n <div class="skhema-skeleton-badge"></div>\n <div class="skhema-skeleton-text">\n <div class="skhema-skeleton-line medium"></div>\n </div>\n </div>\n <div class="skhema-skeleton-content">\n <div class="skhema-skeleton-line short"></div>\n <div class="skhema-skeleton-line"></div>\n <div class="skhema-skeleton-line short"></div>\n <div class="skhema-skeleton-line"></div>\n <div class="skhema-skeleton-line medium"></div>\n </div>\n </div>\n\n <slot style="display:none;"></slot>\n `}renderError(e,t){const n=Array.isArray(t)?t:[String(t)];this.shadow.innerHTML=`\n <style>${T}</style>\n\n <div class="skhema-component-card">\n <div class="skhema-error">\n <div class="skhema-error-title">Skhema Component Error: ${e}</div>\n <ul class="skhema-error-list">\n ${n.map(e=>`<li>${e}</li>`).join("")}\n </ul>\n </div>\n </div>\n\n <slot style="display:none;"></slot>\n `,this.dispatchEvent(new CustomEvent("skhema:error",{detail:{error:e,details:t},bubbles:!0}))}addStructuredData(){if(!this.contentData)return;const{component_type:e,contributor_id:t,title:n,elements:a,source_url:s}=this.contentData,o=function(e,t,n,a,s){const o=b(t);return{"@context":"https://schema.org","@type":"CreativeWork",name:e,description:`${o} strategy component`,category:o,contributor:n,url:S(y(a.map(e=>e.content).join("|")),t,n),hasPart:a.map(e=>({"@type":"AnalysisContent",text:e.content,analysisType:e.elementType,category:w(e.elementType)})),provider:{"@type":"Organization",name:"Skhema",url:"https://skhema.com"},isPartOf:{"@type":"WebPage",url:s},dateCreated:(new Date).toISOString(),platform:"Skhema"}}(n,e,t,a.map(e=>({elementType:e.element_type,content:e.content})),s),i=document.createElement("script");i.type="application/ld+json",i.textContent=JSON.stringify(o),i.className="skhema-structured-data",document.head.appendChild(i)}async trackLoad(){if(!h(this)||!this.contentData||this.hasTrackedLoad)return;this.hasTrackedLoad=!0;const e={contributorId:this.contentData.contributor_id,componentType:this.contentData.component_type,componentHash:this.contentData.component_hash,title:this.contentData.title,elements:this.contentData.elements.map(e=>({elementType:e.element_type,content:e.content,contentHash:e.content_hash})),pageUrl:window.location.href,pageTitle:document.title,timestamp:Date.now(),userAgent:navigator.userAgent};await async function(e){try{if(i(e.componentHash))return void console.debug("Component embed already tracked, skipping:",e.componentHash);r(e.componentHash),c.addComponentEmbedLoad(e)}catch(t){console.debug("Component analytics tracking failed:",t)}}(e),this.dispatchEvent(new CustomEvent("skhema:component-load",{detail:e,bubbles:!0}))}async handleSaveClick(e){this.contentData&&(h(this)&&await async function(e){try{c.addComponentClick(e)}catch(t){console.debug("Component click tracking failed:",t)}}(this.contentData),this.dispatchEvent(new CustomEvent("skhema:component-click",{detail:this.contentData,bubbles:!0})))}getContentData(){return this.contentData}refresh(){this.render()}setupThemeListeners(){const e=this.getAttribute("theme");if("auto"===e||!e){if(window.matchMedia){this.mediaQueryListener=window.matchMedia("(prefers-color-scheme: dark)");const e=()=>this.updateTheme();this.mediaQueryListener.addEventListener("change",e)}this.themeObserver=new MutationObserver(()=>this.updateTheme()),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","theme"]}),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme","theme"]})}}cleanupThemeListeners(){this.themeObserver&&(this.themeObserver.disconnect(),this.themeObserver=null),this.mediaQueryListener&&(this.mediaQueryListener=null)}updateTheme(){if("auto"===(this.getAttribute("theme")||"auto")){const e=this.shadow.querySelector(".skhema-component-card");if(e){const t=this.getActualTheme("auto");e.setAttribute("data-theme",t)}}}}const E=`\n:host {\n /* Skhema Brand Colors - matching UI library */\n --skhema-primary: hsl(344 57% 54%); /* #cd476a */\n --skhema-primary-hover: hsl(344 50% 47%); /* #b53d5e */\n --skhema-primary-pressed: hsl(343 50% 41%); /* #9d3552 */\n --skhema-secondary: hsl(345 100% 75%); /* #ff82a2 */\n\n /* Light mode colors */\n --skhema-bg: hsl(0 0% 100%);\n --skhema-card: hsl(0 0% 100%);\n --skhema-border: hsl(214.3 31.8% 91.4%);\n --skhema-text: hsl(222.2 84% 4.9%);\n --skhema-text-muted: hsl(215.4 16.3% 46.9%);\n --skhema-accent: hsl(210 40% 96%);\n\n /* Shadows matching UI library */\n --skhema-shadow: 0 1px 3px 0 hsl(0 0 0 / 0.1), 0 1px 2px -1px hsl(0 0 0 / 0.1);\n --skhema-shadow-md: 0 4px 6px -1px hsl(0 0 0 / 0.1), 0 2px 4px -2px hsl(0 0 0 / 0.1);\n --skhema-shadow-lg: 0 10px 15px -3px hsl(0 0 0 / 0.1), 0 4px 6px -4px hsl(0 0 0 / 0.1);\n --skhema-radius: 0.1rem;\n\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;\n line-height: 1.5;\n color: var(--skhema-text);\n}\n\n/* Dark mode styles - applied via data-theme attribute */\n.skhema-element-card[data-theme="dark"],\n.skhema-skeleton[data-theme="dark"] {\n --skhema-bg: hsl(222.2 84% 4.9%);\n --skhema-card: hsl(222.2 84% 4.9%);\n --skhema-border: hsl(217.2 32.6% 17.5%);\n --skhema-text: hsl(210 40% 98%);\n --skhema-text-muted: hsl(215 20.2% 65.1%);\n --skhema-accent: hsl(217.2 32.6% 17.5%);\n}\n\n/* Main component card */\n.skhema-element-card {\n position: relative;\n background: var(--skhema-card);\n border: 1px solid var(--skhema-border);\n border-radius: calc(var(--skhema-radius) + 2px);\n padding: 0;\n box-shadow: var(--skhema-shadow);\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n max-width: 600px;\n margin: 8px 0;\n overflow: hidden;\n}\n\n.skhema-element-card:hover {\n box-shadow: var(--skhema-shadow-lg);\n border-color: var(--skhema-primary);\n transform: translateY(-1px);\n}\n\n/* Header section with acronym badge + element type label */\n.skhema-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--skhema-border);\n}\n\n/* Content section */\n.skhema-content {\n padding: 16px;\n}\n\n.skhema-content-text {\n font-size: 15px;\n line-height: 1.6;\n color: var(--skhema-text);\n margin: 0;\n word-wrap: break-word;\n overflow-wrap: break-word;\n hyphens: auto;\n max-width: 100%;\n}\n\n/* Footer section */\n.skhema-footer {\n padding: 12px 16px;\n border-top: 1px solid var(--skhema-border);\n}\n\n.skhema-footer-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n${n}\n\n/* Element type label next to badge */\n.skhema-type-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--skhema-text);\n}\n\n/* Error state */\n.skhema-error {\n background: hsl(0 93% 94%);\n border: 1px solid hsl(0 84% 60%);\n color: hsl(0 74% 42%);\n padding: 12px;\n border-radius: calc(var(--skhema-radius) + 2px);\n font-size: 13px;\n}\n\n.skhema-error-title {\n font-weight: 600;\n margin-bottom: 8px;\n}\n\n.skhema-error-list {\n margin: 0;\n padding-left: 16px;\n}\n\n/* Skeleton loading state */\n.skhema-skeleton {\n background: var(--skhema-card);\n border: 1px solid var(--skhema-border);\n border-radius: calc(var(--skhema-radius) + 2px);\n padding: 16px;\n box-shadow: var(--skhema-shadow);\n max-width: 600px;\n margin: 8px 0;\n animation: skeletonPulse 1.5s ease-in-out infinite;\n}\n\n.skhema-skeleton-header {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 12px;\n}\n\n.skhema-skeleton-badge {\n width: 32px;\n height: 20px;\n border-radius: 2px;\n background: linear-gradient(90deg,\n var(--skhema-border) 25%,\n var(--skhema-accent) 50%,\n var(--skhema-border) 75%);\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n}\n\n.skhema-skeleton-text {\n flex: 1;\n}\n\n.skhema-skeleton-line {\n height: 12px;\n background: linear-gradient(90deg,\n var(--skhema-border) 25%,\n var(--skhema-accent) 50%,\n var(--skhema-border) 75%);\n background-size: 200% 100%;\n animation: shimmer 1.5s infinite;\n border-radius: calc(var(--skhema-radius) + 2px);\n margin: 6px 0;\n}\n\n.skhema-skeleton-line.short {\n width: 40%;\n}\n\n.skhema-skeleton-line.medium {\n width: 70%;\n}\n\n.skhema-skeleton-content {\n margin: 16px 0;\n}\n\n@keyframes skeletonPulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.8;\n }\n}\n\n@keyframes shimmer {\n 0% {\n background-position: -200% 0;\n }\n 100% {\n background-position: 200% 0;\n }\n}\n\n/* Responsive design */\n@media (max-width: 640px) {\n .skhema-element-card {\n margin: 4px 0;\n }\n\n .skhema-header {\n padding: 10px 12px;\n }\n\n .skhema-content {\n padding: 12px;\n }\n\n .skhema-footer {\n padding: 10px 12px;\n }\n\n .skhema-footer-row {\n flex-direction: column;\n align-items: stretch;\n gap: 8px;\n }\n\n .skhema-save-btn {\n justify-content: center;\n }\n}\n\n/* Accessibility */\n@media (prefers-reduced-motion: reduce) {\n .skhema-element-card,\n .skhema-save-btn {\n transition: none;\n }\n\n .skhema-save-btn::after {\n transition: none;\n }\n\n .skhema-save-btn:hover::after {\n transform: none;\n }\n}\n\n.skhema-structured-data {\n display: none !important;\n}\n`;class A extends HTMLElement{constructor(){super(),this.contentData=null,this.componentConnected=!1,this.hasTrackedLoad=!1,this.nestedMode=!1,this.themeObserver=null,this.mediaQueryListener=null,this.shadow=this.attachShadow({mode:"closed"}),this.renderSkeleton()}static get observedAttributes(){return["element-type","contributor-id","contributor-name","content","source-url","theme","track-analytics"]}connectedCallback(){if(!this.componentConnected){if(this.componentConnected=!0,this.closest("skhema-component")){this.nestedMode=!0;const e=x(this);if(!e.isValid)return void console.warn("skhema-element: invalid attributes in nested mode",e.errors);const t=this.getContent();return t.trim()?(this.contentData={contributor_id:e.contributorId,element_type:e.elementType,content:t,content_hash:y(t),source_url:this.getAttribute("source-url")||window.location.href,timestamp:(new Date).toISOString(),page_title:document.title},this.shadow.innerHTML="",void this.dispatchEvent(new CustomEvent("skhema:element-ready",{bubbles:!0,composed:!0,detail:this.getElementData()}))):void console.warn("skhema-element: empty content in nested mode")}try{this.addPreconnectHints(),requestAnimationFrame(()=>{this.render(),this.trackLoad(),this.setupThemeListeners()})}catch(e){this.renderError("Failed to initialize component",e)}}}disconnectedCallback(){this.cleanupThemeListeners()}attributeChangedCallback(e,t,n){t!==n&&this.componentConnected&&!this.nestedMode&&this.render()}getElementData(){return this.contentData?{elementType:this.contentData.element_type,content:this.contentData.content,contentHash:this.contentData.content_hash}:null}render(){const e=x(this);if(!e.isValid)return void this.renderError("Invalid component attributes",e.errors);const t=this.getContent();if(!t.trim())return void this.renderError("Component requires content",["Add content between the opening and closing tags, or use the content attribute"]);const n=function(e){const t=[];return/<script[\s>]/i.test(e)&&t.push("Script tags detected"),/on\w+\s*=/i.test(e)&&t.push("Event handlers detected"),/javascript:/i.test(e)&&t.push("JavaScript protocol detected"),/data:[^,]*script/i.test(e)&&t.push("Data URL with script detected"),/<iframe[\s>]/i.test(e)&&t.push("Iframe tags detected"),(/https?:\/\//i.test(e)||/www\./i.test(e))&&t.push("URLs detected in content"),{isSecure:0===t.length,issues:t}}(t);n.isSecure?(this.contentData={contributor_id:e.contributorId,element_type:e.elementType,content:t,content_hash:y(t),source_url:this.getAttribute("source-url")||window.location.href,timestamp:(new Date).toISOString(),page_title:document.title},this.renderContent(),this.addStructuredData()):this.renderError("Content security validation failed",n.issues)}getContent(){return this.getAttribute("content")||this.textContent||""}renderContent(){if(!this.contentData)return;const{element_type:e,contributor_id:n,content:s}=this.contentData,o=w(e),i=C(s,e,n),r=this.getAttribute("theme")||"auto",c=this.getActualTheme(r),l=this.getAttribute("contributor-name")||this.formatContributorName(n),h=function(e){for(const[t,n]of Object.entries(p.elementFlow))if(n.some(t=>t.value===e))return t;return"diagnosis"}(e),m=g(h),d=t[h],u={role:"article","aria-label":`${w(e)} - Strategic element`,"aria-describedby":"skhema-description"};Object.entries(u).forEach(([e,t])=>{this.setAttribute(e,t)});const k=d?`background: ${d.bg}; color: ${d.text}; border: 1px solid ${d.border};`:"";this.shadow.innerHTML=`\n <style>${E}</style>\n\n <div class="skhema-element-card" data-theme="${c}">\n <div class="skhema-header">\n <span class="skhema-acronym-badge" style="${k}" title="${o}">\n ${m}\n </span>\n <span class="skhema-type-label">${o}</span>\n </div>\n\n <div class="skhema-content">\n <div class="skhema-content-text">${v(s)}</div>\n </div>\n\n <div class="skhema-footer">\n <div class="skhema-footer-row">\n <span class="skhema-contributor-line">\n ${a}\n ${l}\n </span>\n <a href="${i}"\n class="skhema-save-btn"\n target="_blank"\n rel="noopener noreferrer"\n title="Save this element to Skhema">\n Save to Skhema\n </a>\n </div>\n <div class="skhema-footer-attribution">\n Strategy powered by <a href="https://skhema.com" target="_blank" rel="noopener noreferrer">Skhema</a>\n </div>\n </div>\n </div>\n `;const b=this.shadow.querySelector(".skhema-save-btn");b&&b.addEventListener("click",e=>{this.handleSaveClick(e)})}getActualTheme(e){if("light"===e||"dark"===e)return e;const t=document.documentElement,n=document.body,a=t.getAttribute("data-theme")||t.getAttribute("theme")||t.className.match(/theme-(\w+)/)?.[1],s=n.getAttribute("data-theme")||n.getAttribute("theme")||n.className.match(/theme-(\w+)/)?.[1];if(t.classList.contains("dark")||n.classList.contains("dark")||t.classList.contains("dark-mode")||n.classList.contains("dark-mode")||"dark"===a||"dark"===s)return"dark";const o=window.getComputedStyle(t).getPropertyValue("color-scheme");return o&&o.includes("dark")||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}formatContributorName(e){return e.split(/[_-]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}addPreconnectHints(){if(!document.querySelector('link[rel="preconnect"][href*="analytics.skhema.com"]'))try{const e=document.createElement("link");e.rel="preconnect",e.href="https://analytics.skhema.com",document.head.appendChild(e);const t=document.createElement("link");t.rel="dns-prefetch",t.href="https://skhema.com",document.head.appendChild(t)}catch(e){console.debug("Failed to add preconnect hints:",e)}}renderSkeleton(){const e=this.getAttribute("theme")||"auto",t=this.getActualTheme(e);this.shadow.innerHTML=`\n <style>${E}</style>\n\n <div class="skhema-skeleton" data-theme="${t}">\n <div class="skhema-skeleton-header">\n <div class="skhema-skeleton-badge"></div>\n <div class="skhema-skeleton-text">\n <div class="skhema-skeleton-line medium"></div>\n </div>\n </div>\n <div class="skhema-skeleton-content">\n <div class="skhema-skeleton-line"></div>\n <div class="skhema-skeleton-line"></div>\n <div class="skhema-skeleton-line medium"></div>\n </div>\n </div>\n `}renderError(e,t){const n=Array.isArray(t)?t:[String(t)];this.shadow.innerHTML=`\n <style>${E}</style>\n\n <div class="skhema-element-card">\n <div class="skhema-error">\n <div class="skhema-error-title">Skhema Component Error: ${e}</div>\n <ul class="skhema-error-list">\n ${n.map(e=>`<li>${e}</li>`).join("")}\n </ul>\n </div>\n </div>\n `,this.dispatchEvent(new CustomEvent("skhema:error",{detail:{error:e,details:t},bubbles:!0}))}addStructuredData(){if(!this.contentData)return;const{content:e,element_type:t,contributor_id:n,source_url:a}=this.contentData,s=function(e,t,n,a){return{"@context":"https://schema.org","@type":"AnalysisContent",text:e,analysisType:t,category:w(t),contributor:n,url:C(e,t,n),provider:{"@type":"Organization",name:"Skhema",url:"https://skhema.com"},isPartOf:{"@type":"WebPage",url:a},dateCreated:(new Date).toISOString(),platform:"Skhema"}}(e,t,n,a),o=document.createElement("script");o.type="application/ld+json",o.textContent=JSON.stringify(s),o.className="skhema-structured-data",document.head.appendChild(o);const i=document.createElement("div");i.innerHTML=function(e,t,n){return`\n <div itemscope itemtype="https://schema.org/AnalysisContent" style="display:none;">\n <meta itemprop="analysisType" content="${t}">\n <meta itemprop="text" content="${e}">\n <meta itemprop="contributor" content="${n}">\n <meta itemprop="category" content="${w(t)}">\n <meta itemprop="platform" content="Skhema">\n </div>\n `}(e,t,n),i.className="skhema-structured-data",document.body.appendChild(i)}async trackLoad(){if(!h(this)||!this.contentData||this.hasTrackedLoad)return;this.hasTrackedLoad=!0;const e={contributorId:this.contentData.contributor_id,elementType:this.contentData.element_type,contentHash:this.contentData.content_hash,content:this.contentData.content,pageUrl:window.location.href,pageTitle:document.title,timestamp:Date.now(),userAgent:navigator.userAgent};await async function(e){try{if(i(e.contentHash))return void console.debug("Embed already tracked, skipping:",e.contentHash);r(e.contentHash),c.addEmbedLoad(e)}catch(t){console.debug("Analytics tracking failed:",t)}}(e),this.dispatchEvent(new CustomEvent("skhema:load",{detail:e,bubbles:!0}))}async handleSaveClick(e){this.contentData&&(h(this)&&await async function(e){try{c.addClick(e)}catch(t){console.debug("Click tracking failed:",t)}}(this.contentData),this.dispatchEvent(new CustomEvent("skhema:click",{detail:this.contentData,bubbles:!0})))}getContentData(){return this.contentData}refresh(){this.nestedMode||this.render()}setupThemeListeners(){const e=this.getAttribute("theme");if("auto"===e||!e){if(window.matchMedia){this.mediaQueryListener=window.matchMedia("(prefers-color-scheme: dark)");const e=()=>this.updateTheme();this.mediaQueryListener.addEventListener("change",e)}this.themeObserver=new MutationObserver(()=>this.updateTheme()),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","theme"]}),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme","theme"]})}}cleanupThemeListeners(){this.themeObserver&&(this.themeObserver.disconnect(),this.themeObserver=null),this.mediaQueryListener&&(this.mediaQueryListener=null)}updateTheme(){if("auto"===(this.getAttribute("theme")||"auto")){const e=this.shadow.querySelector(".skhema-element-card");if(e){const t=this.getActualTheme("auto");e.setAttribute("data-theme",t)}}}}customElements.get("skhema-element")||customElements.define("skhema-element",A),customElements.get("skhema-component")||customElements.define("skhema-component",_),"undefined"!=typeof window&&(window.SkhemaElement=A,window.SkhemaComponent=_),e.SkhemaComponent=_,e.SkhemaElement=A,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=embed.min.js.map