@skspwork/config-doc 2.0.3 → 2.0.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.
Files changed (34) hide show
  1. package/package.json +3 -2
  2. package/packages/web/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  3. package/packages/web/.next/standalone/.next/server/app/_not-found.html +1 -1
  4. package/packages/web/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  5. package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  6. package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  7. package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  8. package/packages/web/.next/standalone/.next/server/app/api/export/route.js.nft.json +1 -1
  9. package/packages/web/.next/standalone/.next/server/app/index.html +1 -1
  10. package/packages/web/.next/standalone/.next/server/app/index.rsc +3 -3
  11. package/packages/web/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  12. package/packages/web/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  13. package/packages/web/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  14. package/packages/web/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  15. package/packages/web/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  16. package/packages/web/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_d09de205.js +40 -19
  17. package/packages/web/.next/standalone/.next/server/chunks/ssr/app_page_tsx_55b2e5ee._.js +1 -1
  18. package/packages/web/.next/standalone/.next/server/pages/404.html +1 -1
  19. package/packages/web/.next/standalone/.next/static/chunks/{54e2bd8f072e7d4e.js → 9726c2cde77e0916.js} +1 -1
  20. package/packages/web/.next/standalone/.next/static/chunks/cd878566fda12635.css +3 -0
  21. package/packages/web/.next/standalone/hooks/useConfigManager.ts +72 -52
  22. package/packages/web/.next/standalone/lib/configManagerUtils.ts +84 -0
  23. package/packages/web/.next/standalone/lib/htmlGenerator.ts +31 -5
  24. package/packages/web/.next/standalone/lib/markdownGenerator.ts +37 -6
  25. package/packages/web/.next/standalone/lib/markdownTableGenerator.ts +17 -21
  26. package/packages/web/.next/standalone/lib/utils.ts +19 -2
  27. package/packages/web/.next/standalone/package-lock.json +239 -0
  28. package/packages/web/.next/standalone/package.json +2 -0
  29. package/packages/web/.next/standalone/playwright-report/index.html +1 -1
  30. package/packages/web/.next/static/chunks/{54e2bd8f072e7d4e.js → 9726c2cde77e0916.js} +1 -1
  31. package/packages/web/.next/static/chunks/cd878566fda12635.css +3 -0
  32. package/packages/web/package.json +2 -0
  33. package/packages/web/.next/standalone/.next/static/chunks/4bbca8cd642026de.css +0 -3
  34. package/packages/web/.next/static/chunks/4bbca8cd642026de.css +0 -3
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31713,e=>{"use strict";var t=e.i(43476),r=e.i(71645);let a=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},s=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:o,className:i="",children:n,iconNode:c,...d},h)=>(0,r.createElement)("svg",{ref:h,...l,width:t,height:t,stroke:e,strokeWidth:o?24*Number(a)/Number(t):a,className:s("lucide",i),...!n&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(d)&&{"aria-hidden":"true"},...d},[...c.map(([e,t])=>(0,r.createElement)(e,t)),...Array.isArray(n)?n:[n]])),i=(e,t)=>{let l=(0,r.forwardRef)(({className:l,...i},n)=>(0,r.createElement)(o,{ref:n,iconNode:t,className:s(`lucide-${a(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,l),...i}));return l.displayName=a(e),l},n=i("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),c=i("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);function d({onExportClick:e}){return(0,t.jsx)("header",{className:"bg-white/80 backdrop-blur-md border-b border-gray-200 shadow-sm sticky top-0 z-50",children:(0,t.jsxs)("div",{className:"container mx-auto px-6 py-4 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("img",{src:"/logo.svg",alt:"ConfigDoc",className:"w-12 h-12 rounded-lg"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:"ConfigDoc"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"Configuration Documentation Tool"})]})]}),(0,t.jsxs)("button",{onClick:e,className:"flex items-center gap-2 px-5 py-2.5 bg-gradient-to-r from-green-500 to-emerald-600 text-white rounded-lg hover:from-green-600 hover:to-emerald-700 shadow-md hover:shadow-lg transition-all duration-200 transform",title:"エクスポート",children:[(0,t.jsx)(c,{className:"w-5 h-5"}),(0,t.jsx)("span",{className:"font-medium",children:"エクスポート"})]})]})})}let h=i("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),u=i("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function m({loadedConfigs:e,activeConfigIndex:a,onTabClick:s,onRemoveConfig:l,onAddFileClick:o,onReorder:i}){let[n,c]=(0,r.useState)(null),[d,m]=(0,r.useState)(null),x=()=>{m(null)},g=()=>{c(null),m(null)},f=e.map(e=>e.filePath);return(0,t.jsxs)("div",{className:"bg-white/90 backdrop-blur-sm rounded-2xl shadow-xl border border-gray-100 p-6 mb-8 hover:shadow-2xl transition-shadow duration-300",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-blue-500 to-blue-600 rounded-lg flex items-center justify-center",children:(0,t.jsx)(h,{className:"w-5 h-5 text-white"})}),(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-800",children:"設定ファイル"})]}),(0,t.jsxs)("button",{onClick:o,className:"flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-lg hover:from-blue-600 hover:to-blue-700 shadow-md hover:shadow-lg transition-all duration-200 transform",children:[(0,t.jsx)(h,{className:"w-5 h-5"}),(0,t.jsx)("span",{className:"font-medium",children:"ファイルを追加"})]})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-3",children:e.map((r,o)=>(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>{c(o)},onDragOver:e=>{e.preventDefault(),null!==n&&n!==o&&m(o)},onDragLeave:x,onDrop:()=>(t=>{if(null===n||n===t){c(null),m(null);return}let r=[...e],[s]=r.splice(n,1);r.splice(t,0,s);let l=a;a===n?l=t:n<a&&t>=a?l=a-1:n>a&&t<=a&&(l=a+1),i(r,l),c(null),m(null)})(o),onDragEnd:g,onClick:()=>s(o),className:`group flex items-center gap-2 px-4 py-2.5 rounded-xl border-2 cursor-grab transition-all duration-200 ${a===o?"bg-gradient-to-r from-blue-50 to-indigo-50 border-blue-400 shadow-md":"bg-white border-gray-200 hover:border-blue-300 hover:shadow-md"} ${n===o?"opacity-50":""} ${d===o?"border-blue-500 border-dashed":""}`,children:[(0,t.jsx)("span",{className:`text-sm font-medium ${a===o?"text-blue-700":"text-gray-700"}`,children:function(e,t){let r=e.split(/[/\\]/).pop()||e,a=t.filter(e=>e.split(/[/\\]/).pop()===r);if(1===a.length)return r;let s=e.split(/[/\\]/);for(let t=1;t<s.length;t++){let r=s.slice(-t-1).join("/");if(0===a.filter(a=>r===a.split(/[/\\]/).slice(-t-1).join("/")&&a!==e).length)return r}return e}(r.filePath,f)}),(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),l(o)},className:"text-gray-400 hover:text-red-500 transition-colors opacity-0 group-hover:opacity-100",children:(0,t.jsx)(u,{className:"w-4 h-4"})})]},r.filePath))}):(0,t.jsxs)("div",{className:"text-center py-12 bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl border-2 border-dashed border-gray-300",children:[(0,t.jsx)(h,{className:"w-16 h-16 text-gray-400 mx-auto mb-3"}),(0,t.jsx)("p",{className:"text-sm text-gray-600 font-medium",children:"設定ファイルを選択してください"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"「ファイルを追加」ボタンから開始"})]})]})}let x=i("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),g=i("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),f=i("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),p=i("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),b=i("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);function y({label:e,items:a,onItemsChange:s,editButtonTitle:l,editModeDescription:o,inputPlaceholder:i,newItemPlaceholder:n,deleteButtonTitle:c,addButtonTitle:d,duplicateErrorMessage:h,onRename:m,children:g}){let[y,j]=(0,r.useState)(!1),[N,w]=(0,r.useState)([]),[v,k]=(0,r.useState)(""),[C,S]=(0,r.useState)(null),[P,T]=(0,r.useState)(null),O=(0,r.useMemo)(()=>{if(null===C||null===P||C===P)return N.map((e,t)=>({item:e,originalIndex:t}));let e=N.map((e,t)=>({item:e,originalIndex:t})),[t]=e.splice(C,1);return e.splice(P,0,t),e},[N,C,P]),D=()=>{let e=v.trim();e&&!N.some(t=>t.newName===e)&&(w([...N,{originalName:"",newName:e,isNew:!0}]),k(""))},$=()=>{if(null===C||null===P||C===P){S(null),T(null);return}let e=[...N],[t]=e.splice(C,1);e.splice(P,0,t),w(e),S(null),T(null)},A=()=>{S(null),T(null)},E=()=>{let e=N.map(e=>e.newName.trim()).filter(Boolean);return new Set(e).size!==e.length},M=!E()&&!N.some(e=>!e.newName.trim());return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-gray-700",children:e}),!y&&(0,t.jsx)("button",{onClick:()=>{w(a.map(e=>({originalName:e,newName:e,isNew:!1}))),j(!0),k("")},className:"text-gray-500 hover:text-blue-600 transition-colors p-1",title:l,children:(0,t.jsx)(f,{className:"w-4 h-4"})})]}),y?(0,t.jsxs)("div",{className:"space-y-3 p-4 bg-blue-50 rounded-lg border-2 border-blue-200",children:[(0,t.jsxs)("div",{className:"text-xs font-medium text-blue-700 mb-2",children:[o,"(ドラッグで並び替え可能)"]}),(0,t.jsx)("div",{className:"space-y-2",children:O.map(({item:e,originalIndex:r},a)=>{let s=C===r;return(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>{S(r)},onDragOver:e=>{e.preventDefault(),null!==C&&P!==a&&T(a)},onDrop:$,onDragEnd:A,className:`flex items-center gap-2 transition-all ${s?"opacity-50":""}`,children:[(0,t.jsx)("div",{className:"cursor-grab text-gray-400 hover:text-gray-600 p-1",title:"ドラッグして並び替え",children:(0,t.jsx)(b,{className:"w-4 h-4"})}),(0,t.jsx)("input",{type:"text",value:e.newName,onChange:e=>{var t;return t=e.target.value,void w(N.map((e,a)=>a===r?{...e,newName:t}:e))},placeholder:i,className:`flex-1 px-3 py-2 border-2 rounded-lg text-sm focus:ring-2 transition-all duration-200 ${!e.newName.trim()?"border-red-300 focus:border-red-400 focus:ring-red-200":"border-gray-200 focus:border-blue-400 focus:ring-blue-200"}`}),(0,t.jsx)("button",{onClick:()=>{w(N.filter((e,t)=>t!==r))},className:"text-gray-400 hover:text-red-600 transition-colors p-2",title:c,children:(0,t.jsx)(u,{className:"w-4 h-4"})})]},r)})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-2 border-t border-blue-200",children:[(0,t.jsx)("input",{type:"text",value:v,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),D())},placeholder:n,className:"flex-1 px-3 py-2 border-2 border-gray-200 rounded-lg text-sm focus:border-blue-400 focus:ring-2 focus:ring-blue-200 transition-all duration-200"}),(0,t.jsx)("button",{onClick:D,disabled:!v.trim()||N.some(e=>e.newName.trim()===v.trim()),className:"px-3 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors disabled:bg-gray-300 disabled:cursor-not-allowed",title:d,children:(0,t.jsx)(p,{className:"w-4 h-4"})})]}),E()&&(0,t.jsx)("div",{className:"text-xs text-red-600 mt-2",children:h}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-3 border-t border-blue-200",children:[(0,t.jsxs)("button",{onClick:()=>{let e=[],t={};for(let r of N){let a=r.newName.trim();a&&(e.push(a),r.isNew||r.originalName===a||(t[r.originalName]=a))}let r=v.trim();r&&!e.includes(r)&&e.push(r),m&&Object.keys(t).length>0&&m(t),s(e),j(!1),w([]),k("")},disabled:!M,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors disabled:bg-gray-300 disabled:cursor-not-allowed text-sm font-medium",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"保存"]}),(0,t.jsx)("button",{onClick:()=>{j(!1),w([]),k(""),S(null),T(null)},className:"flex-1 px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors text-sm font-medium",children:"キャンセル"})]})]}):g]})}function j({selectedTags:e,availableTags:r,onSelectedTagsChange:a,onAvailableTagsChange:s}){return(0,t.jsx)(y,{label:"タグ",items:r,onItemsChange:t=>{let r=e.filter(e=>t.includes(e));r.length!==e.length&&a(r),s(t)},editButtonTitle:"タグを編集",editModeDescription:"タグの追加・削除・名前変更",inputPlaceholder:"タグ名",newItemPlaceholder:"新しいタグ名を入力",deleteButtonTitle:"タグを削除",addButtonTitle:"タグを追加",duplicateErrorMessage:"同じ名前のタグがあります",onRename:t=>{let r=e.map(e=>t[e]||e);JSON.stringify(r)!==JSON.stringify(e)&&a(r)},children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:0===r.length?(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"タグがありません。鉛筆アイコンをクリックして追加してください。"}):r.map(r=>{let s=e.includes(r);return(0,t.jsxs)("button",{onClick:()=>{e.includes(r)?a(e.filter(e=>e!==r)):a([...e,r])},className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border-2 transition-all duration-200 ${s?"bg-blue-500 text-white border-blue-600 shadow-md":"bg-white text-gray-700 border-gray-200 hover:border-blue-300 hover:bg-blue-50"}`,children:[s&&(0,t.jsx)(g,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:r})]},r)})})})}function N({fields:e,projectFields:r,onFieldsChange:a,onUpdateProjectFields:s}){let l=Object.keys(r);return(0,t.jsx)(y,{label:"フィールド",items:l,onItemsChange:t=>{let r={};for(let a of t)r[a]=e[a]||"";if(a(r),s){let e={};for(let r of t)e[r]="";s(e)}},editButtonTitle:"フィールドを編集",editModeDescription:"フィールドの追加・削除・名前変更",inputPlaceholder:"フィールド名",newItemPlaceholder:"新しいフィールド名を入力",deleteButtonTitle:"フィールドを削除",addButtonTitle:"フィールドを追加",duplicateErrorMessage:"同じ名前のフィールドがあります",onRename:t=>{let r={};for(let[a,s]of Object.entries(e))r[t[a]||a]=s;a(r)},children:(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(e).map(([r,s])=>(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:r}),(0,t.jsx)("textarea",{value:s,onChange:t=>{var s;return s=t.target.value,void a({...e,[r]:s})},className:"w-full border-2 border-gray-200 rounded-lg p-3 min-h-[80px] text-sm focus:border-blue-400 focus:ring-2 focus:ring-blue-200 transition-all duration-200 shadow-sm hover:shadow-md",placeholder:`${r}を入力してください`})]},r))})})}function w({selectedPath:e,editingDoc:r,hasUnsavedChanges:a,availableTags:s,projectFields:l,onEditingDocChange:o,onAvailableTagsChange:i,onProjectFieldsChange:c,onSave:d}){return(0,t.jsxs)("div",{className:"bg-white/90 backdrop-blur-sm rounded-2xl shadow-xl border border-gray-100 p-6 flex flex-col max-h-[calc(100vh-190px)] hover:shadow-2xl transition-shadow duration-300",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-indigo-500 to-indigo-600 rounded-lg flex items-center justify-center",children:(0,t.jsx)(x,{className:"w-5 h-5 text-white"})}),(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-800",children:"プロパティ詳細"})]}),e&&r?(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex-shrink-0 pb-4 border-b border-gray-200",children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:"パス"}),(0,t.jsx)("div",{className:"text-sm text-gray-700 bg-gradient-to-r from-blue-50 to-indigo-50 p-3 rounded-lg font-mono border border-blue-200 shadow-sm",children:e})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto py-4 space-y-6 min-h-0",children:[(0,t.jsx)(j,{selectedTags:r.tags||[],availableTags:s,onSelectedTagsChange:e=>{o({...r,tags:e})},onAvailableTagsChange:i}),(0,t.jsx)(N,{fields:r.fields||{},projectFields:l,onFieldsChange:e=>{o({...r,fields:e})},onUpdateProjectFields:c})]}),(0,t.jsx)("div",{className:"flex-shrink-0 pt-4 border-t border-gray-200",children:(0,t.jsxs)("button",{onClick:d,disabled:!a,className:`w-full flex items-center justify-center gap-2 px-4 py-3 rounded-lg shadow-md transition-all duration-200 transform ${a?"bg-gradient-to-r from-green-500 to-emerald-600 text-white hover:from-green-600 hover:to-emerald-700 hover:shadow-lg cursor-pointer":"bg-gray-300 text-gray-500 cursor-not-allowed"}`,children:[(0,t.jsx)(x,{className:"w-5 h-5"}),(0,t.jsx)("span",{className:"font-medium",children:"保存"})]})})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1",children:[(0,t.jsx)("div",{className:"w-20 h-20 bg-gradient-to-br from-gray-100 to-gray-200 rounded-full flex items-center justify-center mb-4",children:(0,t.jsx)(n,{className:"w-10 h-10 text-gray-400"})}),(0,t.jsx)("p",{className:"text-sm text-gray-600 font-medium",children:"プロパティを選択してください"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"左側のツリーから項目を選択"})]})]})}let v=i("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),k=i("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);class C{static flattenConfig(e,t=""){let r={};for(let a in e){let s=t?`${t}:${a}`:a,l=e[a];l&&"object"==typeof l?Array.isArray(l)?l.some(e=>e&&"object"==typeof e&&!Array.isArray(e))?l.forEach((e,t)=>{e&&"object"==typeof e&&!Array.isArray(e)&&Object.assign(r,this.flattenConfig(e,`${s}[${t}]`))}):r[s]=l:Object.assign(r,this.flattenConfig(l,s)):r[s]=l}return r}static getAllPropertyPaths(e,t=""){let r=[];for(let a in e){let s=t?`${t}:${a}`:a,l=e[a];r.push(s),l&&"object"==typeof l&&(Array.isArray(l)?l.some(e=>e&&"object"==typeof e&&!Array.isArray(e))&&l.forEach((e,t)=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let a=`${s}[${t}]`;r.push(a),r.push(...this.getAllPropertyPaths(e,a))}}):r.push(...this.getAllPropertyPaths(l,s)))}return r}static buildTree(e,t=""){let r=[];for(let a in e){let s=t?`${t}:${a}`:a,l=e[a];if(l&&"object"==typeof l)if(Array.isArray(l))if(l.some(e=>e&&"object"==typeof e&&!Array.isArray(e))){let e=[];l.forEach((t,r)=>{t&&"object"==typeof t&&!Array.isArray(t)&&e.push({key:`[${r}]`,fullPath:`${s}[${r}]`,value:t,children:this.buildTree(t,`${s}[${r}]`),hasDocumentation:!1,type:"object"})}),r.push({key:a,fullPath:s,value:l,children:e.length>0?e:void 0,hasDocumentation:!1,type:"array"})}else r.push({key:a,fullPath:s,value:l,hasDocumentation:!1,type:"array"});else r.push({key:a,fullPath:s,value:l,children:this.buildTree(l,s),hasDocumentation:!1,type:"object"});else r.push({key:a,fullPath:s,value:l,hasDocumentation:!1,type:typeof l})}return r}}function S({config:e,docs:a,onSelectProperty:s,onEditProperty:l,selectedPath:o}){let[i,c]=(0,r.useState)(new Set),d=(e,r=0)=>{var h;let u,m=(h=e.fullPath,!!(u=a.properties[h])&&(!!(u.tags&&u.tags.length>0||u.fields&&Object.values(u.fields).some(e=>e&&""!==e.trim()))||!1)),x=i.has(e.fullPath),g=o===e.fullPath;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{paddingLeft:`${20*r}px`},className:`group flex items-center gap-2 py-2 px-3 cursor-pointer rounded-lg transition-all duration-150 ${g?"bg-gradient-to-r from-blue-100 to-indigo-100 border-l-4 border-blue-500 shadow-sm":"hover:bg-gradient-to-r hover:from-gray-50 hover:to-gray-100"}`,children:[e.children&&e.children.length>0?(0,t.jsx)("button",{onClick:()=>{var t;let r;return t=e.fullPath,void((r=new Set(i)).has(t)?r.delete(t):r.add(t),c(r))},className:"p-1 hover:bg-blue-100 rounded-md transition-colors",children:x?(0,t.jsx)(k,{className:"w-4 h-4 text-blue-600"}):(0,t.jsx)(v,{className:"w-4 h-4 text-gray-600"})}):(0,t.jsx)("div",{className:"w-6"}),(0,t.jsxs)("div",{onClick:()=>s(e.fullPath),className:"flex-1 flex items-center gap-2",children:[(0,t.jsx)("span",{className:`${e.children?"font-bold text-gray-800":"font-medium text-gray-700"}`,children:e.key}),!e.children&&(0,t.jsxs)("span",{className:"text-sm text-gray-500 truncate max-w-[200px]",children:[": ",JSON.stringify(e.value)]}),m&&(0,t.jsxs)("div",{className:"flex items-center gap-1 px-2 py-0.5 bg-green-100 border border-green-300 rounded-full",children:[(0,t.jsx)(n,{className:"w-3 h-3 text-green-600"}),(0,t.jsx)("span",{className:"text-xs text-green-700 font-medium",children:"Doc"})]})]}),!e.children&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),l(e.fullPath)},className:"p-1 hover:bg-gray-200 rounded",title:"編集"})]}),e.children&&x&&(0,t.jsx)("div",{children:e.children.map(e=>d(e,r+1))})]},e.fullPath)},h=C.buildTree(e);return(0,t.jsxs)("div",{className:"h-full flex flex-col border-2 border-gray-100 rounded-xl bg-white shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 border-b-2 border-gray-100 bg-gradient-to-r from-gray-50 to-gray-100",children:[(0,t.jsx)("button",{onClick:()=>{var t;let r,a;c(new Set((t=C.buildTree(e),r=[],a=e=>{e.children&&e.children.length>0&&(r.push(e.fullPath),e.children.forEach(a))},t.forEach(a),r)))},className:"px-4 py-1.5 text-sm font-medium bg-white border-2 border-blue-200 text-blue-600 rounded-lg hover:bg-blue-50 hover:border-blue-300 transition-all duration-200 shadow-sm hover:shadow-md",children:"すべて展開"}),(0,t.jsx)("button",{onClick:()=>{c(new Set)},className:"px-4 py-1.5 text-sm font-medium bg-white border-2 border-gray-200 text-gray-600 rounded-lg hover:bg-gray-50 hover:border-gray-300 transition-all duration-200 shadow-sm hover:shadow-md",children:"すべて閉じる"})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-3",children:h.map(e=>d(e))})]})}let P=i("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),T=i("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),O=i("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);function D({isOpen:e,currentPath:a,onSelect:s,onClose:l,multiSelect:o=!1,filterJsonOnly:i=!1,folderSelectMode:n=!1,title:c}){let[d,h]=(0,r.useState)(a),[u,m]=(0,r.useState)([]),[x,g]=(0,r.useState)(!1),[f,p]=(0,r.useState)([]);(0,r.useEffect)(()=>{e&&(h(a),p([]))},[e,a]),(0,r.useEffect)(()=>{e&&b(d)},[e,d]);let b=async e=>{g(!0);try{let t=await fetch("/api/files/browse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:e})}),r=await t.json();if(r.success){let e=r.data.items;n?e=r.data.items.filter(e=>"directory"===e.type):i&&(e=r.data.items.filter(e=>"directory"===e.type||".json"===e.extension)),m(e)}else console.error("API returned error:",r.error)}catch(e){console.error("Failed to load directory:",e)}finally{g(!1)}},y=()=>d.replace(/\\/g,"/").toLowerCase()!==a.replace(/\\/g,"/").toLowerCase(),j=()=>{p([]),l()};return e?(0,t.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:c||(n?"フォルダを選択":"ファイルを選択")}),(0,t.jsx)("button",{onClick:j,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 border-b bg-gray-50",children:[(0,t.jsx)("button",{onClick:()=>{if(!y())return;let e=d.replace(/\\/g,"/"),t=e.split("/").filter(e=>e);if(t.length>1){let r,s=t.slice(0,-1),l=(r=1===s.length&&s[0].includes(":")?s[0]+"/":s[0].includes(":")?s[0]+"/"+s.slice(1).join("/"):e.startsWith("/")?"/"+s.join("/"):s.join("/")).replace(/\\/g,"/").toLowerCase(),o=a.replace(/\\/g,"/").toLowerCase();(l.startsWith(o)||l===o)&&h(r)}else if(1===t.length&&!t[0].includes(":")){if("."===a.replace(/\\/g,"/").toLowerCase())return;h(".")}},disabled:!y(),className:`p-2 rounded flex-shrink-0 ${y()?"hover:bg-gray-200":"opacity-50 cursor-not-allowed"}`,title:y()?"上のディレクトリへ":"ルートディレクトリです",children:(0,t.jsx)(O,{className:"w-5 h-5"})}),(0,t.jsxs)("span",{className:"text-sm text-gray-600 flex-1 truncate",children:["パス: ",d]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:x?(0,t.jsx)("div",{className:"text-center text-gray-500",children:"読み込み中..."}):(0,t.jsx)("div",{className:"space-y-1",children:u.map(e=>{let r=f.includes(e.path);return(0,t.jsxs)("div",{onClick:()=>{"directory"===e.type?n?p([e.path]):h(e.path):o?p(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]):p([e.path])},onDoubleClick:()=>{"directory"===e.type&&(h(e.path),p([]))},className:`flex items-center gap-2 p-2 rounded cursor-pointer hover:bg-gray-100 ${r?"bg-blue-100":""}`,children:["directory"===e.type?(0,t.jsx)(P,{className:"w-5 h-5 text-blue-500"}):(0,t.jsx)(T,{className:"w-5 h-5 text-green-500"}),(0,t.jsx)("span",{className:"text-sm",children:e.name}),r&&(o||n)&&(0,t.jsx)("span",{className:"ml-auto text-blue-500",children:"✓"})]},e.path)})})}),(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-t",children:[n?(0,t.jsx)("div",{className:"text-sm text-gray-600",children:f.length>0?`選択中: ${f[0].split(/[/\\]/).pop()}`:`現在のフォルダ: ${d.split(/[/\\]/).pop()||d}`}):o&&f.length>0?(0,t.jsxs)("div",{className:"text-sm text-gray-600",children:[f.length,"件選択中"]}):null,(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto",children:[(0,t.jsx)("button",{onClick:j,className:"px-4 py-2 text-gray-600 hover:bg-gray-100 rounded",children:"キャンセル"}),(0,t.jsx)("button",{onClick:()=>{n?(s(f.length>0?f:[d]),p([]),l()):f.length>0&&(s(f),p([]),l())},disabled:!n&&0===f.length,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed",children:"選択"})]})]})]})}):null}let $={format:"html",autoExport:!0,fileName:"config-doc",outputDir:".config_doc/output"};function A({isOpen:e,onClose:a,onExport:s,currentSettings:l,rootPath:o="."}){let[i,n]=(0,r.useState)(l||$),[d,h]=(0,r.useState)(!1),[m,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>{l&&n(l)},[l]);let g=(0,r.useMemo)(()=>{let e=o.replace(/\//g,"\\"),t=i.outputDir?.trim()||"",r=i.fileName||"config-doc",a="markdown"===i.format||"markdown-table"===i.format?"md":"html";if(t){let s=t.replace(/\//g,"\\");return`${e}\\${s}\\${r}.${a}`}return`${e}\\${r}.${a}`},[i.format,i.fileName,i.outputDir,o]);if(!e)return null;let f=async()=>{h(!0);try{await s(i),a()}catch(e){console.error("Export failed:",e)}finally{h(!1)}};return(0,t.jsxs)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-6 border-b",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-800",children:"エクスポート設定"}),(0,t.jsx)("button",{onClick:a,className:"text-gray-400 hover:text-gray-600 transition-colors",children:(0,t.jsx)(u,{className:"w-5 h-5"})})]}),(0,t.jsxs)("div",{className:"p-6 space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"出力先フォルダ"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",value:i.outputDir||"",onChange:e=>n({...i,outputDir:e.target.value}),className:"flex-1 px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"(空欄でプロジェクトルート)"}),(0,t.jsx)("button",{type:"button",onClick:()=>x(!0),className:"px-3 py-2 border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500",title:"フォルダを選択",children:(0,t.jsx)(P,{className:"w-5 h-5 text-gray-500"})})]}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"相対パスを入力またはフォルダを選択(空欄でプロジェクトルート、チーム共有設定)"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"ファイル名"}),(0,t.jsx)("input",{type:"text",value:i.fileName??"",onChange:e=>n({...i,fileName:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"config-doc"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"拡張子なしのファイル名を指定します(空欄でconfig-doc、チーム共有設定)"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"出力形式"}),(0,t.jsxs)("select",{value:i.format,onChange:e=>n({...i,format:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[(0,t.jsx)("option",{value:"html",children:"HTML"}),(0,t.jsx)("option",{value:"markdown",children:"Markdown"}),(0,t.jsx)("option",{value:"markdown-table",children:"Markdown (テーブル形式)"})]}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"html"===i.format?"スタイル付きのHTMLファイルとして出力します":"markdown-table"===i.format?"Markdownテーブル形式で出力します(プロパティ名、説明、値、備考)":"テキストベースのMarkdownファイルとして出力します"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"出力先パス"}),(0,t.jsx)("div",{className:"px-3 py-2 bg-gray-50 border border-gray-300 rounded-md text-sm text-gray-700 font-mono break-all",children:g})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"flex items-center h-5",children:(0,t.jsx)("input",{id:"auto-export",type:"checkbox",checked:i.autoExport,onChange:e=>n({...i,autoExport:e.target.checked}),className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"})}),(0,t.jsxs)("div",{className:"ml-3",children:[(0,t.jsx)("label",{htmlFor:"auto-export",className:"text-sm font-medium text-gray-700 cursor-pointer",children:"保存時に自動エクスポート"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"ドキュメントを保存したときに自動的にHTMLファイルを更新します"})]})]}),i.lastExportedAt&&(0,t.jsx)("div",{className:"pt-4 border-t",children:(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["最終エクスポート: ",new Date(i.lastExportedAt).toLocaleString("ja-JP")]})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 p-6 border-t bg-gray-50 rounded-b-lg",children:[(0,t.jsx)("button",{onClick:a,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"キャンセル"}),(0,t.jsxs)("button",{onClick:f,disabled:d,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,t.jsx)(c,{className:"w-4 h-4"}),d?"エクスポート中...":"エクスポート"]})]})]}),(0,t.jsx)(D,{isOpen:m,currentPath:o,onSelect:e=>{if(e.length>0){let t=e[0],r=o.replace(/\\/g,"/"),a=t.replace(/\\/g,"/"),s=a;a.startsWith(r)&&(s=a.slice(r.length)).startsWith("/")&&(s=s.slice(1)),s||(s="."),n({...i,outputDir:s})}x(!1)},onClose:()=>x(!1),folderSelectMode:!0,title:"出力先フォルダを選択"})]})}let E=i("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),M=i("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),F=i("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);function z({message:e,type:a,duration:s=3e3,onClose:l}){let[o,i]=(0,r.useState)(!1);(0,r.useEffect)(()=>{setTimeout(()=>i(!0),10);let e=setTimeout(()=>{i(!1),setTimeout(l,300)},s);return()=>clearTimeout(e)},[s,l]);let n={success:(0,t.jsx)(E,{className:"w-5 h-5 text-green-500"}),error:(0,t.jsx)(M,{className:"w-5 h-5 text-red-500"}),warning:(0,t.jsx)(F,{className:"w-5 h-5 text-yellow-500"})};return(0,t.jsx)("div",{className:`fixed bottom-4 left-4 z-50 transition-all duration-300 ${o?"opacity-100 translate-y-0":"opacity-0 translate-y-2"}`,children:(0,t.jsxs)("div",{className:`flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg border ${{success:"bg-green-50 border-green-200",error:"bg-red-50 border-red-200",warning:"bg-yellow-50 border-yellow-200"}[a]} min-w-[300px] max-w-[500px]`,children:[n[a],(0,t.jsx)("span",{className:"flex-1 text-sm text-gray-800",children:e}),(0,t.jsx)("button",{onClick:()=>{i(!1),setTimeout(l,300)},className:"text-gray-400 hover:text-gray-600 transition-colors",children:(0,t.jsx)(u,{className:"w-4 h-4"})})]})})}function J({toasts:e,onRemove:r}){return(0,t.jsx)(t.Fragment,{children:e.map((e,a)=>(0,t.jsx)("div",{style:{bottom:`${16+80*a}px`},className:"fixed left-4 z-50",children:(0,t.jsx)(z,{message:e.message,type:e.type,onClose:()=>r(e.id)})},e.id))})}let L={説明:""};function H(){let[e,a]=(0,r.useState)(!1),[s,l]=(0,r.useState)(!1),{loadedConfigs:o,activeConfigIndex:i,activeConfig:c,selectedPath:h,editingDoc:u,originalDoc:x,hasUnsavedChanges:g,exportSettings:f,availableTags:p,projectFields:b,toasts:y,rootPath:j,setActiveConfigIndex:N,setEditingDoc:v,setHasUnsavedChanges:k,removeToast:C,handleSelectConfigFiles:P,handleRemoveConfig:T,handleReorderConfigs:O,handleSelectProperty:$,handleSaveProperty:E,handleExport:M,handleAvailableTagsChange:F,handleProjectFieldsChange:z,checkForChanges:H,resetSelection:I}=function(){let[e,t]=(0,r.useState)([]),[a,s]=(0,r.useState)(0),[l,o]=(0,r.useState)(""),[i,n]=(0,r.useState)(!1),[c,d]=(0,r.useState)("."),[h,u]=(0,r.useState)(null),[m,x]=(0,r.useState)(null),[g,f]=(0,r.useState)(!1),[p,b]=(0,r.useState)(),[y,j]=(0,r.useState)(["required","nullable","string","number","boolean"]),[N,w]=(0,r.useState)(L),[v,k]=(0,r.useState)([]),C=e[a],S=(0,r.useCallback)((e,t="success")=>{let r=Date.now().toString();k(a=>[...a,{id:r,message:e,type:t}])},[]),P=(0,r.useCallback)(e=>{k(t=>t.filter(t=>t.id!==e))},[]),T=(0,r.useCallback)((e,t)=>{if(!e||!t)return!1;let r=e.tags||[],a=t.tags||[];if(r.length!==a.length||r.some((e,t)=>e!==a[t]))return!0;let s=e.fields||{},l=t.fields||{};for(let e of new Set([...Object.keys(s),...Object.keys(l)]))if((s[e]||"")!==(l[e]||""))return!0;return!1},[]),O=(0,r.useCallback)((e,t)=>{let r=e.replace(/\\/g,"/"),a=t.replace(/\\/g,"/");if(!r.match(/^[a-zA-Z]:\//)&&!r.startsWith("/"))return e;if(r.startsWith(a)){let e=r.substring(a.length);return e.startsWith("/")?e.substring(1):e}return e},[]),D=(0,r.useCallback)(e=>{let t={};for(let r of Object.keys(N))t[r]=e.fields[r]||"";return{...e,fields:t}},[N]),$=(0,r.useCallback)(async e=>{try{let r=await fetch("/api/config/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e})}),a=await r.json();a.success&&t(t=>t.some(t=>t.filePath===e)?t:[...t,{filePath:e,configData:a.data.configData,docs:a.data.docs}])}catch(e){console.error("Failed to load config file:",e)}},[]),A=(0,r.useCallback)(async e=>{try{let t=await fetch("/api/config/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configFilePaths:e})}),r=await t.json();r.deletedDocsFiles&&r.deletedDocsFiles.length>0&&S(`${r.deletedDocsFiles.length}件のドキュメントファイルを削除しました`,"warning")}catch(e){console.error("Failed to update metadata:",e)}},[S]),E=(0,r.useCallback)(async()=>{if(p)try{if((await fetch("/api/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({format:p.format,fileName:p.fileName,outputDir:p.outputDir})})).ok){let e={...p,lastExportedAt:new Date().toISOString()};b(e),await fetch("/api/export/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:e})})}}catch(e){console.error("Auto export failed:",e)}},[p]);(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/project"),t=await e.json();if(t.success&&(d(t.data.rootPath),t.data.hasConfigDoc)){let e=await fetch("/api/config/metadata"),t=await e.json();if(t.success&&t.data?.configFiles)for(let e of t.data.configFiles)await $(e.filePath);t.success&&t.data?.availableTags&&j(t.data.availableTags),t.success&&t.data?.fields&&w(t.data.fields)}let r=await fetch("/api/export/settings"),a=await r.json();a.success&&b(a.data)}catch(e){console.error("Failed to load saved configs:",e)}finally{n(!0)}})()},[$]);let M=(0,r.useCallback)(async r=>{let a=[];for(let t of r){let r=O(t,c);if(!e.some(e=>e.filePath===r))try{let e=await fetch("/api/config/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:t})}),s=await e.json();s.success?a.push({filePath:r,configData:s.data.configData,docs:s.data.docs}):S(`設定ファイルの読み込みに失敗しました (${t}): ${s.error}`,"error")}catch(e){console.error("Failed to load config:",e),S(`設定ファイルの読み込み中にエラーが発生しました: ${t}`,"error")}}a.length>0&&t(e=>{let t=[...e,...a];return A(t.map(e=>e.filePath)),t})},[e,c,S,O,A]),F=(0,r.useCallback)(async r=>{let l=e[r];(!l.docs||!(Object.keys(l.docs.properties).length>0)||confirm("既に説明文が設定されていますが、削除してよろしいですか?"))&&(t(e=>{let t=e.filter((e,t)=>t!==r);return A(t.map(e=>e.filePath)),t}),a>=r&&a>0&&s(a-1),o(""),u(null),f(!1))},[a,e,A]),z=(0,r.useCallback)((e,r)=>{t(e),s(r),A(e.map(e=>e.filePath))},[A]),J=(0,r.useCallback)(e=>{if(g&&!confirm("保存されていない変更があります。破棄しますか?"))return;o(e);let t=C?.docs.properties[e];if(t){let e=D({...t,tags:t.tags||[]});u(e),x(e)}else{let t={path:e,tags:[],fields:{...N},modifiedAt:new Date().toISOString()};u(t),x(t)}f(!1)},[C,g,D,N]),H=(0,r.useCallback)(async()=>{if(h&&C)try{let e={...h,modifiedAt:new Date().toISOString()},r=await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configFilePath:C.filePath,propertyPath:l,propertyDoc:e})}),s=await r.json();s.success?(t(t=>t.map((t,r)=>r===a?{...t,docs:{...t.docs,properties:{...t.docs.properties,[l]:e}}}:t)),u(e),x(e),f(!1),S("保存しました"),p?.autoExport&&await E()):S("保存に失敗しました: "+s.error,"error")}catch(e){console.error("Failed to save:",e),S("保存中にエラーが発生しました","error")}},[C,a,h,p?.autoExport,E,l,S]),I=(0,r.useCallback)(async e=>{try{let t=await fetch("/api/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({format:e.format,fileName:e.fileName,outputDir:e.outputDir})}),r=await t.json();if(r.success){let t={...e,lastExportedAt:new Date().toISOString()};b(t),await fetch("/api/export/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:t})}),S(`エクスポートしました: ${r.outputPath}`)}else S("エクスポートに失敗しました: "+r.error,"error")}catch(e){console.error("Export failed:",e),S("エクスポート中にエラーが発生しました","error")}},[S]),B=(0,r.useCallback)(async r=>{let a=y.filter(e=>!r.includes(e));if(j(r),await fetch("/api/config/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({availableTags:r})}),a.length>0){for(let r of e){let e=!1,s={...r.docs.properties};for(let[t,r]of Object.entries(s))if(r.tags&&r.tags.length>0){let l=r.tags.filter(e=>!a.includes(e));l.length!==r.tags.length&&(s[t]={...r,tags:l},e=!0)}e&&(await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configFilePath:r.filePath,properties:s})}),t(e=>e.map(e=>e.filePath===r.filePath?{...e,docs:{...e.docs,properties:s}}:e)))}if(h&&h.tags){let e=h.tags.filter(e=>!a.includes(e));if(e.length!==h.tags.length&&(u({...h,tags:e}),m)){let e=(m.tags||[]).filter(e=>!a.includes(e));x({...m,tags:e})}}}},[y,h,e,m]),W=(0,r.useCallback)(async r=>{let a=Object.keys(N),s=Object.keys(r),l=a.filter(e=>!s.includes(e));if(w(r),await fetch("/api/config/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fields:r})}),l.length>0)for(let r of e){let e=!1,a={...r.docs.properties};for(let[t,r]of Object.entries(a))if(r.fields){let s={...r.fields},o=!1;for(let e of l)e in s&&(delete s[e],o=!0);o&&(a[t]={...r,fields:s},e=!0)}e&&(await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configFilePath:r.filePath,properties:a})}),t(e=>e.map(e=>e.filePath===r.filePath?{...e,docs:{...e.docs,properties:a}}:e)))}if(m){let e={};for(let t of s)e[t]=m.fields?.[t]||"";x({...m,fields:e})}if(h){let e={};for(let t of s)e[t]=h.fields?.[t]||"";let t={...h,fields:e};u(t),f(T(t,m?{...m,fields:Object.fromEntries(s.map(e=>[e,m.fields?.[e]||""]))}:null))}},[T,h,e,m,N]),R=(0,r.useCallback)(()=>{o(""),u(null),f(!1)},[]);return{loadedConfigs:e,activeConfigIndex:a,activeConfig:C,selectedPath:l,editingDoc:h,originalDoc:m,hasUnsavedChanges:g,exportSettings:p,availableTags:y,projectFields:N,toasts:v,rootPath:c,isInitialized:i,setActiveConfigIndex:s,setSelectedPath:o,setEditingDoc:u,setHasUnsavedChanges:f,showToast:S,removeToast:P,loadConfigFile:$,handleSelectConfigFiles:M,handleRemoveConfig:F,handleReorderConfigs:z,handleSelectProperty:J,handleSaveProperty:H,handleExport:I,handleAvailableTagsChange:B,handleProjectFieldsChange:W,checkForChanges:T,resetSelection:R}}();return(0,t.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-indigo-50 to-purple-50",children:[(0,t.jsx)(d,{onExportClick:()=>l(!0)}),(0,t.jsxs)("main",{className:"container mx-auto px-6 py-8",children:[(0,t.jsx)(m,{loadedConfigs:o,activeConfigIndex:i,onTabClick:e=>{N(e),I()},onRemoveConfig:T,onAddFileClick:()=>a(!0),onReorder:O}),c&&(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,t.jsxs)("div",{className:"bg-white/90 backdrop-blur-sm rounded-2xl shadow-xl border border-gray-100 p-6 flex flex-col max-h-[calc(100vh-190px)] hover:shadow-2xl transition-shadow duration-300",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-purple-500 to-purple-600 rounded-lg flex items-center justify-center",children:(0,t.jsx)(n,{className:"w-5 h-5 text-white"})}),(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-800",children:"JSON構造"})]}),(0,t.jsx)("div",{className:"overflow-y-auto flex-1",children:(0,t.jsx)(S,{config:c.configData,docs:c.docs,onSelectProperty:$,onEditProperty:$,selectedPath:h})})]}),(0,t.jsx)(w,{selectedPath:h,editingDoc:u,hasUnsavedChanges:g,availableTags:p,projectFields:b,onEditingDocChange:e=>{v(e),k(H(e,x))},onAvailableTagsChange:F,onProjectFieldsChange:z,onSave:E})]})]}),(0,t.jsx)(D,{isOpen:e,currentPath:j,multiSelect:!0,filterJsonOnly:!0,onSelect:e=>{P(e),a(!1)},onClose:()=>a(!1)}),(0,t.jsx)(A,{isOpen:s,onClose:()=>l(!1),onExport:M,currentSettings:f,rootPath:j}),(0,t.jsx)(J,{toasts:y,onRemove:C})]})}e.s(["default",()=>H],31713)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31713,e=>{"use strict";var t=e.i(43476),r=e.i(71645);let a=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},s=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:o,className:i="",children:n,iconNode:c,...d},h)=>(0,r.createElement)("svg",{ref:h,...l,width:t,height:t,stroke:e,strokeWidth:o?24*Number(a)/Number(t):a,className:s("lucide",i),...!n&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(d)&&{"aria-hidden":"true"},...d},[...c.map(([e,t])=>(0,r.createElement)(e,t)),...Array.isArray(n)?n:[n]])),i=(e,t)=>{let l=(0,r.forwardRef)(({className:l,...i},n)=>(0,r.createElement)(o,{ref:n,iconNode:t,className:s(`lucide-${a(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,l),...i}));return l.displayName=a(e),l},n=i("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),c=i("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);function d({onExportClick:e}){return(0,t.jsx)("header",{className:"bg-white/80 backdrop-blur-md border-b border-gray-200 shadow-sm sticky top-0 z-50",children:(0,t.jsxs)("div",{className:"container mx-auto px-6 py-4 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("img",{src:"/logo.svg",alt:"ConfigDoc",className:"w-12 h-12 rounded-lg"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:"ConfigDoc"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"Configuration Documentation Tool"})]})]}),(0,t.jsxs)("button",{onClick:e,className:"flex items-center gap-2 px-5 py-2.5 bg-gradient-to-r from-green-500 to-emerald-600 text-white rounded-lg hover:from-green-600 hover:to-emerald-700 shadow-md hover:shadow-lg transition-all duration-200 transform",title:"エクスポート",children:[(0,t.jsx)(c,{className:"w-5 h-5"}),(0,t.jsx)("span",{className:"font-medium",children:"エクスポート"})]})]})})}let h=i("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),u=i("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function m({loadedConfigs:e,activeConfigIndex:a,onTabClick:s,onRemoveConfig:l,onAddFileClick:o,onReorder:i}){let[n,c]=(0,r.useState)(null),[d,m]=(0,r.useState)(null),x=()=>{m(null)},f=()=>{c(null),m(null)},g=e.map(e=>e.filePath);return(0,t.jsxs)("div",{className:"bg-white/90 backdrop-blur-sm rounded-2xl shadow-xl border border-gray-100 p-6 mb-8 hover:shadow-2xl transition-shadow duration-300",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-blue-500 to-blue-600 rounded-lg flex items-center justify-center",children:(0,t.jsx)(h,{className:"w-5 h-5 text-white"})}),(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-800",children:"設定ファイル"})]}),(0,t.jsxs)("button",{onClick:o,className:"flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-lg hover:from-blue-600 hover:to-blue-700 shadow-md hover:shadow-lg transition-all duration-200 transform",children:[(0,t.jsx)(h,{className:"w-5 h-5"}),(0,t.jsx)("span",{className:"font-medium",children:"ファイルを追加"})]})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-3",children:e.map((r,o)=>(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>{c(o)},onDragOver:e=>{e.preventDefault(),null!==n&&n!==o&&m(o)},onDragLeave:x,onDrop:()=>(t=>{if(null===n||n===t){c(null),m(null);return}let r=[...e],[s]=r.splice(n,1);r.splice(t,0,s);let l=a;a===n?l=t:n<a&&t>=a?l=a-1:n>a&&t<=a&&(l=a+1),i(r,l),c(null),m(null)})(o),onDragEnd:f,onClick:()=>s(o),className:`group flex items-center gap-2 px-4 py-2.5 rounded-xl border-2 cursor-grab transition-all duration-200 ${a===o?"bg-gradient-to-r from-blue-50 to-indigo-50 border-blue-400 shadow-md":"bg-white border-gray-200 hover:border-blue-300 hover:shadow-md"} ${n===o?"opacity-50":""} ${d===o?"border-blue-500 border-dashed":""}`,children:[(0,t.jsx)("span",{className:`text-sm font-medium ${a===o?"text-blue-700":"text-gray-700"}`,children:function(e,t){let r=e.split(/[/\\]/).pop()||e,a=t.filter(e=>e.split(/[/\\]/).pop()===r);if(1===a.length)return r;let s=e.split(/[/\\]/);for(let t=1;t<s.length;t++){let r=s.slice(-t-1).join("/");if(0===a.filter(a=>r===a.split(/[/\\]/).slice(-t-1).join("/")&&a!==e).length)return r}return e}(r.filePath,g)}),(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),l(o)},className:"text-gray-400 hover:text-red-500 transition-colors opacity-0 group-hover:opacity-100",children:(0,t.jsx)(u,{className:"w-4 h-4"})})]},r.filePath))}):(0,t.jsxs)("div",{className:"text-center py-12 bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl border-2 border-dashed border-gray-300",children:[(0,t.jsx)(h,{className:"w-16 h-16 text-gray-400 mx-auto mb-3"}),(0,t.jsx)("p",{className:"text-sm text-gray-600 font-medium",children:"設定ファイルを選択してください"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"「ファイルを追加」ボタンから開始"})]})]})}let x=i("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),f=i("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),g=i("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),p=i("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),b=i("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);function y({label:e,items:a,onItemsChange:s,editButtonTitle:l,editModeDescription:o,inputPlaceholder:i,newItemPlaceholder:n,deleteButtonTitle:c,addButtonTitle:d,duplicateErrorMessage:h,onRename:m,children:f}){let[y,j]=(0,r.useState)(!1),[N,w]=(0,r.useState)([]),[v,k]=(0,r.useState)(""),[C,S]=(0,r.useState)(null),[P,O]=(0,r.useState)(null),T=(0,r.useMemo)(()=>{if(null===C||null===P||C===P)return N.map((e,t)=>({item:e,originalIndex:t}));let e=N.map((e,t)=>({item:e,originalIndex:t})),[t]=e.splice(C,1);return e.splice(P,0,t),e},[N,C,P]),D=()=>{let e=v.trim();e&&!N.some(t=>t.newName===e)&&(w([...N,{originalName:"",newName:e,isNew:!0}]),k(""))},$=()=>{if(null===C||null===P||C===P){S(null),O(null);return}let e=[...N],[t]=e.splice(C,1);e.splice(P,0,t),w(e),S(null),O(null)},A=()=>{S(null),O(null)},E=()=>{let e=N.map(e=>e.newName.trim()).filter(Boolean);return new Set(e).size!==e.length},M=!E()&&!N.some(e=>!e.newName.trim());return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-gray-700",children:e}),!y&&(0,t.jsx)("button",{onClick:()=>{w(a.map(e=>({originalName:e,newName:e,isNew:!1}))),j(!0),k("")},className:"text-gray-500 hover:text-blue-600 transition-colors p-1",title:l,children:(0,t.jsx)(g,{className:"w-4 h-4"})})]}),y?(0,t.jsxs)("div",{className:"space-y-3 p-4 bg-blue-50 rounded-lg border-2 border-blue-200",children:[(0,t.jsxs)("div",{className:"text-xs font-medium text-blue-700 mb-2",children:[o,"(ドラッグで並び替え可能)"]}),(0,t.jsx)("div",{className:"space-y-2",children:T.map(({item:e,originalIndex:r},a)=>{let s=C===r;return(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>{S(r)},onDragOver:e=>{e.preventDefault(),null!==C&&P!==a&&O(a)},onDrop:$,onDragEnd:A,className:`flex items-center gap-2 transition-all ${s?"opacity-50":""}`,children:[(0,t.jsx)("div",{className:"cursor-grab text-gray-400 hover:text-gray-600 p-1",title:"ドラッグして並び替え",children:(0,t.jsx)(b,{className:"w-4 h-4"})}),(0,t.jsx)("input",{type:"text",value:e.newName,onChange:e=>{var t;return t=e.target.value,void w(N.map((e,a)=>a===r?{...e,newName:t}:e))},placeholder:i,className:`flex-1 px-3 py-2 border-2 rounded-lg text-sm focus:ring-2 transition-all duration-200 ${!e.newName.trim()?"border-red-300 focus:border-red-400 focus:ring-red-200":"border-gray-200 focus:border-blue-400 focus:ring-blue-200"}`}),(0,t.jsx)("button",{onClick:()=>{w(N.filter((e,t)=>t!==r))},className:"text-gray-400 hover:text-red-600 transition-colors p-2",title:c,children:(0,t.jsx)(u,{className:"w-4 h-4"})})]},r)})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-2 border-t border-blue-200",children:[(0,t.jsx)("input",{type:"text",value:v,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),D())},placeholder:n,className:"flex-1 px-3 py-2 border-2 border-gray-200 rounded-lg text-sm focus:border-blue-400 focus:ring-2 focus:ring-blue-200 transition-all duration-200"}),(0,t.jsx)("button",{onClick:D,disabled:!v.trim()||N.some(e=>e.newName.trim()===v.trim()),className:"px-3 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors disabled:bg-gray-300 disabled:cursor-not-allowed",title:d,children:(0,t.jsx)(p,{className:"w-4 h-4"})})]}),E()&&(0,t.jsx)("div",{className:"text-xs text-red-600 mt-2",children:h}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-3 border-t border-blue-200",children:[(0,t.jsxs)("button",{onClick:()=>{let e=[],t={};for(let r of N){let a=r.newName.trim();a&&(e.push(a),r.isNew||r.originalName===a||(t[r.originalName]=a))}let r=v.trim();r&&!e.includes(r)&&e.push(r),m&&Object.keys(t).length>0&&m(t),s(e),j(!1),w([]),k("")},disabled:!M,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors disabled:bg-gray-300 disabled:cursor-not-allowed text-sm font-medium",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"保存"]}),(0,t.jsx)("button",{onClick:()=>{j(!1),w([]),k(""),S(null),O(null)},className:"flex-1 px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors text-sm font-medium",children:"キャンセル"})]})]}):f]})}function j({selectedTags:e,availableTags:r,onSelectedTagsChange:a,onAvailableTagsChange:s}){return(0,t.jsx)(y,{label:"タグ",items:r,onItemsChange:t=>{let r=e.filter(e=>t.includes(e));r.length!==e.length&&a(r),s(t)},editButtonTitle:"タグを編集",editModeDescription:"タグの追加・削除・名前変更",inputPlaceholder:"タグ名",newItemPlaceholder:"新しいタグ名を入力",deleteButtonTitle:"タグを削除",addButtonTitle:"タグを追加",duplicateErrorMessage:"同じ名前のタグがあります",onRename:t=>{let r=e.map(e=>t[e]||e);JSON.stringify(r)!==JSON.stringify(e)&&a(r)},children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:0===r.length?(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"タグがありません。鉛筆アイコンをクリックして追加してください。"}):r.map(r=>{let s=e.includes(r);return(0,t.jsxs)("button",{onClick:()=>{e.includes(r)?a(e.filter(e=>e!==r)):a([...e,r])},className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border-2 transition-all duration-200 ${s?"bg-blue-500 text-white border-blue-600 shadow-md":"bg-white text-gray-700 border-gray-200 hover:border-blue-300 hover:bg-blue-50"}`,children:[s&&(0,t.jsx)(f,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:r})]},r)})})})}function N({fields:e,projectFields:r,onFieldsChange:a,onUpdateProjectFields:s}){let l=Object.keys(r);return(0,t.jsx)(y,{label:"フィールド",items:l,onItemsChange:t=>{let r={};for(let a of t)r[a]=e[a]||"";if(a(r),s){let e={};for(let r of t)e[r]="";s(e)}},editButtonTitle:"フィールドを編集",editModeDescription:"フィールドの追加・削除・名前変更",inputPlaceholder:"フィールド名",newItemPlaceholder:"新しいフィールド名を入力",deleteButtonTitle:"フィールドを削除",addButtonTitle:"フィールドを追加",duplicateErrorMessage:"同じ名前のフィールドがあります",onRename:t=>{let r={};for(let[a,s]of Object.entries(e))r[t[a]||a]=s;a(r)},children:(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(e).map(([r,s])=>(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:r}),(0,t.jsx)("textarea",{value:s,onChange:t=>{var s;return s=t.target.value,void a({...e,[r]:s})},className:"w-full border-2 border-gray-200 rounded-lg p-3 min-h-[80px] text-sm focus:border-blue-400 focus:ring-2 focus:ring-blue-200 transition-all duration-200 shadow-sm hover:shadow-md",placeholder:`${r}を入力してください`})]},r))})})}function w({selectedPath:e,editingDoc:r,hasUnsavedChanges:a,availableTags:s,projectFields:l,onEditingDocChange:o,onAvailableTagsChange:i,onProjectFieldsChange:c,onSave:d}){return(0,t.jsxs)("div",{className:"bg-white/90 backdrop-blur-sm rounded-2xl shadow-xl border border-gray-100 p-6 flex flex-col max-h-[calc(100vh-190px)] hover:shadow-2xl transition-shadow duration-300",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-indigo-500 to-indigo-600 rounded-lg flex items-center justify-center",children:(0,t.jsx)(x,{className:"w-5 h-5 text-white"})}),(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-800",children:"プロパティ詳細"})]}),e&&r?(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex-shrink-0 pb-4 border-b border-gray-200",children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:"パス"}),(0,t.jsx)("div",{className:"text-sm text-gray-700 bg-gradient-to-r from-blue-50 to-indigo-50 p-3 rounded-lg font-mono border border-blue-200 shadow-sm",children:e})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto py-4 space-y-6 min-h-0",children:[(0,t.jsx)(j,{selectedTags:r.tags||[],availableTags:s,onSelectedTagsChange:e=>{o({...r,tags:e})},onAvailableTagsChange:i}),(0,t.jsx)(N,{fields:r.fields||{},projectFields:l,onFieldsChange:e=>{o({...r,fields:e})},onUpdateProjectFields:c})]}),(0,t.jsx)("div",{className:"flex-shrink-0 pt-4 border-t border-gray-200",children:(0,t.jsxs)("button",{onClick:d,disabled:!a,className:`w-full flex items-center justify-center gap-2 px-4 py-3 rounded-lg shadow-md transition-all duration-200 transform ${a?"bg-gradient-to-r from-green-500 to-emerald-600 text-white hover:from-green-600 hover:to-emerald-700 hover:shadow-lg cursor-pointer":"bg-gray-300 text-gray-500 cursor-not-allowed"}`,children:[(0,t.jsx)(x,{className:"w-5 h-5"}),(0,t.jsx)("span",{className:"font-medium",children:"保存"})]})})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1",children:[(0,t.jsx)("div",{className:"w-20 h-20 bg-gradient-to-br from-gray-100 to-gray-200 rounded-full flex items-center justify-center mb-4",children:(0,t.jsx)(n,{className:"w-10 h-10 text-gray-400"})}),(0,t.jsx)("p",{className:"text-sm text-gray-600 font-medium",children:"プロパティを選択してください"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"左側のツリーから項目を選択"})]})]})}let v=i("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),k=i("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);class C{static flattenConfig(e,t=""){let r={};for(let a in e){let s=t?`${t}:${a}`:a,l=e[a];l&&"object"==typeof l?Array.isArray(l)?l.some(e=>e&&"object"==typeof e&&!Array.isArray(e))?l.forEach((e,t)=>{e&&"object"==typeof e&&!Array.isArray(e)&&Object.assign(r,this.flattenConfig(e,`${s}[${t}]`))}):r[s]=l:Object.assign(r,this.flattenConfig(l,s)):r[s]=l}return r}static getAllPropertyPaths(e,t=""){let r=[];for(let a in e){let s=t?`${t}:${a}`:a,l=e[a];r.push(s),l&&"object"==typeof l&&(Array.isArray(l)?l.some(e=>e&&"object"==typeof e&&!Array.isArray(e))&&l.forEach((e,t)=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let a=`${s}[${t}]`;r.push(a),r.push(...this.getAllPropertyPaths(e,a))}}):r.push(...this.getAllPropertyPaths(l,s)))}return r}static buildTree(e,t=""){let r=[];for(let a in e){let s=t?`${t}:${a}`:a,l=e[a];if(l&&"object"==typeof l)if(Array.isArray(l))if(l.some(e=>e&&"object"==typeof e&&!Array.isArray(e))){let e=[];l.forEach((t,r)=>{t&&"object"==typeof t&&!Array.isArray(t)&&e.push({key:`[${r}]`,fullPath:`${s}[${r}]`,value:t,children:this.buildTree(t,`${s}[${r}]`),hasDocumentation:!1,type:"object"})}),r.push({key:a,fullPath:s,value:l,children:e.length>0?e:void 0,hasDocumentation:!1,type:"array"})}else r.push({key:a,fullPath:s,value:l,hasDocumentation:!1,type:"array"});else r.push({key:a,fullPath:s,value:l,children:this.buildTree(l,s),hasDocumentation:!1,type:"object"});else r.push({key:a,fullPath:s,value:l,hasDocumentation:!1,type:typeof l})}return r}}function S({config:e,docs:a,onSelectProperty:s,onEditProperty:l,selectedPath:o}){let[i,c]=(0,r.useState)(new Set),d=(e,r=0)=>{var h;let u,m=(h=e.fullPath,!!(u=a.properties[h])&&(!!(u.tags&&u.tags.length>0||u.fields&&Object.values(u.fields).some(e=>e&&""!==e.trim()))||!1)),x=i.has(e.fullPath),f=o===e.fullPath;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{paddingLeft:`${20*r}px`},className:`group flex items-center gap-2 py-2 px-3 cursor-pointer rounded-lg transition-all duration-150 ${f?"bg-gradient-to-r from-blue-100 to-indigo-100 border-l-4 border-blue-500 shadow-sm":"hover:bg-gradient-to-r hover:from-gray-50 hover:to-gray-100"}`,children:[e.children&&e.children.length>0?(0,t.jsx)("button",{onClick:()=>{var t;let r;return t=e.fullPath,void((r=new Set(i)).has(t)?r.delete(t):r.add(t),c(r))},className:"p-1 hover:bg-blue-100 rounded-md transition-colors",children:x?(0,t.jsx)(k,{className:"w-4 h-4 text-blue-600"}):(0,t.jsx)(v,{className:"w-4 h-4 text-gray-600"})}):(0,t.jsx)("div",{className:"w-6"}),(0,t.jsxs)("div",{onClick:()=>s(e.fullPath),className:"flex-1 flex items-center gap-2",children:[(0,t.jsx)("span",{className:`${e.children?"font-bold text-gray-800":"font-medium text-gray-700"}`,children:e.key}),!e.children&&(0,t.jsxs)("span",{className:"text-sm text-gray-500 truncate max-w-[200px]",children:[": ",JSON.stringify(e.value)]}),m&&(0,t.jsxs)("div",{className:"flex items-center gap-1 px-2 py-0.5 bg-green-100 border border-green-300 rounded-full",children:[(0,t.jsx)(n,{className:"w-3 h-3 text-green-600"}),(0,t.jsx)("span",{className:"text-xs text-green-700 font-medium",children:"Doc"})]})]}),!e.children&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),l(e.fullPath)},className:"p-1 hover:bg-gray-200 rounded",title:"編集"})]}),e.children&&x&&(0,t.jsx)("div",{children:e.children.map(e=>d(e,r+1))})]},e.fullPath)},h=C.buildTree(e);return(0,t.jsxs)("div",{className:"h-full flex flex-col border-2 border-gray-100 rounded-xl bg-white shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 border-b-2 border-gray-100 bg-gradient-to-r from-gray-50 to-gray-100",children:[(0,t.jsx)("button",{onClick:()=>{var t;let r,a;c(new Set((t=C.buildTree(e),r=[],a=e=>{e.children&&e.children.length>0&&(r.push(e.fullPath),e.children.forEach(a))},t.forEach(a),r)))},className:"px-4 py-1.5 text-sm font-medium bg-white border-2 border-blue-200 text-blue-600 rounded-lg hover:bg-blue-50 hover:border-blue-300 transition-all duration-200 shadow-sm hover:shadow-md",children:"すべて展開"}),(0,t.jsx)("button",{onClick:()=>{c(new Set)},className:"px-4 py-1.5 text-sm font-medium bg-white border-2 border-gray-200 text-gray-600 rounded-lg hover:bg-gray-50 hover:border-gray-300 transition-all duration-200 shadow-sm hover:shadow-md",children:"すべて閉じる"})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-3",children:h.map(e=>d(e))})]})}let P=i("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),O=i("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),T=i("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);function D({isOpen:e,currentPath:a,onSelect:s,onClose:l,multiSelect:o=!1,filterJsonOnly:i=!1,folderSelectMode:n=!1,title:c}){let[d,h]=(0,r.useState)(a),[u,m]=(0,r.useState)([]),[x,f]=(0,r.useState)(!1),[g,p]=(0,r.useState)([]);(0,r.useEffect)(()=>{e&&(h(a),p([]))},[e,a]),(0,r.useEffect)(()=>{e&&b(d)},[e,d]);let b=async e=>{f(!0);try{let t=await fetch("/api/files/browse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:e})}),r=await t.json();if(r.success){let e=r.data.items;n?e=r.data.items.filter(e=>"directory"===e.type):i&&(e=r.data.items.filter(e=>"directory"===e.type||".json"===e.extension)),m(e)}else console.error("API returned error:",r.error)}catch(e){console.error("Failed to load directory:",e)}finally{f(!1)}},y=()=>d.replace(/\\/g,"/").toLowerCase()!==a.replace(/\\/g,"/").toLowerCase(),j=()=>{p([]),l()};return e?(0,t.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:c||(n?"フォルダを選択":"ファイルを選択")}),(0,t.jsx)("button",{onClick:j,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 border-b bg-gray-50",children:[(0,t.jsx)("button",{onClick:()=>{if(!y())return;let e=d.replace(/\\/g,"/"),t=e.split("/").filter(e=>e);if(t.length>1){let r,s=t.slice(0,-1),l=(r=1===s.length&&s[0].includes(":")?s[0]+"/":s[0].includes(":")?s[0]+"/"+s.slice(1).join("/"):e.startsWith("/")?"/"+s.join("/"):s.join("/")).replace(/\\/g,"/").toLowerCase(),o=a.replace(/\\/g,"/").toLowerCase();(l.startsWith(o)||l===o)&&h(r)}else if(1===t.length&&!t[0].includes(":")){if("."===a.replace(/\\/g,"/").toLowerCase())return;h(".")}},disabled:!y(),className:`p-2 rounded flex-shrink-0 ${y()?"hover:bg-gray-200":"opacity-50 cursor-not-allowed"}`,title:y()?"上のディレクトリへ":"ルートディレクトリです",children:(0,t.jsx)(T,{className:"w-5 h-5"})}),(0,t.jsxs)("span",{className:"text-sm text-gray-600 flex-1 truncate",children:["パス: ",d]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:x?(0,t.jsx)("div",{className:"text-center text-gray-500",children:"読み込み中..."}):(0,t.jsx)("div",{className:"space-y-1",children:u.map(e=>{let r=g.includes(e.path);return(0,t.jsxs)("div",{onClick:()=>{"directory"===e.type?n?p([e.path]):h(e.path):o?p(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]):p([e.path])},onDoubleClick:()=>{"directory"===e.type&&(h(e.path),p([]))},className:`flex items-center gap-2 p-2 rounded cursor-pointer hover:bg-gray-100 ${r?"bg-blue-100":""}`,children:["directory"===e.type?(0,t.jsx)(P,{className:"w-5 h-5 text-blue-500"}):(0,t.jsx)(O,{className:"w-5 h-5 text-green-500"}),(0,t.jsx)("span",{className:"text-sm",children:e.name}),r&&(o||n)&&(0,t.jsx)("span",{className:"ml-auto text-blue-500",children:"✓"})]},e.path)})})}),(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-t",children:[n?(0,t.jsx)("div",{className:"text-sm text-gray-600",children:g.length>0?`選択中: ${g[0].split(/[/\\]/).pop()}`:`現在のフォルダ: ${d.split(/[/\\]/).pop()||d}`}):o&&g.length>0?(0,t.jsxs)("div",{className:"text-sm text-gray-600",children:[g.length,"件選択中"]}):null,(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto",children:[(0,t.jsx)("button",{onClick:j,className:"px-4 py-2 text-gray-600 hover:bg-gray-100 rounded",children:"キャンセル"}),(0,t.jsx)("button",{onClick:()=>{n?(s(g.length>0?g:[d]),p([]),l()):g.length>0&&(s(g),p([]),l())},disabled:!n&&0===g.length,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed",children:"選択"})]})]})]})}):null}let $={format:"html",autoExport:!0,fileName:"config-doc",outputDir:".config_doc/output"};function A({isOpen:e,onClose:a,onExport:s,currentSettings:l,rootPath:o="."}){let[i,n]=(0,r.useState)(l||$),[d,h]=(0,r.useState)(!1),[m,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>{l&&n(l)},[l]);let f=(0,r.useMemo)(()=>{let e=o.replace(/\//g,"\\"),t=i.outputDir?.trim()||"",r=i.fileName||"config-doc",a="markdown"===i.format||"markdown-table"===i.format?"md":"html";if(t){let s=t.replace(/\//g,"\\");return`${e}\\${s}\\${r}.${a}`}return`${e}\\${r}.${a}`},[i.format,i.fileName,i.outputDir,o]);if(!e)return null;let g=async()=>{h(!0);try{await s(i),a()}catch(e){console.error("Export failed:",e)}finally{h(!1)}};return(0,t.jsxs)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-6 border-b",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-800",children:"エクスポート設定"}),(0,t.jsx)("button",{onClick:a,className:"text-gray-400 hover:text-gray-600 transition-colors",children:(0,t.jsx)(u,{className:"w-5 h-5"})})]}),(0,t.jsxs)("div",{className:"p-6 space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"出力先フォルダ"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",value:i.outputDir||"",onChange:e=>n({...i,outputDir:e.target.value}),className:"flex-1 px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"(空欄でプロジェクトルート)"}),(0,t.jsx)("button",{type:"button",onClick:()=>x(!0),className:"px-3 py-2 border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500",title:"フォルダを選択",children:(0,t.jsx)(P,{className:"w-5 h-5 text-gray-500"})})]}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"相対パスを入力またはフォルダを選択(空欄でプロジェクトルート、チーム共有設定)"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"ファイル名"}),(0,t.jsx)("input",{type:"text",value:i.fileName??"",onChange:e=>n({...i,fileName:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"config-doc"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"拡張子なしのファイル名を指定します(空欄でconfig-doc、チーム共有設定)"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"出力形式"}),(0,t.jsxs)("select",{value:i.format,onChange:e=>n({...i,format:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[(0,t.jsx)("option",{value:"html",children:"HTML"}),(0,t.jsx)("option",{value:"markdown",children:"Markdown"}),(0,t.jsx)("option",{value:"markdown-table",children:"Markdown (テーブル形式)"})]}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"html"===i.format?"スタイル付きのHTMLファイルとして出力します":"markdown-table"===i.format?"Markdownテーブル形式で出力します(プロパティ名、説明、値、備考)":"テキストベースのMarkdownファイルとして出力します"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"出力先パス"}),(0,t.jsx)("div",{className:"px-3 py-2 bg-gray-50 border border-gray-300 rounded-md text-sm text-gray-700 font-mono break-all",children:f})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"flex items-center h-5",children:(0,t.jsx)("input",{id:"auto-export",type:"checkbox",checked:i.autoExport,onChange:e=>n({...i,autoExport:e.target.checked}),className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"})}),(0,t.jsxs)("div",{className:"ml-3",children:[(0,t.jsx)("label",{htmlFor:"auto-export",className:"text-sm font-medium text-gray-700 cursor-pointer",children:"保存時に自動エクスポート"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"ドキュメントを保存したときに自動的にHTMLファイルを更新します"})]})]}),i.lastExportedAt&&(0,t.jsx)("div",{className:"pt-4 border-t",children:(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["最終エクスポート: ",new Date(i.lastExportedAt).toLocaleString("ja-JP")]})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 p-6 border-t bg-gray-50 rounded-b-lg",children:[(0,t.jsx)("button",{onClick:a,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"キャンセル"}),(0,t.jsxs)("button",{onClick:g,disabled:d,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,t.jsx)(c,{className:"w-4 h-4"}),d?"エクスポート中...":"エクスポート"]})]})]}),(0,t.jsx)(D,{isOpen:m,currentPath:o,onSelect:e=>{if(e.length>0){let t=e[0],r=o.replace(/\\/g,"/"),a=t.replace(/\\/g,"/"),s=a;a.startsWith(r)&&(s=a.slice(r.length)).startsWith("/")&&(s=s.slice(1)),s||(s="."),n({...i,outputDir:s})}x(!1)},onClose:()=>x(!1),folderSelectMode:!0,title:"出力先フォルダを選択"})]})}let E=i("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),M=i("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),F=i("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);function z({message:e,type:a,duration:s=3e3,onClose:l}){let[o,i]=(0,r.useState)(!1);(0,r.useEffect)(()=>{setTimeout(()=>i(!0),10);let e=setTimeout(()=>{i(!1),setTimeout(l,300)},s);return()=>clearTimeout(e)},[s,l]);let n={success:(0,t.jsx)(E,{className:"w-5 h-5 text-green-500"}),error:(0,t.jsx)(M,{className:"w-5 h-5 text-red-500"}),warning:(0,t.jsx)(F,{className:"w-5 h-5 text-yellow-500"})};return(0,t.jsx)("div",{className:`fixed bottom-4 left-4 z-50 transition-all duration-300 ${o?"opacity-100 translate-y-0":"opacity-0 translate-y-2"}`,children:(0,t.jsxs)("div",{className:`flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg border ${{success:"bg-green-50 border-green-200",error:"bg-red-50 border-red-200",warning:"bg-yellow-50 border-yellow-200"}[a]} min-w-[300px] max-w-[500px]`,children:[n[a],(0,t.jsx)("span",{className:"flex-1 text-sm text-gray-800",children:e}),(0,t.jsx)("button",{onClick:()=>{i(!1),setTimeout(l,300)},className:"text-gray-400 hover:text-gray-600 transition-colors",children:(0,t.jsx)(u,{className:"w-4 h-4"})})]})})}function J({toasts:e,onRemove:r}){return(0,t.jsx)(t.Fragment,{children:e.map((e,a)=>(0,t.jsx)("div",{style:{bottom:`${16+80*a}px`},className:"fixed left-4 z-50",children:(0,t.jsx)(z,{message:e.message,type:e.type,onClose:()=>r(e.id)})},e.id))})}let L={説明:""};function H(e,t){return[...e].sort((e,r)=>{let a=t.indexOf(e),s=t.indexOf(r);return -1!==a&&-1!==s?a-s:-1===a?1:-1===s?-1:0})}function I(e,t){return e.length!==t.length||e.some((e,r)=>e!==t[r])}function B(){let[e,a]=(0,r.useState)(!1),[s,l]=(0,r.useState)(!1),{loadedConfigs:o,activeConfigIndex:i,activeConfig:c,selectedPath:h,editingDoc:u,originalDoc:x,hasUnsavedChanges:f,exportSettings:g,availableTags:p,projectFields:b,toasts:y,rootPath:j,setActiveConfigIndex:N,setEditingDoc:v,setHasUnsavedChanges:k,removeToast:C,handleSelectConfigFiles:P,handleRemoveConfig:O,handleReorderConfigs:T,handleSelectProperty:$,handleSaveProperty:E,handleExport:M,handleAvailableTagsChange:F,handleProjectFieldsChange:z,checkForChanges:B,resetSelection:W}=function(){let[e,t]=(0,r.useState)([]),[a,s]=(0,r.useState)(0),[l,o]=(0,r.useState)(""),[i,n]=(0,r.useState)(!1),[c,d]=(0,r.useState)("."),[h,u]=(0,r.useState)(null),[m,x]=(0,r.useState)(null),[f,g]=(0,r.useState)(!1),[p,b]=(0,r.useState)(),[y,j]=(0,r.useState)(["required","nullable","string","number","boolean"]),[N,w]=(0,r.useState)(L),[v,k]=(0,r.useState)([]),C=e[a],S=(0,r.useCallback)((e,t="success")=>{let r=Date.now().toString();k(a=>[...a,{id:r,message:e,type:t}])},[]),P=(0,r.useCallback)(e=>{k(t=>t.filter(t=>t.id!==e))},[]),O=(0,r.useCallback)((e,t)=>{if(!e||!t)return!1;let r=e.tags||[];if(I(t.tags||[],r))return!0;let a=e.fields||{};return!!function(e,t){for(let r of new Set([...Object.keys(e),...Object.keys(t)]))if((e[r]||"")!==(t[r]||""))return!0;return!1}(t.fields||{},a)},[]),T=(0,r.useCallback)((e,t)=>{let r=e.replace(/\\/g,"/"),a=t.replace(/\\/g,"/");if(!r.match(/^[a-zA-Z]:\//)&&!r.startsWith("/"))return e;if(r.startsWith(a)){let e=r.substring(a.length);return e.startsWith("/")?e.substring(1):e}return e},[]),D=(0,r.useCallback)(e=>{let t={};for(let r of Object.keys(N))t[r]=e.fields[r]||"";return{...e,fields:t}},[N]),$=(0,r.useCallback)(async e=>{try{let r=await fetch("/api/config/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e})}),a=await r.json();a.success&&t(t=>t.some(t=>t.filePath===e)?t:[...t,{filePath:e,configData:a.data.configData,docs:a.data.docs}])}catch(e){console.error("Failed to load config file:",e)}},[]),A=(0,r.useCallback)(async e=>{try{let t=await fetch("/api/config/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configFilePaths:e})}),r=await t.json();r.deletedDocsFiles&&r.deletedDocsFiles.length>0&&S(`${r.deletedDocsFiles.length}件のドキュメントファイルを削除しました`,"warning")}catch(e){console.error("Failed to update metadata:",e)}},[S]),E=(0,r.useCallback)(async()=>{if(p)try{if((await fetch("/api/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({format:p.format,fileName:p.fileName,outputDir:p.outputDir})})).ok){let e={...p,lastExportedAt:new Date().toISOString()};b(e),await fetch("/api/export/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:e})})}}catch(e){console.error("Auto export failed:",e)}},[p]);(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/project"),t=await e.json();if(t.success&&(d(t.data.rootPath),t.data.hasConfigDoc)){let e=await fetch("/api/config/metadata"),t=await e.json();if(t.success&&t.data?.configFiles)for(let e of t.data.configFiles)await $(e.filePath);t.success&&t.data?.availableTags&&j(t.data.availableTags),t.success&&t.data?.fields&&w(t.data.fields)}let r=await fetch("/api/export/settings"),a=await r.json();a.success&&b(a.data)}catch(e){console.error("Failed to load saved configs:",e)}finally{n(!0)}})()},[$]);let M=(0,r.useCallback)(async r=>{let a=[];for(let t of r){let r=T(t,c);if(!e.some(e=>e.filePath===r))try{let e=await fetch("/api/config/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:t})}),s=await e.json();s.success?a.push({filePath:r,configData:s.data.configData,docs:s.data.docs}):S(`設定ファイルの読み込みに失敗しました (${t}): ${s.error}`,"error")}catch(e){console.error("Failed to load config:",e),S(`設定ファイルの読み込み中にエラーが発生しました: ${t}`,"error")}}a.length>0&&t(e=>{let t=[...e,...a];return A(t.map(e=>e.filePath)),t})},[e,c,S,T,A]),F=(0,r.useCallback)(async r=>{let l=e[r];(!l.docs||!(Object.keys(l.docs.properties).length>0)||confirm("既に説明文が設定されていますが、削除してよろしいですか?"))&&(t(e=>{let t=e.filter((e,t)=>t!==r);return A(t.map(e=>e.filePath)),t}),a>=r&&a>0&&s(a-1),o(""),u(null),g(!1))},[a,e,A]),z=(0,r.useCallback)((e,r)=>{t(e),s(r),A(e.map(e=>e.filePath))},[A]),J=(0,r.useCallback)(e=>{if(f&&!confirm("保存されていない変更があります。破棄しますか?"))return;o(e);let t=C?.docs.properties[e];if(t){let e=D({...t,tags:t.tags||[]});u(e),x(e)}else{let t={path:e,tags:[],fields:{...N},modifiedAt:new Date().toISOString()};u(t),x(t)}g(!1)},[C,f,D,N]),B=(0,r.useCallback)(async()=>{if(h&&C)try{let e={...h,modifiedAt:new Date().toISOString()},r=await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configFilePath:C.filePath,propertyPath:l,propertyDoc:e})}),s=await r.json();s.success?(t(t=>t.map((t,r)=>r===a?{...t,docs:{...t.docs,properties:{...t.docs.properties,[l]:e}}}:t)),u(e),x(e),g(!1),S("保存しました"),p?.autoExport&&await E()):S("保存に失敗しました: "+s.error,"error")}catch(e){console.error("Failed to save:",e),S("保存中にエラーが発生しました","error")}},[C,a,h,p?.autoExport,E,l,S]),W=(0,r.useCallback)(async e=>{try{let t=await fetch("/api/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({format:e.format,fileName:e.fileName,outputDir:e.outputDir})}),r=await t.json();if(r.success){let t={...e,lastExportedAt:new Date().toISOString()};b(t),await fetch("/api/export/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:t})}),S(`エクスポートしました: ${r.outputPath}`)}else S("エクスポートに失敗しました: "+r.error,"error")}catch(e){console.error("Export failed:",e),S("エクスポート中にエラーが発生しました","error")}},[S]),R=(0,r.useCallback)(async r=>{let a=y.filter(e=>!r.includes(e));j(r),await fetch("/api/config/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({availableTags:r})});let s=a.length>0,l=y.some((e,t)=>e!==r[t])||y.length!==r.length;if(s||l){for(let s of e){let e=!1,l={...s.docs.properties};for(let[t,s]of Object.entries(l))if(s.tags&&s.tags.length>0){let o=H(s.tags.filter(e=>!a.includes(e)),r);I(s.tags,o)&&(l[t]={...s,tags:o},e=!0)}e&&(await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configFilePath:s.filePath,properties:l})}),t(e=>e.map(e=>e.filePath===s.filePath?{...e,docs:{...e.docs,properties:l}}:e)))}if(h&&h.tags&&h.tags.length>0){let e=H(h.tags.filter(e=>!a.includes(e)),r);if(I(h.tags,e)&&(u({...h,tags:e}),m&&m.tags)){let e=H(m.tags.filter(e=>!a.includes(e)),r);x({...m,tags:e})}}}},[y,h,e,m]),V=(0,r.useCallback)(async r=>{let a=Object.keys(N),s=Object.keys(r),l=a.filter(e=>!s.includes(e));for(let a of(w(r),await fetch("/api/config/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fields:r})}),e)){let e=!1,r={...a.docs.properties};for(let[t,a]of Object.entries(r))if(a.fields){let o=function(e,t){let r={};for(let a of t)r[a]=e[a]||"";return r}(a.fields,s),i=Object.keys(a.fields),n=i.some((e,t)=>e!==s[t]),c=l.some(e=>e in a.fields);(n||c||i.length!==s.length)&&(r[t]={...a,fields:o},e=!0)}e&&(await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configFilePath:a.filePath,properties:r})}),t(e=>e.map(e=>e.filePath===a.filePath?{...e,docs:{...e.docs,properties:r}}:e)))}if(m){let e={};for(let t of s)e[t]=m.fields?.[t]||"";x({...m,fields:e})}if(h){let e={};for(let t of s)e[t]=h.fields?.[t]||"";let t={...h,fields:e};u(t),g(O(t,m?{...m,fields:Object.fromEntries(s.map(e=>[e,m.fields?.[e]||""]))}:null))}},[O,h,e,m,N]),q=(0,r.useCallback)(()=>{o(""),u(null),g(!1)},[]);return{loadedConfigs:e,activeConfigIndex:a,activeConfig:C,selectedPath:l,editingDoc:h,originalDoc:m,hasUnsavedChanges:f,exportSettings:p,availableTags:y,projectFields:N,toasts:v,rootPath:c,isInitialized:i,setActiveConfigIndex:s,setSelectedPath:o,setEditingDoc:u,setHasUnsavedChanges:g,showToast:S,removeToast:P,loadConfigFile:$,handleSelectConfigFiles:M,handleRemoveConfig:F,handleReorderConfigs:z,handleSelectProperty:J,handleSaveProperty:B,handleExport:W,handleAvailableTagsChange:R,handleProjectFieldsChange:V,checkForChanges:O,resetSelection:q}}();return(0,t.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-indigo-50 to-purple-50",children:[(0,t.jsx)(d,{onExportClick:()=>l(!0)}),(0,t.jsxs)("main",{className:"container mx-auto px-6 py-8",children:[(0,t.jsx)(m,{loadedConfigs:o,activeConfigIndex:i,onTabClick:e=>{N(e),W()},onRemoveConfig:O,onAddFileClick:()=>a(!0),onReorder:T}),c&&(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,t.jsxs)("div",{className:"bg-white/90 backdrop-blur-sm rounded-2xl shadow-xl border border-gray-100 p-6 flex flex-col max-h-[calc(100vh-190px)] hover:shadow-2xl transition-shadow duration-300",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-purple-500 to-purple-600 rounded-lg flex items-center justify-center",children:(0,t.jsx)(n,{className:"w-5 h-5 text-white"})}),(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-800",children:"JSON構造"})]}),(0,t.jsx)("div",{className:"overflow-y-auto flex-1",children:(0,t.jsx)(S,{config:c.configData,docs:c.docs,onSelectProperty:$,onEditProperty:$,selectedPath:h})})]}),(0,t.jsx)(w,{selectedPath:h,editingDoc:u,hasUnsavedChanges:f,availableTags:p,projectFields:b,onEditingDocChange:e=>{v(e),k(B(e,x))},onAvailableTagsChange:F,onProjectFieldsChange:z,onSave:E})]})]}),(0,t.jsx)(D,{isOpen:e,currentPath:j,multiSelect:!0,filterJsonOnly:!0,onSelect:e=>{P(e),a(!1)},onClose:()=>a(!1)}),(0,t.jsx)(A,{isOpen:s,onClose:()=>l(!1),onExport:M,currentSettings:g,rootPath:j}),(0,t.jsx)(J,{toasts:y,onRemove:C})]})}e.s(["default",()=>B],31713)}]);
@@ -0,0 +1,3 @@
1
+ @font-face{font-family:Geist;font-style:normal;font-weight:100 900;font-display:swap;src:url(../media/8a480f0b521d4e75-s.8e0177b5.woff2)format("woff2");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist;font-style:normal;font-weight:100 900;font-display:swap;src:url(../media/7178b3e590c64307-s.b97b3418.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist;font-style:normal;font-weight:100 900;font-display:swap;src:url(../media/caa3a2e1cccd8315-s.p.853070df.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Fallback;src:local(Arial);ascent-override:95.94%;descent-override:28.16%;line-gap-override:0.0%;size-adjust:104.76%}.geist_a71539c9-module__T19VSG__className{font-family:Geist,Geist Fallback;font-style:normal}.geist_a71539c9-module__T19VSG__variable{--font-geist-sans:"Geist","Geist Fallback"}
2
+ @font-face{font-family:Geist Mono;font-style:normal;font-weight:100 900;font-display:swap;src:url(../media/4fa387ec64143e14-s.c1fdd6c2.woff2)format("woff2");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Mono;font-style:normal;font-weight:100 900;font-display:swap;src:url(../media/bbc41e54d2fcbd21-s.799d8ef8.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Mono;font-style:normal;font-weight:100 900;font-display:swap;src:url(../media/797e433ab948586e-s.p.dbea232f.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Mono Fallback;src:local(Arial);ascent-override:74.67%;descent-override:21.92%;line-gap-override:0.0%;size-adjust:134.59%}.geist_mono_8d43a2aa-module__8Li5zG__className{font-family:Geist Mono,Geist Mono Fallback;font-style:normal}.geist_mono_8d43a2aa-module__8Li5zG__variable{--font-geist-mono:"Geist Mono","Geist Mono Fallback"}
3
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--color-red-50:#fef2f2;--color-red-200:#ffcaca;--color-red-300:#ffa3a3;--color-red-400:#ff6568;--color-red-500:#fb2c36;--color-red-600:#e40014;--color-yellow-50:#fefce8;--color-yellow-200:#fff085;--color-yellow-500:#edb200;--color-green-50:#f0fdf4;--color-green-100:#dcfce7;--color-green-200:#b9f8cf;--color-green-300:#7bf1a8;--color-green-500:#00c758;--color-green-600:#00a544;--color-green-700:#008138;--color-emerald-600:#009767;--color-emerald-700:#007956;--color-blue-50:#eff6ff;--color-blue-100:#dbeafe;--color-blue-200:#bedbff;--color-blue-300:#90c5ff;--color-blue-400:#54a2ff;--color-blue-500:#3080ff;--color-blue-600:#155dfc;--color-blue-700:#1447e6;--color-indigo-50:#eef2ff;--color-indigo-100:#e0e7ff;--color-indigo-500:#625fff;--color-indigo-600:#4f39f6;--color-purple-50:#faf5ff;--color-purple-500:#ac4bff;--color-purple-600:#9810fa;--color-gray-50:#f9fafb;--color-gray-100:#f3f4f6;--color-gray-200:#e5e7eb;--color-gray-300:#d1d5dc;--color-gray-400:#99a1af;--color-gray-500:#6a7282;--color-gray-600:#4a5565;--color-gray-700:#364153;--color-gray-800:#1e2939;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--blur-sm:8px;--blur-md:12px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-geist-sans);--default-mono-font-family:var(--font-geist-mono)}@supports (color:lab(0% 0 0)){:root,:host{--color-red-50:lab(96.5005% 4.18511 1.52329);--color-red-200:lab(86.017% 19.8815 7.75869);--color-red-300:lab(76.5514% 36.4219 15.5335);--color-red-400:lab(63.7053% 60.7449 31.3109);--color-red-500:lab(55.4814% 75.0732 48.8528);--color-red-600:lab(48.4493% 77.4328 61.5452);--color-yellow-50:lab(98.6846% -1.79058 9.77662);--color-yellow-200:lab(94.3433% -5.00426 52.9663);--color-yellow-500:lab(76.3898% 14.5258 98.4589);--color-green-50:lab(98.1563% -5.60117 2.75913);--color-green-100:lab(96.186% -13.8464 6.52362);--color-green-200:lab(92.4222% -26.4702 12.9427);--color-green-300:lab(86.9953% -47.2691 25.0054);--color-green-500:lab(70.5521% -66.5147 45.8072);--color-green-600:lab(59.0978% -58.6621 41.2579);--color-green-700:lab(47.0329% -47.0239 31.4788);--color-emerald-600:lab(55.0481% -49.9246 15.93);--color-emerald-700:lab(44.4871% -41.0396 11.0361);--color-blue-50:lab(96.492% -1.14647 -5.11479);--color-blue-100:lab(92.0301% -2.24757 -11.6453);--color-blue-200:lab(86.15% -4.04379 -21.0797);--color-blue-300:lab(77.5052% -6.4629 -36.42);--color-blue-400:lab(65.0361% -1.42062 -56.9803);--color-blue-500:lab(54.1736% 13.3368 -74.6839);--color-blue-600:lab(44.0605% 29.0279 -86.0352);--color-blue-700:lab(36.9089% 35.0961 -85.6872);--color-indigo-50:lab(95.4818% .411302 -6.78529);--color-indigo-100:lab(91.6577% 1.04591 -12.7199);--color-indigo-500:lab(48.295% 38.3129 -81.9673);--color-indigo-600:lab(38.4009% 52.6132 -92.3857);--color-purple-50:lab(97.1626% 2.99937 -4.13398);--color-purple-500:lab(52.0183% 66.11 -78.2316);--color-purple-600:lab(43.0295% 75.21 -86.5669);--color-gray-50:lab(98.2596% -.247031 -.706708);--color-gray-100:lab(96.1596% -.082314 -1.13575);--color-gray-200:lab(91.6229% -.159085 -2.26791);--color-gray-300:lab(85.1236% -.612259 -3.7138);--color-gray-400:lab(65.9269% -.832707 -8.17474);--color-gray-500:lab(47.7841% -.393212 -10.0268);--color-gray-600:lab(35.6337% -1.58697 -10.8425);--color-gray-700:lab(27.1134% -.956401 -12.3224);--color-gray-800:lab(16.1051% -1.18239 -11.7533)}}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.bottom-4{bottom:calc(var(--spacing)*4)}.left-4{left:calc(var(--spacing)*4)}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.table{display:table}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-8{height:calc(var(--spacing)*8)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-full{height:100%}.max-h-\[80vh\]{max-height:80vh}.max-h-\[calc\(100vh-190px\)\]{max-height:calc(100vh - 190px)}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing)*3)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[200px\]{max-width:200px}.max-w-\[500px\]{max-width:500px}.max-w-md{max-width:var(--container-md)}.min-w-\[300px\]{min-width:300px}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-2{--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-6{gap:calc(var(--spacing)*6)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-400{border-color:var(--color-blue-400)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-600{border-color:var(--color-blue-600)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-green-200{border-color:var(--color-green-200)}.border-green-300{border-color:var(--color-green-300)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-transparent{border-color:#0000}.border-yellow-200{border-color:var(--color-yellow-200)}.bg-black{background-color:var(--color-black)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-600{background-color:var(--color-green-600)}.bg-red-50{background-color:var(--color-red-50)}.bg-white{background-color:var(--color-white)}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab, red, red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.bg-yellow-50{background-color:var(--color-yellow-50)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-100{--tw-gradient-from:var(--color-blue-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500{--tw-gradient-from:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-600{--tw-gradient-from:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-gray-50{--tw-gradient-from:var(--color-gray-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-gray-100{--tw-gradient-from:var(--color-gray-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500{--tw-gradient-from:var(--color-green-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-indigo-50{--tw-gradient-via:var(--color-indigo-50);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-600{--tw-gradient-to:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-emerald-600{--tw-gradient-to:var(--color-emerald-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-gray-100{--tw-gradient-to:var(--color-gray-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-gray-200{--tw-gradient-to:var(--color-gray-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-indigo-50{--tw-gradient-to:var(--color-indigo-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-indigo-100{--tw-gradient-to:var(--color-indigo-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-indigo-600{--tw-gradient-to:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-50{--tw-gradient-to:var(--color-purple-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-600{--tw-gradient-to:var(--color-purple-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-8{padding-block:calc(var(--spacing)*8)}.py-12{padding-block:calc(var(--spacing)*12)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.text-center{text-align:center}.font-mono{font-family:var(--font-geist-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.break-all{word-break:break-all}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-transparent{color:#0000}.text-white{color:var(--color-white)}.text-yellow-500{color:var(--color-yellow-500)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-100{opacity:1}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\:border-blue-300:hover{border-color:var(--color-blue-300)}.hover\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\:bg-blue-50:hover{background-color:var(--color-blue-50)}.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-gradient-to-r:hover{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.hover\:from-blue-600:hover{--tw-gradient-from:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\:from-gray-50:hover{--tw-gradient-from:var(--color-gray-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\:from-green-600:hover{--tw-gradient-from:var(--color-green-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\:to-blue-700:hover{--tw-gradient-to:var(--color-blue-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\:to-emerald-700:hover{--tw-gradient-to:var(--color-emerald-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\:to-gray-100:hover{--tw-gradient-to:var(--color-gray-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-gray-600:hover{color:var(--color-gray-600)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-red-500:hover{color:var(--color-red-500)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:shadow-2xl:hover{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:border-blue-400:focus{border-color:var(--color-blue-400)}.focus\:border-red-400:focus{border-color:var(--color-red-400)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-blue-200:focus{--tw-ring-color:var(--color-blue-200)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-red-200:focus{--tw-ring-color:var(--color-red-200)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-300:disabled{background-color:var(--color-gray-300)}.disabled\:opacity-50:disabled{opacity:.5}@media (min-width:64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}}:root{--background:#fff;--foreground:#171717}@media (prefers-color-scheme:dark){:root{--background:#0a0a0a;--foreground:#ededed}}body{background:var(--background);color:var(--foreground);font-family:Arial,Helvetica,sans-serif}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}
@@ -4,6 +4,12 @@ import { useState, useEffect, useCallback } from 'react';
4
4
  import { ConfigDocs, PropertyDoc, ExportSettings, DEFAULT_FIELDS } from '@/types';
5
5
  import { LoadedConfig } from '@/components/ConfigFileTabs';
6
6
  import { ToastType } from '@/components/Toast';
7
+ import {
8
+ sortTagsByOrder,
9
+ reorderFields,
10
+ detectTagChanges,
11
+ detectFieldChanges
12
+ } from '@/lib/configManagerUtils';
7
13
 
8
14
  interface Toast {
9
15
  id: string;
@@ -89,18 +95,12 @@ export function useConfigManager(): UseConfigManagerReturn {
89
95
  // タグの比較
90
96
  const currentTags = current.tags || [];
91
97
  const originalTags = original.tags || [];
92
- if (currentTags.length !== originalTags.length) return true;
93
- if (currentTags.some((tag, index) => tag !== originalTags[index])) return true;
98
+ if (detectTagChanges(originalTags, currentTags)) return true;
94
99
 
95
100
  // フィールドの比較
96
101
  const currentFields = current.fields || {};
97
102
  const originalFields = original.fields || {};
98
- const allKeys = new Set([...Object.keys(currentFields), ...Object.keys(originalFields)]);
99
- for (const key of allKeys) {
100
- const currentValue = currentFields[key] || '';
101
- const originalValue = originalFields[key] || '';
102
- if (currentValue !== originalValue) return true;
103
- }
103
+ if (detectFieldChanges(originalFields, currentFields)) return true;
104
104
 
105
105
  return false;
106
106
  }, []);
@@ -456,6 +456,8 @@ export function useConfigManager(): UseConfigManagerReturn {
456
456
  // 利用可能なタグを更新
457
457
  const handleAvailableTagsChange = useCallback(async (tags: string[]) => {
458
458
  const removedTags = availableTags.filter(tag => !tags.includes(tag));
459
+ const oldTagOrder = availableTags;
460
+ const newTagOrder = tags;
459
461
 
460
462
  setAvailableTags(tags);
461
463
  await fetch('/api/config/metadata', {
@@ -464,15 +466,28 @@ export function useConfigManager(): UseConfigManagerReturn {
464
466
  body: JSON.stringify({ availableTags: tags })
465
467
  });
466
468
 
467
- if (removedTags.length > 0) {
469
+ // タグの削除または順序変更がある場合、すべてのドキュメントを更新
470
+ const hasRemovedTags = removedTags.length > 0;
471
+ const hasOrderChanged = oldTagOrder.some((tag, idx) => tag !== newTagOrder[idx]) ||
472
+ oldTagOrder.length !== newTagOrder.length;
473
+
474
+ if (hasRemovedTags || hasOrderChanged) {
468
475
  for (const config of loadedConfigs) {
469
476
  let hasChanges = false;
470
477
  const updatedProperties = { ...config.docs.properties };
471
478
 
472
479
  for (const [propPath, doc] of Object.entries(updatedProperties)) {
473
480
  if (doc.tags && doc.tags.length > 0) {
474
- const updatedTags = doc.tags.filter(tag => !removedTags.includes(tag));
475
- if (updatedTags.length !== doc.tags.length) {
481
+ // 削除されたタグを除外
482
+ const filteredTags = doc.tags.filter(tag => !removedTags.includes(tag));
483
+
484
+ // availableTagsの順序でソート
485
+ const updatedTags = sortTagsByOrder(filteredTags, newTagOrder);
486
+
487
+ // タグの内容または順序が変わったかチェック
488
+ const tagsChanged = detectTagChanges(doc.tags, updatedTags);
489
+
490
+ if (tagsChanged) {
476
491
  updatedProperties[propPath] = { ...doc, tags: updatedTags };
477
492
  hasChanges = true;
478
493
  }
@@ -497,13 +512,20 @@ export function useConfigManager(): UseConfigManagerReturn {
497
512
  }
498
513
  }
499
514
 
500
- if (editingDoc && editingDoc.tags) {
501
- const updatedEditingTags = editingDoc.tags.filter(tag => !removedTags.includes(tag));
502
- if (updatedEditingTags.length !== editingDoc.tags.length) {
515
+ // 編集中のドキュメントも更新
516
+ if (editingDoc && editingDoc.tags && editingDoc.tags.length > 0) {
517
+ const filteredEditingTags = editingDoc.tags.filter(tag => !removedTags.includes(tag));
518
+ const updatedEditingTags = sortTagsByOrder(filteredEditingTags, newTagOrder);
519
+
520
+ const tagsChanged = detectTagChanges(editingDoc.tags, updatedEditingTags);
521
+
522
+ if (tagsChanged) {
503
523
  const updated = { ...editingDoc, tags: updatedEditingTags };
504
524
  setEditingDoc(updated);
505
- if (originalDoc) {
506
- const updatedOriginalTags = (originalDoc.tags || []).filter(tag => !removedTags.includes(tag));
525
+
526
+ if (originalDoc && originalDoc.tags) {
527
+ const filteredOriginalTags = originalDoc.tags.filter(tag => !removedTags.includes(tag));
528
+ const updatedOriginalTags = sortTagsByOrder(filteredOriginalTags, newTagOrder);
507
529
  setOriginalDoc({ ...originalDoc, tags: updatedOriginalTags });
508
530
  }
509
531
  }
@@ -524,46 +546,44 @@ export function useConfigManager(): UseConfigManagerReturn {
524
546
  body: JSON.stringify({ fields })
525
547
  });
526
548
 
527
- if (removedFields.length > 0) {
528
- for (const config of loadedConfigs) {
529
- let hasChanges = false;
530
- const updatedProperties = { ...config.docs.properties };
531
-
532
- for (const [propPath, doc] of Object.entries(updatedProperties)) {
533
- if (doc.fields) {
534
- const updatedFields = { ...doc.fields };
535
- let fieldRemoved = false;
536
-
537
- for (const removedField of removedFields) {
538
- if (removedField in updatedFields) {
539
- delete updatedFields[removedField];
540
- fieldRemoved = true;
541
- }
542
- }
543
-
544
- if (fieldRemoved) {
545
- updatedProperties[propPath] = { ...doc, fields: updatedFields };
546
- hasChanges = true;
547
- }
549
+ // すべての設定ファイルのドキュメントを更新
550
+ // フィールドの削除または順序変更に対応
551
+ for (const config of loadedConfigs) {
552
+ let hasChanges = false;
553
+ const updatedProperties = { ...config.docs.properties };
554
+
555
+ for (const [propPath, doc] of Object.entries(updatedProperties)) {
556
+ if (doc.fields) {
557
+ // 新しいフィールド定義の順序で再構築
558
+ const reorderedDocFields = reorderFields(doc.fields, newFieldKeys);
559
+
560
+ // 順序が変わったか、削除されたフィールドがあるかチェック
561
+ const oldKeys = Object.keys(doc.fields);
562
+ const orderChanged = oldKeys.some((key, idx) => key !== newFieldKeys[idx]);
563
+ const hasRemovedFields = removedFields.some(field => field in doc.fields);
564
+
565
+ if (orderChanged || hasRemovedFields || oldKeys.length !== newFieldKeys.length) {
566
+ updatedProperties[propPath] = { ...doc, fields: reorderedDocFields };
567
+ hasChanges = true;
548
568
  }
549
569
  }
570
+ }
550
571
 
551
- if (hasChanges) {
552
- await fetch('/api/config/save', {
553
- method: 'POST',
554
- headers: { 'Content-Type': 'application/json' },
555
- body: JSON.stringify({
556
- configFilePath: config.filePath,
557
- properties: updatedProperties
558
- })
559
- });
572
+ if (hasChanges) {
573
+ await fetch('/api/config/save', {
574
+ method: 'POST',
575
+ headers: { 'Content-Type': 'application/json' },
576
+ body: JSON.stringify({
577
+ configFilePath: config.filePath,
578
+ properties: updatedProperties
579
+ })
580
+ });
560
581
 
561
- setLoadedConfigs(prev => prev.map(c =>
562
- c.filePath === config.filePath
563
- ? { ...c, docs: { ...c.docs, properties: updatedProperties } }
564
- : c
565
- ));
566
- }
582
+ setLoadedConfigs(prev => prev.map(c =>
583
+ c.filePath === config.filePath
584
+ ? { ...c, docs: { ...c.docs, properties: updatedProperties } }
585
+ : c
586
+ ));
567
587
  }
568
588
  }
569
589
 
@@ -0,0 +1,84 @@
1
+ /**
2
+ * ConfigManager用の純粋関数ユーティリティ
3
+ * テスト可能性を向上させるために抽出された関数群
4
+ */
5
+
6
+ /**
7
+ * availableTagsOrderで定義された順序でタグをソート
8
+ * availableTagsOrderに含まれないタグは末尾に配置される
9
+ */
10
+ export function sortTagsByOrder(
11
+ tags: string[],
12
+ availableTagsOrder: string[]
13
+ ): string[] {
14
+ return [...tags].sort((a, b) => {
15
+ const indexA = availableTagsOrder.indexOf(a);
16
+ const indexB = availableTagsOrder.indexOf(b);
17
+
18
+ // 両方のタグが順序リストに含まれている場合
19
+ if (indexA !== -1 && indexB !== -1) {
20
+ return indexA - indexB;
21
+ }
22
+
23
+ // タグaが順序リストにない場合は末尾に配置
24
+ if (indexA === -1) return 1;
25
+
26
+ // タグbが順序リストにない場合は末尾に配置
27
+ if (indexB === -1) return -1;
28
+
29
+ return 0;
30
+ });
31
+ }
32
+
33
+ /**
34
+ * newFieldKeysの順序でフィールドを並び替え
35
+ * 指定された順序で新しいオブジェクトを作成
36
+ * 存在しないフィールドは空文字列で初期化される
37
+ */
38
+ export function reorderFields(
39
+ fields: Record<string, string>,
40
+ newFieldKeys: string[]
41
+ ): Record<string, string> {
42
+ const reordered: Record<string, string> = {};
43
+
44
+ for (const key of newFieldKeys) {
45
+ reordered[key] = fields[key] || '';
46
+ }
47
+
48
+ return reordered;
49
+ }
50
+
51
+ /**
52
+ * タグが変更されたか検出(順序または内容)
53
+ */
54
+ export function detectTagChanges(
55
+ oldTags: string[],
56
+ newTags: string[]
57
+ ): boolean {
58
+ if (oldTags.length !== newTags.length) {
59
+ return true;
60
+ }
61
+
62
+ return oldTags.some((tag, idx) => tag !== newTags[idx]);
63
+ }
64
+
65
+ /**
66
+ * フィールドが変更されたか検出(値またはキー)
67
+ */
68
+ export function detectFieldChanges(
69
+ oldFields: Record<string, string>,
70
+ newFields: Record<string, string>
71
+ ): boolean {
72
+ const allKeys = new Set([
73
+ ...Object.keys(oldFields),
74
+ ...Object.keys(newFields)
75
+ ]);
76
+
77
+ for (const key of allKeys) {
78
+ if ((oldFields[key] || '') !== (newFields[key] || '')) {
79
+ return true;
80
+ }
81
+ }
82
+
83
+ return false;
84
+ }