import{n as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";import{n}from"./iframe-GrlyTB2d.js";import{D as r,E as i,O as a,k as o}from"./odata-BPGjAOCV.js";function s(e,t){return Array.from({length:t},(t,n)=>{let r=e+n;return{code:`P${String(r).padStart(4,`0`)}`,text:`Ответственный ${r}`}})}var c,l;function u(){return(u=e((()=>{c=[{code:`R01`,text:`Северный регион`,branches:[{code:`B0101`,text:`Подразделение Альфа`,teams:[{code:`T0101`,text:`Команда поддержки`,owners:s(1,8)},{code:`T0102`,text:`Команда внедрения`,owners:s(9,6)},{code:`T0103`,text:`Команда инфраструктуры`,owners:s(15,5)}]},{code:`B0102`,text:`Подразделение Бета`,teams:[{code:`T0201`,text:`Команда аналитики`,owners:s(20,6)},{code:`T0202`,text:`Проектный офис`,owners:s(26,5)}]}]},{code:`R02`,text:`Южный регион`,branches:[{code:`B0201`,text:`Подразделение Гамма`,teams:[{code:`T0301`,text:`Команда сопровождения`,owners:s(31,6)},{code:`T0302`,text:`Команда продаж`,owners:s(37,5)}]},{code:`B0202`,text:`Подразделение Логистика`,teams:[{code:`T0401`,text:`Команда логистики`,owners:s(42,5)}]}]},{code:`R03`,text:`Восточный регион`,branches:[{code:`B0301`,text:`Подразделение Дельта`,teams:[{code:`T0501`,text:`Команда развития`,owners:s(47,6)},{code:`T0502`,text:`Команда архитектуры`,owners:s(53,5)}]},{code:`B0302`,text:`Подразделение Омега`,teams:[{code:`T0601`,text:`Команда качества`,owners:s(58,5)}]}]},{code:`R04`,text:`Западный регион`,branches:[{code:`B0401`,text:`Подразделение Сигма`,teams:[{code:`T0701`,text:`Финансовая команда`,owners:s(63,5)},{code:`T0702`,text:`Команда по работе с клиентами`,owners:s(68,5)}]}]}],l=c.flatMap(e=>e.branches.flatMap(t=>t.teams.flatMap(n=>n.owners.map(r=>({REGION:e.code,REGION_Text:e.text,BRANCH:t.code,BRANCH_Text:t.text,TEAM:n.code,TEAM_Text:n.text,OWNER:r.code,OWNER_Text:r.text})))))})))()}function d(e,t,n=200){return new Response(e,{status:n,headers:{"Content-Type":t}})}function f(e,t){return new Promise((n,r)=>{let i=()=>{window.clearTimeout(a),r(t?.reason??new DOMException(`Ожидание OData mock отменено`,`AbortError`))},a=window.setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);if(t?.aborted){i();return}t?.addEventListener(`abort`,i,{once:!0})})}function p(e,t){for(let n of t.values())if(e.includes(`/${n.service}/`))return n}function m(){let e=window.fetch,t=new Map;return{originalFetch:e,registrations:t,registrationIdsByCanvas:new WeakMap,mockedFetch:async(n,r)=>{let i=typeof n==`string`?n:n instanceof URL?n.toString():n.url,a=new URL(i,window.location.origin).pathname,o=p(a,t);return o?(o.mode===`loading`&&await f(1200,r?.signal??(typeof Request<`u`&&n instanceof Request?n.signal:void 0)),a.endsWith(`/${o.service}/$metadata`)?o.mode===`metadataError`?d(`Ошибка чтения metadata`,`text/plain`,500):d(b,`application/xml`):a.endsWith(`/${o.service}/DemoReferenceItems`)?o.mode===`collectionError`?d(JSON.stringify({error:`Ошибка загрузки справочника`}),`application/json`,500):d(JSON.stringify({d:{results:l}}),`application/json`):e(n,r)):e(n,r)}}}function h(e){let t=e.parameters.odataMockMode??`success`,n=w??m(),r=(e.canvasElement&&n.registrationIdsByCanvas.get(e.canvasElement))??Symbol(`odata-story-fetch-mock`),i=Symbol(`odata-story-fetch-mock-version`);return w=n,e.canvasElement&&n.registrationIdsByCanvas.set(e.canvasElement,r),n.registrations.delete(r),n.registrations.set(r,{mode:t,service:C[t],version:i}),window.fetch=n.mockedFetch,()=>{n.registrations.get(r)?.version===i&&(n.registrations.delete(r),e.canvasElement&&n.registrationIdsByCanvas.delete(e.canvasElement),!(n.registrations.size>0||w!==n)&&(window.fetch===n.mockedFetch&&(window.fetch=n.originalFetch),w=void 0))}}var g,_,v,y,b,x,S,C,w,T,E,D,O,k;function A(){return(A=e((()=>{g=t(),o(),r(),u(),_=n(),v=`DEMO_REFERENCE_SRV`,y=`DemoReferenceItems`,b=`<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
	<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0">
		<Schema Namespace="DEMO_REFERENCE_SRV" xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:sap="http://www.sap.com/Protocols/SAPData">
			<EntityType Name="DemoReferenceItemsType" sap:semantics="aggregate" sap:label="Демо-справочник" sap:content-version="1">
				<Key>
					<PropertyRef Name="ID" />
				</Key>
				<Property Name="ID" Type="Edm.String" Nullable="false" sap:sortable="false" sap:filterable="false" />
				<Property Name="REGION" Type="Edm.String" MaxLength="4" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="REGION_Text" />
				<Property Name="REGION_Text" Type="Edm.String" MaxLength="40" sap:label="Регион" sap:quickinfo="Краткое описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="BRANCH" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="BRANCH_Text" />
				<Property Name="BRANCH_Text" Type="Edm.String" MaxLength="40" sap:label="Подразделение" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="TEAM" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="TEAM_Text" />
				<Property Name="TEAM_Text" Type="Edm.String" MaxLength="40" sap:label="Команда" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="OWNER" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="OWNER_Text" />
				<Property Name="OWNER_Text" Type="Edm.String" MaxLength="40" sap:label="Ответственный" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="CNT" Type="Edm.Byte" sap:aggregation-role="measure" sap:filterable="false" />
			</EntityType>
			<EntityContainer Name="DEMO_REFERENCE_SRV_Entities" m:IsDefaultEntityContainer="true">
				<EntitySet Name="DemoReferenceItems" EntityType="DEMO_REFERENCE_SRV.DemoReferenceItemsType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1" />
			</EntityContainer>
		</Schema>
	</edmx:DataServices>
</edmx:Edmx>`,x={region:`R01`,regionText:`Северный регион`,branch:`B0101`,branchAlt:`B0102`,team:`T0101`,teamAlt:`T0201`,owner:`P0001`,ownerAlt:`P0006`},S={REGION:{placeholder:`Регион`},BRANCH:{placeholder:`Подразделение`,hideCode:!0},TEAM:{placeholder:`Команда`},OWNER:{placeholder:`Ответственный`}},C={success:v,loading:`DEMO_REFERENCE_LOADING_SRV`,metadataError:`DEMO_REFERENCE_METADATA_ERROR_SRV`,collectionError:`DEMO_REFERENCE_COLLECTION_ERROR_SRV`},T=e=>{let t=(0,g.useMemo)(()=>new a({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}}),[]),n=e;return(0,g.useEffect)(()=>()=>{t.clear()},[t]),(0,_.jsx)(i,{client:t,children:(0,_.jsx)(n,{})})},E={service:v,target:y},D={success:E,loading:{...E,service:C.loading},metadataError:{...E,service:C.metadataError},collectionError:{...E,service:C.collectionError}},O={codeKey:`REGION`,minSearchTextLength:1,minSearchCodeLength:1,searchDebounceDelay:250,maxVisibleItems:100},k={placeholder:`Регион`},T.__docgenInfo={description:`Создаёт изолированный QueryClient без IndexedDB persistence для каждой OData story.`,methods:[],displayName:`withODataStoryQueryClient`}})))()}export{h as a,S as c,A as i,T as l,E as n,D as o,k as r,x as s,O as t};